Mercurial > emacs
comparison src/mocklisp.c @ 40659:7e3c616777d3 raeburn-tag-7-for-export
(Fml_defun, Fml_while, Fml_substr): Remove commented and #ifdef'd-out code.
Fix and reindent comments.
author | Pavel Janík <Pavel@Janik.cz> |
---|---|
date | Fri, 02 Nov 2001 22:37:31 +0000 |
parents | cdfd4d09b79a |
children |
comparison
equal
deleted
inserted
replaced
40658:ec60cd36c995 | 40659:7e3c616777d3 |
---|---|
23 | 23 |
24 #include <config.h> | 24 #include <config.h> |
25 #include "lisp.h" | 25 #include "lisp.h" |
26 #include "buffer.h" | 26 #include "buffer.h" |
27 | 27 |
28 /* Now in lisp code ("macrocode...") | |
29 * DEFUN ("ml-defun", Fml_defun, Sml_defun, 0, UNEVALLED, 0, | |
30 * "Define mocklisp functions") | |
31 * (args) | |
32 * Lisp_Object args; | |
33 * { | |
34 * Lisp_Object elt; | |
35 * | |
36 * while (!NILP (args)) | |
37 * { | |
38 * elt = Fcar (args); | |
39 * Ffset (Fcar (elt), Fcons (Qmocklisp, Fcdr (elt))); | |
40 * args = Fcdr (args); | |
41 * } | |
42 * return Qnil; | |
43 * } | |
44 */ | |
45 | |
46 DEFUN ("ml-if", Fml_if, Sml_if, 0, UNEVALLED, 0, | 28 DEFUN ("ml-if", Fml_if, Sml_if, 0, UNEVALLED, 0, |
47 doc: /* Mocklisp version of `if'. | 29 doc: /* Mocklisp version of `if'. |
48 usage: (ml-if COND THEN ELSE...) */) | 30 usage: (ml-if COND THEN ELSE...) */) |
49 (args) | 31 (args) |
50 Lisp_Object args; | 32 Lisp_Object args; |
68 } | 50 } |
69 UNGCPRO; | 51 UNGCPRO; |
70 return val; | 52 return val; |
71 } | 53 } |
72 | 54 |
73 #if 0 /* Now converted to regular "while" by hairier conversion code. */ | |
74 /**/DEFUN ("ml-while", Fml_while, Sml_while, 1, UNEVALLED, 0, "while for mocklisp programs") | |
75 (args) | |
76 Lisp_Object args; | |
77 { | |
78 Lisp_Object test, body, tem; | |
79 struct gcpro gcpro1, gcpro2; | |
80 | |
81 GCPRO2 (test, body); | |
82 | |
83 test = Fcar (args); | |
84 body = Fcdr (args); | |
85 while (tem = Feval (test), XINT (tem)) | |
86 { | |
87 QUIT; | |
88 Fprogn (body); | |
89 } | |
90 | |
91 UNGCPRO; | |
92 return Qnil; | |
93 } | |
94 #endif | |
95 | 55 |
96 /* This is the main entry point to mocklisp execution. | 56 /* This is the main entry point to mocklisp execution. |
97 When eval sees a mocklisp function being called, it calls here | 57 When eval sees a mocklisp function being called, it calls here |
98 with the unevaluated argument list */ | 58 with the unevaluated argument list. */ |
99 | 59 |
100 Lisp_Object | 60 Lisp_Object |
101 ml_apply (function, args) | 61 ml_apply (function, args) |
102 Lisp_Object function, args; | 62 Lisp_Object function, args; |
103 { | 63 { |
179 Fprogn (args); | 139 Fprogn (args); |
180 UNGCPRO; | 140 UNGCPRO; |
181 return Qnil; | 141 return Qnil; |
182 } | 142 } |
183 | 143 |
184 #if 0 /* Now in mlsupport.el */ | |
185 | |
186 DEFUN ("ml-substr", Fml_substr, Sml_substr, 3, 3, 0, | |
187 doc: /* Return a substring of STRING, starting at index FROM and of length LENGTH. | |
188 If either FROM or LENGTH is negative, the length of STRING is added to it. */) | |
189 (string, from, to) | |
190 Lisp_Object string, from, to; | |
191 { | |
192 CHECK_STRING (string); | |
193 CHECK_NUMBER (from); | |
194 CHECK_NUMBER (to); | |
195 | |
196 if (XINT (from) < 0) | |
197 XSETINT (from, XINT (from) + XSTRING (string)->size); | |
198 if (XINT (to) < 0) | |
199 XSETINT (to, XINT (to) + XSTRING (string)->size); | |
200 XSETINT (to, XINT (to) + XINT (from)); | |
201 return Fsubstring (string, from, to); | |
202 } | |
203 #endif /* 0 */ | |
204 DEFUN ("insert-string", Finsert_string, Sinsert_string, 0, MANY, 0, | 144 DEFUN ("insert-string", Finsert_string, Sinsert_string, 0, MANY, 0, |
205 doc: /* Mocklisp-compatibility insert function. | 145 doc: /* Mocklisp-compatibility insert function. |
206 Like the function `insert' except that any argument that is a number | 146 Like the function `insert' except that any argument that is a number |
207 is converted into a string by expressing it in decimal. | 147 is converted into a string by expressing it in decimal. |
208 usage: (insert-string &rest ARGS) */) | 148 usage: (insert-string &rest ARGS) */) |
236 syms_of_mocklisp () | 176 syms_of_mocklisp () |
237 { | 177 { |
238 Qmocklisp = intern ("mocklisp"); | 178 Qmocklisp = intern ("mocklisp"); |
239 staticpro (&Qmocklisp); | 179 staticpro (&Qmocklisp); |
240 | 180 |
241 /*defsubr (&Sml_defun);*/ | |
242 defsubr (&Sml_if); | 181 defsubr (&Sml_if); |
243 /*defsubr (&Sml_while);*/ | |
244 defsubr (&Sml_arg); | 182 defsubr (&Sml_arg); |
245 defsubr (&Sml_nargs); | 183 defsubr (&Sml_nargs); |
246 defsubr (&Sml_interactive); | 184 defsubr (&Sml_interactive); |
247 defsubr (&Sml_provide_prefix_argument); | 185 defsubr (&Sml_provide_prefix_argument); |
248 defsubr (&Sml_prefix_argument_loop); | 186 defsubr (&Sml_prefix_argument_loop); |
249 /*defsubr (&Sml_substr);*/ | |
250 defsubr (&Sinsert_string); | 187 defsubr (&Sinsert_string); |
251 } | 188 } |