annotate lib-src/make-msgfile.lex @ 4601:7c7262c47538

Remove any reference to mocklisp as an active technology. lisp/ChangeLog addition: 2009-02-04 Aidan Kehoe <kehoea@parhasard.net> * help.el: (describe-function-1): * byte-optimize.el: Remove any reference to mocklisp as an active technology. man/ChangeLog addition: 2009-02-04 Aidan Kehoe <kehoea@parhasard.net> * xemacs/xemacs.texi (Top): * xemacs/misc.texi (Emulation): * xemacs/building.texi (Lisp Libraries): (Compiling Libraries): Remove any reference to mocklisp as an active technology. Also remove documentation of the related #'set-gosmacs-bindings, which is no longer available.
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 04 Feb 2009 20:52:24 +0000
parents ecf1ebac70d8
children c50b0b3c7b8d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 %{
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 /* This is a Lex file. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 /* Localizable-message snarfing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 Copyright (C) 1994, 1995 Amdahl Corporation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 XEmacs is free software; you can redistribute it and/or modify
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 it under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 XEmacs is distributed in the hope that it will be useful,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 GNU General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 /* Written by Ben Wing, November 1994. Some code based on earlier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 make-msgfile.c. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 440
diff changeset
28 /* See text.c for a proposal about how this whole system should work. */
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 440
diff changeset
29
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 /* Note: there is still much work to be done on this.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 1) Definition of Arg below won't handle a generalized argument
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 as might appear in a function call. This is fine for DEFUN
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 and friends, because only simple arguments appear there; but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 it might run into problems if Arg is used for other sorts
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 of functions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 2) snarf() should be modified so that it doesn't output null
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 strings and non-textual strings (see the comment at the top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 of make-msgfile.c).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 3) parsing of (insert) should snarf all of the arguments.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 4) need to add set-keymap-prompt and deal with gettext of that.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 5) parsing of arguments should snarf all strings anywhere within
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 the arguments, rather than just looking for a string as the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 argument. This allows if statements as arguments to get parsed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 6) begin_paren_counting() et al. should handle recursive entry.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 7) handle set-window-buffer and other such functions that take
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 a buffer as the other-than-first argument.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 8) there is a fair amount of work to be done on the C code.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 Look through the code for #### comments associated with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 '#ifdef I18N3' or with an I18N3 nearby.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 9) Deal with `get-buffer-process' et al.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 10) Many of the changes in the Lisp code marked
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 'rewritten for I18N3 snarfing' should be undone once (5) is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 implemented.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 11) Go through the Lisp code in prim and make sure that all
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 strings are gettexted as necessary. This may reveal more
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 things to implement.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 12) Do the equivalent of (8) for the Lisp code.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 13) Deal with parsing of menu specifications.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 --ben
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 /* Some notes:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 -- {Arg} below could get confused by commas inside of quotes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 -- {LispToken} below can match some things that are not tokens (e.g.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 numbers) but for all practical purposes it should be fine.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 #include <stdio.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 int snarf_return_state;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 %}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 %p 6000
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 %e 2000
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 %n 1000
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 %a 4000
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 %s C_QUOTE C_COMMENT LQUO LCOM
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 %s CSNARF LSNARF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 %s DO_C DO_LISP DEFUN
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 %s DEFUN2 DEFUN3 LDEF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 W [ \t\n]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 Any (.|"\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 Q "\""
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 NQ [^"]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 NT [^A-Za-z_0-9]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 LP "("
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 RP ")"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 BS "\\"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 Esc ({BS}{Any})
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 Wh ({W}*)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 LCom (";"({Esc}|.)*)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 LWh (({W}|{Lcom})*)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 Open ({Wh}{LP})
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 OpWQ ({Open}{Wh}{Q})
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 String ({Q}({Esc}|{NQ})*{Q})
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 Arg ([^,]*",")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 StringArg ({Wh}{String}{Wh}",")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 OpenString ({Open}{StringArg})
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 LispToken (({Esc}|[-A-Za-z0-9!@$%^&*_=+|{}`~,<.>/?])+)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 %%
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 <DO_C>{NT}"GETTEXT"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 <DO_C>{NT}"DEFER_GETTEXT"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 <DO_C>{NT}"build_translated_string"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 <DO_C>{NT}"insert_string"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 <DO_C>{NT}"message"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 <DO_C>{NT}"warn_when_safe"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 <DO_C>{NT}"error"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 <DO_C>{NT}"continuable_error"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 <DO_C>{NT}"signal_simple_error"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 <DO_C>{NT}"signal_simple_error_2"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 <DO_C>{NT}"signal_simple_continuable_error"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 <DO_C>{NT}"signal_simple_continuable_error_2"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 <DO_C>{NT}"report_file_error"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 <DO_C>{NT}"signal_file_error"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 <DO_C>{NT}"signal_double_file_error"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 <DO_C>{NT}"signal_double_file_error_2"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 <DO_C>{NT}"syntax_error"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 <DO_C>{NT}"continuable_syntax_error"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 <DO_C>{NT}"CTB_ERROR"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 <DO_C>{NT}"fatal"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 <DO_C>{NT}"stdout_out"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 <DO_C>{NT}"stderr_out"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 <DO_C>{NT}"with_output_to_temp_buffer"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 <DO_C>{NT}"DEFVAR_BOOL"{OpenString}{Arg}{Wh}{Q} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 <DO_C>{NT}"DEFVAR_LISP"{OpenString}{Arg}{Wh}{Q} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 <DO_C>{NT}"DEFVAR_SPECIFIER"{OpenString}{Arg}{Wh}{Q} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 <DO_C>{NT}"DEFVAR_INT"{OpenString}{Arg}{Wh}{Q} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 <DO_C>{NT}"DEFVAR_BUFFER_LOCAL"{OpenString}{Arg}{Wh}{Q} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 <DO_C>{NT}"DEFVAR_BUFFER_DEFAULTS"{OpenString}{Arg}{Wh}{Q} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 <DO_C>{NT}"deferror"{Open}{Arg}{StringArg}{Wh}{Q} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 <DO_C>{NT}"barf_or_query_if_file_exists"{Open}{Arg}{Wh}{Q} {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 /* #### see comment above about use of Arg */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 snarf ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 <DO_C>{NT}"DEFUN"{Open} { BEGIN DEFUN; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 <DO_C>"/*" {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 /* This is hateful, but doc strings are sometimes put inside of comments
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 (to get around limits in cpp), so we can't ignore stuff inside of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 comments. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 /* BEGIN C_COMMENT; */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 <DO_C>{Q} { BEGIN C_QUOTE; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 <DO_C>{Any} { }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 <DEFUN>{StringArg}{Arg}{Arg}{Arg}{Arg}{Wh} { BEGIN DEFUN2; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 <DEFUN>{Any} { bad_c_defun (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 <DEFUN2>{Q} {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 /* We found an interactive specification. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 snarf_return_state = DEFUN3;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 snarf ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 <DEFUN2>[^,]* {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 /* This function doesn't have an interactive specification.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 Don't use {Arg} in the specification because DEFUN3 looks
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 for the comma. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 BEGIN DEFUN3;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 <DEFUN3>{Wh}","{Wh}{Q} {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 snarf_return_state = DO_C;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 snarf ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 <DEFUN3>{Any} { bad_c_defun (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 <C_QUOTE>{Esc} { }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 <C_QUOTE>{Q} { BEGIN DO_C; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 <C_QUOTE>{Any} { }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 <C_COMMENT>"*/" { BEGIN DO_C; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 <C_COMMENT>{Any} { }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 <DO_LISP>{LP}{LWh}"gettext"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 <DO_LISP>{LP}{LWh}"purecopy"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 <DO_LISP>{LP}{LWh}"interactive"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 <DO_LISP>{LP}{LWh}"message"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 <DO_LISP>{LP}{LWh}"error"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 <DO_LISP>{LP}{LWh}"warn"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 <DO_LISP>{LP}{LWh}"format"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 <DO_LISP>{LP}{LWh}"substitute-command-keys"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 <DO_LISP>{LP}{LWh}"temp-minibuffer-message"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 <DO_LISP>{LP}{LWh}"momentary-string-display"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 <DO_LISP>{LP}{LWh}"princ"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 <DO_LISP>{LP}{LWh}"prin1"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 <DO_LISP>{LP}{LWh}"prin1-to-string"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 <DO_LISP>{LP}{LWh}"print"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 <DO_LISP>{LP}{LWh}"insert"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 <DO_LISP>{LP}{LWh}"insert-before-markers"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 <DO_LISP>{LP}{LWh}"get-buffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 <DO_LISP>{LP}{LWh}"get-buffer-create"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 <DO_LISP>{LP}{LWh}"generate-new-buffer-name"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 <DO_LISP>{LP}{LWh}"rename-buffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 <DO_LISP>{LP}{LWh}"set-buffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 <DO_LISP>{LP}{LWh}"switch-to-buffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 <DO_LISP>{LP}{LWh}"pop-to-buffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 <DO_LISP>{LP}{LWh}"with-output-to-temp-buffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 <DO_LISP>{LP}{LWh}"buffer-enable-undo"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 <DO_LISP>{LP}{LWh}"buffer-disable-undo"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 <DO_LISP>{LP}{LWh}"get-buffer-window"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 <DO_LISP>{LP}{LWh}"delete-windows-on"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 <DO_LISP>{LP}{LWh}"replace-buffer-in-windows"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 <DO_LISP>{LP}{LWh}"display-buffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 <DO_LISP>{LP}{LWh}"other-buffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 <DO_LISP>{LP}{LWh}"read-from-minibuffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 <DO_LISP>{LP}{LWh}"read-shell-command"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 <DO_LISP>{LP}{LWh}"read-file-name"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 <DO_LISP>{LP}{LWh}"read-buffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 <DO_LISP>{LP}{LWh}"read-variable"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 <DO_LISP>{LP}{LWh}"read-command"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 <DO_LISP>{LP}{LWh}"read-function"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 <DO_LISP>{LP}{LWh}"read-directory-name"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 <DO_LISP>{LP}{LWh}"read-string"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 <DO_LISP>{LP}{LWh}"read-number"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 <DO_LISP>{LP}{LWh}"read-minibuffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 <DO_LISP>{LP}{LWh}"read-quoted-char"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 <DO_LISP>{LP}{LWh}"read-face-name"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 <DO_LISP>{LP}{LWh}"read-itimer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 <DO_LISP>{LP}{LWh}"completing-read"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 <DO_LISP>{LP}{LWh}"y-or-n-p"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 <DO_LISP>{LP}{LWh}"yes-or-no-p"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 <DO_LISP>{LP}{LWh}"query-replace-read-args"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 <DO_LISP>{LP}{LWh}"eval-minibuffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 <DO_LISP>{LP}{LWh}"edit-and-eval-command"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 <DO_LISP>{LP}{LWh}"defvar"{LWh}{LispToken}{LWh} {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 inc_paren (); begin_paren_counting (LDEF);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 <DO_LISP>{LP}{LWh}"defconst"{LWh}{LispToken}{LWh} {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 inc_paren (); begin_paren_counting (LDEF);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 <DO_LISP>{LP}{LWh}"defun"{LWh}{LispToken}{LWh} {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 inc_paren (); begin_paren_counting (LDEF);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 <DO_LISP>{LP}{LWh}"defmacro"{LWh}{LispToken}{LWh} {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 inc_paren (); begin_paren_counting (LDEF);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 <DO_LISP>{LP}{LWh}"defsubst"{LWh}{LispToken}{LWh} {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 inc_paren (); begin_paren_counting (LDEF);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 <DO_LISP>{Q} { BEGIN LQUO; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 <DO_LISP>";" { BEGIN LCOM; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 <DO_LISP>{LP} { inc_paren (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 <DO_LISP>{RP} { dec_paren (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 <DO_LISP>{Esc} { }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 <DO_LISP>{W} { lisp_whitespace (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 <DO_LISP>{Any} { }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 <LQUO>{Esc} { }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 <LQUO>{Q} { BEGIN DO_LISP; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 <LQUO>{Any} { }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 <LCOM>"\n" { BEGIN DO_LISP; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 <LCOM>{Any} { }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 <LDEF>{LWh}{Q} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 <LDEF>{Any} { BEGIN DO_LISP; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 <CSNARF>{Esc} { ECHO; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 <CSNARF>{Q} { ECHO; fprintf (yyout, ")\n"); BEGIN snarf_return_state; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 <CSNARF>{Any} { ECHO; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 <LSNARF>{Esc} { ECHO; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 <LSNARF>"\n" { fprintf (yyout, "\\n\\\n"); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 <LSNARF>{Q} { ECHO; fprintf (yyout, ")\n"); BEGIN snarf_return_state; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 <LSNARF>{Any} { ECHO; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 %%
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 enum filetype { C_FILE, LISP_FILE, INVALID_FILE };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 /* some brain-dead headers define this ... */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 #undef FALSE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 #undef TRUE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 enum boolean { FALSE, TRUE };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 void scan_file (char *filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 void process_C_file (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 void process_Lisp_file (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 int in_c;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 int in_paren_counting, paren_count;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 int paren_return_state;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 snarf ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 fprintf (yyout, "gettext(\"");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 if (in_c)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 BEGIN CSNARF;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 BEGIN LSNARF;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 bad_c_defun ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 fprintf (stderr, "Warning: Invalid DEFUN encountered in C, line %d.\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 yylineno);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 snarf_return_state = DO_C;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 BEGIN DO_C;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 /* REJECT; Sun's lex is broken! Use Flex! */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 bad_lisp_def ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 fprintf (stderr,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 "Warning: Invalid defmumble encountered in Lisp, line %d.\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 yylineno);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 snarf_return_state = DO_LISP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 BEGIN DO_LISP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 /* REJECT; Sun's lex is broken! Use Flex! */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 inc_paren ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 if (in_paren_counting)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 paren_count++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 dec_paren ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 if (in_paren_counting)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 /* If we find a right paren without a matching left paren, it usually
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 just indicates a statement like
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 (defvar foo-mumble nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 where 'nil' is the sexp we are skipping over, and there's no
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 doc string. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 if (paren_count > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 paren_count--;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 unput (')');
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 if (paren_count == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 in_paren_counting = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 BEGIN paren_return_state;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 /* #### begin_paren_counting () does not handle recursive entries */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 begin_paren_counting (int return_state)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 in_paren_counting = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 paren_count = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 paren_return_state = return_state;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 lisp_whitespace ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 if (in_paren_counting && !paren_count)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 /* We got to the end of a token and we're not in a parenthesized
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 expression, so we're at the end of an sexp. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 in_paren_counting = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 BEGIN paren_return_state;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 yywrap ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 main (int argc, char *argv[])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 register int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 yyout = stdout;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 /* If first two args are -o FILE, output to FILE. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 i = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 if (argc > i + 1 && strcmp (argv[i], "-o") == 0) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 yyout = fopen (argv[++i], "w");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 ++i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 /* ...Or if args are -a FILE, append to FILE. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 if (argc > i + 1 && strcmp (argv[i], "-a") == 0) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 yyout = fopen (argv[++i], "a");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 ++i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 if (!yyout) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 fprintf (stderr, "Unable to open output file %s\n", argv[--i]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 for (; i < argc; i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 scan_file (argv[i]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 void scan_file (char *filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 enum filetype type = INVALID_FILE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 register char *p = filename + strlen (filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 if (strcmp (p - 4, ".elc") == 0) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 *--p = '\0'; /* Use .el file instead */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 type = LISP_FILE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 } else if (strcmp (p - 3, ".el") == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 type = LISP_FILE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 else if (strcmp (p - 2, ".o") == 0) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 *--p = 'c'; /* Use .c file instead */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 type = C_FILE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 } else if (strcmp (p - 2, ".c") == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 type = C_FILE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 if (type == INVALID_FILE) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 fprintf (stderr, "File %s being ignored\n", filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 yyin = fopen (filename, "r");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 if (!yyin) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 fprintf (stderr, "Unable to open input file %s\n", filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 fprintf (yyout, "/* %s */\n", filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 if (type == C_FILE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 process_C_file ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 process_Lisp_file ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 fputc ('\n', yyout);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 fclose (yyin);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 void process_C_file ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 snarf_return_state = DO_C;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 in_c = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 BEGIN DO_C;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 yylex ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 void process_Lisp_file ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 snarf_return_state = DO_LISP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 in_c = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 BEGIN DO_LISP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 yylex ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459