diff options
| author | Miles Bader | 2004-11-12 02:53:04 +0000 |
|---|---|---|
| committer | Miles Bader | 2004-11-12 02:53:04 +0000 |
| commit | 8b7e837d9c3266e775142a4865845b3d2a8b60aa (patch) | |
| tree | d1468612ab319b665728b9ebf94dbc0c0d4c20fc /src/doc.c | |
| parent | d1a3e560ff62e047d9fa8e8b3b1bc1e56e104c26 (diff) | |
| parent | e22c7647c7ff33c846132f3d2877ac436b8b47e6 (diff) | |
| download | emacs-8b7e837d9c3266e775142a4865845b3d2a8b60aa.tar.gz emacs-8b7e837d9c3266e775142a4865845b3d2a8b60aa.zip | |
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-70
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-669
- 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
- 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
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-691
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
- miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-71
Update from CVS
Diffstat (limited to 'src/doc.c')
| -rw-r--r-- | src/doc.c | 78 |
1 files changed, 76 insertions, 2 deletions
| @@ -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 | ||
| 52 | Lisp_Object Qfunction_documentation; | 53 | Lisp_Object Qfunction_documentation; |
| 53 | 54 | ||
| 55 | /* A list of files used to build this Emacs binary. */ | ||
| 56 | static Lisp_Object Vbuild_files; | ||
| 57 | |||
| 54 | extern Lisp_Object Voverriding_local_map; | 58 | extern 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); |