From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Newsgroups: gmane.comp.tex.texinfo.bugs,gmane.lisp.guile.devel Subject: Re: makeinfo swallows page breaks Date: Thu, 21 Mar 2013 19:25:59 +0100 Message-ID: <87boacboeg.fsf@gnu.org> References: <8738vpirz4.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1363890379 29704 80.91.229.3 (21 Mar 2013 18:26:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 21 Mar 2013 18:26:19 +0000 (UTC) Cc: bug-texinfo@gnu.org To: guile-devel@gnu.org Original-X-From: bug-texinfo-bounces+gnu-bug-texinfo2=m.gmane.org@gnu.org Thu Mar 21 19:26:45 2013 Return-path: Envelope-to: gnu-bug-texinfo2@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UIkCI-0005cA-6C for gnu-bug-texinfo2@m.gmane.org; Thu, 21 Mar 2013 19:26:42 +0100 Original-Received: from localhost ([::1]:56530 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIkBu-0005J4-PZ for gnu-bug-texinfo2@m.gmane.org; Thu, 21 Mar 2013 14:26:18 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35970) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIkBr-0005Fe-5h for bug-texinfo@gnu.org; Thu, 21 Mar 2013 14:26:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIkBn-0000o2-0E for bug-texinfo@gnu.org; Thu, 21 Mar 2013 14:26:15 -0400 Original-Received: from [2a01:e0b:1:123:ca0a:a9ff:fe03:271e] (port=50608 helo=xanadu.aquilenet.fr) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIkBm-0000lH-ME; Thu, 21 Mar 2013 14:26:10 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by xanadu.aquilenet.fr (Postfix) with ESMTP id A06C8CD8B; Thu, 21 Mar 2013 19:26:01 +0100 (CET) Original-Received: from xanadu.aquilenet.fr ([127.0.0.1]) by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pPZIQYorzxLq; Thu, 21 Mar 2013 19:26:01 +0100 (CET) Original-Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) by xanadu.aquilenet.fr (Postfix) with ESMTPSA id 86E89CC87; Thu, 21 Mar 2013 19:26:00 +0100 (CET) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 1 Germinal an 221 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu In-Reply-To: <8738vpirz4.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Thu, 21 Mar 2013 00:14:39 +0100") User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2a01:e0b:1:123:ca0a:a9ff:fe03:271e X-BeenThere: bug-texinfo@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Texinfo documentation system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-texinfo-bounces+gnu-bug-texinfo2=m.gmane.org@gnu.org Original-Sender: bug-texinfo-bounces+gnu-bug-texinfo2=m.gmane.org@gnu.org Xref: news.gmane.org gmane.comp.tex.texinfo.bugs:6255 gmane.lisp.guile.devel:15958 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable ludo@gnu.org (Ludovic Court=C3=A8s) skribis: > Alternately, would you suggest using a different approach? Attached is a patch to use Guile=E2=80=99s Texinfo support [0] to build said file. Guile=E2=80=99s Texinfo parser is incomplete but sufficient to handle those docstrings. It solves an actual bug for anyone using Texinfo 5.x. It also seems to be the most profitable solution for us Guile hackers in the long run. And, it=E2=80=99s much faster: makeinfo 4.13 takes 0.1s makeinfo 5.1 takes 11.7s Guile takes 1.3s OK to commit? Thanks, Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Build-guile-procedures.txt-using-texinfo-instead-of-.patch Content-Description: the patch >From 84b2457ed9fdf866a354465c67e282f8fbb30eb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 21 Mar 2013 19:17:13 +0100 Subject: [PATCH] Build `guile-procedures.txt' using (texinfo) instead of `makeinfo'. * Makefile.am (schemelibdir, schemelib_DATA): New variables. (libguile/guile-procedures.txt): New target. (EXTRA_DIST): Add libguile/texi-fragments-to-docstrings. * libguile/Makefile.am (guile-procedures.txt): Remove target. (schemelibdir, schemelib_DATA): Remove. * libguile/texi-fragments-to-docstrings: New file. --- Makefile.am | 17 ++++++++-- libguile/Makefile.am | 16 ---------- libguile/texi-fragments-to-docstrings | 55 +++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 18 deletions(-) create mode 100644 libguile/texi-fragments-to-docstrings diff --git a/Makefile.am b/Makefile.am index 3aa5ddd..737897b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ ## Process this file with automake to produce Makefile.in. ## ## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2006, 2007, -## 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. +## 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. ## ## This file is part of GUILE. ## @@ -42,6 +42,18 @@ SUBDIRS = \ libguileincludedir = $(pkgincludedir)/$(GUILE_EFFECTIVE_VERSION) libguileinclude_HEADERS = libguile.h +schemelibdir = $(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION) +schemelib_DATA = libguile/guile-procedures.txt + +# Build it from here so that all the modules are compiled by the time we +# build it. +libguile/guile-procedures.txt: libguile/guile-procedures.texi + $(AM_V_GEN) \ + $(top_builddir)/meta/guile --no-auto-compile \ + "$(srcdir)/libguile/texi-fragments-to-docstrings" \ + "$(builddir)/libguile/guile-procedures.texi" \ + > libguile/guile-procedures.txt + EXTRA_DIST = LICENSE HACKING GUILE-VERSION \ m4/ChangeLog-2008 \ m4/gnulib-cache.m4 \ @@ -50,7 +62,8 @@ EXTRA_DIST = LICENSE HACKING GUILE-VERSION \ gnulib-local/lib/localcharset.h.diff \ gnulib-local/lib/localcharset.c.diff \ gnulib-local/m4/clock_time.m4.diff \ - gnulib-local/build-aux/git-version-gen.diff + gnulib-local/build-aux/git-version-gen.diff \ + libguile/texi-fragments-to-docstrings TESTS = check-guile TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ diff --git a/libguile/Makefile.am b/libguile/Makefile.am index d77bdfe..450d955 100644 --- a/libguile/Makefile.am +++ b/libguile/Makefile.am @@ -713,25 +713,9 @@ guile.texi: $(alldotdocfiles) guile$(EXEEXT) guile-procedures.texi: $(alldotdocfiles) guile$(EXEEXT) $(AM_V_GEN)$(dotdoc2texi) > $@ || { rm $@; false; } -if HAVE_MAKEINFO - -guile-procedures.txt: guile-procedures.texi - rm -f $@ - makeinfo --force -o $@ guile-procedures.texi || test -f $@ - -else - -guile-procedures.txt: guile-procedures.texi - cp guile-procedures.texi $@ - -endif - c-tokenize.c: c-tokenize.lex flex -t $(srcdir)/c-tokenize.lex > $@ || { rm $@; false; } -schemelibdir = $(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION) -schemelib_DATA = guile-procedures.txt - ## Add -MG to make the .x magic work with auto-dep code. MKDEP = gcc -M -MG $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) diff --git a/libguile/texi-fragments-to-docstrings b/libguile/texi-fragments-to-docstrings new file mode 100644 index 0000000..b72390b --- /dev/null +++ b/libguile/texi-fragments-to-docstrings @@ -0,0 +1,55 @@ +;;; -*- mode: scheme; coding: utf-8; -*- +;;; +;;; Copyright (C) 2013 Free Software Foundation, Inc. +;;; +;;; This library is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU Lesser General Public +;;; License as published by the Free Software Foundation; either +;;; version 3 of the License, or (at your option) any later version. +;;; +;;; This library is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; Lesser General Public License for more details. +;;; +;;; You should have received a copy of the GNU Lesser General Public +;;; License along with this library; if not, write to the Free Software +;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + +;;; +;;; Read Texinfo fragments from stdin (docstrings of Guile's primitives +;;; in the format of `guile-procedures.texi'), and write to stdout a +;;; textual rendering thereof. The output preserves page breaks (^L) +;;; found in the input, as per the Guile Documentation Format +;;; version 2---see (ice-9 documentation). +;;; + +(use-modules (texinfo) + (texinfo plain-text) + (srfi srfi-1) + (ice-9 match) + (rnrs io ports)) + +(define (docstring-fragments->strings str) + "Return the list resulting from the split of STR at each page +break (^L)" + (string-tokenize str (char-set-complement (char-set #\page)))) + +(match (command-line) + ((_ texi-file) + (let* ((fragments (remove (compose string-null? string-trim-both) + (call-with-input-file texi-file + (compose docstring-fragments->strings + get-string-all)))) + (stexi (map texi-fragment->stexi fragments))) + (format #t "Produced by GNU Guile ~a from `~a'.~%~%" + (version) texi-file) + (for-each (lambda (stexi) + (display #\page) + (display (stexi->plain-text stexi))) + stexi))) + ((command args ...) + (format (current-error-port) "invalid arguments: ~s~%" args) + (format (current-error-port) "Usage: ~a TEXINFO-FILE~%" command) + (exit 1))) -- 1.7.10.4 --=-=-=--