comparison src/doc.c @ 4990:8f0cf4fd3d2c

Automatic merge
author Ben Wing <ben@xemacs.org>
date Sat, 06 Feb 2010 04:01:46 -0600
parents 16112448d484
children 39d74978fd32
comparison
equal deleted inserted replaced
4989:d2ec55325515 4990:8f0cf4fd3d2c
63 doc_pos - buffer_size : 0; 63 doc_pos - buffer_size : 0;
64 64
65 if (0 > lseek (fd, position, 0)) 65 if (0 > lseek (fd, position, 0))
66 { 66 {
67 if (name_nonreloc) 67 if (name_nonreloc)
68 name_reloc = build_intstring (name_nonreloc); 68 name_reloc = build_istring (name_nonreloc);
69 return_me = list3 (build_msg_string 69 return_me = list3 (build_msg_string
70 ("Position out of range in doc string file"), 70 ("Position out of range in doc string file"),
71 name_reloc, make_int (position)); 71 name_reloc, make_int (position));
72 goto done; 72 goto done;
73 } 73 }
178 GCPRO2 (fdstream, instream); 178 GCPRO2 (fdstream, instream);
179 179
180 if (0 > lseek (fd, position, 0)) 180 if (0 > lseek (fd, position, 0))
181 { 181 {
182 if (name_nonreloc) 182 if (name_nonreloc)
183 name_reloc = build_intstring (name_nonreloc); 183 name_reloc = build_istring (name_nonreloc);
184 return_me = list3 (build_msg_string 184 return_me = list3 (build_msg_string
185 ("Position out of range in doc string file"), 185 ("Position out of range in doc string file"),
186 name_reloc, make_int (position)); 186 name_reloc, make_int (position));
187 goto done; 187 goto done;
188 } 188 }
287 Lstream_delete (XLSTREAM (instream)); 287 Lstream_delete (XLSTREAM (instream));
288 Lstream_delete (XLSTREAM (fdstream)); 288 Lstream_delete (XLSTREAM (fdstream));
289 } 289 }
290 UNGCPRO; 290 UNGCPRO;
291 if (buffer != buf) /* We must have allocated buffer above */ 291 if (buffer != buf) /* We must have allocated buffer above */
292 xfree (buffer, Ibyte *); 292 xfree (buffer);
293 return return_me; 293 return return_me;
294 } 294 }
295 295
296 #define string_join(dest, s1, s2) \ 296 #define string_join(dest, s1, s2) \
297 memcpy (dest, XSTRING_DATA (s1), XSTRING_LENGTH (s1)); \ 297 memcpy (dest, XSTRING_DATA (s1), XSTRING_LENGTH (s1)); \
376 fd = qxe_open (name_nonreloc, O_RDONLY | OPEN_BINARY, 0); 376 fd = qxe_open (name_nonreloc, O_RDONLY | OPEN_BINARY, 0);
377 } 377 }
378 378
379 if (fd < 0) 379 if (fd < 0)
380 report_file_error ("Cannot open doc string file", 380 report_file_error ("Cannot open doc string file",
381 name_nonreloc ? build_intstring (name_nonreloc) : 381 name_nonreloc ? build_istring (name_nonreloc) :
382 name_reloc); 382 name_reloc);
383 } 383 }
384 384
385 tem = unparesseuxify_doc_string (fd, position, name_nonreloc, name_reloc, 385 tem = unparesseuxify_doc_string (fd, position, name_nonreloc, name_reloc,
386 standard_doc_file); 386 standard_doc_file);
473 fd = qxe_open (name_nonreloc, O_RDONLY | OPEN_BINARY, 0); 473 fd = qxe_open (name_nonreloc, O_RDONLY | OPEN_BINARY, 0);
474 } 474 }
475 475
476 if (fd < 0) 476 if (fd < 0)
477 report_file_error ("Cannot open doc string file", 477 report_file_error ("Cannot open doc string file",
478 name_nonreloc ? build_intstring (name_nonreloc) : 478 name_nonreloc ? build_istring (name_nonreloc) :
479 name_reloc); 479 name_reloc);
480 } 480 }
481 481
482 tem = extract_object_file_name (fd, position, name_nonreloc, name_reloc, 482 tem = extract_object_file_name (fd, position, name_nonreloc, name_reloc,
483 standard_doc_file); 483 standard_doc_file);
489 return tem; 489 return tem;
490 } 490 }
491 491
492 492
493 static void 493 static void
494 weird_doc (Lisp_Object sym, const CIbyte *weirdness, const CIbyte *type, 494 weird_doc (Lisp_Object sym, const Ascbyte *weirdness, const Ascbyte *type,
495 int pos) 495 int pos)
496 { 496 {
497 if (!strcmp (weirdness, GETTEXT ("duplicate"))) return; 497 if (!strcmp (weirdness, "duplicate")) return;
498 message ("Note: Strange doc (%s) for %s %s @ %d", 498 message ("Note: Strange doc (%s) for %s %s @ %d",
499 weirdness, type, XSTRING_DATA (XSYMBOL (sym)->name), pos); 499 GETTEXT (weirdness), GETTEXT (type),
500 XSTRING_DATA (XSYMBOL (sym)->name), pos);
500 } 501 }
501 502
502 DEFUN ("built-in-symbol-file", Fbuilt_in_symbol_file, 1, 2, 0, /* 503 DEFUN ("built-in-symbol-file", Fbuilt_in_symbol_file, 1, 2, 0, /*
503 Return the C source file built-in symbol SYM comes from. 504 Return the C source file built-in symbol SYM comes from.
504 Don't use this. Use the more general `symbol-file' (q.v.) instead. 505 Don't use this. Use the more general `symbol-file' (q.v.) instead.
596 if (SUBRP (fun)) 597 if (SUBRP (fun))
597 { 598 {
598 if (XSUBR (fun)->doc == 0) 599 if (XSUBR (fun)->doc == 0)
599 return Qnil; 600 return Qnil;
600 if ((EMACS_INT) XSUBR (fun)->doc >= 0) 601 if ((EMACS_INT) XSUBR (fun)->doc >= 0)
601 doc = build_string (XSUBR (fun)->doc); 602 doc = build_cistring (XSUBR (fun)->doc);
602 else 603 else
603 doc = get_doc_string (make_int (- (EMACS_INT) XSUBR (fun)->doc)); 604 doc = get_doc_string (make_int (- (EMACS_INT) XSUBR (fun)->doc));
604 } 605 }
605 else if (COMPILED_FUNCTIONP (fun)) 606 else if (COMPILED_FUNCTIONP (fun))
606 { 607 {
751 752
752 qxestrcat (name, XSTRING_DATA (filename)); 753 qxestrcat (name, XSTRING_DATA (filename));
753 754
754 fd = qxe_open (name, O_RDONLY | OPEN_BINARY, 0); 755 fd = qxe_open (name, O_RDONLY | OPEN_BINARY, 0);
755 if (fd < 0) 756 if (fd < 0)
756 report_file_error ("Opening doc string file", build_intstring (name)); 757 report_file_error ("Opening doc string file", build_istring (name));
757 Vinternal_doc_file_name = filename; 758 Vinternal_doc_file_name = filename;
758 filled = 0; 759 filled = 0;
759 pos = 0; 760 pos = 0;
760 while (1) 761 while (1)
761 { 762 {
787 and make it negative for a user-variable 788 and make it negative for a user-variable
788 (doc starts with a `*'). */ 789 (doc starts with a `*'). */
789 Lisp_Object old = Fget (sym, Qvariable_documentation, Qzero); 790 Lisp_Object old = Fget (sym, Qvariable_documentation, Qzero);
790 if (!ZEROP (old)) 791 if (!ZEROP (old))
791 { 792 {
792 weird_doc (sym, GETTEXT ("duplicate"), 793 weird_doc (sym, "duplicate",
793 GETTEXT ("variable"), pos); 794 "variable", pos);
794 /* In the case of duplicate doc file entries, always 795 /* In the case of duplicate doc file entries, always
795 take the later one. But if the doc is not an int 796 take the later one. But if the doc is not an int
796 (a string, say) leave it alone. */ 797 (a string, say) leave it alone. */
797 if (!INTP (old)) 798 if (!INTP (old))
798 goto weird; 799 goto weird;
828 /src/xemacs/mule/src/abbrev.c:269: warning: `SFexpand_abbrev' defined but not used 829 /src/xemacs/mule/src/abbrev.c:269: warning: `SFexpand_abbrev' defined but not used
829 830
830 So I'm disabling this. --ben */ 831 So I'm disabling this. --ben */
831 832
832 /* May have been #if'ed out or something */ 833 /* May have been #if'ed out or something */
833 weird_doc (sym, GETTEXT ("not fboundp"), 834 weird_doc (sym, "not fboundp",
834 GETTEXT ("function"), pos); 835 "function", pos);
835 #endif 836 #endif
836 goto weird; 837 goto weird;
837 } 838 }
838 else if (SUBRP (fun)) 839 else if (SUBRP (fun))
839 { 840 {
840 /* Lisp_Subrs have a slot for it. */ 841 /* Lisp_Subrs have a slot for it. */
841 if (XSUBR (fun)->doc) 842 if (XSUBR (fun)->doc)
842 { 843 {
843 weird_doc (sym, GETTEXT ("duplicate"), 844 weird_doc (sym, "duplicate",
844 GETTEXT ("subr"), pos); 845 "subr", pos);
845 goto weird; 846 goto weird;
846 } 847 }
847 XSUBR (fun)->doc = (char *) (- XINT (offset)); 848 XSUBR (fun)->doc = (char *) (- XINT (offset));
848 } 849 }
849 else if (CONSP (fun)) 850 else if (CONSP (fun))
857 INTP (XCAR (tem))) 858 INTP (XCAR (tem)))
858 { 859 {
859 Lisp_Object old = XCAR (tem); 860 Lisp_Object old = XCAR (tem);
860 if (!ZEROP (old)) 861 if (!ZEROP (old))
861 { 862 {
862 weird_doc (sym, GETTEXT ("duplicate"), 863 if (EQ (tem, Qlambda))
863 (EQ (tem, Qlambda) 864 weird_doc (sym, "duplicate", "lambda",
864 ? GETTEXT ("lambda") 865 pos);
865 : GETTEXT ("autoload")), 866 else
866 pos); 867 weird_doc (sym, "duplicate", "autoload",
868 pos);
867 /* In the case of duplicate doc file entries, 869 /* In the case of duplicate doc file entries,
868 always take the later one. But if the doc 870 always take the later one. But if the doc
869 is not an int (a string, say) leave it 871 is not an int (a string, say) leave it
870 alone. */ 872 alone. */
871 if (!INTP (old)) 873 if (!INTP (old))
873 } 875 }
874 XCAR (tem) = offset; 876 XCAR (tem) = offset;
875 } 877 }
876 else if (!CONSP (tem)) 878 else if (!CONSP (tem))
877 { 879 {
878 weird_doc (sym, GETTEXT ("!CONSP(tem)"), 880 weird_doc (sym, "!CONSP(tem)", "function", pos);
879 GETTEXT ("function"), pos);
880 goto cont; 881 goto cont;
881 } 882 }
882 else 883 else
883 { 884 {
884 /* DOC string is a string not integer 0 */ 885 /* DOC string is a string not integer 0 */
885 #if 0 886 #if 0
886 weird_doc (sym, GETTEXT ("!INTP(XCAR(tem))"), 887 weird_doc (sym, "!INTP(XCAR(tem))",
887 GETTEXT ("function"), pos); 888 "function", pos);
888 #endif 889 #endif
889 goto cont; 890 goto cont;
890 } 891 }
891 } 892 }
892 else 893 else
893 { 894 {
894 weird_doc (sym, GETTEXT ("not lambda or autoload"), 895 weird_doc (sym, "not lambda or autoload",
895 GETTEXT ("function"), pos); 896 "function", pos);
896 goto cont; 897 goto cont;
897 } 898 }
898 } 899 }
899 else if (COMPILED_FUNCTIONP (fun)) 900 else if (COMPILED_FUNCTIONP (fun))
900 { 901 {
909 have any doc, which is a legal if slightly 910 have any doc, which is a legal if slightly
910 bogus situation, so don't blow up. */ 911 bogus situation, so don't blow up. */
911 912
912 if (! (f->flags.documentationp)) 913 if (! (f->flags.documentationp))
913 { 914 {
914 weird_doc (sym, GETTEXT ("no doc slot"), 915 weird_doc (sym, "no doc slot", "bytecode", pos);
915 GETTEXT ("bytecode"), pos);
916 goto weird; 916 goto weird;
917 } 917 }
918 else 918 else
919 { 919 {
920 Lisp_Object old = 920 Lisp_Object old =
921 compiled_function_documentation (f); 921 compiled_function_documentation (f);
922 if (!ZEROP (old)) 922 if (!ZEROP (old))
923 { 923 {
924 weird_doc (sym, GETTEXT ("duplicate"), 924 weird_doc (sym, "duplicate", "bytecode", pos);
925 GETTEXT ("bytecode"), pos);
926 /* In the case of duplicate doc file entries, 925 /* In the case of duplicate doc file entries,
927 always take the later one. But if the doc is 926 always take the later one. But if the doc is
928 not an int (a string, say) leave it alone. */ 927 not an int (a string, say) leave it alone. */
929 if (!INTP (old)) 928 if (!INTP (old))
930 goto weird; 929 goto weird;
934 } 933 }
935 else 934 else
936 { 935 {
937 /* Otherwise the function is undefined or 936 /* Otherwise the function is undefined or
938 otherwise weird. Ignore it. */ 937 otherwise weird. Ignore it. */
939 weird_doc (sym, GETTEXT ("weird function"), 938 weird_doc (sym, "weird function", "function", pos);
940 GETTEXT ("function"), pos);
941 goto weird; 939 goto weird;
942 } 940 }
943 } 941 }
944 else 942 else
945 { 943 {
1243 tem = get_keymap (tem, 0, 1); 1241 tem = get_keymap (tem, 0, 1);
1244 } 1242 }
1245 1243
1246 if (NILP (tem)) 1244 if (NILP (tem))
1247 { 1245 {
1248 buffer_insert_c_string (buf_, "(uses keymap \""); 1246 buffer_insert_ascstring (buf_, "(uses keymap \"");
1249 buffer_insert_lisp_string (buf_, Fsymbol_name (name)); 1247 buffer_insert_lisp_string (buf_, Fsymbol_name (name));
1250 buffer_insert_c_string (buf_, "\", which is not currently defined) "); 1248 buffer_insert_ascstring (buf_, "\", which is not currently defined) ");
1251 1249
1252 if (start[-1] == '<') keymap = Qnil; 1250 if (start[-1] == '<') keymap = Qnil;
1253 } 1251 }
1254 else if (start[-1] == '<') 1252 else if (start[-1] == '<')
1255 keymap = tem; 1253 keymap = tem;
1282 1280
1283 if (changed) /* don't bother if nothing substituted */ 1281 if (changed) /* don't bother if nothing substituted */
1284 tem = make_string (buf, bufp - buf); 1282 tem = make_string (buf, bufp - buf);
1285 else 1283 else
1286 tem = string; 1284 tem = string;
1287 xfree (buf, Ibyte *); 1285 xfree (buf);
1288 UNGCPRO; 1286 UNGCPRO;
1289 return tem; 1287 return tem;
1290 } 1288 }
1291 1289
1292 1290
1313 DEFVAR_LISP ("internal-doc-file-name", &Vinternal_doc_file_name /* 1311 DEFVAR_LISP ("internal-doc-file-name", &Vinternal_doc_file_name /*
1314 Name of file containing documentation strings of built-in symbols. 1312 Name of file containing documentation strings of built-in symbols.
1315 */ ); 1313 */ );
1316 Vinternal_doc_file_name = Qnil; 1314 Vinternal_doc_file_name = Qnil;
1317 1315
1318 QSsubstitute = build_string (" *substitute*"); 1316 QSsubstitute = build_ascstring (" *substitute*");
1319 staticpro (&QSsubstitute); 1317 staticpro (&QSsubstitute);
1320 } 1318 }