diff options
Diffstat (limited to 'src')
129 files changed, 842 insertions, 560 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 87376db4e7f..e3c212924b3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,131 @@ +2007-08-13 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * gtkutil.c (update_frame_tool_bar): Use -1 as index + to gtk_toolbar_insert. + +2007-08-13 Stefan Monnier <monnier@iro.umontreal.ca> + + * fileio.c (Finsert_file_contents): Yet Another Int/Lisp_Object Mixup. + + * insdel.c (reset_var_on_error): New fun. + (signal_before_change, signal_after_change): + Use it to reset (after|before)-change-functions to nil in case of error. + Bind inhibit-modification-hooks to t. + Don't bind (after|before)-change-functions to nil while they run. + +2007-08-11 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * xterm.c (x_draw_image_glyph_string): Adjust stipple origin when + filling pixmap with stippled background. + +2007-08-10 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * macterm.c [TARGET_API_MAC_CARBON] (mac_handle_window_event): + Don't use invisible frame as parent window for repositioning. + +2007-08-10 Stefan Monnier <monnier@iro.umontreal.ca> + + * print.c (new_backquote_output): Rename from old_backquote_output. + (print): Inverse its logic (according to its name) so as to match the + behavior of new_backquote_flag in lread.c. + +2007-08-09 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * gmalloc.c (posix_memalign): New function. + + * macterm.c (frame_highlight, frame_unhighlight): Don't call + ActivateControl/DeactivateControl here. + [USE_MAC_TOOLBAR] (free_frame_tool_bar): Suppress animation when + frame-notice-user-settings is non-nil. + [USE_MAC_FONT_PANEL] (mac_handle_font_event): Also record parameter + for kEventParamFMFontStyle. + [TARGET_API_MAC_CARBON] (mac_handle_keyboard_event): Don't check + mac_pass_command_to_system and mac_pass_control_to_system here. + (XTread_socket): Call ActivateControl/DeactivateControl here. + (XTread_socket) [TARGET_API_MAC_CARBON]: + Check mac_pass_command_to_system and mac_pass_control_to_system here. + (mac_handle_window_event) [USE_MAC_TOOLBAR]: Add further workaround + for window repositioning. + +2007-08-08 Glenn Morris <rgm@gnu.org> + + * Replace `iff' in doc-strings and comments. + +2007-08-07 Chong Yidong <cyd@stupidchicken.com> + + * xdisp.c (move_it_by_lines): Remove incorrect optimization. + +2007-08-07 Martin Rudalics <rudalics@gmx.at> + + * fileio.c (Finsert_file_contents): Run format-decode and + after_insert_file_functions on entire buffer when REPLACE is + non-nil and inhibit modification_hooks and point_motion_hooks. + For consistency, run after_insert_file_functions iff something + got inserted. Move signal_after_change and update_compositions + after code running after_insert_file_functions. Make sure that + undo_list doesn't record intermediate steps of the decoding + process. + +2007-08-07 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * emacs.c (main) + [HAVE_GTK_AND_PTHREAD && !SYSTEM_MALLOC && !DOUG_LEA_MALLOC]: + Call malloc_enable_thread on interactive startup. + + * gmalloc.c (_malloc_thread_enabled_p) [USE_PTHREAD]: New variable. + (LOCK, UNLOCK, LOCK_ALIGNED_BLOCKS, UNLOCK_ALIGNED_BLOCKS) + [USE_PTHREAD]: Conditionalize with it. + (malloc_atfork_handler_prepare, malloc_atfork_handler_parent) + (malloc_atfork_handler_child, malloc_enable_thread) [USE_PTHREAD]: + New functions. + +2007-08-06 Chong Yidong <cyd@stupidchicken.com> + + * xdisp.c (redisplay_window): When restoring original buffer + position, make sure it is still valid. + + * image.c (png_load): Ignore png-supplied background color. + +2007-08-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * mac.c [TARGET_API_MAC_CARBON] (cfdate_to_lisp): Obtain microsec value. + Use kCFAbsoluteTimeIntervalSince1970. + + * macmenu.c (quit_dialog_event_loop) [TARGET_API_MAC_CARBON]: + New variable. + [TARGET_API_MAC_CARBON] (mac_handle_dialog_event): Set it if dialog + event loop should be quit. + [TARGET_API_MAC_CARBON] (create_and_show_dialog) [!MAC_OSX]: + Quit dialog event loop if quit_dialog_event_loop is set. + + * macselect.c [!TARGET_API_MAC_CARBON]: Include Scrap.h. + (Selection): New typedef. Use instead of ScrapRef. + (mac_get_selection_from_symbol): Rename from get_scrap_from_symbol. + (mac_valid_selection_target_p): Rename from valid_scrap_target_type_p. + (mac_clear_selection): Rename from clear_scrap. + (get_flavor_type_from_symbol): New argument SEL and subsume function of + scrap_has_target_type. All uses changed. + (mac_get_selection_ownership_info, mac_valid_selection_value_p) + (mac_selection_has_target_p): New functions. + (mac_put_selection_value): Rename from put_scrap_string. + (mac_get_selection_value): Rename from get_scrap_string. + (mac_get_selection_target_list): Rename from get_scrap_target_type_list. + (put_scrap_private_timestamp, scrap_has_target_type) + (get_scrap_private_timestamp): Remove functions. + (SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP): Remove define. + (x_own_selection, x_get_local_selection): + Use mac_valid_selection_value_p. + (x_own_selection): Don't use put_scrap_private_timestamp. + Record OWNERSHIP-INFO into Vselection_alist instead. + (x_get_local_selection): Don't check type if request is local. + (Fx_selection_owner_p): Don't use get_scrap_private_timestamp. + Detect ownership change with OWNERSHIP-INFO in Vselection_alist instead. + +2007-08-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * gtkutil.c (xg_tool_bar_callback): Generate two TOOL_BAR_EVENT:s, + add comment explaining why. + 2007-08-03 Richard Stallman <rms@gnu.org> * fileio.c (Fvisited_file_modtime): Use make_time. diff --git a/src/buffer.h b/src/buffer.h index 65cfef4f04f..ed99dc4ffb1 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -561,7 +561,7 @@ struct buffer Lisp_Object filename; /* Dir for expanding relative file names. */ Lisp_Object directory; - /* True iff this buffer has been backed up (if you write to the + /* True if this buffer has been backed up (if you write to the visited file and it hasn't been backed up, then a backup will be made). */ /* This isn't really used by the C code, so could be deleted. */ diff --git a/src/callproc.c b/src/callproc.c index 65a75d685a5..5bd4cee9cfa 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -119,7 +119,7 @@ Lisp_Object Vprocess_environment; Lisp_Object Qbuffer_file_type; #endif /* DOS_NT */ -/* True iff we are about to fork off a synchronous process or if we +/* True if we are about to fork off a synchronous process or if we are waiting for it. */ int synch_process_alive; diff --git a/src/casetab.c b/src/casetab.c index bf0e022f139..952a320dda3 100644 --- a/src/casetab.c +++ b/src/casetab.c @@ -40,7 +40,7 @@ static void set_identity (); static void shuffle (); DEFUN ("case-table-p", Fcase_table_p, Scase_table_p, 1, 1, 0, - doc: /* Return t iff OBJECT is a case table. + doc: /* Return t if OBJECT is a case table. See `set-case-table' for more information on these data structures. */) (object) Lisp_Object object; diff --git a/src/category.c b/src/category.c index 55e752045e7..7ea9b7810fa 100644 --- a/src/category.c +++ b/src/category.c @@ -559,7 +559,7 @@ syms_of_category () doc: /* List of pair (cons) of categories to determine word boundary. Emacs treats a sequence of word constituent characters as a single -word (i.e. finds no word boundary between them) iff they belongs to +word (i.e. finds no word boundary between them) only if they belong to the same charset. But, exceptions are allowed in the following cases. \(1) The case that characters are in different charsets is controlled diff --git a/src/ccl.c b/src/ccl.c index c25e67abf57..564fd4ba4fa 100644 --- a/src/ccl.c +++ b/src/ccl.c @@ -659,13 +659,13 @@ while (0) #define CCL_LookupIntConstTbl 0x13 /* Lookup multibyte character by integer key. Afterwards R7 set - to 1 iff lookup succeeded. + to 1 if lookup succeeded. 1:ExtendedCOMMNDRrrRRRXXXXXXXX 2:ARGUMENT(Hash table ID) */ #define CCL_LookupCharConstTbl 0x14 /* Lookup integer by multibyte character key. Afterwards R7 set - to 1 iff lookup succeeded. + to 1 if lookup succeeded. 1:ExtendedCOMMNDRrrRRRrrrXXXXX 2:ARGUMENT(Hash table ID) */ diff --git a/src/charset.c b/src/charset.c index a6ec309cbb3..1a85cd39c72 100644 --- a/src/charset.c +++ b/src/charset.c @@ -337,7 +337,7 @@ split_string (str, len, charset, c1, c2) return 0; } -/* Return 1 iff character C has valid printable glyph. +/* Return 1 if character C has valid printable glyph. Use the macro CHAR_PRINTABLE_P instead. */ int char_printable_p (c) @@ -1102,8 +1102,8 @@ DIMENSION, CHARS, and FINAL-CHAR. */) return CHARSET_SYMBOL (charset); } -/* If GENERICP is nonzero, return nonzero iff C is a valid normal or - generic character. If GENERICP is zero, return nonzero iff C is a +/* If GENERICP is nonzero, return nonzero if C is a valid normal or + generic character. If GENERICP is zero, return nonzero if C is a valid normal character. Do not call this function directly, instead use macro CHAR_VALID_P. */ int diff --git a/src/charset.h b/src/charset.h index 984d466d97d..c20766f910b 100644 --- a/src/charset.h +++ b/src/charset.h @@ -413,8 +413,8 @@ extern int width_by_char_head[256]; | ((c1) <= 0 ? 0 : (((c1) & 0x7F) << 7)))))) -/* If GENERICP is nonzero, return nonzero iff C is a valid normal or - generic character. If GENERICP is zero, return nonzero iff C is a +/* If GENERICP is nonzero, return nonzero if C is a valid normal or + generic character. If GENERICP is zero, return nonzero if C is a valid normal character. */ #define CHAR_VALID_P(c, genericp) \ ((c) >= 0 \ @@ -450,7 +450,7 @@ extern int width_by_char_head[256]; #define VALID_LEADING_CODE_P(code) \ (! NILP (CHARSET_TABLE_ENTRY (code))) -/* Return 1 iff the byte sequence at unibyte string STR (LENGTH bytes) +/* Return 1 if the byte sequence at unibyte string STR (LENGTH bytes) is valid as a multibyte form. If valid, by a side effect, BYTES is set to the byte length of the multibyte form. */ @@ -471,7 +471,7 @@ extern int width_by_char_head[256]; && VALID_LEADING_CODE_P (str[1])))))))) -/* Return 1 iff the byte sequence at multibyte string STR is valid as +/* Return 1 if the byte sequence at multibyte string STR is valid as a unibyte form. By a side effect, BYTES is set to the byte length of one character at STR. */ @@ -499,7 +499,7 @@ extern int width_by_char_head[256]; c1 = CHAR_FIELD3 (c), \ c2 = -1))) -/* Return 1 iff character C has valid printable glyph. */ +/* Return 1 if character C has valid printable glyph. */ #define CHAR_PRINTABLE_P(c) (ASCII_BYTE_P (c) || char_printable_p (c)) /* The charset of the character at STR is stored in CHARSET, and the diff --git a/src/coding.h b/src/coding.h index 39feeea96af..a53a74ec161 100644 --- a/src/coding.h +++ b/src/coding.h @@ -263,7 +263,7 @@ enum coding_type eol-type is not consistent through the file. */ -/* 1 iff composing. */ +/* 1 if composing. */ #define COMPOSING_P(coding) ((int) coding->composing > (int) COMPOSITION_NO) #define COMPOSITION_DATA_SIZE 4080 @@ -372,7 +372,7 @@ struct coding_system /* The current status of composition handling. */ int composing; - /* 1 iff the next character is a composition rule. */ + /* 1 if the next character is a composition rule. */ int composition_rule_follows; /* Information of compositions are stored here on decoding and set diff --git a/src/composite.h b/src/composite.h index 5dc8dde62e2..ba8f8c84104 100644 --- a/src/composite.h +++ b/src/composite.h @@ -56,7 +56,7 @@ enum composition_method { /* Temporary variable used only in the following macros. */ extern Lisp_Object composition_temp; -/* Return 1 iff the composition is already registered. */ +/* Return 1 if the composition is already registered. */ #define COMPOSITION_REGISTERD_P(prop) INTEGERP (XCAR (prop)) /* Return ID number of the already registered composition. */ @@ -91,7 +91,7 @@ extern Lisp_Object composition_temp; ? COMPOSITION_WITH_ALTCHARS \ : COMPOSITION_WITH_RULE_ALTCHARS)))) -/* Return 1 iff the composition is valid. It is valid if length of +/* Return 1 if the composition is valid. It is valid if length of the composition equals to (END - START). */ #define COMPOSITION_VALID_P(start, end, prop) \ (CONSP (prop) \ diff --git a/src/dired.c b/src/dired.c index 22283b66ea0..1fb5387268a 100644 --- a/src/dired.c +++ b/src/dired.c @@ -916,7 +916,7 @@ Elements of the attribute list are: 7. Size in bytes. This is a floating point number if the size is too large for an integer. 8. File modes, as a string of ten letters or dashes as in ls -l. - 9. t iff file's gid would change if file were deleted and recreated. + 9. t if file's gid would change if file were deleted and recreated. 10. inode number. If inode number is larger than the Emacs integer, this is a cons cell containing two integers: first the high part, then the low 16 bits. diff --git a/src/editfns.c b/src/editfns.c index 7bb74958c2c..dac7eb83af2 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -3514,7 +3514,7 @@ usage: (format STRING &rest OBJECTS) */) precision ::= '.' [0-9]* If a field-width is specified, it specifies to which width - the output should be padded with blanks, iff the output + the output should be padded with blanks, if the output string is shorter than field-width. If precision is specified, it specifies the number of diff --git a/src/emacs.c b/src/emacs.c index 373eab33e11..e23f8083a31 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1165,6 +1165,13 @@ main (argc, argv setpgrp (); #endif #endif +#if defined (HAVE_GTK_AND_PTHREAD) && !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC) + { + extern void malloc_enable_thread P_ ((void)); + + malloc_enable_thread (); + } +#endif } init_signals (); diff --git a/src/eval.c b/src/eval.c index 9a03e5fac83..13ea0ba7ebf 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1793,7 +1793,7 @@ signal_error (s, arg) } -/* Return nonzero iff LIST is a non-nil atom or +/* Return nonzero if LIST is a non-nil atom or a list containing one of CONDITIONS. */ static int diff --git a/src/fileio.c b/src/fileio.c index 6e47670f09c..37a694da01d 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3692,27 +3692,25 @@ DEFUN ("insert-file-contents", Finsert_file_contents, Sinsert_file_contents, 1, 5, 0, doc: /* Insert contents of file FILENAME after point. Returns list of absolute file name and number of characters inserted. -If second argument VISIT is non-nil, the buffer's visited filename -and last save file modtime are set, and it is marked unmodified. -If visiting and the file does not exist, visiting is completed -before the error is signaled. -The optional third and fourth arguments BEG and END -specify what portion of the file to insert. -These arguments count bytes in the file, not characters in the buffer. -If VISIT is non-nil, BEG and END must be nil. - -If optional fifth argument REPLACE is non-nil, -it means replace the current buffer contents (in the accessible portion) -with the file contents. This is better than simply deleting and inserting -the whole thing because (1) it preserves some marker positions -and (2) it puts less data in the undo list. -When REPLACE is non-nil, the value is the number of characters actually read, -which is often less than the number of characters to be read. - -This does code conversion according to the value of -`coding-system-for-read' or `file-coding-system-alist', -and sets the variable `last-coding-system-used' to the coding system -actually used. */) +If second argument VISIT is non-nil, the buffer's visited filename and +last save file modtime are set, and it is marked unmodified. If +visiting and the file does not exist, visiting is completed before the +error is signaled. + +The optional third and fourth arguments BEG and END specify what portion +of the file to insert. These arguments count bytes in the file, not +characters in the buffer. If VISIT is non-nil, BEG and END must be nil. + +If optional fifth argument REPLACE is non-nil, replace the current +buffer contents (in the accessible portion) with the file contents. +This is better than simply deleting and inserting the whole thing +because (1) it preserves some marker positions and (2) it puts less data +in the undo list. When REPLACE is non-nil, the second return value is +the number of characters that replace previous buffer contents. + +This function does code conversion according to the value of +`coding-system-for-read' or `file-coding-system-alist', and sets the +variable `last-coding-system-used' to the coding system actually used. */) (filename, visit, beg, end, replace) Lisp_Object filename, visit, beg, end, replace; { @@ -3722,8 +3720,8 @@ actually used. */) register int how_much; register int unprocessed; int count = SPECPDL_INDEX (); - struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; - Lisp_Object handler, val, insval, orig_filename; + struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; + Lisp_Object handler, val, insval, orig_filename, old_undo; Lisp_Object p; int total = 0; int not_regular = 0; @@ -3746,8 +3744,9 @@ actually used. */) val = Qnil; p = Qnil; orig_filename = Qnil; + old_undo = Qnil; - GCPRO4 (filename, val, p, orig_filename); + GCPRO5 (filename, val, p, orig_filename, old_undo); CHECK_STRING (filename); filename = Fexpand_file_name (filename, Qnil); @@ -4706,24 +4705,103 @@ actually used. */) /* Decode file format */ if (inserted > 0) { - int empty_undo_list_p = 0; + /* Don't run point motion or modification hooks when decoding. */ + int count = SPECPDL_INDEX (); + specbind (Qinhibit_point_motion_hooks, Qt); + specbind (Qinhibit_modification_hooks, Qt); + + /* Save old undo list and don't record undo for decoding. */ + old_undo = current_buffer->undo_list; + current_buffer->undo_list = Qt; - /* If we're anyway going to discard undo information, don't - record it in the first place. The buffer's undo list at this - point is either nil or t when visiting a file. */ - if (!NILP (visit)) + if (NILP (replace)) { - empty_undo_list_p = NILP (current_buffer->undo_list); - current_buffer->undo_list = Qt; + insval = call3 (Qformat_decode, + Qnil, make_number (inserted), visit); + CHECK_NUMBER (insval); + inserted = XFASTINT (insval); + } + else + { + /* If REPLACE is non-nil and we succeeded in not replacing the + beginning or end of the buffer text with the file's contents, + call format-decode with `point' positioned at the beginning of + the buffer and `inserted' equalling the number of characters + in the buffer. Otherwise, format-decode might fail to + correctly analyze the beginning or end of the buffer. Hence + we temporarily save `point' and `inserted' here and restore + `point' iff format-decode did not insert or delete any text. + Otherwise we leave `point' at point-min. */ + int opoint = PT; + int opoint_byte = PT_BYTE; + int oinserted = ZV - BEGV; + + TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); + insval = call3 (Qformat_decode, + Qnil, make_number (oinserted), visit); + CHECK_NUMBER (insval); + if (XINT (insval) == oinserted) + SET_PT_BOTH (opoint, opoint_byte); + inserted = XFASTINT (insval); } - insval = call3 (Qformat_decode, - Qnil, make_number (inserted), visit); - CHECK_NUMBER (insval); - inserted = XFASTINT (insval); + /* For consistency with format-decode call these now iff inserted > 0 + (martin 2007-06-28) */ + p = Vafter_insert_file_functions; + while (CONSP (p)) + { + if (NILP (replace)) + { + insval = call1 (XCAR (p), make_number (inserted)); + if (!NILP (insval)) + { + CHECK_NUMBER (insval); + inserted = XFASTINT (insval); + } + } + else + { + /* For the rationale of this see the comment on format-decode above. */ + int opoint = PT; + int opoint_byte = PT_BYTE; + int oinserted = ZV - BEGV; + + TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); + insval = call1 (XCAR (p), make_number (oinserted)); + if (!NILP (insval)) + { + CHECK_NUMBER (insval); + if (XINT (insval) == oinserted) + SET_PT_BOTH (opoint, opoint_byte); + inserted = XFASTINT (insval); + } + } + + QUIT; + p = XCDR (p); + } + + if (NILP (visit)) + { + Lisp_Object lbeg, lend; + XSETINT (lbeg, PT); + XSETINT (lend, PT + inserted); + if (CONSP (old_undo)) + { + Lisp_Object tem = XCAR (old_undo); + if (CONSP (tem) && INTEGERP (XCAR (tem)) && + INTEGERP (XCDR (tem)) && EQ (XCAR (tem), lbeg)) + /* In the non-visiting case record only the final insertion. */ + current_buffer->undo_list = + Fcons (Fcons (lbeg, lend), Fcdr (old_undo)); + } + } + else + /* If undo_list was Qt before, keep it that way. + Otherwise start with an empty undo_list. */ + current_buffer->undo_list = EQ (old_undo, Qt) ? Qt : Qnil; - if (!NILP (visit)) - current_buffer->undo_list = empty_undo_list_p ? Qnil : Qt; + unbind_to (count, Qnil); } /* Call after-change hooks for the inserted text, aside from the case @@ -4736,19 +4814,6 @@ actually used. */) update_compositions (PT, PT, CHECK_BORDER); } - p = Vafter_insert_file_functions; - while (CONSP (p)) - { - insval = call1 (XCAR (p), make_number (inserted)); - if (!NILP (insval)) - { - CHECK_NUMBER (insval); - inserted = XFASTINT (insval); - } - QUIT; - p = XCDR (p); - } - if (!NILP (visit) && current_buffer->modtime == -1) { @@ -5193,7 +5258,7 @@ This does code conversion according to the value of * if we do writes that don't end with a carriage return. Furthermore * it cannot handle writes of more then 16K. The modified * version of "sys_write" in SYSDEP.C (see comment there) copes with - * this EXCEPT for the last record (iff it doesn't end with a carriage + * this EXCEPT for the last record (if it doesn't end with a carriage * return). This implies that if your buffer doesn't end with a carriage * return, you get one free... tough. However it also means that if * we make two calls to sys_write (a la the following code) you can diff --git a/src/fontset.c b/src/fontset.c index d76ed658de6..1d6e73517b6 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -501,7 +501,7 @@ free_face_fontset (f, face) } -/* Return 1 iff FACE is suitable for displaying character C. +/* Return 1 if FACE is suitable for displaying character C. Otherwise return 0. Called from the macro FACE_SUITABLE_FOR_CHAR_P when C is not a single byte character.. */ diff --git a/src/fontset.h b/src/fontset.h index 5b5c5cbcfaa..c8bd1e36eab 100644 --- a/src/fontset.h +++ b/src/fontset.h @@ -66,7 +66,7 @@ struct font_info /* Average width of glyphs in the font. */ int average_width; - /* 1 iff `vertical-centering-font-regexp' matches this font name. + /* 1 if `vertical-centering-font-regexp' matches this font name. In this case, we render characters at vartical center positions of lines. */ int vertical_centering; diff --git a/src/getloadavg.c b/src/getloadavg.c index f40149a8c47..6d66cbfd8a1 100644 --- a/src/getloadavg.c +++ b/src/getloadavg.c @@ -484,7 +484,7 @@ static struct dg_sys_info_load_info load_info; /* what-a-mouthful! */ #if !defined(HAVE_LIBKSTAT) && defined(LOAD_AVE_TYPE) /* File descriptor open to /dev/kmem or VMS load ave driver. */ static int channel; -/* Nonzero iff channel is valid. */ +/* Nonzero if channel is valid. */ static int getloadavg_initialized; /* Offset in kmem to seek to read load average, or 0 means invalid. */ static long offset; diff --git a/src/gmalloc.c b/src/gmalloc.c index cf79b9159f2..ccc08e1ff68 100644 --- a/src/gmalloc.c +++ b/src/gmalloc.c @@ -129,6 +129,8 @@ extern FREE_RETURN_TYPE free PP ((__ptr_t __ptr)); #if ! (defined (_MALLOC_INTERNAL) && __DJGPP__ - 0 == 1) /* Avoid conflict. */ extern __ptr_t memalign PP ((__malloc_size_t __alignment, __malloc_size_t __size)); +extern int posix_memalign PP ((__ptr_t *, __malloc_size_t, + __malloc_size_t size)); #endif /* Allocate SIZE bytes on a page boundary. */ @@ -136,6 +138,10 @@ extern __ptr_t memalign PP ((__malloc_size_t __alignment, extern __ptr_t valloc PP ((__malloc_size_t __size)); #endif +#ifdef USE_PTHREAD +/* Set up mutexes and make malloc etc. thread-safe. */ +extern void malloc_enable_thread PP ((void)); +#endif #ifdef _MALLOC_INTERNAL @@ -242,10 +248,27 @@ extern void _free_internal_nolock PP ((__ptr_t __ptr)); #ifdef USE_PTHREAD extern pthread_mutex_t _malloc_mutex, _aligned_blocks_mutex; -#define LOCK() pthread_mutex_lock (&_malloc_mutex) -#define UNLOCK() pthread_mutex_unlock (&_malloc_mutex) -#define LOCK_ALIGNED_BLOCKS() pthread_mutex_lock (&_aligned_blocks_mutex) -#define UNLOCK_ALIGNED_BLOCKS() pthread_mutex_unlock (&_aligned_blocks_mutex) +extern int _malloc_thread_enabled_p; +#define LOCK() \ + do { \ + if (_malloc_thread_enabled_p) \ + pthread_mutex_lock (&_malloc_mutex); \ + } while (0) +#define UNLOCK() \ + do { \ + if (_malloc_thread_enabled_p) \ + pthread_mutex_unlock (&_malloc_mutex); \ + } while (0) +#define LOCK_ALIGNED_BLOCKS() \ + do { \ + if (_malloc_thread_enabled_p) \ + pthread_mutex_lock (&_aligned_blocks_mutex); \ + } while (0) +#define UNLOCK_ALIGNED_BLOCKS() \ + do { \ + if (_malloc_thread_enabled_p) \ + pthread_mutex_unlock (&_aligned_blocks_mutex); \ + } while (0) #else #define LOCK() #define UNLOCK() @@ -563,6 +586,47 @@ register_heapinfo () #ifdef USE_PTHREAD pthread_mutex_t _malloc_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t _aligned_blocks_mutex = PTHREAD_MUTEX_INITIALIZER; +int _malloc_thread_enabled_p; + +static void +malloc_atfork_handler_prepare () +{ + LOCK (); + LOCK_ALIGNED_BLOCKS (); +} + +static void +malloc_atfork_handler_parent () +{ + UNLOCK_ALIGNED_BLOCKS (); + UNLOCK (); +} + +static void +malloc_atfork_handler_child () +{ + UNLOCK_ALIGNED_BLOCKS (); + UNLOCK (); +} + +/* Set up mutexes and make malloc etc. thread-safe. */ +void +malloc_enable_thread () +{ + if (_malloc_thread_enabled_p) + return; + + /* Some pthread implementations call malloc for statically + initialized mutexes when they are used first. To avoid such a + situation, we initialize mutexes here while their use is + disabled in malloc etc. */ + pthread_mutex_init (&_malloc_mutex, NULL); + pthread_mutex_init (&_aligned_blocks_mutex, NULL); + pthread_atfork (malloc_atfork_handler_prepare, + malloc_atfork_handler_parent, + malloc_atfork_handler_child); + _malloc_thread_enabled_p = 1; +} #endif static void @@ -575,19 +639,6 @@ malloc_initialize_1 () if (__malloc_initialize_hook) (*__malloc_initialize_hook) (); - /* We don't use recursive mutex because pthread_mutexattr_init may - call malloc internally. */ -#if 0 /* defined (USE_PTHREAD) */ - { - pthread_mutexattr_t attr; - - pthread_mutexattr_init (&attr); - pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE); - pthread_mutex_init (&_malloc_mutex, &attr); - pthread_mutexattr_destroy (&attr); - } -#endif - heapsize = HEAP / BLOCKSIZE; _heapinfo = (malloc_info *) align (heapsize * sizeof (malloc_info)); if (_heapinfo == NULL) @@ -1808,6 +1859,36 @@ memalign (alignment, size) return result; } +#ifndef ENOMEM +#define ENOMEM 12 +#endif + +#ifndef EINVAL +#define EINVAL 22 +#endif + +int +posix_memalign (memptr, alignment, size) + __ptr_t *memptr; + __malloc_size_t alignment; + __malloc_size_t size; +{ + __ptr_t mem; + + if (alignment == 0 + || alignment % sizeof (__ptr_t) != 0 + || (alignment & (alignment - 1)) != 0) + return EINVAL; + + mem = memalign (alignment, size); + if (mem == NULL) + return ENOMEM; + + *memptr = mem; + + return 0; +} + #endif /* Not DJGPP v1 */ /* Allocate memory on a page boundary. Copyright (C) 1991, 92, 93, 94, 96 Free Software Foundation, Inc. diff --git a/src/gtkutil.c b/src/gtkutil.c index a4c0522c49b..0f95acaa2c7 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -3372,8 +3372,16 @@ xg_tool_bar_callback (w, client_data) key = AREF (f->tool_bar_items, idx + TOOL_BAR_ITEM_KEY); XSETFRAME (frame, f); + + /* We generate two events here. The first one is to set the prefix + to `(tool_bar)', see keyboard.c. */ event.kind = TOOL_BAR_EVENT; event.frame_or_window = frame; + event.arg = frame; + kbd_buffer_store_event (&event); + + event.kind = TOOL_BAR_EVENT; + event.frame_or_window = frame; event.arg = key; /* Convert between the modifier bits GDK uses and the modifier bits Emacs uses. This assumes GDK an X masks are the same, which they are when @@ -3794,7 +3802,7 @@ update_frame_tool_bar (f) gtk_container_add (GTK_CONTAINER (weventbox), wbutton); ti = gtk_tool_item_new (); gtk_container_add (GTK_CONTAINER (ti), weventbox); - gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), ti, i); + gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), ti, -1); } continue; } @@ -3811,7 +3819,7 @@ update_frame_tool_bar (f) gtk_container_add (GTK_CONTAINER (weventbox), wbutton); ti = gtk_tool_item_new (); gtk_container_add (GTK_CONTAINER (ti), weventbox); - gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), ti, i); + gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), ti, -1); /* The EMACS_INT cast avoids a warning. */ diff --git a/src/image.c b/src/image.c index d38ca04e083..96335558afa 100644 --- a/src/image.c +++ b/src/image.c @@ -1644,6 +1644,8 @@ search_image_cache (f, spec, hash) struct image_cache *c = FRAME_X_IMAGE_CACHE (f); int i = hash % IMAGE_CACHE_BUCKETS_SIZE; + if (!c) return NULL; + /* If the image spec does not specify a background color, the cached image must have the same background color as the current frame. The foreground color must also match, for the sake of monochrome @@ -1655,13 +1657,10 @@ search_image_cache (f, spec, hash) for formats that don't use transparency (such as jpeg), or if the image spec specifies :background. However, the extra memory usage is probably negligible in practice, so we don't bother. */ - if (!c) return NULL; for (img = c->buckets[i]; img; img = img->next) if (img->hash == hash && !NILP (Fequal (img->spec, spec)) - /* If the image spec specifies a background, it doesn't matter - what the frame background is. */ && img->frame_foreground == FRAME_FOREGROUND_PIXEL (f) && img->frame_background == FRAME_BACKGROUND_PIXEL (f)) break; @@ -6362,11 +6361,14 @@ png_load (f, img) PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); } } + /* The commented-out code checked if the png specifies a default + background color, and uses that. Since we use the current + frame background, it is OK for us to ignore this. + else if (fn_png_get_bKGD (png_ptr, info_ptr, &image_bg)) - /* Image contains a background color with which to - combine the image. */ fn_png_set_background (png_ptr, image_bg, PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); + */ else { /* Image does not contain a background color with which diff --git a/src/indent.c b/src/indent.c index c4ed2b94854..88856814279 100644 --- a/src/indent.c +++ b/src/indent.c @@ -118,7 +118,7 @@ character_width (c, dp) return 0; } -/* Return true iff the display table DISPTAB specifies the same widths +/* Return true if the display table DISPTAB specifies the same widths for characters as WIDTHTAB. We use this to decide when to invalidate the buffer's width_run_cache. */ diff --git a/src/indent.h b/src/indent.h index 2d3c158b069..2e873769603 100644 --- a/src/indent.h +++ b/src/indent.h @@ -61,7 +61,7 @@ extern int last_known_column_point; /* Functions for dealing with the column cache. */ -/* Return true iff the display table DISPTAB specifies the same widths +/* Return true if the display table DISPTAB specifies the same widths for characters as WIDTHTAB. We use this to decide when to invalidate the buffer's column_cache. */ int disptab_matches_widthtab P_ ((struct Lisp_Char_Table *disptab, diff --git a/src/insdel.c b/src/insdel.c index 14e7478e69a..19823623091 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -2137,6 +2137,20 @@ prepare_to_modify_buffer (start, end, preserve_ptr) #define FETCH_END \ (! NILP (end_marker) ? Fmarker_position (end_marker) : end) +/* Set a variable to nil if an error occurred. + VAL is a cons-cell whose car is the variable name, and whose cdr is + either nil (to mean that there was indeed an error), or non-nil to mean + that the was no error (which thus causes this function to do + nothing). */ +Lisp_Object +reset_var_on_error (val) + Lisp_Object val; +{ + if (NILP (XCDR (val))) + Fset (XCAR (val), Qnil); + return Qnil; +} + /* Signal a change to the buffer immediately before it happens. START_INT and END_INT are the bounds of the text to be changed. @@ -2152,6 +2166,7 @@ signal_before_change (start_int, end_int, preserve_ptr) Lisp_Object start_marker, end_marker; Lisp_Object preserve_marker; struct gcpro gcpro1, gcpro2, gcpro3; + int count = SPECPDL_INDEX (); if (inhibit_modification_hooks) return; @@ -2163,6 +2178,8 @@ signal_before_change (start_int, end_int, preserve_ptr) end_marker = Qnil; GCPRO3 (preserve_marker, start_marker, end_marker); + specbind (Qinhibit_modification_hooks, Qt); + /* If buffer is unmodified, run a special hook for that case. */ if (SAVE_MODIFF >= MODIFF && !NILP (Vfirst_change_hook) @@ -2177,46 +2194,22 @@ signal_before_change (start_int, end_int, preserve_ptr) if (!NILP (Vbefore_change_functions)) { Lisp_Object args[3]; - Lisp_Object before_change_functions; - Lisp_Object after_change_functions; - struct gcpro gcpro1, gcpro2; - struct buffer *old = current_buffer; - struct buffer *new; + Lisp_Object rvoe_arg = Fcons (Qbefore_change_functions, Qnil); PRESERVE_VALUE; PRESERVE_START_END; - /* "Bind" before-change-functions and after-change-functions - to nil--but in a way that errors don't know about. - That way, if there's an error in them, they will stay nil. */ - before_change_functions = Vbefore_change_functions; - after_change_functions = Vafter_change_functions; - Vbefore_change_functions = Qnil; - Vafter_change_functions = Qnil; - GCPRO2 (before_change_functions, after_change_functions); + /* Mark before-change-functions to be reset to nil in case of error. */ + record_unwind_protect (reset_var_on_error, rvoe_arg); /* Actually run the hook functions. */ args[0] = Qbefore_change_functions; args[1] = FETCH_START; args[2] = FETCH_END; - run_hook_list_with_args (before_change_functions, 3, args); + Frun_hook_with_args (3, args); - /* "Unbind" the variables we "bound" to nil. Beware a - buffer-local hook which changes the buffer when run (e.g. W3). */ - if (old != current_buffer) - { - new = current_buffer; - set_buffer_internal (old); - Vbefore_change_functions = before_change_functions; - Vafter_change_functions = after_change_functions; - set_buffer_internal (new); - } - else - { - Vbefore_change_functions = before_change_functions; - Vafter_change_functions = after_change_functions; - } - UNGCPRO; + /* There was no error: unarm the reset_on_error. */ + XSETCDR (rvoe_arg, Qt); } if (current_buffer->overlays_before || current_buffer->overlays_after) @@ -2232,6 +2225,8 @@ signal_before_change (start_int, end_int, preserve_ptr) free_marker (end_marker); RESTORE_VALUE; UNGCPRO; + + unbind_to (count, Qnil); } /* Signal a change immediately after it happens. @@ -2245,6 +2240,7 @@ void signal_after_change (charpos, lendel, lenins) int charpos, lendel, lenins; { + int count = SPECPDL_INDEX (); if (inhibit_modification_hooks) return; @@ -2275,48 +2271,25 @@ signal_after_change (charpos, lendel, lenins) if (!NILP (combine_after_change_list)) Fcombine_after_change_execute (); + specbind (Qinhibit_modification_hooks, Qt); + if (!NILP (Vafter_change_functions)) { Lisp_Object args[4]; - Lisp_Object before_change_functions; - Lisp_Object after_change_functions; - struct buffer *old = current_buffer; - struct buffer *new; - struct gcpro gcpro1, gcpro2; - - /* "Bind" before-change-functions and after-change-functions - to nil--but in a way that errors don't know about. - That way, if there's an error in them, they will stay nil. */ - before_change_functions = Vbefore_change_functions; - after_change_functions = Vafter_change_functions; - Vbefore_change_functions = Qnil; - Vafter_change_functions = Qnil; - GCPRO2 (before_change_functions, after_change_functions); + Lisp_Object rvoe_arg = Fcons (Qafter_change_functions, Qnil); + + /* Mark after-change-functions to be reset to nil in case of error. */ + record_unwind_protect (reset_var_on_error, rvoe_arg); /* Actually run the hook functions. */ args[0] = Qafter_change_functions; XSETFASTINT (args[1], charpos); XSETFASTINT (args[2], charpos + lenins); XSETFASTINT (args[3], lendel); - run_hook_list_with_args (after_change_functions, - 4, args); + Frun_hook_with_args (4, args); - /* "Unbind" the variables we "bound" to nil. Beware a - buffer-local hook which changes the buffer when run (e.g. W3). */ - if (old != current_buffer) - { - new = current_buffer; - set_buffer_internal (old); - Vbefore_change_functions = before_change_functions; - Vafter_change_functions = after_change_functions; - set_buffer_internal (new); - } - else - { - Vbefore_change_functions = before_change_functions; - Vafter_change_functions = after_change_functions; - } - UNGCPRO; + /* There was no error: unarm the reset_on_error. */ + XSETCDR (rvoe_arg, Qt); } if (current_buffer->overlays_before || current_buffer->overlays_after) @@ -2332,6 +2305,8 @@ signal_after_change (charpos, lendel, lenins) if (lendel == 0) report_interval_modification (make_number (charpos), make_number (charpos + lenins)); + + unbind_to (count, Qnil); } Lisp_Object diff --git a/src/intervals.c b/src/intervals.c index 89f99a052b9..a695976b8b7 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -2200,7 +2200,7 @@ set_point_both (buffer, charpos, bytepos) temp_set_point_both (buffer, charpos, bytepos); - /* We run point-left and point-entered hooks here, iff the + /* We run point-left and point-entered hooks here, if the two intervals are not equivalent. These hooks take (old_point, new_point) as arguments. */ if (NILP (Vinhibit_point_motion_hooks) diff --git a/src/keyboard.c b/src/keyboard.c index 8999dd05759..626748b6c12 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -487,7 +487,7 @@ static struct input_event * volatile kbd_store_ptr; /* The above pair of variables forms a "queue empty" flag. When we enqueue a non-hook event, we increment kbd_store_ptr. When we dequeue a non-hook event, we increment kbd_fetch_ptr. We say that - there is input available iff the two pointers are not equal. + there is input available if the two pointers are not equal. Why not just have a flag set and cleared by the enqueuing and dequeuing functions? Such a flag could be screwed up by interrupts @@ -3703,7 +3703,7 @@ restore_getcjmp (temp) kbd_buffer_store_event places events in kbd_buffer, and kbd_buffer_get_event retrieves them. */ -/* Return true iff there are any events in the queue that read-char +/* Return true if there are any events in the queue that read-char would return. If this returns false, a read-char would block. */ static int readable_events (flags) diff --git a/src/keyboard.h b/src/keyboard.h index 869449f4000..a65bf8cfa02 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -248,7 +248,7 @@ extern Lisp_Object item_properties; /* Macros for dealing with lispy events. */ -/* True iff EVENT has data fields describing it (i.e. a mouse click). */ +/* True if EVENT has data fields describing it (i.e. a mouse click). */ #define EVENT_HAS_PARAMETERS(event) (CONSP (event)) /* Extract the head from an event. diff --git a/src/keymap.c b/src/keymap.c index b4f74885e91..181d43a4f48 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -4067,7 +4067,7 @@ don't alter it yourself. */); DEFVAR_LISP ("minor-mode-map-alist", &Vminor_mode_map_alist, doc: /* Alist of keymaps to use for minor modes. Each element looks like (VARIABLE . KEYMAP); KEYMAP is used to read -key sequences and look up bindings iff VARIABLE's value is non-nil. +key sequences and look up bindings if VARIABLE's value is non-nil. If two active keymaps bind the same key, the keymap appearing earlier in the list takes precedence. */); Vminor_mode_map_alist = Qnil; diff --git a/src/lisp.h b/src/lisp.h index 6dee6e0a7d4..2273015d643 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -1444,7 +1444,7 @@ typedef unsigned char UCHAR; #define GLYPH_CHAR(f, g) (FAST_GLYPH_CHAR (g)) #define GLYPH_FACE(f, g) (FAST_GLYPH_FACE (g)) -/* Return 1 iff GLYPH contains valid character code. */ +/* Return 1 if GLYPH contains valid character code. */ #define GLYPH_CHAR_VALID_P(glyph) CHAR_VALID_P (FAST_GLYPH_CHAR (glyph), 1) /* The ID of the mode line highlighting face. */ @@ -1591,7 +1591,7 @@ typedef unsigned char UCHAR; "dead", which is what we want; this is an argument-checking macro, and the user should never get access to interior windows. - A window of any sort, leaf or interior, is dead iff the buffer, + A window of any sort, leaf or interior, is dead if the buffer, vchild, and hchild members are all nil. */ #define CHECK_LIVE_WINDOW(x) \ diff --git a/src/lread.c b/src/lread.c index 78e8b2730fe..bc667fc9270 100644 --- a/src/lread.c +++ b/src/lread.c @@ -95,7 +95,7 @@ Lisp_Object Qfile_truename, Qdo_after_load_evaluation; /* ACM 2006/5/16 */ extern Lisp_Object Qevent_symbol_element_mask; extern Lisp_Object Qfile_exists_p; -/* non-zero iff inside `load' */ +/* non-zero if inside `load' */ int load_in_progress; /* Directory in which the sources were found. */ @@ -1128,7 +1128,7 @@ in which case file-name-handlers are ignored. */) On success, returns a file descriptor. On failure, returns -1. SUFFIXES is a list of strings containing possible suffixes. - The empty suffix is automatically added iff the list is empty. + The empty suffix is automatically added if the list is empty. PREDICATE non-nil means don't open the files, just look for one that satisfies the predicate. In this case, @@ -4079,7 +4079,7 @@ customize `jka-compr-load-suffixes' rather than the present variable. */); Vload_file_rep_suffixes = Fcons (empty_unibyte_string, Qnil); DEFVAR_BOOL ("load-in-progress", &load_in_progress, - doc: /* Non-nil iff inside of `load'. */); + doc: /* Non-nil if inside of `load'. */); DEFVAR_LISP ("after-load-alist", &Vafter_load_alist, doc: /* An alist of expressions to be evalled when particular files are loaded. diff --git a/src/m/7300.h b/src/m/7300.h index b590593abc8..6e439a829cc 100644 --- a/src/m/7300.h +++ b/src/m/7300.h @@ -30,7 +30,7 @@ Boston, MA 02110-1301, USA. */ /* # define SHORTNAMES */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/acorn.h b/src/m/acorn.h index 7fa5991e28b..148d46454ab 100644 --- a/src/m/acorn.h +++ b/src/m/acorn.h @@ -21,7 +21,7 @@ Boston, MA 02110-1301, USA. */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/alliant-2800.h b/src/m/alliant-2800.h index 3d65f9d1f12..405267afb2b 100644 --- a/src/m/alliant-2800.h +++ b/src/m/alliant-2800.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="bsd4-3" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/alliant.h b/src/m/alliant.h index b871d4a2385..7cad4bfb0c1 100644 --- a/src/m/alliant.h +++ b/src/m/alliant.h @@ -26,7 +26,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="bsd4-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/alpha.h b/src/m/alpha.h index 84e74d581d1..5e46a05ab68 100644 --- a/src/m/alpha.h +++ b/src/m/alpha.h @@ -35,7 +35,7 @@ NOTE-END on OSF 4/5 -- fx. */ #endif -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/altos.h b/src/m/altos.h index 8a1cb138345..0f4bb9b810f 100644 --- a/src/m/altos.h +++ b/src/m/altos.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="usg5-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/amdahl.h b/src/m/amdahl.h index 3d9ee17e91f..486e2925a55 100644 --- a/src/m/amdahl.h +++ b/src/m/amdahl.h @@ -31,7 +31,7 @@ This file works with the Amdahl uts native C compiler. The 5.2u370 compiler is so brain damaged that it is not even worth trying to use it. */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/amdx86-64.h b/src/m/amdx86-64.h index fbd53a955a2..681be8b0647 100644 --- a/src/m/amdx86-64.h +++ b/src/m/amdx86-64.h @@ -26,7 +26,7 @@ Boston, MA 02110-1301, USA. */ #define BITS_PER_LONG 64 #define BITS_PER_EMACS_INT 64 -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/apollo.h b/src/m/apollo.h index b769c24c294..2eac3098db9 100644 --- a/src/m/apollo.h +++ b/src/m/apollo.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="bsd4-3" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/arm.h b/src/m/arm.h index b1df83f9b70..697179723f7 100644 --- a/src/m/arm.h +++ b/src/m/arm.h @@ -21,7 +21,7 @@ Boston, MA 02110-1301, USA. */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/att3b.h b/src/m/att3b.h index 3344aabc2a9..8e9a589bcd2 100644 --- a/src/m/att3b.h +++ b/src/m/att3b.h @@ -26,7 +26,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="usg5-2-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/aviion.h b/src/m/aviion.h index 7f3f7f253d5..832feb79a00 100644 --- a/src/m/aviion.h +++ b/src/m/aviion.h @@ -20,7 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/celerity.h b/src/m/celerity.h index 76f1e1729b3..556c2765883 100644 --- a/src/m/celerity.h +++ b/src/m/celerity.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="bsd4-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/clipper.h b/src/m/clipper.h index de99ba97eb5..c0006f48eab 100644 --- a/src/m/clipper.h +++ b/src/m/clipper.h @@ -20,7 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/cnvrgnt.h b/src/m/cnvrgnt.h index f64fc86b08b..22478a273b6 100644 --- a/src/m/cnvrgnt.h +++ b/src/m/cnvrgnt.h @@ -20,7 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/convex.h b/src/m/convex.h index 7f90d22117c..c8f447cf2fa 100644 --- a/src/m/convex.h +++ b/src/m/convex.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="bsd4-3" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/cydra5.h b/src/m/cydra5.h index 2361fb4b589..4c95f226371 100644 --- a/src/m/cydra5.h +++ b/src/m/cydra5.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="usg5-3" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/delta88k.h b/src/m/delta88k.h index c767e1db1ca..b5d0c8f190b 100644 --- a/src/m/delta88k.h +++ b/src/m/delta88k.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="usg5-3" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/dpx2.h b/src/m/dpx2.h index 1c1d146a08a..b39ef93ee34 100644 --- a/src/m/dpx2.h +++ b/src/m/dpx2.h @@ -32,7 +32,7 @@ Boston, MA 02110-1301, USA. */ /* #define ncl_el /* DPX/2 210,220 etc */ /* #define ncl_mr 1 /* DPX/2 320,340 (and 360,380 ?) */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/dual.h b/src/m/dual.h index 4fda7a8a96c..d287f9502d2 100644 --- a/src/m/dual.h +++ b/src/m/dual.h @@ -35,7 +35,7 @@ Dual running Uniplus (-machine=dual -opsystem=unipl5-2) NOTE-END */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/elxsi.h b/src/m/elxsi.h index 81689e66e52..07a00bbf714 100644 --- a/src/m/elxsi.h +++ b/src/m/elxsi.h @@ -27,7 +27,7 @@ Boston, MA 02110-1301, USA. */ /* This file was modified by Matt Crawford <matt@tank.uchicago.edu> to work under Elxsi's 12.0 release of BSD unix. */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/gould.h b/src/m/gould.h index c31f50249e7..cd16e09b785 100644 --- a/src/m/gould.h +++ b/src/m/gould.h @@ -49,7 +49,7 @@ Gould Power Node (-machine=gould -opsystem=bsd4-2 or bsd4-3) A site running a pre-release of 2.1 should #define RELEASE2_1 in config.h. NOTE-END */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/hp800.h b/src/m/hp800.h index d54690104b5..83465052478 100644 --- a/src/m/hp800.h +++ b/src/m/hp800.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="hpux" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/hp9000s300.h b/src/m/hp9000s300.h index 3718bb3f3ae..9a27065f866 100644 --- a/src/m/hp9000s300.h +++ b/src/m/hp9000s300.h @@ -59,7 +59,7 @@ NOTE-END */ /* #define HPUX_5 */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/i860.h b/src/m/i860.h index 1255f2f1576..6d79c5c8d38 100644 --- a/src/m/i860.h +++ b/src/m/i860.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="<name of system .h file here, without the s- or .h>" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/ia64.h b/src/m/ia64.h index b6fea6b8fd7..8f7fed8d69e 100644 --- a/src/m/ia64.h +++ b/src/m/ia64.h @@ -23,7 +23,7 @@ Boston, MA 02110-1301, USA. */ #define BITS_PER_LONG 64 #define BITS_PER_EMACS_INT 64 -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/ibm370aix.h b/src/m/ibm370aix.h index f632a30780b..0195ec141ab 100644 --- a/src/m/ibm370aix.h +++ b/src/m/ibm370aix.h @@ -30,7 +30,7 @@ Boston, MA 02110-1301, USA. */ #undef INTEL386 #undef aix386 -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/ibmps2-aix.h b/src/m/ibmps2-aix.h index 8882052b006..8c975b81bb9 100644 --- a/src/m/ibmps2-aix.h +++ b/src/m/ibmps2-aix.h @@ -30,7 +30,7 @@ NOTE-START work with certain new X window managers, and may be suboptimal. NOTE-END */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/ibmrs6000.h b/src/m/ibmrs6000.h index 2a298e7f760..d542c07ad0a 100644 --- a/src/m/ibmrs6000.h +++ b/src/m/ibmrs6000.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="aix3-1" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #ifdef USG5_4 diff --git a/src/m/ibmrt-aix.h b/src/m/ibmrt-aix.h index d24e99fe6d6..57a9dbc4df1 100644 --- a/src/m/ibmrt-aix.h +++ b/src/m/ibmrt-aix.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="usg5-2-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/ibmrt.h b/src/m/ibmrt.h index 55cbfd88371..ca32db94518 100644 --- a/src/m/ibmrt.h +++ b/src/m/ibmrt.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="bsd4-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/ibms390.h b/src/m/ibms390.h index aece0f7599e..1c7165e04c0 100644 --- a/src/m/ibms390.h +++ b/src/m/ibms390.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="<name of system .h file here, without the s- or .h>" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/ibms390x.h b/src/m/ibms390x.h index fb1f210c634..64ede365d0c 100644 --- a/src/m/ibms390x.h +++ b/src/m/ibms390x.h @@ -36,7 +36,7 @@ NOTE-END */ #define BITS_PER_LONG 64 #define BITS_PER_EMACS_INT 64 -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/intel386.h b/src/m/intel386.h index 7c6c2106d17..22205ed762c 100644 --- a/src/m/intel386.h +++ b/src/m/intel386.h @@ -50,7 +50,7 @@ Prime EXL (-machine=intel386 -opsystem=usg5-3) Minor changes merged in 19.1. NOTE-END */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/iris4d.h b/src/m/iris4d.h index d918c25aede..4c15131e595 100644 --- a/src/m/iris4d.h +++ b/src/m/iris4d.h @@ -20,7 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/irist.h b/src/m/irist.h index 0b33bd964aa..c0d55f96d0f 100644 --- a/src/m/irist.h +++ b/src/m/irist.h @@ -58,7 +58,7 @@ NOTE-END */ (copy-file), it would say that it is non-critical... #endif /* 0 */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/isi-ov.h b/src/m/isi-ov.h index 7e25ed9d277..6706ee9981b 100644 --- a/src/m/isi-ov.h +++ b/src/m/isi-ov.h @@ -30,7 +30,7 @@ NOTE-END */ #define ISI68K -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/m68k.h b/src/m/m68k.h index c771e863711..4c600a44d8c 100644 --- a/src/m/m68k.h +++ b/src/m/m68k.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ the size of various data types. */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/macppc.h b/src/m/macppc.h index cc4afe31519..d4561c0289f 100644 --- a/src/m/macppc.h +++ b/src/m/macppc.h @@ -19,7 +19,7 @@ along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/masscomp.h b/src/m/masscomp.h index ac753de1537..4e95c268860 100644 --- a/src/m/masscomp.h +++ b/src/m/masscomp.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="rtu" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/mega68.h b/src/m/mega68.h index 6d991ba06a2..0d22b572fc5 100644 --- a/src/m/mega68.h +++ b/src/m/mega68.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="bsd4-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/mg1.h b/src/m/mg1.h index 647544e21e4..515e9e23a96 100644 --- a/src/m/mg1.h +++ b/src/m/mg1.h @@ -34,7 +34,7 @@ own configuration files, please let the Free Software Foundation in on your work; we'd like to distribute this information. NOTE-END */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/mips-siemens.h b/src/m/mips-siemens.h index d90a651d361..53366a1332e 100644 --- a/src/m/mips-siemens.h +++ b/src/m/mips-siemens.h @@ -36,7 +36,7 @@ This is the m- file for SNI RM*00 machines. Use s- sinix5-4.h file! With this the file mips-siemens.h is obsolete. NOTE-END */ -/* Define BIG_ENDIAN iff lowest-numbered byte in a word +/* Define BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define BIG_ENDIAN diff --git a/src/m/mips.h b/src/m/mips.h index b18324fb8b7..6c039c5e14c 100644 --- a/src/m/mips.h +++ b/src/m/mips.h @@ -29,7 +29,7 @@ Use mips4.h for RISCOS version 4; use s-bsd4-3.h with the BSD world. Note that the proper m file for the Decstation is pmax.h. NOTE-END */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #if ! (defined (__MIPSEL__) || defined (MIPSEL) || defined (_MIPSEL)) diff --git a/src/m/news.h b/src/m/news.h index 419015dd150..084c5abb92c 100644 --- a/src/m/news.h +++ b/src/m/news.h @@ -34,7 +34,7 @@ NOTE-END */ #define m68000 #endif -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/next.h b/src/m/next.h index ef92607d957..bca8ac39d47 100644 --- a/src/m/next.h +++ b/src/m/next.h @@ -26,7 +26,7 @@ Boston, MA 02110-1301, USA. */ #define NeXT #endif -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ /* Let the compiler tell us. */ diff --git a/src/m/ns16000.h b/src/m/ns16000.h index c64bfa32482..6feddd97610 100644 --- a/src/m/ns16000.h +++ b/src/m/ns16000.h @@ -30,7 +30,7 @@ For a Tektronix 16000 box (a 6130, perhaps?), use `-opsystem=bsd4-2'. Use `-machine=ns16000' for both. NOTE-END */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/ns32000.h b/src/m/ns32000.h index 0b776115ca8..b6484b4b219 100644 --- a/src/m/ns32000.h +++ b/src/m/ns32000.h @@ -25,7 +25,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="usg5-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/nu.h b/src/m/nu.h index 347606a6c01..279d14ff915 100644 --- a/src/m/nu.h +++ b/src/m/nu.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="usg5-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/orion.h b/src/m/orion.h index 36a74b3cc3b..cc3a7e395fc 100644 --- a/src/m/orion.h +++ b/src/m/orion.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="bsd4-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/orion105.h b/src/m/orion105.h index 73408ed1b2f..fabcf67e2a9 100644 --- a/src/m/orion105.h +++ b/src/m/orion105.h @@ -25,7 +25,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="bsd4-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/pfa50.h b/src/m/pfa50.h index 8f1f146000e..5f98dc993c7 100644 --- a/src/m/pfa50.h +++ b/src/m/pfa50.h @@ -20,7 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/plexus.h b/src/m/plexus.h index 4a4e6a32f7f..51961977904 100644 --- a/src/m/plexus.h +++ b/src/m/plexus.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="usg5-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/powermac.h b/src/m/powermac.h index 729bbb0358b..2dde47bd6cf 100644 --- a/src/m/powermac.h +++ b/src/m/powermac.h @@ -23,7 +23,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="darwin" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/powerpcle.h b/src/m/powerpcle.h index 403d6986bf8..5be26e93b17 100644 --- a/src/m/powerpcle.h +++ b/src/m/powerpcle.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ USUAL-OPSYS="Solaris2.5.1 Windows/NT AIX 4.1.2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/pyramid.h b/src/m/pyramid.h index 9ee3fefe387..1b834c60ba0 100644 --- a/src/m/pyramid.h +++ b/src/m/pyramid.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="bsd4-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/sequent.h b/src/m/sequent.h index be5d3f19bd1..3c06d854b41 100644 --- a/src/m/sequent.h +++ b/src/m/sequent.h @@ -31,7 +31,7 @@ NOTE-END */ /* NOTE: this file works for DYNIX release 2.0 (not tested on 1.3) on NS32000's */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/sh3el.h b/src/m/sh3el.h index 5851ade1523..eefcccea6de 100644 --- a/src/m/sh3el.h +++ b/src/m/sh3el.h @@ -23,7 +23,7 @@ Boston, MA 02111-1307, USA. */ operating system this machine is likely to run. USUAL-OPSYS="<name of system .h file here, without the s- or .h>" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/sparc.h b/src/m/sparc.h index f59c2c2b969..8df81ee91aa 100644 --- a/src/m/sparc.h +++ b/src/m/sparc.h @@ -28,7 +28,7 @@ Use -opsystem=sunos4 for operating system version 4, and -opsystem=bsd4-2 for earlier versions. NOTE-END */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/sps7.h b/src/m/sps7.h index 68acf2c6c52..67fc60c1b6a 100644 --- a/src/m/sps7.h +++ b/src/m/sps7.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="usg5-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/sr2k.h b/src/m/sr2k.h index ba4a9a905ab..6c17795e058 100644 --- a/src/m/sr2k.h +++ b/src/m/sr2k.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="hpux" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/stride.h b/src/m/stride.h index cb0380024a1..d846a6c9843 100644 --- a/src/m/stride.h +++ b/src/m/stride.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="usg5-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/sun1.h b/src/m/sun1.h index fda451a9310..03cb4e803ff 100644 --- a/src/m/sun1.h +++ b/src/m/sun1.h @@ -40,7 +40,7 @@ Sun 1, 2 and 3 (-machine=sun1, -machine=sun2, -machine=sun3; problems caused by bugs in the "export" version of SunOS 4. NOTE-END */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/sun2.h b/src/m/sun2.h index 00b7ae97c4d..e764ded3ce7 100644 --- a/src/m/sun2.h +++ b/src/m/sun2.h @@ -42,7 +42,7 @@ Sun 1, 2 and 3 (-machine=sun1, -machine=sun2, -machine=sun3; problems caused by bugs in the "export" version of SunOS 4. NOTE-END */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/tad68k.h b/src/m/tad68k.h index 5e982a314ab..c8be8763fb5 100644 --- a/src/m/tad68k.h +++ b/src/m/tad68k.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="usg5-3" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/tahoe.h b/src/m/tahoe.h index 8fe41cd4109..9b9271577fc 100644 --- a/src/m/tahoe.h +++ b/src/m/tahoe.h @@ -29,7 +29,7 @@ Use -opsystem=bsd4-2 or -opsystem=bsd4-3, depending on the version of Berkeley you are running. NOTE-END */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/targon31.h b/src/m/targon31.h index 0c657e0ea5d..39e995b076d 100644 --- a/src/m/targon31.h +++ b/src/m/targon31.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="usg5-2-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/tek4300.h b/src/m/tek4300.h index be43210212a..6498238461d 100644 --- a/src/m/tek4300.h +++ b/src/m/tek4300.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="bsd4-3" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/tekxd88.h b/src/m/tekxd88.h index 1d46bb9bb55..f351229292f 100644 --- a/src/m/tekxd88.h +++ b/src/m/tekxd88.h @@ -22,7 +22,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/template.h b/src/m/template.h index fccc5b0901c..b893ba23df2 100644 --- a/src/m/template.h +++ b/src/m/template.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="<name of system .h file here, without the s- or .h>" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/tower32.h b/src/m/tower32.h index 0ce623b7f37..01daada2423 100644 --- a/src/m/tower32.h +++ b/src/m/tower32.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="usg5-2-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/tower32v3.h b/src/m/tower32v3.h index 226c0e2640a..ff209edab41 100644 --- a/src/m/tower32v3.h +++ b/src/m/tower32v3.h @@ -25,7 +25,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="usg5-3" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/ustation.h b/src/m/ustation.h index f88cdc5ee63..0ac833c28da 100644 --- a/src/m/ustation.h +++ b/src/m/ustation.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="usg5-3" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/vax.h b/src/m/vax.h index 80844ba3ba6..82695074424 100644 --- a/src/m/vax.h +++ b/src/m/vax.h @@ -52,7 +52,7 @@ Vax running VMS (-opsystem=vms) NOTE-END */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #undef WORDS_BIG_ENDIAN diff --git a/src/m/wicat.h b/src/m/wicat.h index 67409844666..3ac7b530739 100644 --- a/src/m/wicat.h +++ b/src/m/wicat.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="usg5-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/m/windowsnt.h b/src/m/windowsnt.h index f1efe64a4f5..ddad551c772 100644 --- a/src/m/windowsnt.h +++ b/src/m/windowsnt.h @@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="<name of system .h file here, without the s- or .h>" */ -/* Define BIG_ENDIAN iff lowest-numbered byte in a word +/* Define BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ /* #define BIG_ENDIAN */ diff --git a/src/m/xps100.h b/src/m/xps100.h index 691f5fedbd6..3b378319ceb 100644 --- a/src/m/xps100.h +++ b/src/m/xps100.h @@ -26,7 +26,7 @@ Boston, MA 02110-1301, USA. */ operating system this machine is likely to run. USUAL-OPSYS="usg5-2" */ -/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word +/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ #define WORDS_BIG_ENDIAN diff --git a/src/mac.c b/src/mac.c index e81db1479b9..64af2407ab1 100644 --- a/src/mac.c +++ b/src/mac.c @@ -1127,18 +1127,15 @@ Lisp_Object cfdate_to_lisp (date) CFDateRef date; { - static const CFGregorianDate epoch_gdate = {1970, 1, 1, 0, 0, 0.0}; - static CFAbsoluteTime epoch = 0.0, sec; - int high, low; + CFTimeInterval sec; + int high, low, microsec; - if (epoch == 0.0) - epoch = CFGregorianDateGetAbsoluteTime (epoch_gdate, NULL); - - sec = CFDateGetAbsoluteTime (date) - epoch; + sec = CFDateGetAbsoluteTime (date) + kCFAbsoluteTimeIntervalSince1970; high = sec / 65536.0; low = sec - high * 65536.0; + microsec = (sec - floor (sec)) * 1000000.0; - return list3 (make_number (high), make_number (low), make_number (0)); + return list3 (make_number (high), make_number (low), make_number (microsec)); } diff --git a/src/macmenu.c b/src/macmenu.c index 71b384c0762..8305c89ee68 100644 --- a/src/macmenu.c +++ b/src/macmenu.c @@ -2331,6 +2331,7 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error) ((value) + DIALOG_BUTTON_COMMAND_ID_OFFSET) extern EMACS_TIME timer_check P_ ((int)); +static int quit_dialog_event_loop; static pascal OSStatus mac_handle_dialog_event (next_handler, event, data) @@ -2340,7 +2341,6 @@ mac_handle_dialog_event (next_handler, event, data) { OSStatus err, result = eventNotHandledErr; WindowRef window = (WindowRef) data; - int quit_event_loop_p = 0; switch (GetEventClass (event)) { @@ -2355,7 +2355,7 @@ mac_handle_dialog_event (next_handler, event, data) if (DIALOG_BUTTON_COMMAND_ID_P (command.commandID)) { SetWRefCon (window, command.commandID); - quit_event_loop_p = 1; + quit_dialog_event_loop = 1; break; } @@ -2379,7 +2379,7 @@ mac_handle_dialog_event (next_handler, event, data) switch (char_code) { case kEscapeCharCode: - quit_event_loop_p = 1; + quit_dialog_event_loop = 1; break; default: @@ -2395,7 +2395,7 @@ mac_handle_dialog_event (next_handler, event, data) NULL, &key_code); if (err == noErr) if (mac_quit_char_key_p (modifiers, key_code)) - quit_event_loop_p = 1; + quit_dialog_event_loop = 1; } break; } @@ -2406,7 +2406,7 @@ mac_handle_dialog_event (next_handler, event, data) abort (); } - if (quit_event_loop_p) + if (quit_dialog_event_loop) { err = QuitEventLoop (GetCurrentEventLoop ()); if (err == noErr) @@ -2733,6 +2733,7 @@ create_and_show_dialog (f, first_wv) { EventTargetRef toolbox_dispatcher = GetEventDispatcherTarget (); + quit_dialog_event_loop = 0; while (1) { EMACS_TIME next_time = timer_check (1); @@ -2758,12 +2759,22 @@ create_and_show_dialog (f, first_wv) SendEventToEventTarget (event, toolbox_dispatcher); ReleaseEvent (event); } +#ifdef MAC_OSX else if (err != eventLoopTimedOutErr) { if (err == eventLoopQuitErr) err = noErr; break; } +#else + /* The return value of ReceiveNextEvent seems to be + unreliable. Use our own global variable instead. */ + if (quit_dialog_event_loop) + { + err = noErr; + break; + } +#endif } } if (err == noErr) diff --git a/src/macselect.c b/src/macselect.c index 04034c499b7..9515a5774ec 100644 --- a/src/macselect.c +++ b/src/macselect.c @@ -25,22 +25,27 @@ Boston, MA 02110-1301, USA. */ #include "blockinput.h" #include "keymap.h" -#if !TARGET_API_MAC_CARBON +#if TARGET_API_MAC_CARBON +typedef ScrapRef Selection; +#else /* !TARGET_API_MAC_CARBON */ +#include <Scrap.h> #include <Endian.h> -typedef int ScrapRef; -typedef ResType ScrapFlavorType; +typedef int Selection; #endif /* !TARGET_API_MAC_CARBON */ -static OSStatus get_scrap_from_symbol P_ ((Lisp_Object, int, ScrapRef *)); -static ScrapFlavorType get_flavor_type_from_symbol P_ ((Lisp_Object)); -static int valid_scrap_target_type_p P_ ((Lisp_Object)); -static OSStatus clear_scrap P_ ((ScrapRef *)); -static OSStatus put_scrap_string P_ ((ScrapRef, Lisp_Object, Lisp_Object)); -static OSStatus put_scrap_private_timestamp P_ ((ScrapRef, unsigned long)); -static ScrapFlavorType scrap_has_target_type P_ ((ScrapRef, Lisp_Object)); -static Lisp_Object get_scrap_string P_ ((ScrapRef, Lisp_Object)); -static OSStatus get_scrap_private_timestamp P_ ((ScrapRef, unsigned long *)); -static Lisp_Object get_scrap_target_type_list P_ ((ScrapRef)); +static OSStatus mac_get_selection_from_symbol P_ ((Lisp_Object, int, + Selection *)); +static ScrapFlavorType get_flavor_type_from_symbol P_ ((Lisp_Object, + Selection)); +static int mac_valid_selection_target_p P_ ((Lisp_Object)); +static OSStatus mac_clear_selection P_ ((Selection *)); +static Lisp_Object mac_get_selection_ownership_info P_ ((Selection)); +static int mac_valid_selection_value_p P_ ((Lisp_Object, Lisp_Object)); +static OSStatus mac_put_selection_value P_ ((Selection, Lisp_Object, + Lisp_Object)); +static int mac_selection_has_target_p P_ ((Selection, Lisp_Object)); +static Lisp_Object mac_get_selection_value P_ ((Selection, Lisp_Object)); +static Lisp_Object mac_get_selection_target_list P_ ((Selection)); static void x_own_selection P_ ((Lisp_Object, Lisp_Object)); static Lisp_Object x_get_local_selection P_ ((Lisp_Object, Lisp_Object, int)); static Lisp_Object x_get_foreign_selection P_ ((Lisp_Object, @@ -56,7 +61,7 @@ void init_service_handler P_ ((void)); Lisp_Object QPRIMARY, QSECONDARY, QTIMESTAMP, QTARGETS; static Lisp_Object Vx_lost_selection_functions; -/* Coding system for communicating with other programs via scrap. */ +/* Coding system for communicating with other programs via selections. */ static Lisp_Object Vselection_coding_system; /* Coding system for the next communicating with other programs. */ @@ -70,23 +75,24 @@ static Lisp_Object Qforeign_selection; extern unsigned long last_event_timestamp; /* This is an association list whose elements are of the form - ( SELECTION-NAME SELECTION-VALUE SELECTION-TIMESTAMP FRAME) + ( SELECTION-NAME SELECTION-VALUE SELECTION-TIMESTAMP FRAME OWNERSHIP-INFO) SELECTION-NAME is a lisp symbol. SELECTION-VALUE is the value that emacs owns for that selection. It may be any kind of Lisp object. SELECTION-TIMESTAMP is the time at which emacs began owning this selection, as a cons of two 16-bit numbers (making a 32 bit time.) FRAME is the frame for which we made the selection. - If there is an entry in this alist, and the data for the flavor - type SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP in the corresponding scrap - (if exists) coincides with SELECTION-TIMESTAMP, then it can be - assumed that Emacs owns that selection. + OWNERSHIP-INFO is a value saved when emacs owns for that selection. + If another application takes the ownership of that selection + later, then newly examined ownership info value should be + different from the saved one. + If there is an entry in this alist, the current ownership info for + the selection coincides with OWNERSHIP-INFO, then it can be + assumed that Emacs owns that selection. The only (eq) parts of this list that are visible from Lisp are the selection-values. */ static Lisp_Object Vselection_alist; -#define SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP 'Etsp' - /* This is an alist whose CARs are selection-types and whose CDRs are the names of Lisp functions to call to convert the given Emacs selection value to a string representing the given selection type. @@ -104,21 +110,22 @@ static Lisp_Object Qmac_scrap_name, Qmac_ostype; static Lisp_Object Vmac_service_selection; #endif -/* Get a reference to the scrap corresponding to the symbol SYM. The - reference is set to *SCRAP, and it becomes NULL if there's no - corresponding scrap. Clear the scrap if CLEAR_P is non-zero. */ +/* Get a reference to the selection corresponding to the symbol SYM. + The reference is set to *SEL, and it becomes NULL if there's no + corresponding selection. Clear the selection if CLEAR_P is + non-zero. */ static OSStatus -get_scrap_from_symbol (sym, clear_p, scrap) +mac_get_selection_from_symbol (sym, clear_p, sel) Lisp_Object sym; int clear_p; - ScrapRef *scrap; + Selection *sel; { OSStatus err = noErr; Lisp_Object str = Fget (sym, Qmac_scrap_name); if (!STRINGP (str)) - *scrap = NULL; + *sel = NULL; else { #if TARGET_API_MAC_CARBON @@ -127,19 +134,19 @@ get_scrap_from_symbol (sym, clear_p, scrap) OptionBits options = (clear_p ? kScrapClearNamedScrap : kScrapGetNamedScrap); - err = GetScrapByName (scrap_name, options, scrap); + err = GetScrapByName (scrap_name, options, sel); CFRelease (scrap_name); #else /* !MAC_OSX */ if (clear_p) err = ClearCurrentScrap (); if (err == noErr) - err = GetCurrentScrap (scrap); + err = GetCurrentScrap (sel); #endif /* !MAC_OSX */ #else /* !TARGET_API_MAC_CARBON */ if (clear_p) err = ZeroScrap (); if (err == noErr) - *scrap = 1; + *sel = 1; #endif /* !TARGET_API_MAC_CARBON */ } @@ -147,138 +154,154 @@ get_scrap_from_symbol (sym, clear_p, scrap) } /* Get a scrap flavor type from the symbol SYM. Return 0 if no - corresponding flavor type. */ + corresponding flavor type. If SEL is non-zero, the return value is + non-zero only when the SEL has the flavor type. */ static ScrapFlavorType -get_flavor_type_from_symbol (sym) +get_flavor_type_from_symbol (sym, sel) Lisp_Object sym; + Selection sel; { Lisp_Object str = Fget (sym, Qmac_ostype); + ScrapFlavorType flavor_type; if (STRINGP (str) && SBYTES (str) == 4) - return EndianU32_BtoN (*((UInt32 *) SDATA (str))); + flavor_type = EndianU32_BtoN (*((UInt32 *) SDATA (str))); + else + flavor_type = 0; + + if (flavor_type && sel) + { +#if TARGET_API_MAC_CARBON + OSStatus err; + ScrapFlavorFlags flags; - return 0; + err = GetScrapFlavorFlags (sel, flavor_type, &flags); + if (err != noErr) + flavor_type = 0; +#else /* !TARGET_API_MAC_CARBON */ + SInt32 size, offset; + + size = GetScrap (NULL, flavor_type, &offset); + if (size < 0) + flavor_type = 0; +#endif /* !TARGET_API_MAC_CARBON */ + } + + return flavor_type; } -/* Check if the symbol SYM has a corresponding scrap flavor type. */ +/* Check if the symbol SYM has a corresponding selection target type. */ static int -valid_scrap_target_type_p (sym) +mac_valid_selection_target_p (sym) Lisp_Object sym; { - return get_flavor_type_from_symbol (sym) != 0; + return get_flavor_type_from_symbol (sym, 0) != 0; } -/* Clear the scrap whose reference is *SCRAP. */ +/* Clear the selection whose reference is *SEL. */ -static INLINE OSStatus -clear_scrap (scrap) - ScrapRef *scrap; +static OSStatus +mac_clear_selection (sel) + Selection *sel; { #if TARGET_API_MAC_CARBON #ifdef MAC_OSX - return ClearScrap (scrap); + return ClearScrap (sel); #else - return ClearCurrentScrap (); + OSStatus err; + + err = ClearCurrentScrap (); + if (err == noErr) + err = GetCurrentScrap (sel); + return err; #endif #else /* !TARGET_API_MAC_CARBON */ return ZeroScrap (); #endif /* !TARGET_API_MAC_CARBON */ } -/* Put Lisp String STR to the scrap SCRAP. The target type is - specified by TYPE. */ +/* Get ownership information for SEL. Emacs can detect a change of + the ownership by comparing saved and current values of the + ownership information. */ -static OSStatus -put_scrap_string (scrap, type, str) - ScrapRef scrap; - Lisp_Object type, str; +static Lisp_Object +mac_get_selection_ownership_info (sel) + Selection sel; { - ScrapFlavorType flavor_type = get_flavor_type_from_symbol (type); - - if (flavor_type == 0) - return noTypeErr; - #if TARGET_API_MAC_CARBON - return PutScrapFlavor (scrap, flavor_type, kScrapFlavorMaskNone, - SBYTES (str), SDATA (str)); + return long_to_cons ((unsigned long) sel); #else /* !TARGET_API_MAC_CARBON */ - return PutScrap (SBYTES (str), flavor_type, SDATA (str)); + ScrapStuffPtr scrap_info = InfoScrap (); + + return make_number (scrap_info->scrapCount); #endif /* !TARGET_API_MAC_CARBON */ } -/* Put TIMESTAMP to the scrap SCRAP. The timestamp is used for - checking if the scrap is owned by the process. */ +/* Return non-zero if VALUE is a valid selection value for TARGET. */ -static INLINE OSStatus -put_scrap_private_timestamp (scrap, timestamp) - ScrapRef scrap; - unsigned long timestamp; +static int +mac_valid_selection_value_p (value, target) + Lisp_Object value, target; { -#if TARGET_API_MAC_CARBON - return PutScrapFlavor (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP, - kScrapFlavorMaskSenderOnly, - sizeof (timestamp), ×tamp); -#else /* !TARGET_API_MAC_CARBON */ - return PutScrap (sizeof (timestamp), SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP, - ×tamp); -#endif /* !TARGET_API_MAC_CARBON */ + return STRINGP (value); } -/* Check if data for the target type TYPE is available in SCRAP. */ +/* Put Lisp Object VALUE to the selection SEL. The target type is + specified by TARGET. */ -static ScrapFlavorType -scrap_has_target_type (scrap, type) - ScrapRef scrap; - Lisp_Object type; +static OSStatus +mac_put_selection_value (sel, target, value) + Selection sel; + Lisp_Object target, value; { - OSStatus err; - ScrapFlavorType flavor_type = get_flavor_type_from_symbol (type); + ScrapFlavorType flavor_type = get_flavor_type_from_symbol (target, 0); - if (flavor_type) - { -#if TARGET_API_MAC_CARBON - ScrapFlavorFlags flags; + if (flavor_type == 0 || !STRINGP (value)) + return noTypeErr; - err = GetScrapFlavorFlags (scrap, flavor_type, &flags); - if (err != noErr) - flavor_type = 0; +#if TARGET_API_MAC_CARBON + return PutScrapFlavor (sel, flavor_type, kScrapFlavorMaskNone, + SBYTES (value), SDATA (value)); #else /* !TARGET_API_MAC_CARBON */ - SInt32 size, offset; - - size = GetScrap (NULL, flavor_type, &offset); - if (size < 0) - flavor_type = 0; + return PutScrap (SBYTES (value), flavor_type, SDATA (value)); #endif /* !TARGET_API_MAC_CARBON */ - } +} - return flavor_type; +/* Check if data for the target type TARGET is available in SEL. */ + +static int +mac_selection_has_target_p (sel, target) + Selection sel; + Lisp_Object target; +{ + return get_flavor_type_from_symbol (target, sel) != 0; } -/* Get data for the target type TYPE from SCRAP and create a Lisp +/* Get data for the target type TARGET from SEL and create a Lisp string. Return nil if failed to get data. */ static Lisp_Object -get_scrap_string (scrap, type) - ScrapRef scrap; - Lisp_Object type; +mac_get_selection_value (sel, target) + Selection sel; + Lisp_Object target; { OSStatus err; Lisp_Object result = Qnil; - ScrapFlavorType flavor_type = get_flavor_type_from_symbol (type); + ScrapFlavorType flavor_type = get_flavor_type_from_symbol (target, sel); #if TARGET_API_MAC_CARBON Size size; if (flavor_type) { - err = GetScrapFlavorSize (scrap, flavor_type, &size); + err = GetScrapFlavorSize (sel, flavor_type, &size); if (err == noErr) { do { result = make_uninit_string (size); - err = GetScrapFlavorData (scrap, flavor_type, + err = GetScrapFlavorData (sel, flavor_type, &size, SDATA (result)); if (err != noErr) result = Qnil; @@ -308,72 +331,25 @@ get_scrap_string (scrap, type) return result; } -/* Get timestamp from the scrap SCRAP and set to *TIMPSTAMP. */ - -static OSStatus -get_scrap_private_timestamp (scrap, timestamp) - ScrapRef scrap; - unsigned long *timestamp; -{ - OSStatus err = noErr; -#if TARGET_API_MAC_CARBON - ScrapFlavorFlags flags; - - err = GetScrapFlavorFlags (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP, &flags); - if (err == noErr) - { - if (!(flags & kScrapFlavorMaskSenderOnly)) - err = noTypeErr; - else - { - Size size = sizeof (*timestamp); - - err = GetScrapFlavorData (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP, - &size, timestamp); - if (err == noErr && size != sizeof (*timestamp)) - err = noTypeErr; - } - } -#else /* !TARGET_API_MAC_CARBON */ - Handle handle; - SInt32 size, offset; - - size = GetScrap (NULL, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP, &offset); - if (size == sizeof (*timestamp)) - { - handle = NewHandle (size); - HLock (handle); - size = GetScrap (handle, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP, &offset); - if (size == sizeof (*timestamp)) - *timestamp = *((unsigned long *) *handle); - DisposeHandle (handle); - } - if (size != sizeof (*timestamp)) - err = noTypeErr; -#endif /* !TARGET_API_MAC_CARBON */ - - return err; -} - -/* Get the list of target types in SCRAP. The return value is a list - of target type symbols possibly followed by scrap flavor type +/* Get the list of target types in SEL. The return value is a list of + target type symbols possibly followed by scrap flavor type strings. */ static Lisp_Object -get_scrap_target_type_list (scrap) - ScrapRef scrap; +mac_get_selection_target_list (sel) + Selection sel; { - Lisp_Object result = Qnil, rest, target_type; + Lisp_Object result = Qnil, rest, target; #if TARGET_API_MAC_CARBON OSStatus err; UInt32 count, i, type; ScrapFlavorInfo *flavor_info = NULL; Lisp_Object strings = Qnil; - err = GetScrapFlavorCount (scrap, &count); + err = GetScrapFlavorCount (sel, &count); if (err == noErr) flavor_info = xmalloc (sizeof (ScrapFlavorInfo) * count); - err = GetScrapFlavorInfoList (scrap, &count, flavor_info); + err = GetScrapFlavorInfoList (sel, &count, flavor_info); if (err != noErr) { xfree (flavor_info); @@ -387,11 +363,11 @@ get_scrap_target_type_list (scrap) ScrapFlavorType flavor_type = 0; if (CONSP (XCAR (rest)) - && (target_type = XCAR (XCAR (rest)), - SYMBOLP (target_type)) - && (flavor_type = scrap_has_target_type (scrap, target_type))) + && (target = XCAR (XCAR (rest)), + SYMBOLP (target)) + && (flavor_type = get_flavor_type_from_symbol (target, sel))) { - result = Fcons (target_type, result); + result = Fcons (target, result); #if TARGET_API_MAC_CARBON for (i = 0; i < count; i++) if (flavor_info[i].flavorType == flavor_type) @@ -428,9 +404,9 @@ x_own_selection (selection_name, selection_value) Lisp_Object selection_name, selection_value; { OSStatus err; - ScrapRef scrap; + Selection sel; struct gcpro gcpro1, gcpro2; - Lisp_Object rest, handler_fn, value, type; + Lisp_Object rest, handler_fn, value, target_type; int count; CHECK_SYMBOL (selection_name); @@ -439,8 +415,8 @@ x_own_selection (selection_name, selection_value) BLOCK_INPUT; - err = get_scrap_from_symbol (selection_name, 1, &scrap); - if (err == noErr && scrap) + err = mac_get_selection_from_symbol (selection_name, 1, &sel); + if (err == noErr && sel) { /* Don't allow a quit within the converter. When the user types C-g, he would be surprised @@ -451,49 +427,56 @@ x_own_selection (selection_name, selection_value) for (rest = Vselection_converter_alist; CONSP (rest); rest = XCDR (rest)) { if (!(CONSP (XCAR (rest)) - && (type = XCAR (XCAR (rest)), - SYMBOLP (type)) - && valid_scrap_target_type_p (type) + && (target_type = XCAR (XCAR (rest)), + SYMBOLP (target_type)) + && mac_valid_selection_target_p (target_type) && (handler_fn = XCDR (XCAR (rest)), SYMBOLP (handler_fn)))) continue; if (!NILP (handler_fn)) value = call3 (handler_fn, selection_name, - type, selection_value); + target_type, selection_value); + + if (NILP (value)) + continue; - if (STRINGP (value)) - err = put_scrap_string (scrap, type, value); + if (mac_valid_selection_value_p (value, target_type)) + err = mac_put_selection_value (sel, target_type, value); else if (CONSP (value) - && EQ (XCAR (value), type) - && STRINGP (XCDR (value))) - err = put_scrap_string (scrap, type, XCDR (value)); + && EQ (XCAR (value), target_type) + && mac_valid_selection_value_p (XCDR (value), target_type)) + err = mac_put_selection_value (sel, target_type, XCDR (value)); } unbind_to (count, Qnil); - - if (err == noErr) - err = put_scrap_private_timestamp (scrap, last_event_timestamp); } UNBLOCK_INPUT; UNGCPRO; - if (scrap && err != noErr) + if (sel && err != noErr) error ("Can't set selection"); /* Now update the local cache */ { Lisp_Object selection_time; Lisp_Object selection_data; + Lisp_Object ownership_info; Lisp_Object prev_value; selection_time = long_to_cons (last_event_timestamp); + if (sel) + ownership_info = mac_get_selection_ownership_info (sel); + else + ownership_info = Qnil; /* dummy value for local-only selection */ selection_data = Fcons (selection_name, Fcons (selection_value, Fcons (selection_time, - Fcons (selected_frame, Qnil)))); + Fcons (selected_frame, + Fcons (ownership_info, + Qnil))))); prev_value = assq_no_quit (selection_name, Vselection_alist); Vselection_alist = Fcons (selection_data, Vselection_alist); @@ -574,29 +557,20 @@ x_get_local_selection (selection_symbol, target_type, local_request) unbind_to (count, Qnil); } + if (local_request) + return value; + /* Make sure this value is of a type that we could transmit - to another X client. */ + to another application. */ + type = target_type; check = value; if (CONSP (value) && SYMBOLP (XCAR (value))) type = XCAR (value), check = XCDR (value); - if (STRINGP (check) - || VECTORP (check) - || SYMBOLP (check) - || INTEGERP (check) - || NILP (value)) - return value; - /* Check for a value that cons_to_long could handle. */ - else if (CONSP (check) - && INTEGERP (XCAR (check)) - && (INTEGERP (XCDR (check)) - || - (CONSP (XCDR (check)) - && INTEGERP (XCAR (XCDR (check))) - && NILP (XCDR (XCDR (check)))))) + if (NILP (value) || mac_valid_selection_value_p (check, type)) return value; signal_error ("Invalid data returned by selection-conversion function", @@ -676,22 +650,22 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp) Lisp_Object selection_symbol, target_type, time_stamp; { OSStatus err; - ScrapRef scrap; + Selection sel; Lisp_Object result = Qnil; BLOCK_INPUT; - err = get_scrap_from_symbol (selection_symbol, 0, &scrap); - if (err == noErr && scrap) + err = mac_get_selection_from_symbol (selection_symbol, 0, &sel); + if (err == noErr && sel) { if (EQ (target_type, QTARGETS)) { - result = get_scrap_target_type_list (scrap); + result = mac_get_selection_target_list (sel); result = Fvconcat (1, &result); } else { - result = get_scrap_string (scrap, target_type); + result = mac_get_selection_value (sel, target_type); if (STRINGP (result)) Fput_text_property (make_number (0), make_number (SBYTES (result)), Qforeign_selection, target_type, result); @@ -770,7 +744,7 @@ Disowning it means there is no such selection. */) Lisp_Object time; { OSStatus err; - ScrapRef scrap; + Selection sel; Lisp_Object local_selection_data; check_mac (); @@ -812,9 +786,9 @@ Disowning it means there is no such selection. */) BLOCK_INPUT; - err = get_scrap_from_symbol (selection, 0, &scrap); - if (err == noErr && scrap) - clear_scrap (&scrap); + err = mac_get_selection_from_symbol (selection, 0, &sel); + if (err == noErr && sel) + mac_clear_selection (&sel); UNBLOCK_INPUT; @@ -833,7 +807,7 @@ and t is the same as `SECONDARY'. */) Lisp_Object selection; { OSStatus err; - ScrapRef scrap; + Selection sel; Lisp_Object result = Qnil, local_selection_data; check_mac (); @@ -848,15 +822,14 @@ and t is the same as `SECONDARY'. */) BLOCK_INPUT; - err = get_scrap_from_symbol (selection, 0, &scrap); - if (err == noErr && scrap) + err = mac_get_selection_from_symbol (selection, 0, &sel); + if (err == noErr && sel) { - unsigned long timestamp; + Lisp_Object ownership_info; - err = get_scrap_private_timestamp (scrap, ×tamp); - if (err == noErr - && (timestamp - == cons_to_long (XCAR (XCDR (XCDR (local_selection_data)))))) + ownership_info = XCAR (XCDR (XCDR (XCDR (XCDR (local_selection_data))))); + if (!NILP (Fequal (ownership_info, + mac_get_selection_ownership_info (sel)))) result = Qt; } else @@ -878,7 +851,7 @@ and t is the same as `SECONDARY'. */) Lisp_Object selection; { OSStatus err; - ScrapRef scrap; + Selection sel; Lisp_Object result = Qnil, rest; /* It should be safe to call this before we have an Mac frame. */ @@ -893,12 +866,12 @@ and t is the same as `SECONDARY'. */) BLOCK_INPUT; - err = get_scrap_from_symbol (selection, 0, &scrap); - if (err == noErr && scrap) + err = mac_get_selection_from_symbol (selection, 0, &sel); + if (err == noErr && sel) for (rest = Vselection_converter_alist; CONSP (rest); rest = XCDR (rest)) { if (CONSP (XCAR (rest)) && SYMBOLP (XCAR (XCAR (rest))) - && scrap_has_target_type (scrap, XCAR (XCAR (rest)))) + && mac_selection_has_target_p (sel, XCAR (XCAR (rest)))) { result = Qt; break; @@ -1700,7 +1673,7 @@ mac_handle_service_event (call_ref, event, data) if (!SYMBOLP (Vmac_service_selection)) err = eventNotHandledErr; else - err = get_scrap_from_symbol (Vmac_service_selection, 0, &cur_scrap); + err = mac_get_selection_from_symbol (Vmac_service_selection, 0, &cur_scrap); if (!(err == noErr && cur_scrap)) return eventNotHandledErr; @@ -1719,7 +1692,7 @@ mac_handle_service_event (call_ref, event, data) rest = XCDR (rest)) if (CONSP (XCAR (rest)) && SYMBOLP (XCAR (XCAR (rest))) && (flavor_type = - get_flavor_type_from_symbol (XCAR (XCAR (rest))))) + get_flavor_type_from_symbol (XCAR (XCAR (rest)), 0))) { type = CreateTypeStringWithOSType (flavor_type); if (type) @@ -1804,14 +1777,15 @@ mac_handle_service_event (call_ref, event, data) NULL, sizeof (ScrapRef), NULL, &specific_scrap); if (err == noErr) - err = clear_scrap (&cur_scrap); + err = mac_clear_selection (&cur_scrap); if (err == noErr) for (rest = Vselection_converter_alist; CONSP (rest); rest = XCDR (rest)) { if (! (CONSP (XCAR (rest)) && SYMBOLP (XCAR (XCAR (rest))))) continue; - flavor_type = get_flavor_type_from_symbol (XCAR (XCAR (rest))); + flavor_type = get_flavor_type_from_symbol (XCAR (XCAR (rest)), + specific_scrap); if (flavor_type == 0) continue; err = copy_scrap_flavor_data (specific_scrap, cur_scrap, diff --git a/src/macterm.c b/src/macterm.c index 5643372845b..31f3cfbdcd7 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -4329,14 +4329,6 @@ static void frame_highlight (f) struct frame *f; { - OSErr err; - ControlRef root_control; - - BLOCK_INPUT; - err = GetRootControl (FRAME_MAC_WINDOW (f), &root_control); - if (err == noErr) - ActivateControl (root_control); - UNBLOCK_INPUT; x_update_cursor (f, 1); } @@ -4344,14 +4336,6 @@ static void frame_unhighlight (f) struct frame *f; { - OSErr err; - ControlRef root_control; - - BLOCK_INPUT; - err = GetRootControl (FRAME_MAC_WINDOW (f), &root_control); - if (err == noErr) - DeactivateControl (root_control); - UNBLOCK_INPUT; x_update_cursor (f, 1); } @@ -6109,7 +6093,9 @@ free_frame_tool_bar (f) BLOCK_INPUT; ShowHideWindowToolbar (FRAME_MAC_WINDOW (f), false, - f == mac_focus_frame (dpyinfo)); + (NILP (Fsymbol_value + (intern ("frame-notice-user-settings"))) + && f == mac_focus_frame (dpyinfo))); /* Mac OS X 10.3 does not issue kEventWindowBoundsChanged events on toolbar visibility change. */ mac_handle_origin_change (f); @@ -9386,11 +9372,13 @@ mac_handle_font_event (next_handler, event, data) static const EventParamName names_sel[] = {kEventParamATSUFontID, kEventParamATSUFontSize, kEventParamFMFontFamily, + kEventParamFMFontStyle, kEventParamFMFontSize, kEventParamFontColor}; static const EventParamType types_sel[] = {typeATSUFontID, typeATSUSize, typeFMFontFamily, + typeFMFontStyle, typeFMFontSize, typeFontColor}; @@ -10711,7 +10699,7 @@ mac_handle_window_event (next_handler, event, data) { struct frame *sf = SELECTED_FRAME (); - if (!(FRAME_MAC_P (sf))) + if (!(FRAME_MAC_P (sf) && sf->async_visible)) RepositionWindow (wp, NULL, kWindowCenterOnMainScreen); else { @@ -10726,8 +10714,11 @@ mac_handle_window_event (next_handler, event, data) /* This is a workaround. RepositionWindow fails to put a window at the cascading position when its parent window has a Carbon HIToolbar. */ - if (f->top_pos == sf->top_pos && f->left_pos == sf->left_pos) - MoveWindowStructure (wp, f->left_pos + 10, f->top_pos + 32); + if ((f->left_pos == sf->left_pos + && f->top_pos == sf->top_pos) + || (f->left_pos == sf->left_pos + 10 * 2 + && f->top_pos == sf->top_pos + 32 * 2)) + MoveWindowStructure (wp, sf->left_pos + 10, sf->top_pos + 32); #endif } result = noErr; @@ -10952,7 +10943,7 @@ mac_handle_keyboard_event (next_handler, event, data) void *data; { OSStatus err, result = eventNotHandledErr; - UInt32 event_kind, key_code, modifiers, mapped_modifiers; + UInt32 event_kind, key_code, modifiers; unsigned char char_code; event_kind = GetEventKind (event); @@ -10961,32 +10952,16 @@ mac_handle_keyboard_event (next_handler, event, data) case kEventRawKeyDown: case kEventRawKeyRepeat: case kEventRawKeyUp: - if (read_socket_inev == NULL) - { - result = CallNextEventHandler (next_handler, event); - break; - } - - err = GetEventParameter (event, kEventParamKeyModifiers, - typeUInt32, NULL, - sizeof (UInt32), NULL, &modifiers); - if (err != noErr) - break; - - mapped_modifiers = mac_mapped_modifiers (modifiers); - /* When using Carbon Events, we need to pass raw keyboard events to the TSM ourselves. If TSM handles it, it will pass back noErr, otherwise it will pass back "eventNotHandledErr" and we can process it normally. */ - if (!(mapped_modifiers - & ~(mac_pass_command_to_system ? cmdKey : 0) - & ~(mac_pass_control_to_system ? controlKey : 0))) - { - result = CallNextEventHandler (next_handler, event); - if (result != eventNotHandledErr) - break; - } + result = CallNextEventHandler (next_handler, event); + if (result != eventNotHandledErr) + break; + + if (read_socket_inev == NULL) + break; #if USE_MAC_TSM if (read_socket_inev->kind != NO_EVENT) @@ -11011,6 +10986,12 @@ mac_handle_keyboard_event (next_handler, event, data) if (err != noErr) break; + err = GetEventParameter (event, kEventParamKeyModifiers, + typeUInt32, NULL, + sizeof (UInt32), NULL, &modifiers); + if (err != noErr) + break; + do_keystroke ((event_kind == kEventRawKeyDown ? keyDown : autoKey), char_code, key_code, modifiers, ((unsigned long) @@ -12157,7 +12138,7 @@ XTread_socket (sd, expected, hold_quit) /* Window will be selected only when it is not selected now and last mouse movement event was not in it. Minibuffer window - will be selected iff it is active. */ + will be selected only when it is active. */ if (WINDOWP (window) && !EQ (window, last_window) && !EQ (window, selected_window)) @@ -12192,6 +12173,8 @@ XTread_socket (sd, expected, hold_quit) case activateEvt: { WindowRef window_ptr = (WindowRef) er.message; + OSErr err; + ControlRef root_control; if (window_ptr == tip_window) { @@ -12209,6 +12192,10 @@ XTread_socket (sd, expected, hold_quit) /* A window has been activated */ Point mouse_loc; + err = GetRootControl (FRAME_MAC_WINDOW (f), &root_control); + if (err == noErr) + ActivateControl (root_control); + x_detect_focus_change (dpyinfo, &er, &inev); mouse_loc.h = (er.where.h @@ -12224,6 +12211,10 @@ XTread_socket (sd, expected, hold_quit) else { /* A window has been deactivated */ + err = GetRootControl (FRAME_MAC_WINDOW (f), &root_control); + if (err == noErr) + DeactivateControl (root_control); + #ifdef USE_TOOLKIT_SCROLL_BARS if (dpyinfo->grabbed && tracked_scroll_bar) { @@ -12279,13 +12270,29 @@ XTread_socket (sd, expected, hold_quit) clear_mouse_face (dpyinfo); dpyinfo->mouse_face_hidden = 1; } + + { + UInt32 modifiers = er.modifiers, mapped_modifiers; + +#ifdef MAC_OSX + GetEventParameter (eventRef, kEventParamKeyModifiers, + typeUInt32, NULL, + sizeof (UInt32), NULL, &modifiers); +#endif + mapped_modifiers = mac_mapped_modifiers (modifiers); + #if TARGET_API_MAC_CARBON - goto OTHER; -#else - do_keystroke (er.what, er.message & charCodeMask, - (er.message & keyCodeMask) >> 8, - er.modifiers, timestamp, &inev); + if (!(mapped_modifiers + & ~(mac_pass_command_to_system ? cmdKey : 0) + & ~(mac_pass_control_to_system ? controlKey : 0))) + goto OTHER; + else #endif + if (er.what != keyUp) + do_keystroke (er.what, er.message & charCodeMask, + (er.message & keyCodeMask) >> 8, + modifiers, timestamp, &inev); + } break; case kHighLevelEvent: @@ -12339,7 +12346,6 @@ XTread_socket (sd, expected, hold_quit) } count++; } - } /* If the focus was just given to an autoraising frame, diff --git a/src/macterm.h b/src/macterm.h index d0d5d58e65e..9df9b1abcdb 100644 --- a/src/macterm.h +++ b/src/macterm.h @@ -153,7 +153,7 @@ struct mac_display_info char *mac_id_name; /* The number of fonts actually stored in the font table. - font_table[n] is used and valid iff 0 <= n < n_fonts. 0 <= + font_table[n] is used and valid if 0 <= n < n_fonts. 0 <= n_fonts <= font_table_size and font_table[i].name != 0. */ int n_fonts; diff --git a/src/msdos.c b/src/msdos.c index fd4f211b2f6..fc14be2705c 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -3231,7 +3231,7 @@ dos_rawgetc () `dos_get_modifiers', they might have already released the Alt key, and Emacs gets just `x', which is BAD. However, for keys with the `Map' property set, the ASCII - code returns zero iff Alt is pressed. So, when we DON'T + code returns zero only if Alt is pressed. So, when we DON'T have to support international_keyboard, we don't have to distinguish between the left and right Alt keys, and we can set the META modifier for any keys with the `Map' diff --git a/src/print.c b/src/print.c index 8b3aaaa1ee9..cd3d6438bff 100644 --- a/src/print.c +++ b/src/print.c @@ -93,8 +93,8 @@ Lisp_Object Vfloat_output_format, Qfloat_output_format; /* Avoid actual stack overflow in print. */ int print_depth; -/* Nonzero if inside outputting backquote in old style. */ -int old_backquote_output; +/* Level of nesting inside outputting backquote in new style. */ +int new_backquote_output; /* Detect most circularities to print finite output. */ #define PRINT_CIRCLE 200 @@ -1291,7 +1291,7 @@ print (obj, printcharfun, escapeflag) register Lisp_Object printcharfun; int escapeflag; { - old_backquote_output = 0; + new_backquote_output = 0; /* Reset print_number_index and Vprint_number_table only when the variable Vprint_continuous_numbering is nil. Otherwise, @@ -1756,14 +1756,24 @@ print_object (obj, printcharfun, escapeflag) print_object (XCAR (XCDR (obj)), printcharfun, escapeflag); } else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj))) - && ! old_backquote_output + && ((EQ (XCAR (obj), Qbackquote)))) + { + print_object (XCAR (obj), printcharfun, 0); + new_backquote_output++; + print_object (XCAR (XCDR (obj)), printcharfun, escapeflag); + new_backquote_output--; + } + else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj))) + && new_backquote_output && ((EQ (XCAR (obj), Qbackquote) || EQ (XCAR (obj), Qcomma) || EQ (XCAR (obj), Qcomma_at) || EQ (XCAR (obj), Qcomma_dot)))) { print_object (XCAR (obj), printcharfun, 0); + new_backquote_output--; print_object (XCAR (XCDR (obj)), printcharfun, escapeflag); + new_backquote_output++; } else { @@ -1783,9 +1793,7 @@ print_object (obj, printcharfun, escapeflag) print_object (Qbackquote, printcharfun, 0); PRINTCHAR (' '); - ++old_backquote_output; print_object (XCAR (XCDR (tem)), printcharfun, 0); - --old_backquote_output; PRINTCHAR (')'); obj = XCDR (obj); diff --git a/src/process.c b/src/process.c index 43609266112..dfb97b8d615 100644 --- a/src/process.c +++ b/src/process.c @@ -2780,7 +2780,7 @@ The stopped state is cleared by `continue-process' and set by :filter-multibyte BOOL -- If BOOL is non-nil, strings given to the process filter are multibyte, otherwise they are unibyte. -If this keyword is not specified, the strings are multibyte iff +If this keyword is not specified, the strings are multibyte if `default-enable-multibyte-characters' is non-nil. :sentinel SENTINEL -- Install SENTINEL as the process sentinel. @@ -3922,7 +3922,7 @@ it specifies a fractional number of seconds to wait. If optional fourth arg JUST-THIS-ONE is non-nil, only accept output from PROCESS, suspending reading output from other processes. If JUST-THIS-ONE is an integer, don't run any timers either. -Return non-nil iff we received any output before the timeout expired. */) +Return non-nil if we received any output before the timeout expired. */) (process, seconds, millisec, just_this_one) register Lisp_Object process, seconds, millisec, just_this_one; { @@ -4254,16 +4254,16 @@ select_wrapper (n, rfd, wfd, xfd, tmo) (and gobble terminal input into the buffer if any arrives). If WAIT_PROC is specified, wait until something arrives from that - process. The return value is true iff we read some input from + process. The return value is true if we read some input from that process. If JUST_WAIT_PROC is non-nil, handle only output from WAIT_PROC (suspending output from other processes). A negative value means don't run any timers either. - If WAIT_PROC is specified, then the function returns true iff we + If WAIT_PROC is specified, then the function returns true if we received input from that process before the timeout elapsed. - Otherwise, return true iff we received input from any process. */ + Otherwise, return true if we received input from any process. */ int wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, @@ -7358,7 +7358,7 @@ Lisp_Object QCtype; do_display != 0 means redisplay should be done to show subprocess output that arrives. - Return true iff we received input from any process. */ + Return true if we received input from any process. */ int wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, diff --git a/src/process.h b/src/process.h index 79875564766..eaed95fe4b7 100644 --- a/src/process.h +++ b/src/process.h @@ -138,7 +138,7 @@ extern Lisp_Object chan_process[]; /* Alist of elements (NAME . PROCESS). */ extern Lisp_Object Vprocess_alist; -/* True iff we are about to fork off a synchronous process or if we +/* True if we are about to fork off a synchronous process or if we are waiting for it. */ extern int synch_process_alive; diff --git a/src/regex.c b/src/regex.c index 64bfef15c4e..66b84c9dfc2 100644 --- a/src/regex.c +++ b/src/regex.c @@ -2048,7 +2048,7 @@ re_wctype (str) else return 0; } -/* True iff CH is in the char class CC. */ +/* True if CH is in the char class CC. */ boolean re_iswctype (ch, cc) int ch; diff --git a/src/search.c b/src/search.c index 4ae3a68b304..d91110f4b0e 100644 --- a/src/search.c +++ b/src/search.c @@ -1662,7 +1662,7 @@ simple_search (n, pat, len, len_byte, trt, pos, pos_byte, lim, lim_byte) have nontrivial translation are the same aside from the last byte. This makes it possible to translate just the last byte of a character, and do so after just a simple test of the context. - CHARSET_BASE is nonzero iff there is such a non-ASCII character. + CHARSET_BASE is nonzero if there is such a non-ASCII character. If that criterion is not satisfied, do not call this function. */ diff --git a/src/systime.h b/src/systime.h index 85c2799f083..8b1b7f56ad6 100644 --- a/src/systime.h +++ b/src/systime.h @@ -67,7 +67,7 @@ extern time_t timezone; EMACS_SECS (TIME) is an rvalue for the seconds component of TIME. EMACS_SET_SECS (TIME, SECONDS) sets that to SECONDS. - EMACS_HAS_USECS is defined iff EMACS_TIME has a usecs component. + EMACS_HAS_USECS is defined if EMACS_TIME has a usecs component. EMACS_USECS (TIME) is an rvalue for the microseconds component of TIME. This returns zero if EMACS_TIME doesn't have a microseconds component. EMACS_SET_USECS (TIME, MICROSECONDS) sets that to MICROSECONDS. @@ -83,7 +83,7 @@ extern time_t timezone; EMACS_SUB_TIME (DEST, SRC1, SRC2) subtracts SRC2 from SRC1 and stores the result in DEST. SRC should not be negative. - EMACS_TIME_NEG_P (TIME) is true iff TIME is negative. + EMACS_TIME_NEG_P (TIME) is true if TIME is negative. */ diff --git a/src/systty.h b/src/systty.h index 15dd7a4e26c..c89edfc8d93 100644 --- a/src/systty.h +++ b/src/systty.h @@ -297,7 +297,7 @@ static struct sensemode { written before making the change. Return 0 if all went well, and -1 if anything failed. - EMACS_TTY_TABS_OK (struct emacs_tty *P) is false iff the kernel + EMACS_TTY_TABS_OK (struct emacs_tty *P) is false if the kernel expands tabs to spaces upon output; in that case, there is no advantage to using tabs over spaces. */ diff --git a/src/termhooks.h b/src/termhooks.h index 740c9135866..4124e37586b 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -52,7 +52,7 @@ extern void (*fullscreen_hook) P_ ((struct frame *f)); /* Input queue declarations and hooks. */ /* Expedient hack: only provide the below definitions to files that - are prepared to handle lispy things. CONSP is defined iff lisp.h + are prepared to handle lispy things. CONSP is defined if lisp.h has been included before this file. */ #ifdef CONSP diff --git a/src/textprop.c b/src/textprop.c index 711ee571af6..8ce5656e5a2 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -1633,8 +1633,8 @@ Return t if any property was actually removed, nil otherwise. */) The flag `modified' records if changes have been made. When object is a buffer, we must call modify_region before changes are made and signal_after_change when we are done. - We call modify_region before calling remove_properties iff modified == 0, - and we call signal_after_change before returning iff modified != 0. */ + We call modify_region before calling remove_properties if modified == 0, + and we call signal_after_change before returning if modified != 0. */ for (;;) { if (i == 0) diff --git a/src/w32term.c b/src/w32term.c index fb312010728..100af4ebc21 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -4378,7 +4378,7 @@ w32_read_socket (sd, expected, hold_quit) /* Window will be selected only when it is not selected now and last mouse movement event was not in it. Minibuffer window will be selected - iff it is active. */ + only when it is active. */ if (WINDOWP(window) && !EQ (window, last_window) && !EQ (window, selected_window)) diff --git a/src/w32term.h b/src/w32term.h index bd1a5ab2aad..3e7f3a3a6a9 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -201,7 +201,7 @@ struct w32_display_info char *w32_id_name; /* The number of fonts actually stored in w32_font_table. - font_table[n] is used and valid iff 0 <= n < n_fonts. 0 <= + font_table[n] is used and valid if 0 <= n < n_fonts. 0 <= n_fonts <= font_table_size. and font_table[i].name != 0. */ int n_fonts; diff --git a/src/window.c b/src/window.c index cda5eccf082..3db1802a861 100644 --- a/src/window.c +++ b/src/window.c @@ -559,6 +559,15 @@ use (let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges))). */) return make_number (window_box_text_cols (decode_any_window (window))); } +DEFUN ("window-full-width-p", Fwindow_full_width_p, Swindow_full_width_p, 0, 1, 0, + doc: /* Return t if WINDOW is as wide as its frame. +WINDOW defaults to the selected window. */) + (window) + Lisp_Object window; +{ + return WINDOW_FULL_WIDTH_P (decode_any_window (window)) ? Qt : Qnil; +} + DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, doc: /* Return the number of columns by which WINDOW is scrolled from left margin. WINDOW defaults to the selected window. */) @@ -7517,6 +7526,7 @@ The selected frame is the one whose configuration has changed. */); defsubr (&Swindow_buffer); defsubr (&Swindow_height); defsubr (&Swindow_width); + defsubr (&Swindow_full_width_p); defsubr (&Swindow_hscroll); defsubr (&Sset_window_hscroll); defsubr (&Swindow_redisplay_end_trigger); diff --git a/src/window.h b/src/window.h index d459d9e305d..c9ef865c4f0 100644 --- a/src/window.h +++ b/src/window.h @@ -777,6 +777,7 @@ extern Lisp_Object window_from_coordinates P_ ((struct frame *, int, int, EXFUN (Fwindow_dedicated_p, 1); extern int window_height P_ ((Lisp_Object)); extern int window_width P_ ((Lisp_Object)); +EXFUN (Fwindow_full_width_p, 1); extern void set_window_height P_ ((Lisp_Object, int, int)); extern void set_window_width P_ ((Lisp_Object, int, int)); extern void change_window_heights P_ ((Lisp_Object, int)); @@ -818,7 +819,7 @@ extern int command_loop_level; extern int minibuf_level; -/* true iff we should redraw the mode lines on the next redisplay. */ +/* true if we should redraw the mode lines on the next redisplay. */ extern int update_mode_lines; diff --git a/src/xdisp.c b/src/xdisp.c index 674e07a2ed7..9d786f286cb 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -7074,18 +7074,22 @@ move_it_by_lines (it, dvpos, need_y_p) { struct position pos; - if (!FRAME_WINDOW_P (it->f)) + /* The commented-out optimization uses vmotion on terminals. This + gives bad results, because elements like it->what, on which + callers such as pos_visible_p rely, aren't updated. */ + /* if (!FRAME_WINDOW_P (it->f)) { struct text_pos textpos; - /* We can use vmotion on frames without proportional fonts. */ pos = *vmotion (IT_CHARPOS (*it), dvpos, it->w); SET_TEXT_POS (textpos, pos.bufpos, pos.bytepos); reseat (it, textpos, 1); it->vpos += pos.vpos; it->current_y += pos.vpos; } - else if (dvpos == 0) + else */ + + if (dvpos == 0) { /* DVPOS == 0 means move to the start of the screen line. */ move_it_vertically_backward (it, 0); @@ -13532,7 +13536,10 @@ redisplay_window (window, just_this_one_p) /* Restore current_buffer and value of point in it. */ TEMP_SET_PT_BOTH (CHARPOS (opoint), BYTEPOS (opoint)); set_buffer_internal_1 (old); - TEMP_SET_PT_BOTH (CHARPOS (lpoint), BYTEPOS (lpoint)); + /* Avoid an abort in TEMP_SET_PT_BOTH if the buffer has become + shorter. This can be caused by log truncation in *Messages*. */ + if (CHARPOS (lpoint) <= ZV) + TEMP_SET_PT_BOTH (CHARPOS (lpoint), BYTEPOS (lpoint)); unbind_to (count, Qnil); } diff --git a/src/xterm.c b/src/xterm.c index 6183ffade0d..1ced63932e5 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2537,9 +2537,11 @@ x_draw_image_glyph_string (s) { /* Fill background with a stipple pattern. */ XSetFillStyle (s->display, s->gc, FillOpaqueStippled); + XSetTSOrigin (s->display, s->gc, - s->x, - s->y); XFillRectangle (s->display, pixmap, s->gc, 0, 0, s->background_width, s->height); XSetFillStyle (s->display, s->gc, FillSolid); + XSetTSOrigin (s->display, s->gc, 0, 0); } else { @@ -6711,7 +6713,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) /* Window will be selected only when it is not selected now and last mouse movement event was not in it. Minibuffer window - will be selected iff it is active. */ + will be selected only when it is active. */ if (WINDOWP (window) && !EQ (window, last_window) && !EQ (window, selected_window)) diff --git a/src/xterm.h b/src/xterm.h index c5a266c45fb..c8b768f6187 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -256,7 +256,7 @@ struct x_display_info char *x_id_name; /* The number of fonts actually stored in x_font_table. - font_table[n] is used and valid iff 0 <= n < n_fonts. 0 <= + font_table[n] is used and valid if 0 <= n < n_fonts. 0 <= n_fonts <= font_table_size and font_table[i].name != 0. */ int n_fonts; |