151 |
|
|
152 |
if (!STRINGP (file)) |
if (!STRINGP (file)) |
153 |
return Qnil; |
return Qnil; |
154 |
|
|
155 |
/* Put the file name in NAME as a C string. |
/* Put the file name in NAME as a C string. |
156 |
If it is relative, combine it with Vdoc_directory. */ |
If it is relative, combine it with Vdoc_directory. */ |
157 |
|
|
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); |
375 |
documentation: |
documentation: |
376 |
|
|
377 |
doc = Qnil; |
doc = Qnil; |
378 |
|
|
379 |
if (SYMBOLP (function) |
if (SYMBOLP (function) |
380 |
&& (tem = Fget (function, Qfunction_documentation), |
&& (tem = Fget (function, Qfunction_documentation), |
381 |
!NILP (tem))) |
!NILP (tem))) |
382 |
return Fdocumentation_property (function, Qfunction_documentation, raw); |
return Fdocumentation_property (function, Qfunction_documentation, raw); |
383 |
|
|
384 |
fun = Findirect_function (function); |
fun = Findirect_function (function); |
385 |
if (SUBRP (fun)) |
if (SUBRP (fun)) |
386 |
{ |
{ |
489 |
Lisp_Object tem; |
Lisp_Object tem; |
490 |
|
|
491 |
documentation_property: |
documentation_property: |
492 |
|
|
493 |
tem = Fget (symbol, prop); |
tem = Fget (symbol, prop); |
494 |
if (EQ (tem, make_number (0))) |
if (EQ (tem, make_number (0))) |
495 |
tem = Qnil; |
tem = Qnil; |
514 |
else if (!STRINGP (tem)) |
else if (!STRINGP (tem)) |
515 |
/* Feval protects its argument. */ |
/* Feval protects its argument. */ |
516 |
tem = Feval (tem); |
tem = Feval (tem); |
517 |
|
|
518 |
if (NILP (raw) && STRINGP (tem)) |
if (NILP (raw) && STRINGP (tem)) |
519 |
tem = Fsubstitute_command_keys (tem); |
tem = Fsubstitute_command_keys (tem); |
520 |
return tem; |
return tem; |
594 |
(0) |
(0) |
595 |
#endif /* CANNOT_DUMP */ |
#endif /* CANNOT_DUMP */ |
596 |
{ |
{ |
597 |
name = (char *) alloca (XSTRING (filename)->size + 14); |
name = (char *) alloca (SCHARS (filename) + 14); |
598 |
strcpy (name, "../etc/"); |
strcpy (name, "../etc/"); |
599 |
} |
} |
600 |
else |
else |
601 |
{ |
{ |
602 |
CHECK_STRING (Vdoc_directory); |
CHECK_STRING (Vdoc_directory); |
603 |
name = (char *) alloca (XSTRING (filename)->size |
name = (char *) alloca (SCHARS (filename) |
604 |
+ XSTRING (Vdoc_directory)->size + 1); |
+ SCHARS (Vdoc_directory) + 1); |
605 |
strcpy (name, XSTRING (Vdoc_directory)->data); |
strcpy (name, SDATA (Vdoc_directory)); |
606 |
} |
} |
607 |
strcat (name, XSTRING (filename)->data); /*** Add this line ***/ |
strcat (name, SDATA (filename)); /*** Add this line ***/ |
608 |
#ifdef VMS |
#ifdef VMS |
609 |
#ifndef VMS4_4 |
#ifndef VMS4_4 |
610 |
/* For VMS versions with limited file name syntax, |
/* For VMS versions with limited file name syntax, |
726 |
if (NILP (keymap)) |
if (NILP (keymap)) |
727 |
keymap = Voverriding_local_map; |
keymap = Voverriding_local_map; |
728 |
|
|
729 |
bsize = STRING_BYTES (XSTRING (string)); |
bsize = SBYTES (string); |
730 |
bufp = buf = (unsigned char *) xmalloc (bsize); |
bufp = buf = (unsigned char *) xmalloc (bsize); |
731 |
|
|
732 |
strp = (unsigned char *) XSTRING (string)->data; |
strp = (unsigned char *) SDATA (string); |
733 |
while (strp < XSTRING (string)->data + STRING_BYTES (XSTRING (string))) |
while (strp < SDATA (string) + SBYTES (string)) |
734 |
{ |
{ |
735 |
if (strp[0] == '\\' && strp[1] == '=') |
if (strp[0] == '\\' && strp[1] == '=') |
736 |
{ |
{ |
741 |
if (multibyte) |
if (multibyte) |
742 |
{ |
{ |
743 |
int len; |
int len; |
744 |
int maxlen = XSTRING (string)->data + STRING_BYTES (XSTRING (string)) - strp; |
int maxlen = SDATA (string) + SBYTES (string) - strp; |
745 |
|
|
746 |
STRING_CHAR_AND_LENGTH (strp, maxlen, len); |
STRING_CHAR_AND_LENGTH (strp, maxlen, len); |
747 |
if (len == 1) |
if (len == 1) |
763 |
changed = 1; |
changed = 1; |
764 |
strp += 2; /* skip \[ */ |
strp += 2; /* skip \[ */ |
765 |
start = strp; |
start = strp; |
766 |
start_idx = start - XSTRING (string)->data; |
start_idx = start - SDATA (string); |
767 |
|
|
768 |
while ((strp - (unsigned char *) XSTRING (string)->data |
while ((strp - (unsigned char *) SDATA (string) |
769 |
< STRING_BYTES (XSTRING (string))) |
< SBYTES (string)) |
770 |
&& *strp != ']') |
&& *strp != ']') |
771 |
strp++; |
strp++; |
772 |
length_byte = strp - start; |
length_byte = strp - start; |
774 |
strp++; /* skip ] */ |
strp++; /* skip ] */ |
775 |
|
|
776 |
/* Save STRP in IDX. */ |
/* Save STRP in IDX. */ |
777 |
idx = strp - (unsigned char *) XSTRING (string)->data; |
idx = strp - (unsigned char *) SDATA (string); |
778 |
tem = Fintern (make_string (start, length_byte), Qnil); |
tem = Fintern (make_string (start, length_byte), Qnil); |
779 |
|
|
780 |
/* Note the Fwhere_is_internal can GC, so we have to take |
/* Note the Fwhere_is_internal can GC, so we have to take |
781 |
relocation of string contents into account. */ |
relocation of string contents into account. */ |
782 |
tem = Fwhere_is_internal (tem, keymap, Qt, Qnil, Qnil); |
tem = Fwhere_is_internal (tem, keymap, Qt, Qnil, Qnil); |
783 |
strp = XSTRING (string)->data + idx; |
strp = SDATA (string) + idx; |
784 |
start = XSTRING (string)->data + start_idx; |
start = SDATA (string) + start_idx; |
785 |
|
|
786 |
/* Disregard menu bar bindings; it is positively annoying to |
/* Disregard menu bar bindings; it is positively annoying to |
787 |
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 |
823 |
changed = 1; |
changed = 1; |
824 |
strp += 2; /* skip \{ or \< */ |
strp += 2; /* skip \{ or \< */ |
825 |
start = strp; |
start = strp; |
826 |
start_idx = start - XSTRING (string)->data; |
start_idx = start - SDATA (string); |
827 |
|
|
828 |
while ((strp - (unsigned char *) XSTRING (string)->data |
while ((strp - (unsigned char *) SDATA (string) |
829 |
< XSTRING (string)->size) |
< SCHARS (string)) |
830 |
&& *strp != '}' && *strp != '>') |
&& *strp != '}' && *strp != '>') |
831 |
strp++; |
strp++; |
832 |
|
|
834 |
strp++; /* skip } or > */ |
strp++; /* skip } or > */ |
835 |
|
|
836 |
/* Save STRP in IDX. */ |
/* Save STRP in IDX. */ |
837 |
idx = strp - (unsigned char *) XSTRING (string)->data; |
idx = strp - (unsigned char *) SDATA (string); |
838 |
|
|
839 |
/* Get the value of the keymap in TEM, or nil if undefined. |
/* Get the value of the keymap in TEM, or nil if undefined. |
840 |
Do this while still in the user's current buffer |
Do this while still in the user's current buffer |
848 |
{ |
{ |
849 |
tem = get_keymap (tem, 0, 1); |
tem = get_keymap (tem, 0, 1); |
850 |
/* Note that get_keymap can GC. */ |
/* Note that get_keymap can GC. */ |
851 |
strp = XSTRING (string)->data + idx; |
strp = SDATA (string) + idx; |
852 |
start = XSTRING (string)->data + start_idx; |
start = SDATA (string) + start_idx; |
853 |
} |
} |
854 |
} |
} |
855 |
|
|
862 |
name = Fsymbol_name (name); |
name = Fsymbol_name (name); |
863 |
insert_string ("\nUses keymap \""); |
insert_string ("\nUses keymap \""); |
864 |
insert_from_string (name, 0, 0, |
insert_from_string (name, 0, 0, |
865 |
XSTRING (name)->size, |
SCHARS (name), |
866 |
STRING_BYTES (XSTRING (name)), 1); |
SBYTES (name), 1); |
867 |
insert_string ("\", which is not currently defined.\n"); |
insert_string ("\", which is not currently defined.\n"); |
868 |
if (start[-1] == '<') keymap = Qnil; |
if (start[-1] == '<') keymap = Qnil; |
869 |
} |
} |
876 |
set_buffer_internal (oldbuf); |
set_buffer_internal (oldbuf); |
877 |
|
|
878 |
subst_string: |
subst_string: |
879 |
start = XSTRING (tem)->data; |
start = SDATA (tem); |
880 |
length = XSTRING (tem)->size; |
length = SCHARS (tem); |
881 |
length_byte = STRING_BYTES (XSTRING (tem)); |
length_byte = SBYTES (tem); |
882 |
subst: |
subst: |
883 |
{ |
{ |
884 |
int offset = bufp - buf; |
int offset = bufp - buf; |
888 |
bufp += length_byte; |
bufp += length_byte; |
889 |
nchars += length; |
nchars += length; |
890 |
/* Check STRING again in case gc relocated it. */ |
/* Check STRING again in case gc relocated it. */ |
891 |
strp = (unsigned char *) XSTRING (string)->data + idx; |
strp = (unsigned char *) SDATA (string) + idx; |
892 |
} |
} |
893 |
} |
} |
894 |
else if (! multibyte) /* just copy other chars */ |
else if (! multibyte) /* just copy other chars */ |
896 |
else |
else |
897 |
{ |
{ |
898 |
int len; |
int len; |
899 |
int maxlen = XSTRING (string)->data + STRING_BYTES (XSTRING (string)) - strp; |
int maxlen = SDATA (string) + SBYTES (string) - strp; |
900 |
|
|
901 |
STRING_CHAR_AND_LENGTH (strp, maxlen, len); |
STRING_CHAR_AND_LENGTH (strp, maxlen, len); |
902 |
if (len == 1) |
if (len == 1) |
922 |
{ |
{ |
923 |
Qfunction_documentation = intern ("function-documentation"); |
Qfunction_documentation = intern ("function-documentation"); |
924 |
staticpro (&Qfunction_documentation); |
staticpro (&Qfunction_documentation); |
925 |
|
|
926 |
DEFVAR_LISP ("internal-doc-file-name", &Vdoc_file_name, |
DEFVAR_LISP ("internal-doc-file-name", &Vdoc_file_name, |
927 |
doc: /* Name of file containing documentation strings of built-in symbols. */); |
doc: /* Name of file containing documentation strings of built-in symbols. */); |
928 |
Vdoc_file_name = Qnil; |
Vdoc_file_name = Qnil; |