unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jan D." <jan.h.d@swipnet.se>
Cc: emacs-devel@gnu.org
Subject: Re: DOC for Mac OS shown for Emacs compiled for X.
Date: Mon, 01 Nov 2004 09:47:29 +0100	[thread overview]
Message-ID: <4185F821.10703@swipnet.se> (raw)
In-Reply-To: <E1COWXX-0001cm-QD@fencepost.gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1661 bytes --]

Richard Stallman wrote:
>     Then we need to include symbols from all w32 files also.
> 
> To make it fully platform-independent, that is necessary.
> 
> 							      But the patch 
>     doesn't make the DOC file dependent on platform, it just makes the 
>     Emacs binary selective of what it reads from it.
> 
> I did not realize that.  In that case, I take back what I said.
> However, what does the patch do?  There is nothing in the DOC file
> that says what file each doc string was read from.

The ^_S markers in the DOC file shows the file from where the following 
doc-strings came from.  They where introduced on April 7, (revision 1.57 of 
lib-src/make-docfile.c), presumably to support the link when a 
function/variable is "defined in C source file".

The patch has been somewhat updated since I posted it last, so I add it again. 
  Here what it does:

1. When temacs is linked, output the object file names used to link it to 
buildobj.lst.
2. A new variable Vbuild_files is declared in doc.c, initialize to nil.
3. When temacs is run, Snarf_documentation checks if Vbuild_files is nil, and 
if it is, reads buildobj.lst and inserts the file names into Vbuild_files as a 
list.
4. When looking for pointers to doc strings, Snarf_documentation skips strings 
that belongs to a file not in Vbuild_list.
5. The function in help-fns.el that finds C files also skips files not in 
build-files.

The patch still does not work on W32/msdos, because from what I understand the 
file names in DOC for those platforms are the .c files, not the .o files.  Plus 
the fact that the buildobj.lst file would contain .obj extensions instead of .o.

	Jan D.



[-- Attachment #2: doc-diff --]
[-- Type: text/plain, Size: 5671 bytes --]

diff -c src/Makefile.in.~1.303.~ src/Makefile.in
Index: src/Makefile.in
*** src/Makefile.in.~1.303.~	2004-10-20 17:44:02.000000000 +0200
--- src/Makefile.in	2004-10-30 19:46:52.000000000 +0200
***************
*** 943,949 ****
  #define MAKE_PARALLEL
  #endif
  
! temacs${EXEEXT}: MAKE_PARALLEL $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} OBJECTS_MACHINE prefix-args${EXEEXT}
  	$(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \
      -o temacs ${STARTFILES} ${obj} ${otherobj}  \
      OBJECTS_MACHINE ${LIBES}
--- 943,950 ----
  #define MAKE_PARALLEL
  #endif
  
! temacs${EXEEXT}: MAKE_PARALLEL $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} OBJECTS_MACHINE prefix-args${EXEEXT} buildobj.lst
! 	echo "${obj} ${otherobj} " OBJECTS_MACHINE > buildobj.lst
  	$(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \
      -o temacs ${STARTFILES} ${obj} ${otherobj}  \
      OBJECTS_MACHINE ${LIBES}
***************
*** 1272,1277 ****
--- 1273,1279 ----
  	rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a
  	rm -f ../etc/DOC
  	rm -f bootstrap-emacs${EXEEXT}
+ 	rm -f buildobj.lst
  clean: mostlyclean
  	rm -f emacs-*${EXEEXT} emacs${EXEEXT}
  /**/# This is used in making a distribution.
diff -c src/doc.c.~1.108.~ src/doc.c
Index: src/doc.c
*** src/doc.c.~1.108.~	2004-10-28 22:22:33.000000000 +0200
--- src/doc.c	2004-10-30 19:25:02.000000000 +0200
***************
*** 51,56 ****
--- 51,59 ----
  
  Lisp_Object Qfunction_documentation;
  
+ /* A list of files used to build this Emacs binary.  */
+ static Lisp_Object Vbuild_files;
+ 
  extern Lisp_Object Voverriding_local_map;
  
  /* For VMS versions with limited file name syntax,
***************
*** 581,586 ****
--- 584,590 ----
    register char *p, *end;
    Lisp_Object sym;
    char *name;
+   int skip_file = 0;
  
    CHECK_STRING (filename);
  
***************
*** 617,622 ****
--- 621,657 ----
    strcpy (name, sys_translate_unix (name));
  #endif /* VMS4_4 */
  #endif /* VMS */
+   
+   if (NILP (Vbuild_files))
+   {
+     size_t cp_size = 0;
+     size_t to_read;
+     int nr_read;
+     char *cp = NULL;
+ 
+     fd = emacs_open ("buildobj.lst", O_RDONLY, 0);
+     if (fd < 0)
+       report_file_error ("Opening file buildobj.lst", Qnil);
+ 
+     filled = 0;
+     for (;;)
+       {
+         cp_size += 1024;
+         to_read = cp_size - 1 - filled;
+         cp = xrealloc (cp, cp_size);
+         nr_read = emacs_read (fd, &cp[filled], to_read);
+         filled += nr_read;
+         if (nr_read < to_read)
+           break;
+       }
+ 
+     cp[filled] = 0;
+ 
+     Vbuild_files = Feval (Fcons (intern ("split-string"),
+                                  Fcons (build_string (cp), Qnil)));
+     emacs_close (fd);
+     xfree (cp);
+   }
  
    fd = emacs_open (name, O_RDONLY, 0);
    if (fd < 0)
***************
*** 640,649 ****
        if (p != end)
  	{
  	  end = (char *) index (p, '\n');
  	  sym = oblookup (Vobarray, p + 2,
  			  multibyte_chars_in_text (p + 2, end - p - 2),
  			  end - p - 2);
! 	  if (SYMBOLP (sym))
  	    {
  	      /* Attach a docstring to a variable?  */
  	      if (p[1] == 'V')
--- 675,699 ----
        if (p != end)
  	{
  	  end = (char *) index (p, '\n');
+ 
+           /* See if this is a file name, and if it is a file in build-files.  */
+           if (p[1] == 'S' && end - p > 4 && end[-2] == '.' && end[-1] == 'o')
+             {
+               int len = end - p - 2;
+               char *fromfile = alloca (len + 1);
+               strncpy (fromfile, &p[2], len);
+               fromfile[len] = 0;
+ 
+               if (EQ (Fmember (build_string (fromfile), Vbuild_files), Qnil))
+                 skip_file = 1;
+               else
+                 skip_file = 0;
+             }
+ 
  	  sym = oblookup (Vobarray, p + 2,
  			  multibyte_chars_in_text (p + 2, end - p - 2),
  			  end - p - 2);
! 	  if (! skip_file && SYMBOLP (sym))
  	    {
  	      /* Attach a docstring to a variable?  */
  	      if (p[1] == 'V')
***************
*** 919,924 ****
--- 969,978 ----
  	       doc: /* Name of file containing documentation strings of built-in symbols.  */);
    Vdoc_file_name = Qnil;
  
+   DEFVAR_LISP ("build-files", &Vbuild_files,
+                doc: /* A list of files used to build this Emacs binary.  */);
+   Vbuild_files = Qnil;
+ 
    defsubr (&Sdocumentation);
    defsubr (&Sdocumentation_property);
    defsubr (&Ssnarf_documentation);
diff -c lisp/help-fns.el.~1.57.~ lisp/help-fns.el
Index: lisp/help-fns.el
*** lisp/help-fns.el.~1.57.~	2004-11-01 09:25:38.000000000 +0100
--- lisp/help-fns.el	2004-11-01 09:21:49.000000000 +0100
***************
*** 228,236 ****
        (if (eobp)
  	  (insert-file-contents-literally
  	   (expand-file-name internal-doc-file-name doc-directory)))
!       (search-forward (concat "\x1f" name "\n"))
!       (re-search-backward "\x1fS\\(.*\\)")
!       (let ((file (match-string 1)))
  	(if (string-match "\\.\\(o\\|obj\\)\\'" file)
  	    (setq file (replace-match ".c" t t file)))
  	(if (string-match "\\.c\\'" file)
--- 228,241 ----
        (if (eobp)
  	  (insert-file-contents-literally
  	   (expand-file-name internal-doc-file-name doc-directory)))
!       (let ((file (catch 'loop
! 		    (while t
! 		      (let ((pnt (search-forward (concat "\x1f" name "\n"))))
! 			(re-search-backward "\x1fS\\(.*\\)")
! 			(let ((file (match-string 1)))
! 			  (if (member file build-files)
! 			      (throw 'loop file)
! 			    (goto-char pnt))))))))
  	(if (string-match "\\.\\(o\\|obj\\)\\'" file)
  	    (setq file (replace-match ".c" t t file)))
  	(if (string-match "\\.c\\'" file)

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2004-11-01  8:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-27  9:09 DOC for Mac OS shown for Emacs compiled for X Jan D.
2004-10-27  9:46 ` Andreas Schwab
2004-10-28  7:26   ` Jan D.
2004-10-28  9:47     ` Andreas Schwab
2004-10-28 13:16       ` Jan D.
2004-10-28 13:57         ` Andreas Schwab
2004-10-28 19:56         ` Stefan
2004-10-29  8:00           ` Jan D.
2004-10-29 20:37             ` Stefan
2004-10-29 21:16               ` Jan D.
2004-10-29 21:48                 ` Stefan
2004-10-30  5:43                   ` Jan D.
2004-10-30 16:32                     ` Stefan
2004-10-30 17:43                       ` Jan D.
2004-10-30 21:59                     ` Kim F. Storm
2004-10-30 14:20                 ` Richard Stallman
2004-10-30 14:19             ` Richard Stallman
2004-10-30 14:39               ` Jan D.
2004-11-01  7:23                 ` Richard Stallman
2004-11-01  8:47                   ` Jan D. [this message]
2004-11-02 14:08                     ` Richard Stallman
2004-10-28  6:24 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4185F821.10703@swipnet.se \
    --to=jan.h.d@swipnet.se \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).