Mercurial > hg > xemacs-beta
annotate src/lisp.h @ 4914:1628e3b9601a
When aborting due to unknown opcode, output more descriptive msg
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2010-02-02 Ben Wing <ben@xemacs.org>
* bytecode.c (execute_rare_opcode):
* lisp.h (abort_with_msg): New.
When aborting due to unknown opcode, output more descriptive msg.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Tue, 02 Feb 2010 15:19:15 -0600 |
parents | 6bc1f3f6cf0d |
children | 17362f371cc2 |
rev | line source |
---|---|
428 | 1 /* Fundamental definitions for XEmacs Lisp interpreter. |
2 Copyright (C) 1985-1987, 1992-1995 Free Software Foundation, Inc. | |
3 Copyright (C) 1993-1996 Richard Mlynarik. | |
4843
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
4 Copyright (C) 1995, 1996, 2000-2005, 2009, 2010 Ben Wing. |
428 | 5 |
6 This file is part of XEmacs. | |
7 | |
8 XEmacs is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
10 Free Software Foundation; either version 2, or (at your option) any | |
11 later version. | |
12 | |
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with XEmacs; see the file COPYING. If not, write to | |
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
21 Boston, MA 02111-1307, USA. */ | |
22 | |
23 /* Synched up with: FSF 19.30. */ | |
24 | |
853 | 25 /* Authorship: |
26 | |
27 Based on code from pre-release FSF 19, c. 1991. | |
28 Various changes by Jamie Zawinski 1991-1994: | |
29 converting to ANSI C, splitting out function prototypes to a separate | |
30 file (later moved back for unknown reasons by Steve Baur?), debug-gcpro | |
31 stuff (now moribund). | |
32 ANSI-fication of DEFUN macros by Felix Lee, c. 1992? | |
33 NOT_REACHED, DOESNT_RETURN, PRINTF_ARGS by Richard Mlynarik, c. 1994. | |
34 Many changes over the years corresponding to Lisp_Object definition | |
35 changes, esp. by Richard Mlynarik (c. 1993) and Kyle Jones (c. 1998). | |
36 See alloc.c for more details. | |
37 Overhauled and reordered by Ben Wing, 1995-1996, and many things added: | |
38 Dynarrs, REALLOC macros, asserts, typedefs, inline header code, | |
39 first LIST_LOOP macros, CONCHECK_*, all error-checking code | |
40 (e.g. error-checking versions of XFOO macros), structure read syntax, | |
41 weak lists, lcrecord lists, reworking of quit handling, object hashing, | |
42 nested GCPRO, character objects and Ebola checking, memory usage stats, | |
43 others. | |
44 LOADHIST changes from Steve Baur, c. 1997? | |
45 Various macro-related changes by Martin Buchholz, 1998-1999: | |
46 LIST_LOOP macros greatly expanded and tortoise-hared; | |
47 RETURN_SANS_WARNINGS; reworked DEFUN macros; EXFUN macros (???). | |
1743 | 48 Various macro-related changes by Jerry James, 2003: |
49 MODULE_API introduced; | |
50 Compiler-specific definitions modernized and moved to compiler.h. | |
853 | 51 */ |
52 | |
440 | 53 #ifndef INCLUDED_lisp_h_ |
54 #define INCLUDED_lisp_h_ | |
428 | 55 |
56 /************************************************************************/ | |
57 /* general definitions */ | |
58 /************************************************************************/ | |
59 | |
2367 | 60 /* Conventions in comments: |
61 | |
62 "Mule-izing" is the process of going through a file and eliminating | |
63 assumptions that the internal format (Ibyte * text) is the same as the | |
64 external format used by library routines. Mule-ization should also | |
65 include replacing *ALL* raw references to `char' or `unsigned char' with | |
66 one of the self-documenting types created below. How exactly to do the | |
67 conversion, and how to write correctly Mule-ized code, is described in | |
68 the internals manual. Files that say "This file is Mule-ized" have | |
69 been reviewed at some point; that's not to say that incorrect code hasn't | |
70 crept in, though. | |
71 | |
72 "Unicode-splitting" is the process of fixing a file so that it will | |
73 handle external text in Unicode under Microsoft Windows, as appropriate. | |
74 ("splitting" because it needs to handle either Unicode or variable-width | |
75 multibyte depending on the OS -- NT or 9x). See intl-win32.c. | |
76 | |
77 #### is a way of marking problems of any sort. | |
78 | |
79 !!#### marks places that are not properly Mule-ized. | |
80 | |
81 &&#### marks places that need to be fixed in order for the "8-bit mule" | |
82 conversion to work correctly, i.e. in order to support multiple different | |
83 buffer formats under Mule, including a fixed 8-bit format. | |
84 | |
85 ^^#### marks places that need to be fixed in order to eliminate the | |
86 assumption that Ibyte * text is composed of 1-byte units (e.g. UTF-16 | |
87 is composed of 2-byte units and might be a possible format to consider | |
88 for Ibyte * text). | |
89 | |
90 %%#### marks places that need work for KKCC (the new garbage collector). | |
91 | |
92 */ | |
93 | |
1318 | 94 /* -------------------------- include files --------------------- */ |
442 | 95 |
428 | 96 /* We include the following generally useful header files so that you |
97 don't have to worry about prototypes when using the standard C | |
98 library functions and macros. These files shouldn't be excessively | |
99 large so they shouldn't cause that much of a slowdown. */ | |
100 | |
101 #include <stdlib.h> | |
102 #include <string.h> /* primarily for memcpy, etc. */ | |
103 #include <stdio.h> /* NULL, etc. */ | |
104 #include <ctype.h> | |
105 #include <stdarg.h> | |
106 #include <stddef.h> /* offsetof */ | |
107 #include <sys/types.h> | |
442 | 108 #include <limits.h> |
109 | |
1318 | 110 /* -------------------------- error-checking ------------------------ */ |
853 | 111 |
112 /* The large categories established by configure can be subdivided into | |
113 smaller subcategories, for problems in specific modules. You can't | |
114 control this using configure, but you can manually stick in a define as | |
115 necessary. */ | |
116 | |
4843
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
117 /* How these work: |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
118 |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
119 The most common classes will be `text' and `type', followed by `structure'. |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
120 `text' is for problems related to bad textual format. `type' is for |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
121 problems related to wrongly typed arguments, structure fields, etc. |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
122 `structure' is for bad data inside of a structure. Sometimes these are |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
123 used "incorrectly", e.g. `type' is often used for structure-checking. |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
124 Consider `text': |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
125 |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
126 `text_checking_assert() will assert() only when ERROR_CHECK_TEXT is defined; |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
127 otherwise it's a no-op. text_checking_assert_at_line() is similar, but |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
128 allows you to override the file name and line number normally supplied in |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
129 the message. This is especially useful in inline header functions, and |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
130 so there's a special inline_text_checking_assert() for this; this works |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
131 like text_checking_assert() but supplies the file and line of the calling |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
132 function. In order for this to work, you need to declare your inline |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
133 function with INLINE_TEXT_CHECK_ARGS at the end of its argument list, |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
134 and give its function name a _1 extension or similar. Then create a |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
135 macro that calls your inline function and includes INLINE_TEXT_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
136 at the end of the parameter list. This will arrange to pass in and receive |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
137 the file and line (__FILE__, __LINE__) at place where the call occurs in |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
138 the calling function; but nothing will get passed in when ERROR_CHECK_TEXT |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
139 is not defined. |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
140 */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
141 |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
142 |
853 | 143 #ifdef ERROR_CHECK_STRUCTURES |
144 /* Check for problems with the catch list and specbind stack */ | |
145 #define ERROR_CHECK_CATCH | |
146 /* Check for insufficient use of call_trapping_problems(), particularly | |
147 due to glyph-related changes causing eval or QUIT within redisplay */ | |
148 #define ERROR_CHECK_TRAPPING_PROBLEMS | |
4843
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
149 #endif /* ERROR_CHECK_STRUCTURES */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
150 |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
151 #define INLINE_ERROR_CHECK_ARGS , const char *__file__, int __line__ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
152 #define INLINE_ERROR_CHECK_CALL , __FILE__, __LINE__ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
153 #define DISABLED_INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
154 #define DISABLED_INLINE_ERROR_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
155 |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
156 /* For assertions in inline header functions which will report the file and |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
157 line of the calling function */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
158 #define inline_assert(assertion) assert_at_line (assertion, __file__, __line__) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
159 #define disabled_inline_assert(assertion) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
160 disabled_assert_at_line (assertion, __file__, __line__) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
161 |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
162 #ifdef ERROR_CHECK_TEXT |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
163 #define text_checking_assert(assertion) assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
164 #define text_checking_assert_at_line(assertion, file, line) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
165 assert_at_line (assertion, file, line) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
166 #define inline_text_checking_assert(assertion) inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
167 #define INLINE_TEXT_CHECK_ARGS INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
168 #define INLINE_TEXT_CHECK_CALL INLINE_ERROR_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
169 #define text_checking_assert_with_message(assertion, msg) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
170 assert_with_message (assertion, msg) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
171 #else /* not ERROR_CHECK_TEXT */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
172 #define text_checking_assert(assertion) disabled_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
173 #define text_checking_assert_at_line(assertion, file, line) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
174 disabled_assert_at_line (assertion, file, line) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
175 #define inline_text_checking_assert(assertion) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
176 disabled_inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
177 #define INLINE_TEXT_CHECK_ARGS DISABLED_INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
178 #define INLINE_TEXT_CHECK_CALL DISABLED_INLINE_ERROR_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
179 #define text_checking_assert_with_message(assertion, msg) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
180 disabled_assert_with_message (assertion, msg) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
181 #endif /* ERROR_CHECK_TEXT */ |
853 | 182 |
1318 | 183 #ifdef ERROR_CHECK_TYPES |
184 #define type_checking_assert(assertion) assert (assertion) | |
185 #define type_checking_assert_at_line(assertion, file, line) \ | |
186 assert_at_line (assertion, file, line) | |
4843
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
187 #define inline_type_checking_assert(assertion) inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
188 #define INLINE_TYPE_CHECK_ARGS INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
189 #define INLINE_TYPE_CHECK_CALL INLINE_ERROR_CHECK_CALL |
1318 | 190 #define type_checking_assert_with_message(assertion, msg) \ |
191 assert_with_message (assertion, msg) | |
4843
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
192 #else /* not ERROR_CHECK_TYPES */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
193 #define type_checking_assert(assertion) disabled_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
194 #define type_checking_assert_at_line(assertion, file, line) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
195 disabled_assert_at_line (assertion, file, line) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
196 #define inline_type_checking_assert(assertion) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
197 disabled_inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
198 #define INLINE_TYPE_CHECK_ARGS DISABLED_INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
199 #define INLINE_TYPE_CHECK_CALL DISABLED_INLINE_ERROR_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
200 #define type_checking_assert_with_message(assertion, msg) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
201 disabled_assert_with_message (assertion, msg) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
202 #endif /* ERROR_CHECK_TYPES */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
203 |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
204 #ifdef ERROR_CHECK_STRUCTURES |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
205 #define structure_checking_assert(assertion) assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
206 #define structure_checking_assert_at_line(assertion, file, line) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
207 assert_at_line (assertion, file, line) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
208 #define inline_structure_checking_assert(assertion) inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
209 #define INLINE_STRUCTURE_CHECK_ARGS INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
210 #define INLINE_STRUCTURE_CHECK_CALL INLINE_ERROR_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
211 #define structure_checking_assert_with_message(assertion, msg) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
212 assert_with_message (assertion, msg) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
213 #else /* not ERROR_CHECK_STRUCTURES */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
214 #define structure_checking_assert(assertion) disabled_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
215 #define structure_checking_assert_at_line(assertion, file, line) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
216 disabled_assert_at_line (assertion, file, line) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
217 #define inline_structure_checking_assert(assertion) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
218 disabled_inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
219 #define INLINE_STRUCTURE_CHECK_ARGS DISABLED_INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
220 #define INLINE_STRUCTURE_CHECK_CALL DISABLED_INLINE_ERROR_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
221 #define structure_checking_assert_with_message(assertion, msg) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
222 disabled_assert_with_message (assertion, msg) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
223 #endif /* ERROR_CHECK_STRUCTURES */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
224 |
1318 | 225 #ifdef ERROR_CHECK_GC |
226 #define gc_checking_assert(assertion) assert (assertion) | |
227 #define gc_checking_assert_at_line(assertion, file, line) \ | |
228 assert_at_line (assertion, file, line) | |
4843
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
229 #define inline_gc_checking_assert(assertion) inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
230 #define INLINE_GC_CHECK_ARGS INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
231 #define INLINE_GC_CHECK_CALL INLINE_ERROR_CHECK_CALL |
1318 | 232 #define gc_checking_assert_with_message(assertion, msg) \ |
233 assert_with_message (assertion, msg) | |
4843
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
234 #else /* not ERROR_CHECK_GC */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
235 #define gc_checking_assert(assertion) disabled_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
236 #define gc_checking_assert_at_line(assertion, file, line) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
237 disabled_assert_at_line (assertion, file, line) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
238 #define inline_gc_checking_assert(assertion) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
239 disabled_inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
240 #define INLINE_GC_CHECK_ARGS DISABLED_INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
241 #define INLINE_GC_CHECK_CALL DISABLED_INLINE_ERROR_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
242 #define gc_checking_assert_with_message(assertion, msg) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
243 disabled_assert_with_message (assertion, msg) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
244 #endif /* ERROR_CHECK_GC */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
245 |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
246 #ifdef ERROR_CHECK_DISPLAY |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
247 #define display_checking_assert(assertion) assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
248 #define display_checking_assert_at_line(assertion, file, line) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
249 assert_at_line (assertion, file, line) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
250 #define inline_display_checking_assert(assertion) inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
251 #define INLINE_DISPLAY_CHECK_ARGS INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
252 #define INLINE_DISPLAY_CHECK_CALL INLINE_ERROR_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
253 #define display_checking_assert_with_message(assertion, msg) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
254 assert_with_message (assertion, msg) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
255 #else /* not ERROR_CHECK_DISPLAY */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
256 #define display_checking_assert(assertion) disabled_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
257 #define display_checking_assert_at_line(assertion, file, line) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
258 disabled_assert_at_line (assertion, file, line) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
259 #define inline_display_checking_assert(assertion) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
260 disabled_inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
261 #define INLINE_DISPLAY_CHECK_ARGS DISABLED_INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
262 #define INLINE_DISPLAY_CHECK_CALL DISABLED_INLINE_ERROR_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
263 #define display_checking_assert_with_message(assertion, msg) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
264 disabled_assert_with_message (assertion, msg) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
265 #endif /* ERROR_CHECK_DISPLAY */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
266 |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
267 #ifdef ERROR_CHECK_GLYPHS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
268 #define glyph_checking_assert(assertion) assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
269 #define glyph_checking_assert_at_line(assertion, file, line) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
270 assert_at_line (assertion, file, line) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
271 #define inline_glyph_checking_assert(assertion) inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
272 #define INLINE_GLYPH_CHECK_ARGS INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
273 #define INLINE_GLYPH_CHECK_CALL INLINE_ERROR_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
274 #define glyph_checking_assert_with_message(assertion, msg) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
275 assert_with_message (assertion, msg) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
276 #else /* not ERROR_CHECK_GLYPHS */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
277 #define glyph_checking_assert(assertion) disabled_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
278 #define glyph_checking_assert_at_line(assertion, file, line) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
279 disabled_assert_at_line (assertion, file, line) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
280 #define inline_glyph_checking_assert(assertion) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
281 disabled_inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
282 #define INLINE_GLYPH_CHECK_ARGS DISABLED_INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
283 #define INLINE_GLYPH_CHECK_CALL DISABLED_INLINE_ERROR_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
284 #define glyph_checking_assert_with_message(assertion, msg) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
285 disabled_assert_with_message (assertion, msg) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
286 #endif /* ERROR_CHECK_GLYPHS */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
287 |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
288 #ifdef ERROR_CHECK_EXTENTS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
289 #define extent_checking_assert(assertion) assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
290 #define extent_checking_assert_at_line(assertion, file, line) \ |
1318 | 291 assert_at_line (assertion, file, line) |
4843
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
292 #define inline_extent_checking_assert(assertion) inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
293 #define INLINE_EXTENT_CHECK_ARGS INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
294 #define INLINE_EXTENT_CHECK_CALL INLINE_ERROR_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
295 #define extent_checking_assert_with_message(assertion, msg) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
296 assert_with_message (assertion, msg) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
297 #else /* not ERROR_CHECK_EXTENTS */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
298 #define extent_checking_assert(assertion) disabled_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
299 #define extent_checking_assert_at_line(assertion, file, line) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
300 disabled_assert_at_line (assertion, file, line) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
301 #define inline_extent_checking_assert(assertion) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
302 disabled_inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
303 #define INLINE_EXTENT_CHECK_ARGS DISABLED_INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
304 #define INLINE_EXTENT_CHECK_CALL DISABLED_INLINE_ERROR_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
305 #define extent_checking_assert_with_message(assertion, msg) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
306 disabled_assert_with_message (assertion, msg) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
307 #endif /* ERROR_CHECK_EXTENTS */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
308 |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
309 #ifdef ERROR_CHECK_MALLOC |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
310 #define malloc_checking_assert(assertion) assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
311 #define malloc_checking_assert_at_line(assertion, file, line) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
312 assert_at_line (assertion, file, line) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
313 #define inline_malloc_checking_assert(assertion) inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
314 #define INLINE_MALLOC_CHECK_ARGS INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
315 #define INLINE_MALLOC_CHECK_CALL INLINE_ERROR_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
316 #define malloc_checking_assert_with_message(assertion, msg) \ |
1318 | 317 assert_with_message (assertion, msg) |
4843
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
318 #else /* not ERROR_CHECK_MALLOC */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
319 #define malloc_checking_assert(assertion) disabled_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
320 #define malloc_checking_assert_at_line(assertion, file, line) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
321 disabled_assert_at_line (assertion, file, line) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
322 #define inline_malloc_checking_assert(assertion) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
323 disabled_inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
324 #define INLINE_MALLOC_CHECK_ARGS DISABLED_INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
325 #define INLINE_MALLOC_CHECK_CALL DISABLED_INLINE_ERROR_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
326 #define malloc_checking_assert_with_message(assertion, msg) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
327 disabled_assert_with_message (assertion, msg) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
328 #endif /* ERROR_CHECK_MALLOC */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
329 |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
330 #ifdef ERROR_CHECK_BYTE_CODE |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
331 #define byte_code_checking_assert(assertion) assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
332 #define byte_code_checking_assert_at_line(assertion, file, line) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
333 assert_at_line (assertion, file, line) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
334 #define inline_byte_code_checking_assert(assertion) inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
335 #define INLINE_BYTE_CODE_CHECK_ARGS INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
336 #define INLINE_BYTE_CODE_CHECK_CALL INLINE_ERROR_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
337 #define byte_code_checking_assert_with_message(assertion, msg) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
338 assert_with_message (assertion, msg) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
339 #else /* not ERROR_CHECK_BYTE_CODE */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
340 #define byte_code_checking_assert(assertion) disabled_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
341 #define byte_code_checking_assert_at_line(assertion, file, line) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
342 disabled_assert_at_line (assertion, file, line) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
343 #define inline_byte_code_checking_assert(assertion) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
344 disabled_inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
345 #define INLINE_BYTE_CODE_CHECK_ARGS DISABLED_INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
346 #define INLINE_BYTE_CODE_CHECK_CALL DISABLED_INLINE_ERROR_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
347 #define byte_code_checking_assert_with_message(assertion, msg) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
348 disabled_assert_with_message (assertion, msg) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
349 #endif /* ERROR_CHECK_BYTE_CODE */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
350 |
1318 | 351 #ifdef ERROR_CHECK_TRAPPING_PROBLEMS |
352 #define trapping_problems_checking_assert(assertion) assert (assertion) | |
353 #define trapping_problems_checking_assert_at_line(assertion, file, line) \ | |
354 assert_at_line (assertion, file, line) | |
4843
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
355 #define inline_trapping_problems_checking_assert(assertion) inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
356 #define INLINE_TRAPPING_PROBLEMS_CHECK_ARGS INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
357 #define INLINE_TRAPPING_PROBLEMS_CHECK_CALL INLINE_ERROR_CHECK_CALL |
1318 | 358 #define trapping_problems_checking_assert_with_message(assertion, msg) \ |
359 assert_with_message (assertion, msg) | |
4843
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
360 #else /* not ERROR_CHECK_TRAPPING_PROBLEMS */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
361 #define trapping_problems_checking_assert(assertion) disabled_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
362 #define trapping_problems_checking_assert_at_line(assertion, file, line) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
363 disabled_assert_at_line (assertion, file, line) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
364 #define inline_trapping_problems_checking_assert(assertion) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
365 disabled_inline_assert (assertion) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
366 #define INLINE_TRAPPING_PROBLEMS_CHECK_ARGS DISABLED_INLINE_ERROR_CHECK_ARGS |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
367 #define INLINE_TRAPPING_PROBLEMS_CHECK_CALL DISABLED_INLINE_ERROR_CHECK_CALL |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
368 #define trapping_problems_checking_assert_with_message(assertion, msg) \ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
369 disabled_assert_with_message (assertion, msg) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
370 #endif /* ERROR_CHECK_TRAPPING_PROBLEMS */ |
1318 | 371 |
2367 | 372 /************************************************************************/ |
373 /** Definitions of basic types **/ | |
374 /************************************************************************/ | |
375 | |
376 /* ------------- generic 8/16/32/64/128-bit integral types ------------ */ | |
647 | 377 |
826 | 378 #if SIZEOF_SHORT == 2 |
379 #define INT_16_BIT short | |
380 #define UINT_16_BIT unsigned short | |
381 #elif SIZEOF_INT == 2 | |
382 /* Bwa ha ha. As if XEmacs could actually support such systems. */ | |
383 #define INT_16_BIT int | |
384 #define UINT_16_BIT unsigned int | |
385 #else | |
386 #error Unable to find a 16-bit integral type | |
387 #endif | |
388 | |
389 #if SIZEOF_INT == 4 | |
390 #define INT_32_BIT int | |
391 #define UINT_32_BIT unsigned int | |
392 #define MAKE_32_BIT_UNSIGNED_CONSTANT(num) num##U | |
393 #elif SIZEOF_LONG == 4 | |
394 /* Bwa ha ha again. */ | |
395 #define INT_32_BIT long | |
396 #define UINT_32_BIT unsigned long | |
397 #define MAKE_32_BIT_UNSIGNED_CONSTANT(num) num##UL | |
398 #elif SIZEOF_SHORT == 4 | |
399 /* And again. */ | |
400 #define INT_32_BIT short | |
401 #define UINT_32_BIT unsigned short | |
402 #define MAKE_32_BIT_UNSIGNED_CONSTANT(num) num##U | |
1429 | 403 #elif 1 /* Unable to find a 32-bit integral type! */ |
826 | 404 #error What kind of strange-ass system are you running on? |
405 #endif | |
406 | |
407 #if SIZEOF_LONG == 8 | |
408 #define INT_64_BIT long | |
409 #define UINT_64_BIT unsigned long | |
410 #define MAKE_64_BIT_UNSIGNED_CONSTANT(num) num##UL | |
411 #elif SIZEOF_LONG_LONG == 8 | |
412 #define INT_64_BIT long long | |
413 #define UINT_64_BIT unsigned long long | |
414 #define MAKE_64_BIT_UNSIGNED_CONSTANT(num) num##ULL | |
4682
648f4a0dac3e
Fix build problems on WIN32 platforms caused by the large image crash fix.
Jerry James <james@xemacs.org>
parents:
4678
diff
changeset
|
415 #elif defined(WIN32_ANY) |
648f4a0dac3e
Fix build problems on WIN32 platforms caused by the large image crash fix.
Jerry James <james@xemacs.org>
parents:
4678
diff
changeset
|
416 #define INT_64_BIT __int64 |
648f4a0dac3e
Fix build problems on WIN32 platforms caused by the large image crash fix.
Jerry James <james@xemacs.org>
parents:
4678
diff
changeset
|
417 #define UINT_64_BIT unsigned __int64 |
648f4a0dac3e
Fix build problems on WIN32 platforms caused by the large image crash fix.
Jerry James <james@xemacs.org>
parents:
4678
diff
changeset
|
418 #define MAKE_64_BIT_UNSIGNED_CONSTANT(num) num##UI64 |
826 | 419 /* No error otherwise; just leave undefined */ |
420 #endif | |
421 | |
422 #if SIZEOF_LONG_LONG == 16 | |
423 #define INT_128_BIT long long | |
424 #define UINT_128_BIT unsigned long long | |
425 #define MAKE_128_BIT_UNSIGNED_CONSTANT(num) num##ULL | |
426 /* No error otherwise; just leave undefined */ | |
427 #endif | |
428 | |
429 /* #### Fill this in for other systems */ | |
430 #if defined (INT_64_BIT) && !(defined (i386) || defined (__i386__)) | |
431 #define EFFICIENT_INT_64_BIT INT_64_BIT | |
432 #define EFFICIENT_UINT_64_BIT UINT_64_BIT | |
433 #endif | |
434 | |
435 #if defined (INT_128_BIT) | |
436 #define EFFICIENT_INT_128_BIT INT_128_BIT | |
437 #define EFFICIENT_UINT_128_BIT UINT_128_BIT | |
438 #endif | |
439 | |
2367 | 440 #ifdef HAVE_INTTYPES_H |
441 #include <inttypes.h> | |
442 #elif defined (HAVE_INTPTR_T_IN_SYS_TYPES_H) | |
443 /* included elsewhere */ | |
444 #elif SIZEOF_VOID_P == SIZEOF_INT | |
445 typedef int intptr_t; | |
446 typedef unsigned int uintptr_t; | |
447 #elif SIZEOF_VOID_P == SIZEOF_LONG | |
448 typedef long intptr_t; | |
449 typedef unsigned long uintptr_t; | |
450 #elif defined (SIZEOF_LONG_LONG) && SIZEOF_VOID_P == SIZEOF_LONG_LONG | |
451 typedef long long intptr_t; | |
452 typedef unsigned long long uintptr_t; | |
453 #else | |
454 /* Just pray. May break, may not. */ | |
455 typedef long intptr_t; | |
456 typedef unsigned long uintptr_t; | |
457 #endif | |
458 | |
3988 | 459 #if SIZEOF_VOID_P == 8 |
460 #define DEADBEEF_CONSTANT 0xCAFEBABEDEADBEEF | |
461 #elif SIZEOF_VOID_P == 4 | |
462 #define DEADBEEF_CONSTANT 0xDEADBEEF | |
463 #else | |
464 #error "What size are your pointers, really?" | |
465 #endif /* SIZEOF_VOID_P == 8 */ | |
466 | |
2367 | 467 /* ---------------------- definition of EMACS_INT --------------------- */ |
468 | |
469 /* EMACS_INT is the underlying integral type into which a Lisp_Object must fit. | |
470 In particular, it must be large enough to contain a pointer. | |
471 config.h can override this, e.g. to use `long long' for bigger lisp ints. | |
472 | |
473 #### In point of fact, it would NOT be a good idea for config.h to mess | |
474 with EMACS_INT. A lot of code makes the basic assumption that EMACS_INT | |
475 is the size of a pointer. */ | |
476 | |
477 #ifndef SIZEOF_EMACS_INT | |
478 # define SIZEOF_EMACS_INT SIZEOF_VOID_P | |
479 #endif | |
480 | |
481 #ifndef EMACS_INT | |
482 # if SIZEOF_EMACS_INT == SIZEOF_LONG | |
483 # define EMACS_INT long | |
484 # elif SIZEOF_EMACS_INT == SIZEOF_INT | |
485 # define EMACS_INT int | |
486 # elif SIZEOF_EMACS_INT == SIZEOF_LONG_LONG | |
487 # define EMACS_INT long long | |
488 # else | |
489 # error Unable to determine suitable type for EMACS_INT | |
490 # endif | |
491 #endif | |
492 | |
493 #ifndef EMACS_UINT | |
494 # define EMACS_UINT unsigned EMACS_INT | |
495 #endif | |
496 | |
497 #define BITS_PER_EMACS_INT (SIZEOF_EMACS_INT * BITS_PER_CHAR) | |
498 | |
499 /* -------------------------- basic byte typedefs --------------------- */ | |
500 | |
501 /* The definitions we put here and in the next section use typedefs to | |
502 attribute specific meaning to types that by themselves are pretty | |
503 general. | |
504 | |
505 REMEMBER! These typedefs are purely for documentation purposes; from | |
647 | 506 the C code's perspective, they are exactly equivalent to `char *', |
507 `unsigned char *', etc., so you can freely use them with library | |
2367 | 508 functions declared as such. |
509 | |
510 (See also "Byte/Character Types" in text.c) | |
511 | |
512 The basic semantics for `char': | |
513 | |
514 a) [Ibyte] pointer to internally-formatted text | |
515 b) [Extbyte] pointer to text in some external format, which can be | |
516 defined as all formats other than the internal one | |
517 c) [Ascbyte] pure ASCII text | |
518 d) [Binbyte] binary data that is not meant to be interpreted as text | |
519 e) [Rawbyte] general data in memory, where we don't care about whether | |
520 it's text or binary | |
521 f) [Boolbyte] a zero or a one | |
522 g) [Bitbyte] a byte used for bit fields | |
523 h) [Chbyte] null-semantics `char *'; used when casting an argument to | |
524 an external API where the the other types may not be | |
525 appropriate | |
526 | |
527 | |
528 Prefixing codes: | |
529 | |
530 C = plain char, when the base type is unsigned | |
531 U = unsigned | |
532 S = signed | |
533 | |
534 Ideally, XEmacs code should NEVER directly use `char' or any type | |
535 derived from it. This is for Mule-cleanliness. If you find yourself | |
536 wanting or needing to use `char' and one of the above six semantics does | |
537 not apply, add a new type of semantics; don't use `char' directly. | |
538 | |
539 See text.c under "Byte Types", and following sections. | |
540 */ | |
647 | 541 |
542 /* The data representing the text in a buffer is logically a set | |
867 | 543 of Ibytes, declared as follows. */ |
544 | |
545 typedef unsigned char Ibyte; | |
647 | 546 |
547 /* The following should be used when you are working with internal data | |
548 but for whatever reason need to have it declared a "char *". Examples | |
549 are function arguments whose values are most commonly literal strings, | |
550 or where you have to apply a stdlib string function to internal data. | |
551 | |
2367 | 552 In general, you should avoid this where possible and use Ascbyte if the |
553 text is just ASCII (e.g. string literals) or otherwise Ibyte, for | |
554 consistency. For example, the new Mule workspace contains Ibyte | |
555 versions of the stdlib string functions. */ | |
867 | 556 |
557 typedef char CIbyte; | |
647 | 558 |
559 /* The data representing a string in "external" format (binary or any | |
560 external encoding) is logically a set of Extbytes, declared as | |
561 follows. Extbyte is guaranteed to be just a char, so for example | |
562 strlen (Extbyte *) is OK. Extbyte is only a documentation device | |
563 for referring to external text. */ | |
564 | |
565 typedef char Extbyte; | |
771 | 566 typedef unsigned char UExtbyte; |
647 | 567 |
2367 | 568 #define EXTTEXT_ZTERM_SIZE (sizeof (Extbyte)) |
647 | 569 |
570 /* A byte in a string in entirely US-ASCII format: (Nothing outside | |
571 the range 00 - 7F) */ | |
572 | |
2367 | 573 typedef char Ascbyte; |
574 typedef unsigned char UAscbyte; | |
575 | |
576 /* A generic memory pointer, no text or binary semantics assumed. | |
577 In general, there should be no manipulation of the memory pointed to | |
578 by these pointers other than just copying it around. */ | |
579 | |
580 typedef unsigned char Rawbyte; | |
581 typedef char CRawbyte; | |
582 | |
583 /* A byte in a string in binary (not meant as text) format: */ | |
584 | |
585 typedef unsigned char Binbyte; | |
586 typedef char CBinbyte; | |
587 typedef signed char SBinbyte; | |
588 | |
589 /* A byte used to represent a boolean value: 0 or 1. | |
590 Normally use plain Boolint, and only use Boolbyte to save space. */ | |
591 | |
592 typedef char Boolbyte; | |
593 | |
594 /* A byte composed of bitfields. Hardly ever used. */ | |
595 | |
596 typedef unsigned char Bitbyte; | |
597 | |
598 /* A no-semantics `char'. Used (pretty-much) ONLY for casting arguments to | |
599 functions accepting a `char *', `unsigned char *', etc. where the other | |
600 types don't exactly apply and what you are logically concerned with is | |
601 the type of the function's argument and not its semantics. | |
602 | |
603 DO NOT DO NOT DO NOT DO NOT use this as a sloppy replacement for one of | |
604 the other types. If you're not using this as part of casting an | |
605 argument to a function call, and you're not Ben Wing, you're using it | |
606 wrong. Go find another one of the types. */ | |
607 | |
608 typedef char Chbyte; | |
609 typedef unsigned char UChbyte; | |
610 typedef signed char SChbyte; | |
611 | |
612 /* ------------------------ other text-related typedefs ------------------- */ | |
647 | 613 |
826 | 614 /* To the user, a buffer is made up of characters. In the non-Mule world, |
867 | 615 characters and Ibytes are equivalent, restricted to the range 0 - 255. |
3498 | 616 In the Mule world, many more characters are possible (21 bits worth, |
867 | 617 more or less), and a character requires (typically) 1 to 4 Ibytes for |
826 | 618 its representation in a buffer or string. Note that the representation |
619 of a character by itself, in a variable, is very different from its | |
620 representation in a string of text (in a buffer or Lisp string). | |
621 | |
622 Under Mule, text can be represented in more than one way. The "default" | |
623 format is variable-width (1 to 4 bytes) and compatible with ASCII -- | |
624 ASCII chars are stored in one byte, as themselves, and all other chars | |
625 use only high bytes. The default format is currently the only format | |
626 used for text stored anywhere but in a buffer. In a buffer, other | |
627 formats -- fixed-width formats (1, 2, or 4 bytes) -- are possible, for | |
628 speed. | |
629 | |
630 See text.c/text.h for a detailed discussion of all of this. */ | |
631 | |
632 /* A character, as represented on its own. */ | |
647 | 633 |
867 | 634 typedef int Ichar; |
647 | 635 |
826 | 636 /* The "raw value" of a character as stored in the buffer. In the default |
637 format, this is just the same as the character. In fixed-width formats, | |
638 this is the actual value in the buffer, which will be limited to the | |
639 range as established by the format. This is used when searching for a | |
640 character in a buffer -- it's faster to convert the character to the raw | |
641 value and look for that, than repeatedly convert each raw value in the | |
642 buffer into a character. */ | |
643 | |
867 | 644 typedef int Raw_Ichar; |
826 | 645 |
2367 | 646 /* Internal text as a series of textual units (8-bit bytes in the old |
647 "Mule" encoding -- still the standard internal encoding -- and in UTF-8, | |
648 but 16-bit bytes in UTF-16 and 32-bit bytes in UTF-32). See text.c. */ | |
649 | |
650 #ifdef UTF16_IBYTE_FORMAT | |
651 #define NON_ASCII_INTERNAL_FORMAT | |
652 typedef unsigned short Itext; | |
653 #else | |
654 typedef Ibyte Itext; | |
655 #endif | |
656 typedef EMACS_INT Textcount; | |
657 | |
658 #define ITEXT_SIZE (sizeof (Itext)) | |
659 /* Use this to emphasize that we are adding space for the zero-terminator */ | |
660 #define ITEXT_ZTERM_SIZE ITEXT_SIZE | |
661 | |
662 /* Wexttext is wchar_t on WIN32_NATIVE (and perhaps other systems that | |
663 support wchar_t's in library functions), and Extbyte otherwise. This is | |
664 used whenever we have to do any sort of manipulation of | |
665 externally-encoded strings -- generally a very bad idea, and unsafe, but | |
666 in some cases we have no choice (especially at startup, and esp. prior | |
667 to pdump, where we haven't loaded the Unicode tables necessary for | |
668 conversion under Windows). On platforms where the external encoding may | |
669 be Unicode (i.e. Windows), we always do our manipulations in Unicode, | |
670 converting to and from multibyte if necessary -- otherwise we'd have to | |
671 conditionalize on Unicode vs. multibyte all over the place, which is | |
672 just a nightmare. */ | |
673 #ifdef WIN32_NATIVE | |
674 #define WEXTTEXT_IS_WIDE | |
675 typedef wchar_t Wexttext; | |
676 #else | |
677 typedef Extbyte Wexttext; | |
678 #endif | |
826 | 679 |
680 #if !defined (__cplusplus) || !defined (CPLUSPLUS_INTEGRAL_CLASSES_NOT_YET) | |
681 | |
682 /* Counts of bytes or chars */ | |
683 | |
684 typedef EMACS_INT Bytecount; | |
685 typedef EMACS_INT Charcount; | |
686 | |
647 | 687 /* Different ways of referring to a position in a buffer. We use |
688 the typedefs in preference to 'EMACS_INT' to make it clearer what | |
826 | 689 sort of position is being used. See text.c for a description |
690 of the different positions. | |
691 | |
692 Note that buffer positions are 1-based, and there's a gap in the middle | |
693 of a buffer; that's why we have separate typedefs. For Lisp strings and | |
694 other strings of text, we just use Bytecount and Charcount. */ | |
800 | 695 |
665 | 696 typedef EMACS_INT Charbpos; |
697 typedef EMACS_INT Bytebpos; | |
698 typedef EMACS_INT Membpos; | |
647 | 699 |
826 | 700 /* Different ways of referring to a position that can be either in a buffer |
701 or string; used when passing around an object that can be either a | |
702 buffer or string, and an associated position. Conceptually, they | |
703 resolve as follows: | |
704 | |
705 Typedef Buffer String | |
706 ------------------------------------------------------ | |
707 Charxpos Charbpos Charcount | |
708 Bytexpos Bytebpos Bytecount | |
709 Memxpos Membpos Bytecount | |
710 | |
711 */ | |
712 | |
814 | 713 typedef EMACS_INT Charxpos; |
714 typedef EMACS_INT Bytexpos; | |
715 typedef EMACS_INT Memxpos; | |
716 | |
717 #else /* __cplusplus */ | |
718 | |
719 /* Implement strong type-checking of the above integral types by declaring | |
720 them to be classes and using operator overloading. Unfortunately this | |
721 is a huge pain in the ass because C++ doesn't strongly distinguish | |
722 "bool" and "size_t" from int. The problem is especially bad with "bool" | |
2956 | 723 -- if you want to be able to say `if (len--)' where len is e.g. a |
814 | 724 Bytecount, you need to declare a conversion operator to bool(); and |
725 since bool is just an alias for int, you suddenly get tons and tons of | |
726 ambiguities, which need to be resolved by lots of laborious declarations | |
727 for every single possible type combination. Hence the multitude of | |
728 declarations in DECLARE_INTCLASS_ARITH_COMPARE(). The bool/int | |
729 equivalence also means that we have to forcibly block the combinations | |
730 we don't want by creating overloaded versions of them and declaring them | |
731 private. */ | |
732 | |
733 class Bytecount; | |
734 class Bytebpos; | |
735 class Bytexpos; | |
736 class Charcount; | |
737 class Charbpos; | |
738 class Charxpos; | |
739 class Membpos; | |
740 class Memxpos; | |
741 | |
742 /* Declare the arithmetic and comparison operations for an integral class, | |
743 i.e. one of the above classes. If this is a "position" class, where the | |
744 difference between two positions is a different class (a "count" class), | |
745 then use POSCL for the position class and COUNTCL for the count class. | |
746 If this is a simple class, where all operations yield the same class, | |
747 substitute the same class for POSCL and COUNTCL. */ | |
748 | |
749 #define DECLARE_INTCLASS_ARITH_COMPARE(poscl, countcl) \ | |
750 poscl operator += (const countcl& l) { data += l.data; return *this; } \ | |
751 poscl operator -= (const countcl& l) { data -= l.data; return *this; } \ | |
752 poscl operator + (const countcl& l) const { return poscl (data + l.data); } \ | |
753 poscl operator - (const countcl& l) const { return poscl (data - l.data); } \ | |
754 poscl operator += (const int& l) { data += l; return *this; } \ | |
755 poscl operator -= (const int& l) { data -= l; return *this; } \ | |
756 poscl operator + (const int& l) const { return poscl (data + l); } \ | |
757 poscl operator - (const int& l) const { return poscl (data - l); } \ | |
758 poscl operator += (const unsigned int& l) { data += l; return *this; } \ | |
759 poscl operator -= (const unsigned int& l) { data -= l; return *this; } \ | |
760 poscl operator + (const unsigned int& l) const \ | |
761 { return poscl (data + l); } \ | |
762 poscl operator - (const unsigned int& l) const \ | |
763 { return poscl (data - l); } \ | |
764 poscl operator += (const long& l) { data += l; return *this; } \ | |
765 poscl operator -= (const long& l) { data -= l; return *this; } \ | |
766 poscl operator + (const long& l) const { return poscl (data + l); } \ | |
767 poscl operator - (const long& l) const { return poscl (data - l); } \ | |
768 poscl operator += (const unsigned long& l) { data += l; return *this; } \ | |
769 poscl operator -= (const unsigned long& l) { data -= l; return *this; } \ | |
770 poscl operator + (const unsigned long& l) const \ | |
771 { return poscl (data + l); } \ | |
772 poscl operator - (const unsigned long& l) const \ | |
773 { return poscl (data - l); } \ | |
774 poscl operator += (const short& l) { data += l; return *this; } \ | |
775 poscl operator -= (const short& l) { data -= l; return *this; } \ | |
776 poscl operator + (const short& l) const { return poscl (data + l); } \ | |
777 poscl operator - (const short& l) const { return poscl (data - l); } \ | |
778 poscl operator += (const unsigned short& l) { data += l; return *this; } \ | |
779 poscl operator -= (const unsigned short& l) { data -= l; return *this; } \ | |
780 poscl operator + (const unsigned short& l) const \ | |
781 { return poscl (data + l); } \ | |
782 poscl operator - (const unsigned short& l) const \ | |
783 { return poscl (data - l); } \ | |
784 \ | |
785 poscl operator *= (const countcl& l) { data *= l.data; return *this; } \ | |
786 poscl operator /= (const countcl& l) { data /= l.data; return *this; } \ | |
787 poscl operator * (const countcl& l) const { return poscl (data * l.data); } \ | |
788 poscl operator / (const countcl& l) const { return poscl (data / l.data); } \ | |
789 poscl operator *= (const int& l) { data *= l; return *this; } \ | |
790 poscl operator /= (const int& l) { data /= l; return *this; } \ | |
791 poscl operator * (const int& l) const { return poscl (data * l); } \ | |
792 poscl operator / (const int& l) const { return poscl (data / l); } \ | |
793 poscl operator *= (const unsigned int& l) { data *= l; return *this; } \ | |
794 poscl operator /= (const unsigned int& l) { data /= l; return *this; } \ | |
795 poscl operator * (const unsigned int& l) const { return poscl (data * l); } \ | |
796 poscl operator / (const unsigned int& l) const { return poscl (data / l); } \ | |
797 poscl operator *= (const long& l) { data *= l; return *this; } \ | |
798 poscl operator /= (const long& l) { data /= l; return *this; } \ | |
799 poscl operator * (const long& l) const { return poscl (data * l); } \ | |
800 poscl operator / (const long& l) const { return poscl (data / l); } \ | |
801 poscl operator *= (const unsigned long& l) { data *= l; return *this; } \ | |
802 poscl operator /= (const unsigned long& l) { data /= l; return *this; } \ | |
803 poscl operator * (const unsigned long& l) const \ | |
804 { return poscl (data * l); } \ | |
805 poscl operator / (const unsigned long& l) const \ | |
806 { return poscl (data / l); } \ | |
807 poscl operator *= (const short& l) { data *= l; return *this; } \ | |
808 poscl operator /= (const short& l) { data /= l; return *this; } \ | |
809 poscl operator * (const short& l) const { return poscl (data * l); } \ | |
810 poscl operator / (const short& l) const { return poscl (data / l); } \ | |
811 poscl operator *= (const unsigned short& l) { data *= l; return *this; } \ | |
812 poscl operator /= (const unsigned short& l) { data /= l; return *this; } \ | |
813 poscl operator * (const unsigned short& l) const \ | |
814 { return poscl (data * l); } \ | |
815 poscl operator / (const unsigned short& l) const \ | |
816 { return poscl (data / l); } \ | |
817 \ | |
818 poscl operator &= (const countcl& l) { data &= l.data; return *this; } \ | |
819 poscl operator |= (const countcl& l) { data |= l.data; return *this; } \ | |
820 poscl operator & (const countcl& l) const { return poscl (data & l.data); } \ | |
821 poscl operator | (const countcl& l) const { return poscl (data | l.data); } \ | |
822 poscl operator &= (const int& l) { data &= l; return *this; } \ | |
823 poscl operator |= (const int& l) { data |= l; return *this; } \ | |
824 poscl operator & (const int& l) const { return poscl (data & l); } \ | |
825 poscl operator | (const int& l) const { return poscl (data | l); } \ | |
826 poscl operator &= (const unsigned int& l) { data &= l; return *this; } \ | |
827 poscl operator |= (const unsigned int& l) { data |= l; return *this; } \ | |
828 poscl operator & (const unsigned int& l) const { return poscl (data & l); } \ | |
829 poscl operator | (const unsigned int& l) const { return poscl (data | l); } \ | |
830 poscl operator &= (const long& l) { data &= l; return *this; } \ | |
831 poscl operator |= (const long& l) { data |= l; return *this; } \ | |
832 poscl operator & (const long& l) const { return poscl (data & l); } \ | |
833 poscl operator | (const long& l) const { return poscl (data | l); } \ | |
834 poscl operator &= (const unsigned long& l) { data &= l; return *this; } \ | |
835 poscl operator |= (const unsigned long& l) { data |= l; return *this; } \ | |
836 poscl operator & (const unsigned long& l) const \ | |
837 { return poscl (data & l); } \ | |
838 poscl operator | (const unsigned long& l) const \ | |
839 { return poscl (data | l); } \ | |
840 poscl operator &= (const short& l) { data &= l; return *this; } \ | |
841 poscl operator |= (const short& l) { data |= l; return *this; } \ | |
842 poscl operator & (const short& l) const { return poscl (data & l); } \ | |
843 poscl operator | (const short& l) const { return poscl (data | l); } \ | |
844 poscl operator &= (const unsigned short& l) { data &= l; return *this; } \ | |
845 poscl operator |= (const unsigned short& l) { data |= l; return *this; } \ | |
846 poscl operator & (const unsigned short& l) const \ | |
847 { return poscl (data & l); } \ | |
848 poscl operator | (const unsigned short& l) const \ | |
849 { return poscl (data | l); } \ | |
850 \ | |
851 poscl operator - () { return poscl (-data); } \ | |
852 poscl operator-- () { data--; return *this; } \ | |
853 poscl operator-- (int) { data--; return poscl (data + 1); } \ | |
854 poscl operator++ () { data++; return *this; } \ | |
855 poscl operator++ (int) { data++; return poscl (data - 1); } \ | |
856 \ | |
857 bool operator < (const poscl& l) const { return data < l.data; } \ | |
858 bool operator <= (const poscl& l) const { return data <= l.data; } \ | |
859 bool operator > (const poscl& l) const { return data > l.data; } \ | |
860 bool operator >= (const poscl& l) const { return data >= l.data; } \ | |
861 bool operator == (const poscl& l) const { return data == l.data; } \ | |
862 bool operator != (const poscl& l) const { return data != l.data; } \ | |
863 bool operator < (const int& l) const { return data < (EMACS_INT) l; } \ | |
864 bool operator <= (const int& l) const { return data <= (EMACS_INT) l; } \ | |
865 bool operator > (const int& l) const { return data > (EMACS_INT) l; } \ | |
866 bool operator >= (const int& l) const { return data >= (EMACS_INT) l; } \ | |
867 bool operator == (const int& l) const { return data == (EMACS_INT) l; } \ | |
868 bool operator != (const int& l) const { return data != (EMACS_INT) l; } \ | |
869 bool operator < (const unsigned int& l) const \ | |
870 { return data < (EMACS_INT) l; } \ | |
871 bool operator <= (const unsigned int& l) const \ | |
872 { return data <= (EMACS_INT) l; } \ | |
873 bool operator > (const unsigned int& l) const \ | |
874 { return data > (EMACS_INT) l; } \ | |
875 bool operator >= (const unsigned int& l) const \ | |
876 { return data >= (EMACS_INT) l; } \ | |
877 bool operator == (const unsigned int& l) const \ | |
878 { return data == (EMACS_INT) l; } \ | |
879 bool operator != (const unsigned int& l) const \ | |
880 { return data != (EMACS_INT) l; } \ | |
881 bool operator < (const long& l) const { return data < (EMACS_INT) l; } \ | |
882 bool operator <= (const long& l) const { return data <= (EMACS_INT) l; } \ | |
883 bool operator > (const long& l) const { return data > (EMACS_INT) l; } \ | |
884 bool operator >= (const long& l) const { return data >= (EMACS_INT) l; } \ | |
885 bool operator == (const long& l) const { return data == (EMACS_INT) l; } \ | |
886 bool operator != (const long& l) const { return data != (EMACS_INT) l; } \ | |
887 bool operator < (const unsigned long& l) const \ | |
888 { return data < (EMACS_INT) l; } \ | |
889 bool operator <= (const unsigned long& l) const \ | |
890 { return data <= (EMACS_INT) l; } \ | |
891 bool operator > (const unsigned long& l) const \ | |
892 { return data > (EMACS_INT) l; } \ | |
893 bool operator >= (const unsigned long& l) const \ | |
894 { return data >= (EMACS_INT) l; } \ | |
895 bool operator == (const unsigned long& l) const \ | |
896 { return data == (EMACS_INT) l; } \ | |
897 bool operator != (const unsigned long& l) const \ | |
898 { return data != (EMACS_INT) l; } \ | |
899 bool operator < (const short& l) const { return data < (EMACS_INT) l; } \ | |
900 bool operator <= (const short& l) const { return data <= (EMACS_INT) l; } \ | |
901 bool operator > (const short& l) const { return data > (EMACS_INT) l; } \ | |
902 bool operator >= (const short& l) const { return data >= (EMACS_INT) l; } \ | |
903 bool operator == (const short& l) const { return data == (EMACS_INT) l; } \ | |
904 bool operator != (const short& l) const { return data != (EMACS_INT) l; } \ | |
905 bool operator < (const unsigned short& l) const \ | |
906 { return data < (EMACS_INT) l; } \ | |
907 bool operator <= (const unsigned short& l) const \ | |
908 { return data <= (EMACS_INT) l; } \ | |
909 bool operator > (const unsigned short& l) const \ | |
910 { return data > (EMACS_INT) l; } \ | |
911 bool operator >= (const unsigned short& l) const \ | |
912 { return data >= (EMACS_INT) l; } \ | |
913 bool operator == (const unsigned short& l) const \ | |
914 { return data == (EMACS_INT) l; } \ | |
915 bool operator != (const unsigned short& l) const \ | |
916 { return data != (EMACS_INT) l; } \ | |
917 bool operator ! () const { return !data; } | |
918 | |
919 /* Declare the "bad" or disallowed arithmetic and comparion operations | |
920 between class GOOD and class BAD. Meant to go inside the private | |
921 section of class GOOD. */ | |
922 | |
923 #define DECLARE_BAD_INTCLASS_ARITH_COMPARE(good, bad) \ | |
924 good operator += (const bad& l) { return badret; } \ | |
925 good operator -= (const bad& l) { return badret; } \ | |
926 good operator *= (const bad& l) { return badret; } \ | |
927 good operator /= (const bad& l) { return badret; } \ | |
928 good operator + (const bad& l) { return badret; } \ | |
929 good operator - (const bad& l) { return badret; } \ | |
930 good operator * (const bad& l) { return badret; } \ | |
931 good operator / (const bad& l) { return badret; } \ | |
932 \ | |
933 bool operator < (const bad& l) { return 0; } \ | |
934 bool operator <= (const bad& l) { return 0; } \ | |
935 bool operator > (const bad& l) { return 0; } \ | |
936 bool operator >= (const bad& l) { return 0; } \ | |
937 bool operator == (const bad& l) { return 0; } \ | |
938 bool operator != (const bad& l) { return 0; } | |
939 | |
940 /* Declare the "bad" or disallowed arithmetic operations between class GOOD | |
941 and another of the same class, for a position class. Meant to go inside | |
942 the private section of class GOOD. */ | |
943 | |
944 #define DECLARE_BAD_POS_CLASS_ARITH(good) \ | |
945 good operator += (const good& l) { return badret; } \ | |
946 good operator -= (const good& l) { return badret; } \ | |
947 good operator *= (const good& l) { return badret; } \ | |
948 good operator /= (const good& l) { return badret; } \ | |
949 good operator + (const good& l) { return badret; } \ | |
950 good operator * (const good& l) { return badret; } \ | |
951 good operator / (const good& l) { return badret; } | |
952 | |
953 /* Basic declaration at the top of all integral classes. Don't call | |
954 directly, use one of the more specific versions below. */ | |
955 | |
956 #define DECLARE_INTCLASS(cl) \ | |
957 public: \ | |
958 EMACS_INT data; \ | |
959 cl () { data = 0xCDCDCDCD; } \ | |
960 cl (int i) { data = i; } \ | |
961 cl (unsigned int i) { data = i; } \ | |
962 cl (long i) { data = i; } \ | |
963 cl (unsigned long i) { data = i; } \ | |
964 cl (short i) { data = i; } \ | |
965 cl (unsigned short i) { data = i; } \ | |
966 operator EMACS_INT () const { return data; } | |
967 | |
968 /* Basic declaration at the top of all count classes. */ | |
969 | |
970 #define DECLARE_COUNT_CLASS(cl) \ | |
971 DECLARE_INTCLASS (cl) \ | |
972 DECLARE_INTCLASS_ARITH_COMPARE (cl, cl) \ | |
973 private: \ | |
974 static cl badret; | |
975 | |
976 /* Basic declaration at the bottom of the prelude of all position classes. | |
977 Don't call directly. */ | |
978 | |
979 #define DECLARE_POS_CLASS_SECOND_HALF(cl, countcl) \ | |
980 DECLARE_INTCLASS_ARITH_COMPARE (cl, countcl) \ | |
981 countcl operator - (const cl& l) const { return countcl (data - l.data); } \ | |
982 private: \ | |
983 static cl badret; \ | |
984 DECLARE_BAD_POS_INTCLASS_ARITH (cl) | |
985 | |
986 /* Basic declaration at the top of all buffer position classes. */ | |
987 | |
988 #define DECLARE_BPOS_CLASS(cl, countcl) \ | |
989 DECLARE_INTCLASS (cl) \ | |
990 DECLARE_POS_CLASS_SECOND_HALF (cl, countcl) | |
991 | |
992 /* Basic declaration at the top of all X-position classes (that can refer | |
993 to buffers or strings). CL1 and CL2 are the equivalent more specific | |
1318 | 994 classes referring only to buffers or strings, respectively. */ |
814 | 995 |
996 #define DECLARE_XPOS_CLASS(cl, countcl, cl1, cl2) \ | |
997 DECLARE_INTCLASS (cl) \ | |
998 cl (const cl1& x) { data = x.data; } \ | |
999 cl (const cl2& x) { data = x.data; } \ | |
1000 operator cl1 () const { return cl1 (data); } \ | |
1001 operator cl2 () const { return cl2 (data); } \ | |
1002 DECLARE_POS_CLASS_SECOND_HALF (cl, countcl) | |
1003 | |
1004 /* Declare the "bad" or disallowed arithmetic and comparion operations | |
1005 between class CHARCL (a character class) and various non-character | |
1006 classes. Meant to go inside the private section of class GOOD. */ | |
1007 | |
1008 #define DECLARE_BAD_CHAR_INTCLASS_ARITH_COMPARE(charcl) \ | |
1009 DECLARE_BAD_INTCLASS_ARITH_COMPARE (charcl, Bytecount) \ | |
1010 DECLARE_BAD_INTCLASS_ARITH_COMPARE (charcl, Bytebpos) \ | |
1011 DECLARE_BAD_INTCLASS_ARITH_COMPARE (charcl, Bytexpos) \ | |
1012 DECLARE_BAD_INTCLASS_ARITH_COMPARE (charcl, Membpos) \ | |
1013 DECLARE_BAD_INTCLASS_ARITH_COMPARE (charcl, Memxpos) | |
1014 | |
1015 /* Declare the "bad" or disallowed arithmetic and comparion operations | |
1016 between class BYTECL (a byte class) and various non-byte classes. | |
1017 Meant to go inside the private section of class GOOD. */ | |
1018 | |
1019 #define DECLARE_BAD_BYTE_INTCLASS_ARITH_COMPARE(bytecl) \ | |
1020 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Charcount) \ | |
1021 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Charbpos) \ | |
1022 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Charxpos) \ | |
1023 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Membpos) \ | |
1024 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Memxpos) | |
1025 | |
1026 /* Declare the "bad" or disallowed arithmetic and comparion operations | |
1027 between class BYTECL (a mem class) and various non-mem classes. | |
1028 Meant to go inside the private section of class GOOD. */ | |
1029 | |
1030 #define DECLARE_BAD_MEM_INTCLASS_ARITH_COMPARE(bytecl) \ | |
1031 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Charcount) \ | |
1032 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Charbpos) \ | |
1033 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Charxpos) \ | |
1034 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Bytebpos) \ | |
1035 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Bytexpos) | |
1036 | |
1037 class Charcount | |
1038 { | |
1039 DECLARE_COUNT_CLASS (Charcount) | |
1040 DECLARE_BAD_CHAR_INTCLASS_ARITH_COMPARE (Charcount) | |
1041 }; | |
1042 | |
1043 class Charbpos | |
1044 { | |
1045 DECLARE_BPOS_CLASS (Charbpos, Charcount) | |
1046 DECLARE_BAD_CHAR_INTCLASS_ARITH_COMPARE (Charbpos) | |
1047 }; | |
1048 | |
1049 class Charxpos | |
1050 { | |
1051 DECLARE_XPOS_CLASS (Charxpos, Charcount, Charbpos, Charcount) | |
1052 DECLARE_BAD_CHAR_INTCLASS_ARITH_COMPARE (Charxpos) | |
1053 }; | |
1054 | |
1055 class Bytecount | |
1056 { | |
1057 DECLARE_COUNT_CLASS (Bytecount) | |
1058 DECLARE_BAD_BYTE_INTCLASS_ARITH_COMPARE (Bytecount) | |
1059 }; | |
1060 | |
1061 class Bytebpos | |
1062 { | |
1063 DECLARE_BPOS_CLASS (Bytebpos, Bytecount) | |
1064 DECLARE_BAD_BYTE_INTCLASS_ARITH_COMPARE (Bytebpos) | |
1065 }; | |
1066 | |
1067 class Bytexpos | |
1068 { | |
1069 DECLARE_XPOS_CLASS (Bytexpos, Bytecount, Bytebpos, Bytecount) | |
1070 DECLARE_BAD_BYTE_INTCLASS_ARITH_COMPARE (Bytexpos) | |
1071 }; | |
1072 | |
1073 class Membpos | |
1074 { | |
1075 DECLARE_BPOS_CLASS (Membpos, Bytecount) | |
1076 DECLARE_BAD_MEM_INTCLASS_ARITH_COMPARE (Membpos) | |
1077 }; | |
1078 | |
1079 class Memxpos | |
1080 { | |
1081 DECLARE_XPOS_CLASS (Memxpos, Bytecount, Membpos, Bytecount) | |
1082 DECLARE_BAD_MEM_INTCLASS_ARITH_COMPARE (Memxpos) | |
1083 }; | |
1084 | |
826 | 1085 #define DECLARE_POINTER_TYPE_ARITH_COUNT(pointer, countcl) \ |
1086 inline pointer operator += (const pointer & x, const countcl& y) \ | |
1087 { x += y.data; return x; } \ | |
1088 inline pointer operator -= (const pointer & x, const countcl& y) \ | |
1089 { x -= y.data; return x; } \ | |
1090 inline pointer operator + (const pointer x, const countcl& y) \ | |
1091 { return x + y.data; } \ | |
1092 inline pointer operator - (const pointer x, const countcl& y) \ | |
814 | 1093 { return x - y.data; } |
1094 | |
1095 #define DECLARE_INTEGRAL_TYPE_ARITH_COUNT(integral, countcl) \ | |
1096 inline integral operator += (integral & x, const countcl& y) \ | |
1097 { x += y.data; return x; } \ | |
1098 inline integral operator -= (integral & x, const countcl& y) \ | |
1099 { x -= y.data; return x; } \ | |
1100 inline countcl operator + (integral x, const countcl& y) \ | |
1101 { return countcl (x + y.data); } \ | |
1102 inline countcl operator - (integral x, const countcl& y) \ | |
1103 { return countcl (x - y.data); } | |
1104 | |
1105 #define DECLARE_INTEGRAL_TYPE_COMPARE(integral, cl) \ | |
1106 inline bool operator < (integral x, const cl& y) \ | |
1107 { return (EMACS_INT) x < y.data; } \ | |
1108 inline bool operator <= (integral x, const cl& y) \ | |
1109 { return (EMACS_INT) x <= y.data; } \ | |
1110 inline bool operator > (integral x, const cl& y) \ | |
1111 { return (EMACS_INT) x > y.data; } \ | |
1112 inline bool operator >= (integral x, const cl& y) \ | |
1113 { return (EMACS_INT) x >= y.data; } \ | |
1114 inline bool operator == (integral x, const cl& y) \ | |
1115 { return (EMACS_INT) x == y.data; } \ | |
1116 inline bool operator != (integral x, const cl& y) \ | |
1117 { return (EMACS_INT) x != y.data; } | |
1118 | |
1119 #if 0 | |
1120 /* Unfortunately C++ doesn't let you overload the ?: operator, so we have | |
1121 to manually deal with ambiguities using casting */ | |
1122 #define DECLARE_INTEGRAL_TYPE_TRISTATE(integral, cl) \ | |
1123 inline cl operator ?: (bool b, integral x, const cl& y) \ | |
1124 { return b ? cl (x) : y; } \ | |
1125 inline cl operator ?: (bool b, const cl& x, integral y) \ | |
1126 { return b ? x : cl (y); } | |
1127 #endif /* 0 */ | |
1128 | |
867 | 1129 /* DECLARE_POINTER_TYPE_ARITH_COUNT (const Ibyte *, Bytecount); |
826 | 1130 DECLARE_POINTER_TYPE_ARITH_COUNT (const Extbyte *, Bytecount); */ |
867 | 1131 DECLARE_POINTER_TYPE_ARITH_COUNT (Ibyte *, Bytecount); |
814 | 1132 DECLARE_POINTER_TYPE_ARITH_COUNT (Extbyte *, Bytecount); |
1133 | |
1134 DECLARE_INTEGRAL_TYPE_ARITH_COUNT (int, Bytecount); | |
1135 DECLARE_INTEGRAL_TYPE_ARITH_COUNT (int, Charcount); | |
1136 DECLARE_INTEGRAL_TYPE_ARITH_COUNT (unsigned int, Bytecount); | |
1137 DECLARE_INTEGRAL_TYPE_ARITH_COUNT (unsigned int, Charcount); | |
1138 DECLARE_INTEGRAL_TYPE_ARITH_COUNT (long, Bytecount); | |
1139 DECLARE_INTEGRAL_TYPE_ARITH_COUNT (long, Charcount); | |
1140 DECLARE_INTEGRAL_TYPE_ARITH_COUNT (unsigned long, Bytecount); | |
1141 DECLARE_INTEGRAL_TYPE_ARITH_COUNT (unsigned long, Charcount); | |
1142 | |
1143 DECLARE_INTEGRAL_TYPE_COMPARE (int, Bytecount); | |
1144 DECLARE_INTEGRAL_TYPE_COMPARE (int, Charcount); | |
1145 DECLARE_INTEGRAL_TYPE_COMPARE (unsigned int, Bytecount); | |
1146 DECLARE_INTEGRAL_TYPE_COMPARE (unsigned int, Charcount); | |
1147 DECLARE_INTEGRAL_TYPE_COMPARE (long, Bytecount); | |
1148 DECLARE_INTEGRAL_TYPE_COMPARE (long, Charcount); | |
1149 DECLARE_INTEGRAL_TYPE_COMPARE (unsigned long, Bytecount); | |
1150 DECLARE_INTEGRAL_TYPE_COMPARE (unsigned long, Charcount); | |
1151 | |
1152 #if 0 /* doesn't work */ | |
867 | 1153 inline Bytecount operator - (const Ibyte *x, const Ibyte *y) \ |
814 | 1154 { return Bytecount (x - y); } |
1155 #endif | |
1156 | |
1157 #endif /* __cplusplus */ | |
1158 | |
665 | 1159 /* Counts of elements */ |
1160 typedef EMACS_INT Elemcount; | |
1161 /* Hash codes */ | |
1162 typedef unsigned long Hashcode; | |
2367 | 1163 /* Booleans */ |
1164 typedef int Boolint; | |
771 | 1165 |
793 | 1166 /* ------------------------ basic compiler defines ------------------- */ |
428 | 1167 |
1743 | 1168 #include "compiler.h" |
1632 | 1169 |
793 | 1170 /* ------------------------ alignment definitions ------------------- */ |
1171 | |
454 | 1172 /* No type has a greater alignment requirement than max_align_t. |
1173 (except perhaps for types we don't use, like long double) */ | |
1174 typedef union | |
1175 { | |
1176 struct { long l; } l; | |
1177 struct { void *p; } p; | |
1178 struct { void (*f)(void); } f; | |
1179 struct { double d; } d; | |
1180 } max_align_t; | |
1181 | |
771 | 1182 /* ALIGNOF returns the required alignment of a type -- i.e. a value such |
1183 that data of this type must begin at a memory address which is a | |
1184 multiple of that value. For simple types, this is often the same size | |
1185 as the type itself. */ | |
1186 | |
428 | 1187 #ifndef ALIGNOF |
1188 # if defined (__GNUC__) && (__GNUC__ >= 2) | |
454 | 1189 /* gcc has an extension that gives us exactly what we want. */ |
1190 # define ALIGNOF(type) __alignof__ (type) | |
1191 # elif ! defined (__cplusplus) | |
1192 /* The following is mostly portable, except that: | |
1193 - it doesn't work for inside out declarations like void (*) (void). | |
1194 (so just call ALIGNOF with a typedef'ed name) | |
1195 - it doesn't work with C++. The C++ committee has decided, | |
1196 in its infinite wisdom, that: | |
1197 "Types must be declared in declarations, not in expressions." */ | |
1198 # define ALIGNOF(type) offsetof (struct { char c; type member; }, member) | |
428 | 1199 # else |
456 | 1200 /* C++ is annoying, but it has a big bag of tricks. |
1201 The following doesn't have the "inside out" declaration bug C does. */ | |
458 | 1202 template<typename T> struct alignment_trick { char c; T member; }; |
456 | 1203 # define ALIGNOF(type) offsetof (alignment_trick<type>, member) |
428 | 1204 # endif |
454 | 1205 #endif /* ALIGNOF */ |
428 | 1206 |
771 | 1207 /* ALIGN_SIZE returns the smallest size greater than or equal to LEN which |
1208 is a multiple of UNIT. This can be used to assure that data that | |
1209 follows a block of the returned size is of correct alignment for a type | |
1210 whose alignment (as returned by ALIGNOF) is UNIT (provided that the | |
1211 block itself is correctly aligned for this type; memory returned by | |
1212 malloc() is guaranteed to be correctly aligned for all types). */ | |
1213 | |
428 | 1214 #define ALIGN_SIZE(len, unit) \ |
1215 ((((len) + (unit) - 1) / (unit)) * (unit)) | |
1216 | |
826 | 1217 /* ALIGN_FOR_TYPE returns the smallest size greater than or equal to LEN |
1218 which is aligned for the given type. This can be used to assure that | |
1219 data that follows a block of the returned size is of correct alignment | |
1220 for the type (provided that the block itself is correctly aligned for | |
1221 this type; memory returned by malloc() is guaranteed to be correctly | |
1222 aligned for all types). */ | |
1223 | |
1224 #define ALIGN_FOR_TYPE(len, type) ALIGN_SIZE (len, ALIGNOF (type)) | |
1225 | |
771 | 1226 /* MAX_ALIGN_SIZE returns the smallest size greater than or equal to LEN |
1227 which guarantees that data following a block of such size is correctly | |
1228 aligned for all types (provided that the block itself is so aligned, | |
1229 which is the case for memory returned by malloc()). */ | |
1230 | |
826 | 1231 #define MAX_ALIGN_SIZE(len) ALIGN_FOR_TYPE (len, max_align_t) |
1232 | |
1233 /* ALIGN_PTR returns the smallest pointer >= PTR which is aligned for | |
1234 data of TYPE. */ | |
1235 #define ALIGN_PTR(ptr, type) ((void *) ALIGN_FOR_TYPE ((size_t) (ptr), type)) | |
428 | 1236 |
1743 | 1237 BEGIN_C_DECLS |
1650 | 1238 |
793 | 1239 /* ------------------------ assertions ------------------- */ |
428 | 1240 |
1241 /* We define assert iff USE_ASSERTIONS or DEBUG_XEMACS is defined. | |
1242 Otherwise we define it to be empty. Quantify has shown that the | |
1243 time the assert checks take is measurable so let's not include them | |
771 | 1244 in production binaries. |
1245 | |
788 | 1246 If ASSERTIONS_DONT_ABORT defined, we will continue after assertion |
1247 failures. | |
1248 | |
1249 assert_at_line() is used for asserts inside of inline functions called | |
1250 from error-checking macros. If we're not tricky, we just get the file | |
1251 and line of the inline function, which is not very useful. */ | |
428 | 1252 |
1253 /* Highly dubious kludge */ | |
1254 /* (thanks, Jamie, I feel better now -- ben) */ | |
2367 | 1255 MODULE_API void assert_failed (const Ascbyte *, int, const Ascbyte *); |
4914
1628e3b9601a
When aborting due to unknown opcode, output more descriptive msg
Ben Wing <ben@xemacs.org>
parents:
4910
diff
changeset
|
1256 #define ABORT() assert_failed (__FILE__, __LINE__, "ABORT()") |
1628e3b9601a
When aborting due to unknown opcode, output more descriptive msg
Ben Wing <ben@xemacs.org>
parents:
4910
diff
changeset
|
1257 #define abort_with_msg(msg) assert_failed (__FILE__, __LINE__, msg) |
2535 | 1258 |
4843
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
1259 /* This used to be ((void) (0)) but that triggers lots of unused variable |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
1260 warnings. It's pointless to force all that code to be rewritten, with |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
1261 added ifdefs. Any reasonable compiler will eliminate an expression with |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
1262 no effects. We keep this abstracted out like this in case we want to |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
1263 change it in the future. */ |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
1264 #define disabled_assert(x) ((void) (x)) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
1265 #define disabled_assert_with_message(x, msg) disabled_assert (x) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
1266 #define disabled_assert_at_line(x, file, line) disabled_assert (x) |
715b15990d0a
add more foo_checking_assert macros
Ben Wing <ben@xemacs.org>
parents:
4841
diff
changeset
|
1267 |
2535 | 1268 #ifdef USE_ASSERTIONS |
428 | 1269 # define assert(x) ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, #x)) |
853 | 1270 # define assert_with_message(x, msg) \ |
1271 ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, msg)) | |
788 | 1272 # define assert_at_line(x, file, line) \ |
1273 ((x) ? (void) 0 : assert_failed (file, line, #x)) | |
2535 | 1274 #elif defined (DEBUG_XEMACS) |
1275 # define assert(x) ((x) ? (void) 0 : (void) ABORT ()) | |
2956 | 1276 # define assert_with_message(x, msg) assert (x) |
2535 | 1277 # define assert_at_line(x, file, line) assert (x) |
428 | 1278 #else |
2956 | 1279 /* This used to be ((void) (0)) but that triggers lots of unused variable |
1280 warnings. It's pointless to force all that code to be rewritten, with | |
1281 added ifdefs. Any reasonable compiler will eliminate an expression with | |
1282 no effects. */ | |
1283 # define assert(x) ((void) (x)) | |
1284 # define assert_with_message(x, msg) assert (x) | |
2535 | 1285 # define assert_at_line(x, file, line) assert (x) |
428 | 1286 #endif |
1287 | |
2367 | 1288 /************************************************************************/ |
1289 /** Memory allocation **/ | |
1290 /************************************************************************/ | |
853 | 1291 |
793 | 1292 /* ------------------------ simple memory allocation ------------------- */ |
1293 | |
2367 | 1294 /* Basic memory allocation and freeing functions */ |
1295 void malloc_warning (const Ascbyte *); | |
1743 | 1296 MODULE_API void *xmalloc (Bytecount size) ATTRIBUTE_MALLOC; |
1297 MODULE_API void *xmalloc_and_zero (Bytecount size) ATTRIBUTE_MALLOC; | |
1298 MODULE_API void *xrealloc (void *, Bytecount size) ATTRIBUTE_MALLOC; | |
2367 | 1299 MODULE_API Chbyte *xstrdup (const Chbyte *) ATTRIBUTE_MALLOC; |
1300 | |
1301 /* Basic free function */ | |
1302 | |
1303 MODULE_API void xfree_1 (void *); | |
1304 #ifdef ERROR_CHECK_MALLOC | |
1305 /* This used to use a temporary variable, which both avoided the multiple | |
1306 evaluation and obviated the need for the TYPE argument. But that triggered | |
1307 complaints under strict aliasing. #### There should be a better way. */ | |
1308 #define xfree(lvalue, type) do \ | |
1309 { \ | |
1310 xfree_1 (lvalue); \ | |
3988 | 1311 VOIDP_CAST (lvalue) = (void *) DEADBEEF_CONSTANT; \ |
2367 | 1312 } while (0) |
1313 #else | |
1314 #define xfree(lvalue,type) xfree_1 (lvalue) | |
1315 #endif /* ERROR_CHECK_MALLOC */ | |
1316 | |
1317 /* ------------------------ stack allocation -------------------------- */ | |
1318 | |
1319 /* Allocating excessively large blocks on the stack can cause crashes. | |
851 | 1320 We provide MALLOC_OR_ALLOCA() below for places where it's likely that |
1321 large amounts will be allocated; it mallocs the block if it's too big. | |
1322 Unfortunately, that requires a call to unbind_to() at the end of the | |
1323 function, and it's not feasible to rewrite all calls to alloca() this | |
1324 way. | |
1325 | |
1326 Instead, we use the portable C alloca() substitute in alloca.c above a | |
1327 certain size. This actually uses malloc(), but checks the current stack | |
1328 pointer to see if data from previous alloca() calls needs to be freed. | |
1329 However, this can lead to large heap sizes -- especially since cleanup | |
1330 can only happen in a parent function, and will never happen if (as will | |
1331 often be the case) it's the same function in the same place in the code | |
1332 that keeps tripping the alloca() limit. | |
1333 | |
1334 So we set up a system to periodically force cleanup. Currently we | |
1335 do cleanup: | |
1336 | |
1337 -- Only when there's C alloca() data, and then | |
1338 -- Every stack alloca() or allocation of Lisp data, every call to | |
1339 next_event_internal() [typically near the top of the stack], | |
1340 or every 10th funcall | |
1341 | |
1342 This should not be a big penalty because | |
1343 | |
1344 (a) If there are few C alloca() chunks, checking them will be fast | |
1345 (b) If not, we've allocated a huge amount of heap space (remember, each | |
1346 chunk represents > 256K of heap), and we really want them gone | |
1347 */ | |
1348 | |
1349 /* We use a larger maximum when the choice is alloca() vs. the C alloca() | |
1350 substitute than when the choice is vs. malloc(), because in the former | |
1351 case, our alternative choice is less palatable because the memory may | |
1352 not be freed for awhile. */ | |
1353 | |
1354 #define MAX_ALLOCA_VS_C_ALLOCA 262144 | |
1355 #define MAX_ALLOCA_VS_MALLOC 65536 | |
1356 | |
1357 #define MAX_FUNCALLS_BETWEEN_ALLOCA_CLEANUP 10 | |
1358 | |
1632 | 1359 extern MODULE_API Bytecount __temp_alloca_size__; |
851 | 1360 extern Bytecount funcall_alloca_count; |
1361 | |
1333 | 1362 #ifdef ERROR_CHECK_MALLOC |
1632 | 1363 extern MODULE_API int regex_malloc_disallowed; |
1333 | 1364 #define REGEX_MALLOC_CHECK() assert (!regex_malloc_disallowed) |
1365 #else | |
1366 #define REGEX_MALLOC_CHECK() ((void) 0) | |
1367 #endif | |
1368 | |
851 | 1369 /* Do stack or heap alloca() depending on size. |
1370 | |
1371 NOTE: The use of a global temporary like this is unsafe if ALLOCA() occurs | |
1372 twice anywhere in the same expression; but that seems highly unlikely. The | |
1373 alternative is to force all callers to declare a local temporary if the | |
1374 expression has side effects -- something easy to forget. */ | |
1375 | |
1376 #define ALLOCA(size) \ | |
1333 | 1377 (REGEX_MALLOC_CHECK (), \ |
1378 __temp_alloca_size__ = (size), \ | |
851 | 1379 __temp_alloca_size__ > MAX_ALLOCA_VS_C_ALLOCA ? \ |
1380 xemacs_c_alloca (__temp_alloca_size__) : \ | |
1381 (need_to_check_c_alloca ? xemacs_c_alloca (0) : 0, \ | |
1382 alloca (__temp_alloca_size__))) | |
1383 | |
1318 | 1384 /* Version of ALLOCA() that is guaranteed to work inside of function calls |
1385 (i.e., we call the C alloca if regular alloca() is broken inside of | |
1386 function calls). */ | |
1387 #ifdef BROKEN_ALLOCA_IN_FUNCTION_CALLS | |
1388 #define ALLOCA_FUNCALL_OK(size) xemacs_c_alloca (size) | |
1389 #else | |
1390 #define ALLOCA_FUNCALL_OK(size) ALLOCA (size) | |
1391 #endif | |
1392 | |
2367 | 1393 MODULE_API void *xemacs_c_alloca (unsigned int size) ATTRIBUTE_MALLOC; |
1394 | |
1395 MODULE_API int record_unwind_protect_freeing (void *ptr); | |
1396 | |
1397 DECLARE_INLINE_HEADER ( | |
1398 void * | |
1399 xmalloc_and_record_unwind (Bytecount size) | |
1400 ) | |
1401 { | |
1402 void *ptr = xmalloc (size); | |
1403 record_unwind_protect_freeing (ptr); | |
1404 return ptr; | |
1405 } | |
1406 | |
851 | 1407 /* WARNING: If you use this, you must unbind_to() at the end of your |
1408 function! */ | |
1409 | |
1410 #define MALLOC_OR_ALLOCA(size) \ | |
1333 | 1411 (REGEX_MALLOC_CHECK (), \ |
1412 __temp_alloca_size__ = (size), \ | |
851 | 1413 __temp_alloca_size__ > MAX_ALLOCA_VS_MALLOC ? \ |
1414 xmalloc_and_record_unwind (__temp_alloca_size__) : \ | |
1415 (need_to_check_c_alloca ? xemacs_c_alloca (0) : 0, \ | |
1416 alloca (__temp_alloca_size__))) | |
793 | 1417 |
2367 | 1418 /* -------------- convenience functions for memory allocation ------------- */ |
1419 | |
1420 #define countof(x) ((int) (sizeof(x)/sizeof((x)[0]))) | |
1421 #define xnew(type) ((type *) xmalloc (sizeof (type))) | |
1422 #define xnew_array(type, len) ((type *) xmalloc ((len) * sizeof (type))) | |
1423 #define xnew_and_zero(type) ((type *) xmalloc_and_zero (sizeof (type))) | |
1424 #define xzero(lvalue) ((void) memset (&(lvalue), '\0', sizeof (lvalue))) | |
1425 #define xnew_array_and_zero(type, len) ((type *) xmalloc_and_zero ((len) * sizeof (type))) | |
1426 | |
1427 #define alloca_new(type) ((type *) ALLOCA (sizeof (type))) | |
1428 #define alloca_array(type, len) ((type *) ALLOCA ((len) * sizeof (type))) | |
1429 | |
1430 #define alloca_itexts(num) alloca_array (Itext, num) | |
1431 #define alloca_ibytes(num) alloca_array (Ibyte, num) | |
1432 #define alloca_extbytes(num) alloca_array (Extbyte, num) | |
1433 #define alloca_rawbytes(num) alloca_array (Rawbyte, num) | |
1434 #define alloca_binbytes(num) alloca_array (Binbyte, num) | |
1435 #define alloca_ascbytes(num) alloca_array (Ascbyte, num) | |
1436 #define xmalloc_itexts(num) xnew_array (Itext, num) | |
1437 #define xnew_ibytes(num) xnew_array (Ibyte, num) | |
1438 #define xnew_extbytes(num) xnew_array (Extbyte, num) | |
1439 #define xnew_rawbytes(num) xnew_array (Rawbyte, num) | |
1440 #define xnew_binbytes(num) xnew_array (Binbyte, num) | |
1441 #define xnew_ascbytes(num) xnew_array (Ascbyte, num) | |
1442 | |
1443 /* Make an alloca'd copy of a Ibyte * */ | |
1444 #define IBYTE_STRING_TO_ALLOCA(p, lval) \ | |
1445 do { \ | |
1446 Ibyte **_bsta_ = (Ibyte **) &(lval); \ | |
1447 const Ibyte *_bsta_2 = (p); \ | |
1448 Bytecount _bsta_3 = qxestrlen (_bsta_2); \ | |
1449 *_bsta_ = alloca_ibytes (1 + _bsta_3); \ | |
1450 memcpy (*_bsta_, _bsta_2, 1 + _bsta_3); \ | |
1451 } while (0) | |
1452 | |
1453 /* ----------------- convenience functions for reallocation --------------- */ | |
1454 | |
1455 #define XREALLOC_ARRAY(ptr, type, len) \ | |
1456 ((void) (ptr = (type *) xrealloc (ptr, (len) * sizeof (type)))) | |
1457 | |
793 | 1458 /* also generally useful if you want to avoid arbitrary size limits |
1459 but don't need a full dynamic array. Assumes that BASEVAR points | |
1460 to a malloced array of TYPE objects (or possibly a NULL pointer, | |
1461 if SIZEVAR is 0), with the total size stored in SIZEVAR. This | |
1462 macro will realloc BASEVAR as necessary so that it can hold at | |
1463 least NEEDED_SIZE objects. The reallocing is done by doubling, | |
1464 which ensures constant amortized time per element. */ | |
1465 #define DO_REALLOC(basevar, sizevar, needed_size, type) do { \ | |
1466 Bytecount do_realloc_needed_size = (needed_size); \ | |
1333 | 1467 REGEX_MALLOC_CHECK (); \ |
793 | 1468 if ((sizevar) < do_realloc_needed_size) \ |
1469 { \ | |
1470 if ((sizevar) < 32) \ | |
1471 (sizevar) = 32; \ | |
1472 while ((sizevar) < do_realloc_needed_size) \ | |
1473 (sizevar) *= 2; \ | |
1474 XREALLOC_ARRAY (basevar, type, (sizevar)); \ | |
1475 } \ | |
1476 } while (0) | |
1477 | |
2367 | 1478 /************************************************************************/ |
1479 /** Definitions of more complex types **/ | |
1480 /************************************************************************/ | |
428 | 1481 |
647 | 1482 /* Note that the simplest typedefs are near the top of this file. */ |
1483 | |
428 | 1484 /* We put typedefs here so that prototype declarations don't choke. |
1485 Note that we don't actually declare the structures here (except | |
1486 maybe for simple structures like Dynarrs); that keeps them private | |
1487 to the routines that actually use them. */ | |
1488 | |
771 | 1489 /* ------------------------------- */ |
1490 /* Error_Behavior typedefs */ | |
1491 /* ------------------------------- */ | |
1492 | |
800 | 1493 #ifndef ERROR_CHECK_TYPES |
771 | 1494 |
1495 typedef enum error_behavior | |
428 | 1496 { |
771 | 1497 ERROR_ME, |
1498 ERROR_ME_NOT, | |
793 | 1499 ERROR_ME_WARN, |
1500 ERROR_ME_DEBUG_WARN | |
771 | 1501 } Error_Behavior; |
1502 | |
1503 #define ERRB_EQ(a, b) ((a) == (b)) | |
1504 | |
1505 #else | |
1506 | |
1507 /* By defining it like this, we provide strict type-checking | |
1508 for code that lazily uses ints. */ | |
1509 | |
1510 typedef struct _error_behavior_struct_ | |
428 | 1511 { |
771 | 1512 int really_unlikely_name_to_have_accidentally_in_a_non_errb_structure; |
1513 } Error_Behavior; | |
1514 | |
1515 extern Error_Behavior ERROR_ME; | |
1516 extern Error_Behavior ERROR_ME_NOT; | |
1517 extern Error_Behavior ERROR_ME_WARN; | |
793 | 1518 extern Error_Behavior ERROR_ME_DEBUG_WARN; |
771 | 1519 |
1520 #define ERRB_EQ(a, b) \ | |
1521 ((a).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure == \ | |
1522 (b).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure) | |
1523 | |
1524 #endif | |
1525 | |
1526 /* ------------------------------- */ | |
1527 /* Empty structures and typedefs */ | |
1528 /* ------------------------------- */ | |
428 | 1529 |
1530 struct buffer; /* "buffer.h" */ | |
1531 struct console; /* "console.h" */ | |
1532 struct device; /* "device.h" */ | |
1533 struct extent_fragment; | |
1534 struct extent; | |
1535 struct frame; /* "frame.h" */ | |
1536 struct window; /* "window.h" */ | |
771 | 1537 struct utimbuf; /* "systime.h" or <utime.h> */ |
428 | 1538 struct display_line; |
1539 struct display_glyph_area; | |
1540 struct display_box; | |
1541 struct redisplay_info; | |
1542 struct window_mirror; | |
1543 struct scrollbar_instance; | |
1544 struct font_metric_info; | |
1545 struct face_cachel; | |
1546 struct console_type_entry; | |
1547 | |
771 | 1548 /* This is shared by process.h, events.h and others in future. |
1549 See events.h for description */ | |
4123 | 1550 typedef unsigned EMACS_INT USID; |
771 | 1551 typedef int face_index; |
1552 typedef int glyph_index; | |
1726 | 1553 typedef struct lstream Lstream; /* lstream.h */ |
872 | 1554 typedef struct extent *EXTENT; /* extents-impl.h */ |
771 | 1555 typedef struct Lisp_Event Lisp_Event; /* "events.h" */ |
872 | 1556 typedef struct Lisp_Face Lisp_Face; /* "faces-impl.h" */ |
771 | 1557 typedef struct Lisp_Process Lisp_Process; /* "procimpl.h" */ |
872 | 1558 typedef struct Lisp_Color_Instance Lisp_Color_Instance; /* objects-impl.h */ |
1559 typedef struct Lisp_Font_Instance Lisp_Font_Instance; /* objects-impl.h */ | |
1726 | 1560 typedef struct Lisp_Image_Instance Lisp_Image_Instance; /* glyphs.h */ |
771 | 1561 typedef struct Lisp_Gui_Item Lisp_Gui_Item; |
1562 | |
1563 /* ------------------------------- */ | |
1564 /* enum typedefs */ | |
1565 /* ------------------------------- */ | |
1566 | |
428 | 1567 enum run_hooks_condition |
1568 { | |
1569 RUN_HOOKS_TO_COMPLETION, | |
1570 RUN_HOOKS_UNTIL_SUCCESS, | |
1571 RUN_HOOKS_UNTIL_FAILURE | |
1572 }; | |
1573 | |
1574 #ifdef HAVE_TOOLBARS | |
1575 enum toolbar_pos | |
1576 { | |
1577 TOP_TOOLBAR, | |
1578 BOTTOM_TOOLBAR, | |
1579 LEFT_TOOLBAR, | |
1580 RIGHT_TOOLBAR | |
1581 }; | |
1582 #endif | |
1583 | |
1584 enum edge_style | |
1585 { | |
1586 EDGE_ETCHED_IN, | |
1587 EDGE_ETCHED_OUT, | |
1588 EDGE_BEVEL_IN, | |
1589 EDGE_BEVEL_OUT | |
1590 }; | |
1591 | |
1592 enum munge_me_out_the_door | |
1593 { | |
1594 MUNGE_ME_FUNCTION_KEY, | |
1595 MUNGE_ME_KEY_TRANSLATION | |
1596 }; | |
1597 | |
771 | 1598 /* ------------------------------- */ |
1599 /* misc */ | |
1600 /* ------------------------------- */ | |
1601 | |
1602 #ifdef MEMORY_USAGE_STATS | |
1603 | |
1604 /* This structure is used to keep statistics on the amount of memory | |
1605 in use. | |
1606 | |
1607 WAS_REQUESTED stores the actual amount of memory that was requested | |
1608 of the allocation function. The *_OVERHEAD fields store the | |
1609 additional amount of memory that was grabbed by the functions to | |
1610 facilitate allocation, reallocation, etc. MALLOC_OVERHEAD is for | |
1611 memory allocated with malloc(); DYNARR_OVERHEAD is for dynamic | |
1612 arrays; GAP_OVERHEAD is for gap arrays. Note that for (e.g.) | |
1613 dynamic arrays, there is both MALLOC_OVERHEAD and DYNARR_OVERHEAD | |
1614 memory: The dynamic array allocates memory above and beyond what | |
1615 was asked of it, and when it in turns allocates memory using | |
1616 malloc(), malloc() allocates memory beyond what it was asked | |
1617 to allocate. | |
1618 | |
1619 Functions that accept a structure of this sort do not initialize | |
1620 the fields to 0, and add any existing values to whatever was there | |
1621 before; this way, you can get a cumulative effect. */ | |
1622 | |
1623 struct overhead_stats | |
1624 { | |
1625 int was_requested; | |
1626 int malloc_overhead; | |
1627 int dynarr_overhead; | |
1628 int gap_overhead; | |
1629 }; | |
1630 | |
1631 #endif /* MEMORY_USAGE_STATS */ | |
1632 | |
428 | 1633 |
1634 /************************************************************************/ | |
1635 /* Definition of Lisp_Object data type */ | |
1636 /************************************************************************/ | |
1637 | |
1638 /* Define the fundamental Lisp data structures */ | |
1639 | |
1640 /* This is the set of Lisp data types */ | |
1641 | |
1642 enum Lisp_Type | |
1643 { | |
1644 Lisp_Type_Record, | |
1645 Lisp_Type_Int_Even, | |
1646 Lisp_Type_Char, | |
1647 Lisp_Type_Int_Odd | |
1648 }; | |
1649 | |
1650 #define POINTER_TYPE_P(type) ((type) == Lisp_Type_Record) | |
1651 | |
1652 /* Overridden by m/next.h */ | |
1653 #ifndef ASSERT_VALID_POINTER | |
1654 # define ASSERT_VALID_POINTER(pnt) (assert ((((EMACS_UINT) pnt) & 3) == 0)) | |
1655 #endif | |
1656 | |
1657 #define GCMARKBITS 0 | |
1658 #define GCTYPEBITS 2 | |
1659 #define GCBITS 2 | |
1660 #define INT_GCBITS 1 | |
1661 | |
1662 #define INT_VALBITS (BITS_PER_EMACS_INT - INT_GCBITS) | |
1663 #define VALBITS (BITS_PER_EMACS_INT - GCBITS) | |
542 | 1664 #define EMACS_INT_MAX ((EMACS_INT) ((1UL << (INT_VALBITS - 1)) -1UL)) |
442 | 1665 #define EMACS_INT_MIN (-(EMACS_INT_MAX) - 1) |
802 | 1666 /* WARNING: evaluates its arg twice. */ |
1667 #define NUMBER_FITS_IN_AN_EMACS_INT(num) \ | |
1668 ((num) <= EMACS_INT_MAX && (num) >= EMACS_INT_MIN) | |
428 | 1669 |
1670 #ifdef USE_UNION_TYPE | |
1671 # include "lisp-union.h" | |
1672 #else /* !USE_UNION_TYPE */ | |
1673 # include "lisp-disunion.h" | |
1674 #endif /* !USE_UNION_TYPE */ | |
1675 | |
1676 #define XPNTR(x) ((void *) XPNTRVAL(x)) | |
1677 | |
1678 /* Close your eyes now lest you vomit or spontaneously combust ... */ | |
1679 | |
1680 #define HACKEQ_UNSAFE(obj1, obj2) \ | |
1681 (EQ (obj1, obj2) || (!POINTER_TYPE_P (XTYPE (obj1)) \ | |
1682 && !POINTER_TYPE_P (XTYPE (obj2)) \ | |
1683 && XCHAR_OR_INT (obj1) == XCHAR_OR_INT (obj2))) | |
1684 | |
1685 #ifdef DEBUG_XEMACS | |
1632 | 1686 extern MODULE_API int debug_issue_ebola_notices; |
1687 MODULE_API int eq_with_ebola_notice (Lisp_Object, Lisp_Object); | |
428 | 1688 #define EQ_WITH_EBOLA_NOTICE(obj1, obj2) \ |
1689 (debug_issue_ebola_notices ? eq_with_ebola_notice (obj1, obj2) \ | |
1690 : EQ (obj1, obj2)) | |
1691 #else | |
1692 #define EQ_WITH_EBOLA_NOTICE(obj1, obj2) EQ (obj1, obj2) | |
1693 #endif | |
1694 | |
1695 /* OK, you can open them again */ | |
1696 | |
1743 | 1697 END_C_DECLS |
1650 | 1698 |
428 | 1699 /************************************************************************/ |
442 | 1700 /** Definitions of basic Lisp objects **/ |
428 | 1701 /************************************************************************/ |
1702 | |
1703 #include "lrecord.h" | |
1704 | |
1743 | 1705 BEGIN_C_DECLS |
1650 | 1706 |
3293 | 1707 /* ------------------------ dynamic arrays ------------------- */ |
1708 | |
3092 | 1709 #ifdef NEW_GC |
1710 #ifdef ERROR_CHECK_STRUCTURES | |
1711 #define Dynarr_declare(type) \ | |
1712 struct lrecord_header header; \ | |
1713 type *base; \ | |
1714 const struct lrecord_implementation *lisp_imp; \ | |
1715 int locked; \ | |
1716 int elsize; \ | |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1717 int len; \ |
3092 | 1718 int largest; \ |
1719 int max | |
1720 #else | |
1721 #define Dynarr_declare(type) \ | |
1722 struct lrecord_header header; \ | |
1723 type *base; \ | |
1724 const struct lrecord_implementation *lisp_imp; \ | |
1725 int elsize; \ | |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1726 int len; \ |
3092 | 1727 int largest; \ |
1728 int max | |
1729 #endif /* ERROR_CHECK_STRUCTURES */ | |
3293 | 1730 #else /* not NEW_GC */ |
1731 #ifdef ERROR_CHECK_STRUCTURES | |
1732 #define Dynarr_declare(type) \ | |
1733 struct lrecord_header header; \ | |
1734 type *base; \ | |
1735 int locked; \ | |
1736 int elsize; \ | |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1737 int len; \ |
3293 | 1738 int largest; \ |
1739 int max | |
1740 #else | |
1741 #define Dynarr_declare(type) \ | |
1742 struct lrecord_header header; \ | |
1743 type *base; \ | |
1744 int elsize; \ | |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1745 int len; \ |
3293 | 1746 int largest; \ |
1747 int max | |
1748 #endif /* ERROR_CHECK_STRUCTURES */ | |
1749 #endif /* not NEW_GC */ | |
3092 | 1750 |
1751 typedef struct dynarr | |
1752 { | |
1753 Dynarr_declare (void); | |
1754 } Dynarr; | |
1755 | |
1756 MODULE_API void *Dynarr_newf (int elsize); | |
1757 MODULE_API void Dynarr_resize (void *dy, Elemcount size); | |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1758 MODULE_API void Dynarr_insert_many (void *d, const void *el, int len, |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1759 int start); |
3092 | 1760 MODULE_API void Dynarr_delete_many (void *d, int start, int len); |
1761 MODULE_API void Dynarr_free (void *d); | |
1762 | |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1763 #ifdef ERROR_CHECK_TYPES |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1764 DECLARE_INLINE_HEADER ( |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1765 int |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1766 Dynarr_verify_pos_at (void *d, int pos, const Ascbyte *file, int line) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1767 ) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1768 { |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1769 Dynarr *dy = (Dynarr *) d; |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1770 /* We use `largest', not `len', because the redisplay code often |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1771 accesses stuff between len and largest. */ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1772 assert_at_line (pos >= 0 && pos < dy->largest, file, line); |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1773 return pos; |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1774 } |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1775 #else |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1776 #define Dynarr_verify_pos(d, pos, file, line) (pos) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1777 #endif /* ERROR_CHECK_TYPES */ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1778 |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1779 #ifdef ERROR_CHECK_TYPES |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1780 DECLARE_INLINE_HEADER ( |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1781 int |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1782 Dynarr_verify_pos_atp (void *d, int pos, const Ascbyte *file, int line) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1783 ) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1784 { |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1785 Dynarr *dy = (Dynarr *) d; |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1786 /* We use `largest', not `len', because the redisplay code often |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1787 accesses stuff between len and largest. */ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1788 /* Code will often do something like ... |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1789 |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1790 val = make_bit_vector_from_byte_vector (Dynarr_atp (dyn, 0), |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1791 Dynarr_length (dyn)); |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1792 |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1793 which works fine when the Dynarr_length is non-zero, but when zero, |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1794 the result of Dynarr_atp() not only points past the end of the |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1795 allocated array, but the array may not have ever been allocated and |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1796 hence the return value is NULL. But the length of 0 causes the |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1797 pointer to never get checked. These can occur throughout the code |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1798 so we put in a special check. */ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1799 if (pos == 0 && dy->len == 0) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1800 return pos; |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1801 /* #### It's vaguely possible that some code could legitimately want to |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1802 retrieve a pointer to the position just past the end of dynarr memory. |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1803 This could happen with Dynarr_atp() but not Dynarr_at(). If so, it |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1804 will trigger this assert(). In such cases, it should be obvious that |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1805 the code wants to do this; rather than relaxing the assert, we should |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1806 probably create a new macro Dynarr_atp_allow_end() which is like |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1807 Dynarr_atp() but which allows for pointing at invalid addresses -- we |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1808 really want to check for cases of accessing just past the end of |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1809 memory, which is a likely off-by-one problem to occur and will usually |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1810 not trigger a protection fault (instead, you'll just get random |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1811 behavior, possibly overwriting other memory, which is bad). */ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1812 assert_at_line (pos >= 0 && pos < dy->largest, file, line); |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1813 return pos; |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1814 } |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1815 |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1816 DECLARE_INLINE_HEADER ( |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1817 int |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1818 Dynarr_verify_pos_atp_allow_end (void *d, int pos, const Ascbyte *file, |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1819 int line) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1820 ) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1821 { |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1822 Dynarr *dy = (Dynarr *) d; |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1823 /* We use `largest', not `len', because the redisplay code often |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1824 accesses stuff between len and largest. |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1825 We also allow referencing the very end, past the end of allocated |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1826 legitimately space. See comments in Dynarr_verify_pos_atp.()*/ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1827 assert_at_line (pos >= 0 && pos <= dy->largest, file, line); |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1828 return pos; |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1829 } |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1830 |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1831 #else |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1832 #define Dynarr_verify_pos_at(d, pos, file, line) (pos) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1833 #define Dynarr_verify_pos_atp(d, pos, file, line) (pos) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1834 #define Dynarr_verify_pos_atp_allow_end(d, pos, file, line) (pos) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1835 #endif /* ERROR_CHECK_TYPES */ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1836 |
3293 | 1837 #ifdef NEW_GC |
3092 | 1838 MODULE_API void *Dynarr_lisp_newf (int elsize, |
1839 const struct lrecord_implementation | |
1840 *dynarr_imp, | |
1841 const struct lrecord_implementation *imp); | |
1842 | |
1843 #define Dynarr_lisp_new(type, dynarr_imp, imp) \ | |
1844 ((type##_dynarr *) Dynarr_lisp_newf (sizeof (type), dynarr_imp, imp)) | |
1845 #define Dynarr_lisp_new2(dynarr_type, type, dynarr_imp, imp) \ | |
1846 ((dynarr_type *) Dynarr_lisp_newf (sizeof (type)), dynarr_imp, imp) | |
3293 | 1847 #endif /* NEW_GC */ |
3092 | 1848 #define Dynarr_new(type) ((type##_dynarr *) Dynarr_newf (sizeof (type))) |
1849 #define Dynarr_new2(dynarr_type, type) \ | |
1850 ((dynarr_type *) Dynarr_newf (sizeof (type))) | |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1851 |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1852 #define Dynarr_at(d, pos) \ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1853 ((d)->base[Dynarr_verify_pos_at (d, pos, __FILE__, __LINE__)]) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1854 #define Dynarr_atp_allow_end(d, pos) \ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1855 (&((d)->base[Dynarr_verify_pos_atp_allow_end (d, pos, __FILE__, __LINE__)])) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1856 #define Dynarr_atp(d, pos) \ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1857 (&((d)->base[Dynarr_verify_pos_atp (d, pos, __FILE__, __LINE__)])) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1858 |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1859 /* Old #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos)) */ |
3092 | 1860 #define Dynarr_begin(d) Dynarr_atp (d, 0) |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1861 #define Dynarr_lastp(d) Dynarr_atp (d, Dynarr_length (d) - 1) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1862 #define Dynarr_past_lastp(d) Dynarr_atp_allow_end (d, Dynarr_length (d)) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1863 #define Dynarr_sizeof(d) ((d)->len * (d)->elsize) |
3092 | 1864 |
1865 #ifdef ERROR_CHECK_STRUCTURES | |
1866 DECLARE_INLINE_HEADER ( | |
1867 Dynarr * | |
1868 Dynarr_verify_1 (void *d, const Ascbyte *file, int line) | |
1869 ) | |
1870 { | |
1871 Dynarr *dy = (Dynarr *) d; | |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1872 assert_at_line (dy->len >= 0 && dy->len <= dy->largest && |
3092 | 1873 dy->largest <= dy->max, file, line); |
1874 return dy; | |
1875 } | |
1876 | |
1877 DECLARE_INLINE_HEADER ( | |
1878 Dynarr * | |
1879 Dynarr_verify_mod_1 (void *d, const Ascbyte *file, int line) | |
1880 ) | |
1881 { | |
1882 Dynarr *dy = (Dynarr *) d; | |
1883 assert_at_line (!dy->locked, file, line); | |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1884 assert_at_line (dy->len >= 0 && dy->len <= dy->largest && |
3092 | 1885 dy->largest <= dy->max, file, line); |
1886 return dy; | |
1887 } | |
1888 | |
1889 #define Dynarr_verify(d) Dynarr_verify_1 (d, __FILE__, __LINE__) | |
1890 #define Dynarr_verify_mod(d) Dynarr_verify_mod_1 (d, __FILE__, __LINE__) | |
1891 #define Dynarr_lock(d) (Dynarr_verify_mod (d)->locked = 1) | |
1892 #define Dynarr_unlock(d) ((d)->locked = 0) | |
1893 #else | |
1894 #define Dynarr_verify(d) (d) | |
1895 #define Dynarr_verify_mod(d) (d) | |
1896 #define Dynarr_lock(d) | |
1897 #define Dynarr_unlock(d) | |
1898 #endif /* ERROR_CHECK_STRUCTURES */ | |
1899 | |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1900 #define Dynarr_length(d) (Dynarr_verify (d)->len) |
3092 | 1901 #define Dynarr_largest(d) (Dynarr_verify (d)->largest) |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1902 #define Dynarr_reset(d) (Dynarr_verify_mod (d)->len = 0) |
3092 | 1903 #define Dynarr_insert_many_at_start(d, el, len) \ |
1904 Dynarr_insert_many (d, el, len, 0) | |
1905 #define Dynarr_add_literal_string(d, s) Dynarr_add_many (d, s, sizeof (s) - 1) | |
1906 #define Dynarr_add_lisp_string(d, s, codesys) \ | |
1907 do { \ | |
1908 Lisp_Object dyna_ls_s = (s); \ | |
1909 Lisp_Object dyna_ls_cs = (codesys); \ | |
1910 Extbyte *dyna_ls_eb; \ | |
1911 Bytecount dyna_ls_bc; \ | |
1912 \ | |
1913 LISP_STRING_TO_SIZED_EXTERNAL (dyna_ls_s, dyna_ls_eb, \ | |
1914 dyna_ls_bc, dyna_ls_cs); \ | |
1915 Dynarr_add_many (d, dyna_ls_eb, dyna_ls_bc); \ | |
1916 } while (0) | |
1917 | |
3293 | 1918 #ifdef NEW_GC |
3092 | 1919 #define Dynarr_add(d, el) \ |
1920 do { \ | |
3319 | 1921 const struct lrecord_implementation *imp = (d)->lisp_imp; \ |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1922 if (Dynarr_verify_mod (d)->len >= (d)->max) \ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1923 Dynarr_resize ((d), (d)->len+1); \ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1924 ((d)->base)[(d)->len] = (el); \ |
3092 | 1925 \ |
3319 | 1926 if (imp) \ |
3092 | 1927 set_lheader_implementation \ |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1928 ((struct lrecord_header *)&(((d)->base)[(d)->len]), imp); \ |
3092 | 1929 \ |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1930 (d)->len++; \ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1931 if ((d)->len > (d)->largest) \ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1932 (d)->largest = (d)->len; \ |
3092 | 1933 } while (0) |
3293 | 1934 #else /* not NEW_GC */ |
3092 | 1935 #define Dynarr_add(d, el) ( \ |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1936 Dynarr_verify_mod (d)->len >= (d)->max ? Dynarr_resize ((d), (d)->len+1) : \ |
3092 | 1937 (void) 0, \ |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1938 ((d)->base)[(d)->len++] = (el), \ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1939 (d)->len > (d)->largest ? (d)->largest = (d)->len : (int) 0) |
3293 | 1940 #endif /* not NEW_GC */ |
3092 | 1941 |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1942 /* Add LEN contiguous elements to a Dynarr */ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1943 |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1944 DECLARE_INLINE_HEADER ( |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1945 void |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1946 Dynarr_add_many (void *d, const void *el, int len) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1947 ) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1948 { |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1949 /* This duplicates Dynarr_insert_many to some extent; but since it is |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1950 called so often, it seemed useful to remove the unnecessary stuff |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1951 from that function and to make it inline */ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1952 Dynarr *dy = (Dynarr *) Dynarr_verify (d); |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1953 |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1954 if (dy->len + len > dy->max) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1955 Dynarr_resize (dy, dy->len + len); |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1956 /* Some functions call us with a value of 0 to mean "reserve space but |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1957 don't write into it" */ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1958 if (el) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1959 memcpy ((char *) dy->base + dy->len*dy->elsize, el, len*dy->elsize); |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1960 dy->len += len; |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1961 |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1962 if (dy->len > dy->largest) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1963 dy->largest = dy->len; |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1964 } |
3092 | 1965 |
1966 /* The following defines will get you into real trouble if you aren't | |
1967 careful. But they can save a lot of execution time when used wisely. */ | |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1968 #define Dynarr_increment(d) (Dynarr_verify_mod (d)->len++) |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1969 #define Dynarr_set_size(d, n) \ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1970 do { \ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1971 Bytecount _dss_n = (n); \ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1972 structure_checking_assert (_dss_n >= 0 && _dss_n <= (d)->largest); \ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1973 Dynarr_verify_mod (d)->len = _dss_n; \ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1974 } while (0) |
3092 | 1975 |
1976 #define Dynarr_pop(d) \ | |
4844
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1977 (assert ((d)->len > 0), Dynarr_verify_mod (d)->len--, \ |
91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents:
4843
diff
changeset
|
1978 Dynarr_at (d, (d)->len)) |
3092 | 1979 #define Dynarr_delete(d, i) Dynarr_delete_many (d, i, 1) |
1980 #define Dynarr_delete_by_pointer(d, p) \ | |
1981 Dynarr_delete_many (d, (p) - ((d)->base), 1) | |
1982 | |
1983 #define Dynarr_delete_object(d, el) \ | |
1984 do \ | |
1985 { \ | |
1986 REGISTER int i; \ | |
1987 for (i = Dynarr_length (d) - 1; i >= 0; i--) \ | |
1988 { \ | |
1989 if (el == Dynarr_at (d, i)) \ | |
1990 Dynarr_delete_many (d, i, 1); \ | |
1991 } \ | |
1992 } while (0) | |
1993 | |
1994 #ifdef MEMORY_USAGE_STATS | |
1995 struct overhead_stats; | |
1996 Bytecount Dynarr_memory_usage (void *d, struct overhead_stats *stats); | |
1997 #endif | |
1998 | |
1999 void *stack_like_malloc (Bytecount size); | |
2000 void stack_like_free (void *val); | |
2001 | |
2002 /* ------------------------------- */ | |
2003 /* Dynarr typedefs */ | |
2004 /* ------------------------------- */ | |
2005 | |
2006 /* Dynarr typedefs -- basic types first */ | |
2007 | |
2008 typedef struct | |
2009 { | |
2010 Dynarr_declare (Ibyte); | |
2011 } Ibyte_dynarr; | |
2012 | |
2013 typedef struct | |
2014 { | |
2015 Dynarr_declare (Extbyte); | |
2016 } Extbyte_dynarr; | |
2017 | |
2018 typedef struct | |
2019 { | |
2020 Dynarr_declare (Ichar); | |
2021 } Ichar_dynarr; | |
2022 | |
2023 typedef struct | |
2024 { | |
2025 Dynarr_declare (char); | |
2026 } char_dynarr; | |
2027 | |
2028 typedef struct | |
2029 { | |
2030 Dynarr_declare (char *); | |
2031 } char_ptr_dynarr; | |
2032 | |
2033 typedef unsigned char unsigned_char; | |
2034 typedef struct | |
2035 { | |
2036 Dynarr_declare (unsigned char); | |
2037 } unsigned_char_dynarr; | |
2038 | |
2039 typedef unsigned long unsigned_long; | |
2040 typedef struct | |
2041 { | |
2042 Dynarr_declare (unsigned long); | |
2043 } unsigned_long_dynarr; | |
2044 | |
2045 typedef struct | |
2046 { | |
2047 Dynarr_declare (int); | |
2048 } int_dynarr; | |
2049 | |
2050 typedef struct | |
2051 { | |
2052 Dynarr_declare (Charbpos); | |
2053 } Charbpos_dynarr; | |
2054 | |
2055 typedef struct | |
2056 { | |
2057 Dynarr_declare (Bytebpos); | |
2058 } Bytebpos_dynarr; | |
2059 | |
2060 typedef struct | |
2061 { | |
2062 Dynarr_declare (Charcount); | |
2063 } Charcount_dynarr; | |
2064 | |
2065 typedef struct | |
2066 { | |
2067 Dynarr_declare (Bytecount); | |
2068 } Bytecount_dynarr; | |
2069 | |
2070 /* Dynarr typedefs -- more complex types */ | |
2071 | |
2072 typedef struct | |
2073 { | |
2074 Dynarr_declare (struct face_cachel); | |
2075 } face_cachel_dynarr; | |
2076 | |
3293 | 2077 #ifdef NEW_GC |
3092 | 2078 DECLARE_LRECORD (face_cachel_dynarr, face_cachel_dynarr); |
2079 #define XFACE_CACHEL_DYNARR(x) \ | |
2080 XRECORD (x, face_cachel_dynarr, face_cachel_dynarr) | |
2081 #define wrap_face_cachel_dynarr(p) wrap_record (p, face_cachel_dynarr) | |
2082 #define FACE_CACHEL_DYNARRP(x) RECORDP (x, face_cachel_dynarr) | |
2083 #define CHECK_FACE_CACHEL_DYNARR(x) CHECK_RECORD (x, face_cachel_dynarr) | |
2084 #define CONCHECK_FACE_CACHEL_DYNARR(x) CONCHECK_RECORD (x, face_cachel_dynarr) | |
3293 | 2085 #endif /* NEW_GC */ |
3092 | 2086 |
2087 typedef struct | |
2088 { | |
2089 Dynarr_declare (struct glyph_cachel); | |
2090 } glyph_cachel_dynarr; | |
2091 | |
3293 | 2092 #ifdef NEW_GC |
3092 | 2093 DECLARE_LRECORD (glyph_cachel_dynarr, glyph_cachel_dynarr); |
2094 #define XGLYPH_CACHEL_DYNARR(x) \ | |
2095 XRECORD (x, glyph_cachel_dynarr, glyph_cachel_dynarr) | |
2096 #define wrap_glyph_cachel_dynarr(p) wrap_record (p, glyph_cachel_dynarr) | |
2097 #define GLYPH_CACHEL_DYNARRP(x) RECORDP (x, glyph_cachel_dynarr) | |
2098 #define CHECK_GLYPH_CACHEL_DYNARR(x) CHECK_RECORD (x, glyph_cachel_dynarr) | |
2099 #define CONCHECK_GLYPH_CACHEL_DYNARR(x) \ | |
2100 CONCHECK_RECORD (x, glyph_cachel_dynarr) | |
3293 | 2101 #endif /* NEW_GC */ |
3092 | 2102 |
2103 typedef struct | |
2104 { | |
2105 Dynarr_declare (struct console_type_entry); | |
2106 } console_type_entry_dynarr; | |
2107 | |
2108 /* WARNING WARNING WARNING. You must ensure on your own that proper | |
2109 GC protection is provided for the elements in this array. */ | |
2110 typedef struct | |
2111 { | |
2112 Dynarr_declare (Lisp_Object); | |
2113 } Lisp_Object_dynarr; | |
2114 | |
2115 typedef struct | |
2116 { | |
2117 Dynarr_declare (Lisp_Object *); | |
2118 } Lisp_Object_ptr_dynarr; | |
2119 | |
442 | 2120 /*------------------------------ unbound -------------------------------*/ |
428 | 2121 |
2122 /* Qunbound is a special Lisp_Object (actually of type | |
2123 symbol-value-forward), that can never be visible to | |
2124 the Lisp caller and thus can be used in the C code | |
2125 to mean "no such value". */ | |
2126 | |
2127 #define UNBOUNDP(val) EQ (val, Qunbound) | |
2128 | |
771 | 2129 /* Evaluate expr, return it if it's not Qunbound. */ |
2130 #define RETURN_IF_NOT_UNBOUND(expr) do \ | |
2131 { \ | |
2132 Lisp_Object ret_nunb_val = (expr); \ | |
2133 if (!UNBOUNDP (ret_nunb_val)) \ | |
2134 RETURN_SANS_WARNINGS ret_nunb_val; \ | |
2135 } while (0) | |
2136 | |
442 | 2137 /*------------------------------- cons ---------------------------------*/ |
428 | 2138 |
2139 /* In a cons, the markbit of the car is the gc mark bit */ | |
2140 | |
2141 struct Lisp_Cons | |
2142 { | |
2143 struct lrecord_header lheader; | |
853 | 2144 Lisp_Object car_, cdr_; |
428 | 2145 }; |
2146 typedef struct Lisp_Cons Lisp_Cons; | |
2147 | |
2148 #if 0 /* FSFmacs */ | |
2149 /* Like a cons, but records info on where the text lives that it was read from */ | |
2150 /* This is not really in use now */ | |
2151 | |
2152 struct Lisp_Buffer_Cons | |
2153 { | |
2154 Lisp_Object car, cdr; | |
2155 struct buffer *buffer; | |
665 | 2156 int charbpos; |
428 | 2157 }; |
2158 #endif | |
2159 | |
1632 | 2160 DECLARE_MODULE_API_LRECORD (cons, Lisp_Cons); |
428 | 2161 #define XCONS(x) XRECORD (x, cons, Lisp_Cons) |
617 | 2162 #define wrap_cons(p) wrap_record (p, cons) |
428 | 2163 #define CONSP(x) RECORDP (x, cons) |
2164 #define CHECK_CONS(x) CHECK_RECORD (x, cons) | |
2165 #define CONCHECK_CONS(x) CONCHECK_RECORD (x, cons) | |
2166 | |
3263 | 2167 #ifdef NEW_GC |
2720 | 2168 #define CONS_MARKED_P(c) MARKED_P (&((c)->lheader)) |
2169 #define MARK_CONS(c) MARK (&((c)->lheader)) | |
3263 | 2170 #else /* not NEW_GC */ |
428 | 2171 #define CONS_MARKED_P(c) MARKED_RECORD_HEADER_P(&((c)->lheader)) |
2172 #define MARK_CONS(c) MARK_RECORD_HEADER (&((c)->lheader)) | |
3263 | 2173 #endif /* not NEW_GC */ |
428 | 2174 |
1632 | 2175 extern MODULE_API Lisp_Object Qnil; |
428 | 2176 |
2177 #define NILP(x) EQ (x, Qnil) | |
853 | 2178 #define cons_car(a) ((a)->car_) |
2179 #define cons_cdr(a) ((a)->cdr_) | |
2180 #define XCAR(a) (XCONS (a)->car_) | |
2181 #define XCDR(a) (XCONS (a)->cdr_) | |
1318 | 2182 #define XCADR(a) (XCAR (XCDR (a))) |
2183 #define XCDDR(a) (XCDR (XCDR (a))) | |
2184 #define XCADDR(a) (XCAR (XCDDR (a))) | |
2185 #define XCDDDR(a) (XCDR (XCDDR (a))) | |
2186 #define XCADDDR(a) (XCAR (XCDDDR (a))) | |
2187 #define XCDDDDR(a) (XCDR (XCDDDR (a))) | |
2188 #define XCADDDDR(a) (XCAR (XCDDDDR (a))) | |
2189 #define XCDDDDDR(a) (XCDR (XCDDDDR (a))) | |
2190 #define XCADDDDDR(a) (XCAR (XCDDDDDR (a))) | |
2191 #define XCDDDDDDR(a) (XCDR (XCDDDDDR (a))) | |
2192 #define X1ST(a) XCAR (a) | |
2193 #define X2ND(a) XCADR (a) | |
2194 #define X3RD(a) XCADDR (a) | |
2195 #define X4TH(a) XCADDDR (a) | |
2196 #define X5TH(a) XCADDDDR (a) | |
2197 #define X6TH(a) XCADDDDDR (a) | |
2198 | |
853 | 2199 #define XSETCAR(a, b) (XCONS (a)->car_ = (b)) |
2200 #define XSETCDR(a, b) (XCONS (a)->cdr_ = (b)) | |
428 | 2201 #define LISTP(x) (CONSP(x) || NILP(x)) |
2202 | |
2203 #define CHECK_LIST(x) do { \ | |
2204 if (!LISTP (x)) \ | |
2205 dead_wrong_type_argument (Qlistp, x); \ | |
2206 } while (0) | |
2207 | |
2208 #define CONCHECK_LIST(x) do { \ | |
2209 if (!LISTP (x)) \ | |
2210 x = wrong_type_argument (Qlistp, x); \ | |
2211 } while (0) | |
2212 | |
442 | 2213 /*---------------------- list traversal macros -------------------------*/ |
2214 | |
2215 /* Note: These macros are for traversing through a list in some format, | |
2216 and executing code that you specify on each member of the list. | |
2217 | |
2218 There are two kinds of macros, those requiring surrounding braces, and | |
2219 those not requiring this. Which type of macro will be indicated. | |
2220 The general format for using a brace-requiring macro is | |
2221 | |
2222 { | |
2223 LIST_LOOP_3 (elt, list, tail) | |
2224 execute_code_here; | |
2225 } | |
2226 | |
2227 or | |
2228 | |
2229 { | |
2230 LIST_LOOP_3 (elt, list, tail) | |
2231 { | |
2232 execute_code_here; | |
2233 } | |
2234 } | |
2235 | |
2236 You can put variable declarations between the brace and beginning of | |
2237 macro, but NOTHING ELSE. | |
2238 | |
2239 The brace-requiring macros typically declare themselves any arguments | |
2240 that are initialized and iterated by the macros. If for some reason | |
2241 you need to declare these arguments yourself (e.g. to do something on | |
2242 them before the iteration starts, use the _NO_DECLARE versions of the | |
2243 macros.) | |
2244 */ | |
2245 | |
2246 /* There are two basic kinds of macros: those that handle "internal" lists | |
2247 that are known to be correctly structured (i.e. first element is a cons | |
2248 or nil, and the car of each cons is also a cons or nil, and there are | |
2249 no circularities), and those that handle "external" lists, where the | |
2250 list may have any sort of invalid formation. This is reflected in | |
2251 the names: those with "EXTERNAL_" work with external lists, and those | |
2252 without this prefix work with internal lists. The internal-list | |
2253 macros will hit an assertion failure if the structure is ill-formed; | |
2254 the external-list macros will signal an error in this case, either a | |
2255 malformed-list error or a circular-list error. | |
2256 */ | |
2257 | |
2367 | 2258 /* LIST_LOOP is a simple, old-fashioned macro. It doesn't require brace |
2259 surrounding, and iterates through a list, which may or may not known to | |
2260 be syntactically correct. It accepts two args, TAIL (set progressively | |
2261 to each cons starting with the first), and LIST, the list to iterate | |
2262 over. TAIL needs to be defined by the caller. | |
442 | 2263 |
2264 In each iteration, you can retrieve the current list item using XCAR | |
2265 (tail), or destructively modify the list using XSETCAR (tail, | |
2266 ...). */ | |
2267 | |
428 | 2268 #define LIST_LOOP(tail, list) \ |
2269 for (tail = list; \ | |
2270 !NILP (tail); \ | |
2271 tail = XCDR (tail)) | |
2272 | |
442 | 2273 /* The following macros are the "core" macros for list traversal. |
2274 | |
2275 *** ALL OF THESE MACROS MUST BE DECLARED INSIDE BRACES -- SEE ABOVE. *** | |
2276 | |
2277 LIST_LOOP_2 and EXTERNAL_LIST_LOOP_2 are the standard, most-often used | |
2278 macros. They take two arguments, an element variable ELT and the list | |
2279 LIST. ELT is automatically declared, and set to each element in turn | |
2280 from LIST. | |
2281 | |
2282 LIST_LOOP_3 and EXTERNAL_LIST_LOOP_3 are the same, but they have a third | |
2283 argument TAIL, another automatically-declared variable. At each iteration, | |
2284 this one points to the cons cell for which ELT is the car. | |
2285 | |
2286 EXTERNAL_LIST_LOOP_4 is like EXTERNAL_LIST_LOOP_3 but takes an additional | |
2287 LEN argument, again automatically declared, which counts the number of | |
2288 iterations gone by. It is 0 during the first iteration. | |
2289 | |
2290 EXTERNAL_LIST_LOOP_4_NO_DECLARE is like EXTERNAL_LIST_LOOP_4 but none | |
2291 of the variables are automatically declared, and so you need to declare | |
2292 them yourself. (ELT and TAIL are Lisp_Objects, and LEN is an EMACS_INT.) | |
2293 */ | |
2294 | |
2295 #define LIST_LOOP_2(elt, list) \ | |
2296 LIST_LOOP_3(elt, list, unused_tail_##elt) | |
2297 | |
2298 #define LIST_LOOP_3(elt, list, tail) \ | |
2299 Lisp_Object elt, tail; \ | |
2300 for (tail = list; \ | |
2301 NILP (tail) ? \ | |
2302 0 : (elt = XCAR (tail), 1); \ | |
2303 tail = XCDR (tail)) | |
428 | 2304 |
2305 /* The following macros are for traversing lisp lists. | |
2306 Signal an error if LIST is not properly acyclic and nil-terminated. | |
2307 | |
2308 Use tortoise/hare algorithm to check for cycles, but only if it | |
2309 looks like the list is getting too long. Not only is the hare | |
2310 faster than the tortoise; it even gets a head start! */ | |
2311 | |
2312 /* Optimized and safe macros for looping over external lists. */ | |
2313 #define CIRCULAR_LIST_SUSPICION_LENGTH 1024 | |
2314 | |
2315 #define EXTERNAL_LIST_LOOP_1(list) \ | |
2316 Lisp_Object ELL1_elt, ELL1_hare, ELL1_tortoise; \ | |
442 | 2317 EMACS_INT ELL1_len; \ |
2318 PRIVATE_EXTERNAL_LIST_LOOP_6 (ELL1_elt, list, ELL1_len, ELL1_hare, \ | |
428 | 2319 ELL1_tortoise, CIRCULAR_LIST_SUSPICION_LENGTH) |
2320 | |
2321 #define EXTERNAL_LIST_LOOP_2(elt, list) \ | |
442 | 2322 Lisp_Object elt, hare_##elt, tortoise_##elt; \ |
2323 EMACS_INT len_##elt; \ | |
2324 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len_##elt, hare_##elt, \ | |
428 | 2325 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH) |
2326 | |
2367 | 2327 |
2328 #define GC_EXTERNAL_LIST_LOOP_2(elt, list) \ | |
2329 do { \ | |
2330 XGCDECL3 (elt); \ | |
2331 Lisp_Object elt, hare_##elt, tortoise_##elt; \ | |
2332 EMACS_INT len_##elt; \ | |
2333 XGCPRO3 (elt, elt, hare_##elt, tortoise_##elt); \ | |
2334 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len_##elt, hare_##elt, \ | |
2335 tortoise_##elt, \ | |
2336 CIRCULAR_LIST_SUSPICION_LENGTH) | |
2337 | |
2338 #define END_GC_EXTERNAL_LIST_LOOP(elt) \ | |
2339 XUNGCPRO (elt); \ | |
2340 } \ | |
2341 while (0) | |
2342 | |
428 | 2343 #define EXTERNAL_LIST_LOOP_3(elt, list, tail) \ |
442 | 2344 Lisp_Object elt, tail, tortoise_##elt; \ |
2345 EMACS_INT len_##elt; \ | |
2346 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len_##elt, tail, \ | |
2347 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH) | |
2348 | |
2349 #define EXTERNAL_LIST_LOOP_4_NO_DECLARE(elt, list, tail, len) \ | |
428 | 2350 Lisp_Object tortoise_##elt; \ |
442 | 2351 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail, \ |
428 | 2352 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH) |
2353 | |
2354 #define EXTERNAL_LIST_LOOP_4(elt, list, tail, len) \ | |
442 | 2355 Lisp_Object elt, tail, tortoise_##elt; \ |
2356 EMACS_INT len; \ | |
2357 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail, \ | |
428 | 2358 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH) |
2359 | |
2360 | |
444 | 2361 #define PRIVATE_EXTERNAL_LIST_LOOP_6(elt, list, len, hare, \ |
2362 tortoise, suspicion_length) \ | |
2363 for (tortoise = hare = list, len = 0; \ | |
2364 \ | |
2365 (CONSP (hare) ? ((elt = XCAR (hare)), 1) : \ | |
2366 (NILP (hare) ? 0 : \ | |
2367 (signal_malformed_list_error (list), 0))); \ | |
2368 \ | |
2369 hare = XCDR (hare), \ | |
2370 (void) \ | |
2371 ((++len > suspicion_length) \ | |
2372 && \ | |
2373 ((((len & 1) != 0) && (tortoise = XCDR (tortoise), 0)), \ | |
2374 (EQ (hare, tortoise) && (signal_circular_list_error (list), 0))))) | |
428 | 2375 |
442 | 2376 /* GET_LIST_LENGTH and GET_EXTERNAL_LIST_LENGTH: |
2377 | |
2378 These two macros return the length of LIST (either an internal or external | |
2379 list, according to which macro is used), stored into LEN (which must | |
2380 be declared by the caller). Circularities are trapped in external lists | |
2381 (and cause errors). Neither macro need be declared inside brackets. */ | |
2382 | |
2383 #define GET_LIST_LENGTH(list, len) do { \ | |
2384 Lisp_Object GLL_tail; \ | |
2385 for (GLL_tail = list, len = 0; \ | |
2386 !NILP (GLL_tail); \ | |
2387 GLL_tail = XCDR (GLL_tail), ++len) \ | |
2388 DO_NOTHING; \ | |
2389 } while (0) | |
2390 | |
2391 #define GET_EXTERNAL_LIST_LENGTH(list, len) \ | |
2392 do { \ | |
2393 Lisp_Object GELL_elt, GELL_tail; \ | |
2394 EXTERNAL_LIST_LOOP_4_NO_DECLARE (GELL_elt, list, GELL_tail, len) \ | |
2395 ; \ | |
2396 } while (0) | |
2397 | |
2398 /* For a list that's known to be in valid list format, where we may | |
2399 be deleting the current element out of the list -- | |
2500 | 2400 will ABORT() if the list is not in valid format */ |
442 | 2401 #define LIST_LOOP_DELETING(consvar, nextconsvar, list) \ |
2402 for (consvar = list; \ | |
2403 !NILP (consvar) ? (nextconsvar = XCDR (consvar), 1) :0; \ | |
2404 consvar = nextconsvar) | |
2405 | |
2406 /* LIST_LOOP_DELETE_IF and EXTERNAL_LIST_LOOP_DELETE_IF: | |
2407 | |
2408 These two macros delete all elements of LIST (either an internal or | |
2409 external list, according to which macro is used) satisfying | |
2410 CONDITION, a C expression referring to variable ELT. ELT is | |
2411 automatically declared. Circularities are trapped in external | |
2412 lists (and cause errors). Neither macro need be declared inside | |
2413 brackets. */ | |
2414 | |
2415 #define LIST_LOOP_DELETE_IF(elt, list, condition) do { \ | |
2416 /* Do not use ##list when creating new variables because \ | |
2417 that may not be just a variable name. */ \ | |
2418 Lisp_Object prev_tail_##elt = Qnil; \ | |
2419 LIST_LOOP_3 (elt, list, tail_##elt) \ | |
2420 { \ | |
2421 if (condition) \ | |
2422 { \ | |
2423 if (NILP (prev_tail_##elt)) \ | |
2424 list = XCDR (tail_##elt); \ | |
2425 else \ | |
2426 XCDR (prev_tail_##elt) = XCDR (tail_##elt); \ | |
2427 } \ | |
2428 else \ | |
2429 prev_tail_##elt = tail_##elt; \ | |
2430 } \ | |
2431 } while (0) | |
2432 | |
2433 #define EXTERNAL_LIST_LOOP_DELETE_IF(elt, list, condition) do { \ | |
2434 Lisp_Object prev_tail_##elt = Qnil; \ | |
2435 EXTERNAL_LIST_LOOP_4 (elt, list, tail_##elt, len_##elt) \ | |
2436 { \ | |
2437 if (condition) \ | |
2438 { \ | |
2439 if (NILP (prev_tail_##elt)) \ | |
2440 list = XCDR (tail_##elt); \ | |
2441 else \ | |
2442 XCDR (prev_tail_##elt) = XCDR (tail_##elt); \ | |
2443 /* Keep tortoise from ever passing hare. */ \ | |
2444 len_##elt = 0; \ | |
2445 } \ | |
2446 else \ | |
2447 prev_tail_##elt = tail_##elt; \ | |
2448 } \ | |
2449 } while (0) | |
2450 | |
2451 | |
1204 | 2452 /* Macros for looping over internal alists. |
2453 | |
2454 *** ALL OF THESE MACROS MUST BE DECLARED INSIDE BRACES -- SEE ABOVE. *** | |
2455 | |
2456 ALIST_LOOP_3 loops over an alist, at each iteration setting CAR and CDR | |
2457 to the car and cdr of the acons. CAR and CDR are automatically | |
2458 declared. | |
2459 | |
2460 ALIST_LOOP_4 is similar to ALIST_LOOP_3 but contains an additional | |
2461 variable ACONS at the beginning for access to the acons itself.All of | |
2462 the variables ACONS, CAR and CDR are automatically declared. | |
2463 */ | |
2464 | |
2465 #define ALIST_LOOP_3(car, cdr, alist) \ | |
2466 Lisp_Object _al3_acons_##car, car, cdr, _al3_tail_##car; \ | |
2467 for (_al3_tail_##car = alist; \ | |
2468 NILP (_al3_tail_##car) ? \ | |
2469 0 : (_al3_acons_##car = XCAR (_al3_tail_##car), \ | |
2470 car = XCAR (_al3_acons_##car), \ | |
2471 cdr = XCDR (_al3_acons_##car), 1); \ | |
2472 _al3_tail_##car = XCDR (_al3_tail_##car)) | |
2473 | |
2474 #define ALIST_LOOP_4(acons, car, cdr, list) \ | |
2475 Lisp_Object acons, car, cdr, _al4_tail_##car; \ | |
2476 for (_al4_tail_##car = list; \ | |
2477 NILP (_al4_tail_##car) ? \ | |
2478 0 : (elt = XCAR (_al4_tail_##car), car = XCAR (elt), \ | |
2479 cdr = XCDR (elt), 1); \ | |
2480 _al4_tail_##car = XCDR (tail)) | |
2481 | |
442 | 2482 /* Macros for looping over external alists. |
2483 | |
2484 *** ALL OF THESE MACROS MUST BE DECLARED INSIDE BRACES -- SEE ABOVE. *** | |
2485 | |
2486 EXTERNAL_ALIST_LOOP_4 is similar to EXTERNAL_LIST_LOOP_2, but it | |
2487 assumes the elements are aconses (the elements in an alist) and | |
2488 sets two additional argument variables ELT_CAR and ELT_CDR to the | |
2489 car and cdr of the acons. All of the variables ELT, ELT_CAR and | |
2490 ELT_CDR are automatically declared. | |
2491 | |
2492 EXTERNAL_ALIST_LOOP_5 adds a TAIL argument to EXTERNAL_ALIST_LOOP_4, | |
2493 just like EXTERNAL_LIST_LOOP_3 does, and again TAIL is automatically | |
2494 declared. | |
2495 | |
2496 EXTERNAL_ALIST_LOOP_6 adds a LEN argument to EXTERNAL_ALIST_LOOP_5, | |
2497 just like EXTERNAL_LIST_LOOP_4 does, and again LEN is automatically | |
2498 declared. | |
2499 | |
2500 EXTERNAL_ALIST_LOOP_6_NO_DECLARE does not declare any of its arguments, | |
2501 just like EXTERNAL_LIST_LOOP_4_NO_DECLARE, and so these must be declared | |
2502 manually. | |
2503 */ | |
428 | 2504 |
2505 /* Optimized and safe macros for looping over external alists. */ | |
2506 #define EXTERNAL_ALIST_LOOP_4(elt, elt_car, elt_cdr, list) \ | |
442 | 2507 Lisp_Object elt, elt_car, elt_cdr; \ |
428 | 2508 Lisp_Object hare_##elt, tortoise_##elt; \ |
2509 EMACS_INT len_##elt; \ | |
442 | 2510 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \ |
428 | 2511 len_##elt, hare_##elt, tortoise_##elt, \ |
2512 CIRCULAR_LIST_SUSPICION_LENGTH) | |
2513 | |
2514 #define EXTERNAL_ALIST_LOOP_5(elt, elt_car, elt_cdr, list, tail) \ | |
442 | 2515 Lisp_Object elt, elt_car, elt_cdr, tail; \ |
428 | 2516 Lisp_Object tortoise_##elt; \ |
2517 EMACS_INT len_##elt; \ | |
442 | 2518 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \ |
428 | 2519 len_##elt, tail, tortoise_##elt, \ |
2520 CIRCULAR_LIST_SUSPICION_LENGTH) \ | |
2521 | |
2522 #define EXTERNAL_ALIST_LOOP_6(elt, elt_car, elt_cdr, list, tail, len) \ | |
442 | 2523 Lisp_Object elt, elt_car, elt_cdr, tail; \ |
2524 EMACS_INT len; \ | |
428 | 2525 Lisp_Object tortoise_##elt; \ |
442 | 2526 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \ |
428 | 2527 len, tail, tortoise_##elt, \ |
2528 CIRCULAR_LIST_SUSPICION_LENGTH) | |
2529 | |
442 | 2530 #define EXTERNAL_ALIST_LOOP_6_NO_DECLARE(elt, elt_car, elt_cdr, list, \ |
2531 tail, len) \ | |
2532 Lisp_Object tortoise_##elt; \ | |
2533 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \ | |
2534 len, tail, tortoise_##elt, \ | |
2535 CIRCULAR_LIST_SUSPICION_LENGTH) | |
2536 | |
2537 | |
2538 #define PRIVATE_EXTERNAL_ALIST_LOOP_8(elt, elt_car, elt_cdr, list, len, \ | |
2539 hare, tortoise, suspicion_length) \ | |
2540 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, hare, tortoise, \ | |
2541 suspicion_length) \ | |
428 | 2542 if (CONSP (elt) ? (elt_car = XCAR (elt), elt_cdr = XCDR (elt), 0) :1) \ |
2543 continue; \ | |
2544 else | |
2545 | |
442 | 2546 /* Macros for looping over external property lists. |
2547 | |
2548 *** ALL OF THESE MACROS MUST BE DECLARED INSIDE BRACES -- SEE ABOVE. *** | |
2549 | |
2550 EXTERNAL_PROPERTY_LIST_LOOP_3 maps over an external list assumed to | |
2551 be a property list, consisting of alternating pairs of keys | |
2552 (typically symbols or keywords) and values. Each iteration | |
2553 processes one such pair out of LIST, assigning the two elements to | |
2554 KEY and VALUE respectively. Malformed lists and circularities are | |
2555 trapped as usual, and in addition, property lists with an odd number | |
2556 of elements also signal an error. | |
2557 | |
2558 EXTERNAL_PROPERTY_LIST_LOOP_4 adds a TAIL argument to | |
2559 EXTERNAL_PROPERTY_LIST_LOOP_3, just like EXTERNAL_LIST_LOOP_3 does, | |
2560 and again TAIL is automatically declared. | |
2561 | |
2562 EXTERNAL_PROPERTY_LIST_LOOP_5 adds a LEN argument to | |
2563 EXTERNAL_PROPERTY_LIST_LOOP_4, just like EXTERNAL_LIST_LOOP_4 does, | |
2564 and again LEN is automatically declared. Note that in this case, | |
2565 LEN counts the iterations, NOT the total number of list elements | |
2566 processed, which is 2 * LEN. | |
2567 | |
2568 EXTERNAL_PROPERTY_LIST_LOOP_5_NO_DECLARE does not declare any of its | |
2569 arguments, just like EXTERNAL_LIST_LOOP_4_NO_DECLARE, and so these | |
2570 must be declared manually. */ | |
428 | 2571 |
2572 /* Optimized and safe macros for looping over external property lists. */ | |
2573 #define EXTERNAL_PROPERTY_LIST_LOOP_3(key, value, list) \ | |
2574 Lisp_Object key, value, hare_##key, tortoise_##key; \ | |
442 | 2575 EMACS_INT len_##key; \ |
428 | 2576 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len_##key, hare_##key, \ |
2577 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH) | |
2578 | |
2579 #define EXTERNAL_PROPERTY_LIST_LOOP_4(key, value, list, tail) \ | |
2580 Lisp_Object key, value, tail, tortoise_##key; \ | |
442 | 2581 EMACS_INT len_##key; \ |
428 | 2582 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len_##key, tail, \ |
2583 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH) | |
2584 | |
2585 #define EXTERNAL_PROPERTY_LIST_LOOP_5(key, value, list, tail, len) \ | |
2586 Lisp_Object key, value, tail, tortoise_##key; \ | |
2587 EMACS_INT len; \ | |
2588 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len, tail, \ | |
2589 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH) | |
2590 | |
442 | 2591 #define EXTERNAL_PROPERTY_LIST_LOOP_5_NO_DECLARE(key, value, list, \ |
2592 tail, len) \ | |
2593 Lisp_Object tortoise_##key; \ | |
2594 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len, tail, \ | |
2595 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH) | |
2596 | |
428 | 2597 |
2598 #define EXTERNAL_PROPERTY_LIST_LOOP_7(key, value, list, len, hare, \ | |
2599 tortoise, suspicion_length) \ | |
2600 for (tortoise = hare = list, len = 0; \ | |
2601 \ | |
2602 ((CONSP (hare) && \ | |
2603 (key = XCAR (hare), \ | |
2604 hare = XCDR (hare), \ | |
442 | 2605 (CONSP (hare) ? 1 : \ |
2606 (signal_malformed_property_list_error (list), 0)))) ? \ | |
428 | 2607 (value = XCAR (hare), 1) : \ |
2608 (NILP (hare) ? 0 : \ | |
2609 (signal_malformed_property_list_error (list), 0))); \ | |
2610 \ | |
2611 hare = XCDR (hare), \ | |
2612 ((++len < suspicion_length) ? \ | |
2613 ((void) 0) : \ | |
2614 (((len & 1) ? \ | |
2615 ((void) (tortoise = XCDR (XCDR (tortoise)))) : \ | |
2616 ((void) 0)) \ | |
2617 , \ | |
2618 (EQ (hare, tortoise) ? \ | |
2619 ((void) signal_circular_property_list_error (list)) : \ | |
2620 ((void) 0))))) | |
2621 | |
2421 | 2622 #define PRIVATE_PROPERTY_LIST_LOOP_4(tail, key, value, plist) \ |
2623 for (tail = plist; \ | |
2624 NILP (tail) ? 0 : \ | |
2625 (key = XCAR (tail), tail = XCDR (tail), \ | |
2626 value = XCAR (tail), tail = XCDR (tail), 1); \ | |
428 | 2627 ) |
2628 | |
2421 | 2629 #define PROPERTY_LIST_LOOP_3(key, value, plist) \ |
2630 Lisp_Object key, value, tail_##key; \ | |
2631 PRIVATE_PROPERTY_LIST_LOOP_4 (tail_##key, key, value, plist) | |
2632 | |
2633 #define GC_PROPERTY_LIST_LOOP_3(key, value, plist) \ | |
2634 do { \ | |
2635 XGCDECL3 (key); \ | |
2636 Lisp_Object key, value, tail_##key; \ | |
2637 XGCPRO3 (key, key, value, tail_##key); \ | |
2638 PRIVATE_PROPERTY_LIST_LOOP_4 (tail_##key, key, value, plist) | |
2639 | |
2640 #define END_GC_PROPERTY_LIST_LOOP(key) \ | |
2641 XUNGCPRO (key); \ | |
2642 } \ | |
2643 while (0) | |
2644 | |
428 | 2645 /* Return 1 if LIST is properly acyclic and nil-terminated, else 0. */ |
826 | 2646 DECLARE_INLINE_HEADER ( |
2647 int | |
428 | 2648 TRUE_LIST_P (Lisp_Object object) |
826 | 2649 ) |
428 | 2650 { |
2651 Lisp_Object hare, tortoise; | |
2652 EMACS_INT len; | |
2653 | |
2654 for (hare = tortoise = object, len = 0; | |
2655 CONSP (hare); | |
2656 hare = XCDR (hare), len++) | |
2657 { | |
2658 if (len < CIRCULAR_LIST_SUSPICION_LENGTH) | |
2659 continue; | |
2660 | |
2661 if (len & 1) | |
2662 tortoise = XCDR (tortoise); | |
2663 else if (EQ (hare, tortoise)) | |
2664 return 0; | |
2665 } | |
2666 | |
2667 return NILP (hare); | |
2668 } | |
2669 | |
2670 /* Signal an error if LIST is not properly acyclic and nil-terminated. */ | |
2671 #define CHECK_TRUE_LIST(list) do { \ | |
2672 Lisp_Object CTL_list = (list); \ | |
2673 Lisp_Object CTL_hare, CTL_tortoise; \ | |
436 | 2674 EMACS_INT CTL_len; \ |
428 | 2675 \ |
2676 for (CTL_hare = CTL_tortoise = CTL_list, CTL_len = 0; \ | |
2677 CONSP (CTL_hare); \ | |
2678 CTL_hare = XCDR (CTL_hare), CTL_len++) \ | |
2679 { \ | |
2680 if (CTL_len < CIRCULAR_LIST_SUSPICION_LENGTH) \ | |
2681 continue; \ | |
2682 \ | |
2683 if (CTL_len & 1) \ | |
2684 CTL_tortoise = XCDR (CTL_tortoise); \ | |
2685 else if (EQ (CTL_hare, CTL_tortoise)) \ | |
2686 Fsignal (Qcircular_list, list1 (CTL_list)); \ | |
2687 } \ | |
2688 \ | |
2689 if (! NILP (CTL_hare)) \ | |
2690 signal_malformed_list_error (CTL_list); \ | |
2691 } while (0) | |
2692 | |
442 | 2693 /*------------------------------ string --------------------------------*/ |
428 | 2694 |
3092 | 2695 #ifdef NEW_GC |
2696 struct Lisp_String_Direct_Data | |
2697 { | |
2698 struct lrecord_header header; | |
2699 Bytecount size; | |
2700 Ibyte data[1]; | |
2701 }; | |
2702 typedef struct Lisp_String_Direct_Data Lisp_String_Direct_Data; | |
2703 | |
2704 DECLARE_MODULE_API_LRECORD (string_direct_data, Lisp_String_Direct_Data); | |
2705 #define XSTRING_DIRECT_DATA(x) \ | |
2706 XRECORD (x, string_direct_data, Lisp_String_Direct_Data) | |
2707 #define wrap_string_direct_data(p) wrap_record (p, string_direct_data) | |
2708 #define STRING_DIRECT_DATAP(x) RECORDP (x, string_direct_data) | |
2709 #define CHECK_STRING_DIRECT_DATA(x) CHECK_RECORD (x, string_direct_data) | |
2710 #define CONCHECK_STRING_DIRECT_DATA(x) CONCHECK_RECORD (x, string_direct_data) | |
2711 | |
2712 #define XSTRING_DIRECT_DATA_SIZE(x) XSTRING_DIRECT_DATA (x)->size | |
2713 #define XSTRING_DIRECT_DATA_DATA(x) XSTRING_DIRECT_DATA (x)->data | |
2714 | |
2715 | |
2716 struct Lisp_String_Indirect_Data | |
2717 { | |
2718 struct lrecord_header header; | |
2719 Bytecount size; | |
2720 Ibyte *data; | |
2721 }; | |
2722 typedef struct Lisp_String_Indirect_Data Lisp_String_Indirect_Data; | |
2723 | |
2724 DECLARE_MODULE_API_LRECORD (string_indirect_data, Lisp_String_Indirect_Data); | |
2725 #define XSTRING_INDIRECT_DATA(x) \ | |
2726 XRECORD (x, string_indirect_data, Lisp_String_Indirect_Data) | |
2727 #define wrap_string_indirect_data(p) wrap_record (p, string_indirect_data) | |
2728 #define STRING_INDIRECT_DATAP(x) RECORDP (x, string_indirect_data) | |
2729 #define CHECK_STRING_INDIRECT_DATA(x) CHECK_RECORD (x, string_indirect_data) | |
2730 #define CONCHECK_STRING_INDIRECT_DATA(x) \ | |
2731 CONCHECK_RECORD (x, string_indirect_data) | |
2732 | |
2733 #define XSTRING_INDIRECT_DATA_SIZE(x) XSTRING_INDIRECT_DATA (x)->size | |
2734 #define XSTRING_INDIRECT_DATA_DATA(x) XSTRING_INDIRECT_DATA (x)->data | |
2735 | |
2736 | |
2737 #define XSTRING_DATA_SIZE(s) ((s)->indirect)? \ | |
2738 XSTRING_INDIRECT_DATA_SIZE ((s)->data_object): \ | |
2739 XSTRING_DIRECT_DATA_SIZE ((s)->data_object) | |
2740 #define XSTRING_DATA_DATA(s) ((s)->indirect)? \ | |
2741 XSTRING_INDIRECT_DATA_DATA ((s)->data_object): \ | |
2742 XSTRING_DIRECT_DATA_DATA ((s)->data_object) | |
2743 | |
2744 #define XSET_STRING_DATA_SIZE(s, len) \ | |
2745 if ((s)->indirect) \ | |
2746 XSTRING_INDIRECT_DATA_SIZE ((s)->data_object) = len; \ | |
2747 else \ | |
2748 XSTRING_DIRECT_DATA_SIZE ((s)->data_object) = len | |
2749 #define XSET_STRING_DATA_DATA(s, ptr) \ | |
2750 if ((s)->indirect) \ | |
2751 XSTRING_INDIRECT_DATA_DATA ((s)->data_object) = ptr; \ | |
2752 else \ | |
2753 XSTRING_DIRECT_DATA_DATA ((s)->data_object) = ptr | |
2754 #endif /* NEW_GC */ | |
2755 | |
428 | 2756 struct Lisp_String |
2757 { | |
771 | 2758 union |
2759 { | |
2760 struct lrecord_header lheader; | |
2761 struct | |
2762 { | |
2763 /* WARNING: Everything before ascii_begin must agree exactly with | |
2764 struct lrecord_header */ | |
2765 unsigned int type :8; | |
3263 | 2766 #ifdef NEW_GC |
2720 | 2767 unsigned int lisp_readonly :1; |
2768 unsigned int free :1; | |
2769 /* Number of chars at beginning of string that are one byte in length | |
2770 (byte_ascii_p) */ | |
2771 unsigned int ascii_begin :22; | |
3263 | 2772 #else /* not NEW_GC */ |
771 | 2773 unsigned int mark :1; |
2774 unsigned int c_readonly :1; | |
2775 unsigned int lisp_readonly :1; | |
2776 /* Number of chars at beginning of string that are one byte in length | |
826 | 2777 (byte_ascii_p) */ |
771 | 2778 unsigned int ascii_begin :21; |
3263 | 2779 #endif /* not NEW_GC */ |
771 | 2780 } v; |
2781 } u; | |
3092 | 2782 #ifdef NEW_GC |
2783 int indirect; | |
2784 Lisp_Object data_object; | |
2785 #else /* not NEW_GC */ | |
793 | 2786 Bytecount size_; |
867 | 2787 Ibyte *data_; |
3092 | 2788 #endif /* not NEW_GC */ |
428 | 2789 Lisp_Object plist; |
2790 }; | |
2791 typedef struct Lisp_String Lisp_String; | |
2792 | |
3263 | 2793 #ifdef NEW_GC |
3063 | 2794 #define MAX_STRING_ASCII_BEGIN ((1 << 22) - 1) |
3263 | 2795 #else /* not NEW_GC */ |
851 | 2796 #define MAX_STRING_ASCII_BEGIN ((1 << 21) - 1) |
3263 | 2797 #endif /* not NEW_GC */ |
771 | 2798 |
1632 | 2799 DECLARE_MODULE_API_LRECORD (string, Lisp_String); |
428 | 2800 #define XSTRING(x) XRECORD (x, string, Lisp_String) |
617 | 2801 #define wrap_string(p) wrap_record (p, string) |
428 | 2802 #define STRINGP(x) RECORDP (x, string) |
2803 #define CHECK_STRING(x) CHECK_RECORD (x, string) | |
2804 #define CONCHECK_STRING(x) CONCHECK_RECORD (x, string) | |
2805 | |
826 | 2806 /* Most basic macros for strings -- basically just accessing or setting |
2807 fields -- are here. Everything else is in text.h, since they depend on | |
2808 stuff there. */ | |
428 | 2809 |
793 | 2810 /* Operations on Lisp_String *'s; only ones left */ |
3092 | 2811 #ifdef NEW_GC |
3304 | 2812 #define set_lispstringp_direct(s) ((s)->indirect = 0) |
3092 | 2813 #define set_lispstringp_indirect(s) ((s)->indirect = 1) |
2814 #define set_lispstringp_length(s, len) XSET_STRING_DATA_SIZE (s, len) | |
2815 #define set_lispstringp_data(s, ptr) XSET_STRING_DATA_DATA (s, ptr) | |
2816 #else /* not NEW_GC */ | |
826 | 2817 #define set_lispstringp_length(s, len) ((void) ((s)->size_ = (len))) |
2818 #define set_lispstringp_data(s, ptr) ((void) ((s)->data_ = (ptr))) | |
3092 | 2819 #endif /* not NEW_GC */ |
826 | 2820 |
2821 /* Operations on strings as Lisp_Objects. Don't manipulate Lisp_String *'s | |
2822 in any new code. */ | |
3092 | 2823 #ifdef NEW_GC |
2824 #define STRING_DATA_OBJECT(s) ((s)->data_object) | |
2825 #define XSTRING_DATA_OBJECT(s) (STRING_DATA_OBJECT (XSTRING (s))) | |
2826 #define XSTRING_LENGTH(s) (XSTRING_DATA_SIZE (XSTRING (s))) | |
2827 #else /* not NEW_GC */ | |
793 | 2828 #define XSTRING_LENGTH(s) (XSTRING (s)->size_) |
3092 | 2829 #endif /* not NEW_GC */ |
793 | 2830 #define XSTRING_PLIST(s) (XSTRING (s)->plist) |
3092 | 2831 #ifdef NEW_GC |
2832 #define XSTRING_DATA(s) (XSTRING_DATA_DATA (XSTRING (s))) | |
2833 #else /* not NEW_GC */ | |
793 | 2834 #define XSTRING_DATA(s) (XSTRING (s)->data_ + 0) |
3092 | 2835 #endif /* not NEW_GC */ |
793 | 2836 #define XSTRING_ASCII_BEGIN(s) (XSTRING (s)->u.v.ascii_begin + 0) |
826 | 2837 #define XSET_STRING_LENGTH(s, ptr) set_lispstringp_length (XSTRING (s), ptr) |
2838 #define XSET_STRING_DATA(s, ptr) set_lispstringp_data (XSTRING (s), ptr) | |
771 | 2839 /* WARNING: If you modify an existing string, you must call |
2840 bump_string_modiff() afterwards. */ | |
793 | 2841 #define XSET_STRING_ASCII_BEGIN(s, val) \ |
2842 ((void) (XSTRING (s)->u.v.ascii_begin = (val))) | |
826 | 2843 #define XSTRING_FORMAT(s) FORMAT_DEFAULT |
428 | 2844 |
456 | 2845 /* Return the true aligned size of a struct whose last member is a |
2846 variable-length array field. (this is known as the "struct hack") */ | |
2847 /* Implementation: in practice, structtype and fieldtype usually have | |
2848 the same alignment, but we can't be sure. We need to use | |
2849 ALIGN_SIZE to be absolutely sure of getting the correct alignment. | |
2850 To help the compiler's optimizer, we use a ternary expression that | |
2851 only a very stupid compiler would fail to correctly simplify. */ | |
2852 #define FLEXIBLE_ARRAY_STRUCT_SIZEOF(structtype, \ | |
2853 fieldtype, \ | |
2854 fieldname, \ | |
2855 array_length) \ | |
2856 (ALIGNOF (structtype) == ALIGNOF (fieldtype) \ | |
2857 ? (offsetof (structtype, fieldname) + \ | |
2858 (offsetof (structtype, fieldname[1]) - \ | |
2859 offsetof (structtype, fieldname[0])) * \ | |
2860 (array_length)) \ | |
826 | 2861 : (ALIGN_FOR_TYPE \ |
456 | 2862 ((offsetof (structtype, fieldname) + \ |
2863 (offsetof (structtype, fieldname[1]) - \ | |
2864 offsetof (structtype, fieldname[0])) * \ | |
2865 (array_length)), \ | |
826 | 2866 structtype))) |
442 | 2867 |
2868 /*------------------------------ vector --------------------------------*/ | |
428 | 2869 |
2870 struct Lisp_Vector | |
2871 { | |
3017 | 2872 struct LCRECORD_HEADER header; |
428 | 2873 long size; |
2874 Lisp_Object contents[1]; | |
2875 }; | |
2876 typedef struct Lisp_Vector Lisp_Vector; | |
2877 | |
2878 DECLARE_LRECORD (vector, Lisp_Vector); | |
2879 #define XVECTOR(x) XRECORD (x, vector, Lisp_Vector) | |
617 | 2880 #define wrap_vector(p) wrap_record (p, vector) |
428 | 2881 #define VECTORP(x) RECORDP (x, vector) |
2882 #define CHECK_VECTOR(x) CHECK_RECORD (x, vector) | |
2883 #define CONCHECK_VECTOR(x) CONCHECK_RECORD (x, vector) | |
2884 | |
2885 #define vector_length(v) ((v)->size) | |
2886 #define XVECTOR_LENGTH(s) vector_length (XVECTOR (s)) | |
2887 #define vector_data(v) ((v)->contents) | |
2888 #define XVECTOR_DATA(s) vector_data (XVECTOR (s)) | |
2889 | |
442 | 2890 /*---------------------------- bit vectors -----------------------------*/ |
428 | 2891 |
2892 #if (LONGBITS < 16) | |
2893 #error What the hell?! | |
2894 #elif (LONGBITS < 32) | |
2895 # define LONGBITS_LOG2 4 | |
2896 # define LONGBITS_POWER_OF_2 16 | |
2897 #elif (LONGBITS < 64) | |
2898 # define LONGBITS_LOG2 5 | |
2899 # define LONGBITS_POWER_OF_2 32 | |
2900 #elif (LONGBITS < 128) | |
2901 # define LONGBITS_LOG2 6 | |
2902 # define LONGBITS_POWER_OF_2 64 | |
2903 #else | |
2904 #error You really have 128-bit integers?! | |
2905 #endif | |
2906 | |
2907 struct Lisp_Bit_Vector | |
2908 { | |
3017 | 2909 struct LCRECORD_HEADER lheader; |
665 | 2910 Elemcount size; |
428 | 2911 unsigned long bits[1]; |
2912 }; | |
2913 typedef struct Lisp_Bit_Vector Lisp_Bit_Vector; | |
2914 | |
2915 DECLARE_LRECORD (bit_vector, Lisp_Bit_Vector); | |
2916 #define XBIT_VECTOR(x) XRECORD (x, bit_vector, Lisp_Bit_Vector) | |
617 | 2917 #define wrap_bit_vector(p) wrap_record (p, bit_vector) |
428 | 2918 #define BIT_VECTORP(x) RECORDP (x, bit_vector) |
2919 #define CHECK_BIT_VECTOR(x) CHECK_RECORD (x, bit_vector) | |
2920 #define CONCHECK_BIT_VECTOR(x) CONCHECK_RECORD (x, bit_vector) | |
2921 | |
2922 #define BITP(x) (INTP (x) && (XINT (x) == 0 || XINT (x) == 1)) | |
2923 | |
2924 #define CHECK_BIT(x) do { \ | |
2925 if (!BITP (x)) \ | |
2926 dead_wrong_type_argument (Qbitp, x);\ | |
2927 } while (0) | |
2928 | |
2929 #define CONCHECK_BIT(x) do { \ | |
2930 if (!BITP (x)) \ | |
2931 x = wrong_type_argument (Qbitp, x); \ | |
2932 } while (0) | |
2933 | |
2934 #define bit_vector_length(v) ((v)->size) | |
2935 | |
826 | 2936 DECLARE_INLINE_HEADER ( |
2937 int | |
665 | 2938 bit_vector_bit (Lisp_Bit_Vector *v, Elemcount n) |
826 | 2939 ) |
428 | 2940 { |
2941 return ((v->bits[n >> LONGBITS_LOG2] >> (n & (LONGBITS_POWER_OF_2 - 1))) | |
2942 & 1); | |
2943 } | |
2944 | |
826 | 2945 DECLARE_INLINE_HEADER ( |
2946 void | |
665 | 2947 set_bit_vector_bit (Lisp_Bit_Vector *v, Elemcount n, int value) |
826 | 2948 ) |
428 | 2949 { |
2950 if (value) | |
2951 v->bits[n >> LONGBITS_LOG2] |= (1UL << (n & (LONGBITS_POWER_OF_2 - 1))); | |
2952 else | |
2953 v->bits[n >> LONGBITS_LOG2] &= ~(1UL << (n & (LONGBITS_POWER_OF_2 - 1))); | |
2954 } | |
2955 | |
2956 /* Number of longs required to hold LEN bits */ | |
2957 #define BIT_VECTOR_LONG_STORAGE(len) \ | |
2958 (((len) + LONGBITS_POWER_OF_2 - 1) >> LONGBITS_LOG2) | |
2959 | |
3659 | 2960 /* For when we want to include a bit vector in another structure, and we |
2961 know it's of a fixed size. */ | |
2962 #define DECLARE_INLINE_LISP_BIT_VECTOR(numbits) struct { \ | |
2963 struct LCRECORD_HEADER lheader; \ | |
2964 Elemcount size; \ | |
2965 unsigned long bits[BIT_VECTOR_LONG_STORAGE(numbits)]; \ | |
2966 } | |
853 | 2967 |
442 | 2968 /*------------------------------ symbol --------------------------------*/ |
428 | 2969 |
440 | 2970 typedef struct Lisp_Symbol Lisp_Symbol; |
428 | 2971 struct Lisp_Symbol |
2972 { | |
2973 struct lrecord_header lheader; | |
2974 /* next symbol in this obarray bucket */ | |
440 | 2975 Lisp_Symbol *next; |
793 | 2976 Lisp_Object name; |
428 | 2977 Lisp_Object value; |
2978 Lisp_Object function; | |
2979 Lisp_Object plist; | |
2980 }; | |
2981 | |
2982 #define SYMBOL_IS_KEYWORD(sym) \ | |
826 | 2983 ((string_byte (symbol_name (XSYMBOL (sym)), 0) == ':') \ |
428 | 2984 && EQ (sym, oblookup (Vobarray, \ |
793 | 2985 XSTRING_DATA (symbol_name (XSYMBOL (sym))), \ |
2986 XSTRING_LENGTH (symbol_name (XSYMBOL (sym)))))) | |
428 | 2987 #define KEYWORDP(obj) (SYMBOLP (obj) && SYMBOL_IS_KEYWORD (obj)) |
2988 | |
1632 | 2989 DECLARE_MODULE_API_LRECORD (symbol, Lisp_Symbol); |
428 | 2990 #define XSYMBOL(x) XRECORD (x, symbol, Lisp_Symbol) |
617 | 2991 #define wrap_symbol(p) wrap_record (p, symbol) |
428 | 2992 #define SYMBOLP(x) RECORDP (x, symbol) |
2993 #define CHECK_SYMBOL(x) CHECK_RECORD (x, symbol) | |
2994 #define CONCHECK_SYMBOL(x) CONCHECK_RECORD (x, symbol) | |
2995 | |
2996 #define symbol_next(s) ((s)->next) | |
2997 #define symbol_name(s) ((s)->name) | |
2998 #define symbol_value(s) ((s)->value) | |
2999 #define symbol_function(s) ((s)->function) | |
3000 #define symbol_plist(s) ((s)->plist) | |
3001 | |
793 | 3002 #define XSYMBOL_NEXT(s) (XSYMBOL (s)->next) |
3003 #define XSYMBOL_NAME(s) (XSYMBOL (s)->name) | |
3004 #define XSYMBOL_VALUE(s) (XSYMBOL (s)->value) | |
3005 #define XSYMBOL_FUNCTION(s) (XSYMBOL (s)->function) | |
3006 #define XSYMBOL_PLIST(s) (XSYMBOL (s)->plist) | |
3007 | |
3008 | |
442 | 3009 /*------------------------------- subr ---------------------------------*/ |
428 | 3010 |
853 | 3011 /* A function that takes no arguments and returns a Lisp_Object. |
3012 We could define such types for n arguments, if needed. */ | |
428 | 3013 typedef Lisp_Object (*lisp_fn_t) (void); |
3014 | |
3015 struct Lisp_Subr | |
3016 { | |
3017 struct lrecord_header lheader; | |
442 | 3018 short min_args; |
3019 short max_args; | |
3379 | 3020 /* #### We should make these const Ascbyte * or const Ibyte *, not const |
3021 char *. */ | |
442 | 3022 const char *prompt; |
3023 const char *doc; | |
3024 const char *name; | |
428 | 3025 lisp_fn_t subr_fn; |
3026 }; | |
3027 typedef struct Lisp_Subr Lisp_Subr; | |
3028 | |
3029 DECLARE_LRECORD (subr, Lisp_Subr); | |
3030 #define XSUBR(x) XRECORD (x, subr, Lisp_Subr) | |
617 | 3031 #define wrap_subr(p) wrap_record (p, subr) |
428 | 3032 #define SUBRP(x) RECORDP (x, subr) |
3033 #define CHECK_SUBR(x) CHECK_RECORD (x, subr) | |
3034 #define CONCHECK_SUBR(x) CONCHECK_RECORD (x, subr) | |
3035 | |
436 | 3036 #define subr_function(subr) ((subr)->subr_fn) |
3037 #define SUBR_FUNCTION(subr,max_args) \ | |
3038 ((Lisp_Object (*) (EXFUN_##max_args)) (subr)->subr_fn) | |
3039 #define subr_name(subr) ((subr)->name) | |
428 | 3040 |
442 | 3041 /*------------------------------ marker --------------------------------*/ |
3042 | |
428 | 3043 |
440 | 3044 typedef struct Lisp_Marker Lisp_Marker; |
428 | 3045 struct Lisp_Marker |
3046 { | |
3047 struct lrecord_header lheader; | |
440 | 3048 Lisp_Marker *next; |
3049 Lisp_Marker *prev; | |
428 | 3050 struct buffer *buffer; |
665 | 3051 Membpos membpos; |
428 | 3052 char insertion_type; |
3053 }; | |
3054 | |
1632 | 3055 DECLARE_MODULE_API_LRECORD (marker, Lisp_Marker); |
428 | 3056 #define XMARKER(x) XRECORD (x, marker, Lisp_Marker) |
617 | 3057 #define wrap_marker(p) wrap_record (p, marker) |
428 | 3058 #define MARKERP(x) RECORDP (x, marker) |
3059 #define CHECK_MARKER(x) CHECK_RECORD (x, marker) | |
3060 #define CONCHECK_MARKER(x) CONCHECK_RECORD (x, marker) | |
3061 | |
3062 /* The second check was looking for GCed markers still in use */ | |
2500 | 3063 /* if (INTP (XMARKER (x)->lheader.next.v)) ABORT (); */ |
428 | 3064 |
3065 #define marker_next(m) ((m)->next) | |
3066 #define marker_prev(m) ((m)->prev) | |
3067 | |
3063 | 3068 /*-------------------basic int (no connection to char)------------------*/ |
3069 | |
3070 #define ZEROP(x) EQ (x, Qzero) | |
428 | 3071 |
800 | 3072 #ifdef ERROR_CHECK_TYPES |
428 | 3073 |
3063 | 3074 #define XINT(x) XINT_1 (x, __FILE__, __LINE__) |
3075 | |
3076 DECLARE_INLINE_HEADER ( | |
3077 EMACS_INT | |
3078 XINT_1 (Lisp_Object obj, const Ascbyte *file, int line) | |
3079 ) | |
3080 { | |
3081 assert_at_line (INTP (obj), file, line); | |
3082 return XREALINT (obj); | |
3083 } | |
3084 | |
3085 #else /* no error checking */ | |
3086 | |
3087 #define XINT(obj) XREALINT (obj) | |
3088 | |
3089 #endif /* no error checking */ | |
3090 | |
3091 #define CHECK_INT(x) do { \ | |
3092 if (!INTP (x)) \ | |
3093 dead_wrong_type_argument (Qintegerp, x); \ | |
3094 } while (0) | |
3095 | |
3096 #define CONCHECK_INT(x) do { \ | |
3097 if (!INTP (x)) \ | |
3098 x = wrong_type_argument (Qintegerp, x); \ | |
3099 } while (0) | |
3100 | |
3101 #define NATNUMP(x) (INTP (x) && XINT (x) >= 0) | |
3102 | |
3103 #define CHECK_NATNUM(x) do { \ | |
3104 if (!NATNUMP (x)) \ | |
3105 dead_wrong_type_argument (Qnatnump, x); \ | |
3106 } while (0) | |
3107 | |
3108 #define CONCHECK_NATNUM(x) do { \ | |
3109 if (!NATNUMP (x)) \ | |
3110 x = wrong_type_argument (Qnatnump, x); \ | |
3111 } while (0) | |
3112 | |
3113 /*------------------------------- char ---------------------------------*/ | |
3114 | |
3115 /* NOTE: There are basic functions for converting between a character and | |
3116 the string representation of a character in text.h, as well as lots of | |
3117 other character-related stuff. There are other functions/macros for | |
3118 working with Ichars in charset.h, for retrieving the charset of an | |
3119 Ichar, the length of an Ichar when converted to text, etc. | |
3120 */ | |
3121 | |
3122 #ifdef MULE | |
3123 | |
3124 MODULE_API int non_ascii_valid_ichar_p (Ichar ch); | |
3125 | |
3126 /* Return whether the given Ichar is valid. | |
3127 */ | |
3128 | |
3129 DECLARE_INLINE_HEADER ( | |
3130 int | |
3131 valid_ichar_p (Ichar ch) | |
3132 ) | |
3133 { | |
3134 return (! (ch & ~0xFF)) || non_ascii_valid_ichar_p (ch); | |
3135 } | |
3136 | |
3137 #else /* not MULE */ | |
3138 | |
3139 /* This works when CH is negative, and correctly returns non-zero only when CH | |
3140 is in the range [0, 255], inclusive. */ | |
3141 #define valid_ichar_p(ch) (! (ch & ~0xFF)) | |
3142 | |
3143 #endif /* not MULE */ | |
3144 | |
3145 #ifdef ERROR_CHECK_TYPES | |
3146 | |
3147 DECLARE_INLINE_HEADER ( | |
3148 int | |
3149 CHARP_1 (Lisp_Object obj, const Ascbyte *file, int line) | |
3150 ) | |
3151 { | |
3152 if (XTYPE (obj) != Lisp_Type_Char) | |
3153 return 0; | |
3154 assert_at_line (valid_ichar_p (XCHARVAL (obj)), file, line); | |
3155 return 1; | |
3156 } | |
3157 | |
3158 #define CHARP(x) CHARP_1 (x, __FILE__, __LINE__) | |
3159 | |
826 | 3160 DECLARE_INLINE_HEADER ( |
867 | 3161 Ichar |
2367 | 3162 XCHAR_1 (Lisp_Object obj, const Ascbyte *file, int line) |
826 | 3163 ) |
428 | 3164 { |
3063 | 3165 Ichar ch; |
788 | 3166 assert_at_line (CHARP (obj), file, line); |
3063 | 3167 ch = XCHARVAL (obj); |
3168 assert_at_line (valid_ichar_p (ch), file, line); | |
3169 return ch; | |
428 | 3170 } |
3171 | |
788 | 3172 #define XCHAR(x) XCHAR_1 (x, __FILE__, __LINE__) |
3173 | |
3063 | 3174 #else /* not ERROR_CHECK_TYPES */ |
3175 | |
3176 #define CHARP(x) (XTYPE (x) == Lisp_Type_Char) | |
3177 #define XCHAR(x) ((Ichar) XCHARVAL (x)) | |
3178 | |
3179 #endif /* (else) not ERROR_CHECK_TYPES */ | |
3180 | |
3181 #define CONCHECK_CHAR(x) do { \ | |
3182 if (!CHARP (x)) \ | |
3183 x = wrong_type_argument (Qcharacterp, x); \ | |
3184 } while (0) | |
3185 | |
3186 #define CHECK_CHAR(x) do { \ | |
3187 if (!CHARP (x)) \ | |
3188 dead_wrong_type_argument (Qcharacterp, x); \ | |
3189 } while (0) | |
3190 | |
3191 | |
3192 DECLARE_INLINE_HEADER ( | |
3193 Lisp_Object | |
3194 make_char (Ichar val) | |
3195 ) | |
3196 { | |
3197 type_checking_assert (valid_ichar_p (val)); | |
3198 /* This is defined in lisp-union.h or lisp-disunion.h */ | |
3199 return make_char_1 (val); | |
3200 } | |
3201 | |
3202 /*------------------------- int-char connection ------------------------*/ | |
3203 | |
3204 #ifdef ERROR_CHECK_TYPES | |
3205 | |
3206 #define XCHAR_OR_INT(x) XCHAR_OR_INT_1 (x, __FILE__, __LINE__) | |
3207 | |
3208 DECLARE_INLINE_HEADER ( | |
3209 EMACS_INT | |
3210 XCHAR_OR_INT_1 (Lisp_Object obj, const Ascbyte *file, int line) | |
3211 ) | |
3212 { | |
3213 assert_at_line (INTP (obj) || CHARP (obj), file, line); | |
3214 return CHARP (obj) ? XCHAR (obj) : XINT (obj); | |
3215 } | |
3216 | |
788 | 3217 #else /* no error checking */ |
3218 | |
4134 | 3219 /* obj is multiply eval'ed and not an lvalue; use an inline function instead |
3220 of a macro. */ | |
3221 DECLARE_INLINE_HEADER ( | |
3222 EMACS_INT | |
3223 XCHAR_OR_INT (Lisp_Object obj) | |
3224 ) | |
3225 { | |
3226 return CHARP (obj) ? XCHAR (obj) : XINT (obj); | |
3227 } | |
788 | 3228 |
3229 #endif /* no error checking */ | |
428 | 3230 |
3063 | 3231 /* True of X is an integer whose value is the valid integral equivalent of a |
3232 character. */ | |
3233 | |
3234 #define CHAR_INTP(x) (INTP (x) && valid_ichar_p (XINT (x))) | |
3235 | |
3236 /* True of X is a character or an integral value that can be converted into a | |
3237 character. */ | |
3238 #define CHAR_OR_CHAR_INTP(x) (CHARP (x) || CHAR_INTP (x)) | |
3239 | |
3240 DECLARE_INLINE_HEADER ( | |
3241 Ichar | |
3242 XCHAR_OR_CHAR_INT (Lisp_Object obj) | |
3243 ) | |
3244 { | |
3245 return CHARP (obj) ? XCHAR (obj) : XINT (obj); | |
3246 } | |
3247 | |
3248 /* Signal an error if CH is not a valid character or integer Lisp_Object. | |
3249 If CH is an integer Lisp_Object, convert it to a character Lisp_Object, | |
3250 but merely by repackaging, without performing tests for char validity. | |
3251 */ | |
3252 | |
3253 #define CHECK_CHAR_COERCE_INT(x) do { \ | |
3254 if (CHARP (x)) \ | |
3255 ; \ | |
3256 else if (CHAR_INTP (x)) \ | |
3257 x = make_char (XINT (x)); \ | |
3258 else \ | |
3259 x = wrong_type_argument (Qcharacterp, x); \ | |
3260 } while (0) | |
3261 | |
3262 /* next three always continuable because they coerce their arguments. */ | |
3263 #define CHECK_INT_COERCE_CHAR(x) do { \ | |
3264 if (INTP (x)) \ | |
3265 ; \ | |
3266 else if (CHARP (x)) \ | |
3267 x = make_int (XCHAR (x)); \ | |
3268 else \ | |
3269 x = wrong_type_argument (Qinteger_or_char_p, x); \ | |
3270 } while (0) | |
3271 | |
3272 #define CHECK_INT_COERCE_MARKER(x) do { \ | |
3273 if (INTP (x)) \ | |
3274 ; \ | |
3275 else if (MARKERP (x)) \ | |
3276 x = make_int (marker_position (x)); \ | |
3277 else \ | |
3278 x = wrong_type_argument (Qinteger_or_marker_p, x); \ | |
3279 } while (0) | |
3280 | |
3281 #define CHECK_INT_COERCE_CHAR_OR_MARKER(x) do { \ | |
3282 if (INTP (x)) \ | |
3283 ; \ | |
3284 else if (CHARP (x)) \ | |
3285 x = make_int (XCHAR (x)); \ | |
3286 else if (MARKERP (x)) \ | |
3287 x = make_int (marker_position (x)); \ | |
3288 else \ | |
3289 x = wrong_type_argument (Qinteger_char_or_marker_p, x); \ | |
3290 } while (0) | |
428 | 3291 |
442 | 3292 /*------------------------------ float ---------------------------------*/ |
428 | 3293 |
3294 /* Note: the 'unused_next_' field exists only to ensure that the | |
3295 `next' pointer fits within the structure, for the purposes of the | |
3296 free list. This makes a difference in the unlikely case of | |
3297 sizeof(double) being smaller than sizeof(void *). */ | |
3298 | |
3299 struct Lisp_Float | |
3300 { | |
3301 struct lrecord_header lheader; | |
3302 union { double d; struct Lisp_Float *unused_next_; } data; | |
3303 }; | |
3304 typedef struct Lisp_Float Lisp_Float; | |
3305 | |
3306 DECLARE_LRECORD (float, Lisp_Float); | |
3307 #define XFLOAT(x) XRECORD (x, float, Lisp_Float) | |
617 | 3308 #define wrap_float(p) wrap_record (p, float) |
428 | 3309 #define FLOATP(x) RECORDP (x, float) |
3310 #define CHECK_FLOAT(x) CHECK_RECORD (x, float) | |
3311 #define CONCHECK_FLOAT(x) CONCHECK_RECORD (x, float) | |
3312 | |
3313 #define float_data(f) ((f)->data.d) | |
3314 #define XFLOAT_DATA(x) float_data (XFLOAT (x)) | |
3315 | |
3316 #define XFLOATINT(n) extract_float (n) | |
3317 | |
3318 #define CHECK_INT_OR_FLOAT(x) do { \ | |
3319 if (!INT_OR_FLOATP (x)) \ | |
3320 dead_wrong_type_argument (Qnumberp, x); \ | |
3321 } while (0) | |
3322 | |
3323 #define CONCHECK_INT_OR_FLOAT(x) do { \ | |
3324 if (!INT_OR_FLOATP (x)) \ | |
3325 x = wrong_type_argument (Qnumberp, x); \ | |
3326 } while (0) | |
3327 | |
3328 # define INT_OR_FLOATP(x) (INTP (x) || FLOATP (x)) | |
3329 | |
442 | 3330 /*--------------------------- readonly objects -------------------------*/ |
440 | 3331 |
3263 | 3332 #ifndef NEW_GC |
428 | 3333 #define CHECK_C_WRITEABLE(obj) \ |
3334 do { if (c_readonly (obj)) c_write_error (obj); } while (0) | |
3335 | |
2720 | 3336 #define C_READONLY(obj) (C_READONLY_RECORD_HEADER_P(XRECORD_LHEADER (obj))) |
3263 | 3337 #endif /* not NEW_GC */ |
2720 | 3338 |
428 | 3339 #define CHECK_LISP_WRITEABLE(obj) \ |
3340 do { if (lisp_readonly (obj)) lisp_write_error (obj); } while (0) | |
3341 | |
3342 #define LISP_READONLY(obj) (LISP_READONLY_RECORD_HEADER_P(XRECORD_LHEADER (obj))) | |
3343 | |
980 | 3344 /*----------------------------- structures ----------------------------*/ |
428 | 3345 |
3346 typedef struct structure_keyword_entry structure_keyword_entry; | |
3347 struct structure_keyword_entry | |
3348 { | |
3349 Lisp_Object keyword; | |
3350 int (*validate) (Lisp_Object keyword, Lisp_Object value, | |
578 | 3351 Error_Behavior errb); |
428 | 3352 }; |
3353 | |
3354 typedef struct | |
3355 { | |
3356 Dynarr_declare (structure_keyword_entry); | |
3357 } structure_keyword_entry_dynarr; | |
3358 | |
3359 typedef struct structure_type structure_type; | |
3360 struct structure_type | |
3361 { | |
3362 Lisp_Object type; | |
3363 structure_keyword_entry_dynarr *keywords; | |
578 | 3364 int (*validate) (Lisp_Object data, Error_Behavior errb); |
428 | 3365 Lisp_Object (*instantiate) (Lisp_Object data); |
3366 }; | |
3367 | |
3368 typedef struct | |
3369 { | |
3370 Dynarr_declare (structure_type); | |
3371 } structure_type_dynarr; | |
3372 | |
3373 struct structure_type *define_structure_type (Lisp_Object type, | |
3374 int (*validate) | |
3375 (Lisp_Object data, | |
578 | 3376 Error_Behavior errb), |
428 | 3377 Lisp_Object (*instantiate) |
3378 (Lisp_Object data)); | |
3379 void define_structure_type_keyword (struct structure_type *st, | |
3380 Lisp_Object keyword, | |
3381 int (*validate) (Lisp_Object keyword, | |
3382 Lisp_Object value, | |
578 | 3383 Error_Behavior errb)); |
428 | 3384 |
858 | 3385 /*---------------------------- weak boxes ------------------------------*/ |
3386 | |
3387 struct weak_box | |
3388 { | |
3017 | 3389 struct LCRECORD_HEADER header; |
858 | 3390 Lisp_Object value; |
3391 | |
3392 Lisp_Object next_weak_box; /* don't mark through this! */ | |
3393 }; | |
3394 | |
3395 void prune_weak_boxes (void); | |
3396 Lisp_Object make_weak_box (Lisp_Object value); | |
3397 Lisp_Object weak_box_ref (Lisp_Object value); | |
3398 | |
3399 DECLARE_LRECORD (weak_box, struct weak_box); | |
3400 #define XWEAK_BOX(x) XRECORD (x, weak_box, struct weak_box) | |
3401 #define XSET_WEAK_BOX(x, v) (XWEAK_BOX (x)->value = (v)) | |
3402 #define wrap_weak_box(p) wrap_record (p, weak_box) | |
3403 #define WEAK_BOXP(x) RECORDP (x, weak_box) | |
3404 #define CHECK_WEAK_BOX(x) CHECK_RECORD (x, weak_box) | |
3405 #define CONCHECK_WEAK_BOX(x) CONCHECK_RECORD (x, weak_box) | |
3406 | |
888 | 3407 /*--------------------------- ephemerons ----------------------------*/ |
3408 | |
3409 struct ephemeron | |
3410 { | |
3017 | 3411 struct LCRECORD_HEADER header; |
888 | 3412 |
3413 Lisp_Object key; | |
3414 | |
3415 /* This field holds a pair. The cdr of this cons points to the next | |
3416 ephemeron in Vall_ephemerons. The car points to another pair | |
3417 whose car is the value and whose cdr is the finalizer. | |
3418 | |
3419 This representation makes it very easy to unlink an ephemeron | |
3420 from Vall_ephemerons and chain it into | |
3421 Vall_ephemerons_to_finalize. */ | |
3422 | |
3423 Lisp_Object cons_chain; | |
3424 | |
3425 Lisp_Object value; | |
3426 }; | |
3427 | |
3428 void prune_ephemerons (void); | |
3429 Lisp_Object ephemeron_value(Lisp_Object ephi); | |
1590 | 3430 void init_marking_ephemerons(void); |
3431 int continue_marking_ephemerons(void); | |
888 | 3432 int finish_marking_ephemerons(void); |
3433 Lisp_Object zap_finalize_list(void); | |
3434 Lisp_Object make_ephemeron(Lisp_Object key, Lisp_Object value, Lisp_Object finalizer); | |
3435 | |
3436 DECLARE_LRECORD(ephemeron, struct ephemeron); | |
3437 #define XEPHEMERON(x) XRECORD (x, ephemeron, struct ephemeron) | |
3438 #define XEPHEMERON_REF(x) (XEPHEMERON (x)->value) | |
3439 #define XEPHEMERON_NEXT(x) (XCDR (XEPHEMERON(x)->cons_chain)) | |
3440 #define XEPHEMERON_FINALIZER(x) (XCDR (XCAR (XEPHEMERON (x)->cons_chain))) | |
3441 #define XSET_EPHEMERON_NEXT(x, n) (XSETCDR (XEPHEMERON(x)->cons_chain, n)) | |
3442 #define XSET_EPHEMERON_VALUE(x, v) (XEPHEMERON(x)->value = (v)) | |
3443 #define XSET_EPHEMERON_KEY(x, k) (XEPHEMERON(x)->key = (k)) | |
3444 #define wrap_ephemeron(p) wrap_record (p, ephemeron) | |
3445 #define EPHEMERONP(x) RECORDP (x, ephemeron) | |
3446 #define CHECK_EPHEMERON(x) CHECK_RECORD (x, ephemeron) | |
3447 #define CONCHECK_EPHEMERON(x) CONCHECK_RECORD (x, ephemeron) | |
3448 | |
858 | 3449 |
442 | 3450 /*---------------------------- weak lists ------------------------------*/ |
428 | 3451 |
3452 enum weak_list_type | |
3453 { | |
3454 /* element disappears if it's unmarked. */ | |
3455 WEAK_LIST_SIMPLE, | |
3456 /* element disappears if it's a cons and either its car or | |
3457 cdr is unmarked. */ | |
3458 WEAK_LIST_ASSOC, | |
3459 /* element disappears if it's a cons and its car is unmarked. */ | |
3460 WEAK_LIST_KEY_ASSOC, | |
3461 /* element disappears if it's a cons and its cdr is unmarked. */ | |
442 | 3462 WEAK_LIST_VALUE_ASSOC, |
3463 /* element disappears if it's a cons and neither its car nor | |
3464 its cdr is marked. */ | |
3465 WEAK_LIST_FULL_ASSOC | |
428 | 3466 }; |
3467 | |
3468 struct weak_list | |
3469 { | |
3017 | 3470 struct LCRECORD_HEADER header; |
428 | 3471 Lisp_Object list; /* don't mark through this! */ |
3472 enum weak_list_type type; | |
3473 Lisp_Object next_weak; /* don't mark through this! */ | |
3474 }; | |
3475 | |
3476 DECLARE_LRECORD (weak_list, struct weak_list); | |
3477 #define XWEAK_LIST(x) XRECORD (x, weak_list, struct weak_list) | |
617 | 3478 #define wrap_weak_list(p) wrap_record (p, weak_list) |
428 | 3479 #define WEAK_LISTP(x) RECORDP (x, weak_list) |
3480 #define CHECK_WEAK_LIST(x) CHECK_RECORD (x, weak_list) | |
3481 #define CONCHECK_WEAK_LIST(x) CONCHECK_RECORD (x, weak_list) | |
3482 | |
3483 #define weak_list_list(w) ((w)->list) | |
3484 #define XWEAK_LIST_LIST(w) (XWEAK_LIST (w)->list) | |
3485 | |
3486 Lisp_Object make_weak_list (enum weak_list_type type); | |
3487 /* The following two are only called by the garbage collector */ | |
3488 int finish_marking_weak_lists (void); | |
3489 void prune_weak_lists (void); | |
3490 | |
1743 | 3491 END_C_DECLS |
428 | 3492 |
3493 /************************************************************************/ | |
771 | 3494 /* Definitions related to the format of text and of characters */ |
3495 /************************************************************************/ | |
3496 | |
3497 /* Note: | |
3498 | |
3499 "internally formatted text" and the term "internal format" in | |
3500 general are likely to refer to the format of text in buffers and | |
3501 strings; "externally formatted text" and the term "external format" | |
3502 refer to any text format used in the O.S. or elsewhere outside of | |
3503 XEmacs. The format of text and of a character are related and | |
3504 there must be a one-to-one relationship (hopefully through a | |
3505 relatively simple algorithmic means of conversion) between a string | |
3506 of text and an equivalent array of characters, but the conversion | |
3507 between the two is NOT necessarily trivial. | |
3508 | |
3509 In a non-Mule XEmacs, allowed characters are numbered 0 through | |
3510 255, where no fixed meaning is assigned to them, but (when | |
3511 representing text, rather than bytes in a binary file) in practice | |
3512 the lower half represents ASCII and the upper half some other 8-bit | |
3513 character set (chosen by setting the font, case tables, syntax | |
3514 tables, etc. appropriately for the character set through ad-hoc | |
3515 means such as the `iso-8859-1' file and the | |
3516 `standard-display-european' function). | |
3517 | |
3518 #### Finish this. | |
3519 | |
3520 */ | |
3521 #include "text.h" | |
3522 | |
3523 | |
3524 /************************************************************************/ | |
428 | 3525 /* Definitions of primitive Lisp functions and variables */ |
3526 /************************************************************************/ | |
3527 | |
3528 | |
3529 /* DEFUN - Define a built-in Lisp-visible C function or `subr'. | |
3530 `lname' should be the name to give the function in Lisp, | |
3531 as a null-terminated C string. | |
3532 `Fname' should be the C equivalent of `lname', using only characters | |
3533 valid in a C identifier, with an "F" prepended. | |
3534 The name of the C constant structure that records information | |
3535 on this function for internal use is "S" concatenated with Fname. | |
3536 `min_args' should be a number, the minimum number of arguments allowed. | |
3537 `max_args' should be a number, the maximum number of arguments allowed, | |
3538 or else MANY or UNEVALLED. | |
3539 MANY means pass a vector of evaluated arguments, | |
3540 in the form of an integer number-of-arguments | |
3541 followed by the address of a vector of Lisp_Objects | |
3542 which contains the argument values. | |
3543 UNEVALLED means pass the list of unevaluated arguments. | |
3544 `prompt' says how to read arguments for an interactive call. | |
3545 See the doc string for `interactive'. | |
3546 A null string means call interactively with no arguments. | |
3547 `arglist' are the comma-separated arguments (always Lisp_Objects) for | |
3548 the function. | |
3549 The docstring for the function is placed as a "C" comment between | |
3550 the prompt and the `args' argument. make-docfile reads the | |
3551 comment and creates the DOC file from it. | |
3552 */ | |
3553 | |
3554 #define EXFUN_0 void | |
3555 #define EXFUN_1 Lisp_Object | |
3556 #define EXFUN_2 Lisp_Object,Lisp_Object | |
3557 #define EXFUN_3 Lisp_Object,Lisp_Object,Lisp_Object | |
3558 #define EXFUN_4 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object | |
3559 #define EXFUN_5 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object | |
3560 #define EXFUN_6 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object, \ | |
3561 Lisp_Object | |
3562 #define EXFUN_7 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object, \ | |
3563 Lisp_Object,Lisp_Object | |
3564 #define EXFUN_8 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object, \ | |
3565 Lisp_Object,Lisp_Object,Lisp_Object | |
3566 #define EXFUN_MANY int, Lisp_Object* | |
3567 #define EXFUN_UNEVALLED Lisp_Object | |
3568 #define EXFUN(sym, max_args) Lisp_Object sym (EXFUN_##max_args) | |
2268 | 3569 #define EXFUN_NORETURN(sym, max_args) \ |
3570 DECLARE_DOESNT_RETURN_TYPE (Lisp_Object, sym (EXFUN_##max_args)) | |
428 | 3571 |
3572 #define SUBR_MAX_ARGS 8 | |
3573 #define MANY -2 | |
3574 #define UNEVALLED -1 | |
3575 | |
3576 /* Can't be const, because then subr->doc is read-only and | |
3577 Snarf_documentation chokes */ | |
3578 | |
3263 | 3579 #ifdef NEW_GC |
2720 | 3580 #define DEFUN(lname, Fname, min_args, max_args, prompt, arglist) \ |
3581 Lisp_Object Fname (EXFUN_##max_args); \ | |
3582 static struct Lisp_Subr MC_ALLOC_S##Fname = \ | |
3583 { \ | |
3584 { /* struct lrecord_header */ \ | |
3585 lrecord_type_subr, /* lrecord_type_index */ \ | |
3586 1, /* lisp_readonly bit */ \ | |
3587 0, /* free */ \ | |
3588 0 /* uid */ \ | |
3589 }, \ | |
3590 min_args, \ | |
3591 max_args, \ | |
3592 prompt, \ | |
3593 0, /* doc string */ \ | |
3594 lname, \ | |
3595 (lisp_fn_t) Fname \ | |
3596 }; \ | |
2814 | 3597 static struct Lisp_Subr *S##Fname; \ |
2720 | 3598 Lisp_Object Fname (DEFUN_##max_args arglist) |
3599 | |
3600 #define DEFUN_NORETURN(lname, Fname, min_args, max_args, prompt, arglist) \ | |
3601 DECLARE_DOESNT_RETURN_TYPE (Lisp_Object, Fname (EXFUN_##max_args)); \ | |
3602 static struct Lisp_Subr MC_ALLOC_S##Fname = \ | |
3603 { \ | |
3604 { /* struct lrecord_header */ \ | |
3605 lrecord_type_subr, /* lrecord_type_index */ \ | |
3606 1, /* lisp_readonly bit */ \ | |
3607 0, /* free */ \ | |
3608 0 /* uid */ \ | |
3609 }, \ | |
3610 min_args, \ | |
3611 max_args, \ | |
3612 prompt, \ | |
3613 0, /* doc string */ \ | |
3614 lname, \ | |
3615 (lisp_fn_t) Fname \ | |
3616 }; \ | |
2814 | 3617 static struct Lisp_Subr *S##Fname; \ |
2720 | 3618 DOESNT_RETURN_TYPE (Lisp_Object) Fname (DEFUN_##max_args arglist) |
2834 | 3619 #define GET_DEFUN_LISP_OBJECT(Fname) \ |
3620 wrap_subr (S##Fname); | |
3263 | 3621 #else /* not NEW_GC */ |
428 | 3622 #define DEFUN(lname, Fname, min_args, max_args, prompt, arglist) \ |
3623 Lisp_Object Fname (EXFUN_##max_args); \ | |
442 | 3624 static struct Lisp_Subr S##Fname = \ |
3625 { \ | |
3626 { /* struct lrecord_header */ \ | |
3627 lrecord_type_subr, /* lrecord_type_index */ \ | |
3628 1, /* mark bit */ \ | |
3629 1, /* c_readonly bit */ \ | |
1111 | 3630 1, /* lisp_readonly bit */ \ |
3631 0 /* unused */ \ | |
442 | 3632 }, \ |
3633 min_args, \ | |
3634 max_args, \ | |
3635 prompt, \ | |
3636 0, /* doc string */ \ | |
3637 lname, \ | |
3638 (lisp_fn_t) Fname \ | |
3639 }; \ | |
428 | 3640 Lisp_Object Fname (DEFUN_##max_args arglist) |
3641 | |
2268 | 3642 #define DEFUN_NORETURN(lname, Fname, min_args, max_args, prompt, arglist) \ |
3643 DECLARE_DOESNT_RETURN_TYPE (Lisp_Object, Fname (EXFUN_##max_args)); \ | |
3644 static struct Lisp_Subr S##Fname = \ | |
3645 { \ | |
3646 { /* struct lrecord_header */ \ | |
3647 lrecord_type_subr, /* lrecord_type_index */ \ | |
3648 1, /* mark bit */ \ | |
3649 1, /* c_readonly bit */ \ | |
3650 1, /* lisp_readonly bit */ \ | |
3651 0 /* unused */ \ | |
3652 }, \ | |
3653 min_args, \ | |
3654 max_args, \ | |
3655 prompt, \ | |
3656 0, /* doc string */ \ | |
3657 lname, \ | |
3658 (lisp_fn_t) Fname \ | |
3659 }; \ | |
3660 DOESNT_RETURN_TYPE (Lisp_Object) Fname (DEFUN_##max_args arglist) | |
2834 | 3661 #define GET_DEFUN_LISP_OBJECT(Fname) \ |
3662 wrap_subr (&S##Fname); | |
3263 | 3663 #endif /* not NEW_GC */ |
2268 | 3664 |
428 | 3665 /* Heavy ANSI C preprocessor hackery to get DEFUN to declare a |
3666 prototype that matches max_args, and add the obligatory | |
3667 `Lisp_Object' type declaration to the formal C arguments. */ | |
3668 | |
3669 #define DEFUN_MANY(named_int, named_Lisp_Object) named_int, named_Lisp_Object | |
3670 #define DEFUN_UNEVALLED(args) Lisp_Object args | |
3671 #define DEFUN_0() void | |
3672 #define DEFUN_1(a) Lisp_Object a | |
3673 #define DEFUN_2(a,b) DEFUN_1(a), Lisp_Object b | |
3674 #define DEFUN_3(a,b,c) DEFUN_2(a,b), Lisp_Object c | |
3675 #define DEFUN_4(a,b,c,d) DEFUN_3(a,b,c), Lisp_Object d | |
3676 #define DEFUN_5(a,b,c,d,e) DEFUN_4(a,b,c,d), Lisp_Object e | |
3677 #define DEFUN_6(a,b,c,d,e,f) DEFUN_5(a,b,c,d,e), Lisp_Object f | |
3678 #define DEFUN_7(a,b,c,d,e,f,g) DEFUN_6(a,b,c,d,e,f), Lisp_Object g | |
3679 #define DEFUN_8(a,b,c,d,e,f,g,h) DEFUN_7(a,b,c,d,e,f,g),Lisp_Object h | |
3680 | |
3681 /* WARNING: If you add defines here for higher values of max_args, | |
3682 make sure to also fix the clauses in PRIMITIVE_FUNCALL(), | |
3683 and change the define of SUBR_MAX_ARGS above. */ | |
3684 | |
3685 #include "symeval.h" | |
3686 | |
1743 | 3687 BEGIN_C_DECLS |
1650 | 3688 |
428 | 3689 /* `specpdl' is the special binding/unwind-protect stack. |
3690 | |
3691 Knuth says (see the Jargon File): | |
3692 At MIT, `pdl' [abbreviation for `Push Down List'] used to | |
3693 be a more common synonym for `stack'. | |
3694 Everywhere else `stack' seems to be the preferred term. | |
3695 | |
3696 specpdl_depth is the current depth of `specpdl'. | |
771 | 3697 Save this for use later as arg to `unbind_to_1'. */ |
1632 | 3698 extern MODULE_API int specpdl_depth_counter; |
428 | 3699 #define specpdl_depth() specpdl_depth_counter |
3700 | |
442 | 3701 |
3702 #define CHECK_FUNCTION(fun) do { \ | |
3703 while (NILP (Ffunctionp (fun))) \ | |
3704 signal_invalid_function_error (fun); \ | |
3705 } while (0) | |
3706 | |
428 | 3707 |
3708 /************************************************************************/ | |
3709 /* Checking for QUIT */ | |
3710 /************************************************************************/ | |
3711 | |
1123 | 3712 /* NOTE NOTE NOTE: Invoking QUIT can cause random Lisp code to be executed! |
3713 This can happen in numerous ways. For example, on many platforms, QUIT | |
3714 needs to drain the event queue to see whether there's a C-g in the works. | |
3715 A side effect of this is that, if there's a menu-press event, menu filters | |
3716 (i.e. Lisp code) will be invoked. Lisp code could also happen if there's | |
3717 an asynchronous timeout, or if the debugger is invoked as a result of | |
3718 debug-on-quit and the user returns by hitting `r', etc. etc. | |
3719 | |
3720 However, GC CANNOT HAPPEN. It is forbidden everywhere within the QUIT- | |
3721 processing code, because most callers cannot tolerate GC during QUIT | |
3722 since it's just too prevalent. */ | |
3723 | |
853 | 3724 /* The exact workings of this mechanism are described in detail in signal.c. */ |
3725 | |
428 | 3726 /* Asynchronous events set something_happened, and then are processed |
3727 within the QUIT macro. At this point, we are guaranteed to not be in | |
3728 any sensitive code. */ | |
3729 | |
1632 | 3730 extern MODULE_API volatile int something_happened; |
3731 extern MODULE_API int dont_check_for_quit; | |
3732 MODULE_API void check_what_happened (void); | |
3733 | |
3734 extern MODULE_API volatile int quit_check_signal_happened; | |
428 | 3735 extern volatile int quit_check_signal_tick_count; |
1632 | 3736 MODULE_API void check_quit (void); |
3737 | |
3738 MODULE_API void signal_quit (void); | |
428 | 3739 |
853 | 3740 int begin_dont_check_for_quit (void); |
3741 int begin_do_check_for_quit (void); | |
3742 | |
3743 /* Nonzero if the values of `quit-flag' and `inhibit-quit' indicate | |
3744 that a quit should be signalled. */ | |
771 | 3745 #define QUIT_FLAG_SAYS_SHOULD_QUIT \ |
3746 (!NILP (Vquit_flag) && \ | |
3747 (NILP (Vinhibit_quit) \ | |
3748 || (EQ (Vquit_flag, Qcritical) && !dont_check_for_quit))) | |
3749 | |
853 | 3750 /* Nonzero if ought to quit now. This is the "efficient" version, which |
3751 respects the flags set to indicate whether the full quit check should | |
3752 be done. Therefore it may be inaccurate (i.e. lagging reality), esp. | |
3753 when poll for quit is used. | |
3754 | |
3755 This is defined for code that wants to allow quitting, but needs to | |
3756 do some cleanup if that happens. (You could always register the cleanup | |
3757 code using record_unwind_protect(), but sometimes it makes more sense | |
3758 to do it using QUITP.) To use this macro, just call it at the | |
3759 appropriate time, and if its value is non-zero, do your cleanup code | |
3760 and then call QUIT. | |
3761 | |
3762 A different version (below) is used for the actual QUIT macro. */ | |
428 | 3763 #define QUITP \ |
853 | 3764 ((quit_check_signal_happened ? check_quit () : (void) 0), \ |
771 | 3765 QUIT_FLAG_SAYS_SHOULD_QUIT) |
428 | 3766 |
853 | 3767 /* This is the version actually called by QUIT. The difference |
3768 between it and QUITP is that it also has side effects in that it | |
3769 will handle anything else that has recently signalled itself | |
3770 asynchronously and wants to be handled now. Currently this | |
3771 includes executing asynchronous timeouts that may have been set | |
3772 from Lisp or from the poll-for-quit or poll-for-sigchld | |
3773 timers. (#### It seems that, to be slightly more accurate, we | |
3774 should also process poll-for-quit timers in the above version. | |
3775 However, this mechanism is inherently approximate, so it really | |
3776 doesn't matter much.) In the future, it might also include doing a | |
3777 thread context switch. Callers of QUITP generally don't except | |
1123 | 3778 random side effects to happen (#### unfortunately, random side effects |
3779 can happen anyway, e.g. through menu filters -- see comment above), | |
3780 so we have this different version. */ | |
428 | 3781 #define INTERNAL_QUITP \ |
853 | 3782 ((something_happened ? check_what_happened () : (void) 0), \ |
771 | 3783 QUIT_FLAG_SAYS_SHOULD_QUIT) |
428 | 3784 |
3785 /* Check quit-flag and quit if it is non-nil. Also do any other things | |
853 | 3786 that are triggered by asynchronous events and might want to be |
3787 handled. */ | |
428 | 3788 #define QUIT do { if (INTERNAL_QUITP) signal_quit (); } while (0) |
3789 | |
3790 | |
3791 /************************************************************************/ | |
3792 /* hashing */ | |
3793 /************************************************************************/ | |
3794 | |
3795 /* #### for a 64-bit machine, we should substitute a prime just over 2^32 */ | |
3796 #define GOOD_HASH 65599 /* prime number just over 2^16; Dragon book, p. 435 */ | |
3797 #define HASH2(a,b) (GOOD_HASH * (a) + (b)) | |
3798 #define HASH3(a,b,c) (GOOD_HASH * HASH2 (a,b) + (c)) | |
3799 #define HASH4(a,b,c,d) (GOOD_HASH * HASH3 (a,b,c) + (d)) | |
3800 #define HASH5(a,b,c,d,e) (GOOD_HASH * HASH4 (a,b,c,d) + (e)) | |
3801 #define HASH6(a,b,c,d,e,f) (GOOD_HASH * HASH5 (a,b,c,d,e) + (f)) | |
3802 #define HASH7(a,b,c,d,e,f,g) (GOOD_HASH * HASH6 (a,b,c,d,e,f) + (g)) | |
3803 #define HASH8(a,b,c,d,e,f,g,h) (GOOD_HASH * HASH7 (a,b,c,d,e,f,g) + (h)) | |
3804 #define HASH9(a,b,c,d,e,f,g,h,i) (GOOD_HASH * HASH8 (a,b,c,d,e,f,g,h) + (i)) | |
3805 | |
3806 #define LISP_HASH(obj) ((unsigned long) LISP_TO_VOID (obj)) | |
2516 | 3807 Hashcode memory_hash (const void *xv, Bytecount size); |
3808 Hashcode internal_hash (Lisp_Object obj, int depth); | |
3809 Hashcode internal_array_hash (Lisp_Object *arr, int size, int depth); | |
428 | 3810 |
3811 | |
3812 /************************************************************************/ | |
3813 /* String translation */ | |
3814 /************************************************************************/ | |
3815 | |
771 | 3816 /* When support for message translation exists, GETTEXT() translates a |
3817 string from English into the language defined by | |
3818 `current-language-environment'. This is done by looking the string | |
3819 up in a large predefined table; if no translation is found, the | |
3820 original string is returned, and the failure is possibly logged so | |
3821 that the translation can later be entered into the table. | |
3822 | |
3823 In addition to this, there is a mechanism to snarf message strings | |
3824 out of the source code so that they can be entered into the tables. | |
3825 This is what make-msgfile.lex does. | |
3826 | |
3827 Handling `format' strings is more difficult: The format string | |
3828 should get translated, but not under all circumstances. When the | |
3829 format string is a Lisp string, what should happen is that | |
3830 Fformat() should format the untranslated args[0] and return that, | |
3831 and also call Fgettext() on args[0] and, if that is different, | |
3832 format it and store it in the `string-translatable' property of the | |
3833 returned string. See Fgettext(). | |
3834 | |
3835 CGETTEXT() is the same as GETTEXT() but works with char * strings | |
867 | 3836 instead of Ibyte * strings. |
771 | 3837 |
3838 build_msg_string() is a shorthand for build_string (GETTEXT (x)). | |
3839 build_msg_intstring() is a shorthand for build_intstring (GETTEXT (x)). | |
3840 */ | |
3841 | |
3842 #define GETTEXT(x) (x) | |
3843 #define CGETTEXT(x) (x) | |
3844 #define LISP_GETTEXT(x) (x) | |
428 | 3845 |
3846 /* DEFER_GETTEXT is used to identify strings which are translated when | |
3847 they are referenced instead of when they are defined. | |
3848 These include Qerror_messages and initialized arrays of strings. | |
3849 */ | |
3850 #define DEFER_GETTEXT(x) (x) | |
3851 | |
3852 | |
3853 /************************************************************************/ | |
3854 /* Garbage collection / GC-protection */ | |
3855 /************************************************************************/ | |
3856 | |
3857 /* Structure for recording stack slots that need marking */ | |
3858 | |
3859 /* This is a chain of structures, each of which points at a Lisp_Object | |
3860 variable whose value should be marked in garbage collection. | |
3861 Normally every link of the chain is an automatic variable of a function, | |
3862 and its `val' points to some argument or local variable of the function. | |
3863 On exit to the function, the chain is set back to the value it had on | |
3864 entry. This way, no link remains in the chain when the stack frame | |
3865 containing the link disappears. | |
3866 | |
3867 Every function that can call Feval must protect in this fashion all | |
3868 Lisp_Object variables whose contents will be used again. */ | |
3869 | |
1632 | 3870 extern MODULE_API struct gcpro *gcprolist; |
428 | 3871 |
1743 | 3872 END_C_DECLS |
1650 | 3873 |
1204 | 3874 /* #### Catching insufficient gcpro: |
3875 | |
3876 The C++ code below catches GCPRO without UNGCPRO or vice-versa. | |
3877 Catching cases where there's no GCPRO or UNGCPRO but should be, however, | |
3878 is much harder, but could be done: | |
3879 | |
3880 1. Lisp_Object becomes a real object. Its creator and destructor need to | |
3881 figure out whether the object is on the stack (by looking at the range | |
3882 that `this' is within), and if so, add the pointer to a list of all | |
3883 stack-based Lisp_Objects. | |
3884 | |
3885 2. The assignment method needs to do reference-counting on actual Lisp | |
3886 objects -- in particular, we need to know if there are any references | |
3887 to a Lisp object that are *NOT* from stack-based Lisp_Objects. | |
3888 | |
3889 3. When we get to a point in the code where we might garbage collect -- | |
3890 i.e. Ffuncall(), Feval(), or Fgarbage_collect() is called -- we look | |
3891 at our list of stack-based Lisp_Objects, and if there are any that | |
3892 point to Lisp objects with no non-stack references, see if there are | |
3893 any gcpros pointing to the object, and if not, set a flag indicating | |
3894 that the object is "destroyed". (Don't abort yet because the function | |
3895 might not use the object any more.) | |
3896 | |
3897 4. When we detag a pointer using XFOO(), abort if its "destroyed" flag | |
3898 is set. | |
3899 | |
3900 --ben | |
3901 */ | |
3902 | |
428 | 3903 struct gcpro |
3904 { | |
3905 struct gcpro *next; | |
771 | 3906 const Lisp_Object *var; /* Address of first protected variable */ |
428 | 3907 int nvars; /* Number of consecutive protected variables */ |
1204 | 3908 #if defined (__cplusplus) && defined (ERROR_CHECK_GC) |
3909 /* Try to catch GCPRO without UNGCPRO, or vice-versa. G++ complains (at | |
3910 least with sufficient numbers of warnings enabled, i.e. -Weffc++) if a | |
3911 copy constructor or assignment operator is not defined. */ | |
3912 gcpro () : next (0), var (0), nvars (0) { } | |
3913 gcpro (const gcpro& g) : next (g.next), var (g.var), nvars (g.nvars) { } | |
3914 gcpro& operator= (const gcpro& g) { next = g.next; var = g.var; | |
3915 nvars = g.nvars; | |
3916 return *this;} | |
3917 ~gcpro () { assert (!next); } | |
3918 #endif /* defined (__cplusplus) && defined (ERROR_CHECK_GC) */ | |
428 | 3919 }; |
3920 | |
3921 /* Normally, you declare variables gcpro1, gcpro2, ... and use the | |
3922 GCPROn() macros. However, if you need to have nested gcpro's, | |
3923 declare ngcpro1, ngcpro2, ... and use NGCPROn(). If you need | |
3924 to nest another level, use nngcpro1, nngcpro2, ... and use | |
3925 NNGCPROn(). If you need to nest yet another level, create | |
3926 the appropriate macros. */ | |
3927 | |
1123 | 3928 /* NOTE: About comments like "This function does not GC": These are there to |
3929 try to track whether GCPROing is necessary. Strictly speaking, some | |
3930 functions that say this might actually GC, but only when it is never | |
3931 possible to return (more specifically, in the process of signalling an | |
3932 error, the debugger may be invoked, and could GC). For GCPRO purposes, | |
3933 you only have to worry about functions that can GC and then return. | |
3934 The QUIT macro cannot GC any more, although this wasn't true at some point, | |
3935 and so some "This function can GC" comments may be inaccurate. | |
3936 */ | |
3937 | |
1743 | 3938 BEGIN_C_DECLS |
1650 | 3939 |
2367 | 3940 #define XGCDECL1(x) struct gcpro x##cpro1 |
3941 #define XGCDECL2(x) struct gcpro x##cpro1, x##cpro2 | |
3942 #define XGCDECL3(x) struct gcpro x##cpro1, x##cpro2, x##cpro3 | |
3943 #define XGCDECL4(x) struct gcpro x##cpro1, x##cpro2, x##cpro3, x##cpro4 | |
3944 #define XGCDECL5(x) struct gcpro x##cpro1, x##cpro2, x##cpro3, x##cpro4, x##cpro5 | |
3945 | |
428 | 3946 #ifdef DEBUG_GCPRO |
3947 | |
2367 | 3948 MODULE_API void debug_gcpro1 (Ascbyte *, int, struct gcpro *, Lisp_Object *); |
3949 MODULE_API void debug_gcpro2 (Ascbyte *, int, struct gcpro *, struct gcpro *, | |
1632 | 3950 Lisp_Object *, Lisp_Object *); |
2367 | 3951 MODULE_API void debug_gcpro3 (Ascbyte *, int, struct gcpro *, struct gcpro *, |
1632 | 3952 struct gcpro *, Lisp_Object *, Lisp_Object *, |
3953 Lisp_Object *); | |
2367 | 3954 MODULE_API void debug_gcpro4 (Ascbyte *, int, struct gcpro *, struct gcpro *, |
1632 | 3955 struct gcpro *, struct gcpro *, Lisp_Object *, |
3956 Lisp_Object *, Lisp_Object *, Lisp_Object *); | |
2367 | 3957 MODULE_API void debug_gcpro5 (Ascbyte *, int, struct gcpro *, struct gcpro *, |
1632 | 3958 struct gcpro *, struct gcpro *, struct gcpro *, |
3959 Lisp_Object *, Lisp_Object *, Lisp_Object *, | |
3960 Lisp_Object *, Lisp_Object *); | |
2367 | 3961 MODULE_API void debug_ungcpro(Ascbyte *, int, struct gcpro *); |
3962 | |
3963 #define XGCPRO1(x,v) \ | |
3964 debug_gcpro1 (__FILE__, __LINE__,&x##cpro1,&v) | |
3965 #define XGCPRO2(x,v1,v2) \ | |
3966 debug_gcpro2 (__FILE__, __LINE__,&x##cpro1,&x##cpro2,&v1,&v2) | |
3967 #define XGCPRO3(x,v1,v2,v3) \ | |
3968 debug_gcpro3 (__FILE__, __LINE__,&x##cpro1,&x##cpro2,&x##cpro3, \ | |
3969 &v1,&v2,&v3) | |
3970 #define XGCPRO4(x,v1,v2,v3,v4) \ | |
3971 debug_gcpro4 (__FILE__, __LINE__,&x##cpro1,&x##cpro2,&x##cpro3, \ | |
3972 &x##cpro4, \ | |
428 | 3973 &v1,&v2,&v3,&v4) |
2367 | 3974 #define XGCPRO5(x,v1,v2,v3,v4,v5) \ |
3975 debug_gcpro5 (__FILE__, __LINE__,&x##cpro1,&x##cpro2,&x##cpro3, \ | |
3976 &x##cpro4,&x##cpro5, \ | |
428 | 3977 &v1,&v2,&v3,&v4,&v5) |
2367 | 3978 #define XUNGCPRO(x) \ |
3979 debug_ungcpro(__FILE__, __LINE__,&x##cpro1) | |
428 | 3980 |
3981 #else /* ! DEBUG_GCPRO */ | |
3982 | |
2367 | 3983 #define XGCPRO1(x, var1) ((void) ( \ |
3984 x##cpro1.next = gcprolist, x##cpro1.var = &var1, x##cpro1.nvars = 1, \ | |
3985 gcprolist = &x##cpro1 )) | |
3986 | |
3987 #define XGCPRO2(x, var1, var2) ((void) ( \ | |
3988 x##cpro1.next = gcprolist, x##cpro1.var = &var1, x##cpro1.nvars = 1, \ | |
3989 x##cpro2.next = &x##cpro1, x##cpro2.var = &var2, x##cpro2.nvars = 1, \ | |
3990 gcprolist = &x##cpro2 )) | |
3991 | |
3992 #define XGCPRO3(x, var1, var2, var3) ((void) ( \ | |
3993 x##cpro1.next = gcprolist, x##cpro1.var = &var1, x##cpro1.nvars = 1, \ | |
3994 x##cpro2.next = &x##cpro1, x##cpro2.var = &var2, x##cpro2.nvars = 1, \ | |
3995 x##cpro3.next = &x##cpro2, x##cpro3.var = &var3, x##cpro3.nvars = 1, \ | |
3996 gcprolist = &x##cpro3 )) | |
3997 | |
3998 #define XGCPRO4(x, var1, var2, var3, var4) ((void) ( \ | |
3999 x##cpro1.next = gcprolist, x##cpro1.var = &var1, x##cpro1.nvars = 1, \ | |
4000 x##cpro2.next = &x##cpro1, x##cpro2.var = &var2, x##cpro2.nvars = 1, \ | |
4001 x##cpro3.next = &x##cpro2, x##cpro3.var = &var3, x##cpro3.nvars = 1, \ | |
4002 x##cpro4.next = &x##cpro3, x##cpro4.var = &var4, x##cpro4.nvars = 1, \ | |
4003 gcprolist = &x##cpro4 )) | |
4004 | |
4005 #define XGCPRO5(x, var1, var2, var3, var4, var5) ((void) ( \ | |
4006 x##cpro1.next = gcprolist, x##cpro1.var = &var1, x##cpro1.nvars = 1, \ | |
4007 x##cpro2.next = &x##cpro1, x##cpro2.var = &var2, x##cpro2.nvars = 1, \ | |
4008 x##cpro3.next = &x##cpro2, x##cpro3.var = &var3, x##cpro3.nvars = 1, \ | |
4009 x##cpro4.next = &x##cpro3, x##cpro4.var = &var4, x##cpro4.nvars = 1, \ | |
4010 x##cpro5.next = &x##cpro4, x##cpro5.var = &var5, x##cpro5.nvars = 1, \ | |
4011 gcprolist = &x##cpro5 )) | |
4012 | |
4013 #define XGCPRO1_ARRAY(x, array, n) ((void) ( \ | |
4014 x##cpro1.next = gcprolist, x##cpro1.var = array, x##cpro1.nvars = n, \ | |
4015 gcprolist = &x##cpro1 )) | |
4016 | |
4017 #define XGCPRO2_ARRAY(x, array1, n1, array2, n2) ((void) ( \ | |
4018 x##cpro1.next = gcprolist, x##cpro1.var = array1, x##cpro1.nvars = n1, \ | |
4019 x##cpro2.next = &x##cpro1, x##cpro2.var = array2, x##cpro2.nvars = n2, \ | |
4020 gcprolist = &x##cpro2 )) | |
4021 | |
4022 #define XGCPRO3_ARRAY(x, array1, n1, array2, n2, array3, n3) ((void) ( \ | |
4023 x##cpro1.next = gcprolist, x##cpro1.var = array1, x##cpro1.nvars = n1, \ | |
4024 x##cpro2.next = &x##cpro1, x##cpro2.var = array2, x##cpro2.nvars = n2, \ | |
4025 x##cpro3.next = &x##cpro2, x##cpro3.var = array3, x##cpro3.nvars = n3, \ | |
4026 gcprolist = &x##cpro3 )) | |
853 | 4027 |
1204 | 4028 #if defined (__cplusplus) && defined (ERROR_CHECK_GC) |
4029 /* We need to reset each gcpro to avoid triggering the assert() in | |
4030 ~gcpro(). This happens in UNGCPRO and longjmp(). */ | |
4031 #define UNWIND_GCPRO_TO(val) \ | |
4032 do \ | |
4033 { \ | |
4034 struct gcpro *__gcpro_stop = (val); \ | |
4035 /* Try to catch UNGCPRO without GCPRO. We arrange for there to be a \ | |
4036 sentinel at the end of the gcprolist, so it should never be NULL. */ \ | |
4037 assert (__gcpro_stop); \ | |
4038 while (gcprolist != __gcpro_stop) \ | |
4039 { \ | |
4040 struct gcpro *__gcpro_next = gcprolist->next; \ | |
4041 gcprolist->next = 0; \ | |
4042 gcprolist = __gcpro_next; \ | |
4043 assert (gcprolist); \ | |
4044 } \ | |
4045 } while (0) | |
4046 #else | |
4047 #define UNWIND_GCPRO_TO(val) (gcprolist = (val)) | |
4048 #endif /* defined (__cplusplus) && defined (ERROR_CHECK_GC) */ | |
4049 | |
2367 | 4050 #define XUNGCPRO(x) UNWIND_GCPRO_TO (x##cpro1.next) |
428 | 4051 |
4052 #endif /* ! DEBUG_GCPRO */ | |
4053 | |
2367 | 4054 #define GCDECL1 XGCDECL1 (g) |
4055 #define GCDECL2 XGCDECL2 (g) | |
4056 #define GCDECL3 XGCDECL3 (g) | |
4057 #define GCDECL4 XGCDECL4 (g) | |
4058 #define GCDECL5 XGCDECL5 (g) | |
4059 | |
4060 #define GCPRO1(a) XGCPRO1 (g,a) | |
4061 #define GCPRO2(a,b) XGCPRO2 (g,a,b) | |
4062 #define GCPRO3(a,b,c) XGCPRO3 (g,a,b,c) | |
4063 #define GCPRO4(a,b,c,d) XGCPRO4 (g,a,b,c,d) | |
4064 #define GCPRO5(a,b,c,d,e) XGCPRO5 (g,a,b,c,d,e) | |
4065 | |
4066 #define GCPRO1_ARRAY(a1,n1) XGCPRO1_ARRAY(g,a1,n1) | |
4067 #define GCPRO2_ARRAY(a1,n1,a2,n2) XGCPRO2_ARRAY (g,a1,n1,a2,n2) | |
4068 #define GCPRO3_ARRAY(a1,n1,a2,n2,a3,n3) XGCPRO3_ARRAY (g,a1,n1,a2,n2,a3,n3) | |
4069 | |
4070 #define UNGCPRO XUNGCPRO (g) | |
4071 | |
4072 #define NGCDECL1 XGCDECL1 (ng) | |
4073 #define NGCDECL2 XGCDECL2 (ng) | |
4074 #define NGCDECL3 XGCDECL3 (ng) | |
4075 #define NGCDECL4 XGCDECL4 (ng) | |
4076 #define NGCDECL5 XGCDECL5 (ng) | |
4077 | |
4078 #define NGCPRO1(a) XGCPRO1 (ng,a) | |
4079 #define NGCPRO2(a,b) XGCPRO2 (ng,a,b) | |
4080 #define NGCPRO3(a,b,c) XGCPRO3 (ng,a,b,c) | |
4081 #define NGCPRO4(a,b,c,d) XGCPRO4 (ng,a,b,c,d) | |
4082 #define NGCPRO5(a,b,c,d,e) XGCPRO5 (ng,a,b,c,d,e) | |
4083 | |
4084 #define NGCPRO1_ARRAY(a1,n1) XGCPRO1_ARRAY(ng,a1,n1) | |
4085 #define NGCPRO2_ARRAY(a1,n1,a2,n2) XGCPRO2_ARRAY (ng,a1,n1,a2,n2) | |
4086 #define NGCPRO3_ARRAY(a1,n1,a2,n2,a3,n3) XGCPRO3_ARRAY (ng,a1,n1,a2,n2,a3,n3) | |
4087 | |
4088 #define NUNGCPRO XUNGCPRO (ng) | |
4089 | |
4090 #define NNGCDECL1 XGCDECL1 (nng) | |
4091 #define NNGCDECL2 XGCDECL2 (nng) | |
4092 #define NNGCDECL3 XGCDECL3 (nng) | |
4093 #define NNGCDECL4 XGCDECL4 (nng) | |
4094 #define NNGCDECL5 XGCDECL5 (nng) | |
4095 | |
4096 #define NNGCPRO1(a) XGCPRO1 (nng,a) | |
4097 #define NNGCPRO2(a,b) XGCPRO2 (nng,a,b) | |
4098 #define NNGCPRO3(a,b,c) XGCPRO3 (nng,a,b,c) | |
4099 #define NNGCPRO4(a,b,c,d) XGCPRO4 (nng,a,b,c,d) | |
4100 #define NNGCPRO5(a,b,c,d,e) XGCPRO5 (nng,a,b,c,d,e) | |
4101 | |
4102 #define NNGCPRO1_ARRAY(a1,n1) XGCPRO1_ARRAY(nng,a1,n1) | |
4103 #define NNGCPRO2_ARRAY(a1,n1,a2,n2) XGCPRO2_ARRAY (nng,a1,n1,a2,n2) | |
4104 #define NNGCPRO3_ARRAY(a1,n1,a2,n2,a3,n3) XGCPRO3_ARRAY (nng,a1,n1,a2,n2,a3,n3) | |
4105 | |
4106 #define NNUNGCPRO XUNGCPRO (nng) | |
4107 | |
428 | 4108 /* Evaluate expr, UNGCPRO, and then return the value of expr. */ |
4109 #define RETURN_UNGCPRO(expr) do \ | |
4110 { \ | |
4111 Lisp_Object ret_ungc_val = (expr); \ | |
4112 UNGCPRO; \ | |
4113 RETURN_SANS_WARNINGS ret_ungc_val; \ | |
4114 } while (0) | |
4115 | |
4116 /* Evaluate expr, NUNGCPRO, UNGCPRO, and then return the value of expr. */ | |
4117 #define RETURN_NUNGCPRO(expr) do \ | |
4118 { \ | |
4119 Lisp_Object ret_ungc_val = (expr); \ | |
4120 NUNGCPRO; \ | |
4121 UNGCPRO; \ | |
4122 RETURN_SANS_WARNINGS ret_ungc_val; \ | |
4123 } while (0) | |
4124 | |
4125 /* Evaluate expr, NNUNGCPRO, NUNGCPRO, UNGCPRO, and then return the | |
4126 value of expr. */ | |
4127 #define RETURN_NNUNGCPRO(expr) do \ | |
4128 { \ | |
4129 Lisp_Object ret_ungc_val = (expr); \ | |
4130 NNUNGCPRO; \ | |
4131 NUNGCPRO; \ | |
4132 UNGCPRO; \ | |
4133 RETURN_SANS_WARNINGS ret_ungc_val; \ | |
4134 } while (0) | |
4135 | |
452 | 4136 extern Lisp_Object_ptr_dynarr *staticpros; |
3092 | 4137 extern Lisp_Object_ptr_dynarr *staticpros_nodump; |
771 | 4138 #ifdef DEBUG_XEMACS |
4139 | |
4140 /* Help debug crashes gc-marking a staticpro'ed object. */ | |
4141 | |
2367 | 4142 MODULE_API void staticpro_1 (Lisp_Object *, Ascbyte *); |
4143 MODULE_API void staticpro_nodump_1 (Lisp_Object *, Ascbyte *); | |
4511
71bf2c5667ba
Fix g++ const char -> char warnings.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
3659
diff
changeset
|
4144 /* g++ 4.3 complains about the conversion of const char to char. |
71bf2c5667ba
Fix g++ const char -> char warnings.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
3659
diff
changeset
|
4145 These end up in a dynarray, so we would need to define a whole new class |
71bf2c5667ba
Fix g++ const char -> char warnings.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
3659
diff
changeset
|
4146 of dynarray just to handle the const char stuff. |
71bf2c5667ba
Fix g++ const char -> char warnings.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
3659
diff
changeset
|
4147 ####Check to see how hard this might be. */ |
71bf2c5667ba
Fix g++ const char -> char warnings.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
3659
diff
changeset
|
4148 #define staticpro(ptr) staticpro_1 (ptr, (Ascbyte *) #ptr) |
71bf2c5667ba
Fix g++ const char -> char warnings.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
3659
diff
changeset
|
4149 #define staticpro_nodump(ptr) staticpro_nodump_1 (ptr, (Ascbyte *) #ptr) |
771 | 4150 |
996 | 4151 #ifdef HAVE_SHLIB |
2367 | 4152 MODULE_API void unstaticpro_nodump_1 (Lisp_Object *, Ascbyte *); |
4511
71bf2c5667ba
Fix g++ const char -> char warnings.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
3659
diff
changeset
|
4153 #define unstaticpro_nodump(ptr) unstaticpro_nodump_1 (ptr, (Ascbyte *) #ptr) |
996 | 4154 #endif |
4155 | |
771 | 4156 #else |
611 | 4157 |
428 | 4158 /* Call staticpro (&var) to protect static variable `var'. */ |
1632 | 4159 MODULE_API void staticpro (Lisp_Object *); |
428 | 4160 |
4161 /* Call staticpro_nodump (&var) to protect static variable `var'. */ | |
4162 /* var will not be saved at dump time */ | |
1632 | 4163 MODULE_API void staticpro_nodump (Lisp_Object *); |
428 | 4164 |
996 | 4165 #ifdef HAVE_SHLIB |
4166 /* Call unstaticpro_nodump (&var) to stop protecting static variable `var'. */ | |
1632 | 4167 MODULE_API void unstaticpro_nodump (Lisp_Object *); |
996 | 4168 #endif |
4169 | |
771 | 4170 #endif |
4171 | |
3263 | 4172 #ifdef NEW_GC |
2720 | 4173 extern Lisp_Object_dynarr *mcpros; |
4174 #ifdef DEBUG_XEMACS | |
4175 /* Help debug crashes gc-marking a mcpro'ed object. */ | |
4176 MODULE_API void mcpro_1 (Lisp_Object, char *); | |
4177 #define mcpro(ptr) mcpro_1 (ptr, #ptr) | |
4178 #else /* not DEBUG_XEMACS */ | |
4179 /* Call mcpro (&var) to protect mc variable `var'. */ | |
4180 MODULE_API void mcpro (Lisp_Object); | |
4181 #endif /* not DEBUG_XEMACS */ | |
3263 | 4182 #endif /* NEW_GC */ |
2720 | 4183 |
771 | 4184 void register_post_gc_action (void (*fun) (void *), void *arg); |
4185 int begin_gc_forbidden (void); | |
4186 void end_gc_forbidden (int count); | |
1957 | 4187 extern int gc_currently_forbidden; |
771 | 4188 |
1743 | 4189 END_C_DECLS |
1650 | 4190 |
771 | 4191 |
4192 /************************************************************************/ | |
4193 /* Misc definitions */ | |
4194 /************************************************************************/ | |
442 | 4195 |
4196 /************************************************************************/ | |
1983 | 4197 /* Other numeric types */ |
4198 /************************************************************************/ | |
4199 #include "number.h" | |
4200 | |
4201 | |
4202 /************************************************************************/ | |
442 | 4203 /* prototypes */ |
4204 /************************************************************************/ | |
4205 | |
4206 /* NOTE: Prototypes should go HERE, not in various header files, unless | |
4207 they specifically reference a type that's not defined in lisp.h. | |
4208 (And even then, you might consider adding the type to lisp.h.) | |
4209 | |
4210 The idea is that header files typically contain the innards of objects, | |
4211 and we want to minimize the number of "dependencies" of one file on | |
4212 the specifics of such objects. Putting prototypes here minimizes the | |
4213 number of header files that need to be included -- good for a number | |
4214 of reasons. --ben */ | |
4215 | |
4216 /*--------------- prototypes for various public c functions ------------*/ | |
4217 | |
4218 /* Prototypes for all init/syms_of/vars_of initialization functions. */ | |
4219 #include "symsinit.h" | |
4220 | |
1743 | 4221 BEGIN_C_DECLS |
1650 | 4222 |
826 | 4223 /* Defined in abbrev.c */ |
1632 | 4224 MODULE_API EXFUN (Fexpand_abbrev, 0); |
826 | 4225 |
428 | 4226 /* Defined in alloc.c */ |
1632 | 4227 MODULE_API EXFUN (Fcons, 2); |
4228 MODULE_API EXFUN (Flist, MANY); | |
826 | 4229 EXFUN (Fmake_byte_code, MANY); |
1632 | 4230 MODULE_API EXFUN (Fmake_list, 2); |
4231 MODULE_API EXFUN (Fmake_string, 2); | |
4232 MODULE_API EXFUN (Fmake_symbol, 1); | |
4233 MODULE_API EXFUN (Fmake_vector, 2); | |
4234 MODULE_API EXFUN (Fvector, MANY); | |
826 | 4235 |
3263 | 4236 #ifndef NEW_GC |
428 | 4237 void release_breathing_space (void); |
3263 | 4238 #endif /* not NEW_GC */ |
428 | 4239 Lisp_Object noseeum_cons (Lisp_Object, Lisp_Object); |
1632 | 4240 MODULE_API Lisp_Object make_vector (Elemcount, Lisp_Object); |
4241 MODULE_API Lisp_Object vector1 (Lisp_Object); | |
4242 MODULE_API Lisp_Object vector2 (Lisp_Object, Lisp_Object); | |
4243 MODULE_API Lisp_Object vector3 (Lisp_Object, Lisp_Object, Lisp_Object); | |
665 | 4244 Lisp_Object make_bit_vector (Elemcount, Lisp_Object); |
4245 Lisp_Object make_bit_vector_from_byte_vector (unsigned char *, Elemcount); | |
428 | 4246 Lisp_Object noseeum_make_marker (void); |
3092 | 4247 #ifndef NEW_GC |
428 | 4248 void garbage_collect_1 (void); |
3092 | 4249 #endif /* not NEW_GC */ |
1632 | 4250 MODULE_API Lisp_Object acons (Lisp_Object, Lisp_Object, Lisp_Object); |
4251 MODULE_API Lisp_Object cons3 (Lisp_Object, Lisp_Object, Lisp_Object); | |
4252 MODULE_API Lisp_Object list1 (Lisp_Object); | |
4253 MODULE_API Lisp_Object list2 (Lisp_Object, Lisp_Object); | |
4254 MODULE_API Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object); | |
4255 MODULE_API Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object, | |
4256 Lisp_Object); | |
4257 MODULE_API Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, | |
4258 Lisp_Object); | |
4259 MODULE_API Lisp_Object list6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, | |
4260 Lisp_Object, Lisp_Object); | |
428 | 4261 DECLARE_DOESNT_RETURN (memory_full (void)); |
4262 void disksave_object_finalization (void); | |
4263 extern int purify_flag; | |
3092 | 4264 #ifndef NEW_GC |
428 | 4265 extern EMACS_INT gc_generation_number[1]; |
3092 | 4266 #endif /* not NEW_GC */ |
428 | 4267 int c_readonly (Lisp_Object); |
4268 int lisp_readonly (Lisp_Object); | |
1632 | 4269 MODULE_API void copy_lisp_object (Lisp_Object dst, Lisp_Object src); |
4270 MODULE_API Lisp_Object build_intstring (const Ibyte *); | |
4271 MODULE_API Lisp_Object build_string (const CIbyte *); | |
4272 MODULE_API Lisp_Object build_ext_string (const Extbyte *, Lisp_Object); | |
4273 MODULE_API Lisp_Object build_msg_intstring (const Ibyte *); | |
4274 MODULE_API Lisp_Object build_msg_string (const CIbyte *); | |
4275 MODULE_API Lisp_Object make_string (const Ibyte *, Bytecount); | |
4276 MODULE_API Lisp_Object make_ext_string (const Extbyte *, EMACS_INT, Lisp_Object); | |
771 | 4277 void init_string_ascii_begin (Lisp_Object string); |
428 | 4278 Lisp_Object make_uninit_string (Bytecount); |
1632 | 4279 MODULE_API Lisp_Object make_float (double); |
867 | 4280 Lisp_Object make_string_nocopy (const Ibyte *, Bytecount); |
853 | 4281 void free_cons (Lisp_Object); |
428 | 4282 void free_list (Lisp_Object); |
4283 void free_alist (Lisp_Object); | |
1204 | 4284 void free_marker (Lisp_Object); |
428 | 4285 int object_dead_p (Lisp_Object); |
4286 void mark_object (Lisp_Object obj); | |
3092 | 4287 #ifndef NEW_GC |
1598 | 4288 #ifdef USE_KKCC |
2645 | 4289 #ifdef DEBUG_XEMACS |
4290 void kkcc_gc_stack_push_lisp_object_1 (Lisp_Object obj, int level, int pos); | |
4291 #define kkcc_gc_stack_push_lisp_object(obj, level, pos) \ | |
4292 kkcc_gc_stack_push_lisp_object_1 (obj, level, pos) | |
4293 void kkcc_backtrace (void); | |
4294 #else | |
4295 void kkcc_gc_stack_push_lisp_object_1 (Lisp_Object obj); | |
4296 #define kkcc_gc_stack_push_lisp_object(obj, level, pos) \ | |
4297 kkcc_gc_stack_push_lisp_object_1 (obj) | |
4298 #define kkcc_backtrace() | |
4299 #endif | |
1598 | 4300 #endif /* USE_KKCC */ |
3092 | 4301 #endif /* not NEW_GC */ |
428 | 4302 int marked_p (Lisp_Object obj); |
851 | 4303 extern int funcall_allocation_flag; |
814 | 4304 extern int need_to_garbage_collect; |
1632 | 4305 extern MODULE_API int need_to_check_c_alloca; |
888 | 4306 extern int need_to_signal_post_gc; |
1333 | 4307 extern Lisp_Object Qpost_gc_hook, Qgarbage_collecting; |
851 | 4308 void recompute_funcall_allocation_flag (void); |
428 | 4309 |
4310 #ifdef MEMORY_USAGE_STATS | |
665 | 4311 Bytecount malloced_storage_size (void *, Bytecount, struct overhead_stats *); |
4312 Bytecount fixed_type_block_overhead (Bytecount); | |
428 | 4313 #endif |
1204 | 4314 |
4315 #ifdef EVENT_DATA_AS_OBJECTS | |
4316 Lisp_Object make_key_data (void); | |
4317 Lisp_Object make_button_data (void); | |
4318 Lisp_Object make_motion_data (void); | |
4319 Lisp_Object make_process_data (void); | |
4320 Lisp_Object make_timeout_data (void); | |
4321 Lisp_Object make_magic_data (void); | |
4322 Lisp_Object make_magic_eval_data (void); | |
4323 Lisp_Object make_eval_data (void); | |
4324 Lisp_Object make_misc_user_data (void); | |
4325 void free_key_data (Lisp_Object); | |
4326 void free_button_data (Lisp_Object); | |
4327 void free_motion_data (Lisp_Object); | |
4328 void free_process_data (Lisp_Object); | |
4329 void free_timeout_data (Lisp_Object); | |
4330 void free_magic_data (Lisp_Object); | |
4331 void free_magic_eval_data (Lisp_Object); | |
4332 void free_eval_data (Lisp_Object); | |
4333 void free_misc_user_data (Lisp_Object); | |
4334 #endif /* EVENT_DATA_AS_OBJECTS */ | |
934 | 4335 |
428 | 4336 /* Defined in buffer.c */ |
4337 Lisp_Object get_truename_buffer (Lisp_Object); | |
4338 void switch_to_buffer (Lisp_Object, Lisp_Object); | |
4339 extern int find_file_compare_truenames; | |
4340 extern int find_file_use_truenames; | |
867 | 4341 Ibyte *get_initial_directory (Ibyte *pathname, Bytecount size); |
771 | 4342 void set_buffer_internal (struct buffer *b); |
4343 struct buffer *decode_buffer (Lisp_Object buffer, int allow_string); | |
4344 | |
4345 void record_buffer (Lisp_Object buf); | |
4346 Lisp_Object get_buffer (Lisp_Object name, | |
4347 int error_if_deleted_or_does_not_exist); | |
4348 int map_over_sharing_buffers (struct buffer *buf, | |
4349 int (*mapfun) (struct buffer *buf, | |
4350 void *closure), | |
4351 void *closure); | |
1204 | 4352 void cleanup_buffer_undo_lists (void); |
771 | 4353 |
4354 extern struct buffer *current_buffer; | |
4355 | |
4356 extern void init_initial_directory (void); /* initialize initial_directory */ | |
4357 | |
4358 EXFUN (Fbuffer_disable_undo, 1); | |
1632 | 4359 MODULE_API EXFUN (Fbuffer_modified_p, 1); |
4360 MODULE_API EXFUN (Fbuffer_name, 1); | |
4361 MODULE_API EXFUN (Fcurrent_buffer, 0); | |
771 | 4362 EXFUN (Ferase_buffer, 1); |
4363 EXFUN (Fget_buffer, 1); | |
4364 EXFUN (Fget_buffer_create, 1); | |
4365 EXFUN (Fget_file_buffer, 1); | |
1632 | 4366 MODULE_API EXFUN (Fkill_buffer, 1); |
771 | 4367 EXFUN (Fother_buffer, 3); |
4368 EXFUN (Frecord_buffer, 1); | |
1632 | 4369 MODULE_API EXFUN (Fset_buffer, 1); |
771 | 4370 EXFUN (Fset_buffer_modified_p, 2); |
4371 | |
4372 extern Lisp_Object QSscratch, Qafter_change_function, Qafter_change_functions; | |
4373 extern Lisp_Object Qbefore_change_function, Qbefore_change_functions; | |
4374 extern Lisp_Object Qbuffer_or_string_p, Qdefault_directory, Qfirst_change_hook; | |
4375 extern Lisp_Object Qpermanent_local, Vafter_change_function; | |
4376 extern Lisp_Object Vafter_change_functions, Vbefore_change_function; | |
4377 extern Lisp_Object Vbefore_change_functions, Vbuffer_alist, Vbuffer_defaults; | |
4378 extern Lisp_Object Vinhibit_read_only, Vtransient_mark_mode; | |
428 | 4379 |
563 | 4380 /* Defined in bytecode.c */ |
826 | 4381 EXFUN (Fbyte_code, 3); |
4382 | |
593 | 4383 DECLARE_DOESNT_RETURN (invalid_byte_code |
867 | 4384 (const CIbyte *reason, Lisp_Object frob)); |
563 | 4385 |
826 | 4386 /* Defined in callint.c */ |
4387 EXFUN (Fcall_interactively, 3); | |
4388 EXFUN (Fprefix_numeric_value, 1); | |
4389 | |
4390 /* Defined in casefiddle.c */ | |
4391 EXFUN (Fdowncase, 2); | |
4910
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4906
diff
changeset
|
4392 EXFUN (Fcanoncase, 2); |
826 | 4393 EXFUN (Fupcase, 2); |
4394 EXFUN (Fupcase_initials, 2); | |
4395 EXFUN (Fupcase_initials_region, 3); | |
4396 EXFUN (Fupcase_region, 3); | |
4397 | |
4398 /* Defined in casetab.c */ | |
4399 EXFUN (Fset_standard_case_table, 1); | |
4400 | |
4401 /* Defined in chartab.c */ | |
4402 EXFUN (Freset_char_table, 1); | |
4403 | |
4404 /* Defined in cmds.c */ | |
4405 EXFUN (Fbeginning_of_line, 2); | |
4406 EXFUN (Fend_of_line, 2); | |
4407 EXFUN (Fforward_char, 2); | |
4408 EXFUN (Fforward_line, 2); | |
4409 | |
428 | 4410 /* Defined in data.c */ |
826 | 4411 EXFUN (Fadd1, 1); |
4412 EXFUN (Faref, 2); | |
4413 EXFUN (Faset, 3); | |
4414 EXFUN (Fcar, 1); | |
4415 EXFUN (Fcar_safe, 1); | |
4416 EXFUN (Fcdr, 1); | |
919 | 4417 EXFUN (Fcdr_safe, 1); |
826 | 4418 EXFUN (Fgeq, MANY); |
4419 EXFUN (Fgtr, MANY); | |
4420 EXFUN (Findirect_function, 1); | |
4421 EXFUN (Fleq, MANY); | |
4422 EXFUN (Flistp, 1); | |
4423 EXFUN (Flss, MANY); | |
4424 EXFUN (Fmax, MANY); | |
4425 EXFUN (Fmin, MANY); | |
4426 EXFUN (Fminus, MANY); | |
4427 EXFUN (Fnumber_to_string, 1); | |
4428 EXFUN (Fplus, MANY); | |
4429 EXFUN (Fquo, MANY); | |
4430 EXFUN (Frem, 2); | |
4431 EXFUN (Fsetcar, 2); | |
4432 EXFUN (Fsetcdr, 2); | |
4433 EXFUN (Fsub1, 1); | |
4434 EXFUN (Fsubr_max_args, 1); | |
4435 EXFUN (Fsubr_min_args, 1); | |
4436 EXFUN (Ftimes, MANY); | |
4437 | |
428 | 4438 DECLARE_DOESNT_RETURN (c_write_error (Lisp_Object)); |
4439 DECLARE_DOESNT_RETURN (lisp_write_error (Lisp_Object)); | |
4440 DECLARE_DOESNT_RETURN (args_out_of_range (Lisp_Object, Lisp_Object)); | |
4441 DECLARE_DOESNT_RETURN (args_out_of_range_3 (Lisp_Object, Lisp_Object, | |
4442 Lisp_Object)); | |
1632 | 4443 MODULE_API Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object); |
4444 MODULE_API | |
428 | 4445 DECLARE_DOESNT_RETURN (dead_wrong_type_argument (Lisp_Object, Lisp_Object)); |
4446 void check_int_range (EMACS_INT, EMACS_INT, EMACS_INT); | |
4447 | |
771 | 4448 EXFUN (Fint_to_char, 1); |
4449 EXFUN (Fchar_to_int, 1); | |
4450 | |
428 | 4451 enum arith_comparison { |
4452 arith_equal, | |
4453 arith_notequal, | |
4454 arith_less, | |
4455 arith_grtr, | |
4456 arith_less_or_equal, | |
4457 arith_grtr_or_equal }; | |
4458 Lisp_Object arithcompare (Lisp_Object, Lisp_Object, enum arith_comparison); | |
4459 | |
707 | 4460 /* Do NOT use word_to_lisp or wasteful_word_to_lisp to decode time_t's |
4461 unless you KNOW arg is non-negative. They cannot return negative | |
4462 values! Use make_time. */ | |
428 | 4463 Lisp_Object word_to_lisp (unsigned int); |
4464 unsigned int lisp_to_word (Lisp_Object); | |
4465 | |
4466 /* Defined in dired.c */ | |
867 | 4467 Lisp_Object make_directory_hash_table (const Ibyte *); |
428 | 4468 Lisp_Object wasteful_word_to_lisp (unsigned int); |
4469 | |
4470 /* Defined in doc.c */ | |
826 | 4471 EXFUN (Fsubstitute_command_keys, 1); |
4472 | |
814 | 4473 Lisp_Object unparesseuxify_doc_string (int fd, EMACS_INT position, |
867 | 4474 Ibyte *name_nonreloc, |
814 | 4475 Lisp_Object name_reloc, |
4476 int standard_doc_file); | |
428 | 4477 Lisp_Object read_doc_string (Lisp_Object); |
4478 | |
4479 /* Defined in doprnt.c */ | |
867 | 4480 Bytecount emacs_doprnt_va (Lisp_Object stream, const Ibyte *format_nonreloc, |
771 | 4481 Bytecount format_length, Lisp_Object format_reloc, |
4482 va_list vargs); | |
867 | 4483 Bytecount emacs_doprnt (Lisp_Object stream, const Ibyte *format_nonreloc, |
771 | 4484 Bytecount format_length, Lisp_Object format_reloc, |
4485 int nargs, const Lisp_Object *largs, ...); | |
867 | 4486 Lisp_Object emacs_vsprintf_string_lisp (const CIbyte *format_nonreloc, |
771 | 4487 Lisp_Object format_reloc, int nargs, |
4488 const Lisp_Object *largs); | |
867 | 4489 Lisp_Object emacs_sprintf_string_lisp (const CIbyte *format_nonreloc, |
771 | 4490 Lisp_Object format_reloc, int nargs, ...); |
867 | 4491 Ibyte *emacs_vsprintf_malloc_lisp (const CIbyte *format_nonreloc, |
771 | 4492 Lisp_Object format_reloc, int nargs, |
4493 const Lisp_Object *largs, | |
4494 Bytecount *len_out); | |
867 | 4495 Ibyte *emacs_sprintf_malloc_lisp (Bytecount *len_out, |
4496 const CIbyte *format_nonreloc, | |
771 | 4497 Lisp_Object format_reloc, int nargs, ...); |
867 | 4498 Lisp_Object emacs_vsprintf_string (const CIbyte *format, va_list vargs); |
4499 Lisp_Object emacs_sprintf_string (const CIbyte *format, ...) | |
771 | 4500 PRINTF_ARGS (1, 2); |
867 | 4501 Ibyte *emacs_vsprintf_malloc (const CIbyte *format, va_list vargs, |
771 | 4502 Bytecount *len_out); |
867 | 4503 Ibyte *emacs_sprintf_malloc (Bytecount *len_out, const CIbyte *format, ...) |
771 | 4504 PRINTF_ARGS (2, 3); |
867 | 4505 Bytecount emacs_vsprintf (Ibyte *output, const CIbyte *format, |
771 | 4506 va_list vargs); |
867 | 4507 Bytecount emacs_sprintf (Ibyte *output, const CIbyte *format, ...) |
771 | 4508 PRINTF_ARGS (2, 3); |
4509 | |
428 | 4510 |
4511 /* Defined in editfns.c */ | |
826 | 4512 EXFUN (Fbobp, 1); |
4513 EXFUN (Fbolp, 1); | |
4514 EXFUN (Fbuffer_substring, 3); | |
4515 EXFUN (Fchar_after, 2); | |
4516 EXFUN (Fchar_to_string, 1); | |
4517 EXFUN (Fdelete_region, 3); | |
4518 EXFUN (Feobp, 1); | |
4519 EXFUN (Feolp, 1); | |
4520 EXFUN (Ffollowing_char, 1); | |
4521 EXFUN (Fformat, MANY); | |
4522 EXFUN (Fgoto_char, 2); | |
4523 EXFUN (Finsert, MANY); | |
4524 EXFUN (Finsert_buffer_substring, 3); | |
4525 EXFUN (Finsert_char, 4); | |
4526 EXFUN (Fnarrow_to_region, 3); | |
4527 EXFUN (Fpoint, 1); | |
4528 EXFUN (Fpoint_marker, 2); | |
4529 EXFUN (Fpoint_max, 1); | |
4530 EXFUN (Fpoint_min, 1); | |
4531 EXFUN (Fpreceding_char, 1); | |
4532 EXFUN (Fsystem_name, 0); | |
4533 EXFUN (Fuser_home_directory, 0); | |
4534 EXFUN (Fuser_login_name, 1); | |
4535 EXFUN (Fwiden, 1); | |
4536 | |
428 | 4537 void uncache_home_directory (void); |
867 | 4538 Ibyte *get_home_directory (void); |
4539 Ibyte *user_login_name (uid_t *); | |
428 | 4540 void buffer_insert1 (struct buffer *, Lisp_Object); |
665 | 4541 Lisp_Object make_string_from_buffer (struct buffer *, Charbpos, Charcount); |
4542 Lisp_Object make_string_from_buffer_no_extents (struct buffer *, Charbpos, Charcount); | |
707 | 4543 Lisp_Object make_time (time_t); |
428 | 4544 Lisp_Object save_excursion_save (void); |
844 | 4545 Lisp_Object save_restriction_save (struct buffer *buf); |
428 | 4546 Lisp_Object save_excursion_restore (Lisp_Object); |
4547 Lisp_Object save_restriction_restore (Lisp_Object); | |
771 | 4548 void widen_buffer (struct buffer *b, int no_clip); |
4549 int beginning_of_line_p (struct buffer *b, Charbpos pt); | |
428 | 4550 |
4551 /* Defined in emacsfns.c */ | |
4552 Lisp_Object save_current_buffer_restore (Lisp_Object); | |
4553 | |
4554 /* Defined in emacs.c */ | |
2268 | 4555 EXFUN_NORETURN (Fkill_emacs, 1); |
826 | 4556 EXFUN (Frunning_temacs_p, 0); |
1123 | 4557 EXFUN (Fforce_debugging_signal, 1); |
826 | 4558 |
428 | 4559 SIGTYPE fatal_error_signal (int); |
2367 | 4560 Lisp_Object make_arg_list (int, Wexttext **); |
4561 void make_argc_argv (Lisp_Object, int *, Wexttext ***); | |
4562 void free_argc_argv (Wexttext **); | |
771 | 4563 Lisp_Object split_external_path (const Extbyte *path); |
867 | 4564 Lisp_Object split_env_path (const CIbyte *evarname, const Ibyte *default_); |
771 | 4565 |
428 | 4566 /* Nonzero means don't do interactive redisplay and don't change tty modes */ |
442 | 4567 extern int noninteractive, noninteractive1; |
2367 | 4568 extern int inhibit_non_essential_conversion_operations; |
428 | 4569 extern int preparing_for_armageddon; |
458 | 4570 extern Fixnum emacs_priority; |
428 | 4571 extern int suppress_early_error_handler_backtrace; |
771 | 4572 void debug_break (void); |
4854 | 4573 int debug_can_access_memory (const void *ptr, Bytecount len); |
2210 | 4574 DECLARE_DOESNT_RETURN (really_abort (void)); |
776 | 4575 void zero_out_command_line_status_vars (void); |
428 | 4576 |
826 | 4577 /* Defined in emodules.c */ |
996 | 4578 #ifdef HAVE_SHLIB |
826 | 4579 EXFUN (Flist_modules, 0); |
4580 EXFUN (Fload_module, 3); | |
996 | 4581 extern int unloading_module; |
4582 #endif | |
826 | 4583 |
428 | 4584 /* Defined in eval.c */ |
1706 | 4585 MODULE_API EXFUN (Fapply, MANY); |
826 | 4586 EXFUN (Fbacktrace, 2); |
4587 EXFUN (Fcommand_execute, 3); | |
4588 EXFUN (Fcommandp, 1); | |
4744
17f7e9191c0b
Rationalise duplicated functionality, #'custom-quote, #'quote-maybe.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4690
diff
changeset
|
4589 EXFUN (Fquote_maybe, 1); |
1706 | 4590 MODULE_API EXFUN (Feval, 1); |
4591 MODULE_API EXFUN (Ffuncall, MANY); | |
826 | 4592 EXFUN (Ffunctionp, 1); |
4593 EXFUN (Finteractive_p, 0); | |
4594 EXFUN (Fprogn, UNEVALLED); | |
1706 | 4595 MODULE_API EXFUN (Fsignal, 2); |
4677
8f1ee2d15784
Support full Common Lisp multiple values in C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4512
diff
changeset
|
4596 MODULE_API EXFUN_NORETURN (Fthrow, UNEVALLED); |
1706 | 4597 MODULE_API EXFUN (Fcall_with_condition_handler, MANY); |
853 | 4598 EXFUN (Ffunction_max_args, 1); |
4599 EXFUN (Ffunction_min_args, 1); | |
826 | 4600 |
4677
8f1ee2d15784
Support full Common Lisp multiple values in C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4512
diff
changeset
|
4601 MODULE_API DECLARE_DOESNT_RETURN (throw_or_bomb_out (Lisp_Object, |
8f1ee2d15784
Support full Common Lisp multiple values in C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4512
diff
changeset
|
4602 Lisp_Object, int, |
8f1ee2d15784
Support full Common Lisp multiple values in C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4512
diff
changeset
|
4603 Lisp_Object, Lisp_Object)); |
8f1ee2d15784
Support full Common Lisp multiple values in C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4512
diff
changeset
|
4604 |
1632 | 4605 MODULE_API DECLARE_DOESNT_RETURN (signal_error_1 (Lisp_Object, Lisp_Object)); |
563 | 4606 void maybe_signal_error_1 (Lisp_Object, Lisp_Object, Lisp_Object, |
578 | 4607 Error_Behavior); |
563 | 4608 Lisp_Object maybe_signal_continuable_error_1 (Lisp_Object, Lisp_Object, |
578 | 4609 Lisp_Object, Error_Behavior); |
1743 | 4610 MODULE_API DECLARE_DOESNT_RETURN (signal_ferror (Lisp_Object, const CIbyte *, |
4611 ...)) PRINTF_ARGS(2, 3); | |
578 | 4612 void maybe_signal_ferror (Lisp_Object, Lisp_Object, Error_Behavior, |
867 | 4613 const CIbyte *, ...) PRINTF_ARGS (4, 5); |
4614 Lisp_Object signal_continuable_ferror (Lisp_Object, const CIbyte *, ...) | |
442 | 4615 PRINTF_ARGS (2, 3); |
563 | 4616 Lisp_Object maybe_signal_continuable_ferror (Lisp_Object, Lisp_Object, |
578 | 4617 Error_Behavior, |
867 | 4618 const CIbyte *, ...) |
442 | 4619 PRINTF_ARGS (4, 5); |
563 | 4620 |
867 | 4621 Lisp_Object build_error_data (const CIbyte *reason, Lisp_Object frob); |
4622 DECLARE_DOESNT_RETURN (signal_error (Lisp_Object, const CIbyte *, | |
563 | 4623 Lisp_Object)); |
867 | 4624 void maybe_signal_error (Lisp_Object, const CIbyte *, Lisp_Object, |
578 | 4625 Lisp_Object, Error_Behavior); |
867 | 4626 Lisp_Object signal_continuable_error (Lisp_Object, const CIbyte *, |
563 | 4627 Lisp_Object); |
867 | 4628 Lisp_Object maybe_signal_continuable_error (Lisp_Object, const CIbyte *, |
563 | 4629 Lisp_Object, |
578 | 4630 Lisp_Object, Error_Behavior); |
1743 | 4631 DECLARE_DOESNT_RETURN (signal_ferror_with_frob (Lisp_Object, Lisp_Object, |
4632 const CIbyte *, ...)) | |
4633 PRINTF_ARGS(3, 4); | |
563 | 4634 void maybe_signal_ferror_with_frob (Lisp_Object, Lisp_Object, Lisp_Object, |
578 | 4635 Error_Behavior, |
867 | 4636 const CIbyte *, ...) PRINTF_ARGS (5, 6); |
563 | 4637 Lisp_Object signal_continuable_ferror_with_frob (Lisp_Object, Lisp_Object, |
867 | 4638 const CIbyte *, |
563 | 4639 ...) PRINTF_ARGS (3, 4); |
4640 Lisp_Object maybe_signal_continuable_ferror_with_frob (Lisp_Object, | |
4641 Lisp_Object, | |
4642 Lisp_Object, | |
578 | 4643 Error_Behavior, |
867 | 4644 const CIbyte *, ...) |
442 | 4645 PRINTF_ARGS (5, 6); |
867 | 4646 DECLARE_DOESNT_RETURN (signal_error_2 (Lisp_Object, const CIbyte *, |
563 | 4647 Lisp_Object, Lisp_Object)); |
867 | 4648 void maybe_signal_error_2 (Lisp_Object, const CIbyte *, Lisp_Object, |
578 | 4649 Lisp_Object, Lisp_Object, Error_Behavior); |
867 | 4650 Lisp_Object signal_continuable_error_2 (Lisp_Object, const CIbyte *, |
563 | 4651 Lisp_Object, Lisp_Object); |
867 | 4652 Lisp_Object maybe_signal_continuable_error_2 (Lisp_Object, const CIbyte *, |
563 | 4653 Lisp_Object, Lisp_Object, |
4654 Lisp_Object, | |
578 | 4655 Error_Behavior); |
563 | 4656 |
4657 | |
1927 | 4658 MODULE_API DECLARE_DOESNT_RETURN (signal_malformed_list_error (Lisp_Object)); |
4659 MODULE_API DECLARE_DOESNT_RETURN (signal_malformed_property_list_error | |
4660 (Lisp_Object)); | |
4661 MODULE_API DECLARE_DOESNT_RETURN (signal_circular_list_error (Lisp_Object)); | |
4662 MODULE_API DECLARE_DOESNT_RETURN (signal_circular_property_list_error | |
4663 (Lisp_Object)); | |
436 | 4664 |
867 | 4665 DECLARE_DOESNT_RETURN (syntax_error (const CIbyte *reason, |
609 | 4666 Lisp_Object frob)); |
867 | 4667 DECLARE_DOESNT_RETURN (syntax_error_2 (const CIbyte *reason, |
609 | 4668 Lisp_Object frob1, |
442 | 4669 Lisp_Object frob2)); |
867 | 4670 void maybe_syntax_error (const CIbyte *, Lisp_Object, Lisp_Object, |
578 | 4671 Error_Behavior); |
867 | 4672 DECLARE_DOESNT_RETURN (sferror (const CIbyte *reason, Lisp_Object frob)); |
4673 DECLARE_DOESNT_RETURN (sferror_2 (const CIbyte *reason, Lisp_Object frob1, | |
563 | 4674 Lisp_Object frob2)); |
867 | 4675 void maybe_sferror (const CIbyte *, Lisp_Object, Lisp_Object, |
578 | 4676 Error_Behavior); |
1632 | 4677 MODULE_API DECLARE_DOESNT_RETURN (invalid_argument (const CIbyte *reason, |
4678 Lisp_Object frob)); | |
4679 MODULE_API DECLARE_DOESNT_RETURN (invalid_argument_2 (const CIbyte *reason, | |
4680 Lisp_Object frob1, | |
4681 Lisp_Object frob2)); | |
867 | 4682 void maybe_invalid_argument (const CIbyte *, Lisp_Object, Lisp_Object, |
578 | 4683 Error_Behavior); |
1632 | 4684 MODULE_API DECLARE_DOESNT_RETURN (invalid_operation (const CIbyte *reason, |
4685 Lisp_Object frob)); | |
4686 MODULE_API DECLARE_DOESNT_RETURN (invalid_operation_2 (const CIbyte *reason, | |
4687 Lisp_Object frob1, | |
4688 Lisp_Object frob2)); | |
4689 MODULE_API void maybe_invalid_operation (const CIbyte *, Lisp_Object, | |
4690 Lisp_Object, Error_Behavior); | |
867 | 4691 DECLARE_DOESNT_RETURN (invalid_state (const CIbyte *reason, |
563 | 4692 Lisp_Object frob)); |
867 | 4693 DECLARE_DOESNT_RETURN (invalid_state_2 (const CIbyte *reason, |
563 | 4694 Lisp_Object frob1, |
4695 Lisp_Object frob2)); | |
867 | 4696 void maybe_invalid_state (const CIbyte *, Lisp_Object, Lisp_Object, |
609 | 4697 Error_Behavior); |
867 | 4698 DECLARE_DOESNT_RETURN (invalid_change (const CIbyte *reason, |
563 | 4699 Lisp_Object frob)); |
867 | 4700 DECLARE_DOESNT_RETURN (invalid_change_2 (const CIbyte *reason, |
563 | 4701 Lisp_Object frob1, |
4702 Lisp_Object frob2)); | |
867 | 4703 void maybe_invalid_change (const CIbyte *, Lisp_Object, Lisp_Object, |
609 | 4704 Error_Behavior); |
1632 | 4705 MODULE_API DECLARE_DOESNT_RETURN (invalid_constant (const CIbyte *reason, |
4706 Lisp_Object frob)); | |
867 | 4707 DECLARE_DOESNT_RETURN (invalid_constant_2 (const CIbyte *reason, |
563 | 4708 Lisp_Object frob1, |
4709 Lisp_Object frob2)); | |
867 | 4710 void maybe_invalid_constant (const CIbyte *, Lisp_Object, Lisp_Object, |
578 | 4711 Error_Behavior); |
867 | 4712 DECLARE_DOESNT_RETURN (wtaerror (const CIbyte *reason, Lisp_Object frob)); |
1632 | 4713 MODULE_API DECLARE_DOESNT_RETURN (out_of_memory (const CIbyte *reason, |
4714 Lisp_Object frob)); | |
867 | 4715 DECLARE_DOESNT_RETURN (stack_overflow (const CIbyte *reason, |
442 | 4716 Lisp_Object frob)); |
4717 | |
436 | 4718 Lisp_Object signal_void_function_error (Lisp_Object); |
4719 Lisp_Object signal_invalid_function_error (Lisp_Object); | |
4720 Lisp_Object signal_wrong_number_of_arguments_error (Lisp_Object, int); | |
4721 | |
428 | 4722 Lisp_Object run_hook_with_args_in_buffer (struct buffer *, int, Lisp_Object *, |
4723 enum run_hooks_condition); | |
4724 Lisp_Object run_hook_with_args (int, Lisp_Object *, enum run_hooks_condition); | |
4725 void va_run_hook_with_args (Lisp_Object, int, ...); | |
4726 void va_run_hook_with_args_in_buffer (struct buffer *, Lisp_Object, int, ...); | |
4727 Lisp_Object run_hook (Lisp_Object); | |
1706 | 4728 MODULE_API Lisp_Object apply1 (Lisp_Object, Lisp_Object); |
4729 MODULE_API Lisp_Object call0 (Lisp_Object); | |
4730 MODULE_API Lisp_Object call1 (Lisp_Object, Lisp_Object); | |
4731 MODULE_API Lisp_Object call2 (Lisp_Object, Lisp_Object, Lisp_Object); | |
4732 MODULE_API Lisp_Object call3 (Lisp_Object, Lisp_Object, Lisp_Object, | |
4733 Lisp_Object); | |
4734 MODULE_API Lisp_Object call4 (Lisp_Object, Lisp_Object, Lisp_Object, | |
4735 Lisp_Object, Lisp_Object); | |
4736 MODULE_API Lisp_Object call5 (Lisp_Object, Lisp_Object, Lisp_Object, | |
4737 Lisp_Object, Lisp_Object, Lisp_Object); | |
4738 MODULE_API Lisp_Object call6 (Lisp_Object, Lisp_Object, Lisp_Object, | |
4739 Lisp_Object, Lisp_Object, Lisp_Object, | |
4740 Lisp_Object); | |
4741 MODULE_API Lisp_Object call7 (Lisp_Object, Lisp_Object, Lisp_Object, | |
4742 Lisp_Object, Lisp_Object, Lisp_Object, | |
4743 Lisp_Object, Lisp_Object); | |
4744 MODULE_API Lisp_Object call8 (Lisp_Object, Lisp_Object, Lisp_Object, | |
4745 Lisp_Object, Lisp_Object, Lisp_Object, | |
4746 Lisp_Object, Lisp_Object, Lisp_Object); | |
428 | 4747 Lisp_Object call0_in_buffer (struct buffer *, Lisp_Object); |
4748 Lisp_Object call1_in_buffer (struct buffer *, Lisp_Object, Lisp_Object); | |
4749 Lisp_Object call2_in_buffer (struct buffer *, Lisp_Object, Lisp_Object, | |
4750 Lisp_Object); | |
4751 Lisp_Object call3_in_buffer (struct buffer *, Lisp_Object, Lisp_Object, | |
4752 Lisp_Object, Lisp_Object); | |
4753 Lisp_Object call4_in_buffer (struct buffer *, Lisp_Object, Lisp_Object, | |
4754 Lisp_Object, Lisp_Object, Lisp_Object); | |
4755 Lisp_Object call5_in_buffer (struct buffer *, Lisp_Object, Lisp_Object, | |
4756 Lisp_Object, Lisp_Object, Lisp_Object, | |
4757 Lisp_Object); | |
4758 Lisp_Object call6_in_buffer (struct buffer *, Lisp_Object, Lisp_Object, | |
4759 Lisp_Object, Lisp_Object, Lisp_Object, | |
4760 Lisp_Object, Lisp_Object); | |
4761 Lisp_Object eval_in_buffer (struct buffer *, Lisp_Object); | |
853 | 4762 |
4763 struct call_trapping_problems_result | |
4764 { | |
4765 int caught_error, caught_throw; | |
4766 Lisp_Object error_conditions, data; | |
4767 Lisp_Object backtrace; | |
4768 Lisp_Object thrown_tag; | |
4769 Lisp_Object thrown_value; | |
4770 }; | |
4771 | |
4772 #define NO_INHIBIT_ERRORS (1<<0) | |
4773 #define NO_INHIBIT_THROWS (1<<1) | |
4774 #define INTERNAL_INHIBIT_ERRORS (1<<0) | |
4775 #define INTERNAL_INHIBIT_THROWS (1<<1) | |
4776 #define INHIBIT_WARNING_ISSUE (1<<2) | |
4777 #define ISSUE_WARNINGS_AT_DEBUG_LEVEL (1<<3) | |
4778 #define INHIBIT_QUIT (1<<4) | |
4779 #define UNINHIBIT_QUIT (1<<5) | |
4780 #define INHIBIT_GC (1<<6) | |
4781 #define INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION (1<<7) | |
4782 #define INHIBIT_EXISTING_CODING_SYSTEM_DELETION (1<<8) | |
4783 #define INHIBIT_EXISTING_CHARSET_DELETION (1<<9) | |
4784 #define INHIBIT_PERMANENT_DISPLAY_OBJECT_CREATION (1<<10) | |
4785 #define INHIBIT_CODING_SYSTEM_CREATION (1<<11) | |
4786 #define INHIBIT_CHARSET_CREATION (1<<12) | |
4787 #define INHIBIT_EXISTING_BUFFER_TEXT_MODIFICATION (1<<13) | |
4788 #define INHIBIT_ANY_CHANGE_AFFECTING_REDISPLAY (1<<14) | |
4789 #define INHIBIT_ENTERING_DEBUGGER (1<<15) | |
4790 #define CALL_WITH_SUSPENDED_ERRORS (1<<16) | |
1333 | 4791 #define POSTPONE_WARNING_ISSUE (1<<17) |
853 | 4792 |
4793 enum check_allowed_operation | |
4794 { | |
4795 OPERATION_DELETE_OBJECT, | |
4796 OPERATION_CREATE_OBJECT, | |
4797 OPERATION_MODIFY_BUFFER_TEXT, | |
1429 | 4798 OPERATION_MODIFY_OBJECT_PROPERTY |
853 | 4799 }; |
4800 | |
4801 int get_inhibit_flags (void); | |
4802 void check_allowed_operation (int what, Lisp_Object obj, Lisp_Object prop); | |
4803 void note_object_created (Lisp_Object obj); | |
4804 void note_object_deleted (Lisp_Object obj); | |
4805 Lisp_Object call_with_condition_handler (Lisp_Object (*handler) (Lisp_Object, | |
4806 Lisp_Object, | |
4807 Lisp_Object), | |
4808 Lisp_Object handler_arg, | |
4809 Lisp_Object (*fun) (Lisp_Object), | |
4810 Lisp_Object arg); | |
1318 | 4811 int set_trapping_problems_flags (int flags); |
853 | 4812 Lisp_Object call_trapping_problems (Lisp_Object warning_class, |
2367 | 4813 const Ascbyte *warning_string, |
853 | 4814 int flags, |
4815 struct call_trapping_problems_result | |
4816 *problem, | |
4817 Lisp_Object (*fun) (void *), | |
4818 void *arg); | |
4819 Lisp_Object va_call_trapping_problems (Lisp_Object warning_class, | |
2367 | 4820 const Ascbyte *warning_string, |
853 | 4821 int flags, |
4822 struct call_trapping_problems_result | |
4823 *problem, | |
4824 lisp_fn_t fun, int nargs, ...); | |
2367 | 4825 Lisp_Object call0_trapping_problems (const Ascbyte *, Lisp_Object, int); |
4826 Lisp_Object call1_trapping_problems (const Ascbyte *, Lisp_Object, Lisp_Object, | |
853 | 4827 int); |
2367 | 4828 Lisp_Object call2_trapping_problems (const Ascbyte *, Lisp_Object, Lisp_Object, |
853 | 4829 Lisp_Object, int); |
2367 | 4830 Lisp_Object call3_trapping_problems (const Ascbyte *, Lisp_Object, Lisp_Object, |
853 | 4831 Lisp_Object, Lisp_Object, int); |
2367 | 4832 Lisp_Object call4_trapping_problems (const Ascbyte *, Lisp_Object, Lisp_Object, |
853 | 4833 Lisp_Object, Lisp_Object, Lisp_Object, |
4834 int); | |
2367 | 4835 Lisp_Object call5_trapping_problems (const Ascbyte *, Lisp_Object, Lisp_Object, |
853 | 4836 Lisp_Object, Lisp_Object, Lisp_Object, |
4837 Lisp_Object, int); | |
2367 | 4838 Lisp_Object eval_in_buffer_trapping_problems (const Ascbyte *, struct buffer *, |
853 | 4839 Lisp_Object, int); |
1333 | 4840 Lisp_Object run_hook_trapping_problems (Lisp_Object, Lisp_Object, int); |
4841 Lisp_Object safe_run_hook_trapping_problems (Lisp_Object, Lisp_Object, int); | |
4842 Lisp_Object run_hook_with_args_in_buffer_trapping_problems (Lisp_Object, | |
4843 struct buffer *, | |
4844 int nargs, | |
853 | 4845 Lisp_Object *args, |
4846 enum | |
4847 run_hooks_condition | |
4848 cond, int flags); | |
1333 | 4849 Lisp_Object run_hook_with_args_trapping_problems (Lisp_Object, |
853 | 4850 int nargs, |
4851 Lisp_Object *args, | |
4852 enum run_hooks_condition | |
4853 cond, | |
4854 int flags); | |
1333 | 4855 Lisp_Object va_run_hook_with_args_trapping_problems (Lisp_Object, |
853 | 4856 Lisp_Object hook_var, |
4857 int nargs, ...); | |
1333 | 4858 Lisp_Object va_run_hook_with_args_in_buffer_trapping_problems (Lisp_Object, |
4859 struct buffer *, | |
4860 Lisp_Object, | |
853 | 4861 int nargs, ...); |
4862 Lisp_Object call_with_suspended_errors (lisp_fn_t, Lisp_Object, | |
4863 Lisp_Object, | |
578 | 4864 Error_Behavior, int, ...); |
428 | 4865 /* C Code should be using internal_catch, record_unwind_p, condition_case_1 */ |
1318 | 4866 int proper_redisplay_wrapping_in_place (void); |
428 | 4867 Lisp_Object internal_catch (Lisp_Object, Lisp_Object (*) (Lisp_Object), |
853 | 4868 Lisp_Object, int * volatile, |
2532 | 4869 Lisp_Object * volatile, |
853 | 4870 Lisp_Object * volatile); |
428 | 4871 Lisp_Object condition_case_1 (Lisp_Object, |
4872 Lisp_Object (*) (Lisp_Object), | |
4873 Lisp_Object, | |
4874 Lisp_Object (*) (Lisp_Object, Lisp_Object), | |
4875 Lisp_Object); | |
4876 Lisp_Object condition_case_3 (Lisp_Object, Lisp_Object, Lisp_Object); | |
1632 | 4877 MODULE_API Lisp_Object unbind_to_1 (int, Lisp_Object); |
771 | 4878 #define unbind_to(obj) unbind_to_1 (obj, Qnil) |
428 | 4879 void specbind (Lisp_Object, Lisp_Object); |
1632 | 4880 MODULE_API int record_unwind_protect (Lisp_Object (*) (Lisp_Object), |
4881 Lisp_Object); | |
771 | 4882 int record_unwind_protect_freeing_dynarr (void *ptr); |
1333 | 4883 int record_unwind_protect_restoring_int (int *addr, int val); |
802 | 4884 int internal_bind_int (int *addr, int newval); |
4885 int internal_bind_lisp_object (Lisp_Object *addr, Lisp_Object newval); | |
970 | 4886 void do_autoload (Lisp_Object, Lisp_Object); /* GCPROs both arguments */ |
428 | 4887 Lisp_Object un_autoload (Lisp_Object); |
4888 void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object); | |
1632 | 4889 MODULE_API void warn_when_safe (Lisp_Object, Lisp_Object, const CIbyte *, |
4890 ...) PRINTF_ARGS (3, 4); | |
1292 | 4891 extern int backtrace_with_internal_sections; |
428 | 4892 |
4841
3465c3161fea
when `debug', abort when lisp error during loadup
Ben Wing <ben@xemacs.org>
parents:
4805
diff
changeset
|
4893 extern Lisp_Object Vdebug_on_error; |
1315 | 4894 extern Lisp_Object Vstack_trace_on_error; |
428 | 4895 |
4896 /* Defined in event-stream.c */ | |
826 | 4897 EXFUN (Faccept_process_output, 3); |
4898 EXFUN (Fadd_timeout, 4); | |
4899 EXFUN (Fdisable_timeout, 1); | |
4900 EXFUN (Fdiscard_input, 0); | |
4901 EXFUN (Fdispatch_event, 1); | |
4902 EXFUN (Fenqueue_eval_event, 2); | |
4903 EXFUN (Fnext_event, 2); | |
4904 EXFUN (Fread_key_sequence, 3); | |
4905 EXFUN (Fsit_for, 2); | |
4906 EXFUN (Fsleep_for, 1); | |
4907 | |
428 | 4908 void wait_delaying_user_input (int (*) (void *), void *); |
1268 | 4909 int detect_input_pending (int how_many); |
428 | 4910 void reset_this_command_keys (Lisp_Object, int); |
4911 Lisp_Object enqueue_misc_user_event (Lisp_Object, Lisp_Object, Lisp_Object); | |
4912 Lisp_Object enqueue_misc_user_event_pos (Lisp_Object, Lisp_Object, | |
4913 Lisp_Object, int, int, int, int); | |
442 | 4914 extern int modifier_keys_are_sticky; |
428 | 4915 |
4916 /* Defined in event-Xt.c */ | |
4917 void signal_special_Xt_user_event (Lisp_Object, Lisp_Object, Lisp_Object); | |
4918 | |
4919 | |
4920 /* Defined in events.c */ | |
826 | 4921 EXFUN (Fcopy_event, 2); |
2862 | 4922 EXFUN (Fevent_to_character, 4); |
826 | 4923 |
428 | 4924 void clear_event_resource (void); |
4925 Lisp_Object allocate_event (void); | |
4926 | |
771 | 4927 EXFUN (Fevent_x_pixel, 1); |
4928 EXFUN (Fevent_y_pixel, 1); | |
4929 | |
4930 | |
4931 /* Defined in file-coding.c */ | |
4932 EXFUN (Fcoding_category_list, 0); | |
4933 EXFUN (Fcoding_category_system, 1); | |
4934 EXFUN (Fcoding_priority_list, 0); | |
4935 EXFUN (Fcoding_system_description, 1); | |
4936 EXFUN (Fcoding_system_documentation, 1); | |
4937 EXFUN (Fcoding_system_list, 1); | |
4938 EXFUN (Fcoding_system_name, 1); | |
4939 EXFUN (Fcoding_system_p, 1); | |
4940 EXFUN (Fcoding_system_property, 2); | |
4941 EXFUN (Fcoding_system_type, 1); | |
4942 EXFUN (Fcopy_coding_system, 2); | |
4943 EXFUN (Fdecode_big5_char, 1); | |
4944 EXFUN (Fdecode_coding_region, 4); | |
4945 EXFUN (Fdecode_shift_jis_char, 1); | |
4946 EXFUN (Fdefine_coding_system_alias, 2); | |
4947 EXFUN (Fdetect_coding_region, 3); | |
4948 EXFUN (Fdefault_encoding_detection_enabled_p, 0); | |
4949 EXFUN (Fencode_big5_char, 1); | |
4950 EXFUN (Fencode_coding_region, 4); | |
4951 EXFUN (Fencode_shift_jis_char, 1); | |
4952 EXFUN (Ffind_coding_system, 1); | |
4953 EXFUN (Fget_coding_system, 1); | |
4690
257b468bf2ca
Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4682
diff
changeset
|
4954 EXFUN (Fmake_coding_system_internal, 4); |
771 | 4955 EXFUN (Fset_coding_category_system, 2); |
4956 EXFUN (Fset_coding_priority_list, 1); | |
4957 EXFUN (Fsubsidiary_coding_system, 2); | |
4958 | |
4959 extern Lisp_Object Qshift_jis, Qiso2022, Qbig5, Qccl; | |
4960 extern Lisp_Object Qcharset_g0; | |
4961 extern Lisp_Object Qcharset_g1, Qcharset_g2, Qcharset_g3, Qcoding_system_error; | |
4962 extern Lisp_Object Qcoding_systemp, Qcr, Qcrlf, Qdecode, Qencode; | |
4963 extern Lisp_Object Qeol_cr, Qeol_crlf, Qeol_lf, Qeol_type, Qescape_quoted; | |
4964 extern Lisp_Object Qforce_g0_on_output, Qforce_g1_on_output; | |
4965 extern Lisp_Object Qforce_g2_on_output, Qforce_g3_on_output; | |
4966 extern Lisp_Object Qinput_charset_conversion, Qlf, Qlock_shift; | |
4967 extern Lisp_Object Qmnemonic, Qno_ascii_cntl, Qno_ascii_eol; | |
4968 extern Lisp_Object Qno_conversion, Qraw_text; | |
4969 extern Lisp_Object Qno_iso6429, Qoutput_charset_conversion; | |
4970 extern Lisp_Object Qpost_read_conversion, Qpre_write_conversion, Qseven; | |
4971 extern Lisp_Object Qshort, Vcoding_system_for_read; | |
4972 extern Lisp_Object Vcoding_system_for_write; | |
4973 extern Lisp_Object Vfile_name_coding_system, Vkeyboard_coding_system; | |
4974 extern Lisp_Object Vterminal_coding_system; | |
4975 extern Lisp_Object Qcanonicalize_after_coding; | |
4976 int coding_system_is_for_text_file (Lisp_Object coding_system); | |
4977 Lisp_Object find_coding_system_for_text_file (Lisp_Object name, int eol_wrap); | |
1632 | 4978 MODULE_API Lisp_Object get_coding_system_for_text_file (Lisp_Object name, |
4979 int eol_wrap); | |
771 | 4980 int coding_system_is_binary (Lisp_Object coding_system); |
4981 | |
4982 | |
428 | 4983 /* Defined in fileio.c */ |
826 | 4984 EXFUN (Fdirectory_file_name, 1); |
4985 EXFUN (Fdo_auto_save, 2); | |
4986 EXFUN (Fexpand_file_name, 2); | |
4987 EXFUN (Ffile_accessible_directory_p, 1); | |
4988 EXFUN (Ffile_directory_p, 1); | |
4989 EXFUN (Ffile_executable_p, 1); | |
4990 EXFUN (Ffile_exists_p, 1); | |
4991 EXFUN (Ffile_name_absolute_p, 1); | |
4992 EXFUN (Ffile_name_as_directory, 1); | |
4993 EXFUN (Ffile_name_directory, 1); | |
4994 EXFUN (Ffile_name_nondirectory, 1); | |
4995 EXFUN (Ffile_readable_p, 1); | |
4996 EXFUN (Ffile_symlink_p, 1); | |
4997 EXFUN (Ffile_truename, 2); | |
4998 EXFUN (Ffind_file_name_handler, 2); | |
4999 EXFUN (Finsert_file_contents_internal, 7); | |
5000 EXFUN (Fmake_temp_name, 1); | |
5001 EXFUN (Fsubstitute_in_file_name, 1); | |
5002 EXFUN (Funhandled_file_name_directory, 1); | |
5003 EXFUN (Fverify_visited_file_modtime, 1); | |
5004 | |
428 | 5005 void record_auto_save (void); |
5006 void force_auto_save_soon (void); | |
563 | 5007 DECLARE_DOESNT_RETURN (report_error_with_errno (Lisp_Object errtype, |
867 | 5008 const CIbyte *string, |
563 | 5009 Lisp_Object data)); |
5010 DECLARE_DOESNT_RETURN (report_file_type_error (Lisp_Object errtype, | |
5011 Lisp_Object oserrmess, | |
867 | 5012 const CIbyte *string, |
563 | 5013 Lisp_Object data)); |
867 | 5014 DECLARE_DOESNT_RETURN (report_file_error (const CIbyte *, Lisp_Object)); |
428 | 5015 Lisp_Object lisp_strerror (int); |
5016 Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object); | |
5017 int internal_delete_file (Lisp_Object); | |
2526 | 5018 Ibyte *find_end_of_directory_component (const Ibyte *path, |
5019 Bytecount len); | |
428 | 5020 |
5021 /* Defined in filelock.c */ | |
826 | 5022 EXFUN (Funlock_buffer, 0); |
5023 | |
428 | 5024 void lock_file (Lisp_Object); |
5025 void unlock_file (Lisp_Object); | |
5026 void unlock_all_files (void); | |
5027 void unlock_buffer (struct buffer *); | |
5028 | |
5029 /* Defined in floatfns.c */ | |
4678
b5e1d4f6b66f
Make #'floor, #'ceiling, #'round, #'truncate conform to Common Lisp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4677
diff
changeset
|
5030 EXFUN (Ftruncate, 2); |
826 | 5031 |
428 | 5032 double extract_float (Lisp_Object); |
5033 | |
5034 /* Defined in fns.c */ | |
1632 | 5035 MODULE_API EXFUN (Fappend, MANY); |
826 | 5036 EXFUN (Fassoc, 2); |
5037 EXFUN (Fassq, 2); | |
5038 EXFUN (Fcanonicalize_lax_plist, 2); | |
5039 EXFUN (Fcanonicalize_plist, 2); | |
5040 EXFUN (Fcheck_valid_plist, 1); | |
5041 EXFUN (Fconcat, MANY); | |
5042 EXFUN (Fcopy_alist, 1); | |
5043 EXFUN (Fcopy_list, 1); | |
5044 EXFUN (Fcopy_sequence, 1); | |
5045 EXFUN (Fcopy_tree, 2); | |
5046 EXFUN (Fdelete, 2); | |
5047 EXFUN (Fdelq, 2); | |
5048 EXFUN (Fdestructive_alist_to_plist, 1); | |
5049 EXFUN (Felt, 2); | |
1632 | 5050 MODULE_API EXFUN (Fequal, 2); |
5051 MODULE_API EXFUN (Fget, 3); | |
4906
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4888
diff
changeset
|
5052 MODULE_API EXFUN (Feqlsign, MANY); |
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4888
diff
changeset
|
5053 MODULE_API EXFUN (Fequalp, 2); |
826 | 5054 EXFUN (Flast, 2); |
5055 EXFUN (Flax_plist_get, 3); | |
5056 EXFUN (Flax_plist_remprop, 2); | |
1632 | 5057 MODULE_API EXFUN (Flength, 1); |
826 | 5058 EXFUN (Fmapcar, 2); |
5059 EXFUN (Fmember, 2); | |
5060 EXFUN (Fmemq, 2); | |
5061 EXFUN (Fnconc, MANY); | |
1632 | 5062 MODULE_API EXFUN (Fnreverse, 1); |
826 | 5063 EXFUN (Fnthcdr, 2); |
5064 EXFUN (Fold_assq, 2); | |
5065 EXFUN (Fold_equal, 2); | |
5066 EXFUN (Fold_member, 2); | |
5067 EXFUN (Fold_memq, 2); | |
5068 EXFUN (Fplist_get, 3); | |
5069 EXFUN (Fplist_member, 2); | |
5070 EXFUN (Fplist_put, 3); | |
1632 | 5071 MODULE_API EXFUN (Fprovide, 1); |
5072 MODULE_API EXFUN (Fput, 3); | |
826 | 5073 EXFUN (Frassq, 2); |
5074 EXFUN (Fremassq, 2); | |
5075 EXFUN (Freplace_list, 2); | |
1632 | 5076 MODULE_API EXFUN (Freverse, 1); |
1268 | 5077 EXFUN (Fsafe_length, 1); |
826 | 5078 EXFUN (Fsort, 2); |
5079 EXFUN (Fstring_equal, 2); | |
5080 EXFUN (Fstring_lessp, 2); | |
5081 EXFUN (Fsubstring, 3); | |
5082 EXFUN (Fvalid_plist_p, 1); | |
5083 | |
428 | 5084 Lisp_Object list_sort (Lisp_Object, Lisp_Object, |
5085 int (*) (Lisp_Object, Lisp_Object, Lisp_Object)); | |
5086 Lisp_Object merge (Lisp_Object, Lisp_Object, Lisp_Object); | |
5087 | |
5088 void bump_string_modiff (Lisp_Object); | |
5089 Lisp_Object memq_no_quit (Lisp_Object, Lisp_Object); | |
5090 Lisp_Object assoc_no_quit (Lisp_Object, Lisp_Object); | |
5091 Lisp_Object assq_no_quit (Lisp_Object, Lisp_Object); | |
5092 Lisp_Object rassq_no_quit (Lisp_Object, Lisp_Object); | |
5093 Lisp_Object delq_no_quit (Lisp_Object, Lisp_Object); | |
5094 Lisp_Object delq_no_quit_and_free_cons (Lisp_Object, Lisp_Object); | |
5095 Lisp_Object remassoc_no_quit (Lisp_Object, Lisp_Object); | |
5096 Lisp_Object remassq_no_quit (Lisp_Object, Lisp_Object); | |
5097 Lisp_Object remrassq_no_quit (Lisp_Object, Lisp_Object); | |
5098 | |
4906
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4888
diff
changeset
|
5099 int plists_differ (Lisp_Object, Lisp_Object, int, int, int, int); |
428 | 5100 Lisp_Object internal_plist_get (Lisp_Object, Lisp_Object); |
5101 void internal_plist_put (Lisp_Object *, Lisp_Object, Lisp_Object); | |
5102 int internal_remprop (Lisp_Object *, Lisp_Object); | |
5103 Lisp_Object external_plist_get (Lisp_Object *, Lisp_Object, | |
578 | 5104 int, Error_Behavior); |
428 | 5105 void external_plist_put (Lisp_Object *, Lisp_Object, |
578 | 5106 Lisp_Object, int, Error_Behavior); |
5107 int external_remprop (Lisp_Object *, Lisp_Object, int, Error_Behavior); | |
853 | 5108 int internal_equal_trapping_problems (Lisp_Object warning_class, |
2367 | 5109 const Ascbyte *warning_string, |
853 | 5110 int flags, |
5111 struct call_trapping_problems_result *p, | |
5112 int retval, | |
5113 Lisp_Object obj1, Lisp_Object obj2, | |
5114 int depth); | |
428 | 5115 int internal_equal (Lisp_Object, Lisp_Object, int); |
801 | 5116 int internal_equalp (Lisp_Object obj1, Lisp_Object obj2, int depth); |
4906
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4888
diff
changeset
|
5117 int internal_equal_0 (Lisp_Object, Lisp_Object, int, int); |
428 | 5118 Lisp_Object concat2 (Lisp_Object, Lisp_Object); |
5119 Lisp_Object concat3 (Lisp_Object, Lisp_Object, Lisp_Object); | |
5120 Lisp_Object vconcat2 (Lisp_Object, Lisp_Object); | |
5121 Lisp_Object vconcat3 (Lisp_Object, Lisp_Object, Lisp_Object); | |
5122 Lisp_Object nconc2 (Lisp_Object, Lisp_Object); | |
5123 Lisp_Object bytecode_nconc2 (Lisp_Object *); | |
4910
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4906
diff
changeset
|
5124 int bytecode_arithcompare (Lisp_Object obj1, Lisp_Object obj2); |
442 | 5125 void check_losing_bytecode (const char *, Lisp_Object); |
428 | 5126 |
771 | 5127 Lisp_Object add_suffix_to_symbol (Lisp_Object symbol, |
2367 | 5128 const Ascbyte *ascii_string); |
5129 Lisp_Object add_prefix_to_symbol (const Ascbyte *ascii_string, | |
771 | 5130 Lisp_Object symbol); |
5131 | |
826 | 5132 /* Defined in free-hook.c */ |
5133 EXFUN (Freally_free, 1); | |
5134 | |
428 | 5135 /* Defined in glyphs.c */ |
826 | 5136 EXFUN (Fmake_glyph_internal, 1); |
5137 | |
578 | 5138 Error_Behavior decode_error_behavior_flag (Lisp_Object); |
5139 Lisp_Object encode_error_behavior_flag (Error_Behavior); | |
428 | 5140 |
563 | 5141 /* Defined in glyphs-shared.c */ |
5142 void shared_resource_validate (Lisp_Object instantiator); | |
5143 Lisp_Object shared_resource_normalize (Lisp_Object inst, | |
5144 Lisp_Object console_type, | |
5145 Lisp_Object dest_mask, | |
5146 Lisp_Object tag); | |
5147 extern Lisp_Object Q_resource_type, Q_resource_id; | |
5148 | |
5149 /* Defined in gui.c */ | |
2367 | 5150 DECLARE_DOESNT_RETURN (gui_error (const Ascbyte *reason, |
563 | 5151 Lisp_Object frob)); |
2367 | 5152 DECLARE_DOESNT_RETURN (gui_error_2 (const Ascbyte *reason, |
569 | 5153 Lisp_Object frob0, Lisp_Object frob1)); |
428 | 5154 /* Defined in indent.c */ |
826 | 5155 EXFUN (Findent_to, 3); |
5156 EXFUN (Fvertical_motion, 3); | |
5157 | |
5158 int byte_spaces_at_point (struct buffer *, Bytebpos); | |
665 | 5159 int column_at_point (struct buffer *, Charbpos, int); |
793 | 5160 int string_column_at_point (Lisp_Object, Charbpos, int); |
428 | 5161 int current_column (struct buffer *); |
5162 void invalidate_current_column (void); | |
665 | 5163 Charbpos vmotion (struct window *, Charbpos, int, int *); |
5164 Charbpos vmotion_pixels (Lisp_Object, Charbpos, int, int, int *); | |
428 | 5165 |
771 | 5166 /* Defined in insdel.c */ |
5167 void set_buffer_point (struct buffer *buf, Charbpos pos, Bytebpos bipos); | |
5168 | |
826 | 5169 /* Defined in intl.c */ |
5170 EXFUN (Fgettext, 1); | |
5171 | |
428 | 5172 /* Defined in keymap.c */ |
826 | 5173 EXFUN (Fdefine_key, 3); |
5174 EXFUN (Fkey_description, 1); | |
5175 EXFUN (Flookup_key, 3); | |
5176 EXFUN (Fmake_sparse_keymap, 1); | |
5177 | |
793 | 5178 void where_is_to_char (Lisp_Object, Eistring *); |
428 | 5179 |
5180 /* Defined in lread.c */ | |
826 | 5181 EXFUN (Fread, 1); |
5182 | |
428 | 5183 void ebolify_bytecode_constants (Lisp_Object); |
5184 void close_load_descs (void); | |
5185 int locate_file (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object *, int); | |
5186 EXFUN (Flocate_file_clear_hashing, 1); | |
442 | 5187 int isfloat_string (const char *); |
1983 | 5188 #ifdef HAVE_RATIO |
5189 int isratio_string (const char *); | |
5190 #endif | |
428 | 5191 |
5192 /* Well, I've decided to enable this. -- ben */ | |
5193 /* And I've decided to make it work right. -- sb */ | |
5194 #define LOADHIST | |
5195 /* Define the following symbol to enable load history of dumped files */ | |
5196 #define LOADHIST_DUMPED | |
5197 /* Define the following symbol to enable load history of C source */ | |
5198 #define LOADHIST_BUILTIN | |
5199 | |
5200 #ifdef LOADHIST /* this is just a stupid idea */ | |
5201 #define LOADHIST_ATTACH(x) \ | |
5202 do { if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list); } \ | |
5203 while (0) | |
5204 #else /*! LOADHIST */ | |
5205 # define LOADHIST_ATTACH(x) | |
5206 #endif /*! LOADHIST */ | |
5207 | |
826 | 5208 /* Defined in macros.c */ |
5209 EXFUN (Fexecute_kbd_macro, 2); | |
5210 | |
428 | 5211 /* Defined in marker.c */ |
826 | 5212 EXFUN (Fcopy_marker, 2); |
5213 EXFUN (Fmake_marker, 0); | |
5214 EXFUN (Fmarker_buffer, 1); | |
5215 EXFUN (Fmarker_position, 1); | |
5216 EXFUN (Fset_marker, 3); | |
5217 EXFUN (Fset_marker_insertion_type, 2); | |
5218 | |
5219 Bytebpos byte_marker_position (Lisp_Object); | |
665 | 5220 Charbpos marker_position (Lisp_Object); |
826 | 5221 void set_byte_marker_position (Lisp_Object, Bytebpos); |
665 | 5222 void set_marker_position (Lisp_Object, Charbpos); |
428 | 5223 void unchain_marker (Lisp_Object); |
5224 Lisp_Object noseeum_copy_marker (Lisp_Object, Lisp_Object); | |
5225 Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object); | |
5226 #ifdef MEMORY_USAGE_STATS | |
5227 int compute_buffer_marker_usage (struct buffer *, struct overhead_stats *); | |
5228 #endif | |
771 | 5229 void init_buffer_markers (struct buffer *b); |
5230 void uninit_buffer_markers (struct buffer *b); | |
428 | 5231 |
5232 /* Defined in minibuf.c */ | |
5233 extern int minibuf_level; | |
867 | 5234 Charcount scmp_1 (const Ibyte *, const Ibyte *, Charcount, int); |
428 | 5235 #define scmp(s1, s2, len) scmp_1 (s1, s2, len, completion_ignore_case) |
5236 extern int completion_ignore_case; | |
867 | 5237 int regexp_ignore_completion_p (const Ibyte *, Lisp_Object, |
428 | 5238 Bytecount, Bytecount); |
5239 Lisp_Object clear_echo_area (struct frame *, Lisp_Object, int); | |
5240 Lisp_Object clear_echo_area_from_print (struct frame *, Lisp_Object, int); | |
867 | 5241 void echo_area_append (struct frame *, const Ibyte *, Lisp_Object, |
428 | 5242 Bytecount, Bytecount, Lisp_Object); |
867 | 5243 void echo_area_message (struct frame *, const Ibyte *, Lisp_Object, |
428 | 5244 Bytecount, Bytecount, Lisp_Object); |
5245 Lisp_Object echo_area_status (struct frame *); | |
5246 int echo_area_active (struct frame *); | |
5247 Lisp_Object echo_area_contents (struct frame *); | |
867 | 5248 void message_internal (const Ibyte *, Lisp_Object, Bytecount, Bytecount); |
5249 void message_append_internal (const Ibyte *, Lisp_Object, | |
428 | 5250 Bytecount, Bytecount); |
1632 | 5251 MODULE_API void message (const char *, ...) PRINTF_ARGS (1, 2); |
442 | 5252 void message_append (const char *, ...) PRINTF_ARGS (1, 2); |
5253 void message_no_translate (const char *, ...) PRINTF_ARGS (1, 2); | |
428 | 5254 void clear_message (void); |
5255 | |
771 | 5256 /* Defined in mule-charset.c */ |
826 | 5257 EXFUN (Fmake_charset, 3); |
5258 | |
771 | 5259 extern Lisp_Object Ql2r, Qr2l; |
5260 | |
428 | 5261 /* Defined in print.c */ |
826 | 5262 EXFUN (Fdisplay_error, 2); |
5263 EXFUN (Ferror_message_string, 1); | |
5264 EXFUN (Fprin1, 2); | |
5265 EXFUN (Fprin1_to_string, 2); | |
5266 EXFUN (Fprinc, 2); | |
5267 EXFUN (Fprint, 2); | |
5268 | |
4394
cacc942c0d0f
Avoid clearing print-gensym-alist inappropriately when printing hash tables.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4355
diff
changeset
|
5269 Lisp_Object prin1_to_string (Lisp_Object, int); |
771 | 5270 |
5271 /* Lower-level ways to output data: */ | |
3085 | 5272 void default_object_printer (Lisp_Object, Lisp_Object, int); |
771 | 5273 void print_internal (Lisp_Object, Lisp_Object, int); |
428 | 5274 void debug_print (Lisp_Object); |
1204 | 5275 void debug_p4 (Lisp_Object obj); |
5276 void debug_p3 (Lisp_Object obj); | |
5277 void debug_short_backtrace (int); | |
5278 void debug_backtrace (void); | |
428 | 5279 /* NOTE: Do not call this with the data of a Lisp_String. Use princ. |
5280 * Note: stream should be defaulted before calling | |
5281 * (eg Qnil means stdout, not Vstandard_output, etc) */ | |
1632 | 5282 MODULE_API void write_c_string (Lisp_Object stream, const CIbyte *str); |
771 | 5283 /* Same goes for this function. */ |
1632 | 5284 MODULE_API void write_string (Lisp_Object stream, const Ibyte *str); |
428 | 5285 /* Same goes for this function. */ |
867 | 5286 void write_string_1 (Lisp_Object stream, const Ibyte *str, Bytecount size); |
826 | 5287 void write_eistring (Lisp_Object stream, const Eistring *ei); |
771 | 5288 |
5289 /* Higher-level (printf-style) ways to output data: */ | |
1632 | 5290 MODULE_API void write_fmt_string (Lisp_Object stream, const CIbyte *fmt, ...); |
5291 MODULE_API void write_fmt_string_lisp (Lisp_Object stream, const CIbyte *fmt, | |
5292 int nargs, ...); | |
867 | 5293 void stderr_out (const CIbyte *, ...) PRINTF_ARGS (1, 2); |
5294 void stderr_out_lisp (const CIbyte *, int nargs, ...); | |
5295 void stdout_out (const CIbyte *, ...) PRINTF_ARGS (1, 2); | |
1346 | 5296 void external_out (int dest, const CIbyte *fmt, ...) PRINTF_ARGS (2, 3); |
867 | 5297 void debug_out (const CIbyte *, ...) PRINTF_ARGS (1, 2); |
1743 | 5298 DECLARE_DOESNT_RETURN (fatal (const CIbyte *, ...)) PRINTF_ARGS(1, 2); |
771 | 5299 |
5300 /* Internal functions: */ | |
1261 | 5301 Lisp_Object canonicalize_printcharfun (Lisp_Object printcharfun); |
771 | 5302 void temp_output_buffer_setup (Lisp_Object); |
5303 void temp_output_buffer_show (Lisp_Object, Lisp_Object); | |
428 | 5304 void print_cons (Lisp_Object, Lisp_Object, int); |
5305 void print_vector (Lisp_Object, Lisp_Object, int); | |
5306 void print_string (Lisp_Object, Lisp_Object, int); | |
771 | 5307 void print_symbol (Lisp_Object, Lisp_Object, int); |
5308 void print_float (Lisp_Object, Lisp_Object, int); | |
603 | 5309 /* The number of bytes required to store the decimal printed |
5310 representation of an integral type. Add a few bytes for truncation, | |
5311 optional sign prefix, and null byte terminator. | |
614 | 5312 2.40824 == log (256) / log (10). |
5313 | |
5314 We don't use floating point since Sun cc (buggily?) cannot use | |
5315 floating point computations to define a compile-time integral | |
5316 constant. */ | |
603 | 5317 #define DECIMAL_PRINT_SIZE(integral_type) \ |
614 | 5318 (((2410824 * sizeof (integral_type)) / 1000000) + 3) |
577 | 5319 void long_to_string (char *, long); |
4329
d9eb5ea14f65
Provide %b in #'format; use it for converting between ints and bit vectors.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4134
diff
changeset
|
5320 void ulong_to_bit_string (char *, unsigned long); |
428 | 5321 extern int print_escape_newlines; |
1632 | 5322 extern MODULE_API int print_readably; |
4880
ae81a2c00f4f
try harder to avoid crashing when debug-printing
Ben Wing <ben@xemacs.org>
parents:
4854
diff
changeset
|
5323 extern int in_debug_print; |
428 | 5324 Lisp_Object internal_with_output_to_temp_buffer (Lisp_Object, |
5325 Lisp_Object (*) (Lisp_Object), | |
5326 Lisp_Object, Lisp_Object); | |
5327 void float_to_string (char *, double); | |
5328 void internal_object_printer (Lisp_Object, Lisp_Object, int); | |
4846 | 5329 MODULE_API DECLARE_DOESNT_RETURN (printing_unreadable_object (const CIbyte *, |
5330 ...)) | |
5331 PRINTF_ARGS (1, 2); | |
5332 DECLARE_DOESNT_RETURN (printing_unreadable_lcrecord (Lisp_Object obj, | |
5333 const Ibyte *name)); | |
428 | 5334 |
5335 /* Defined in rangetab.c */ | |
826 | 5336 EXFUN (Fclear_range_table, 1); |
5337 EXFUN (Fget_range_table, 3); | |
2421 | 5338 EXFUN (Fmake_range_table, 1); |
826 | 5339 EXFUN (Fput_range_table, 4); |
4690
257b468bf2ca
Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4682
diff
changeset
|
5340 EXFUN (Fcopy_range_table, 1); |
826 | 5341 |
2421 | 5342 extern Lisp_Object Qstart_closed_end_open; |
5343 extern Lisp_Object Qstart_open_end_open; | |
5344 extern Lisp_Object Qstart_closed_end_closed; | |
5345 extern Lisp_Object Qstart_open_end_closed; | |
5346 | |
428 | 5347 void put_range_table (Lisp_Object, EMACS_INT, EMACS_INT, Lisp_Object); |
5348 int unified_range_table_bytes_needed (Lisp_Object); | |
5349 int unified_range_table_bytes_used (void *); | |
5350 void unified_range_table_copy_data (Lisp_Object, void *); | |
5351 Lisp_Object unified_range_table_lookup (void *, EMACS_INT, Lisp_Object); | |
5352 int unified_range_table_nentries (void *); | |
5353 void unified_range_table_get_range (void *, int, EMACS_INT *, EMACS_INT *, | |
5354 Lisp_Object *); | |
5355 | |
5356 /* Defined in search.c */ | |
826 | 5357 EXFUN (Fmatch_beginning, 1); |
5358 EXFUN (Fmatch_end, 1); | |
5359 EXFUN (Fskip_chars_backward, 3); | |
5360 EXFUN (Fskip_chars_forward, 3); | |
5361 EXFUN (Fstring_match, 4); | |
5362 | |
428 | 5363 struct re_pattern_buffer; |
5364 struct re_registers; | |
867 | 5365 Charbpos scan_buffer (struct buffer *, Ichar, Charbpos, Charbpos, EMACS_INT, |
826 | 5366 EMACS_INT *, int); |
665 | 5367 Charbpos find_next_newline (struct buffer *, Charbpos, int); |
5368 Charbpos find_next_newline_no_quit (struct buffer *, Charbpos, int); | |
826 | 5369 Bytebpos byte_find_next_newline_no_quit (struct buffer *, Bytebpos, int); |
867 | 5370 Bytecount byte_find_next_ichar_in_string (Lisp_Object, Ichar, Bytecount, |
826 | 5371 EMACS_INT); |
665 | 5372 Charbpos find_before_next_newline (struct buffer *, Charbpos, Charbpos, int); |
826 | 5373 struct re_pattern_buffer *compile_pattern (Lisp_Object pattern, |
5374 struct re_registers *regp, | |
5375 Lisp_Object translate, | |
5376 Lisp_Object searchobj, | |
5377 struct buffer *searchbuf, | |
5378 int posix, Error_Behavior errb); | |
867 | 5379 Bytecount fast_string_match (Lisp_Object, const Ibyte *, |
428 | 5380 Lisp_Object, Bytecount, |
578 | 5381 Bytecount, int, Error_Behavior, int); |
428 | 5382 Bytecount fast_lisp_string_match (Lisp_Object, Lisp_Object); |
507 | 5383 extern Fixnum warn_about_possibly_incompatible_back_references; |
502 | 5384 |
428 | 5385 |
5386 /* Defined in signal.c */ | |
5387 void init_interrupts_late (void); | |
5388 | |
5389 /* Defined in sound.c */ | |
826 | 5390 EXFUN (Fding, 3); |
5391 | |
428 | 5392 void init_device_sound (struct device *); |
2367 | 5393 DECLARE_DOESNT_RETURN (report_sound_error (const Ascbyte *, Lisp_Object)); |
428 | 5394 |
5395 /* Defined in specifier.c */ | |
826 | 5396 EXFUN (Fadd_spec_to_specifier, 5); |
5397 EXFUN (Fspecifier_spec_list, 4); | |
5398 | |
428 | 5399 Lisp_Object specifier_instance (Lisp_Object, Lisp_Object, Lisp_Object, |
578 | 5400 Error_Behavior, int, int, Lisp_Object); |
428 | 5401 Lisp_Object specifier_instance_no_quit (Lisp_Object, Lisp_Object, Lisp_Object, |
578 | 5402 Error_Behavior, int, Lisp_Object); |
428 | 5403 |
5404 /* Defined in symbols.c */ | |
826 | 5405 EXFUN (Fboundp, 1); |
5406 EXFUN (Fbuilt_in_variable_type, 1); | |
5407 EXFUN (Fdefault_boundp, 1); | |
5408 EXFUN (Fdefault_value, 1); | |
5409 EXFUN (Ffboundp, 1); | |
5410 EXFUN (Ffset, 2); | |
5411 EXFUN (Fintern, 2); | |
4355
a2af1ff1761f
Provide a DEFAULT argument in #'intern-soft.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4329
diff
changeset
|
5412 EXFUN (Fintern_soft, 3); |
826 | 5413 EXFUN (Fkill_local_variable, 1); |
5414 EXFUN (Fset, 2); | |
5415 EXFUN (Fset_default, 2); | |
5416 EXFUN (Fsymbol_function, 1); | |
5417 EXFUN (Fsymbol_name, 1); | |
5418 EXFUN (Fsymbol_plist, 1); | |
5419 EXFUN (Fsymbol_value, 1); | |
5420 | |
867 | 5421 unsigned int hash_string (const Ibyte *, Bytecount); |
5422 Lisp_Object intern_int (const Ibyte *str); | |
1632 | 5423 MODULE_API Lisp_Object intern (const CIbyte *str); |
867 | 5424 Lisp_Object intern_converting_underscores_to_dashes (const CIbyte *str); |
5425 Lisp_Object oblookup (Lisp_Object, const Ibyte *, Bytecount); | |
428 | 5426 void map_obarray (Lisp_Object, int (*) (Lisp_Object, void *), void *); |
5427 Lisp_Object indirect_function (Lisp_Object, int); | |
5428 Lisp_Object symbol_value_in_buffer (Lisp_Object, Lisp_Object); | |
5429 void kill_buffer_local_variables (struct buffer *); | |
5430 int symbol_value_buffer_local_info (Lisp_Object, struct buffer *); | |
5431 Lisp_Object find_symbol_value (Lisp_Object); | |
5432 Lisp_Object find_symbol_value_quickly (Lisp_Object, int); | |
5433 Lisp_Object top_level_value (Lisp_Object); | |
5434 void reject_constant_symbols (Lisp_Object sym, Lisp_Object newval, | |
5435 int function_p, | |
5436 Lisp_Object follow_past_lisp_magic); | |
5437 | |
5438 /* Defined in syntax.c */ | |
665 | 5439 Charbpos scan_words (struct buffer *, Charbpos, int); |
826 | 5440 EXFUN (Fchar_syntax, 2); |
5441 EXFUN (Fforward_word, 2); | |
5442 extern Lisp_Object Vstandard_syntax_table; | |
3250 | 5443 void signal_syntax_cache_extent_changed (EXTENT extent); |
5444 void signal_syntax_cache_extent_adjust (struct buffer *buf); | |
826 | 5445 void init_buffer_syntax_cache (struct buffer *buf); |
5446 void mark_buffer_syntax_cache (struct buffer *buf); | |
5447 void uninit_buffer_syntax_cache (struct buffer *buf); | |
5448 extern Lisp_Object Qsyntax_table; | |
428 | 5449 |
771 | 5450 /* Defined in sysdep.c */ |
5451 long get_random (void); | |
5452 void seed_random (long arg); | |
5453 | |
5454 /* Defined in text.c */ | |
867 | 5455 void find_charsets_in_ibyte_string (unsigned char *charsets, |
5456 const Ibyte *str, | |
771 | 5457 Bytecount len); |
867 | 5458 void find_charsets_in_ichar_string (unsigned char *charsets, |
5459 const Ichar *str, | |
771 | 5460 Charcount len); |
867 | 5461 int ibyte_string_displayed_columns (const Ibyte *str, Bytecount len); |
5462 int ichar_string_displayed_columns (const Ichar *str, Charcount len); | |
5463 Charcount ibyte_string_nonascii_chars (const Ibyte *str, Bytecount len); | |
5464 void convert_ibyte_string_into_ichar_dynarr (const Ibyte *str, | |
771 | 5465 Bytecount len, |
867 | 5466 Ichar_dynarr *dyn); |
5467 Charcount convert_ibyte_string_into_ichar_string (const Ibyte *str, | |
771 | 5468 Bytecount len, |
867 | 5469 Ichar *arr); |
5470 void convert_ichar_string_into_ibyte_dynarr (Ichar *arr, int nels, | |
5471 Ibyte_dynarr *dyn); | |
5472 Ibyte *convert_ichar_string_into_malloced_string (Ichar *arr, int nels, | |
771 | 5473 Bytecount *len_out); |
867 | 5474 Bytecount copy_text_between_formats (const Ibyte *src, Bytecount srclen, |
826 | 5475 Internal_Format srcfmt, |
5476 Lisp_Object srcobj, | |
867 | 5477 Ibyte *dst, Bytecount dstlen, |
826 | 5478 Internal_Format dstfmt, |
5479 Lisp_Object dstobj, | |
5480 Bytecount *src_used); | |
5481 Bytecount copy_buffer_text_out (struct buffer *buf, Bytebpos pos, | |
867 | 5482 Bytecount len, Ibyte *dst, Bytecount dstlen, |
826 | 5483 Internal_Format dstfmt, Lisp_Object dstobj, |
5484 Bytecount *src_used); | |
771 | 5485 |
5486 /* flags for get_buffer_pos_char(), get_buffer_range_char(), etc. */ | |
5487 /* At most one of GB_COERCE_RANGE and GB_NO_ERROR_IF_BAD should be | |
5488 specified. At most one of GB_NEGATIVE_FROM_END and GB_NO_ERROR_IF_BAD | |
5489 should be specified. */ | |
5490 | |
5491 #define GB_ALLOW_PAST_ACCESSIBLE (1 << 0) | |
5492 #define GB_ALLOW_NIL (1 << 1) | |
5493 #define GB_CHECK_ORDER (1 << 2) | |
5494 #define GB_COERCE_RANGE (1 << 3) | |
5495 #define GB_NO_ERROR_IF_BAD (1 << 4) | |
5496 #define GB_NEGATIVE_FROM_END (1 << 5) | |
5497 #define GB_HISTORICAL_STRING_BEHAVIOR (GB_NEGATIVE_FROM_END | GB_ALLOW_NIL) | |
5498 | |
5499 Charbpos get_buffer_pos_char (struct buffer *b, Lisp_Object pos, | |
5500 unsigned int flags); | |
5501 Bytebpos get_buffer_pos_byte (struct buffer *b, Lisp_Object pos, | |
5502 unsigned int flags); | |
5503 void get_buffer_range_char (struct buffer *b, Lisp_Object from, Lisp_Object to, | |
5504 Charbpos *from_out, Charbpos *to_out, | |
5505 unsigned int flags); | |
5506 void get_buffer_range_byte (struct buffer *b, Lisp_Object from, Lisp_Object to, | |
5507 Bytebpos *from_out, Bytebpos *to_out, | |
5508 unsigned int flags); | |
5509 Charcount get_string_pos_char (Lisp_Object string, Lisp_Object pos, | |
5510 unsigned int flags); | |
5511 Bytecount get_string_pos_byte (Lisp_Object string, Lisp_Object pos, | |
5512 unsigned int flags); | |
5513 void get_string_range_char (Lisp_Object string, Lisp_Object from, | |
5514 Lisp_Object to, Charcount *from_out, | |
5515 Charcount *to_out, unsigned int flags); | |
5516 void get_string_range_byte (Lisp_Object string, Lisp_Object from, | |
5517 Lisp_Object to, Bytecount *from_out, | |
5518 Bytecount *to_out, unsigned int flags); | |
826 | 5519 Charxpos get_buffer_or_string_pos_char (Lisp_Object object, Lisp_Object pos, |
5520 unsigned int flags); | |
5521 Bytexpos get_buffer_or_string_pos_byte (Lisp_Object object, Lisp_Object pos, | |
5522 unsigned int flags); | |
771 | 5523 void get_buffer_or_string_range_char (Lisp_Object object, Lisp_Object from, |
826 | 5524 Lisp_Object to, Charxpos *from_out, |
5525 Charxpos *to_out, unsigned int flags); | |
771 | 5526 void get_buffer_or_string_range_byte (Lisp_Object object, Lisp_Object from, |
826 | 5527 Lisp_Object to, Bytexpos *from_out, |
5528 Bytexpos *to_out, unsigned int flags); | |
5529 Charxpos buffer_or_string_accessible_begin_char (Lisp_Object object); | |
5530 Charxpos buffer_or_string_accessible_end_char (Lisp_Object object); | |
5531 Bytexpos buffer_or_string_accessible_begin_byte (Lisp_Object object); | |
5532 Bytexpos buffer_or_string_accessible_end_byte (Lisp_Object object); | |
5533 Charxpos buffer_or_string_absolute_begin_char (Lisp_Object object); | |
5534 Charxpos buffer_or_string_absolute_end_char (Lisp_Object object); | |
5535 Bytexpos buffer_or_string_absolute_begin_byte (Lisp_Object object); | |
5536 Bytexpos buffer_or_string_absolute_end_byte (Lisp_Object object); | |
5537 Charbpos charbpos_clip_to_bounds (Charbpos lower, Charbpos num, | |
5538 Charbpos upper); | |
5539 Bytebpos bytebpos_clip_to_bounds (Bytebpos lower, Bytebpos num, | |
5540 Bytebpos upper); | |
5541 Charxpos charxpos_clip_to_bounds (Charxpos lower, Charxpos num, | |
5542 Charxpos upper); | |
5543 Bytexpos bytexpos_clip_to_bounds (Bytexpos lower, Bytexpos num, | |
5544 Bytexpos upper); | |
5545 Charxpos buffer_or_string_clip_to_accessible_char (Lisp_Object object, | |
5546 Charxpos pos); | |
5547 Bytexpos buffer_or_string_clip_to_accessible_byte (Lisp_Object object, | |
5548 Bytexpos pos); | |
5549 Charxpos buffer_or_string_clip_to_absolute_char (Lisp_Object object, | |
5550 Charxpos pos); | |
5551 Bytexpos buffer_or_string_clip_to_absolute_byte (Lisp_Object object, | |
5552 Bytexpos pos); | |
5553 | |
771 | 5554 |
5555 #ifdef ENABLE_COMPOSITE_CHARS | |
5556 | |
867 | 5557 Ichar lookup_composite_char (Ibyte *str, int len); |
5558 Lisp_Object composite_char_string (Ichar ch); | |
771 | 5559 #endif /* ENABLE_COMPOSITE_CHARS */ |
5560 | |
5561 EXFUN (Ffind_charset, 1); | |
5562 EXFUN (Fget_charset, 1); | |
5563 EXFUN (Fcharset_list, 0); | |
5564 | |
5565 extern Lisp_Object Vcharset_ascii; | |
5566 extern Lisp_Object Vcharset_control_1; | |
5567 extern Lisp_Object Vcharset_latin_iso8859_1; | |
5568 extern Lisp_Object Vcharset_latin_iso8859_2; | |
5569 extern Lisp_Object Vcharset_latin_iso8859_3; | |
5570 extern Lisp_Object Vcharset_latin_iso8859_4; | |
5571 extern Lisp_Object Vcharset_thai_tis620; | |
5572 extern Lisp_Object Vcharset_greek_iso8859_7; | |
4805
980575c76541
Move the arabic-iso8859-6 character set back to C, otherwise X11 lookup fails.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4744
diff
changeset
|
5573 extern Lisp_Object Vcharset_arabic_iso8859_6; |
771 | 5574 extern Lisp_Object Vcharset_hebrew_iso8859_8; |
5575 extern Lisp_Object Vcharset_katakana_jisx0201; | |
5576 extern Lisp_Object Vcharset_latin_jisx0201; | |
5577 extern Lisp_Object Vcharset_cyrillic_iso8859_5; | |
5578 extern Lisp_Object Vcharset_latin_iso8859_9; | |
3094 | 5579 extern Lisp_Object Vcharset_latin_iso8859_15; |
771 | 5580 extern Lisp_Object Vcharset_japanese_jisx0208_1978; |
5581 extern Lisp_Object Vcharset_chinese_gb2312; | |
5582 extern Lisp_Object Vcharset_japanese_jisx0208; | |
5583 extern Lisp_Object Vcharset_korean_ksc5601; | |
5584 extern Lisp_Object Vcharset_japanese_jisx0212; | |
5585 extern Lisp_Object Vcharset_chinese_cns11643_1; | |
5586 extern Lisp_Object Vcharset_chinese_cns11643_2; | |
5587 extern Lisp_Object Vcharset_chinese_big5_1; | |
5588 extern Lisp_Object Vcharset_chinese_big5_2; | |
5589 extern Lisp_Object Vcharset_composite; | |
5590 | |
867 | 5591 Ichar Lstream_get_ichar_1 (Lstream *stream, int first_char); |
5592 int Lstream_fput_ichar (Lstream *stream, Ichar ch); | |
5593 void Lstream_funget_ichar (Lstream *stream, Ichar ch); | |
5594 | |
5595 DECLARE_INLINE_HEADER (Ibyte *qxestrdup (const Ibyte *s)) | |
771 | 5596 { |
2367 | 5597 return (Ibyte *) xstrdup ((const Chbyte *) s); |
771 | 5598 } |
5599 | |
867 | 5600 DECLARE_INLINE_HEADER (Bytecount qxestrlen (const Ibyte *s)) |
771 | 5601 { |
2367 | 5602 return strlen ((const Chbyte *) s); |
771 | 5603 } |
5604 | |
867 | 5605 DECLARE_INLINE_HEADER (Charcount qxestrcharlen (const Ibyte *s)) |
771 | 5606 { |
5607 return bytecount_to_charcount (s, qxestrlen (s)); | |
5608 } | |
5609 | |
867 | 5610 DECLARE_INLINE_HEADER (int qxestrcmp (const Ibyte *s1, |
5611 const Ibyte *s2)) | |
771 | 5612 { |
2367 | 5613 return strcmp ((const Chbyte *) s1, (const Chbyte *) s2); |
771 | 5614 } |
5615 | |
2367 | 5616 DECLARE_INLINE_HEADER (int qxestrcmp_ascii (const Ibyte *s1, |
5617 const Ascbyte *s2)) | |
771 | 5618 { |
2367 | 5619 return strcmp ((const Chbyte *) s1, s2); |
771 | 5620 } |
5621 | |
867 | 5622 DECLARE_INLINE_HEADER (int qxestrncmp (const Ibyte *string1, |
5623 const Ibyte *string2, | |
771 | 5624 Bytecount count)) |
5625 { | |
2367 | 5626 return strncmp ((const Chbyte *) string1, (const Chbyte *) string2, |
771 | 5627 (size_t) count); |
5628 } | |
5629 | |
2367 | 5630 DECLARE_INLINE_HEADER (int qxestrncmp_ascii (const Ibyte *string1, |
5631 const Ascbyte *string2, | |
5632 Bytecount count)) | |
771 | 5633 { |
2367 | 5634 return strncmp ((const Chbyte *) string1, string2, (size_t) count); |
771 | 5635 } |
5636 | |
867 | 5637 DECLARE_INLINE_HEADER (Ibyte *qxestrcpy (Ibyte *strDest, |
2367 | 5638 const Ibyte *strSource)) |
771 | 5639 { |
2367 | 5640 return (Ibyte *) strcpy ((Chbyte *) strDest, (const Chbyte *) strSource); |
771 | 5641 } |
5642 | |
2367 | 5643 DECLARE_INLINE_HEADER (Ibyte *qxestrcpy_ascii (Ibyte *strDest, |
5644 const Ascbyte *strSource)) | |
771 | 5645 { |
2367 | 5646 return (Ibyte *) strcpy ((Chbyte *) strDest, strSource); |
771 | 5647 } |
5648 | |
867 | 5649 DECLARE_INLINE_HEADER (Ibyte *qxestrncpy (Ibyte *strDest, |
2367 | 5650 const Ibyte *strSource, |
5651 Bytecount count)) | |
771 | 5652 { |
2367 | 5653 return (Ibyte *) strncpy ((Chbyte *) strDest, (const Chbyte *) strSource, |
771 | 5654 (size_t) count); |
5655 } | |
5656 | |
2367 | 5657 DECLARE_INLINE_HEADER (Ibyte *qxestrncpy_ascii (Ibyte *strDest, |
5658 const Ascbyte *strSource, | |
5659 Bytecount count)) | |
771 | 5660 { |
2367 | 5661 return (Ibyte *) strncpy ((Chbyte *) strDest, strSource, (size_t) count); |
771 | 5662 } |
5663 | |
867 | 5664 DECLARE_INLINE_HEADER (Ibyte *qxestrcat (Ibyte *strDest, |
2367 | 5665 const Ibyte *strSource)) |
771 | 5666 { |
2367 | 5667 return (Ibyte *) strcat ((Chbyte *) strDest, (const Chbyte *) strSource); |
771 | 5668 } |
5669 | |
2367 | 5670 DECLARE_INLINE_HEADER (Ibyte *qxestrcat_ascii (Ibyte *strDest, |
5671 const Ascbyte *strSource)) | |
771 | 5672 { |
2367 | 5673 return (Ibyte *) strcat ((Chbyte *) strDest, strSource); |
771 | 5674 } |
5675 | |
867 | 5676 DECLARE_INLINE_HEADER (Ibyte *qxestrncat (Ibyte *strDest, |
2367 | 5677 const Ibyte *strSource, |
5678 Bytecount count)) | |
771 | 5679 { |
2367 | 5680 return (Ibyte *) strncat ((Chbyte *) strDest, (const Chbyte *) strSource, |
771 | 5681 (size_t) count); |
5682 } | |
5683 | |
2367 | 5684 DECLARE_INLINE_HEADER (Ibyte *qxestrncat_ascii (Ibyte *strDest, |
5685 const Ascbyte *strSource, | |
5686 Bytecount count)) | |
771 | 5687 { |
2367 | 5688 return (Ibyte *) strncat ((Chbyte *) strDest, strSource, (size_t) count); |
771 | 5689 } |
5690 | |
867 | 5691 DECLARE_INLINE_HEADER (Ibyte *qxestrchr (const Ibyte *s, Ichar c)) |
771 | 5692 { |
5693 assert (c >= 0 && c <= 255); | |
2367 | 5694 return (Ibyte *) strchr ((const Chbyte *) s, c); |
771 | 5695 } |
5696 | |
867 | 5697 DECLARE_INLINE_HEADER (Ibyte *qxestrrchr (const Ibyte *s, Ichar c)) |
771 | 5698 { |
5699 assert (c >= 0 && c <= 255); | |
2367 | 5700 return (Ibyte *) strrchr ((const Chbyte *) s, c); |
771 | 5701 } |
5702 | |
867 | 5703 DECLARE_INLINE_HEADER (Ibyte *qxestrstr (const Ibyte *string1, |
2367 | 5704 const Ibyte *string2)) |
771 | 5705 { |
2367 | 5706 return (Ibyte *) strstr ((const Chbyte *) string1, (const Chbyte *) string2); |
771 | 5707 } |
5708 | |
867 | 5709 DECLARE_INLINE_HEADER (Bytecount qxestrcspn (const Ibyte *string, |
5710 const CIbyte *strCharSet)) | |
771 | 5711 { |
2367 | 5712 return (Bytecount) strcspn ((const Chbyte *) string, strCharSet); |
771 | 5713 } |
5714 | |
867 | 5715 DECLARE_INLINE_HEADER (Bytecount qxestrspn (const Ibyte *string, |
5716 const CIbyte *strCharSet)) | |
771 | 5717 { |
2367 | 5718 return (Bytecount) strspn ((const Chbyte *) string, strCharSet); |
771 | 5719 } |
5720 | |
867 | 5721 DECLARE_INLINE_HEADER (Ibyte *qxestrpbrk (const Ibyte *string, |
2367 | 5722 const CIbyte *strCharSet)) |
771 | 5723 { |
2367 | 5724 return (Ibyte *) strpbrk ((const Chbyte *) string, strCharSet); |
771 | 5725 } |
5726 | |
867 | 5727 DECLARE_INLINE_HEADER (Ibyte *qxestrtok (Ibyte *strToken, |
2367 | 5728 const CIbyte *strDelimit)) |
771 | 5729 { |
2367 | 5730 return (Ibyte *) strtok ((Chbyte *) strToken, strDelimit); |
771 | 5731 } |
5732 | |
867 | 5733 DECLARE_INLINE_HEADER (double qxestrtod (const Ibyte *nptr, |
5734 Ibyte **endptr)) | |
771 | 5735 { |
2367 | 5736 return strtod ((const Chbyte *) nptr, (Chbyte **) endptr); |
771 | 5737 } |
5738 | |
867 | 5739 DECLARE_INLINE_HEADER (long qxestrtol (const Ibyte *nptr, Ibyte **endptr, |
771 | 5740 int base)) |
5741 { | |
2367 | 5742 return strtol ((const Chbyte *) nptr, (Chbyte **) endptr, base); |
771 | 5743 } |
5744 | |
867 | 5745 DECLARE_INLINE_HEADER (unsigned long qxestrtoul (const Ibyte *nptr, |
5746 Ibyte **endptr, | |
771 | 5747 int base)) |
5748 { | |
2367 | 5749 return strtoul ((const Chbyte *) nptr, (Chbyte **) endptr, base); |
771 | 5750 } |
5751 | |
867 | 5752 DECLARE_INLINE_HEADER (int qxeatoi (const Ibyte *string)) |
771 | 5753 { |
2367 | 5754 return atoi ((const Chbyte *) string); |
771 | 5755 } |
5756 | |
1204 | 5757 DECLARE_INLINE_HEADER (Ibyte *qxestrupr (Ibyte *s)) |
5758 { | |
2367 | 5759 return (Ibyte *) strupr ((Chbyte *) s); |
1204 | 5760 } |
5761 | |
5762 DECLARE_INLINE_HEADER (Ibyte *qxestrlwr (Ibyte *s)) | |
5763 { | |
2367 | 5764 return (Ibyte *) strlwr ((Chbyte *) s); |
1204 | 5765 } |
5766 | |
867 | 5767 int qxesprintf (Ibyte *buffer, const CIbyte *format, ...) |
771 | 5768 PRINTF_ARGS (2, 3); |
5769 | |
2367 | 5770 DECLARE_INLINE_HEADER (int qxesscanf_ascii_1 (Ibyte *buffer, |
5771 const Ascbyte *format, | |
5772 void *ptr)) | |
5773 { | |
5774 /* #### DAMNIT! No vsscanf! */ | |
5775 return sscanf ((Chbyte *) buffer, format, ptr); | |
5776 } | |
5777 | |
771 | 5778 /* Do not use POSIX locale routines. Not Mule-correct. */ |
5779 #define qxestrcoll DO NOT USE. | |
5780 #define qxestrxfrm DO NOT USE. | |
5781 | |
867 | 5782 int qxestrcasecmp (const Ibyte *s1, const Ibyte *s2); |
2367 | 5783 int qxestrcasecmp_ascii (const Ibyte *s1, const Ascbyte *s2); |
867 | 5784 int qxestrcasecmp_i18n (const Ibyte *s1, const Ibyte *s2); |
2367 | 5785 int ascii_strcasecmp (const Ascbyte *s1, const Ascbyte *s2); |
4906
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4888
diff
changeset
|
5786 int lisp_strcasecmp_ascii (Lisp_Object s1, Lisp_Object s2); |
771 | 5787 int lisp_strcasecmp_i18n (Lisp_Object s1, Lisp_Object s2); |
867 | 5788 int qxestrncasecmp (const Ibyte *s1, const Ibyte *s2, Bytecount len); |
2367 | 5789 int qxestrncasecmp_ascii (const Ibyte *s1, const Ascbyte *s2, |
5790 Bytecount len); | |
867 | 5791 int qxestrncasecmp_i18n (const Ibyte *s1, const Ibyte *s2, Bytecount len); |
2367 | 5792 int ascii_strncasecmp (const Ascbyte *s1, const Ascbyte *s2, |
771 | 5793 Bytecount len); |
867 | 5794 int qxememcmp (const Ibyte *s1, const Ibyte *s2, Bytecount len); |
5795 int qxememcmp4 (const Ibyte *s1, Bytecount len1, | |
5796 const Ibyte *s2, Bytecount len2); | |
5797 int qxememcasecmp (const Ibyte *s1, const Ibyte *s2, Bytecount len); | |
5798 int qxememcasecmp4 (const Ibyte *s1, Bytecount len1, | |
5799 const Ibyte *s2, Bytecount len2); | |
5800 int qxetextcmp (const Ibyte *s1, Bytecount len1, | |
5801 const Ibyte *s2, Bytecount len2); | |
5802 int qxetextcmp_matching (const Ibyte *s1, Bytecount len1, | |
5803 const Ibyte *s2, Bytecount len2, | |
801 | 5804 Charcount *matching); |
867 | 5805 int qxetextcasecmp (const Ibyte *s1, Bytecount len1, |
5806 const Ibyte *s2, Bytecount len2); | |
5807 int qxetextcasecmp_matching (const Ibyte *s1, Bytecount len1, | |
5808 const Ibyte *s2, Bytecount len2, | |
801 | 5809 Charcount *matching); |
771 | 5810 |
5811 void buffer_mule_signal_inserted_region (struct buffer *buf, Charbpos start, | |
5812 Bytecount bytelength, | |
5813 Charcount charlength); | |
5814 void buffer_mule_signal_deleted_region (struct buffer *buf, Charbpos start, | |
826 | 5815 Charbpos end, Bytebpos byte_start, |
5816 Bytebpos byte_end); | |
771 | 5817 |
2367 | 5818 typedef struct |
5819 { | |
5820 const char *srctext; | |
5821 void *dst; | |
5822 Bytecount dst_size; | |
5823 } alloca_convert_vals; | |
5824 | |
5825 typedef struct | |
5826 { | |
5827 Dynarr_declare (alloca_convert_vals); | |
5828 } alloca_convert_vals_dynarr; | |
5829 | |
5830 extern alloca_convert_vals_dynarr *active_alloca_convert; | |
5831 | |
5832 MODULE_API int find_pos_of_existing_active_alloca_convert (const char * | |
5833 srctext); | |
5834 | |
771 | 5835 /* Defined in unicode.c */ |
1204 | 5836 extern const struct sized_memory_description to_unicode_description; |
5837 extern const struct sized_memory_description from_unicode_description; | |
771 | 5838 void init_charset_unicode_tables (Lisp_Object charset); |
5839 void free_charset_unicode_tables (Lisp_Object charset); | |
5840 void recalculate_unicode_precedence (void); | |
5841 extern Lisp_Object Qunicode; | |
4096 | 5842 extern Lisp_Object Qutf_16, Qutf_8, Qucs_4, Qutf_7, Qutf_32; |
771 | 5843 #ifdef MEMORY_USAGE_STATS |
5844 Bytecount compute_from_unicode_table_size (Lisp_Object charset, | |
5845 struct overhead_stats *stats); | |
5846 Bytecount compute_to_unicode_table_size (Lisp_Object charset, | |
5847 struct overhead_stats *stats); | |
5848 #endif /* MEMORY_USAGE_STATS */ | |
5849 | |
428 | 5850 /* Defined in undo.c */ |
826 | 5851 EXFUN (Fundo_boundary, 0); |
5852 | |
428 | 5853 Lisp_Object truncate_undo_list (Lisp_Object, int, int); |
5854 void record_extent (Lisp_Object, int); | |
665 | 5855 void record_insert (struct buffer *, Charbpos, Charcount); |
5856 void record_delete (struct buffer *, Charbpos, Charcount); | |
5857 void record_change (struct buffer *, Charbpos, Charcount); | |
428 | 5858 |
5859 /* Defined in unex*.c */ | |
814 | 5860 #ifdef WIN32_NATIVE |
867 | 5861 int unexec (Ibyte *, Ibyte *, uintptr_t, uintptr_t, uintptr_t); |
814 | 5862 #else |
5863 int unexec (Extbyte *, Extbyte *, uintptr_t, uintptr_t, uintptr_t); | |
5864 #endif | |
428 | 5865 #ifdef RUN_TIME_REMAP |
5866 int run_time_remap (char *); | |
5867 #endif | |
5868 | |
5869 /* Defined in vm-limit.c */ | |
442 | 5870 void memory_warnings (void *, void (*) (const char *)); |
428 | 5871 |
442 | 5872 /*--------------- prototypes for constant symbols ------------*/ |
5873 | |
826 | 5874 /* #### We should get rid of this and put the prototypes back up there in |
5875 #### the per-file stuff, where they belong. */ | |
5876 | |
771 | 5877 /* Use the following when you have to add a bunch of symbols. */ |
5878 | |
5879 /* | |
5880 | |
5881 (defun redo-symbols (beg end) | |
5882 "Snarf any symbols out of the region and print them into a temporary buffer, | |
5883 which is displayed when the function finishes. The symbols are laid out with | |
5884 `extern Lisp_Object ' before each one, with as many as can fit on one line | |
5885 \(the maximum line width is controlled by the constant `max-line-length' in the | |
5886 code)." | |
5887 (interactive "r") | |
5888 (save-excursion | |
5889 (goto-char beg) | |
5890 (let (syms) | |
5891 (while (re-search-forward "\\s-\\(Q[A-Za-z_0-9]+\\)" end t) | |
5892 (push (match-string 1) syms)) | |
5893 (setq syms (sort syms #'string-lessp)) | |
5894 (with-output-to-temp-buffer "*Symbols*" | |
5895 (let* ((col 0) | |
5896 (start "extern Lisp_Object ") | |
5897 (startlen (length start)) | |
5898 ;; with a default-width frame of 80 chars, you can only fit | |
5899 ;; 79 before wrapping. you can see this to a lower value if | |
5900 ;; you don't want it right up against the right margin. | |
5901 (max-line-length 79)) | |
5902 (dolist (sym syms) | |
5903 (cond (;; if something already on line (this will always be the | |
5904 ;; case except the very first iteration), see what | |
5905 ;; space we've got. (need to take into account 2 | |
5906 ;; for the comma+space, 1 for the semicolon at the | |
5907 ;; end.) if enough space, do it. | |
5908 (and (> col 0) (< (+ col (length sym) 2) | |
5909 (1- max-line-length))) | |
5910 (princ ", ") | |
5911 (princ sym) | |
5912 (incf col 2) | |
5913 (incf col (length sym))) | |
5914 (t | |
5915 ;; either we're first iteration or we ran out of space. | |
5916 ;; if the latter, terminate the previous line. this | |
5917 ;; loop is written on purpose so that it always prints | |
5918 ;; at least one item, even if that would go over. | |
5919 (when (> col 0) | |
5920 (princ ";\n") | |
5921 (setq col 0)) | |
5922 (princ start) | |
5923 (incf col startlen) | |
5924 (princ sym) | |
5925 (incf col (length sym))))) | |
5926 ;; finally terminate the last line. | |
5927 (princ ";\n")))))) | |
5928 | |
5929 */ | |
5930 | |
814 | 5931 extern Lisp_Object Qactivate_menubar_hook, Qand_optional, Qand_rest; |
5932 extern Lisp_Object Qarith_error, Qarrayp, Qautoload, Qbackground; | |
5933 extern Lisp_Object Qbackground_pixmap, Qbeginning_of_buffer, Qbitp, Qblinking; | |
5934 extern Lisp_Object Qbuffer_glyph_p, Qbuffer_live_p, Qbuffer_read_only; | |
5935 extern Lisp_Object Qbyte_code, Qcall_interactively, Qcategory_designator_p; | |
5936 extern Lisp_Object Qcategory_table_value_p, Qcdr, Qchar_or_string_p; | |
5937 extern Lisp_Object Qcharacterp, Qcircular_list, Qcircular_property_list; | |
5938 extern Lisp_Object Qcolor_pixmap_image_instance_p, Qcommandp; | |
5939 extern Lisp_Object Qcompletion_ignore_case, Qconsole_live_p, Qconst_specifier; | |
5940 extern Lisp_Object Qconversion_error, Qcurrent_menubar; | |
771 | 5941 extern Lisp_Object Qcyclic_variable_indirection, Qdefun, Qdevice_live_p, Qdim; |
5942 extern Lisp_Object Qdirection, Qdisabled, Qdisabled_command_hook; | |
930 | 5943 extern Lisp_Object Qdisplay_table, Qdll_error, Qdomain_error, Qediting_error; |
771 | 5944 extern Lisp_Object Qend_of_buffer, Qend_of_file, Qend_open, Qerror; |
5945 extern Lisp_Object Qerror_conditions, Qerror_lacks_explanatory_string; | |
5946 extern Lisp_Object Qerror_message, Qevent_live_p, Qexit, Qextent_live_p; | |
996 | 5947 extern Lisp_Object Qexternal_debugging_output, Qfeaturep, Qfile_error; |
5948 extern Lisp_Object Qfile_name_sans_extension, Qfinal; | |
1111 | 5949 extern Lisp_Object Qforeground, Qformat, Qframe_live_p, Qgraphic; |
771 | 5950 extern Lisp_Object Qgui_error, Qicon_glyph_p, Qidentity, Qinhibit_quit; |
5951 extern Lisp_Object Qinhibit_read_only, Qinteger_char_or_marker_p; | |
1632 | 5952 extern Lisp_Object Qinteger_or_char_p, Qinteger_or_marker_p; |
5953 extern Lisp_Object Qinteractive, Qinternal_error; | |
771 | 5954 extern Lisp_Object Qinvalid_byte_code, Qinvalid_change, Qinvalid_constant; |
5955 extern Lisp_Object Qinvalid_function, Qinvalid_operation; | |
5956 extern Lisp_Object Qinvalid_read_syntax, Qinvalid_state, Qio_error, Qlambda; | |
1111 | 5957 extern Lisp_Object Qlayout, Qlist_formation_error, Qlistp, Qload; |
771 | 5958 extern Lisp_Object Qlong_name, Qmacro, Qmakunbound, Qmalformed_list; |
996 | 5959 extern Lisp_Object Qmalformed_property_list, Qmark, Qmodule; |
771 | 5960 extern Lisp_Object Qmono_pixmap_image_instance_p, Qmouse_leave_buffer_hook; |
5961 extern Lisp_Object Qnative_layout, Qnatnump, Qnetwork_error, Qno_catch; | |
1983 | 5962 extern Lisp_Object Qnonnegativep, Qnothing_image_instance_p; |
5963 extern Lisp_Object Qnumber_char_or_marker_p, Qnumberp, Qout_of_memory; | |
442 | 5964 extern Lisp_Object Qoverflow_error, Qpoint, Qpointer_glyph_p; |
771 | 5965 extern Lisp_Object Qpointer_image_instance_p, Qprint_length; |
563 | 5966 extern Lisp_Object Qprint_string_length, Qprinting_unreadable_object; |
1632 | 5967 extern Lisp_Object Qprogn, Qquit, Qquote, Qrange_error; |
771 | 5968 extern Lisp_Object Qread_char, Qread_from_minibuffer; |
5969 extern Lisp_Object Qreally_early_error_handler, Qregion_beginning; | |
3659 | 5970 extern Lisp_Object Qregion_end, Qregistries, Qreverse_direction_charset; |
771 | 5971 extern Lisp_Object Qrun_hooks, Qsans_modifiers, Qsave_buffers_kill_emacs; |
5972 extern Lisp_Object Qself_insert_command, Qself_insert_defer_undo, Qsequencep; | |
5973 extern Lisp_Object Qset, Qsetting_constant, Qshort_name, Qsingularity_error; | |
5974 extern Lisp_Object Qsound_error, Qstack_overflow, Qstandard_input; | |
5975 extern Lisp_Object Qstandard_output, Qstart_open, Qstring_lessp; | |
5976 extern Lisp_Object Qstructure_formation_error, Qsubwindow; | |
1632 | 5977 extern Lisp_Object Qsubwindow_image_instance_p; |
771 | 5978 extern Lisp_Object Qtext_conversion_error, Qtext_image_instance_p, Qtop_level; |
1632 | 5979 extern Lisp_Object Qtrue_list_p, Qunderflow_error, Qunderline; |
771 | 5980 extern Lisp_Object Quser_files_and_directories, Qvalues; |
5981 extern Lisp_Object Qvariable_documentation, Qvariable_domain, Qvoid_function; | |
5982 extern Lisp_Object Qvoid_variable, Qwindow_live_p, Qwrong_number_of_arguments; | |
442 | 5983 extern Lisp_Object Qwrong_type_argument, Qyes_or_no_p; |
5984 | |
1632 | 5985 extern MODULE_API Lisp_Object Qintegerp, Qinvalid_argument, Qprocess_error; |
5986 extern MODULE_API Lisp_Object Qsyntax_error, Qt, Qunbound; | |
5987 | |
442 | 5988 #define SYMBOL(fou) extern Lisp_Object fou |
1632 | 5989 #define SYMBOL_MODULE_API(fou) extern MODULE_API Lisp_Object fou |
442 | 5990 #define SYMBOL_KEYWORD(la_cle_est_fou) extern Lisp_Object la_cle_est_fou |
5991 #define SYMBOL_GENERAL(tout_le_monde, est_fou) \ | |
5992 extern Lisp_Object tout_le_monde | |
5993 | |
5994 #include "general-slots.h" | |
5995 | |
5996 #undef SYMBOL | |
1632 | 5997 #undef SYMBOL_MODULE_API |
442 | 5998 #undef SYMBOL_KEYWORD |
5999 #undef SYMBOL_GENERAL | |
6000 | |
6001 /*--------------- prototypes for variables of type Lisp_Object ------------*/ | |
6002 | |
826 | 6003 /* #### We should get rid of this and put the prototypes back up there in |
6004 #### the per-file stuff, where they belong. */ | |
6005 | |
446 | 6006 extern Lisp_Object Vactivate_menubar_hook; |
6007 extern Lisp_Object Vautoload_queue, Vblank_menubar; | |
771 | 6008 extern Lisp_Object Vcommand_history; |
428 | 6009 extern Lisp_Object Vcommand_line_args, Vconfigure_info_directory; |
6010 extern Lisp_Object Vconfigure_site_directory, Vconfigure_site_module_directory; | |
6011 extern Lisp_Object Vconsole_list, Vcontrolling_terminal; | |
6012 extern Lisp_Object Vcurrent_compiled_function_annotation, Vcurrent_load_list; | |
6013 extern Lisp_Object Vcurrent_mouse_event, Vcurrent_prefix_arg, Vdata_directory; | |
434 | 6014 extern Lisp_Object Vdirectory_sep_char, Vdisabled_command_hook; |
6015 extern Lisp_Object Vdoc_directory, Vinternal_doc_file_name; | |
428 | 6016 extern Lisp_Object Vecho_area_buffer, Vemacs_major_version; |
6017 extern Lisp_Object Vemacs_minor_version, Vexec_directory, Vexec_path; | |
6018 extern Lisp_Object Vexecuting_macro, Vfeatures, Vfile_domain; | |
1927 | 6019 extern Lisp_Object Vinvocation_directory, Vinvocation_name; |
771 | 6020 extern Lisp_Object Vlast_command, Vlast_command_char; |
428 | 6021 extern Lisp_Object Vlast_command_event, Vlast_input_event; |
2548 | 6022 extern Lisp_Object Vload_file_name_internal, Vload_history; |
428 | 6023 extern Lisp_Object Vload_path, Vmark_even_if_inactive, Vmenubar_configuration; |
6024 extern Lisp_Object Vminibuf_preprompt, Vminibuf_prompt, Vminibuffer_zero; | |
6025 extern Lisp_Object Vmodule_directory, Vmswindows_downcase_file_names; | |
6026 extern Lisp_Object Vmswindows_get_true_file_attributes, Vobarray; | |
6027 extern Lisp_Object Vprint_length, Vprint_level, Vprocess_environment; | |
6028 extern Lisp_Object Vrecent_keys_ring, Vshell_file_name, Vsite_directory; | |
6029 extern Lisp_Object Vsite_module_directory; | |
6030 extern Lisp_Object Vstandard_input, Vstandard_output, Vstdio_str; | |
771 | 6031 extern Lisp_Object Vsynchronous_sounds, Vsystem_name; |
428 | 6032 extern Lisp_Object Vthis_command_keys, Vunread_command_event; |
6033 extern Lisp_Object Vx_initial_argv_list; | |
6034 | |
1927 | 6035 extern MODULE_API Lisp_Object Vinhibit_quit, Vquit_flag; |
6036 | |
1743 | 6037 END_C_DECLS |
1650 | 6038 |
440 | 6039 #endif /* INCLUDED_lisp_h_ */ |