annotate src/mocklisp.c @ 5069:47cc31b47402

(read_minibuf): History list always gets strings, not Lisp objects made by read.
author Richard M. Stallman <rms@gnu.org>
date Fri, 19 Nov 1993 17:44:23 +0000
parents 1fc792473491
children 0c3c25c2456e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 /* Mocklisp compatibility functions for GNU Emacs Lisp interpreter.
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2 Copyright (C) 1985, 1986 Free Software Foundation, Inc.
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4 This file is part of GNU Emacs.
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 the Free Software Foundation; either version 1, or (at your option)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 any later version.
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 GNU General Public License for more details.
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 /* Compatibility for mocklisp */
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22
4696
1fc792473491 Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents: 2429
diff changeset
23 #include <config.h>
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 #include "lisp.h"
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 #include "buffer.h"
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 /* Now in lisp code ("macrocode...")
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 * DEFUN ("ml-defun", Fml_defun, Sml_defun, 0, UNEVALLED, 0,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 * "Define mocklisp functions")
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 * (args)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 * Lisp_Object args;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 * {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 * Lisp_Object elt;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 *
484
3165b2697c78 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 311
diff changeset
35 * while (!NILP (args))
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 * {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 * elt = Fcar (args);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 * Ffset (Fcar (elt), Fcons (Qmocklisp, Fcdr (elt)));
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 * args = Fcdr (args);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 * }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 * return Qnil;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 * }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 */
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 DEFUN ("ml-if", Fml_if, Sml_if, 0, UNEVALLED, 0, "Mocklisp version of `if'.")
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 (args)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 Lisp_Object args;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 register Lisp_Object val;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 struct gcpro gcpro1;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 GCPRO1 (args);
484
3165b2697c78 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 311
diff changeset
53 while (!NILP (args))
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 val = Feval (Fcar (args));
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 args = Fcdr (args);
484
3165b2697c78 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 311
diff changeset
57 if (NILP (args)) break;
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 if (XINT (val))
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 val = Feval (Fcar (args));
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 break;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 args = Fcdr (args);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 UNGCPRO;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 return val;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 /* Now converted to regular "while" by hairier conversion code.
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 * DEFUN ("ml-while", Fml_while, Sml_while, 1, UNEVALLED, 0, "while for mocklisp programs")
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 * (args)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 * Lisp_Object args;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 * {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 * Lisp_Object test, body, tem;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 * struct gcpro gcpro1, gcpro2;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 *
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 * GCPRO2 (test, body);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 *
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 * test = Fcar (args);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 * body = Fcdr (args);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 * while (tem = Feval (test), XINT (tem))
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 * {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 * QUIT;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 * Fprogn (body);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 * }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 *
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 * UNGCPRO;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 * return Qnil;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 *}
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 /* This is the main entry point to mocklisp execution.
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 When eval sees a mocklisp function being called, it calls here
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 with the unevaluated argument list */
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 Lisp_Object
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 ml_apply (function, args)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 Lisp_Object function, args;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 register int count = specpdl_ptr - specpdl;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 register Lisp_Object val;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 specbind (Qmocklisp_arguments, args);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 val = Fprogn (Fcdr (function));
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 return unbind_to (count, val);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 DEFUN ("ml-nargs", Fml_nargs, Sml_nargs, 0, 0, 0,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 "Number of arguments to currently executing mocklisp function.")
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 ()
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 if (EQ (Vmocklisp_arguments, Qinteractive))
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 return make_number (0);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 return Flength (Vmocklisp_arguments);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 DEFUN ("ml-arg", Fml_arg, Sml_arg, 1, 2, 0,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 "Argument number N to currently executing mocklisp function.")
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 (n, prompt)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 Lisp_Object n, prompt;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 if (EQ (Vmocklisp_arguments, Qinteractive))
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 return Fread_string (prompt, Qnil);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 CHECK_NUMBER (n, 0);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 XSETINT (n, XINT (n) - 1); /* Mocklisp likes to be origin-1 */
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 return Fcar (Fnthcdr (n, Vmocklisp_arguments));
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 DEFUN ("ml-interactive", Fml_interactive, Sml_interactive, 0, 0, 0,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 "True if currently executing mocklisp function was called interactively.")
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 ()
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 return (EQ (Vmocklisp_arguments, Qinteractive)) ? Qt : Qnil;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 DEFUN ("ml-provide-prefix-argument", Fml_provide_prefix_argument, Sml_provide_prefix_argument,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 2, UNEVALLED, 0,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 "Evaluate second argument, using first argument as prefix arg value.")
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 (args)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 Lisp_Object args;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 struct gcpro gcpro1;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 GCPRO1 (args);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 Vcurrent_prefix_arg = Feval (Fcar (args));
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 UNGCPRO;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 return Feval (Fcar (Fcdr (args)));
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 DEFUN ("ml-prefix-argument-loop", Fml_prefix_argument_loop, Sml_prefix_argument_loop,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 0, UNEVALLED, 0,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 "")
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 (args)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 Lisp_Object args;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 register Lisp_Object tem;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 register int i;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 struct gcpro gcpro1;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 /* Set `arg' in case we call a built-in function that looks at it. Still are a few. */
484
3165b2697c78 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 311
diff changeset
159 if (NILP (Vcurrent_prefix_arg))
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 i = 1;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 else
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 tem = Vcurrent_prefix_arg;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 if (CONSP (tem))
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 tem = Fcar (tem);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 if (EQ (tem, Qminus))
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 i = -1;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 else i = XINT (tem);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 GCPRO1 (args);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 while (i-- > 0)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 Fprogn (args);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 UNGCPRO;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 return Qnil;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 #if 0 /* Now in mlsupport.el */
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 DEFUN ("ml-substr", Fml_substr, Sml_substr, 3, 3, 0,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 "Return a substring of STRING, starting at index FROM and of length LENGTH.\n\
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 If either FROM or LENGTH is negative, the length of STRING is added to it.")
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 (string, from, to)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 Lisp_Object string, from, to;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 CHECK_STRING (string, 0);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 CHECK_NUMBER (from, 1);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 CHECK_NUMBER (to, 2);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 if (XINT (from) < 0)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 XSETINT (from, XINT (from) + XSTRING (string)->size);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 if (XINT (to) < 0)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 XSETINT (to, XINT (to) + XSTRING (string)->size);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 XSETINT (to, XINT (to) + XINT (from));
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 return Fsubstring (string, from, to);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 }
1011
a7f08730f7ae * mocklisp.c (Fml_substr): Put comments around text following #endif.
Jim Blandy <jimb@redhat.com>
parents: 484
diff changeset
197 #endif /* 0 */
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 DEFUN ("insert-string", Finsert_string, Sinsert_string, 0, MANY, 0,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 "Mocklisp-compatibility insert function.\n\
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 Like the function `insert' except that any argument that is a number\n\
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 is converted into a string by expressing it in decimal.")
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 (nargs, args)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 int nargs;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 Lisp_Object *args;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 register int argnum;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 register Lisp_Object tem;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 for (argnum = 0; argnum < nargs; argnum++)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 tem = args[argnum];
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 retry:
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 if (XTYPE (tem) == Lisp_Int)
2429
96b55f2f19cd Rename int-to-string to number-to-string, since it can handle
Jim Blandy <jimb@redhat.com>
parents: 1011
diff changeset
214 tem = Fnumber_to_string (tem);
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 if (XTYPE (tem) == Lisp_String)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 insert1 (tem);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217 else
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 tem = wrong_type_argument (Qstringp, tem);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 goto retry;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 }
295
d63a5e102cab *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 153
diff changeset
223
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 return Qnil;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228 syms_of_mocklisp ()
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 Qmocklisp = intern ("mocklisp");
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 staticpro (&Qmocklisp);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 /*defsubr (&Sml_defun);*/
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 defsubr (&Sml_if);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 /*defsubr (&Sml_while);*/
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 defsubr (&Sml_arg);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 defsubr (&Sml_nargs);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238 defsubr (&Sml_interactive);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 defsubr (&Sml_provide_prefix_argument);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 defsubr (&Sml_prefix_argument_loop);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 /*defsubr (&Sml_substr);*/
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 defsubr (&Sinsert_string);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 }