comparison src/doc.c @ 185:3d6bfa290dbd r20-3b19

Import from CVS: tag r20-3b19
author cvs
date Mon, 13 Aug 2007 09:55:28 +0200
parents e121b013d1f0
children 489f57a838ef
comparison
equal deleted inserted replaced
184:bcd2674570bf 185:3d6bfa290dbd
90 if (space_left > 1024 * 8) 90 if (space_left > 1024 * 8)
91 space_left = 1024 * 8; 91 space_left = 1024 * 8;
92 nread = read (fd, p, space_left); 92 nread = read (fd, p, space_left);
93 if (nread < 0) 93 if (nread < 0)
94 { 94 {
95 return_me = list1 (build_string 95 return_me = list1 (build_string
96 ("Read error on documentation file")); 96 ("Read error on documentation file"));
97 goto done; 97 goto done;
98 } 98 }
99 p[nread] = 0; 99 p[nread] = 0;
100 if (!nread) 100 if (!nread)
119 if (*from != 1 /*^A*/) 119 if (*from != 1 /*^A*/)
120 *to++ = *from++; 120 *to++ = *from++;
121 else 121 else
122 { 122 {
123 int c = *(++from); 123 int c = *(++from);
124 124
125 from++; 125 from++;
126 switch (c) 126 switch (c)
127 { 127 {
128 case 1: *to++ = c; break; 128 case 1: *to++ = c; break;
129 case '0': *to++ = '\0'; break; 129 case '0': *to++ = '\0'; break;
188 else 188 else
189 return Qnil; 189 return Qnil;
190 190
191 if (!STRINGP (file)) 191 if (!STRINGP (file))
192 return Qnil; 192 return Qnil;
193 193
194 /* Put the file name in NAME as a C string. 194 /* Put the file name in NAME as a C string.
195 If it is relative, combine it with Vdoc_directory. */ 195 If it is relative, combine it with Vdoc_directory. */
196 196
197 tem = Ffile_name_absolute_p (file); 197 tem = Ffile_name_absolute_p (file);
198 if (NILP (tem)) 198 if (NILP (tem))
379 if (NILP (domain)) 379 if (NILP (domain))
380 doc = Fgettext (doc); 380 doc = Fgettext (doc);
381 else 381 else
382 doc = Fdgettext (domain, doc); 382 doc = Fdgettext (domain, doc);
383 } 383 }
384 #endif 384 #endif
385 if (NILP (raw) && STRINGP (doc)) 385 if (NILP (raw) && STRINGP (doc))
386 doc = Fsubstitute_command_keys (doc); 386 doc = Fsubstitute_command_keys (doc);
387 return doc; 387 return doc;
388 } 388 }
389 389
428 #ifndef CANNOT_DUMP 428 #ifndef CANNOT_DUMP
429 name = (char *) alloca (XSTRING_LENGTH (filename) + 14); 429 name = (char *) alloca (XSTRING_LENGTH (filename) + 14);
430 strcpy (name, "../lib-src/"); 430 strcpy (name, "../lib-src/");
431 #else /* CANNOT_DUMP */ 431 #else /* CANNOT_DUMP */
432 CHECK_STRING (Vdoc_directory); 432 CHECK_STRING (Vdoc_directory);
433 name = (char *) alloca (XSTRING_LENGTH (filename) 433 name = (char *) alloca (XSTRING_LENGTH (filename)
434 + XSTRING_LENGTH (Vdoc_directory) 434 + XSTRING_LENGTH (Vdoc_directory)
435 + 1); 435 + 1);
436 strcpy (name, (char *) XSTRING_DATA (Vdoc_directory)); 436 strcpy (name, (char *) XSTRING_DATA (Vdoc_directory));
437 #endif /* CANNOT_DUMP */ 437 #endif /* CANNOT_DUMP */
438 strcat (name, (char *) XSTRING_DATA (filename)); 438 strcat (name, (char *) XSTRING_DATA (filename));
479 (a string, say) leave it alone. */ 479 (a string, say) leave it alone. */
480 if (!INTP (old)) 480 if (!INTP (old))
481 goto weird; 481 goto weird;
482 } 482 }
483 Fput (sym, Qvariable_documentation, 483 Fput (sym, Qvariable_documentation,
484 ((end[1] == '*') 484 ((end[1] == '*')
485 ? make_int (- XINT (offset)) 485 ? make_int (- XINT (offset))
486 : offset)); 486 : offset));
487 } 487 }
488 /* Attach a docstring to a function. 488 /* Attach a docstring to a function.
489 The type determines where the docstring is stored. */ 489 The type determines where the docstring is stored. */
667 if (EQ (tem, Qlambda) || EQ (tem, Qautoload)) 667 if (EQ (tem, Qlambda) || EQ (tem, Qautoload))
668 { 668 {
669 doc = -1; 669 doc = -1;
670 tem = Fcdr (Fcdr (fun)); 670 tem = Fcdr (Fcdr (fun));
671 if (CONSP (tem) && 671 if (CONSP (tem) &&
672 INTP (XCAR (tem))) 672 INTP (XCAR (tem)))
673 doc = XINT (XCAR (tem)); 673 doc = XINT (XCAR (tem));
674 } 674 }
675 } 675 }
676 else if (COMPILED_FUNCTIONP (fun)) 676 else if (COMPILED_FUNCTIONP (fun))
677 { 677 {
726 726
727 DEFUN ("substitute-command-keys", Fsubstitute_command_keys, 1, 1, 0, /* 727 DEFUN ("substitute-command-keys", Fsubstitute_command_keys, 1, 1, 0, /*
728 Substitute key descriptions for command names in STRING. 728 Substitute key descriptions for command names in STRING.
729 Return a new string which is STRING with substrings of the form \\=\\[COMMAND] 729 Return a new string which is STRING with substrings of the form \\=\\[COMMAND]
730 replaced by either: a keystroke sequence that will invoke COMMAND, 730 replaced by either: a keystroke sequence that will invoke COMMAND,
731 or \"M-x COMMAND\" if COMMAND is not on any keys. 731 or "M-x COMMAND" if COMMAND is not on any keys.
732 Substrings of the form \\=\\{MAPVAR} are replaced by summaries 732 Substrings of the form \\=\\{MAPVAR} are replaced by summaries
733 \(made by describe-bindings) of the value of MAPVAR, taken as a keymap. 733 \(made by describe-bindings) of the value of MAPVAR, taken as a keymap.
734 Substrings of the form \\=\\<MAPVAR> specify to use the value of MAPVAR 734 Substrings of the form \\=\\<MAPVAR> specify to use the value of MAPVAR
735 as the keymap for future \\=\\[COMMAND] substrings. 735 as the keymap for future \\=\\[COMMAND] substrings.
736 \\=\\= quotes the following character and is discarded; 736 \\=\\= quotes the following character and is discarded;
792 /* Have to reset strdata every time GC might be called */ 792 /* Have to reset strdata every time GC might be called */
793 strdata = XSTRING_DATA (str); 793 strdata = XSTRING_DATA (str);
794 for (idx = 0; idx < strlength; ) 794 for (idx = 0; idx < strlength; )
795 { 795 {
796 Bufbyte *strp = strdata + idx; 796 Bufbyte *strp = strdata + idx;
797 797
798 if (strp[0] != '\\') 798 if (strp[0] != '\\')
799 { 799 {
800 /* just copy other chars */ 800 /* just copy other chars */
801 /* As it happens, this will work with Mule even if the 801 /* As it happens, this will work with Mule even if the
802 character quoted is multi-byte; the remaining multi-byte 802 character quoted is multi-byte; the remaining multi-byte
832 strp += 2; 832 strp += 2;
833 start = strp; 833 start = strp;
834 834
835 while ((idx < strlength) 835 while ((idx < strlength)
836 && *strp != ']') 836 && *strp != ']')
837 { 837 {
838 strp++; 838 strp++;
839 idx++; 839 idx++;
840 } 840 }
841 length = strp - start; 841 length = strp - start;
842 idx++; /* skip ] */ 842 idx++; /* skip ] */
843 843
844 tem = Fintern (make_string (start, length), Qnil); 844 tem = Fintern (make_string (start, length), Qnil);
883 strp += 2; 883 strp += 2;
884 start = strp; 884 start = strp;
885 885
886 while ((idx < strlength) 886 while ((idx < strlength)
887 && *strp != '}' && *strp != '>') 887 && *strp != '}' && *strp != '>')
888 { 888 {
889 strp++; 889 strp++;
890 idx++; 890 idx++;
891 } 891 }
892 length = strp - start; 892 length = strp - start;
893 idx++; /* skip } or > */ 893 idx++; /* skip } or > */
894 894
895 /* Get the value of the keymap in TEM, or nil if undefined. 895 /* Get the value of the keymap in TEM, or nil if undefined.