diff options
| author | Miles Bader | 2005-09-11 22:21:01 +0000 |
|---|---|---|
| committer | Miles Bader | 2005-09-11 22:21:01 +0000 |
| commit | ff8d296438e69b8cf701d95b6ccd271c416c46fd (patch) | |
| tree | 44b388101b40592656ad4c5033aabe2a1ae4b462 /src | |
| parent | 389cb481135145b80a679beec8cdc8fed75682c5 (diff) | |
| parent | a8f6d239d2d541ec874a22000e0542c20fd55a67 (diff) | |
| download | emacs-ff8d296438e69b8cf701d95b6ccd271c416c46fd.tar.gz emacs-ff8d296438e69b8cf701d95b6ccd271c416c46fd.zip | |
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-81
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 532-541)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 112-115)
- Update from CVS
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 72 | ||||
| -rw-r--r-- | src/buffer.c | 45 | ||||
| -rw-r--r-- | src/config.in | 3 | ||||
| -rw-r--r-- | src/doc.c | 13 | ||||
| -rw-r--r-- | src/frame.h | 3 | ||||
| -rw-r--r-- | src/lisp.h | 3 | ||||
| -rw-r--r-- | src/macterm.c | 445 | ||||
| -rw-r--r-- | src/sysdep.c | 77 | ||||
| -rw-r--r-- | src/w32term.c | 28 | ||||
| -rw-r--r-- | src/xdisp.c | 39 | ||||
| -rw-r--r-- | src/xfaces.c | 5 | ||||
| -rw-r--r-- | src/xsmfns.c | 19 |
12 files changed, 590 insertions, 162 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7faeafe2329..99c9d951370 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,75 @@ | |||
| 1 | 2005-09-11 Chris Prince <cprince@gmail.com> (tiny change) | ||
| 2 | |||
| 3 | * w32term.c (x_bitmap_icon): Load small icons too. | ||
| 4 | |||
| 5 | 2005-09-10 Romain Francoise <romain@orebokech.com> | ||
| 6 | |||
| 7 | * buffer.c (init_buffer): Grow buffer to add directory separator | ||
| 8 | and terminal zero. Fix typos. | ||
| 9 | |||
| 10 | 2005-09-10 Eli Zaretskii <eliz@gnu.org> | ||
| 11 | |||
| 12 | * buffer.c (init_buffer): Fix error message for failed call to | ||
| 13 | get_current_dir_name. | ||
| 14 | (get_current_dir_name): Remove prototype. | ||
| 15 | |||
| 16 | * xsmfns.c: (get_current_dir_name): Remove prototype. | ||
| 17 | |||
| 18 | * lisp.h: (get_current_dir_name) [!HAVE_GET_CURRENT_DIR_NAME]: Add | ||
| 19 | prototype. | ||
| 20 | |||
| 21 | * sysdep.c [WINDOWSNT]: Add prototype for getwd. | ||
| 22 | Don't #undef NULL after including blockinput.h. | ||
| 23 | |||
| 24 | * config.in: Regenerated. | ||
| 25 | |||
| 26 | 2005-09-10 Giuseppe Scrivano <gscrivano@gmail.com> | ||
| 27 | |||
| 28 | Remove the MAXPATHLEN limitations: | ||
| 29 | |||
| 30 | * sysdep.c (get_current_dir_name) [!HAVE_GET_CURRENT_DIR_NAME]: | ||
| 31 | New function. | ||
| 32 | |||
| 33 | * buffer.c (init_buffer): Use it. | ||
| 34 | |||
| 35 | * xsmfns.c (smc_save_yourself_CB): Ditto. | ||
| 36 | |||
| 37 | 2005-09-09 Kim F. Storm <storm@cua.dk> | ||
| 38 | |||
| 39 | * doc.c (Fsubstitute_command_keys): Lookup key binding for | ||
| 40 | commands that are remapped from some other command. | ||
| 41 | |||
| 42 | * xdisp.c (try_window_reusing_current_matrix): Clear mode_line_p | ||
| 43 | flag in disabled rows below the window. | ||
| 44 | |||
| 45 | * frame.h (struct frame): New member updated_p. | ||
| 46 | |||
| 47 | * xdisp.c (redisplay_internal): Mark updated frames in new updated_p | ||
| 48 | member. Remove local `updated' array and associated variables. | ||
| 49 | |||
| 50 | 2005-09-07 Kim F. Storm <storm@cua.dk> | ||
| 51 | |||
| 52 | * xdisp.c (handle_display_prop): Respect overlay window property. | ||
| 53 | |||
| 54 | * xdisp.c (try_window): Remove superfluous cursor_height calculation. | ||
| 55 | Fixes crash reported by YAMAMOTO Mitsuharu. | ||
| 56 | |||
| 57 | 2005-09-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 58 | |||
| 59 | * macterm.c (struct xlfdpat_block, struct xlfdpat): New structs. | ||
| 60 | (xlfdpat_destroy, xlfdpat_create, xlfdpat_exact_p) | ||
| 61 | (xlfdpat_block_match_1, xlfdpat_match): New functions. | ||
| 62 | (xlfdpat_block_match): New macro. | ||
| 63 | (mac_to_x_fontname): Don't use tolower for non-ASCII characters. | ||
| 64 | (x_font_name_to_mac_font_name): Set coding.dst_multibyte to 0. | ||
| 65 | (add_font_name_table_entry): Increase font_name_table_size more | ||
| 66 | rapidly. | ||
| 67 | (mac_c_string_match): Remove function. | ||
| 68 | (mac_do_list_fonts): Use XLFD pattern match instead of regular | ||
| 69 | expression match. | ||
| 70 | |||
| 71 | * xfaces.c (xstrlwr): Don't use tolower for non-ASCII characters. | ||
| 72 | |||
| 1 | 2005-09-03 Richard M. Stallman <rms@gnu.org> | 73 | 2005-09-03 Richard M. Stallman <rms@gnu.org> |
| 2 | 74 | ||
| 3 | * xdisp.c (redisplay_internal): Make UPDATED as long as needed. | 75 | * xdisp.c (redisplay_internal): Make UPDATED as long as needed. |
diff --git a/src/buffer.c b/src/buffer.c index 3450e88c72d..ae2a584e506 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -32,10 +32,6 @@ Boston, MA 02110-1301, USA. */ | |||
| 32 | extern int errno; | 32 | extern int errno; |
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | #ifndef MAXPATHLEN | ||
| 36 | /* in 4.1 [probably SunOS? -stef] , param.h fails to define this. */ | ||
| 37 | #define MAXPATHLEN 1024 | ||
| 38 | #endif /* not MAXPATHLEN */ | ||
| 39 | 35 | ||
| 40 | #ifdef HAVE_UNISTD_H | 36 | #ifdef HAVE_UNISTD_H |
| 41 | #include <unistd.h> | 37 | #include <unistd.h> |
| @@ -5131,7 +5127,6 @@ init_buffer_once () | |||
| 5131 | void | 5127 | void |
| 5132 | init_buffer () | 5128 | init_buffer () |
| 5133 | { | 5129 | { |
| 5134 | char buf[MAXPATHLEN + 1]; | ||
| 5135 | char *pwd; | 5130 | char *pwd; |
| 5136 | struct stat dotstat, pwdstat; | 5131 | struct stat dotstat, pwdstat; |
| 5137 | Lisp_Object temp; | 5132 | Lisp_Object temp; |
| @@ -5154,40 +5149,28 @@ init_buffer () | |||
| 5154 | if (NILP (buffer_defaults.enable_multibyte_characters)) | 5149 | if (NILP (buffer_defaults.enable_multibyte_characters)) |
| 5155 | Fset_buffer_multibyte (Qnil); | 5150 | Fset_buffer_multibyte (Qnil); |
| 5156 | 5151 | ||
| 5157 | /* If PWD is accurate, use it instead of calling getwd. PWD is | 5152 | pwd = get_current_dir_name (); |
| 5158 | sometimes a nicer name, and using it may avoid a fatal error if a | 5153 | |
| 5159 | parent directory is searchable but not readable. */ | 5154 | if (!pwd) |
| 5160 | if ((pwd = getenv ("PWD")) != 0 | 5155 | fatal ("`get_current_dir_name' failed: %s\n", strerror (errno)); |
| 5161 | && (IS_DIRECTORY_SEP (*pwd) || (*pwd && IS_DEVICE_SEP (pwd[1]))) | ||
| 5162 | && stat (pwd, &pwdstat) == 0 | ||
| 5163 | && stat (".", &dotstat) == 0 | ||
| 5164 | && dotstat.st_ino == pwdstat.st_ino | ||
| 5165 | && dotstat.st_dev == pwdstat.st_dev | ||
| 5166 | && strlen (pwd) < MAXPATHLEN) | ||
| 5167 | strcpy (buf, pwd); | ||
| 5168 | #ifdef HAVE_GETCWD | ||
| 5169 | else if (getcwd (buf, MAXPATHLEN+1) == 0) | ||
| 5170 | fatal ("`getcwd' failed: %s\n", strerror (errno)); | ||
| 5171 | #else | ||
| 5172 | else if (getwd (buf) == 0) | ||
| 5173 | fatal ("`getwd' failed: %s\n", buf); | ||
| 5174 | #endif | ||
| 5175 | 5156 | ||
| 5176 | #ifndef VMS | 5157 | #ifndef VMS |
| 5177 | /* Maybe this should really use some standard subroutine | 5158 | /* Maybe this should really use some standard subroutine |
| 5178 | whose definition is filename syntax dependent. */ | 5159 | whose definition is filename syntax dependent. */ |
| 5179 | rc = strlen (buf); | 5160 | rc = strlen (pwd); |
| 5180 | if (!(IS_DIRECTORY_SEP (buf[rc - 1]))) | 5161 | if (!(IS_DIRECTORY_SEP (pwd[rc - 1]))) |
| 5181 | { | 5162 | { |
| 5182 | buf[rc] = DIRECTORY_SEP; | 5163 | /* Grow buffer to add directory separator and '\0'. */ |
| 5183 | buf[rc + 1] = '\0'; | 5164 | pwd = (char *) xrealloc (pwd, rc + 2); |
| 5165 | pwd[rc] = DIRECTORY_SEP; | ||
| 5166 | pwd[rc + 1] = '\0'; | ||
| 5184 | } | 5167 | } |
| 5185 | #endif /* not VMS */ | 5168 | #endif /* not VMS */ |
| 5186 | 5169 | ||
| 5187 | current_buffer->directory = make_unibyte_string (buf, strlen (buf)); | 5170 | current_buffer->directory = make_unibyte_string (pwd, strlen (pwd)); |
| 5188 | if (! NILP (buffer_defaults.enable_multibyte_characters)) | 5171 | if (! NILP (buffer_defaults.enable_multibyte_characters)) |
| 5189 | /* At this momemnt, we still don't know how to decode the | 5172 | /* At this moment, we still don't know how to decode the |
| 5190 | direcotry name. So, we keep the bytes in multibyte form so | 5173 | directory name. So, we keep the bytes in multibyte form so |
| 5191 | that ENCODE_FILE correctly gets the original bytes. */ | 5174 | that ENCODE_FILE correctly gets the original bytes. */ |
| 5192 | current_buffer->directory | 5175 | current_buffer->directory |
| 5193 | = string_to_multibyte (current_buffer->directory); | 5176 | = string_to_multibyte (current_buffer->directory); |
| @@ -5206,6 +5189,8 @@ init_buffer () | |||
| 5206 | 5189 | ||
| 5207 | temp = get_minibuffer (0); | 5190 | temp = get_minibuffer (0); |
| 5208 | XBUFFER (temp)->directory = current_buffer->directory; | 5191 | XBUFFER (temp)->directory = current_buffer->directory; |
| 5192 | |||
| 5193 | free (pwd); | ||
| 5209 | } | 5194 | } |
| 5210 | 5195 | ||
| 5211 | /* initialize the buffer routines */ | 5196 | /* initialize the buffer routines */ |
diff --git a/src/config.in b/src/config.in index f2afed2ecb1..b5b700c69bf 100644 --- a/src/config.in +++ b/src/config.in | |||
| @@ -221,6 +221,9 @@ Boston, MA 02110-1301, USA. */ | |||
| 221 | /* Define to 1 if you have the `getwd' function. */ | 221 | /* Define to 1 if you have the `getwd' function. */ |
| 222 | #undef HAVE_GETWD | 222 | #undef HAVE_GETWD |
| 223 | 223 | ||
| 224 | /* Define to 1 if you have the `get_current_dir_name' function. */ | ||
| 225 | #undef HAVE_GET_CURRENT_DIR_NAME | ||
| 226 | |||
| 224 | /* Define to 1 if you have the ungif library (-lungif). */ | 227 | /* Define to 1 if you have the ungif library (-lungif). */ |
| 225 | #undef HAVE_GIF | 228 | #undef HAVE_GIF |
| 226 | 229 | ||
| @@ -57,6 +57,8 @@ static Lisp_Object Vbuild_files; | |||
| 57 | 57 | ||
| 58 | extern Lisp_Object Voverriding_local_map; | 58 | extern Lisp_Object Voverriding_local_map; |
| 59 | 59 | ||
| 60 | extern Lisp_Object Qremap; | ||
| 61 | |||
| 60 | /* For VMS versions with limited file name syntax, | 62 | /* For VMS versions with limited file name syntax, |
| 61 | convert the name to something VMS will allow. */ | 63 | convert the name to something VMS will allow. */ |
| 62 | static void | 64 | static void |
| @@ -812,6 +814,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int | |||
| 812 | else if (strp[0] == '\\' && strp[1] == '[') | 814 | else if (strp[0] == '\\' && strp[1] == '[') |
| 813 | { | 815 | { |
| 814 | int start_idx; | 816 | int start_idx; |
| 817 | int follow_remap = 1; | ||
| 815 | 818 | ||
| 816 | changed = 1; | 819 | changed = 1; |
| 817 | strp += 2; /* skip \[ */ | 820 | strp += 2; /* skip \[ */ |
| @@ -830,11 +833,21 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int | |||
| 830 | idx = strp - SDATA (string); | 833 | idx = strp - SDATA (string); |
| 831 | name = Fintern (make_string (start, length_byte), Qnil); | 834 | name = Fintern (make_string (start, length_byte), Qnil); |
| 832 | 835 | ||
| 836 | do_remap: | ||
| 833 | /* Ignore remappings unless there are no ordinary bindings. */ | 837 | /* Ignore remappings unless there are no ordinary bindings. */ |
| 834 | tem = Fwhere_is_internal (name, keymap, Qt, Qnil, Qt); | 838 | tem = Fwhere_is_internal (name, keymap, Qt, Qnil, Qt); |
| 835 | if (NILP (tem)) | 839 | if (NILP (tem)) |
| 836 | tem = Fwhere_is_internal (name, keymap, Qt, Qnil, Qnil); | 840 | tem = Fwhere_is_internal (name, keymap, Qt, Qnil, Qnil); |
| 837 | 841 | ||
| 842 | if (VECTORP (tem) && XVECTOR (tem)->size > 1 | ||
| 843 | && EQ (AREF (tem, 0), Qremap) && SYMBOLP (AREF (tem, 1)) | ||
| 844 | && follow_remap) | ||
| 845 | { | ||
| 846 | name = AREF (tem, 1); | ||
| 847 | follow_remap = 0; | ||
| 848 | goto do_remap; | ||
| 849 | } | ||
| 850 | |||
| 838 | /* Note the Fwhere_is_internal can GC, so we have to take | 851 | /* Note the Fwhere_is_internal can GC, so we have to take |
| 839 | relocation of string contents into account. */ | 852 | relocation of string contents into account. */ |
| 840 | strp = SDATA (string) + idx; | 853 | strp = SDATA (string) + idx; |
diff --git a/src/frame.h b/src/frame.h index 2928b36f2f2..48cf61d3040 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -468,6 +468,9 @@ struct frame | |||
| 468 | /* Set to non-zero if this frame has already been hscrolled during | 468 | /* Set to non-zero if this frame has already been hscrolled during |
| 469 | current redisplay. */ | 469 | current redisplay. */ |
| 470 | unsigned already_hscrolled_p : 1; | 470 | unsigned already_hscrolled_p : 1; |
| 471 | |||
| 472 | /* Set to non-zero when current redisplay has updated frame. */ | ||
| 473 | unsigned updated_p : 1; | ||
| 471 | }; | 474 | }; |
| 472 | 475 | ||
| 473 | #ifdef MULTI_KBOARD | 476 | #ifdef MULTI_KBOARD |
diff --git a/src/lisp.h b/src/lisp.h index 0346c8fd0d3..1cefd7ba4b5 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3141,6 +3141,9 @@ EXFUN (Fx_popup_dialog, 3); | |||
| 3141 | extern void syms_of_xmenu P_ ((void)); | 3141 | extern void syms_of_xmenu P_ ((void)); |
| 3142 | 3142 | ||
| 3143 | /* defined in sysdep.c */ | 3143 | /* defined in sysdep.c */ |
| 3144 | #ifndef HAVE_GET_CURRENT_DIR_NAME | ||
| 3145 | extern char *get_current_dir_name P_ ((void)); | ||
| 3146 | #endif | ||
| 3144 | extern void stuff_char P_ ((char c)); | 3147 | extern void stuff_char P_ ((char c)); |
| 3145 | extern void init_sigio P_ ((int)); | 3148 | extern void init_sigio P_ ((int)); |
| 3146 | extern void request_sigio P_ ((void)); | 3149 | extern void request_sigio P_ ((void)); |
diff --git a/src/macterm.c b/src/macterm.c index 099b69bfb09..d9b533a9b8c 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -6100,6 +6100,335 @@ x_wm_set_icon_position (f, icon_x, icon_y) | |||
| 6100 | 6100 | ||
| 6101 | 6101 | ||
| 6102 | /*********************************************************************** | 6102 | /*********************************************************************** |
| 6103 | XLFD Pattern Match | ||
| 6104 | ***********************************************************************/ | ||
| 6105 | |||
| 6106 | /* An XLFD pattern is divided into blocks delimited by '*'. This | ||
| 6107 | structure holds information for each block. */ | ||
| 6108 | struct xlfdpat_block | ||
| 6109 | { | ||
| 6110 | /* Length of the pattern string in this block. Non-zero except for | ||
| 6111 | the first and the last blocks. */ | ||
| 6112 | int len; | ||
| 6113 | |||
| 6114 | /* Pattern string except the last character in this block. The last | ||
| 6115 | character is replaced with NUL in order to use it as a | ||
| 6116 | sentinel. */ | ||
| 6117 | unsigned char *pattern; | ||
| 6118 | |||
| 6119 | /* Last character of the pattern string. Must not be '?'. */ | ||
| 6120 | unsigned char last_char; | ||
| 6121 | |||
| 6122 | /* One of the tables for the Boyer-Moore string search. It | ||
| 6123 | specifies the number of positions to proceed for each character | ||
| 6124 | with which the match fails. */ | ||
| 6125 | int skip[256]; | ||
| 6126 | |||
| 6127 | /* The skip value for the last character in the above `skip' is | ||
| 6128 | assigned to `infinity' in order to simplify a loop condition. | ||
| 6129 | The original value is saved here. */ | ||
| 6130 | int last_char_skip; | ||
| 6131 | }; | ||
| 6132 | |||
| 6133 | struct xlfdpat | ||
| 6134 | { | ||
| 6135 | /* Normalized pattern string. "Normalized" means that capital | ||
| 6136 | letters are lowered, blocks are not empty except the first and | ||
| 6137 | the last ones, and trailing '?'s in a block that is not the last | ||
| 6138 | one are moved to the next one. The last character in each block | ||
| 6139 | is replaced with NUL. */ | ||
| 6140 | unsigned char *buf; | ||
| 6141 | |||
| 6142 | /* Number of characters except '*'s and trailing '?'s in the | ||
| 6143 | normalized pattern string. */ | ||
| 6144 | int nchars; | ||
| 6145 | |||
| 6146 | /* Number of trailing '?'s in the normalized pattern string. */ | ||
| 6147 | int trailing_anychars; | ||
| 6148 | |||
| 6149 | /* Number of blocks and information for each block. The latter is | ||
| 6150 | NULL if the pattern is exact (no '*' or '?' in it). */ | ||
| 6151 | int nblocks; | ||
| 6152 | struct xlfdpat_block *blocks; | ||
| 6153 | }; | ||
| 6154 | |||
| 6155 | static void | ||
| 6156 | xlfdpat_destroy (pat) | ||
| 6157 | struct xlfdpat *pat; | ||
| 6158 | { | ||
| 6159 | if (pat) | ||
| 6160 | { | ||
| 6161 | if (pat->buf) | ||
| 6162 | { | ||
| 6163 | if (pat->blocks) | ||
| 6164 | xfree (pat->blocks); | ||
| 6165 | xfree (pat->buf); | ||
| 6166 | } | ||
| 6167 | xfree (pat); | ||
| 6168 | } | ||
| 6169 | } | ||
| 6170 | |||
| 6171 | static struct xlfdpat * | ||
| 6172 | xlfdpat_create (pattern) | ||
| 6173 | char *pattern; | ||
| 6174 | { | ||
| 6175 | struct xlfdpat *pat; | ||
| 6176 | int nblocks, i, skip; | ||
| 6177 | unsigned char last_char, *p, *q, *anychar_head; | ||
| 6178 | struct xlfdpat_block *blk; | ||
| 6179 | |||
| 6180 | pat = xmalloc (sizeof (struct xlfdpat)); | ||
| 6181 | if (pat == NULL) | ||
| 6182 | goto error; | ||
| 6183 | |||
| 6184 | pat->buf = xmalloc (strlen (pattern) + 1); | ||
| 6185 | if (pat->buf == NULL) | ||
| 6186 | goto error; | ||
| 6187 | |||
| 6188 | /* Normalize the pattern string and store it to `pat->buf'. */ | ||
| 6189 | nblocks = 0; | ||
| 6190 | anychar_head = NULL; | ||
| 6191 | q = pat->buf; | ||
| 6192 | last_char = '\0'; | ||
| 6193 | for (p = pattern; *p; p++) | ||
| 6194 | { | ||
| 6195 | unsigned char c = *p; | ||
| 6196 | |||
| 6197 | if (c == '*') | ||
| 6198 | if (last_char == '*') | ||
| 6199 | /* ...a** -> ...a* */ | ||
| 6200 | continue; | ||
| 6201 | else | ||
| 6202 | { | ||
| 6203 | if (last_char == '?') | ||
| 6204 | if (anychar_head > pat->buf && *(anychar_head - 1) == '*') | ||
| 6205 | /* ...*??* -> ...*?? */ | ||
| 6206 | continue; | ||
| 6207 | else | ||
| 6208 | /* ...a??* -> ...a*?? */ | ||
| 6209 | { | ||
| 6210 | *anychar_head++ = '*'; | ||
| 6211 | c = '?'; | ||
| 6212 | } | ||
| 6213 | nblocks++; | ||
| 6214 | } | ||
| 6215 | else if (c == '?') | ||
| 6216 | { | ||
| 6217 | if (last_char != '?') | ||
| 6218 | anychar_head = q; | ||
| 6219 | } | ||
| 6220 | else | ||
| 6221 | /* On Mac OS X 10.3, tolower also converts non-ASCII | ||
| 6222 | characters for some locales. */ | ||
| 6223 | if (isascii (c)) | ||
| 6224 | c = tolower (c); | ||
| 6225 | |||
| 6226 | *q++ = last_char = c; | ||
| 6227 | } | ||
| 6228 | *q = '\0'; | ||
| 6229 | nblocks++; | ||
| 6230 | pat->nblocks = nblocks; | ||
| 6231 | if (last_char != '?') | ||
| 6232 | pat->trailing_anychars = 0; | ||
| 6233 | else | ||
| 6234 | { | ||
| 6235 | pat->trailing_anychars = q - anychar_head; | ||
| 6236 | q = anychar_head; | ||
| 6237 | } | ||
| 6238 | pat->nchars = q - pat->buf - (nblocks - 1); | ||
| 6239 | |||
| 6240 | if (anychar_head == NULL && nblocks == 1) | ||
| 6241 | { | ||
| 6242 | /* The pattern is exact. */ | ||
| 6243 | pat->blocks = NULL; | ||
| 6244 | return pat; | ||
| 6245 | } | ||
| 6246 | |||
| 6247 | pat->blocks = xmalloc (sizeof (struct xlfdpat_block) * nblocks); | ||
| 6248 | if (pat->blocks == NULL) | ||
| 6249 | goto error; | ||
| 6250 | |||
| 6251 | /* Divide the normalized pattern into blocks. */ | ||
| 6252 | p = pat->buf; | ||
| 6253 | for (blk = pat->blocks; blk < pat->blocks + nblocks - 1; blk++) | ||
| 6254 | { | ||
| 6255 | blk->pattern = p; | ||
| 6256 | while (*p != '*') | ||
| 6257 | p++; | ||
| 6258 | blk->len = p - blk->pattern; | ||
| 6259 | p++; | ||
| 6260 | } | ||
| 6261 | blk->pattern = p; | ||
| 6262 | blk->len = q - blk->pattern; | ||
| 6263 | |||
| 6264 | /* Setup a table for the Boyer-Moore string search. */ | ||
| 6265 | for (blk = pat->blocks; blk < pat->blocks + nblocks; blk++) | ||
| 6266 | if (blk->len != 0) | ||
| 6267 | { | ||
| 6268 | blk->last_char = blk->pattern[blk->len - 1]; | ||
| 6269 | blk->pattern[blk->len - 1] = '\0'; | ||
| 6270 | |||
| 6271 | for (skip = 1; skip < blk->len; skip++) | ||
| 6272 | if (blk->pattern[blk->len - skip - 1] == '?') | ||
| 6273 | break; | ||
| 6274 | |||
| 6275 | for (i = 0; i < 256; i++) | ||
| 6276 | blk->skip[i] = skip; | ||
| 6277 | |||
| 6278 | p = blk->pattern + (blk->len - skip); | ||
| 6279 | while (--skip > 0) | ||
| 6280 | blk->skip[*p++] = skip; | ||
| 6281 | |||
| 6282 | blk->last_char_skip = blk->skip[blk->last_char]; | ||
| 6283 | } | ||
| 6284 | |||
| 6285 | return pat; | ||
| 6286 | |||
| 6287 | error: | ||
| 6288 | xlfdpat_destroy (pat); | ||
| 6289 | return NULL; | ||
| 6290 | } | ||
| 6291 | |||
| 6292 | static INLINE int | ||
| 6293 | xlfdpat_exact_p (pat) | ||
| 6294 | struct xlfdpat *pat; | ||
| 6295 | { | ||
| 6296 | return (pat)->blocks == NULL; | ||
| 6297 | } | ||
| 6298 | |||
| 6299 | /* Return the first string in STRING + 0, ..., STRING + START_MAX such | ||
| 6300 | that the pattern in *BLK matches with its prefix. Return NULL | ||
| 6301 | there is no such strings. STRING must be lowered in advance. */ | ||
| 6302 | |||
| 6303 | static char * | ||
| 6304 | xlfdpat_block_match_1 (blk, string, start_max) | ||
| 6305 | struct xlfdpat_block *blk; | ||
| 6306 | unsigned char *string; | ||
| 6307 | int start_max; | ||
| 6308 | { | ||
| 6309 | int start, infinity; | ||
| 6310 | unsigned char *p, *s; | ||
| 6311 | |||
| 6312 | xassert (blk->len > 0); | ||
| 6313 | xassert (start_max + blk->len <= strlen (string)); | ||
| 6314 | xassert (blk->pattern[blk->len - 1] != '?'); | ||
| 6315 | |||
| 6316 | /* See the comments in the function `boyer_moore' (search.c) for the | ||
| 6317 | use of `infinity'. */ | ||
| 6318 | infinity = start_max + blk->len + 1; | ||
| 6319 | blk->skip[blk->last_char] = infinity; | ||
| 6320 | |||
| 6321 | start = 0; | ||
| 6322 | do | ||
| 6323 | { | ||
| 6324 | /* Check the last character of the pattern. */ | ||
| 6325 | s = string + blk->len - 1; | ||
| 6326 | do | ||
| 6327 | { | ||
| 6328 | start += blk->skip[*(s + start)]; | ||
| 6329 | } | ||
| 6330 | while (start <= start_max); | ||
| 6331 | |||
| 6332 | if (start < infinity) | ||
| 6333 | /* Couldn't find the last character. */ | ||
| 6334 | return NULL; | ||
| 6335 | |||
| 6336 | /* No less than `infinity' means we could find the last | ||
| 6337 | character at `s[start - infinity]'. */ | ||
| 6338 | start -= infinity; | ||
| 6339 | |||
| 6340 | /* Check the remaining characters. We prefer making no-'?' | ||
| 6341 | cases faster because the use of '?' is really rare. */ | ||
| 6342 | p = blk->pattern; | ||
| 6343 | s = string + start; | ||
| 6344 | do | ||
| 6345 | { | ||
| 6346 | while (*p++ == *s++) | ||
| 6347 | ; | ||
| 6348 | } | ||
| 6349 | while (*(p - 1) == '?'); | ||
| 6350 | |||
| 6351 | if (*(p - 1) == '\0') | ||
| 6352 | /* Matched. */ | ||
| 6353 | return string + start; | ||
| 6354 | |||
| 6355 | /* Didn't match. */ | ||
| 6356 | start += blk->last_char_skip; | ||
| 6357 | } | ||
| 6358 | while (start <= start_max); | ||
| 6359 | |||
| 6360 | return NULL; | ||
| 6361 | } | ||
| 6362 | |||
| 6363 | #define xlfdpat_block_match(b, s, m) \ | ||
| 6364 | ((b)->len == 1 ? memchr ((s), (b)->last_char, (m) + 1) \ | ||
| 6365 | : xlfdpat_block_match_1 (b, s, m)) | ||
| 6366 | |||
| 6367 | /* Check if XLFD pattern PAT, which is generated by `xfldpat_create', | ||
| 6368 | matches with STRING. STRING must be lowered in advance. */ | ||
| 6369 | |||
| 6370 | static int | ||
| 6371 | xlfdpat_match (pat, string) | ||
| 6372 | struct xlfdpat *pat; | ||
| 6373 | unsigned char *string; | ||
| 6374 | { | ||
| 6375 | int str_len, nblocks, i, start_max; | ||
| 6376 | struct xlfdpat_block *blk; | ||
| 6377 | unsigned char *s; | ||
| 6378 | |||
| 6379 | xassert (pat->nblocks > 0); | ||
| 6380 | |||
| 6381 | if (xlfdpat_exact_p (pat)) | ||
| 6382 | return strcmp (pat->buf, string) == 0; | ||
| 6383 | |||
| 6384 | /* The number of the characters in the string must not be smaller | ||
| 6385 | than that in the pattern. */ | ||
| 6386 | str_len = strlen (string); | ||
| 6387 | if (str_len < pat->nchars + pat->trailing_anychars) | ||
| 6388 | return 0; | ||
| 6389 | |||
| 6390 | /* Chop off the trailing '?'s. */ | ||
| 6391 | str_len -= pat->trailing_anychars; | ||
| 6392 | |||
| 6393 | /* The last block. When it is non-empty, it must match at the end | ||
| 6394 | of the string. */ | ||
| 6395 | nblocks = pat->nblocks; | ||
| 6396 | blk = pat->blocks + (nblocks - 1); | ||
| 6397 | if (nblocks == 1) | ||
| 6398 | /* The last block is also the first one. */ | ||
| 6399 | return (str_len == blk->len | ||
| 6400 | && (blk->len == 0 || xlfdpat_block_match (blk, string, 0))); | ||
| 6401 | else if (blk->len != 0) | ||
| 6402 | if (!xlfdpat_block_match (blk, string + (str_len - blk->len), 0)) | ||
| 6403 | return 0; | ||
| 6404 | |||
| 6405 | /* The first block. When it is non-empty, it must match at the | ||
| 6406 | beginning of the string. */ | ||
| 6407 | blk = pat->blocks; | ||
| 6408 | if (blk->len != 0) | ||
| 6409 | { | ||
| 6410 | s = xlfdpat_block_match (blk, string, 0); | ||
| 6411 | if (s == NULL) | ||
| 6412 | return 0; | ||
| 6413 | string = s + blk->len; | ||
| 6414 | } | ||
| 6415 | |||
| 6416 | /* The rest of the blocks. */ | ||
| 6417 | start_max = str_len - pat->nchars; | ||
| 6418 | for (i = 1, blk++; i < nblocks - 1; i++, blk++) | ||
| 6419 | { | ||
| 6420 | s = xlfdpat_block_match (blk, string, start_max); | ||
| 6421 | if (s == NULL) | ||
| 6422 | return 0; | ||
| 6423 | start_max -= s - string; | ||
| 6424 | string = s + blk->len; | ||
| 6425 | } | ||
| 6426 | |||
| 6427 | return 1; | ||
| 6428 | } | ||
| 6429 | |||
| 6430 | |||
| 6431 | /*********************************************************************** | ||
| 6103 | Fonts | 6432 | Fonts |
| 6104 | ***********************************************************************/ | 6433 | ***********************************************************************/ |
| 6105 | 6434 | ||
| @@ -6198,7 +6527,8 @@ mac_to_x_fontname (name, size, style, charset) | |||
| 6198 | { | 6527 | { |
| 6199 | Str31 foundry, cs; | 6528 | Str31 foundry, cs; |
| 6200 | Str255 family; | 6529 | Str255 family; |
| 6201 | char xf[256], *result, *p; | 6530 | char xf[256], *result; |
| 6531 | unsigned char *p; | ||
| 6202 | 6532 | ||
| 6203 | if (sscanf (name, "%31[^-]-%255[^-]-%31s", foundry, family, cs) == 3) | 6533 | if (sscanf (name, "%31[^-]-%255[^-]-%31s", foundry, family, cs) == 3) |
| 6204 | charset = cs; | 6534 | charset = cs; |
| @@ -6215,7 +6545,10 @@ mac_to_x_fontname (name, size, style, charset) | |||
| 6215 | result = xmalloc (strlen (foundry) + strlen (family) + strlen (xf) + 3 + 1); | 6545 | result = xmalloc (strlen (foundry) + strlen (family) + strlen (xf) + 3 + 1); |
| 6216 | sprintf (result, "-%s-%s-%s", foundry, family, xf); | 6546 | sprintf (result, "-%s-%s-%s", foundry, family, xf); |
| 6217 | for (p = result; *p; p++) | 6547 | for (p = result; *p; p++) |
| 6218 | *p = tolower(*p); | 6548 | /* On Mac OS X 10.3, tolower also converts non-ASCII characters |
| 6549 | for some locales. */ | ||
| 6550 | if (isascii (*p)) | ||
| 6551 | *p = tolower (*p); | ||
| 6219 | return result; | 6552 | return result; |
| 6220 | } | 6553 | } |
| 6221 | 6554 | ||
| @@ -6275,7 +6608,7 @@ x_font_name_to_mac_font_name (xf, mf, mf_decoded, style, cs) | |||
| 6275 | { | 6608 | { |
| 6276 | setup_coding_system (coding_system, &coding); | 6609 | setup_coding_system (coding_system, &coding); |
| 6277 | coding.src_multibyte = 1; | 6610 | coding.src_multibyte = 1; |
| 6278 | coding.dst_multibyte = 1; | 6611 | coding.dst_multibyte = 0; |
| 6279 | coding.mode |= CODING_MODE_LAST_BLOCK; | 6612 | coding.mode |= CODING_MODE_LAST_BLOCK; |
| 6280 | encode_coding (&coding, mf_decoded, mf, | 6613 | encode_coding (&coding, mf_decoded, mf, |
| 6281 | strlen (mf_decoded), sizeof (Str255) - 1); | 6614 | strlen (mf_decoded), sizeof (Str255) - 1); |
| @@ -6290,13 +6623,13 @@ add_font_name_table_entry (char *font_name) | |||
| 6290 | { | 6623 | { |
| 6291 | if (font_name_table_size == 0) | 6624 | if (font_name_table_size == 0) |
| 6292 | { | 6625 | { |
| 6293 | font_name_table_size = 16; | 6626 | font_name_table_size = 256; |
| 6294 | font_name_table = (char **) | 6627 | font_name_table = (char **) |
| 6295 | xmalloc (font_name_table_size * sizeof (char *)); | 6628 | xmalloc (font_name_table_size * sizeof (char *)); |
| 6296 | } | 6629 | } |
| 6297 | else if (font_name_count + 1 >= font_name_table_size) | 6630 | else if (font_name_count + 1 >= font_name_table_size) |
| 6298 | { | 6631 | { |
| 6299 | font_name_table_size += 16; | 6632 | font_name_table_size *= 2; |
| 6300 | font_name_table = (char **) | 6633 | font_name_table = (char **) |
| 6301 | xrealloc (font_name_table, | 6634 | xrealloc (font_name_table, |
| 6302 | font_name_table_size * sizeof (char *)); | 6635 | font_name_table_size * sizeof (char *)); |
| @@ -6521,39 +6854,16 @@ static int xlfd_scalable_fields[] = | |||
| 6521 | }; | 6854 | }; |
| 6522 | 6855 | ||
| 6523 | static Lisp_Object | 6856 | static Lisp_Object |
| 6524 | mac_c_string_match (regexp, string, nonspecial, exact) | ||
| 6525 | Lisp_Object regexp; | ||
| 6526 | const char *string, *nonspecial; | ||
| 6527 | int exact; | ||
| 6528 | { | ||
| 6529 | if (exact) | ||
| 6530 | { | ||
| 6531 | if (strcmp (string, nonspecial) == 0) | ||
| 6532 | return build_string (string); | ||
| 6533 | } | ||
| 6534 | else if (strstr (string, nonspecial)) | ||
| 6535 | { | ||
| 6536 | Lisp_Object str = build_string (string); | ||
| 6537 | |||
| 6538 | if (fast_string_match (regexp, str) >= 0) | ||
| 6539 | return str; | ||
| 6540 | } | ||
| 6541 | |||
| 6542 | return Qnil; | ||
| 6543 | } | ||
| 6544 | |||
| 6545 | static Lisp_Object | ||
| 6546 | mac_do_list_fonts (pattern, maxnames) | 6857 | mac_do_list_fonts (pattern, maxnames) |
| 6547 | char *pattern; | 6858 | char *pattern; |
| 6548 | int maxnames; | 6859 | int maxnames; |
| 6549 | { | 6860 | { |
| 6550 | int i, n_fonts = 0; | 6861 | int i, n_fonts = 0; |
| 6551 | Lisp_Object font_list = Qnil, pattern_regex, fontname; | 6862 | Lisp_Object font_list = Qnil; |
| 6552 | char *regex = (char *) alloca (strlen (pattern) * 2 + 3); | 6863 | struct xlfdpat *pat; |
| 6553 | char *scaled, *ptr; | 6864 | char *scaled, *ptr; |
| 6554 | int scl_val[XLFD_SCL_LAST], *field, *val; | 6865 | int scl_val[XLFD_SCL_LAST], *field, *val; |
| 6555 | char *longest_start, *cur_start, *nonspecial; | 6866 | int exact; |
| 6556 | int longest_len, exact; | ||
| 6557 | 6867 | ||
| 6558 | if (font_name_table == NULL) /* Initialize when first used. */ | 6868 | if (font_name_table == NULL) /* Initialize when first used. */ |
| 6559 | init_font_name_table (); | 6869 | init_font_name_table (); |
| @@ -6611,61 +6921,17 @@ mac_do_list_fonts (pattern, maxnames) | |||
| 6611 | else | 6921 | else |
| 6612 | scl_val[XLFD_SCL_PIXEL_SIZE] = -1; | 6922 | scl_val[XLFD_SCL_PIXEL_SIZE] = -1; |
| 6613 | 6923 | ||
| 6614 | ptr = regex; | 6924 | pat = xlfdpat_create (pattern); |
| 6615 | *ptr++ = '^'; | 6925 | if (pat == NULL) |
| 6616 | 6926 | return Qnil; | |
| 6617 | longest_start = cur_start = ptr; | ||
| 6618 | longest_len = 0; | ||
| 6619 | exact = 1; | ||
| 6620 | |||
| 6621 | /* Turn pattern into a regexp and do a regexp match. Also find the | ||
| 6622 | longest substring containing no special characters. */ | ||
| 6623 | for (; *pattern; pattern++) | ||
| 6624 | { | ||
| 6625 | if (*pattern == '?' || *pattern == '*') | ||
| 6626 | { | ||
| 6627 | if (ptr - cur_start > longest_len) | ||
| 6628 | { | ||
| 6629 | longest_start = cur_start; | ||
| 6630 | longest_len = ptr - cur_start; | ||
| 6631 | } | ||
| 6632 | exact = 0; | ||
| 6633 | |||
| 6634 | if (*pattern == '?') | ||
| 6635 | *ptr++ = '.'; | ||
| 6636 | else /* if (*pattern == '*') */ | ||
| 6637 | { | ||
| 6638 | *ptr++ = '.'; | ||
| 6639 | *ptr++ = '*'; | ||
| 6640 | } | ||
| 6641 | cur_start = ptr; | ||
| 6642 | } | ||
| 6643 | else | ||
| 6644 | *ptr++ = tolower (*pattern); | ||
| 6645 | } | ||
| 6646 | |||
| 6647 | if (ptr - cur_start > longest_len) | ||
| 6648 | { | ||
| 6649 | longest_start = cur_start; | ||
| 6650 | longest_len = ptr - cur_start; | ||
| 6651 | } | ||
| 6652 | |||
| 6653 | *ptr = '$'; | ||
| 6654 | *(ptr + 1) = '\0'; | ||
| 6655 | |||
| 6656 | nonspecial = xmalloc (longest_len + 1); | ||
| 6657 | strncpy (nonspecial, longest_start, longest_len); | ||
| 6658 | nonspecial[longest_len] = '\0'; | ||
| 6659 | 6927 | ||
| 6660 | pattern_regex = build_string (regex); | 6928 | exact = xlfdpat_exact_p (pat); |
| 6661 | 6929 | ||
| 6662 | for (i = 0; i < font_name_count; i++) | 6930 | for (i = 0; i < font_name_count; i++) |
| 6663 | { | 6931 | { |
| 6664 | fontname = mac_c_string_match (pattern_regex, font_name_table[i], | 6932 | if (xlfdpat_match (pat, font_name_table[i])) |
| 6665 | nonspecial, exact); | ||
| 6666 | if (!NILP (fontname)) | ||
| 6667 | { | 6933 | { |
| 6668 | font_list = Fcons (fontname, font_list); | 6934 | font_list = Fcons (build_string (font_name_table[i]), font_list); |
| 6669 | if (exact || maxnames > 0 && ++n_fonts >= maxnames) | 6935 | if (exact || maxnames > 0 && ++n_fonts >= maxnames) |
| 6670 | break; | 6936 | break; |
| 6671 | } | 6937 | } |
| @@ -6675,6 +6941,8 @@ mac_do_list_fonts (pattern, maxnames) | |||
| 6675 | int former_len = ptr - font_name_table[i]; | 6941 | int former_len = ptr - font_name_table[i]; |
| 6676 | 6942 | ||
| 6677 | scaled = xmalloc (strlen (font_name_table[i]) + 20 + 1); | 6943 | scaled = xmalloc (strlen (font_name_table[i]) + 20 + 1); |
| 6944 | if (scaled == NULL) | ||
| 6945 | continue; | ||
| 6678 | memcpy (scaled, font_name_table[i], former_len); | 6946 | memcpy (scaled, font_name_table[i], former_len); |
| 6679 | sprintf (scaled + former_len, | 6947 | sprintf (scaled + former_len, |
| 6680 | "-%d-%d-75-75-m-%d-%s", | 6948 | "-%d-%d-75-75-m-%d-%s", |
| @@ -6682,19 +6950,20 @@ mac_do_list_fonts (pattern, maxnames) | |||
| 6682 | scl_val[XLFD_SCL_POINT_SIZE], | 6950 | scl_val[XLFD_SCL_POINT_SIZE], |
| 6683 | scl_val[XLFD_SCL_AVGWIDTH], | 6951 | scl_val[XLFD_SCL_AVGWIDTH], |
| 6684 | ptr + sizeof ("-0-0-0-0-m-0-") - 1); | 6952 | ptr + sizeof ("-0-0-0-0-m-0-") - 1); |
| 6685 | fontname = mac_c_string_match (pattern_regex, scaled, | 6953 | |
| 6686 | nonspecial, exact); | 6954 | if (xlfdpat_match (pat, scaled)) |
| 6687 | xfree (scaled); | ||
| 6688 | if (!NILP (fontname)) | ||
| 6689 | { | 6955 | { |
| 6690 | font_list = Fcons (fontname, font_list); | 6956 | font_list = Fcons (build_string (scaled), font_list); |
| 6957 | xfree (scaled); | ||
| 6691 | if (exact || maxnames > 0 && ++n_fonts >= maxnames) | 6958 | if (exact || maxnames > 0 && ++n_fonts >= maxnames) |
| 6692 | break; | 6959 | break; |
| 6693 | } | 6960 | } |
| 6961 | else | ||
| 6962 | xfree (scaled); | ||
| 6694 | } | 6963 | } |
| 6695 | } | 6964 | } |
| 6696 | 6965 | ||
| 6697 | xfree (nonspecial); | 6966 | xlfdpat_destroy (pat); |
| 6698 | 6967 | ||
| 6699 | return font_list; | 6968 | return font_list; |
| 6700 | } | 6969 | } |
diff --git a/src/sysdep.c b/src/sysdep.c index e63ee904f14..c0ff47e3072 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -47,7 +47,6 @@ extern void srandom P_ ((unsigned int)); | |||
| 47 | #endif | 47 | #endif |
| 48 | 48 | ||
| 49 | #include "blockinput.h" | 49 | #include "blockinput.h" |
| 50 | #undef NULL | ||
| 51 | 50 | ||
| 52 | #ifdef MAC_OS8 | 51 | #ifdef MAC_OS8 |
| 53 | /* It is essential to include stdlib.h so that this file picks up | 52 | /* It is essential to include stdlib.h so that this file picks up |
| @@ -187,6 +186,7 @@ extern int quit_char; | |||
| 187 | #define _P_WAIT 0 | 186 | #define _P_WAIT 0 |
| 188 | int _CRTAPI1 _spawnlp (int, const char *, const char *, ...); | 187 | int _CRTAPI1 _spawnlp (int, const char *, const char *, ...); |
| 189 | int _CRTAPI1 _getpid (void); | 188 | int _CRTAPI1 _getpid (void); |
| 189 | extern char *getwd (char *); | ||
| 190 | #endif | 190 | #endif |
| 191 | 191 | ||
| 192 | #ifdef NONSYSTEM_DIR_LIBRARY | 192 | #ifdef NONSYSTEM_DIR_LIBRARY |
| @@ -258,6 +258,81 @@ void hft_reset (); | |||
| 258 | 258 | ||
| 259 | SIGMASKTYPE sigprocmask_set; | 259 | SIGMASKTYPE sigprocmask_set; |
| 260 | 260 | ||
| 261 | |||
| 262 | #ifndef HAVE_GET_CURRENT_DIR_NAME | ||
| 263 | |||
| 264 | /* Return the current working directory. Returns NULL on errors. | ||
| 265 | Any other returned value must be freed with free. This is used | ||
| 266 | only when get_current_dir_name is not defined on the system. */ | ||
| 267 | char* | ||
| 268 | get_current_dir_name () | ||
| 269 | { | ||
| 270 | char *buf; | ||
| 271 | char *pwd; | ||
| 272 | struct stat dotstat, pwdstat; | ||
| 273 | /* If PWD is accurate, use it instead of calling getwd. PWD is | ||
| 274 | sometimes a nicer name, and using it may avoid a fatal error if a | ||
| 275 | parent directory is searchable but not readable. */ | ||
| 276 | if ((pwd = getenv ("PWD")) != 0 | ||
| 277 | && (IS_DIRECTORY_SEP (*pwd) || (*pwd && IS_DEVICE_SEP (pwd[1]))) | ||
| 278 | && stat (pwd, &pwdstat) == 0 | ||
| 279 | && stat (".", &dotstat) == 0 | ||
| 280 | && dotstat.st_ino == pwdstat.st_ino | ||
| 281 | && dotstat.st_dev == pwdstat.st_dev | ||
| 282 | #ifdef MAXPATHLEN | ||
| 283 | && strlen (pwd) < MAXPATHLEN | ||
| 284 | #endif | ||
| 285 | ) | ||
| 286 | { | ||
| 287 | buf = (char *) malloc (strlen (pwd) + 1); | ||
| 288 | if (!buf) | ||
| 289 | return NULL; | ||
| 290 | strcpy (buf, pwd); | ||
| 291 | } | ||
| 292 | #ifdef HAVE_GETCWD | ||
| 293 | else | ||
| 294 | { | ||
| 295 | size_t buf_size = 1024; | ||
| 296 | buf = (char *) malloc (buf_size); | ||
| 297 | if (!buf) | ||
| 298 | return NULL; | ||
| 299 | for (;;) | ||
| 300 | { | ||
| 301 | if (getcwd (buf, buf_size) == buf) | ||
| 302 | break; | ||
| 303 | if (errno != ERANGE) | ||
| 304 | { | ||
| 305 | int tmp_errno = errno; | ||
| 306 | free (buf); | ||
| 307 | errno = tmp_errno; | ||
| 308 | return NULL; | ||
| 309 | } | ||
| 310 | buf_size *= 2; | ||
| 311 | buf = (char *) realloc (buf, buf_size); | ||
| 312 | if (!buf) | ||
| 313 | return NULL; | ||
| 314 | } | ||
| 315 | } | ||
| 316 | #else | ||
| 317 | else | ||
| 318 | { | ||
| 319 | /* We need MAXPATHLEN here. */ | ||
| 320 | buf = (char *) malloc (MAXPATHLEN + 1); | ||
| 321 | if (!buf) | ||
| 322 | return NULL; | ||
| 323 | if (getwd (buf) == NULL) | ||
| 324 | { | ||
| 325 | int tmp_errno = errno; | ||
| 326 | free (buf); | ||
| 327 | errno = tmp_errno; | ||
| 328 | return NULL; | ||
| 329 | } | ||
| 330 | } | ||
| 331 | #endif | ||
| 332 | return buf; | ||
| 333 | } | ||
| 334 | #endif | ||
| 335 | |||
| 261 | 336 | ||
| 262 | /* Specify a different file descriptor for further input operations. */ | 337 | /* Specify a different file descriptor for further input operations. */ |
| 263 | 338 | ||
diff --git a/src/w32term.c b/src/w32term.c index 5d14d758f74..f0d5dc507ac 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -5418,16 +5418,25 @@ x_bitmap_icon (f, icon) | |||
| 5418 | struct frame *f; | 5418 | struct frame *f; |
| 5419 | Lisp_Object icon; | 5419 | Lisp_Object icon; |
| 5420 | { | 5420 | { |
| 5421 | HANDLE hicon; | 5421 | HANDLE main_icon; |
| 5422 | HANDLE small_icon = NULL; | ||
| 5422 | 5423 | ||
| 5423 | if (FRAME_W32_WINDOW (f) == 0) | 5424 | if (FRAME_W32_WINDOW (f) == 0) |
| 5424 | return 1; | 5425 | return 1; |
| 5425 | 5426 | ||
| 5426 | if (NILP (icon)) | 5427 | if (NILP (icon)) |
| 5427 | hicon = LoadIcon (hinst, EMACS_CLASS); | 5428 | main_icon = LoadIcon (hinst, EMACS_CLASS); |
| 5428 | else if (STRINGP (icon)) | 5429 | else if (STRINGP (icon)) |
| 5429 | hicon = LoadImage (NULL, (LPCTSTR) SDATA (icon), IMAGE_ICON, 0, 0, | 5430 | { |
| 5430 | LR_DEFAULTSIZE | LR_LOADFROMFILE); | 5431 | /* Load the main icon from the named file. */ |
| 5432 | main_icon = LoadImage (NULL, (LPCTSTR) SDATA (icon), IMAGE_ICON, 0, 0, | ||
| 5433 | LR_DEFAULTSIZE | LR_LOADFROMFILE); | ||
| 5434 | /* Try to load a small icon to go with it. */ | ||
| 5435 | small_icon = LoadImage (NULL, (LPCSTR) SDATA (icon), IMAGE_ICON, | ||
| 5436 | GetSystemMetrics (SM_CXSMICON), | ||
| 5437 | GetSystemMetrics (SM_CYSMICON), | ||
| 5438 | LR_LOADFROMFILE); | ||
| 5439 | } | ||
| 5431 | else if (SYMBOLP (icon)) | 5440 | else if (SYMBOLP (icon)) |
| 5432 | { | 5441 | { |
| 5433 | LPCTSTR name; | 5442 | LPCTSTR name; |
| @@ -5447,16 +5456,21 @@ x_bitmap_icon (f, icon) | |||
| 5447 | else | 5456 | else |
| 5448 | return 1; | 5457 | return 1; |
| 5449 | 5458 | ||
| 5450 | hicon = LoadIcon (NULL, name); | 5459 | main_icon = LoadIcon (NULL, name); |
| 5451 | } | 5460 | } |
| 5452 | else | 5461 | else |
| 5453 | return 1; | 5462 | return 1; |
| 5454 | 5463 | ||
| 5455 | if (hicon == NULL) | 5464 | if (main_icon == NULL) |
| 5456 | return 1; | 5465 | return 1; |
| 5457 | 5466 | ||
| 5458 | PostMessage (FRAME_W32_WINDOW (f), WM_SETICON, (WPARAM) ICON_BIG, | 5467 | PostMessage (FRAME_W32_WINDOW (f), WM_SETICON, (WPARAM) ICON_BIG, |
| 5459 | (LPARAM) hicon); | 5468 | (LPARAM) main_icon); |
| 5469 | |||
| 5470 | /* If there is a small icon that goes with it, set that too. */ | ||
| 5471 | if (small_icon) | ||
| 5472 | PostMessage (FRAME_W32_WINDOW (f), WM_SETICON, (WPARAM) ICON_SMALL, | ||
| 5473 | (LPARAM) small_icon); | ||
| 5460 | 5474 | ||
| 5461 | return 0; | 5475 | return 0; |
| 5462 | } | 5476 | } |
diff --git a/src/xdisp.c b/src/xdisp.c index 529dd7e4cd3..e4adb43d624 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -3431,7 +3431,7 @@ handle_display_prop (it) | |||
| 3431 | } | 3431 | } |
| 3432 | else | 3432 | else |
| 3433 | { | 3433 | { |
| 3434 | object = it->w->buffer; | 3434 | XSETWINDOW (object, it->w); |
| 3435 | position = &it->current.pos; | 3435 | position = &it->current.pos; |
| 3436 | } | 3436 | } |
| 3437 | 3437 | ||
| @@ -3452,6 +3452,9 @@ handle_display_prop (it) | |||
| 3452 | if (NILP (prop)) | 3452 | if (NILP (prop)) |
| 3453 | return HANDLED_NORMALLY; | 3453 | return HANDLED_NORMALLY; |
| 3454 | 3454 | ||
| 3455 | if (!STRINGP (it->string)) | ||
| 3456 | object = it->w->buffer; | ||
| 3457 | |||
| 3455 | if (CONSP (prop) | 3458 | if (CONSP (prop) |
| 3456 | /* Simple properties. */ | 3459 | /* Simple properties. */ |
| 3457 | && !EQ (XCAR (prop), Qimage) | 3460 | && !EQ (XCAR (prop), Qimage) |
| @@ -10718,13 +10721,9 @@ redisplay_internal (preserve_echo_area) | |||
| 10718 | if (consider_all_windows_p) | 10721 | if (consider_all_windows_p) |
| 10719 | { | 10722 | { |
| 10720 | Lisp_Object tail, frame; | 10723 | Lisp_Object tail, frame; |
| 10721 | int i, n = 0, size = 5; | ||
| 10722 | struct frame **updated; | ||
| 10723 | 10724 | ||
| 10724 | FOR_EACH_FRAME (tail, frame) | 10725 | FOR_EACH_FRAME (tail, frame) |
| 10725 | size++; | 10726 | XFRAME (frame)->updated_p = 0; |
| 10726 | |||
| 10727 | updated = (struct frame **) alloca (size * sizeof *updated); | ||
| 10728 | 10727 | ||
| 10729 | /* Recompute # windows showing selected buffer. This will be | 10728 | /* Recompute # windows showing selected buffer. This will be |
| 10730 | incremented each time such a window is displayed. */ | 10729 | incremented each time such a window is displayed. */ |
| @@ -10786,15 +10785,7 @@ redisplay_internal (preserve_echo_area) | |||
| 10786 | break; | 10785 | break; |
| 10787 | #endif | 10786 | #endif |
| 10788 | 10787 | ||
| 10789 | if (n == size) | 10788 | f->updated_p = 1; |
| 10790 | { | ||
| 10791 | int nbytes = size * sizeof *updated; | ||
| 10792 | struct frame **p = (struct frame **) alloca (2 * nbytes); | ||
| 10793 | bcopy (updated, p, nbytes); | ||
| 10794 | size *= 2; | ||
| 10795 | } | ||
| 10796 | |||
| 10797 | updated[n++] = f; | ||
| 10798 | } | 10789 | } |
| 10799 | } | 10790 | } |
| 10800 | } | 10791 | } |
| @@ -10804,12 +10795,15 @@ redisplay_internal (preserve_echo_area) | |||
| 10804 | /* Do the mark_window_display_accurate after all windows have | 10795 | /* Do the mark_window_display_accurate after all windows have |
| 10805 | been redisplayed because this call resets flags in buffers | 10796 | been redisplayed because this call resets flags in buffers |
| 10806 | which are needed for proper redisplay. */ | 10797 | which are needed for proper redisplay. */ |
| 10807 | for (i = 0; i < n; ++i) | 10798 | FOR_EACH_FRAME (tail, frame) |
| 10808 | { | 10799 | { |
| 10809 | struct frame *f = updated[i]; | 10800 | struct frame *f = XFRAME (frame); |
| 10810 | mark_window_display_accurate (f->root_window, 1); | 10801 | if (f->updated_p) |
| 10811 | if (frame_up_to_date_hook) | 10802 | { |
| 10812 | frame_up_to_date_hook (f); | 10803 | mark_window_display_accurate (f->root_window, 1); |
| 10804 | if (frame_up_to_date_hook) | ||
| 10805 | frame_up_to_date_hook (f); | ||
| 10806 | } | ||
| 10813 | } | 10807 | } |
| 10814 | } | 10808 | } |
| 10815 | } | 10809 | } |
| @@ -12925,12 +12919,11 @@ try_window (window, pos, check_margins) | |||
| 12925 | if (check_margins | 12919 | if (check_margins |
| 12926 | && !MINI_WINDOW_P (w)) | 12920 | && !MINI_WINDOW_P (w)) |
| 12927 | { | 12921 | { |
| 12928 | int this_scroll_margin, cursor_height; | 12922 | int this_scroll_margin; |
| 12929 | 12923 | ||
| 12930 | this_scroll_margin = max (0, scroll_margin); | 12924 | this_scroll_margin = max (0, scroll_margin); |
| 12931 | this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4); | 12925 | this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4); |
| 12932 | this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); | 12926 | this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); |
| 12933 | cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height; | ||
| 12934 | 12927 | ||
| 12935 | if ((w->cursor.y < this_scroll_margin | 12928 | if ((w->cursor.y < this_scroll_margin |
| 12936 | && CHARPOS (pos) > BEGV) | 12929 | && CHARPOS (pos) > BEGV) |
| @@ -13181,7 +13174,7 @@ try_window_reusing_current_matrix (w) | |||
| 13181 | /* Disable lines in the current matrix which are now | 13174 | /* Disable lines in the current matrix which are now |
| 13182 | below the window. */ | 13175 | below the window. */ |
| 13183 | for (++row; row < bottom_row; ++row) | 13176 | for (++row; row < bottom_row; ++row) |
| 13184 | row->enabled_p = 0; | 13177 | row->enabled_p = row->mode_line_p = 0; |
| 13185 | } | 13178 | } |
| 13186 | 13179 | ||
| 13187 | /* Update window_end_pos etc.; last_reused_text_row is the last | 13180 | /* Update window_end_pos etc.; last_reused_text_row is the last |
diff --git a/src/xfaces.c b/src/xfaces.c index 6d805feacae..34bee3298ba 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -835,7 +835,10 @@ xstrlwr (s) | |||
| 835 | unsigned char *p = s; | 835 | unsigned char *p = s; |
| 836 | 836 | ||
| 837 | for (p = s; *p; ++p) | 837 | for (p = s; *p; ++p) |
| 838 | *p = tolower (*p); | 838 | /* On Mac OS X 10.3, tolower also converts non-ASCII characters |
| 839 | for some locales. */ | ||
| 840 | if (isascii (*p)) | ||
| 841 | *p = tolower (*p); | ||
| 839 | 842 | ||
| 840 | return s; | 843 | return s; |
| 841 | } | 844 | } |
diff --git a/src/xsmfns.c b/src/xsmfns.c index 4285dd76718..0215d562548 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c | |||
| @@ -52,11 +52,6 @@ Boston, MA 02110-1301, USA. */ | |||
| 52 | #include "termopts.h" | 52 | #include "termopts.h" |
| 53 | #include "xterm.h" | 53 | #include "xterm.h" |
| 54 | 54 | ||
| 55 | #ifndef MAXPATHLEN | ||
| 56 | #define MAXPATHLEN 1024 | ||
| 57 | #endif /* not MAXPATHLEN */ | ||
| 58 | |||
| 59 | |||
| 60 | /* The user login name. */ | 55 | /* The user login name. */ |
| 61 | 56 | ||
| 62 | extern Lisp_Object Vuser_login_name; | 57 | extern Lisp_Object Vuser_login_name; |
| @@ -205,7 +200,7 @@ smc_save_yourself_CB (smcConn, | |||
| 205 | int val_idx = 0; | 200 | int val_idx = 0; |
| 206 | int props_idx = 0; | 201 | int props_idx = 0; |
| 207 | 202 | ||
| 208 | char cwd[MAXPATHLEN+1]; | 203 | char *cwd = NULL; |
| 209 | char *smid_opt; | 204 | char *smid_opt; |
| 210 | 205 | ||
| 211 | /* How to start a new instance of Emacs. */ | 206 | /* How to start a new instance of Emacs. */ |
| @@ -259,12 +254,9 @@ smc_save_yourself_CB (smcConn, | |||
| 259 | props[props_idx]->vals[0].value = SDATA (Vuser_login_name); | 254 | props[props_idx]->vals[0].value = SDATA (Vuser_login_name); |
| 260 | ++props_idx; | 255 | ++props_idx; |
| 261 | 256 | ||
| 262 | /* The current directory property, not mandatory. */ | 257 | cwd = get_current_dir_name (); |
| 263 | #ifdef HAVE_GETCWD | 258 | |
| 264 | if (getcwd (cwd, MAXPATHLEN+1) != 0) | 259 | if (cwd) |
| 265 | #else | ||
| 266 | if (getwd (cwd) != 0) | ||
| 267 | #endif | ||
| 268 | { | 260 | { |
| 269 | props[props_idx] = &prop_ptr[props_idx]; | 261 | props[props_idx] = &prop_ptr[props_idx]; |
| 270 | props[props_idx]->name = SmCurrentDirectory; | 262 | props[props_idx]->name = SmCurrentDirectory; |
| @@ -281,6 +273,9 @@ smc_save_yourself_CB (smcConn, | |||
| 281 | 273 | ||
| 282 | xfree (smid_opt); | 274 | xfree (smid_opt); |
| 283 | 275 | ||
| 276 | if (cwd) | ||
| 277 | free (cwd); | ||
| 278 | |||
| 284 | /* See if we maybe shall interact with the user. */ | 279 | /* See if we maybe shall interact with the user. */ |
| 285 | if (interactStyle != SmInteractStyleAny | 280 | if (interactStyle != SmInteractStyleAny |
| 286 | || ! shutdown | 281 | || ! shutdown |