From cf4bb06de4057d96fb1725615e5cf2c288fc3199 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 19 Mar 2013 18:09:05 +0400 Subject: * print.c (syms_of_print): Initialize debugging output not here... (init_print_once): ...but in a new function here. * lisp.h (init_print_once): Add prototype. * emacs.c (main): Add call to init_print_once. Adjust comments. --- src/lisp.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/lisp.h') diff --git a/src/lisp.h b/src/lisp.h index b2ab5684d4d..f526cd36a6f 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3163,6 +3163,7 @@ extern Lisp_Object internal_with_output_to_temp_buffer (const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object); enum FLOAT_TO_STRING_BUFSIZE { FLOAT_TO_STRING_BUFSIZE = 350 }; extern int float_to_string (char *, double); +extern void init_print_once (void); extern void syms_of_print (void); /* Defined in doprnt.c. */ -- cgit v1.2.1 From 7b1123d824e51d40496c242e7a7f173de8936100 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 21 Mar 2013 13:56:22 -0700 Subject: Use functions and constants to manipulate Lisp_Save_Value objects. This replaces code that used macros and strings and token-pasting. The change makes the C source a bit easier to follow, and shrinks the Emacs executable a bit. * alloc.c: Verify some properties of Lisp_Save_Value's representation. (make_save_value): Change 1st arg from string to enum. All callers changed. (INTX): Remove. (mark_object): Use if, not #if, for GC_MARK_STACK. * lisp.h (SAVE_VALUEP, XSAVE_VALUE, XSAVE_POINTER, XSAVE_INTEGER) (XSAVE_OBJECT): Now functions, not macros. (STRING_BYTES_BOUND): Now just a macro, not a constant too; the constant was never used. (SAVE_SLOT_BITS, SAVE_VALUE_SLOTS, SAVE_TYPE_BITS, SAVE_TYPE_INT_INT) (SAVE_TYPE_INT_INT_INT, SAVE_TYPE_OBJ_OBJ, SAVE_TYPE_OBJ_OBJ_OBJ) (SAVE_TYPE_OBJ_OBJ_OBJ_OBJ, SAVE_TYPE_PTR_INT, SAVE_TYPE_PTR_OBJ) (SAVE_TYPE_PTR_PTR, SAVE_TYPE_PTR_PTR_OBJ, SAVE_TYPE_MEMORY): New constants. (struct Lisp_Save_Value): Replace members area, type0, type1, type2, type3 with a single member save_type. All uses changed. (save_type, set_save_pointer, set_save_integer): New functions. * print.c (PRINTX): Remove. --- src/lisp.h | 153 +++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 109 insertions(+), 44 deletions(-) (limited to 'src/lisp.h') diff --git a/src/lisp.h b/src/lisp.h index f526cd36a6f..6838d4a93cb 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -551,6 +551,12 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) return num < lower ? lower : num <= upper ? num : upper; } + +/* Forward declarations. */ + +LISP_INLINE bool SAVE_VALUEP (Lisp_Object); +LISP_INLINE struct Lisp_Save_Value *XSAVE_VALUE (Lisp_Object); + /* Extract a value or address from a Lisp_Object. */ #define XCONS(a) (eassert (CONSP (a)), \ @@ -571,7 +577,6 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) #define XMISCTYPE(a) (XMISCANY (a)->type) #define XMARKER(a) (eassert (MARKERP (a)), &(XMISC (a)->u_marker)) #define XOVERLAY(a) (eassert (OVERLAYP (a)), &(XMISC (a)->u_overlay)) -#define XSAVE_VALUE(a) (eassert (SAVE_VALUEP (a)), &(XMISC (a)->u_save_value)) /* Forwarding object types. */ @@ -781,13 +786,10 @@ extern ptrdiff_t string_bytes (struct Lisp_String *); would expose alloc.c internal details that we'd rather keep private. - This is a macro for use in static initializers, and a constant for - visibility to GDB. The cast to ptrdiff_t ensures that - the macro is signed. */ -static ptrdiff_t const STRING_BYTES_BOUND = + This is a macro for use in static initializers. The cast to + ptrdiff_t ensures that the macro is signed. */ #define STRING_BYTES_BOUND \ ((ptrdiff_t) min (MOST_POSITIVE_FIXNUM, min (SIZE_MAX, PTRDIFF_MAX) - 1)) - STRING_BYTES_BOUND; /* Mark STR as a unibyte string. */ #define STRING_SET_UNIBYTE(STR) \ @@ -1392,6 +1394,35 @@ enum SAVE_OBJECT }; +/* Number of bits needed to store one of the above values. */ +enum { SAVE_SLOT_BITS = 2 }; + +/* Number of slots in a save value where save_type is nonzero. */ +enum { SAVE_VALUE_SLOTS = 4 }; + +/* Bit-width and values for struct Lisp_Save_Value's save_type member. */ + +enum { SAVE_TYPE_BITS = SAVE_VALUE_SLOTS * SAVE_SLOT_BITS + 1 }; + +enum Lisp_Save_Type + { + SAVE_TYPE_INT_INT = SAVE_INTEGER + (SAVE_INTEGER << SAVE_SLOT_BITS), + SAVE_TYPE_INT_INT_INT + = (SAVE_INTEGER + (SAVE_TYPE_INT_INT << SAVE_SLOT_BITS)), + SAVE_TYPE_OBJ_OBJ = SAVE_OBJECT + (SAVE_OBJECT << SAVE_SLOT_BITS), + SAVE_TYPE_OBJ_OBJ_OBJ = SAVE_OBJECT + (SAVE_TYPE_OBJ_OBJ << SAVE_SLOT_BITS), + SAVE_TYPE_OBJ_OBJ_OBJ_OBJ + = SAVE_OBJECT + (SAVE_TYPE_OBJ_OBJ_OBJ << SAVE_SLOT_BITS), + SAVE_TYPE_PTR_INT = SAVE_POINTER + (SAVE_INTEGER << SAVE_SLOT_BITS), + SAVE_TYPE_PTR_OBJ = SAVE_POINTER + (SAVE_OBJECT << SAVE_SLOT_BITS), + SAVE_TYPE_PTR_PTR = SAVE_POINTER + (SAVE_POINTER << SAVE_SLOT_BITS), + SAVE_TYPE_PTR_PTR_OBJ + = SAVE_POINTER + (SAVE_TYPE_PTR_OBJ << SAVE_SLOT_BITS), + + /* This has an extra bit indicating it's raw memory. */ + SAVE_TYPE_MEMORY = SAVE_TYPE_PTR_INT + (1 << (SAVE_TYPE_BITS - 1)) + }; + /* Special object used to hold a different values for later use. This is mostly used to package C integers and pointers to call @@ -1412,73 +1443,96 @@ enum If yon need to pass more than just one C pointer, you should use make_save_value. This function allows you to pack up to - 4 integers, pointers or Lisp_Objects and conveniently get them - back with XSAVE_POINTER, XSAVE_INTEGER and XSAVE_OBJECT macros: + SAVE_VALUE_SLOTS integers, pointers or Lisp_Objects and + conveniently get them back with XSAVE_POINTER, XSAVE_INTEGER and + XSAVE_OBJECT macros: ... struct my_data *md = get_my_data (); - ptrdiff_t my_offset = get_my_offset (); Lisp_Object my_object = get_my_object (); record_unwind_protect - (my_unwind, make_save_value ("pio", md, my_offset, my_object)); + (my_unwind, make_save_value (SAVE_TYPE_PTR_OBJ, md, my_object)); ... Lisp_Object my_unwind (Lisp_Object arg) { struct my_data *md = XSAVE_POINTER (arg, 0); - ptrdiff_t my_offset = XSAVE_INTEGER (arg, 1); - Lisp_Object my_object = XSAVE_OBJECT (arg, 2); + Lisp_Object my_object = XSAVE_OBJECT (arg, 1); ... } If ENABLE_CHECKING is in effect, XSAVE_xxx macros do type checking of the saved objects and raise eassert if type of the saved object doesn't match the type which is extracted. In the example above, XSAVE_INTEGER (arg, 2) - or XSAVE_OBJECT (arg, 1) are wrong because integer was saved in slot 1 and - Lisp_Object was saved in slot 2 of ARG. */ + or XSAVE_OBJECT (arg, 0) are wrong because nothing was saved in slot 2 and + Lisp_Object was saved in slot 1 of ARG. */ struct Lisp_Save_Value { ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Save_Value */ unsigned gcmarkbit : 1; - int spacer : 6; - /* If `area' is nonzero, `data[0].pointer' is the address of a memory area - containing `data[1].integer' potential Lisp_Objects. The rest of `data' - fields are unused. */ - unsigned area : 1; - /* If `area' is zero, `data[N]' may hold different objects which type is - encoded in `typeN' fields as described by the anonymous enum above. - E.g. if `type0' is SAVE_INTEGER, `data[0].integer' is in use. */ - unsigned type0 : 2; - unsigned type1 : 2; - unsigned type2 : 2; - unsigned type3 : 2; + int spacer : 32 - (16 + 1 + SAVE_TYPE_BITS); + + /* DATA[N] may hold up to SAVE_VALUE_SLOTS entries. The type of + V's Ith entry is given by save_type (V, I). E.g., if save_type + (V, 3) == SAVE_INTEGER, V->data[3].integer is in use. + + If SAVE_TYPE == SAVE_TYPE_MEMORY, DATA[0].pointer is the address of + a memory area containing DATA[1].integer potential Lisp_Objects. */ + ENUM_BF (Lisp_Save_Type) save_type : SAVE_TYPE_BITS; union { void *pointer; ptrdiff_t integer; Lisp_Object object; - } data[4]; + } data[SAVE_VALUE_SLOTS]; }; -/* Macro to set and extract Nth saved pointer. Type - checking is ugly because it's used as an lvalue. */ +/* Return the type of V's Nth saved value. */ +LISP_INLINE int +save_type (struct Lisp_Save_Value *v, int n) +{ + eassert (0 <= n && n < SAVE_VALUE_SLOTS); + return (v->save_type >> (SAVE_SLOT_BITS * n) & ((1 << SAVE_SLOT_BITS) - 1)); +} + +/* Get and set the Nth saved pointer. */ -#define XSAVE_POINTER(obj, n) \ - XSAVE_VALUE (obj)->data[(eassert (XSAVE_VALUE (obj)->type \ - ## n == SAVE_POINTER), n)].pointer +LISP_INLINE void * +XSAVE_POINTER (Lisp_Object obj, int n) +{ + eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_POINTER); + return XSAVE_VALUE (obj)->data[n].pointer;; +} +LISP_INLINE void +set_save_pointer (Lisp_Object obj, int n, void *val) +{ + eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_POINTER); + XSAVE_VALUE (obj)->data[n].pointer = val; +} /* Likewise for the saved integer. */ -#define XSAVE_INTEGER(obj, n) \ - XSAVE_VALUE (obj)->data[(eassert (XSAVE_VALUE (obj)->type \ - ## n == SAVE_INTEGER), n)].integer +LISP_INLINE ptrdiff_t +XSAVE_INTEGER (Lisp_Object obj, int n) +{ + eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_INTEGER); + return XSAVE_VALUE (obj)->data[n].integer; +} +LISP_INLINE void +set_save_integer (Lisp_Object obj, int n, ptrdiff_t val) +{ + eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_INTEGER); + XSAVE_VALUE (obj)->data[n].integer = val; +} -/* Macro to extract Nth saved object. This is never used as - an lvalue, so we can do more convenient type checking. */ +/* Extract Nth saved object. */ -#define XSAVE_OBJECT(obj, n) \ - (eassert (XSAVE_VALUE (obj)->type ## n == SAVE_OBJECT), \ - XSAVE_VALUE (obj)->data[n].object) +LISP_INLINE Lisp_Object +XSAVE_OBJECT (Lisp_Object obj, int n) +{ + eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_OBJECT); + return XSAVE_VALUE (obj)->data[n].object; +} /* A miscellaneous object, when it's on the free list. */ struct Lisp_Free @@ -1501,6 +1555,13 @@ union Lisp_Misc struct Lisp_Save_Value u_save_value; }; +LISP_INLINE struct Lisp_Save_Value * +XSAVE_VALUE (Lisp_Object a) +{ + eassert (SAVE_VALUEP (a)); + return & XMISC (a)->u_save_value; +} + /* Forwarding pointer to an int variable. This is allowed only in the value cell of a symbol, and it means that the symbol's value really lives in the @@ -1786,7 +1847,12 @@ typedef struct { #define VECTORP(x) (VECTORLIKEP (x) && !(ASIZE (x) & PSEUDOVECTOR_FLAG)) #define OVERLAYP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay) #define MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker) -#define SAVE_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Save_Value) + +LISP_INLINE bool +SAVE_VALUEP (Lisp_Object x) +{ + return MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Save_Value; +} #define AUTOLOADP(x) (CONSP (x) && EQ (Qautoload, XCAR (x))) @@ -3105,7 +3171,7 @@ extern bool abort_on_gc; extern Lisp_Object make_float (double); extern void display_malloc_warning (void); extern ptrdiff_t inhibit_garbage_collection (void); -extern Lisp_Object make_save_value (const char *, ...); +extern Lisp_Object make_save_value (enum Lisp_Save_Type, ...); extern Lisp_Object make_save_pointer (void *); extern Lisp_Object build_overlay (Lisp_Object, Lisp_Object, Lisp_Object); extern void free_marker (Lisp_Object); @@ -3822,8 +3888,7 @@ extern void *record_xmalloc (size_t); { \ Lisp_Object arg_; \ buf = xmalloc ((nelt) * word_size); \ - arg_ = make_save_value ("pi", buf, nelt); \ - XSAVE_VALUE (arg_)->area = 1; \ + arg_ = make_save_value (SAVE_TYPE_MEMORY, buf, nelt); \ sa_must_free = 1; \ record_unwind_protect (safe_alloca_unwind, arg_); \ } \ -- cgit v1.2.1 From b5b7745f1fde7cdd5fb76113a56b9d3c39ffffc8 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 Mar 2013 11:01:14 +0200 Subject: Fix bug #14032 with restoring frame dimensions on MS-Windows. src/w32term.c (w32fullscreen_hook): Record last value of the frame's 'fullscreen' parameter. Always record previous width and height of the frame, except when switching out of maximized modes, so that they could be restored correctly, instead of resetting to the default frame dimensions. Send SC_RESTORE command to the frame, unless we are going to send SC_MAXIMIZE, to restore the frame resize hints in the mouse pointer shown by the window manager. src/frame.c (get_frame_param): Now extern for WINDOWSNT as well. src/lisp.h (get_frame_param): Adjust conditions for prototype declaration. --- src/lisp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lisp.h') diff --git a/src/lisp.h b/src/lisp.h index 6838d4a93cb..467710f52f4 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3511,7 +3511,7 @@ extern Lisp_Object Qvisible; extern void store_frame_param (struct frame *, Lisp_Object, Lisp_Object); extern void store_in_alist (Lisp_Object *, Lisp_Object, Lisp_Object); extern Lisp_Object do_switch_frame (Lisp_Object, int, int, Lisp_Object); -#if HAVE_NS +#if HAVE_NS || defined(WINDOWSNT) extern Lisp_Object get_frame_param (struct frame *, Lisp_Object); #endif extern void frames_discard_buffer (Lisp_Object); -- cgit v1.2.1 From 908589fd28437a9b0995b103e22ce5e4d421eb8a Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sun, 24 Mar 2013 13:59:45 +0100 Subject: Reorder conditions that are written backwards * alloc.c (xpalloc, Fgarbage_collect): Reorder conditions that are written backwards. * blockinput.h (input_blocked_p): Likewise. * bytecode.c (exec_byte_code): Likewise. * callproc.c (call_process_kill, call_process_cleanup) (Fcall_process): Likewise. * ccl.c (ccl_driver, resolve_symbol_ccl_program) (Fccl_execute_on_string): Likewise. * character.c (string_escape_byte8): Likewise. * charset.c (read_hex): Likewise. * cm.c (calccost): Likewise. * data.c (cons_to_unsigned): Likewise. * dired.c (directory_files_internal, file_name_completion): Likewise. * dispnew.c (scrolling_window, update_frame_1, Fsleep_for) (sit_for): Likewise. * doc.c (Fsubstitute_command_keys): Likewise. * doprnt.c (doprnt): Likewise. * editfns.c (hi_time, decode_time_components, Fformat): Likewise. * emacsgtkfixed.c: Likewise. * fileio.c (file_offset, Fwrite_region): Likewise. * floatfns.c (Fexpt, fmod_float): Likewise. * fns.c (larger_vector, make_hash_table, Fmake_hash_table): Likewise. * font.c (font_intern_prop): Likewise. * frame.c (x_set_alpha): Likewise. * gtkutil.c (get_utf8_string): Likewise. * indent.c (check_display_width): Likewise. * intervals.c (create_root_interval, rotate_right, rotate_left) (split_interval_right, split_interval_left) (adjust_intervals_for_insertion, delete_node) (interval_deletion_adjustment, adjust_intervals_for_deletion) (merge_interval_right, merge_interval_left, copy_intervals) (set_intervals_multibyte_1): Likewise. * keyboard.c (gobble_input, append_tool_bar_item): Likewise. * keymap.c (Fkey_description): Likewise. * lisp.h (FIXNUM_OVERFLOW_P, vcopy): Likewise. * lread.c (openp, read_integer, read1, string_to_number): Likewise. * menu.c (ensure_menu_items): Likewise. * minibuf.c (read_minibuf_noninteractive): Likewise. * print.c (printchar, strout): Likewise. * process.c (create_process, Faccept_process_output) (wait_reading_process_output, read_process_output, send_process) (wait_reading_process_output): Likewise. * profiler.c (make_log, handle_profiler_signal): Likewise. * regex.c (re_exec): Likewise. * regex.h: Likewise. * search.c (looking_at_1, Freplace_match): Likewise. * sysdep.c (get_child_status, procfs_ttyname) (procfs_get_total_memory): Likewise. * systime.h (EMACS_TIME_VALID_P): Likewise. * term.c (dissociate_if_controlling_tty): Likewise. * window.c (get_phys_cursor_glyph): Likewise. * xdisp.c (init_iterator, redisplay_internal, redisplay_window) (try_window_reusing_current_matrix, try_window_id, pint2hrstr): Likewise. * xfns.c (Fx_window_property): Likewise. * xmenu.c (set_frame_menubar): Likewise. * xselect.c (x_get_window_property, x_handle_dnd_message): Likewise. * xsmfns.c (smc_save_yourself_CB): Likewise. * xterm.c (x_scroll_bar_set_handle): Likewise. --- src/lisp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lisp.h') diff --git a/src/lisp.h b/src/lisp.h index 467710f52f4..897addc90c1 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -543,7 +543,7 @@ static EMACS_INT const VALMASK type or if I is a NaN. */ #define FIXNUM_OVERFLOW_P(i) \ - (! ((0 <= (i) || MOST_NEGATIVE_FIXNUM <= (i)) && (i) <= MOST_POSITIVE_FIXNUM)) + (! (((i) >= 0 || (i) >= MOST_NEGATIVE_FIXNUM) && (i) <= MOST_POSITIVE_FIXNUM)) LISP_INLINE ptrdiff_t clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) @@ -2565,7 +2565,7 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val) LISP_INLINE void vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count) { - eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v)); + eassert (offset >= 0 && count >= 0 && offset + count <= ASIZE (v)); memcpy (XVECTOR (v)->contents + offset, args, count * sizeof *args); } -- cgit v1.2.1 From 717b8bcd964f55cb509711149ad112deca36c2a7 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 28 Mar 2013 12:21:38 -0400 Subject: * src/lisp.h (save_type, XSAVE_POINTER, set_save_pointer, XSAVE_INTEGER) (set_save_integer, XSAVE_OBJECT, XSAVE_VALUE): Move to avoid forward references. --- src/lisp.h | 113 +++++++++++++++++++++++++++++-------------------------------- 1 file changed, 54 insertions(+), 59 deletions(-) (limited to 'src/lisp.h') diff --git a/src/lisp.h b/src/lisp.h index 897addc90c1..4481a2e3373 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -552,11 +552,6 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) } -/* Forward declarations. */ - -LISP_INLINE bool SAVE_VALUEP (Lisp_Object); -LISP_INLINE struct Lisp_Save_Value *XSAVE_VALUE (Lisp_Object); - /* Extract a value or address from a Lisp_Object. */ #define XCONS(a) (eassert (CONSP (a)), \ @@ -1487,53 +1482,6 @@ struct Lisp_Save_Value } data[SAVE_VALUE_SLOTS]; }; -/* Return the type of V's Nth saved value. */ -LISP_INLINE int -save_type (struct Lisp_Save_Value *v, int n) -{ - eassert (0 <= n && n < SAVE_VALUE_SLOTS); - return (v->save_type >> (SAVE_SLOT_BITS * n) & ((1 << SAVE_SLOT_BITS) - 1)); -} - -/* Get and set the Nth saved pointer. */ - -LISP_INLINE void * -XSAVE_POINTER (Lisp_Object obj, int n) -{ - eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_POINTER); - return XSAVE_VALUE (obj)->data[n].pointer;; -} -LISP_INLINE void -set_save_pointer (Lisp_Object obj, int n, void *val) -{ - eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_POINTER); - XSAVE_VALUE (obj)->data[n].pointer = val; -} - -/* Likewise for the saved integer. */ - -LISP_INLINE ptrdiff_t -XSAVE_INTEGER (Lisp_Object obj, int n) -{ - eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_INTEGER); - return XSAVE_VALUE (obj)->data[n].integer; -} -LISP_INLINE void -set_save_integer (Lisp_Object obj, int n, ptrdiff_t val) -{ - eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_INTEGER); - XSAVE_VALUE (obj)->data[n].integer = val; -} - -/* Extract Nth saved object. */ - -LISP_INLINE Lisp_Object -XSAVE_OBJECT (Lisp_Object obj, int n) -{ - eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_OBJECT); - return XSAVE_VALUE (obj)->data[n].object; -} - /* A miscellaneous object, when it's on the free list. */ struct Lisp_Free { @@ -1555,13 +1503,6 @@ union Lisp_Misc struct Lisp_Save_Value u_save_value; }; -LISP_INLINE struct Lisp_Save_Value * -XSAVE_VALUE (Lisp_Object a) -{ - eassert (SAVE_VALUEP (a)); - return & XMISC (a)->u_save_value; -} - /* Forwarding pointer to an int variable. This is allowed only in the value cell of a symbol, and it means that the symbol's value really lives in the @@ -1854,6 +1795,60 @@ SAVE_VALUEP (Lisp_Object x) return MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Save_Value; } +LISP_INLINE struct Lisp_Save_Value * +XSAVE_VALUE (Lisp_Object a) +{ + eassert (SAVE_VALUEP (a)); + return & XMISC (a)->u_save_value; +} + +/* Return the type of V's Nth saved value. */ +LISP_INLINE int +save_type (struct Lisp_Save_Value *v, int n) +{ + eassert (0 <= n && n < SAVE_VALUE_SLOTS); + return (v->save_type >> (SAVE_SLOT_BITS * n) & ((1 << SAVE_SLOT_BITS) - 1)); +} + +/* Get and set the Nth saved pointer. */ + +LISP_INLINE void * +XSAVE_POINTER (Lisp_Object obj, int n) +{ + eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_POINTER); + return XSAVE_VALUE (obj)->data[n].pointer;; +} +LISP_INLINE void +set_save_pointer (Lisp_Object obj, int n, void *val) +{ + eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_POINTER); + XSAVE_VALUE (obj)->data[n].pointer = val; +} + +/* Likewise for the saved integer. */ + +LISP_INLINE ptrdiff_t +XSAVE_INTEGER (Lisp_Object obj, int n) +{ + eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_INTEGER); + return XSAVE_VALUE (obj)->data[n].integer; +} +LISP_INLINE void +set_save_integer (Lisp_Object obj, int n, ptrdiff_t val) +{ + eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_INTEGER); + XSAVE_VALUE (obj)->data[n].integer = val; +} + +/* Extract Nth saved object. */ + +LISP_INLINE Lisp_Object +XSAVE_OBJECT (Lisp_Object obj, int n) +{ + eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_OBJECT); + return XSAVE_VALUE (obj)->data[n].object; +} + #define AUTOLOADP(x) (CONSP (x) && EQ (Qautoload, XCAR (x))) #define INTFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Int) -- cgit v1.2.1 From 7216e43b329303146455bb1dace88f8c61b1cd20 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 1 Apr 2013 18:54:56 -0700 Subject: Prefer < to > in range checks such as 0 <= i && i < N. This makes it easier to visualize quantities on a number line. This patch doesn't apply to all such range checks, only to the range checks affected by the 2013-03-24 change. This patch reverts most of the 2013-03-24 change. * alloc.c (xpalloc, Fgarbage_collect): * ccl.c (ccl_driver, resolve_symbol_ccl_program): * character.c (string_escape_byte8): * charset.c (read_hex): * data.c (cons_to_unsigned): * dispnew.c (update_frame_1): * doc.c (Fsubstitute_command_keys): * doprnt.c (doprnt): * editfns.c (hi_time, decode_time_components): * fileio.c (file_offset): * fns.c (larger_vector, make_hash_table, Fmake_hash_table): * font.c (font_intern_prop): * frame.c (x_set_alpha): * gtkutil.c (get_utf8_string): * indent.c (check_display_width): * keymap.c (Fkey_description): * lisp.h (FIXNUM_OVERFLOW_P, vcopy): * lread.c (read1): * minibuf.c (read_minibuf_noninteractive): * process.c (wait_reading_process_output): * search.c (Freplace_match): * window.c (get_phys_cursor_glyph): * xdisp.c (redisplay_internal): * xsmfns.c (smc_save_yourself_CB): Prefer < to > for range checks. * dispnew.c (sit_for): Don't mishandle NaNs. This fixes a bug introduced in the 2013-03-24 change. * editfns.c (decode_time_components): Don't hoist comparison. This fixes another bug introduced in the 2013-03-24 change. --- src/lisp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lisp.h') diff --git a/src/lisp.h b/src/lisp.h index 4481a2e3373..82cf0cb2678 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -543,7 +543,7 @@ static EMACS_INT const VALMASK type or if I is a NaN. */ #define FIXNUM_OVERFLOW_P(i) \ - (! (((i) >= 0 || (i) >= MOST_NEGATIVE_FIXNUM) && (i) <= MOST_POSITIVE_FIXNUM)) + (! ((0 <= (i) || MOST_NEGATIVE_FIXNUM <= (i)) && (i) <= MOST_POSITIVE_FIXNUM)) LISP_INLINE ptrdiff_t clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) @@ -2560,7 +2560,7 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val) LISP_INLINE void vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count) { - eassert (offset >= 0 && count >= 0 && offset + count <= ASIZE (v)); + eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v)); memcpy (XVECTOR (v)->contents + offset, args, count * sizeof *args); } -- cgit v1.2.1 From 73931ad14ad7a51d91f10b19ae9ca8cadb256916 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Fri, 5 Apr 2013 18:07:02 +0400 Subject: Consistently use platform-specific function to detect window system. * lisp.h (check_window_system): New prototype. This function is going to replace check_x, check_w32 and check_ns. (have_menus_p): Mention msdos.c in comment. * fontset.c (check_window_system_func): Remove. Adjust all users. * fontset.h (check_window_system_func): Remove prototype. * nsterm.h (check_ns): * xterm.h (check_x): * w32term.h (check_w32): Likewise. * menu.c (Fx_popup_menu): Use check_window_system. * msdos.c (check_window_system): Define for MS-DOS. * nsfns.m (check_window_system): Define for NS. Adjust all users. * w32fns.c (check_window_system): Likewise for MS-Windows. * xfns.c (check_window_system): Likewise for X. * font.c, frame.c, nsmenu.m, nsselect.m, nsterm.m, w32menu.c: * xfaces.c, xmenu.c: Use check_window_system where appropriate. --- src/lisp.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/lisp.h') diff --git a/src/lisp.h b/src/lisp.h index 82cf0cb2678..2e1d20a5109 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3765,6 +3765,11 @@ extern void syms_of_xterm (void); extern char *x_get_keysym_name (int); #endif /* HAVE_WINDOW_SYSTEM */ +#if defined(HAVE_WINDOW_SYSTEM) || defined (MSDOS) +/* Defined in (x|w32)fns.c, nsfns.m, msdos.c. */ +extern void check_window_system (void); +#endif + #ifdef HAVE_LIBXML2 /* Defined in xml.c. */ extern void syms_of_xml (void); @@ -3772,7 +3777,7 @@ extern void xml_cleanup_parser (void); #endif #ifdef HAVE_MENUS -/* Defined in (x|w32)fns.c, nsfns.m... */ +/* Defined in (x|w32)fns.c, nsfns.m, msdos.c. */ extern int have_menus_p (void); #endif -- cgit v1.2.1 From 7452b7bd70f01fb96f13269250bda32507ce0cf1 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Sun, 7 Apr 2013 08:41:19 +0400 Subject: Get rid of some platform-specific functions examining window system and its capabilities. This is a partial rework of the 2013-04-05 change. * lisp.h (have_menus_p): Remove prototype. This function is replaced with platform-independent window_system_available. (check_window_system): Move to... * frame.h (decode_window_system_frame, window_system_available): ...here, add new prototypes. * frame.c (window_system_available, decode_window_system_frame): New functions. (check_window_system): Platform-independent now. * xterm.h (x_in_use): Remove declaration. (check_x_frame): * w32term.h (check_x_frame): * nsterm.h (check_x_frame): Remove prototypes. This function is replaced with platform-independent decode_window_system_frame. * msdos.c (have_menus_p): Remove. * nsfns.m (check_window_system, have_menus_p, check_ns_frame): Remove platform-specific functions. Use check_window_system, decode_window_system_frame and check_ns_display_info where appropriate. Minor style and comment tweaks. * w32fns.c (w32_in_use, check_window_system, have_menus_p) (check_x_frame): Likewise. * xfns.c (x_in_use, check_window_system, have_menus_p, check_x_frame): Likewise. * fileio.c, fns.c, font.c, fontset.c, image.c, menu.c, nsmenu.m: * nsselect.m, nsterm.m, w32font.c, w32menu.c, xfaces.c, xgselect.c: * xmenu.c, xselect.c: All related users changed. --- src/lisp.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src/lisp.h') diff --git a/src/lisp.h b/src/lisp.h index 2e1d20a5109..bcb866b4cc4 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3765,22 +3765,12 @@ extern void syms_of_xterm (void); extern char *x_get_keysym_name (int); #endif /* HAVE_WINDOW_SYSTEM */ -#if defined(HAVE_WINDOW_SYSTEM) || defined (MSDOS) -/* Defined in (x|w32)fns.c, nsfns.m, msdos.c. */ -extern void check_window_system (void); -#endif - #ifdef HAVE_LIBXML2 /* Defined in xml.c. */ extern void syms_of_xml (void); extern void xml_cleanup_parser (void); #endif -#ifdef HAVE_MENUS -/* Defined in (x|w32)fns.c, nsfns.m, msdos.c. */ -extern int have_menus_p (void); -#endif - #ifdef HAVE_DBUS /* Defined in dbusbind.c. */ void syms_of_dbusbind (void); -- cgit v1.2.1 From f780d632f2047ccf07208081aa477882ef4ecc2a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 26 Apr 2013 12:31:09 -0700 Subject: Port better to AIX. * configure.ac (CFLAGS): Append -O if the user did not specify CFLAGS, we did not already infer an optimization option, and -O works. AIX xlc needs -O, otherwise garbage collection doesn't work. * src/lisp.h (ENUM_BF) [__IBMC__]: Make it 'unsigned int' here, too, to pacify AIX xlc. Fixes: debbugs:14258 --- src/lisp.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lisp.h') diff --git a/src/lisp.h b/src/lisp.h index bcb866b4cc4..e2c24eed352 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -231,9 +231,9 @@ enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 }; #define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 #define LISP_INT_TAG_P(x) (((x) & ~Lisp_Int1) == 0) -/* Stolen from GDB. The only known compiler that doesn't support - enums in bitfields is MSVC. */ -#ifdef _MSC_VER +/* Idea stolen from GDB. MSVC doesn't support enums in bitfields, + and xlc complains vociferously about them. */ +#if defined _MSC_VER || defined __IBMC__ #define ENUM_BF(TYPE) unsigned int #else #define ENUM_BF(TYPE) enum TYPE -- cgit v1.2.1 From 1aa8d50570ea4ad6e57d1b2476b5338357a5ac74 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 15 May 2013 14:54:49 -0400 Subject: * src/process.c: Export default filters and sentinels to Elisp. (Qinternal_default_process_sentinel, Qinternal_default_process_filter): New constants. (pset_filter, pset_sentinel, make_process, Fset_process_filter) (Fset_process_sentinel, Fformat_network_address): Default to them instead of nil. (server_accept_connection): Sentinels can't be nil any more. (read_and_dispose_of_process_output): New function, extracted from read_process_output. (read_process_output): Use it; filters can't be nil. (Finternal_default_process_filter): New function, extracted from read_process_output. (exec_sentinel_unwind): Remove function. (exec_sentinel): Don't zilch sentinel while running. (status_notify): Sentinels can't be nil. (Finternal_default_process_sentinel): New function extracted from status_notify. (setup_process_coding_systems): Default filter is not nil any more. (syms_of_process): Export new Elisp functions and initialize new constants. * src/lisp.h (make_lisp_proc): New function. --- src/lisp.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/lisp.h') diff --git a/src/lisp.h b/src/lisp.h index e2c24eed352..79d32c90f73 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -585,10 +585,12 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) (eassert (KBOARD_OBJFWDP (a)), &((a)->u_kboard_objfwd)) /* Pseudovector types. */ - +struct Lisp_Process; +LISP_INLINE Lisp_Object make_lisp_proc (struct Lisp_Process *p) +{ return make_lisp_ptr (p, Lisp_Vectorlike); } #define XPROCESS(a) (eassert (PROCESSP (a)), \ (struct Lisp_Process *) XUNTAG (a, Lisp_Vectorlike)) -#define XWINDOW(a) (eassert (WINDOWP (a)), \ +#define XWINDOW(a) (eassert (WINDOWP (a)), \ (struct window *) XUNTAG (a, Lisp_Vectorlike)) #define XTERMINAL(a) (eassert (TERMINALP (a)), \ (struct terminal *) XUNTAG (a, Lisp_Vectorlike)) -- cgit v1.2.1 From 2f592f95d2344d4a28eb946848330dca49e0f5ee Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 3 Jun 2013 05:01:53 -0400 Subject: Merge the specpdl and backtrace stacks. Make the structure of the specpdl entries more obvious via a tagged union of structs. * src/lisp.h (BITS_PER_PTRDIFF_T): New constant. (enum specbind_tag): New enum. (struct specbinding): Make it a tagged union of structs. Add a case for backtrace records. (specpdl_symbol, specpdl_old_value, specpdl_where, specpdl_arg) (specpdl_func, backtrace_function, backtrace_nargs, backtrace_args) (backtrace_debug_on_exit): New accessors. (struct backtrace): Remove. (struct catchtag): Remove backlist field. * src/data.c (let_shadows_buffer_binding_p, let_shadows_global_binding_p): Move to eval.c. (Flocal_variable_p): Speed up the common case where the binding is already loaded. * src/eval.c (backtrace_list): Remove. (set_specpdl_symbol, set_specpdl_old_value): Remove. (set_backtrace_args, set_backtrace_nargs) (set_backtrace_debug_on_exit, backtrace_p, backtrace_top) (backtrace_next): New functions. (Fdefvaralias, Fdefvar): Adjust to new specpdl format. (unwind_to_catch, internal_lisp_condition_case) (internal_condition_case, internal_condition_case_1) (internal_condition_case_2, internal_condition_case_n): Don't bother with backtrace_list any more. (Fsignal): Adjust to new backtrace format. (grow_specpdl): Move up. (record_in_backtrace): New function. (eval_sub, Ffuncall): Use it. (apply_lambda): Adjust to new backtrace format. (let_shadows_buffer_binding_p, let_shadows_global_binding_p): Move from data.c. (specbind): Adjust to new specpdl format. Simplify. (record_unwind_protect, unbind_to): Adjust to new specpdl format. (Fbacktrace_debug, Fbacktrace, Fbacktrace_frame): Adjust to new backtrace format. (mark_backtrace): Remove. (mark_specpdl, get_backtrace, backtrace_top_function): New functions. * src/xdisp.c (redisplay_internal): Use record_in_backtrace. * src/alloc.c (Fgarbage_collect): Use record_in_backtrace. Use mark_specpdl. * src/profiler.c (record_backtrace): Use get_backtrace. (handle_profiler_signal): Use backtrace_top_function. * src/.gdbinit (xbacktrace, hookpost-backtrace): Use new backtrace accessor functions. --- src/lisp.h | 105 ++++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 83 insertions(+), 22 deletions(-) (limited to 'src/lisp.h') diff --git a/src/lisp.h b/src/lisp.h index 79d32c90f73..bd2f55f7cf4 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -73,6 +73,7 @@ enum BITS_PER_SHORT = CHAR_BIT * sizeof (short), BITS_PER_INT = CHAR_BIT * sizeof (int), BITS_PER_LONG = CHAR_BIT * sizeof (long int), + BITS_PER_PTRDIFF_T = CHAR_BIT * sizeof (ptrdiff_t), BITS_PER_EMACS_INT = CHAR_BIT * sizeof (EMACS_INT) }; @@ -2176,12 +2177,24 @@ typedef jmp_buf sys_jmp_buf; #endif +/* Elisp uses several stacks: + - the C stack. + - the bytecode stack: used internally by the bytecode interpreter. + Allocated from the C stack. + - The specpdl stack: keeps track of active unwind-protect and + dynamic-let-bindings. Allocated from the `specpdl' array, a manually + managed stack. + - The catch stack: keeps track of active catch tags. + Allocated on the C stack. This is where the setmp data is kept. + - The handler stack: keeps track of active condition-case handlers. + Allocated on the C stack. Every entry there also uses an entry in + the catch stack. */ + /* Structure for recording Lisp call stack for backtrace purposes. */ /* The special binding stack holds the outer values of variables while they are bound by a function application or a let form, stores the - code to be executed for Lisp unwind-protect forms, and stores the C - functions to be called for record_unwind_protect. + code to be executed for unwind-protect forms. If func is non-zero, undoing this binding applies func to old_value; This implements record_unwind_protect. @@ -2194,35 +2207,77 @@ typedef jmp_buf sys_jmp_buf; which means having bound a local value while CURRENT-BUFFER was active. If WHERE is nil this means we saw the default value when binding SYMBOL. WHERE being a buffer or frame means we saw a buffer-local or frame-local - value. Other values of WHERE mean an internal error. */ + value. Other values of WHERE mean an internal error. + + NOTE: The specbinding struct is defined here, because SPECPDL_INDEX is + used all over the place, needs to be fast, and needs to know the size of + struct specbinding. But only eval.c should access it. */ typedef Lisp_Object (*specbinding_func) (Lisp_Object); +enum specbind_tag { + SPECPDL_UNWIND, /* An unwind_protect function. */ + SPECPDL_BACKTRACE, /* An element of the backtrace. */ + SPECPDL_LET, /* A plain and simple dynamic let-binding. */ + /* Tags greater than SPECPDL_LET must be "subkinds" of LET. */ + SPECPDL_LET_LOCAL, /* A buffer-local let-binding. */ + SPECPDL_LET_DEFAULT /* A global binding for a localized var. */ +}; + struct specbinding { - Lisp_Object symbol, old_value; - specbinding_func func; - Lisp_Object unused; /* Dividing by 16 is faster than by 12. */ + enum specbind_tag kind; + union { + struct { + Lisp_Object arg; + specbinding_func func; + } unwind; + struct { + /* `where' is not used in the case of SPECPDL_LET. */ + Lisp_Object symbol, old_value, where; + } let; + struct { + Lisp_Object function; + Lisp_Object *args; + ptrdiff_t nargs : BITS_PER_PTRDIFF_T - 1; + bool debug_on_exit : 1; + } bt; + } v; }; +LISP_INLINE Lisp_Object specpdl_symbol (struct specbinding *pdl) +{ eassert (pdl->kind >= SPECPDL_LET); return pdl->v.let.symbol; } + +LISP_INLINE Lisp_Object specpdl_old_value (struct specbinding *pdl) +{ eassert (pdl->kind >= SPECPDL_LET); return pdl->v.let.old_value; } + +LISP_INLINE Lisp_Object specpdl_where (struct specbinding *pdl) +{ eassert (pdl->kind > SPECPDL_LET); return pdl->v.let.where; } + +LISP_INLINE Lisp_Object specpdl_arg (struct specbinding *pdl) +{ eassert (pdl->kind == SPECPDL_UNWIND); return pdl->v.unwind.arg; } + +LISP_INLINE specbinding_func specpdl_func (struct specbinding *pdl) +{ eassert (pdl->kind == SPECPDL_UNWIND); return pdl->v.unwind.func; } + +LISP_INLINE Lisp_Object backtrace_function (struct specbinding *pdl) +{ eassert (pdl->kind == SPECPDL_BACKTRACE); return pdl->v.bt.function; } + +LISP_INLINE ptrdiff_t backtrace_nargs (struct specbinding *pdl) +{ eassert (pdl->kind == SPECPDL_BACKTRACE); return pdl->v.bt.nargs; } + +LISP_INLINE Lisp_Object *backtrace_args (struct specbinding *pdl) +{ eassert (pdl->kind == SPECPDL_BACKTRACE); return pdl->v.bt.args; } + +LISP_INLINE bool backtrace_debug_on_exit (struct specbinding *pdl) +{ eassert (pdl->kind == SPECPDL_BACKTRACE); return pdl->v.bt.debug_on_exit; } + extern struct specbinding *specpdl; extern struct specbinding *specpdl_ptr; extern ptrdiff_t specpdl_size; #define SPECPDL_INDEX() (specpdl_ptr - specpdl) -struct backtrace -{ - struct backtrace *next; - Lisp_Object function; - Lisp_Object *args; /* Points to vector of args. */ - ptrdiff_t nargs; /* Length of vector. */ - /* Nonzero means call value of debugger when done with this operation. */ - unsigned int debug_on_exit : 1; -}; - -extern struct backtrace *backtrace_list; - /* Everything needed to describe an active condition case. Members are volatile if their values need to survive _longjmp when @@ -2277,9 +2332,10 @@ struct catchtag Lisp_Object tag; Lisp_Object volatile val; struct catchtag *volatile next; +#if 1 /* GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS, but they're defined later. */ struct gcpro *gcpro; +#endif sys_jmp_buf jmp; - struct backtrace *backlist; struct handler *handlerlist; EMACS_INT lisp_eval_depth; ptrdiff_t volatile pdlcount; @@ -3337,10 +3393,15 @@ extern Lisp_Object safe_call (ptrdiff_t, Lisp_Object, ...); extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object); extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object); extern void init_eval (void); -#if BYTE_MARK_STACK -extern void mark_backtrace (void); -#endif extern void syms_of_eval (void); +extern void record_in_backtrace (Lisp_Object function, + Lisp_Object *args, ptrdiff_t nargs); +extern void mark_specpdl (void); +extern void get_backtrace (Lisp_Object array); +Lisp_Object backtrace_top_function (void); +extern bool let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol); +extern bool let_shadows_global_binding_p (Lisp_Object symbol); + /* Defined in editfns.c. */ extern Lisp_Object Qfield; -- cgit v1.2.1 From c9628c79bba5ec1e55c31512b5c32371ff034b1f Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 3 Jun 2013 15:03:05 +0200 Subject: * configure.ac (file-notification): New option, replaces inotify option. (HAVE_W32): Remove w32notify.o. (with_file_notification): Add checks for glib and w32. Adapt check for inotify. (Summary): Add entry for file notification. * autogen/config.in: Add entries for HAVE_GFILENOTIFY, HAVE_W32NOTIFY and USE_FILE_NOTIFY. * lisp/autorevert.el (auto-revert-notify-enabled) (auto-revert-notify-rm-watch, auto-revert-notify-add-watch) (auto-revert-notify-event-p, auto-revert-notify-event-file-name) (auto-revert-notify-handler): Handle also gfilenotify. * lisp/subr.el: (file-notify-handle-event): New defun. Replacing ... (inotify-event-p, inotify-handle-event, w32notify-handle-event): Removed. * src/Makefile.in (NOTIFY_OBJ): New variable. (base_obj): Replace inotify.o by $(NOTIFY_OBJ). * src/emacs.c (main): Use HAVE_W32NOTIFY to wrap respective code. Call syms_of_gfilenotify. * src/gfilenotify.c: New file. * src/keyboard.c (Qfile_notify): New variable. Replaces Qfile_inotify and Qfile_w32notify. (top): Wrap respective code by HAVE_GFILENOTIFY, HAVE_INOTIFY, HAVE_W32NOTIFY and USE_FILE_NOTIFY. * src/lisp.h: Declare syms_of_gfilenotify. * src/termhooks.h (e): Wrap enum by USE_FILE_NOTIFY. --- src/lisp.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/lisp.h') diff --git a/src/lisp.h b/src/lisp.h index bd2f55f7cf4..517d0abbb61 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3784,9 +3784,9 @@ extern void syms_of_fontset (void); extern Lisp_Object Qfont_param; #endif -#ifdef WINDOWSNT -/* Defined on w32notify.c. */ -extern void syms_of_w32notify (void); +/* Defined in gfilenotify.c */ +#ifdef HAVE_GFILENOTIFY +extern void syms_of_gfilenotify (void); #endif /* Defined in inotify.c */ @@ -3794,6 +3794,11 @@ extern void syms_of_w32notify (void); extern void syms_of_inotify (void); #endif +#ifdef HAVE_W32NOTIFY +/* Defined on w32notify.c. */ +extern void syms_of_w32notify (void); +#endif + /* Defined in xfaces.c. */ extern Lisp_Object Qdefault, Qtool_bar, Qfringe; extern Lisp_Object Qheader_line, Qscroll_bar, Qcursor; -- cgit v1.2.1