158 |
tem = Ffile_name_absolute_p (file); |
tem = Ffile_name_absolute_p (file); |
159 |
if (NILP (tem)) |
if (NILP (tem)) |
160 |
{ |
{ |
161 |
minsize = XSTRING (Vdoc_directory)->size; |
minsize = SCHARS (Vdoc_directory); |
162 |
/* sizeof ("../etc/") == 8 */ |
/* sizeof ("../etc/") == 8 */ |
163 |
if (minsize < 8) |
if (minsize < 8) |
164 |
minsize = 8; |
minsize = 8; |
165 |
name = (char *) alloca (minsize + XSTRING (file)->size + 8); |
name = (char *) alloca (minsize + SCHARS (file) + 8); |
166 |
strcpy (name, XSTRING (Vdoc_directory)->data); |
strcpy (name, SDATA (Vdoc_directory)); |
167 |
strcat (name, XSTRING (file)->data); |
strcat (name, SDATA (file)); |
168 |
munge_doc_file_name (name); |
munge_doc_file_name (name); |
169 |
} |
} |
170 |
else |
else |
171 |
{ |
{ |
172 |
name = (char *) XSTRING (file)->data; |
name = (char *) SDATA (file); |
173 |
} |
} |
174 |
|
|
175 |
fd = emacs_open (name, O_RDONLY, 0); |
fd = emacs_open (name, O_RDONLY, 0); |
181 |
/* Preparing to dump; DOC file is probably not installed. |
/* Preparing to dump; DOC file is probably not installed. |
182 |
So check in ../etc. */ |
So check in ../etc. */ |
183 |
strcpy (name, "../etc/"); |
strcpy (name, "../etc/"); |
184 |
strcat (name, XSTRING (file)->data); |
strcat (name, SDATA (file)); |
185 |
munge_doc_file_name (name); |
munge_doc_file_name (name); |
186 |
|
|
187 |
fd = emacs_open (name, O_RDONLY, 0); |
fd = emacs_open (name, O_RDONLY, 0); |
590 |
(0) |
(0) |
591 |
#endif /* CANNOT_DUMP */ |
#endif /* CANNOT_DUMP */ |
592 |
{ |
{ |
593 |
name = (char *) alloca (XSTRING (filename)->size + 14); |
name = (char *) alloca (SCHARS (filename) + 14); |
594 |
strcpy (name, "../etc/"); |
strcpy (name, "../etc/"); |
595 |
} |
} |
596 |
else |
else |
597 |
{ |
{ |
598 |
CHECK_STRING (Vdoc_directory); |
CHECK_STRING (Vdoc_directory); |
599 |
name = (char *) alloca (XSTRING (filename)->size |
name = (char *) alloca (SCHARS (filename) |
600 |
+ XSTRING (Vdoc_directory)->size + 1); |
+ SCHARS (Vdoc_directory) + 1); |
601 |
strcpy (name, XSTRING (Vdoc_directory)->data); |
strcpy (name, SDATA (Vdoc_directory)); |
602 |
} |
} |
603 |
strcat (name, XSTRING (filename)->data); /*** Add this line ***/ |
strcat (name, SDATA (filename)); /*** Add this line ***/ |
604 |
#ifdef VMS |
#ifdef VMS |
605 |
#ifndef VMS4_4 |
#ifndef VMS4_4 |
606 |
/* For VMS versions with limited file name syntax, |
/* For VMS versions with limited file name syntax, |
722 |
if (NILP (keymap)) |
if (NILP (keymap)) |
723 |
keymap = Voverriding_local_map; |
keymap = Voverriding_local_map; |
724 |
|
|
725 |
bsize = STRING_BYTES (XSTRING (string)); |
bsize = SBYTES (string); |
726 |
bufp = buf = (unsigned char *) xmalloc (bsize); |
bufp = buf = (unsigned char *) xmalloc (bsize); |
727 |
|
|
728 |
strp = (unsigned char *) XSTRING (string)->data; |
strp = (unsigned char *) SDATA (string); |
729 |
while (strp < XSTRING (string)->data + STRING_BYTES (XSTRING (string))) |
while (strp < SDATA (string) + SBYTES (string)) |
730 |
{ |
{ |
731 |
if (strp[0] == '\\' && strp[1] == '=') |
if (strp[0] == '\\' && strp[1] == '=') |
732 |
{ |
{ |
737 |
if (multibyte) |
if (multibyte) |
738 |
{ |
{ |
739 |
int len; |
int len; |
740 |
int maxlen = XSTRING (string)->data + STRING_BYTES (XSTRING (string)) - strp; |
int maxlen = SDATA (string) + SBYTES (string) - strp; |
741 |
|
|
742 |
STRING_CHAR_AND_LENGTH (strp, maxlen, len); |
STRING_CHAR_AND_LENGTH (strp, maxlen, len); |
743 |
if (len == 1) |
if (len == 1) |
759 |
changed = 1; |
changed = 1; |
760 |
strp += 2; /* skip \[ */ |
strp += 2; /* skip \[ */ |
761 |
start = strp; |
start = strp; |
762 |
start_idx = start - XSTRING (string)->data; |
start_idx = start - SDATA (string); |
763 |
|
|
764 |
while ((strp - (unsigned char *) XSTRING (string)->data |
while ((strp - (unsigned char *) SDATA (string) |
765 |
< STRING_BYTES (XSTRING (string))) |
< SBYTES (string)) |
766 |
&& *strp != ']') |
&& *strp != ']') |
767 |
strp++; |
strp++; |
768 |
length_byte = strp - start; |
length_byte = strp - start; |
770 |
strp++; /* skip ] */ |
strp++; /* skip ] */ |
771 |
|
|
772 |
/* Save STRP in IDX. */ |
/* Save STRP in IDX. */ |
773 |
idx = strp - (unsigned char *) XSTRING (string)->data; |
idx = strp - (unsigned char *) SDATA (string); |
774 |
tem = Fintern (make_string (start, length_byte), Qnil); |
tem = Fintern (make_string (start, length_byte), Qnil); |
775 |
|
|
776 |
/* Note the Fwhere_is_internal can GC, so we have to take |
/* Note the Fwhere_is_internal can GC, so we have to take |
777 |
relocation of string contents into account. */ |
relocation of string contents into account. */ |
778 |
tem = Fwhere_is_internal (tem, keymap, Qt, Qnil, Qnil); |
tem = Fwhere_is_internal (tem, keymap, Qt, Qnil, Qnil); |
779 |
strp = XSTRING (string)->data + idx; |
strp = SDATA (string) + idx; |
780 |
start = XSTRING (string)->data + start_idx; |
start = SDATA (string) + start_idx; |
781 |
|
|
782 |
/* Disregard menu bar bindings; it is positively annoying to |
/* Disregard menu bar bindings; it is positively annoying to |
783 |
mention them when there's no menu bar, and it isn't terribly |
mention them when there's no menu bar, and it isn't terribly |
819 |
changed = 1; |
changed = 1; |
820 |
strp += 2; /* skip \{ or \< */ |
strp += 2; /* skip \{ or \< */ |
821 |
start = strp; |
start = strp; |
822 |
start_idx = start - XSTRING (string)->data; |
start_idx = start - SDATA (string); |
823 |
|
|
824 |
while ((strp - (unsigned char *) XSTRING (string)->data |
while ((strp - (unsigned char *) SDATA (string) |
825 |
< XSTRING (string)->size) |
< SCHARS (string)) |
826 |
&& *strp != '}' && *strp != '>') |
&& *strp != '}' && *strp != '>') |
827 |
strp++; |
strp++; |
828 |
|
|
830 |
strp++; /* skip } or > */ |
strp++; /* skip } or > */ |
831 |
|
|
832 |
/* Save STRP in IDX. */ |
/* Save STRP in IDX. */ |
833 |
idx = strp - (unsigned char *) XSTRING (string)->data; |
idx = strp - (unsigned char *) SDATA (string); |
834 |
|
|
835 |
/* Get the value of the keymap in TEM, or nil if undefined. |
/* Get the value of the keymap in TEM, or nil if undefined. |
836 |
Do this while still in the user's current buffer |
Do this while still in the user's current buffer |
844 |
{ |
{ |
845 |
tem = get_keymap (tem, 0, 1); |
tem = get_keymap (tem, 0, 1); |
846 |
/* Note that get_keymap can GC. */ |
/* Note that get_keymap can GC. */ |
847 |
strp = XSTRING (string)->data + idx; |
strp = SDATA (string) + idx; |
848 |
start = XSTRING (string)->data + start_idx; |
start = SDATA (string) + start_idx; |
849 |
} |
} |
850 |
} |
} |
851 |
|
|
858 |
name = Fsymbol_name (name); |
name = Fsymbol_name (name); |
859 |
insert_string ("\nUses keymap \""); |
insert_string ("\nUses keymap \""); |
860 |
insert_from_string (name, 0, 0, |
insert_from_string (name, 0, 0, |
861 |
XSTRING (name)->size, |
SCHARS (name), |
862 |
STRING_BYTES (XSTRING (name)), 1); |
SBYTES (name), 1); |
863 |
insert_string ("\", which is not currently defined.\n"); |
insert_string ("\", which is not currently defined.\n"); |
864 |
if (start[-1] == '<') keymap = Qnil; |
if (start[-1] == '<') keymap = Qnil; |
865 |
} |
} |
872 |
set_buffer_internal (oldbuf); |
set_buffer_internal (oldbuf); |
873 |
|
|
874 |
subst_string: |
subst_string: |
875 |
start = XSTRING (tem)->data; |
start = SDATA (tem); |
876 |
length = XSTRING (tem)->size; |
length = SCHARS (tem); |
877 |
length_byte = STRING_BYTES (XSTRING (tem)); |
length_byte = SBYTES (tem); |
878 |
subst: |
subst: |
879 |
{ |
{ |
880 |
int offset = bufp - buf; |
int offset = bufp - buf; |
884 |
bufp += length_byte; |
bufp += length_byte; |
885 |
nchars += length; |
nchars += length; |
886 |
/* Check STRING again in case gc relocated it. */ |
/* Check STRING again in case gc relocated it. */ |
887 |
strp = (unsigned char *) XSTRING (string)->data + idx; |
strp = (unsigned char *) SDATA (string) + idx; |
888 |
} |
} |
889 |
} |
} |
890 |
else if (! multibyte) /* just copy other chars */ |
else if (! multibyte) /* just copy other chars */ |
892 |
else |
else |
893 |
{ |
{ |
894 |
int len; |
int len; |
895 |
int maxlen = XSTRING (string)->data + STRING_BYTES (XSTRING (string)) - strp; |
int maxlen = SDATA (string) + SBYTES (string) - strp; |
896 |
|
|
897 |
STRING_CHAR_AND_LENGTH (strp, maxlen, len); |
STRING_CHAR_AND_LENGTH (strp, maxlen, len); |
898 |
if (len == 1) |
if (len == 1) |