annotate src/mocklisp.c @ 17554:0a75fcee3cb8

(set_frame_menubar): When widget is new, forget records of old contents.
author Richard M. Stallman <rms@gnu.org>
date Fri, 25 Apr 1997 00:44:48 +0000
parents ee40177f6c68
children 862d3328f79d
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.
10618
e6c31b26a1b5 (Fml_provide_prefix_argument, Fml_prefix_argument_loop): Use perdisplay.
Karl Heuer <kwzh@gnu.org>
parents: 9119
diff changeset
2 Copyright (C) 1985, 1986, 1995 Free Software Foundation, Inc.
153
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
12244
ac7375e60931 Update GPL to version 2.
Karl Heuer <kwzh@gnu.org>
parents: 10858
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
153
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
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12244
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12244
diff changeset
19 Boston, MA 02111-1307, USA. */
153
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
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 /* Compatibility for mocklisp */
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23
4696
1fc792473491 Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents: 2429
diff changeset
24 #include <config.h>
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 #include "lisp.h"
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 #include "buffer.h"
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 /* Now in lisp code ("macrocode...")
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 * DEFUN ("ml-defun", Fml_defun, Sml_defun, 0, UNEVALLED, 0,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 * "Define mocklisp functions")
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 * (args)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 * Lisp_Object args;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 * {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 * Lisp_Object elt;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 *
484
3165b2697c78 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 311
diff changeset
36 * while (!NILP (args))
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 * {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 * elt = Fcar (args);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 * Ffset (Fcar (elt), Fcons (Qmocklisp, Fcdr (elt)));
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 * args = Fcdr (args);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 * }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 * return Qnil;
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
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 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
47 (args)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 Lisp_Object args;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 register Lisp_Object val;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 struct gcpro gcpro1;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 GCPRO1 (args);
484
3165b2697c78 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 311
diff changeset
54 while (!NILP (args))
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 val = Feval (Fcar (args));
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 args = Fcdr (args);
484
3165b2697c78 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 311
diff changeset
58 if (NILP (args)) break;
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 if (XINT (val))
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 val = Feval (Fcar (args));
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 break;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 args = Fcdr (args);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 UNGCPRO;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 return val;
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
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 /* Now converted to regular "while" by hairier conversion code.
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 * 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
72 * (args)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 * Lisp_Object args;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 * {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 * Lisp_Object test, body, tem;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 * struct gcpro gcpro1, gcpro2;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 *
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 * GCPRO2 (test, body);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 *
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 * test = Fcar (args);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 * body = Fcdr (args);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 * while (tem = Feval (test), XINT (tem))
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 * {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 * QUIT;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 * Fprogn (body);
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 *
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 * UNGCPRO;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 * return Qnil;
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
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 /* This is the main entry point to mocklisp execution.
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 When eval sees a mocklisp function being called, it calls here
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 with the unevaluated argument list */
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 Lisp_Object
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 ml_apply (function, args)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 Lisp_Object function, args;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 register int count = specpdl_ptr - specpdl;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 register Lisp_Object val;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 specbind (Qmocklisp_arguments, args);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 val = Fprogn (Fcdr (function));
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 return unbind_to (count, val);
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
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 DEFUN ("ml-nargs", Fml_nargs, Sml_nargs, 0, 0, 0,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 "Number of arguments to currently executing mocklisp function.")
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 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 if (EQ (Vmocklisp_arguments, Qinteractive))
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 return make_number (0);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 return Flength (Vmocklisp_arguments);
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
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 DEFUN ("ml-arg", Fml_arg, Sml_arg, 1, 2, 0,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 "Argument number N to currently executing mocklisp function.")
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 (n, prompt)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 Lisp_Object n, prompt;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 if (EQ (Vmocklisp_arguments, Qinteractive))
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 return Fread_string (prompt, Qnil);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 CHECK_NUMBER (n, 0);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 XSETINT (n, XINT (n) - 1); /* Mocklisp likes to be origin-1 */
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 return Fcar (Fnthcdr (n, Vmocklisp_arguments));
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
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 DEFUN ("ml-interactive", Fml_interactive, Sml_interactive, 0, 0, 0,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 "True if currently executing mocklisp function was called interactively.")
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 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 return (EQ (Vmocklisp_arguments, Qinteractive)) ? Qt : Qnil;
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
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 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
137 2, UNEVALLED, 0,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 "Evaluate second argument, using first argument as prefix arg value.")
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 (args)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 Lisp_Object args;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 struct gcpro gcpro1;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 GCPRO1 (args);
10858
415b568535de (Fml_provide_prefix_argument, Fml_prefix_argument_loop): Undo Jan 31 change.
Karl Heuer <kwzh@gnu.org>
parents: 10618
diff changeset
144 Vcurrent_prefix_arg = Feval (Fcar (args));
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 UNGCPRO;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 return Feval (Fcar (Fcdr (args)));
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
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 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
150 0, UNEVALLED, 0,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 "")
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 (args)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 Lisp_Object args;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 register Lisp_Object tem;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 register int i;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 struct gcpro gcpro1;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 /* Set `arg' in case we call a built-in function that looks at it. Still are a few. */
10858
415b568535de (Fml_provide_prefix_argument, Fml_prefix_argument_loop): Undo Jan 31 change.
Karl Heuer <kwzh@gnu.org>
parents: 10618
diff changeset
160 if (NILP (Vcurrent_prefix_arg))
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 i = 1;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 else
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 {
10858
415b568535de (Fml_provide_prefix_argument, Fml_prefix_argument_loop): Undo Jan 31 change.
Karl Heuer <kwzh@gnu.org>
parents: 10618
diff changeset
164 tem = Vcurrent_prefix_arg;
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 if (CONSP (tem))
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 tem = Fcar (tem);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 if (EQ (tem, Qminus))
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 i = -1;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 else i = XINT (tem);
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
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 GCPRO1 (args);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 while (i-- > 0)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 Fprogn (args);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 UNGCPRO;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 return Qnil;
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
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 #if 0 /* Now in mlsupport.el */
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 DEFUN ("ml-substr", Fml_substr, Sml_substr, 3, 3, 0,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 "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
183 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
184 (string, from, to)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 Lisp_Object string, from, to;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 CHECK_STRING (string, 0);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 CHECK_NUMBER (from, 1);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 CHECK_NUMBER (to, 2);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 if (XINT (from) < 0)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 XSETINT (from, XINT (from) + XSTRING (string)->size);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 if (XINT (to) < 0)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 XSETINT (to, XINT (to) + XSTRING (string)->size);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 XSETINT (to, XINT (to) + XINT (from));
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 return Fsubstring (string, from, to);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 }
1011
a7f08730f7ae * mocklisp.c (Fml_substr): Put comments around text following #endif.
Jim Blandy <jimb@redhat.com>
parents: 484
diff changeset
198 #endif /* 0 */
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 DEFUN ("insert-string", Finsert_string, Sinsert_string, 0, MANY, 0,
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 "Mocklisp-compatibility insert function.\n\
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 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
202 is converted into a string by expressing it in decimal.")
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 (nargs, args)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 int nargs;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 Lisp_Object *args;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 register int argnum;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 register Lisp_Object tem;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 for (argnum = 0; argnum < nargs; argnum++)
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 tem = args[argnum];
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 retry:
9119
0c3c25c2456e (Finsert_string): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents: 4696
diff changeset
214 if (INTEGERP (tem))
2429
96b55f2f19cd Rename int-to-string to number-to-string, since it can handle
Jim Blandy <jimb@redhat.com>
parents: 1011
diff changeset
215 tem = Fnumber_to_string (tem);
9119
0c3c25c2456e (Finsert_string): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents: 4696
diff changeset
216 if (STRINGP (tem))
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217 insert1 (tem);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 else
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 tem = wrong_type_argument (Qstringp, tem);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 goto retry;
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 }
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 }
295
d63a5e102cab *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 153
diff changeset
224
153
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 return Qnil;
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
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229 syms_of_mocklisp ()
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 {
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 Qmocklisp = intern ("mocklisp");
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 staticpro (&Qmocklisp);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 /*defsubr (&Sml_defun);*/
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 defsubr (&Sml_if);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 /*defsubr (&Sml_while);*/
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 defsubr (&Sml_arg);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238 defsubr (&Sml_nargs);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 defsubr (&Sml_interactive);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 defsubr (&Sml_provide_prefix_argument);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 defsubr (&Sml_prefix_argument_loop);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 /*defsubr (&Sml_substr);*/
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 defsubr (&Sinsert_string);
636408ebaaaa Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 }