From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Jan D." Newsgroups: gmane.emacs.devel Subject: Re: DOC for Mac OS shown for Emacs compiled for X. Date: Mon, 01 Nov 2004 09:47:29 +0100 Message-ID: <4185F821.10703@swipnet.se> References: <20041029080140.SPWE44.mxfep02.bredband.com@coolsville.localdomain> <8B99E438-2A81-11D9-A454-000D93505B76@swipnet.se> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030009040708070501070403" X-Trace: sea.gmane.org 1099298919 26082 80.91.229.6 (1 Nov 2004 08:48:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 1 Nov 2004 08:48:39 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 01 09:48:29 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1COXrZ-00054C-00 for ; Mon, 01 Nov 2004 09:48:29 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1COXzY-0005kk-Ei for ged-emacs-devel@m.gmane.org; Mon, 01 Nov 2004 03:56:44 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1COXzH-0005kf-SG for emacs-devel@gnu.org; Mon, 01 Nov 2004 03:56:28 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1COXzG-0005kS-Id for emacs-devel@gnu.org; Mon, 01 Nov 2004 03:56:26 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1COXzG-0005kN-FZ for emacs-devel@gnu.org; Mon, 01 Nov 2004 03:56:26 -0500 Original-Received: from [195.54.107.70] (helo=mxfep01.bredband.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1COXqy-0001am-Lg; Mon, 01 Nov 2004 03:47:53 -0500 Original-Received: from coolsville.localdomain ([83.226.180.220] [83.226.180.220]) by mxfep01.bredband.com with ESMTP id <20041101084751.GVIV4883.mxfep01.bredband.com@coolsville.localdomain>; Mon, 1 Nov 2004 09:47:51 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040916 X-Accept-Language: en-us, en Original-To: rms@gnu.org In-Reply-To: X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:29263 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:29263 This is a multi-part message in MIME format. --------------030009040708070501070403 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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. --------------030009040708070501070403 Content-Type: text/plain; name="doc-diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="doc-diff" 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 "" name "\n")) ! (re-search-backward "S\\(.*\\)") ! (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 "" name "\n")))) ! (re-search-backward "S\\(.*\\)") ! (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) --------------030009040708070501070403 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --------------030009040708070501070403--