comparison src/doc.c @ 104619:90578b9cc2d2

* Makefile.in (buildobj.h): New target. (doc.o): Depend on it. (temacs${EXEEXT}): Don't generate buildobj.lst. (mostlyclean): Delete buildobj.h, not buildobj.lst. * makefile.w32-in ($(SRC)/buildobj.h): New target. ($(BLD)/doc.$(O)): Depend on it. (make-buildobj-CMD, make-buildobj-SH): New targets. (Syntax help provided by Eli Zaretskii.) ($(TEMACS)): Don't generate buildobj.lst. * doc.c: Include buildobj.h. (buildobj): New static variable. (Fsnarf_documentation): Use it, instead of opening and reading buildobj.lst.
author Ken Raeburn <raeburn@raeburn.org>
date Wed, 26 Aug 2009 08:28:23 +0000
parents e038c1a8307c
children cd8d62c35d57
comparison
equal deleted inserted replaced
104618:7c3b132bf9bb 104619:90578b9cc2d2
40 #include "lisp.h" 40 #include "lisp.h"
41 #include "buffer.h" 41 #include "buffer.h"
42 #include "keyboard.h" 42 #include "keyboard.h"
43 #include "character.h" 43 #include "character.h"
44 #include "keymap.h" 44 #include "keymap.h"
45 #include "buildobj.h"
45 46
46 #ifdef HAVE_INDEX 47 #ifdef HAVE_INDEX
47 extern char *index P_ ((const char *, int)); 48 extern char *index P_ ((const char *, int));
48 #endif 49 #endif
49 50
550 if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_DOC_STRING) 551 if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_DOC_STRING)
551 ASET (fun, COMPILED_DOC_STRING, make_number (offset)); 552 ASET (fun, COMPILED_DOC_STRING, make_number (offset));
552 } 553 }
553 } 554 }
554 555
556 static const char buildobj[] = BUILDOBJ;
555 557
556 DEFUN ("Snarf-documentation", Fsnarf_documentation, Ssnarf_documentation, 558 DEFUN ("Snarf-documentation", Fsnarf_documentation, Ssnarf_documentation,
557 1, 1, 0, 559 1, 1, 0,
558 doc: /* Used during Emacs initialization to scan the `etc/DOC...' file. 560 doc: /* Used during Emacs initialization to scan the `etc/DOC...' file.
559 This searches the `etc/DOC...' file for doc strings and 561 This searches the `etc/DOC...' file for doc strings and
596 strcat (name, SDATA (filename)); /*** Add this line ***/ 598 strcat (name, SDATA (filename)); /*** Add this line ***/
597 599
598 /* Vbuild_files is nil when temacs is run, and non-nil after that. */ 600 /* Vbuild_files is nil when temacs is run, and non-nil after that. */
599 if (NILP (Vbuild_files)) 601 if (NILP (Vbuild_files))
600 { 602 {
601 size_t cp_size = 0; 603 const char *beg, *end;
602 size_t to_read; 604
603 int nr_read; 605 for (beg = buildobj; *beg; beg = end)
604 char *cp = NULL;
605 char *beg, *end;
606
607 fd = emacs_open ("buildobj.lst", O_RDONLY, 0);
608 if (fd < 0)
609 report_file_error ("Opening file buildobj.lst", Qnil);
610
611 filled = 0;
612 for (;;)
613 {
614 cp_size += 1024;
615 to_read = cp_size - 1 - filled;
616 cp = xrealloc (cp, cp_size);
617 nr_read = emacs_read (fd, &cp[filled], to_read);
618 filled += nr_read;
619 if (nr_read < to_read)
620 break;
621 }
622
623 emacs_close (fd);
624 cp[filled] = 0;
625
626 for (beg = cp; *beg; beg = end)
627 { 606 {
628 int len; 607 int len;
629 608
630 while (*beg && isspace (*beg)) ++beg; 609 while (*beg && isspace (*beg)) ++beg;
631 610
637 len -= 2; /* Just take .o if it ends in .obj */ 616 len -= 2; /* Just take .o if it ends in .obj */
638 617
639 if (len > 0) 618 if (len > 0)
640 Vbuild_files = Fcons (make_string (beg, len), Vbuild_files); 619 Vbuild_files = Fcons (make_string (beg, len), Vbuild_files);
641 } 620 }
642
643 xfree (cp);
644 } 621 }
645 622
646 fd = emacs_open (name, O_RDONLY, 0); 623 fd = emacs_open (name, O_RDONLY, 0);
647 if (fd < 0) 624 if (fd < 0)
648 report_file_error ("Opening doc string file", 625 report_file_error ("Opening doc string file",