/[emacs]/emacs/src/doc.c
ViewVC logotype

Diff of /emacs/src/doc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.101.2.7 by miles, Fri Oct 22 10:13:37 2004 UTC revision 1.101.2.8 by miles, Fri Nov 12 02:52:59 2004 UTC
# Line 24  Boston, MA 02111-1307, USA.  */ Line 24  Boston, MA 02111-1307, USA.  */
24    
25  #include <sys/types.h>  #include <sys/types.h>
26  #include <sys/file.h>   /* Must be after sys/types.h for USG and BSD4_1*/  #include <sys/file.h>   /* Must be after sys/types.h for USG and BSD4_1*/
27    #include <ctype.h>
28    
29  #ifdef HAVE_FCNTL_H  #ifdef HAVE_FCNTL_H
30  #include <fcntl.h>  #include <fcntl.h>
# Line 51  Lisp_Object Vdoc_file_name; Line 52  Lisp_Object Vdoc_file_name;
52    
53  Lisp_Object Qfunction_documentation;  Lisp_Object Qfunction_documentation;
54    
55    /* A list of files used to build this Emacs binary.  */
56    static Lisp_Object Vbuild_files;
57    
58  extern Lisp_Object Voverriding_local_map;  extern Lisp_Object Voverriding_local_map;
59    
60  /* For VMS versions with limited file name syntax,  /* For VMS versions with limited file name syntax,
# Line 581  the same file name is found in the `doc- Line 585  the same file name is found in the `doc-
585    register char *p, *end;    register char *p, *end;
586    Lisp_Object sym;    Lisp_Object sym;
587    char *name;    char *name;
588      int skip_file = 0;
589    
590    CHECK_STRING (filename);    CHECK_STRING (filename);
591    
# Line 618  the same file name is found in the `doc- Line 623  the same file name is found in the `doc-
623  #endif /* VMS4_4 */  #endif /* VMS4_4 */
624  #endif /* VMS */  #endif /* VMS */
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    
674    fd = emacs_open (name, O_RDONLY, 0);    fd = emacs_open (name, O_RDONLY, 0);
675    if (fd < 0)    if (fd < 0)
676      report_file_error ("Opening doc string file",      report_file_error ("Opening doc string file",
# Line 640  the same file name is found in the `doc- Line 693  the same file name is found in the `doc-
693        if (p != end)        if (p != end)
694          {          {
695            end = (char *) index (p, '\n');            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    
714            sym = oblookup (Vobarray, p + 2,            sym = oblookup (Vobarray, p + 2,
715                            multibyte_chars_in_text (p + 2, end - p - 2),                            multibyte_chars_in_text (p + 2, end - p - 2),
716                            end - p - 2);                            end - p - 2);
717            if (SYMBOLP (sym))            if (! skip_file && SYMBOLP (sym))
718              {              {
719                /* Attach a docstring to a variable?  */                /* Attach a docstring to a variable?  */
720                if (p[1] == 'V')                if (p[1] == 'V')
# Line 756  thus, \\=\\=\\=\\= puts \\=\\= into the Line 827  thus, \\=\\=\\=\\= puts \\=\\= into the
827          }          }
828        else if (strp[0] == '\\' && strp[1] == '[')        else if (strp[0] == '\\' && strp[1] == '[')
829          {          {
           Lisp_Object firstkey;  
830            int start_idx;            int start_idx;
831    
832            changed = 1;            changed = 1;
# Line 919  syms_of_doc () Line 989  syms_of_doc ()
989                 doc: /* Name of file containing documentation strings of built-in symbols.  */);                 doc: /* Name of file containing documentation strings of built-in symbols.  */);
990    Vdoc_file_name = Qnil;    Vdoc_file_name = Qnil;
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    
996    defsubr (&Sdocumentation);    defsubr (&Sdocumentation);
997    defsubr (&Sdocumentation_property);    defsubr (&Sdocumentation_property);
998    defsubr (&Ssnarf_documentation);    defsubr (&Ssnarf_documentation);

Legend:
Removed from v.1.101.2.7  
changed lines
  Added in v.1.101.2.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26