* texi2mdoc @ 2015-02-23 15:31 Kristaps Dzonsons 2015-02-23 16:56 ` texi2mdoc Svyatoslav Mishyn 0 siblings, 1 reply; 8+ messages in thread From: Kristaps Dzonsons @ 2015-02-23 15:31 UTC (permalink / raw) To: discuss Hi folks! In case any of you work with (or need to deal with) Texinfo manuals, you may be interested in a new sub-project of mdocml.bsd.lv, texi2mdoc. http://mdocml.bsd.lv/texi2mdoc In brief, I started this because if there's anything more I dislike using than a browser for documentation, it's info(1). With texi2mdoc, not only can I easily format these pages in a familiar way, the contents can also be sucked into mdocml's apropos. In general, texinfo tries to handle anything you can give it, only exiting if things really go wrong. In fact, the only thing it exits on in the significant real-world corpus of manuals I can find (GNU, GSL, TeXlive, etc.) is an instance of a multiline table cell. I format tables using TS/TE, so I'm not sure how to handle this yet. (There's also one or two absolute paths in included files, all of which seem to be generated at configure time.) Of course there's work to be done. For instance, some of the accent marks seem unsupported right now, and there are still commands that I'm not properly ignoring. And some that I'm ignoring that I shouldn't, like footnotes and so on. The code is pretty straightforward to work with and add to... just sayin'... Anyway, it is a start, and quite usable. The generated mdoc(7) will still emit lots of warnings, 99% of which are due to superfluous .Pp's. I think that'll be a small fix to edge in, though. Best, Kristaps -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: texi2mdoc 2015-02-23 15:31 texi2mdoc Kristaps Dzonsons @ 2015-02-23 16:56 ` Svyatoslav Mishyn 2015-02-23 17:31 ` texi2mdoc Kristaps Dzonsons 0 siblings, 1 reply; 8+ messages in thread From: Svyatoslav Mishyn @ 2015-02-23 16:56 UTC (permalink / raw) To: discuss (Mon, 23 Feb 16:31) Kristaps Dzonsons: > Hi folks! > Hello, /home/juef/dl/texi2mdoc-0.1.1: make cc -g -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings -c -o main.o main.c main.c: In function 'domacro': main.c:486:2: warning: implicit declaration of function 'memmem' [-Wimplicit-function-declaration] blk = memmem(&buf[start], sz, endtok, endtoksz); ^ main.c:486:6: warning: assignment makes pointer from integer without a cast [enabled by default] blk = memmem(&buf[start], sz, endtok, endtoksz); ^ main.c: In function 'doignblock': main.c:533:7: warning: assignment makes pointer from integer without a cast [enabled by default] term = memmem(&buf[*pos], sz, end, endsz); ^ main.c: In function 'doverbatim': main.c:665:7: warning: assignment makes pointer from integer without a cast [enabled by default] term = memmem(&buf[*pos], sz, end, endsz); ^ cc -g -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings -c -o util.o util.c util.c: In function 'texiexecmacro': util.c:497:3: warning: implicit declaration of function 'strlcat' [-Wimplicit-function-declaration] j = strlcat(val, args[k], valsz + 1); ^ cc -o texi2mdoc main.o util.o util.o: In function `texiexecmacro': /home/juef/dl/texi2mdoc-0.1.1/util.c:497: undefined reference to `strlcat' collect2: error: ld returned 1 exit status Makefile:15: recipe for target 'texi2mdoc' failed make: *** [texi2mdoc] Error 1 os: gnu/linux btw: http://mdocml.bsd.lv/texi2mdoc/snapshots/ - 403 Forbidden -- http://www.juef.tk/ -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: texi2mdoc 2015-02-23 16:56 ` texi2mdoc Svyatoslav Mishyn @ 2015-02-23 17:31 ` Kristaps Dzonsons 2015-02-23 18:13 ` texi2mdoc Ingo Schwarze 2015-02-23 18:17 ` texi2mdoc Svyatoslav Mishyn 0 siblings, 2 replies; 8+ messages in thread From: Kristaps Dzonsons @ 2015-02-23 17:31 UTC (permalink / raw) To: discuss [-- Attachment #1: Type: text/plain, Size: 615 bytes --] Sviatoslav, Oh Linux... not only does it not have strlcat(3) (replaced with a simple string copy) or memmem(3) (found with _GNU_SOURCE), but the dirname(3) is all weird. Does the enclosed patch (against the website version) fix all this for you? (There are another two nits fixed in this, as my Linux box has GMP against which I could test...) Thanks for testing it out! As for the 403... Ingo, the httpd.conf defines "/snapshots/" as accepting directory listings. Should texi2mdoc (and, as I'm seeing, pod2mdoc and docbook2mdoc) also have their snap directories also accept listings? Best, Kristaps [-- Attachment #2: linux.patch --] [-- Type: text/plain, Size: 3757 bytes --] ? build ? config.texi ? examples ? files.txt ? files2.txt ? gcc-vers.texi ? gdb-cfg.texi ? intdoc.texi ? linux.patch ? out ? texi2mdoc ? texi2mdoc.dSYM ? afl/dict ? afl/out Index: main.c =================================================================== RCS file: /home/cvs/mdocml/texi2mdoc/main.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -p -r1.36 -r1.37 --- main.c 23 Feb 2015 15:23:44 -0000 1.36 +++ main.c 23 Feb 2015 17:24:51 -0000 1.37 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.36 2015/02/23 15:23:44 kristaps Exp $ */ +/* $Id: main.c,v 1.37 2015/02/23 17:24:51 kristaps Exp $ */ /* * Copyright (c) 2015 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -14,6 +14,9 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#if defined(__linux__) || defined(__MINT__) +# define _GNU_SOURCE /* memmem */ +#endif #include <sys/mman.h> #include <sys/stat.h> @@ -1355,7 +1358,10 @@ dosp(struct texi *p, enum texicmd cmd, const char *buf, size_t sz, size_t *pos) { - texivspace(p); + if (p->literal) + texiputchar(p, '\n'); + else + texivspace(p); /* FIXME: ignore and parseeoln. */ advanceeoln(p, buf, sz, pos, 1); } @@ -1631,7 +1637,7 @@ main(int argc, char *argv[]) { struct texi texi; int c; - char *path, *dir; + char *dirpath, *dir, *ccp; const char *progname, *Idir, *cp; progname = strrchr(argv[0], '/'); @@ -1656,13 +1662,11 @@ main(int argc, char *argv[]) if (0 == (argc -= optind)) goto usage; - if (NULL == (path = strdup(argv[0]))) + if (NULL == (dirpath = strdup(argv[0]))) texiabort(&texi, NULL); - else if (NULL == (dir = dirname(path))) + if (NULL == (dir = dirname(dirpath))) texiabort(&texi, NULL); - free(path); - if (NULL != (cp = strrchr(argv[0], '/'))) texi.title = strdup(cp + 1); else @@ -1670,11 +1674,12 @@ main(int argc, char *argv[]) if (NULL == texi.title) texiabort(&texi, NULL); - else if (NULL != (path = strchr(texi.title, '.'))) - *path = '\0'; + else if (NULL != (ccp = strchr(texi.title, '.'))) + *ccp = '\0'; texi.ign = 1; texi.dirs = parsedirs(&texi, dir, Idir, &texi.dirsz); + free(dirpath); parsefile(&texi, argv[0], 1); /* We shouldn't get here. */ texiexit(&texi); Index: util.c =================================================================== RCS file: /home/cvs/mdocml/texi2mdoc/util.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -p -r1.10 -r1.11 --- util.c 23 Feb 2015 15:09:09 -0000 1.10 +++ util.c 23 Feb 2015 17:24:51 -0000 1.11 @@ -1,4 +1,4 @@ -/* $Id: util.c,v 1.10 2015/02/23 15:09:09 kristaps Exp $ */ +/* $Id: util.c,v 1.11 2015/02/23 17:24:51 kristaps Exp $ */ /* * Copyright (c) 2015 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -421,10 +421,11 @@ static void texiexecmacro(struct texi *p, struct teximacro *m, const char *buf, size_t sz, size_t *pos) { - size_t valsz, realsz, aasz, asz, - ssz, i, j, k, start, end; - char *val; - char **args; + size_t valsz, realsz, aasz, asz, + ssz, i, j, k, start, end; + char *val; + char **args; + const char *cp; args = argparse(p, buf, sz, pos, &asz, m->argsz); if (asz != m->argsz) @@ -494,7 +495,10 @@ texiexecmacro(struct texi *p, struct tex texiabort(p, NULL); } - j = strlcat(val, args[k], valsz + 1); + for (cp = args[k]; '\0' != *cp; cp++) + val[j++] = *cp; + + val[j] = '\0'; i = end; } @@ -1221,8 +1225,6 @@ argparse(struct texi *p, const char *buf /* Test for zero-length '{ }'. */ if (start == end && '}' == buf[*pos] && 0 == *argsz) break; - if (start == end) - texierr(p, "zero-length argument"); /* FIXME: use reallocarray. */ args = realloc (args, sizeof(char *) * ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: texi2mdoc 2015-02-23 17:31 ` texi2mdoc Kristaps Dzonsons @ 2015-02-23 18:13 ` Ingo Schwarze 2015-02-23 18:17 ` texi2mdoc Svyatoslav Mishyn 1 sibling, 0 replies; 8+ messages in thread From: Ingo Schwarze @ 2015-02-23 18:13 UTC (permalink / raw) To: discuss Hi Kristaps, Kristaps Dzonsons wrote on Mon, Feb 23, 2015 at 06:31:22PM +0100: > As for the 403... Ingo, the httpd.conf defines "/snapshots/" as accepting > directory listings. Should texi2mdoc (and, as I'm seeing, pod2mdoc and > docbook2mdoc) also have their snap directories also accept listings? Sure, done. I have also linked texi2mdoc and docbook2mdoc from the front page. Yours, Ingo -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: texi2mdoc 2015-02-23 17:31 ` texi2mdoc Kristaps Dzonsons 2015-02-23 18:13 ` texi2mdoc Ingo Schwarze @ 2015-02-23 18:17 ` Svyatoslav Mishyn 2015-02-25 15:17 ` texi2mdoc Kristaps Dzonsons 1 sibling, 1 reply; 8+ messages in thread From: Svyatoslav Mishyn @ 2015-02-23 18:17 UTC (permalink / raw) To: discuss (Mon, 23 Feb 18:31) Kristaps Dzonsons: > Sviatoslav, > > Oh Linux... not only does it not have strlcat(3) (replaced with a simple > string copy) or memmem(3) (found with _GNU_SOURCE), but the dirname(3) is > all weird. Does the enclosed patch (against the website version) fix all > this for you? Yes, it works ;) Thanks > (There are another two nits fixed in this, as my Linux box has GMP against > which I could test...) > > Thanks for testing it out! > > As for the 403... Ingo, the httpd.conf defines "/snapshots/" as accepting > directory listings. Should texi2mdoc (and, as I'm seeing, pod2mdoc and > docbook2mdoc) also have their snap directories also accept listings? > > Best, > > Kristaps -- http://www.juef.tk/ -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: texi2mdoc 2015-02-23 18:17 ` texi2mdoc Svyatoslav Mishyn @ 2015-02-25 15:17 ` Kristaps Dzonsons 2015-02-25 17:23 ` texi2mdoc Svyatoslav Mishyn 0 siblings, 1 reply; 8+ messages in thread From: Kristaps Dzonsons @ 2015-02-25 15:17 UTC (permalink / raw) To: discuss Hi, All of the raised concerns are part of the new release, 0.1.2. http://mdocml.bsd.lv/texi2mdoc This release focusses on macros, which now work in the same weird and mysterious way as stipulated (sometimes erroneously!) in the texinfo manual. I now splice macros and values directly into the input stream instead of independently parsing them. As usual, I regularly test now on the OpenBSD GNU manuals, GSL, texlive, GMP, the autotools suite, and so forth. They all look pretty good. Huge, but good. I now catch all of the macros in these pages except for some that seem to be errors in the documents, e.g., @sample{} instead of @samp{}. The mdoc output still isn't awesome in terms of overzelous `Pp', but mandoc is able to churn through the superfluousness so easily... Best, Kristaps -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: texi2mdoc 2015-02-25 15:17 ` texi2mdoc Kristaps Dzonsons @ 2015-02-25 17:23 ` Svyatoslav Mishyn 2015-02-25 19:50 ` texi2mdoc Kristaps Dzonsons 0 siblings, 1 reply; 8+ messages in thread From: Svyatoslav Mishyn @ 2015-02-25 17:23 UTC (permalink / raw) To: discuss (Wed, 25 Feb 16:17) Kristaps Dzonsons: > Hi, > > All of the raised concerns are part of the new release, 0.1.2. > > http://mdocml.bsd.lv/texi2mdoc > Hello, Now I'm experimenting to compile against musl [0] (via musl-gcc wrapper) :) texi2mdoc is interesting for me just because I still trying to learn C. and I like small and beautiful programs BTW: Why all files extracted from tarball read-only, not for example, -rw-rw-r-- ? /home/juef/dl/texi2mdoc-0.1.2: make CC=musl-gcc musl-gcc -g -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings -c -o main.o main.c In file included from main.c:32:0: extern.h:397:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void' void advance(struct texi *, size_t *); ^ main.c:35:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'static' static const char *const sects[SECTSZ] = { ^ main.c: In function 'dodefindex': main.c:352:3: warning: implicit declaration of function 'advance' [-Wimplicit-function-declaration] advance(p, pos); ^ main.c: In function 'dosubsubsection': main.c:1503:19: error: 'sects' undeclared (first use in this function) teximacroopen(p, sects[sec]); ^ main.c:1503:19: note: each undeclared identifier is reported only once for each function it appears in main.c:1497:7: warning: variable 'sec' set but not used [-Wunused-but-set-variable] int sec; ^ main.c: In function 'dosubsection': main.c:1517:45: error: 'sects' undeclared (first use in this function) texierr(p, "\"%s\" in open line scope!?", sects[sec]); ^ main.c: In function 'dosection': main.c:1564:45: error: 'sects' undeclared (first use in this function) texierr(p, "\"%s\" in open line scope!?", sects[sec]); ^ main.c:1544:8: warning: variable 'sec' set but not used [-Wunused-but-set-variable] int sec; ^ <builtin>: recipe for target 'main.o' failed make: *** [main.o] Error 1 [0]: http://www.musl-libc.org/ -- http://www.juef.tk/ -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: texi2mdoc 2015-02-25 17:23 ` texi2mdoc Svyatoslav Mishyn @ 2015-02-25 19:50 ` Kristaps Dzonsons 0 siblings, 0 replies; 8+ messages in thread From: Kristaps Dzonsons @ 2015-02-25 19:50 UTC (permalink / raw) To: discuss [-- Attachment #1: Type: text/plain, Size: 216 bytes --] Sviatoslav, The enclosed patch allows me to compile... % make CC=/usr/local/musl/bin/musl-gcc ...with a musl freshly cloned via git. I've already checked it into CVS. Thanks for reporting this! Best, Kristaps [-- Attachment #2: musl.patch --] [-- Type: text/plain, Size: 911 bytes --] Index: extern.h =================================================================== RCS file: /home/cvs/mdocml/texi2mdoc/extern.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -p -r1.16 -r1.17 --- extern.h 25 Feb 2015 14:49:14 -0000 1.16 +++ extern.h 25 Feb 2015 19:45:59 -0000 1.17 @@ -1,4 +1,4 @@ -/* $Id: extern.h,v 1.16 2015/02/25 14:49:14 kristaps Exp $ */ +/* $Id: extern.h,v 1.17 2015/02/25 19:45:59 kristaps Exp $ */ /* * Copyright (c) 2015 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -16,6 +16,21 @@ */ #ifndef EXTERN_H #define EXTERN_H + +#if !defined(__BEGIN_DECLS) +# ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# else +# define __BEGIN_DECLS +# endif +#endif +#if !defined(__END_DECLS) +# ifdef __cplusplus +# define __END_DECLS } +# else +# define __END_DECLS +# endif +#endif /* * This defines each one of the Texinfo commands that we understand. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-02-25 19:50 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-02-23 15:31 texi2mdoc Kristaps Dzonsons 2015-02-23 16:56 ` texi2mdoc Svyatoslav Mishyn 2015-02-23 17:31 ` texi2mdoc Kristaps Dzonsons 2015-02-23 18:13 ` texi2mdoc Ingo Schwarze 2015-02-23 18:17 ` texi2mdoc Svyatoslav Mishyn 2015-02-25 15:17 ` texi2mdoc Kristaps Dzonsons 2015-02-25 17:23 ` texi2mdoc Svyatoslav Mishyn 2015-02-25 19:50 ` texi2mdoc Kristaps Dzonsons
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 NNTP newsgroup(s).