comparison src/lisp.h @ 1333:1b0339b048ce

[xemacs-hg @ 2003-03-02 09:38:37 by ben] To: xemacs-patches@xemacs.org PROBLEMS: Include nt/PROBLEMS and update. Add note about incremental linking badness. cmdloop.el, custom.el, dumped-lisp.el, files.el, keydefs.el, keymap.el, lisp-mode.el, make-docfile.el, replace.el, simple.el, subr.el, view-less.el, wid-edit.el: Lots of syncing with FSF 21.2. Use if-fboundp in wid-edit.el. New file newcomment.el from FSF. internals/internals.texi: Fix typo. (Build-Time Dependencies): New node. PROBLEMS: Delete. config.inc.samp, xemacs.mak: Eliminate HAVE_VC6, use SUPPORT_EDIT_AND_CONTINUE in its place. No incremental linking unless SUPPORT_EDIT_AND_CONTINUE, since it can cause nasty crashes in pdump. Put warnings about this in config.inc.samp. Report the full compile flags used for src and lib-src in the Installation output. alloc.c, lisp.h, ralloc.c, regex.c: Use ALLOCA() in regex.c to avoid excessive stack allocation. Also fix subtle problem with REL_ALLOC() -- any call to malloc() (direct or indirect) may relocate rel-alloced data, causing buffer text to shift. After any such call, regex must update all its pointers to such data. Add a system, when ERROR_CHECK_MALLOC, whereby regex.c indicates all the places it is prepared to handle malloc()/realloc()/free(), and any calls anywhere in XEmacs outside of this will trigger an abort. alloc.c, dialog-msw.c, eval.c, event-stream.c, general-slots.h, insdel.c, lisp.h, menubar-msw.c, menubar-x.c: Change *run_hook*_trapping_problems to take a warning class, not a string. Factor out code to issue warnings, add flag to call_trapping_problems() to postpone warning issue, and make *run_hook*_trapping_problems issue their own warnings tailored to the hook, postponed in the case of safe_run_hook_trapping_problems() so that the appropriate message can be issued about resetting to nil only when not `quit'. Make record_unwind_protect_restoring_int() non-static. dumper.c: Issue notes about incremental linking problems under Windows. fileio.c: Mule-ize encrypt/decrypt-string code. text.h: Spacing changes.
author ben
date Sun, 02 Mar 2003 09:38:54 +0000
parents b531bf8658e9
children 01c57eb70ae9
comparison
equal deleted inserted replaced
1332:6aa23bb3da6b 1333:1b0339b048ce
1143 #define MAX_FUNCALLS_BETWEEN_ALLOCA_CLEANUP 10 1143 #define MAX_FUNCALLS_BETWEEN_ALLOCA_CLEANUP 10
1144 1144
1145 extern Bytecount __temp_alloca_size__; 1145 extern Bytecount __temp_alloca_size__;
1146 extern Bytecount funcall_alloca_count; 1146 extern Bytecount funcall_alloca_count;
1147 1147
1148 #ifdef ERROR_CHECK_MALLOC
1149 extern int regex_malloc_disallowed;
1150 #define REGEX_MALLOC_CHECK() assert (!regex_malloc_disallowed)
1151 #else
1152 #define REGEX_MALLOC_CHECK() ((void) 0)
1153 #endif
1154
1148 /* Do stack or heap alloca() depending on size. 1155 /* Do stack or heap alloca() depending on size.
1149 1156
1150 NOTE: The use of a global temporary like this is unsafe if ALLOCA() occurs 1157 NOTE: The use of a global temporary like this is unsafe if ALLOCA() occurs
1151 twice anywhere in the same expression; but that seems highly unlikely. The 1158 twice anywhere in the same expression; but that seems highly unlikely. The
1152 alternative is to force all callers to declare a local temporary if the 1159 alternative is to force all callers to declare a local temporary if the
1153 expression has side effects -- something easy to forget. */ 1160 expression has side effects -- something easy to forget. */
1154 1161
1155 #define ALLOCA(size) \ 1162 #define ALLOCA(size) \
1156 (__temp_alloca_size__ = (size), \ 1163 (REGEX_MALLOC_CHECK (), \
1164 __temp_alloca_size__ = (size), \
1157 __temp_alloca_size__ > MAX_ALLOCA_VS_C_ALLOCA ? \ 1165 __temp_alloca_size__ > MAX_ALLOCA_VS_C_ALLOCA ? \
1158 xemacs_c_alloca (__temp_alloca_size__) : \ 1166 xemacs_c_alloca (__temp_alloca_size__) : \
1159 (need_to_check_c_alloca ? xemacs_c_alloca (0) : 0, \ 1167 (need_to_check_c_alloca ? xemacs_c_alloca (0) : 0, \
1160 alloca (__temp_alloca_size__))) 1168 alloca (__temp_alloca_size__)))
1161 1169
1170 1178
1171 /* WARNING: If you use this, you must unbind_to() at the end of your 1179 /* WARNING: If you use this, you must unbind_to() at the end of your
1172 function! */ 1180 function! */
1173 1181
1174 #define MALLOC_OR_ALLOCA(size) \ 1182 #define MALLOC_OR_ALLOCA(size) \
1175 (__temp_alloca_size__ = (size), \ 1183 (REGEX_MALLOC_CHECK (), \
1184 __temp_alloca_size__ = (size), \
1176 __temp_alloca_size__ > MAX_ALLOCA_VS_MALLOC ? \ 1185 __temp_alloca_size__ > MAX_ALLOCA_VS_MALLOC ? \
1177 xmalloc_and_record_unwind (__temp_alloca_size__) : \ 1186 xmalloc_and_record_unwind (__temp_alloca_size__) : \
1178 (need_to_check_c_alloca ? xemacs_c_alloca (0) : 0, \ 1187 (need_to_check_c_alloca ? xemacs_c_alloca (0) : 0, \
1179 alloca (__temp_alloca_size__))) 1188 alloca (__temp_alloca_size__)))
1180 1189
1185 macro will realloc BASEVAR as necessary so that it can hold at 1194 macro will realloc BASEVAR as necessary so that it can hold at
1186 least NEEDED_SIZE objects. The reallocing is done by doubling, 1195 least NEEDED_SIZE objects. The reallocing is done by doubling,
1187 which ensures constant amortized time per element. */ 1196 which ensures constant amortized time per element. */
1188 #define DO_REALLOC(basevar, sizevar, needed_size, type) do { \ 1197 #define DO_REALLOC(basevar, sizevar, needed_size, type) do { \
1189 Bytecount do_realloc_needed_size = (needed_size); \ 1198 Bytecount do_realloc_needed_size = (needed_size); \
1199 REGEX_MALLOC_CHECK (); \
1190 if ((sizevar) < do_realloc_needed_size) \ 1200 if ((sizevar) < do_realloc_needed_size) \
1191 { \ 1201 { \
1192 if ((sizevar) < 32) \ 1202 if ((sizevar) < 32) \
1193 (sizevar) = 32; \ 1203 (sizevar) = 32; \
1194 while ((sizevar) < do_realloc_needed_size) \ 1204 while ((sizevar) < do_realloc_needed_size) \
3558 int marked_p (Lisp_Object obj); 3568 int marked_p (Lisp_Object obj);
3559 extern int funcall_allocation_flag; 3569 extern int funcall_allocation_flag;
3560 extern int need_to_garbage_collect; 3570 extern int need_to_garbage_collect;
3561 extern int need_to_check_c_alloca; 3571 extern int need_to_check_c_alloca;
3562 extern int need_to_signal_post_gc; 3572 extern int need_to_signal_post_gc;
3563 extern Lisp_Object Qpost_gc_hook; 3573 extern Lisp_Object Qpost_gc_hook, Qgarbage_collecting;
3564 void recompute_funcall_allocation_flag (void); 3574 void recompute_funcall_allocation_flag (void);
3565 3575
3566 #ifdef MEMORY_USAGE_STATS 3576 #ifdef MEMORY_USAGE_STATS
3567 Bytecount malloced_storage_size (void *, Bytecount, struct overhead_stats *); 3577 Bytecount malloced_storage_size (void *, Bytecount, struct overhead_stats *);
3568 Bytecount fixed_type_block_overhead (Bytecount); 3578 Bytecount fixed_type_block_overhead (Bytecount);
4036 #define INHIBIT_CHARSET_CREATION (1<<12) 4046 #define INHIBIT_CHARSET_CREATION (1<<12)
4037 #define INHIBIT_EXISTING_BUFFER_TEXT_MODIFICATION (1<<13) 4047 #define INHIBIT_EXISTING_BUFFER_TEXT_MODIFICATION (1<<13)
4038 #define INHIBIT_ANY_CHANGE_AFFECTING_REDISPLAY (1<<14) 4048 #define INHIBIT_ANY_CHANGE_AFFECTING_REDISPLAY (1<<14)
4039 #define INHIBIT_ENTERING_DEBUGGER (1<<15) 4049 #define INHIBIT_ENTERING_DEBUGGER (1<<15)
4040 #define CALL_WITH_SUSPENDED_ERRORS (1<<16) 4050 #define CALL_WITH_SUSPENDED_ERRORS (1<<16)
4051 #define POSTPONE_WARNING_ISSUE (1<<17)
4041 4052
4042 enum check_allowed_operation 4053 enum check_allowed_operation
4043 { 4054 {
4044 OPERATION_DELETE_OBJECT, 4055 OPERATION_DELETE_OBJECT,
4045 OPERATION_CREATE_OBJECT, 4056 OPERATION_CREATE_OBJECT,
4084 Lisp_Object call5_trapping_problems (const char *, Lisp_Object, Lisp_Object, 4095 Lisp_Object call5_trapping_problems (const char *, Lisp_Object, Lisp_Object,
4085 Lisp_Object, Lisp_Object, Lisp_Object, 4096 Lisp_Object, Lisp_Object, Lisp_Object,
4086 Lisp_Object, int); 4097 Lisp_Object, int);
4087 Lisp_Object eval_in_buffer_trapping_problems (const char *, struct buffer *, 4098 Lisp_Object eval_in_buffer_trapping_problems (const char *, struct buffer *,
4088 Lisp_Object, int); 4099 Lisp_Object, int);
4089 Lisp_Object run_hook_trapping_problems (const char *, Lisp_Object, int); 4100 Lisp_Object run_hook_trapping_problems (Lisp_Object, Lisp_Object, int);
4090 Lisp_Object safe_run_hook_trapping_problems (const char *, Lisp_Object, int); 4101 Lisp_Object safe_run_hook_trapping_problems (Lisp_Object, Lisp_Object, int);
4091 Lisp_Object run_hook_with_args_in_buffer_trapping_problems (const char 4102 Lisp_Object run_hook_with_args_in_buffer_trapping_problems (Lisp_Object,
4092 *warning_string, 4103 struct buffer *,
4093 struct buffer 4104 int nargs,
4094 *buf, int nargs,
4095 Lisp_Object *args, 4105 Lisp_Object *args,
4096 enum 4106 enum
4097 run_hooks_condition 4107 run_hooks_condition
4098 cond, int flags); 4108 cond, int flags);
4099 Lisp_Object run_hook_with_args_trapping_problems (const char *warning_string, 4109 Lisp_Object run_hook_with_args_trapping_problems (Lisp_Object,
4100 int nargs, 4110 int nargs,
4101 Lisp_Object *args, 4111 Lisp_Object *args,
4102 enum run_hooks_condition 4112 enum run_hooks_condition
4103 cond, 4113 cond,
4104 int flags); 4114 int flags);
4105 Lisp_Object va_run_hook_with_args_trapping_problems (const char 4115 Lisp_Object va_run_hook_with_args_trapping_problems (Lisp_Object,
4106 *warning_string,
4107 Lisp_Object hook_var, 4116 Lisp_Object hook_var,
4108 int nargs, ...); 4117 int nargs, ...);
4109 Lisp_Object va_run_hook_with_args_in_buffer_trapping_problems (const char 4118 Lisp_Object va_run_hook_with_args_in_buffer_trapping_problems (Lisp_Object,
4110 *warning_string, 4119 struct buffer *,
4111 struct buffer 4120 Lisp_Object,
4112 *buf,
4113 Lisp_Object
4114 hook_var,
4115 int nargs, ...); 4121 int nargs, ...);
4116 Lisp_Object call_with_suspended_errors (lisp_fn_t, Lisp_Object, 4122 Lisp_Object call_with_suspended_errors (lisp_fn_t, Lisp_Object,
4117 Lisp_Object, 4123 Lisp_Object,
4118 Error_Behavior, int, ...); 4124 Error_Behavior, int, ...);
4119 /* C Code should be using internal_catch, record_unwind_p, condition_case_1 */ 4125 /* C Code should be using internal_catch, record_unwind_p, condition_case_1 */
4131 #define unbind_to(obj) unbind_to_1 (obj, Qnil) 4137 #define unbind_to(obj) unbind_to_1 (obj, Qnil)
4132 void specbind (Lisp_Object, Lisp_Object); 4138 void specbind (Lisp_Object, Lisp_Object);
4133 int record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object); 4139 int record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object);
4134 int record_unwind_protect_freeing (void *ptr); 4140 int record_unwind_protect_freeing (void *ptr);
4135 int record_unwind_protect_freeing_dynarr (void *ptr); 4141 int record_unwind_protect_freeing_dynarr (void *ptr);
4142 int record_unwind_protect_restoring_int (int *addr, int val);
4136 int internal_bind_int (int *addr, int newval); 4143 int internal_bind_int (int *addr, int newval);
4137 int internal_bind_lisp_object (Lisp_Object *addr, Lisp_Object newval); 4144 int internal_bind_lisp_object (Lisp_Object *addr, Lisp_Object newval);
4138 void do_autoload (Lisp_Object, Lisp_Object); /* GCPROs both arguments */ 4145 void do_autoload (Lisp_Object, Lisp_Object); /* GCPROs both arguments */
4139 Lisp_Object un_autoload (Lisp_Object); 4146 Lisp_Object un_autoload (Lisp_Object);
4140 void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object); 4147 void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object);