aboutsummaryrefslogtreecommitdiffstats
path: root/src/doc.c
diff options
context:
space:
mode:
authorKaroly Lorentey2004-11-13 18:34:40 +0000
committerKaroly Lorentey2004-11-13 18:34:40 +0000
commite417405015c93c81641f5c4a33ec898b5c353772 (patch)
tree017a980c35c8a71c372304418d151e3826f88636 /src/doc.c
parentf590a2a442d19f3a74d7bbd02bbcb4e3239f2327 (diff)
parent68d1b30d251b4771f739d20f507cd9523ae3919b (diff)
downloademacs-e417405015c93c81641f5c4a33ec898b5c353772.tar.gz
emacs-e417405015c93c81641f5c4a33ec898b5c353772.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-673 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-674 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-675 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-676 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-677 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-678 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-679 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-680 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-681 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-682 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-683 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-684 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-685 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-686 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-687 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-688 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-689 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-690 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-691 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-692 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-693 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-69 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-70 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-71 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-267
Diffstat (limited to 'src/doc.c')
-rw-r--r--src/doc.c78
1 files changed, 76 insertions, 2 deletions
diff --git a/src/doc.c b/src/doc.c
index 82df9134f61..f306caed36a 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA. */
24 24
25#include <sys/types.h> 25#include <sys/types.h>
26#include <sys/file.h> /* Must be after sys/types.h for USG and BSD4_1*/ 26#include <sys/file.h> /* Must be after sys/types.h for USG and BSD4_1*/
27#include <ctype.h>
27 28
28#ifdef HAVE_FCNTL_H 29#ifdef HAVE_FCNTL_H
29#include <fcntl.h> 30#include <fcntl.h>
@@ -51,6 +52,9 @@ Lisp_Object Vdoc_file_name;
51 52
52Lisp_Object Qfunction_documentation; 53Lisp_Object Qfunction_documentation;
53 54
55/* A list of files used to build this Emacs binary. */
56static Lisp_Object Vbuild_files;
57
54extern Lisp_Object Voverriding_local_map; 58extern Lisp_Object Voverriding_local_map;
55 59
56/* For VMS versions with limited file name syntax, 60/* For VMS versions with limited file name syntax,
@@ -581,6 +585,7 @@ the same file name is found in the `doc-directory'. */)
581 register char *p, *end; 585 register char *p, *end;
582 Lisp_Object sym; 586 Lisp_Object sym;
583 char *name; 587 char *name;
588 int skip_file = 0;
584 589
585 CHECK_STRING (filename); 590 CHECK_STRING (filename);
586 591
@@ -618,6 +623,54 @@ the same file name is found in the `doc-directory'. */)
618#endif /* VMS4_4 */ 623#endif /* VMS4_4 */
619#endif /* VMS */ 624#endif /* VMS */
620 625
626 /* Vbuild_files is nil when temacs is run, and non-nil after that. */
627 if (NILP (Vbuild_files))
628 {
629 size_t cp_size = 0;
630 size_t to_read;
631 int nr_read;
632 char *cp = NULL;
633 char *beg, *end;
634
635 fd = emacs_open ("buildobj.lst", O_RDONLY, 0);
636 if (fd < 0)
637 report_file_error ("Opening file buildobj.lst", Qnil);
638
639 filled = 0;
640 for (;;)
641 {
642 cp_size += 1024;
643 to_read = cp_size - 1 - filled;
644 cp = xrealloc (cp, cp_size);
645 nr_read = emacs_read (fd, &cp[filled], to_read);
646 filled += nr_read;
647 if (nr_read < to_read)
648 break;
649 }
650
651 emacs_close (fd);
652 cp[filled] = 0;
653
654 for (beg = cp; *beg; beg = end)
655 {
656 int len;
657
658 while (*beg && isspace (*beg)) ++beg;
659
660 for (end = beg; *end && ! isspace (*end); ++end)
661 if (*end == '/') beg = end+1; /* skip directory part */
662
663 len = end - beg;
664 if (len > 4 && end[-4] == '.' && end[-3] == 'o')
665 len -= 2; /* Just take .o if it ends in .obj */
666
667 if (len > 0)
668 Vbuild_files = Fcons (make_string (beg, len), Vbuild_files);
669 }
670
671 xfree (cp);
672 }
673
621 fd = emacs_open (name, O_RDONLY, 0); 674 fd = emacs_open (name, O_RDONLY, 0);
622 if (fd < 0) 675 if (fd < 0)
623 report_file_error ("Opening doc string file", 676 report_file_error ("Opening doc string file",
@@ -640,10 +693,28 @@ the same file name is found in the `doc-directory'. */)
640 if (p != end) 693 if (p != end)
641 { 694 {
642 end = (char *) index (p, '\n'); 695 end = (char *) index (p, '\n');
696
697 /* See if this is a file name, and if it is a file in build-files. */
698 if (p[1] == 'S' && end - p > 4 && end[-2] == '.'
699 && (end[-1] == 'o' || end[-1] == 'c'))
700 {
701 int len = end - p - 2;
702 char *fromfile = alloca (len + 1);
703 strncpy (fromfile, &p[2], len);
704 fromfile[len] = 0;
705 if (fromfile[len-1] == 'c')
706 fromfile[len-1] = 'o';
707
708 if (EQ (Fmember (build_string (fromfile), Vbuild_files), Qnil))
709 skip_file = 1;
710 else
711 skip_file = 0;
712 }
713
643 sym = oblookup (Vobarray, p + 2, 714 sym = oblookup (Vobarray, p + 2,
644 multibyte_chars_in_text (p + 2, end - p - 2), 715 multibyte_chars_in_text (p + 2, end - p - 2),
645 end - p - 2); 716 end - p - 2);
646 if (SYMBOLP (sym)) 717 if (! skip_file && SYMBOLP (sym))
647 { 718 {
648 /* Attach a docstring to a variable? */ 719 /* Attach a docstring to a variable? */
649 if (p[1] == 'V') 720 if (p[1] == 'V')
@@ -756,7 +827,6 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
756 } 827 }
757 else if (strp[0] == '\\' && strp[1] == '[') 828 else if (strp[0] == '\\' && strp[1] == '[')
758 { 829 {
759 Lisp_Object firstkey;
760 int start_idx; 830 int start_idx;
761 831
762 changed = 1; 832 changed = 1;
@@ -919,6 +989,10 @@ syms_of_doc ()
919 doc: /* Name of file containing documentation strings of built-in symbols. */); 989 doc: /* Name of file containing documentation strings of built-in symbols. */);
920 Vdoc_file_name = Qnil; 990 Vdoc_file_name = Qnil;
921 991
992 DEFVAR_LISP ("build-files", &Vbuild_files,
993 doc: /* A list of files used to build this Emacs binary. */);
994 Vbuild_files = Qnil;
995
922 defsubr (&Sdocumentation); 996 defsubr (&Sdocumentation);
923 defsubr (&Sdocumentation_property); 997 defsubr (&Sdocumentation_property);
924 defsubr (&Ssnarf_documentation); 998 defsubr (&Ssnarf_documentation);