comparison src/doc.c @ 272:c5d627a313b1 r21-0b34

Import from CVS: tag r21-0b34
author cvs
date Mon, 13 Aug 2007 10:28:48 +0200
parents 966663fcf606
children 8626e4521993
comparison
equal deleted inserted replaced
271:c7b7086b0a39 272:c5d627a313b1
28 28
29 #include "buffer.h" 29 #include "buffer.h"
30 #include "bytecode.h" 30 #include "bytecode.h"
31 #include "insdel.h" 31 #include "insdel.h"
32 #include "keymap.h" 32 #include "keymap.h"
33
34 #include "sysfile.h" 33 #include "sysfile.h"
35 34
36 35 Lisp_Object Vinternal_doc_file_name;
37 Lisp_Object Vdoc_file_name;
38 36
39 Lisp_Object QSsubstitute; 37 Lisp_Object QSsubstitute;
40 38
41 /* Read and return doc string from open file descriptor FD 39 /* Read and return doc string from open file descriptor FD
42 at position POSITION. Does not close the file. Returns 40 at position POSITION. Does not close the file. Returns
175 Lisp_Object file, tem; 173 Lisp_Object file, tem;
176 Lisp_Object name_reloc = Qnil; 174 Lisp_Object name_reloc = Qnil;
177 175
178 if (INTP (filepos)) 176 if (INTP (filepos))
179 { 177 {
180 file = Vdoc_file_name; 178 file = Vinternal_doc_file_name;
181 position = XINT (filepos); 179 position = XINT (filepos);
182 } 180 }
183 else if (CONSP (filepos) && INTP (XCDR (filepos))) 181 else if (CONSP (filepos) && INTP (XCDR (filepos)))
184 { 182 {
185 file = XCAR (filepos); 183 file = XCAR (filepos);
448 446
449 fd = open (name, O_RDONLY | OPEN_BINARY, 0); 447 fd = open (name, O_RDONLY | OPEN_BINARY, 0);
450 if (fd < 0) 448 if (fd < 0)
451 report_file_error ("Opening doc string file", 449 report_file_error ("Opening doc string file",
452 Fcons (build_string (name), Qnil)); 450 Fcons (build_string (name), Qnil));
453 Vdoc_file_name = filename; 451 Vinternal_doc_file_name = filename;
454 filled = 0; 452 filled = 0;
455 pos = 0; 453 pos = 0;
456 while (1) 454 while (1)
457 { 455 {
458 if (filled < 512) 456 if (filled < 512)
640 wrapped by advice-freeze.el... */ 638 wrapped by advice-freeze.el... */
641 static int 639 static int
642 kludgily_ignore_lost_doc_p (Lisp_Object sym) 640 kludgily_ignore_lost_doc_p (Lisp_Object sym)
643 { 641 {
644 # define kludge_prefix "ad-Orig-" 642 # define kludge_prefix "ad-Orig-"
645 return (string_length (XSYMBOL (sym)->name) > sizeof (kludge_prefix) && 643 struct Lisp_String *name = XSYMBOL (sym)->name;
646 !strncmp ((char *) string_data (XSYMBOL (sym)->name), kludge_prefix, 644 return (string_length (name) > (Bytecount) (sizeof (kludge_prefix)) &&
645 !strncmp ((char *) string_data (name), kludge_prefix,
647 sizeof (kludge_prefix) - 1)); 646 sizeof (kludge_prefix) - 1));
648 # undef kludge_prefix 647 # undef kludge_prefix
649 } 648 }
650 #else 649 #else
651 # define kludgily_ignore_lost_doc_p(sym) 0 650 # define kludgily_ignore_lost_doc_p(sym) 0
756 REGISTER Bufbyte *bufp; 755 REGISTER Bufbyte *bufp;
757 Bytecount strlength; 756 Bytecount strlength;
758 Bytecount idx; 757 Bytecount idx;
759 Bytecount bsize; 758 Bytecount bsize;
760 Bufbyte *new; 759 Bufbyte *new;
761 Lisp_Object tem = Qnil; 760 Lisp_Object tem;
762 Lisp_Object keymap; 761 Lisp_Object keymap;
763 Bufbyte *start; 762 Bufbyte *start;
764 Bytecount length; 763 Bytecount length;
765 Lisp_Object name; 764 Lisp_Object name;
766 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 765 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
788 #if 0 /* FSFmacs */ 787 #if 0 /* FSFmacs */
789 /* This is really weird and garbagey. If keymap is nil and there's 788 /* This is really weird and garbagey. If keymap is nil and there's
790 an overriding-local-map, `where-is-internal' will correctly note 789 an overriding-local-map, `where-is-internal' will correctly note
791 this, so there's no reason to do it here. Maybe FSFmacs 790 this, so there's no reason to do it here. Maybe FSFmacs
792 `where-is-internal' is broken. */ 791 `where-is-internal' is broken. */
792 /*
793 keymap = current_kboard->Voverriding_terminal_local_map; 793 keymap = current_kboard->Voverriding_terminal_local_map;
794 if (NILP (keymap)) 794 if (NILP (keymap))
795 keymap = Voverriding_local_map; 795 keymap = Voverriding_local_map;
796 */
796 #endif 797 #endif
797 798
798 strlength = XSTRING_LENGTH (str); 799 strlength = XSTRING_LENGTH (str);
799 bsize = 1 + strlength; 800 bsize = 1 + strlength;
800 buf = (Bufbyte *) xmalloc (bsize); 801 buf = (Bufbyte *) xmalloc (bsize);
883 } 884 }
884 } 885 }
885 case '{': 886 case '{':
886 case '<': 887 case '<':
887 { 888 {
888 Lisp_Object buffer = Fget_buffer_create (QSsubstitute); 889 /* ### jump to label `subst_string|subst' crosses
889 struct buffer *buf_ = XBUFFER (buffer); 890 initialization of `buffer|_buf' */
891 Lisp_Object buffer;
892 struct buffer *buf_;
893
894 buffer = Fget_buffer_create (QSsubstitute);
895 buf_ = XBUFFER (buffer);
890 896
891 Fbuffer_disable_undo (buffer); 897 Fbuffer_disable_undo (buffer);
892 Ferase_buffer (buffer); 898 Ferase_buffer (buffer);
893 899
894 /* \{foo} is replaced with a summary of keymap (symbol-value foo). 900 /* \{foo} is replaced with a summary of keymap (symbol-value foo).
988 } 994 }
989 995
990 void 996 void
991 vars_of_doc (void) 997 vars_of_doc (void)
992 { 998 {
993 DEFVAR_LISP ("internal-doc-file-name", &Vdoc_file_name /* 999 DEFVAR_LISP ("internal-doc-file-name", &Vinternal_doc_file_name /*
994 Name of file containing documentation strings of built-in symbols. 1000 Name of file containing documentation strings of built-in symbols.
995 */ ); 1001 */ );
996 Vdoc_file_name = Qnil; 1002 Vinternal_doc_file_name = Qnil;
997 1003
998 QSsubstitute = build_string (" *substitute*"); 1004 QSsubstitute = build_string (" *substitute*");
999 staticpro (&QSsubstitute); 1005 staticpro (&QSsubstitute);
1000 } 1006 }