From bcba0ef4486eb9baec3cd4d17250b91e1c8a7f79 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Wed, 31 Dec 2025 18:55:49 +0300 Subject: no longer touch installed files at install-time * hash-bang lines in grosciteco.tes and tedoc.tes are fixed up at build time instead of install-time (via install-exec-hook). * This will hopefully resolve problems with the FreeBSD port, since Poudriere installs the package as non-root but with BINMODE=555. The alternative would have been to set BINMODE=755 in the port which may not be acceptible by the official port committer. Anyway, I decided to go out of the way of any conflicts. See also https://bugs.freebsd.org/bugzilla/show_bug.cgi?format=multiple&id=283601 * On the downside, this will break install-path overrides at install-time (e.g. `make install bindir=...`). --- INSTALL | 3 + doc/Makefile.am | 58 +++----- doc/grosciteco.tes | 389 -------------------------------------------------- doc/grosciteco.tes.in | 389 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/tedoc.tes | 130 ----------------- doc/tedoc.tes.in | 130 +++++++++++++++++ freebsd/Makefile | 4 - 7 files changed, 545 insertions(+), 558 deletions(-) delete mode 100755 doc/grosciteco.tes create mode 100755 doc/grosciteco.tes.in delete mode 100755 doc/tedoc.tes create mode 100755 doc/tedoc.tes.in diff --git a/INSTALL b/INSTALL index 40e0795..5450e6e 100644 --- a/INSTALL +++ b/INSTALL @@ -140,6 +140,9 @@ To install SciTECO, type something like: $ sudo make install +Overwriting installation directories at install-time (make install bindir=...) +is not supported. + You are recommended to use the included "fallback.teco_ini" as a starting point for your profile. On UNIX, you can copy it to your $HOME directory at "~/.teco_ini" while on Windows, it should be in the same directory diff --git a/doc/Makefile.am b/doc/Makefile.am index 8ac9fad..9c83eee 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -7,21 +7,20 @@ include $(top_srcdir)/bootstrap.am # code. # It generates Troff manpage markup and acts as a Troff # preprocessor to manpage templates. -dist_bin_SCRIPTS = tedoc.tes - -# Name of tedoc.tes after installation, taking --program-prefix -# into account. -TEDOC_INSTALLED = \ - $(bindir)/`echo tedoc.tes | @SED@ '$(transform)'` +bin_SCRIPTS = tedoc.tes +CLEANFILES = tedoc.tes +dist_noinst_SCRIPTS = tedoc.tes.in %.in : %.template tedoc.tes @top_srcdir@/src/*.c - $(SCITECO_FULL) -m -- @srcdir@/tedoc.tes \ + $(SCITECO_FULL) -m -- tedoc.tes \ -C $@ $< @top_srcdir@/src/*.c # grosciteco is a troff postprocessor similar to grotty # which can be used to produce SciTECO-friendly output # (woman pages). -dist_bin_SCRIPTS += grosciteco.tes +bin_SCRIPTS += grosciteco.tes +CLEANFILES += grosciteco.tes +dist_noinst_SCRIPTS += grosciteco.tes.in # grosciteco, like many other postprocessors, works # best with its own macro package. # Unfortunately, there is no way to query the built-in @@ -32,34 +31,23 @@ dist_bin_SCRIPTS += grosciteco.tes # the directory via `groff -M`. dist_scitecodata_DATA = sciteco.tmac -# Name of grosciteco.tes after installation, taking --program-prefix -# into account. -GROSCITECO_INSTALLED = \ - $(bindir)/`echo grosciteco.tes | @SED@ '$(transform)'` - -# Fix up the hash-bang line of installed SciTECO scripts upon -# installation to refer to the installed sciteco binary. -# This takes --program-prefix into account. -# This wouldn't work on Windows since SciTECO cannot open -# the /mingw64 paths. -# -# FIXME: This will patch the hash-bang line repeatedly. -# Perhaps it would be better to do that using a preprocessing -# step before installation - see the known problems that this -# is causing on FreeBSD/Poudriere. -if !WIN32 -install-exec-hook: - $(SCITECO_FULL) -e "<%i^[ :Q[^A^E\\i]:; @EB'^EN[^A^E\\i]' \ - 0,^Q::@FR'#!^EM^Xsciteco'#!$(SCITECO_INSTALLED)'> \ - :EX" \ - $(DESTDIR)$(GROSCITECO_INSTALLED) \ - $(DESTDIR)$(TEDOC_INSTALLED) -endif +# Fix up the hash-bang line of installed SciTECO scripts. +# This takes --prefix and --program-prefix into account. +# On the other hand, since this is run at build time, +# it breaks bindir-overwriting at `make install` time, +# which could only be made to work with an install-exec-hook. +# Patching installed scripts however broke the FreeBSD port +# builds with Poudriere where BINMODE=555 is set. +# It was therefore decided to sacrifice the rarely used +# `make install bindir=...` and appease the FreeBSD port +# committers instead. +%.tes : %.tes.in + $(SCITECO_FULL) -qioe "0,^Q::@FR'#\!^EM^Xsciteco'#\!$(SCITECO_INSTALLED)'" <$< >$@ womendir = $(scitecolibdir)/women women_DATA = grosciteco.tes.1.woman grosciteco.tes.1.woman.tec -CLEANFILES = grosciteco.tes.1 +CLEANFILES += grosciteco.tes.1 EXTRA_DIST = grosciteco.tes.1.in women_DATA += tedoc.tes.1.woman tedoc.tes.1.woman.tec @@ -86,15 +74,15 @@ CLEANFILES += $(women_DATA) %.woman : % sciteco.tmac grosciteco.tes @GROFF@ @GROFF_FLAGS@ -wall -Z -Tutf8 -t -man -M@srcdir@ -msciteco $< | \ - $(SCITECO_FULL) -im -- @srcdir@/grosciteco.tes $@ + $(SCITECO_FULL) -im -- grosciteco.tes $@ tutorial.woman : tutorial.ms sciteco.tmac grosciteco.tes @GROFF@ @GROFF_FLAGS@ -wall -Z -Tutf8 -t -ms -M@srcdir@ -msciteco $< | \ - $(SCITECO_FULL) -im -- @srcdir@/grosciteco.tes $@ + $(SCITECO_FULL) -im -- grosciteco.tes $@ man_MANS = grosciteco.tes.1 tedoc.tes.1 sciteco.1 sciteco.7 -dist_noinst_SCRIPTS = htbl.tes +dist_noinst_SCRIPTS += htbl.tes if BUILD_HTMLDOCS html_DATA = grosciteco.tes.1.html tedoc.tes.1.html \ diff --git a/doc/grosciteco.tes b/doc/grosciteco.tes deleted file mode 100755 index c4f16e1..0000000 --- a/doc/grosciteco.tes +++ /dev/null @@ -1,389 +0,0 @@ -#!/usr/local/bin/sciteco -mi -!* grosciteco.tes [-t ] [--] -} - -!* skip N (string) arguments beginning with current one *! -@#sa{ - "~1'< - <0A-^^ "= 1; ' 0A-10"= 1; ' :C;> :M#sw - > -} - -!* get next integer argument, skipping it *! -@#gi{ - \ (0A-^^-"= :C ' <0A"D :C; | 1; '> :M#sw) -} - -!* skip end of command *! -@#sc{ - 0A-10"= :C ' -} - -0U[text.lines] 0U[pos.v] 0U[pos.h] - -!* move to (pos.h,pos.v) relative to origin, making space if necessary *! -@[move]{ [.n - U.n J - Q[pos.v]-Q[text.lines]"> - ZJ Q[pos.v]-Q[text.lines] - Q[pos.v]U[text.lines] - | - Q[pos.v]L - ' - Q[pos.h]<.-Z"= I  | 0A-10"= I  | C' '> - Q.n<.-Z"= 1; ' 0A-10"= 1; ' D> -].n } - -!* draw a line to (h,v) *! -!* FIXME: Works only for straight lines *! -@[line]{ U.[to.v] U.[to.h] - Q.[to.h]-Q[pos.h]"= Q.[to.v]-Q[pos.v]"=  ' ' - [* EBN[output-woman] - Q.[to.h]-Q[pos.h]"= - !* vertical line *! - Q.[to.v]-Q[pos.v]"< Q[pos.v]U.v Q.[to.v]U[pos.v] | Q.[to.v]U.v ' - 1:M[move] %[pos.v] .-Z"= I R ' - -A-9472"= 0A-9472"= I┬ | I┐ ' - | 0A-9472"= I┌ | I╷ ' ' - Q.v-Q[pos.v]< - 1:M[move] %[pos.v] .-Z"= I R ' - -A-9472"= 0A-9472"= I┼ | I┤ ' - | 0A-9472"= I├ | I│ ' ' - > - 1:M[move] .-Z"= I R ' - -A-9472"= 0A-9472"= I┴ | I┘ ' - | 0A-9472"= I└ | I╵ ' ' - Q.[to.v]U[pos.v] - | - !* horizontal line - FIXME: works only if horizonal lines are drawn first. *! - Q.[to.h]-Q[pos.h]"< Q[pos.h]U.h Q.[to.h]U[pos.h] | Q.[to.h]U.h ' - Q.h-Q[pos.h]+1< - 1:M[move] I─ %[pos.h] - > - Q.[to.h]U[pos.h] - ' - ]* -} - -!* style last N glyphs/characters *! -1U[default-style] -@[style]{ [.l - U.l Q[font]-Q[default-style]"N - .-Q.lU.l Q.lESSTARTSTYLING Q[font],(-Q.l)ESSETSTYLING - ' -].l } - -[topics] - -!* special characters *! -[glyphs.**]∗ -[glyphs.\-]- -[glyphs.aa]' -[glyphs.aq]' -[glyphs.oq]‘ -[glyphs.cq]’ -[glyphs.dq]" -[glyphs.hy]‐ -[glyphs.ha]^ -[glyphs.em]— -[glyphs.bu]• -[glyphs.pc]· -[glyphs.la]⟨ -[glyphs.ra]⟩ -[glyphs.lq]“ -[glyphs.rq]” -[glyphs.Fo]« -[glyphs.Fc]» -[glyphs.rs]\ -[glyphs.ti]~ -[glyphs.sl]/ -[glyphs.+]+ -[glyphs.->]→ -[glyphs.tm]™ - -!* process formatter commands *! -@[format]{ < - .-Z"= 1; ' - 0AU[cmd] C - Ocmd.U[cmd] - - !cmd.x! - :M#sw - 0AU[cmd] C - Ocmd.xU[cmd] - - !cmd.xT! - 2:M#sa :M#sc F< - !cmd.xr! - :M#sa :M#giU[res] :M#giU[res.h] :M#giU[res.v] :M#sc F< - !cmd.xi! - :M#sa :M#sc F< - !cmd.xF! - L F< - !cmd.xX! - :M#sw .(@W).X.w - Ocmd.xXQ.w - !cmd.xXsciteco_topic! - !* - * FIXME: The buffer position of this topic might still - * change due to movement commands (esp. when formatting - * a table). Only the line+column should no longer change. - * Either store line+column or use markers. - *! - [* EBN[output-woman] 0:M[move] U.d ]* - :EU[topics]\.d: - C :X[topics] - L F< - !cmd.xXsciteco_tt! - [* EBN[output-woman] 0:M[move] U[ttstart] ]* - L F< - !cmd.xXsciteco_tt_end! - [* EBN[output-woman] 0:M[move] - -Q[ttstart]< - Q[ttstart]ESSTARTSTYLING Q[ttstart]ESGETSTYLEAT+16,1ESSETSTYLING - %[ttstart]> - ]* - L F< - !cmd.xXsciteco_startstyling! - [* EBN[output-woman] 0:M[move] U[stylestart] ]* - L F< - !cmd.xXsciteco_setstyling! - C :M#giU.s - [* EBN[output-woman] 0:M[move] - Q[stylestart]ESSTARTSTYLING Q.s,(-Q[stylestart])ESSETSTYLING - ]* - L F< - !cmd.xXsciteco_foldlevel! - C :M#giU.[foldlevel] - [* EBN[output-woman] 0:M[move] - Q.[foldlevel],(ESLINEFROMPOSITION)ESSETLINESTATE - ]* - L F< - !cmd.xXtty! - !cmd.xXdevtag! - L F< - - !cmd.xf! - :M#sa :M#giU.n Q.n+16U.#nt .(:M#sa).X[font] :M#sc - :Q[fonts.\.n]"F F< ' -U[fonts.\.n] - @:EU[styles]{\.#ntESSTYLESETFONTQ[lexer.font]^J} - Ocmd.xfQ[font] - !cmd.xfR! - Q.nU[default-style] - @:EU[styles]{16ESSTYLESETFONTQ[lexer.font]^J} - F< - !cmd.xfB! - @:EU[styles]{1,\.nESSTYLESETBOLD 1,\.#ntESSTYLESETBOLD^J} - F< - !cmd.xfBI! - @:EU[styles]{1,\.nESSTYLESETBOLD 1,\.#ntESSTYLESETBOLD^J} - !cmd.xfI! - @:EU[styles]{1,\.nESSTYLESETITALIC 1,\.#ntESSTYLESETITALIC^J} - @:EU[styles]{0EJ-1"= 1,\.nESSTYLESETUNDERLINE 1,\.#ntESSTYLESETUNDERLINE '^J} - F< - - !cmd.xt! - :M#sa :M#sc F< - !cmd.xs! - 1; - - !cmd.F! - L F< - - !cmd.p! - :M#sw :M#gi Q[pos.v]U[origin.v] :M#sc F< - - !cmd.f! - :M#sw :M#giU[font] :M#sc F< - - !cmd.s! - :M#sw :M#gi :M#sc F< - - !cmd.V! - :M#sw :M#gi/Q[res.v]-1+Q[origin.v]U[pos.v] Q[pos.v]"<0U[pos.v]' :M#sc F< - - !cmd.v! - :M#sw :M#gi/Q[res.v]%[pos.v] :M#sc F< - - !cmd.H! - :M#sw :M#gi/Q[res.h]U[pos.h] :M#sc F< - - !cmd.h! - :M#sw :M#gi/Q[res.h]%[pos.h] :M#sc F< - - !cmd.m! - :M#sw - 0AU[cmd] C - Ocmd.mU[cmd] - - !cmd.md! - :M#sc F< - - !cmd.D! - :M#sw - 0AU[cmd] C - Ocmd.DU[cmd] - - !cmd.DF! - :M#sw - 0AU[cmd] C - Ocmd.DFU[cmd] - - !cmd.DFd! - :M#sc F< - - !cmd.DFg! - :M#sw :M#gi :M#sc F< - - !cmd.Dl! - :M#sw :M#gi/Q[res.h]+Q[pos.h]U.[to.h] :M#gi/Q[res.v]+Q[pos.v]U.[to.v] :M#sc - Q.[to.h],Q.[to.v]M[line] F< - - !cmd.Dp! - !cmd.DP! - :M#sw Q[pos.h]U.[start.h] Q[pos.v]U.[start.v] - < - :M#gi/Q[res.h]U.h Q.h+Q[pos.h]U.[to.h] :M#gi/Q[res.v]U.v Q.v+Q[pos.v]U.[to.v] - Q.h%.[inc.h] Q.v%.[inc.v] - Q.[to.h],Q.[to.v]M[line] - 0A-10"= 1; ' - > - Q.[start.h],Q.[start.v]M[line] - Q.[inc.h]%[pos.h] Q.[inc.v]%[pos.v] - :M#sc F< - - !cmd.Dt! - :M#sw :M#gi/Q[res.h]%[pos.h] :M#sw :M#gi :M#sc F< - - !cmd.t! - :M#sw .(:M#sa).X.w - [* EBN[output-woman] :Q.w:M[move] - G.w :Q.w:M[style] ]* - :Q.w%[pos.h] :M#sc F< - - !cmd.C! - :M#sw 0A-^^u"= - !* FIXME: This can be CuXXXX_XXXX (decomposed, e.g. for cyrillic й) *! - C 16 \U.w  @W - | - .(:M#sa).X.w 0Q[glyphs.Q.w]U.w - ' - [* EBN[output-woman] 1:M[move] - Q.wI 1:M[style] ]* :M#sc F< - - !cmd.c! - :M#sw 0AU.w C - [* EBN[output-woman] 1:M[move] - G[glyphs.U.w] 1:M[style] ]* :M#sc F< - - !cmd.N! - :M#sw :M#giU.w - [* EBN[output-woman] 1:M[move] - Q.wI 1:M[style] ]* :M#sc F< - - !cmd.n! - :M#sw :M#gi :M#gi :M#sc F< - - !cmd.w! - :M#sc F< -> } - -!* - * Inline local macro invocations in [format] - * This speeds up runtime by 25% - *! -EQ[format] - J - J - J - J - J - J - !* - * Compress whitespace, kind of dangerous: - * J - *! -Q*U* - -:M[format] - -!* - * Generate the styling instructions based on the styles - * of the womanpage buffer. The styles are configured according - * to their font positions (already in `styles`). - * Styles are NOT generated in `styles` immediately during - * formatting, since the buffer positions of text to style - * can still change with `move` operations that add whitespace. - * Also, here we can generate a minimal list of styling operations - * ending up with much smaller *.tec files. - * TODO: The size can still be improved by using SCI_SETSTYLINGEX - * if appropriate. - *! -EBN[output-woman] 0EE !* operate in single-byte mode *! -J 0U#cs 0U#cd -< - .ESGETSTYLEATUs Qs"< Qs= ' - .-Z"< Qs-Q#cs"= C F< ' ' - Q#cs"N - .-Q#cd Ul - @:EU[styles]{\#cdESSTARTSTYLING \#cs,\lESSETSTYLING^J} - ' - QsU#cs .U#cd -:C;> - -!* - * The fold level is stored in the line state since it is set - * while the document is not fully built yet. - *! -J 0U#li 0U[cur.fl] 0U[last.line] -ESGETLINECOUNT< - Q#liESGETLINESTATEU#fl - Q#fl"N - Q[cur.fl]"N - Q#li-Q[last.line]Ux - 1024%[cur.fl] - @:EU[styles]{\[last.line]U.l \x<\[cur.fl],Q.lESSETFOLDLEVEL %.l>^J} - ' - Q#li+1U[last.line] Q#flU[cur.fl] - (1024+Q#fl-1)#(2^*13)U#fl - @:EU[styles]{\#fl,\#liESSETFOLDLEVEL^J} - ' -%#li> -Q[cur.fl]"N - Q#li-Q[last.line]Ux - 1024%[cur.fl] - @:EU[styles]{\[last.line]U.l \x<\[cur.fl],Q.lESSETFOLDLEVEL %.l>^J} -' - -!* - * Save the clear-text part of the document into - *! -2EL EW - -EQ[styles] - -!* Generate topic index *! -J I!*Q[topics]*!^J - -2EL EWQ[getopt.t] - --EX diff --git a/doc/grosciteco.tes.in b/doc/grosciteco.tes.in new file mode 100755 index 0000000..c4f16e1 --- /dev/null +++ b/doc/grosciteco.tes.in @@ -0,0 +1,389 @@ +#!/usr/local/bin/sciteco -mi +!* grosciteco.tes [-t ] [--] +} + +!* skip N (string) arguments beginning with current one *! +@#sa{ + "~1'< + <0A-^^ "= 1; ' 0A-10"= 1; ' :C;> :M#sw + > +} + +!* get next integer argument, skipping it *! +@#gi{ + \ (0A-^^-"= :C ' <0A"D :C; | 1; '> :M#sw) +} + +!* skip end of command *! +@#sc{ + 0A-10"= :C ' +} + +0U[text.lines] 0U[pos.v] 0U[pos.h] + +!* move to (pos.h,pos.v) relative to origin, making space if necessary *! +@[move]{ [.n + U.n J + Q[pos.v]-Q[text.lines]"> + ZJ Q[pos.v]-Q[text.lines] + Q[pos.v]U[text.lines] + | + Q[pos.v]L + ' + Q[pos.h]<.-Z"= I  | 0A-10"= I  | C' '> + Q.n<.-Z"= 1; ' 0A-10"= 1; ' D> +].n } + +!* draw a line to (h,v) *! +!* FIXME: Works only for straight lines *! +@[line]{ U.[to.v] U.[to.h] + Q.[to.h]-Q[pos.h]"= Q.[to.v]-Q[pos.v]"=  ' ' + [* EBN[output-woman] + Q.[to.h]-Q[pos.h]"= + !* vertical line *! + Q.[to.v]-Q[pos.v]"< Q[pos.v]U.v Q.[to.v]U[pos.v] | Q.[to.v]U.v ' + 1:M[move] %[pos.v] .-Z"= I R ' + -A-9472"= 0A-9472"= I┬ | I┐ ' + | 0A-9472"= I┌ | I╷ ' ' + Q.v-Q[pos.v]< + 1:M[move] %[pos.v] .-Z"= I R ' + -A-9472"= 0A-9472"= I┼ | I┤ ' + | 0A-9472"= I├ | I│ ' ' + > + 1:M[move] .-Z"= I R ' + -A-9472"= 0A-9472"= I┴ | I┘ ' + | 0A-9472"= I└ | I╵ ' ' + Q.[to.v]U[pos.v] + | + !* horizontal line + FIXME: works only if horizonal lines are drawn first. *! + Q.[to.h]-Q[pos.h]"< Q[pos.h]U.h Q.[to.h]U[pos.h] | Q.[to.h]U.h ' + Q.h-Q[pos.h]+1< + 1:M[move] I─ %[pos.h] + > + Q.[to.h]U[pos.h] + ' + ]* +} + +!* style last N glyphs/characters *! +1U[default-style] +@[style]{ [.l + U.l Q[font]-Q[default-style]"N + .-Q.lU.l Q.lESSTARTSTYLING Q[font],(-Q.l)ESSETSTYLING + ' +].l } + +[topics] + +!* special characters *! +[glyphs.**]∗ +[glyphs.\-]- +[glyphs.aa]' +[glyphs.aq]' +[glyphs.oq]‘ +[glyphs.cq]’ +[glyphs.dq]" +[glyphs.hy]‐ +[glyphs.ha]^ +[glyphs.em]— +[glyphs.bu]• +[glyphs.pc]· +[glyphs.la]⟨ +[glyphs.ra]⟩ +[glyphs.lq]“ +[glyphs.rq]” +[glyphs.Fo]« +[glyphs.Fc]» +[glyphs.rs]\ +[glyphs.ti]~ +[glyphs.sl]/ +[glyphs.+]+ +[glyphs.->]→ +[glyphs.tm]™ + +!* process formatter commands *! +@[format]{ < + .-Z"= 1; ' + 0AU[cmd] C + Ocmd.U[cmd] + + !cmd.x! + :M#sw + 0AU[cmd] C + Ocmd.xU[cmd] + + !cmd.xT! + 2:M#sa :M#sc F< + !cmd.xr! + :M#sa :M#giU[res] :M#giU[res.h] :M#giU[res.v] :M#sc F< + !cmd.xi! + :M#sa :M#sc F< + !cmd.xF! + L F< + !cmd.xX! + :M#sw .(@W).X.w + Ocmd.xXQ.w + !cmd.xXsciteco_topic! + !* + * FIXME: The buffer position of this topic might still + * change due to movement commands (esp. when formatting + * a table). Only the line+column should no longer change. + * Either store line+column or use markers. + *! + [* EBN[output-woman] 0:M[move] U.d ]* + :EU[topics]\.d: + C :X[topics] + L F< + !cmd.xXsciteco_tt! + [* EBN[output-woman] 0:M[move] U[ttstart] ]* + L F< + !cmd.xXsciteco_tt_end! + [* EBN[output-woman] 0:M[move] + -Q[ttstart]< + Q[ttstart]ESSTARTSTYLING Q[ttstart]ESGETSTYLEAT+16,1ESSETSTYLING + %[ttstart]> + ]* + L F< + !cmd.xXsciteco_startstyling! + [* EBN[output-woman] 0:M[move] U[stylestart] ]* + L F< + !cmd.xXsciteco_setstyling! + C :M#giU.s + [* EBN[output-woman] 0:M[move] + Q[stylestart]ESSTARTSTYLING Q.s,(-Q[stylestart])ESSETSTYLING + ]* + L F< + !cmd.xXsciteco_foldlevel! + C :M#giU.[foldlevel] + [* EBN[output-woman] 0:M[move] + Q.[foldlevel],(ESLINEFROMPOSITION)ESSETLINESTATE + ]* + L F< + !cmd.xXtty! + !cmd.xXdevtag! + L F< + + !cmd.xf! + :M#sa :M#giU.n Q.n+16U.#nt .(:M#sa).X[font] :M#sc + :Q[fonts.\.n]"F F< ' -U[fonts.\.n] + @:EU[styles]{\.#ntESSTYLESETFONTQ[lexer.font]^J} + Ocmd.xfQ[font] + !cmd.xfR! + Q.nU[default-style] + @:EU[styles]{16ESSTYLESETFONTQ[lexer.font]^J} + F< + !cmd.xfB! + @:EU[styles]{1,\.nESSTYLESETBOLD 1,\.#ntESSTYLESETBOLD^J} + F< + !cmd.xfBI! + @:EU[styles]{1,\.nESSTYLESETBOLD 1,\.#ntESSTYLESETBOLD^J} + !cmd.xfI! + @:EU[styles]{1,\.nESSTYLESETITALIC 1,\.#ntESSTYLESETITALIC^J} + @:EU[styles]{0EJ-1"= 1,\.nESSTYLESETUNDERLINE 1,\.#ntESSTYLESETUNDERLINE '^J} + F< + + !cmd.xt! + :M#sa :M#sc F< + !cmd.xs! + 1; + + !cmd.F! + L F< + + !cmd.p! + :M#sw :M#gi Q[pos.v]U[origin.v] :M#sc F< + + !cmd.f! + :M#sw :M#giU[font] :M#sc F< + + !cmd.s! + :M#sw :M#gi :M#sc F< + + !cmd.V! + :M#sw :M#gi/Q[res.v]-1+Q[origin.v]U[pos.v] Q[pos.v]"<0U[pos.v]' :M#sc F< + + !cmd.v! + :M#sw :M#gi/Q[res.v]%[pos.v] :M#sc F< + + !cmd.H! + :M#sw :M#gi/Q[res.h]U[pos.h] :M#sc F< + + !cmd.h! + :M#sw :M#gi/Q[res.h]%[pos.h] :M#sc F< + + !cmd.m! + :M#sw + 0AU[cmd] C + Ocmd.mU[cmd] + + !cmd.md! + :M#sc F< + + !cmd.D! + :M#sw + 0AU[cmd] C + Ocmd.DU[cmd] + + !cmd.DF! + :M#sw + 0AU[cmd] C + Ocmd.DFU[cmd] + + !cmd.DFd! + :M#sc F< + + !cmd.DFg! + :M#sw :M#gi :M#sc F< + + !cmd.Dl! + :M#sw :M#gi/Q[res.h]+Q[pos.h]U.[to.h] :M#gi/Q[res.v]+Q[pos.v]U.[to.v] :M#sc + Q.[to.h],Q.[to.v]M[line] F< + + !cmd.Dp! + !cmd.DP! + :M#sw Q[pos.h]U.[start.h] Q[pos.v]U.[start.v] + < + :M#gi/Q[res.h]U.h Q.h+Q[pos.h]U.[to.h] :M#gi/Q[res.v]U.v Q.v+Q[pos.v]U.[to.v] + Q.h%.[inc.h] Q.v%.[inc.v] + Q.[to.h],Q.[to.v]M[line] + 0A-10"= 1; ' + > + Q.[start.h],Q.[start.v]M[line] + Q.[inc.h]%[pos.h] Q.[inc.v]%[pos.v] + :M#sc F< + + !cmd.Dt! + :M#sw :M#gi/Q[res.h]%[pos.h] :M#sw :M#gi :M#sc F< + + !cmd.t! + :M#sw .(:M#sa).X.w + [* EBN[output-woman] :Q.w:M[move] + G.w :Q.w:M[style] ]* + :Q.w%[pos.h] :M#sc F< + + !cmd.C! + :M#sw 0A-^^u"= + !* FIXME: This can be CuXXXX_XXXX (decomposed, e.g. for cyrillic й) *! + C 16 \U.w  @W + | + .(:M#sa).X.w 0Q[glyphs.Q.w]U.w + ' + [* EBN[output-woman] 1:M[move] + Q.wI 1:M[style] ]* :M#sc F< + + !cmd.c! + :M#sw 0AU.w C + [* EBN[output-woman] 1:M[move] + G[glyphs.U.w] 1:M[style] ]* :M#sc F< + + !cmd.N! + :M#sw :M#giU.w + [* EBN[output-woman] 1:M[move] + Q.wI 1:M[style] ]* :M#sc F< + + !cmd.n! + :M#sw :M#gi :M#gi :M#sc F< + + !cmd.w! + :M#sc F< +> } + +!* + * Inline local macro invocations in [format] + * This speeds up runtime by 25% + *! +EQ[format] + J + J + J + J + J + J + !* + * Compress whitespace, kind of dangerous: + * J + *! +Q*U* + +:M[format] + +!* + * Generate the styling instructions based on the styles + * of the womanpage buffer. The styles are configured according + * to their font positions (already in `styles`). + * Styles are NOT generated in `styles` immediately during + * formatting, since the buffer positions of text to style + * can still change with `move` operations that add whitespace. + * Also, here we can generate a minimal list of styling operations + * ending up with much smaller *.tec files. + * TODO: The size can still be improved by using SCI_SETSTYLINGEX + * if appropriate. + *! +EBN[output-woman] 0EE !* operate in single-byte mode *! +J 0U#cs 0U#cd +< + .ESGETSTYLEATUs Qs"< Qs= ' + .-Z"< Qs-Q#cs"= C F< ' ' + Q#cs"N + .-Q#cd Ul + @:EU[styles]{\#cdESSTARTSTYLING \#cs,\lESSETSTYLING^J} + ' + QsU#cs .U#cd +:C;> + +!* + * The fold level is stored in the line state since it is set + * while the document is not fully built yet. + *! +J 0U#li 0U[cur.fl] 0U[last.line] +ESGETLINECOUNT< + Q#liESGETLINESTATEU#fl + Q#fl"N + Q[cur.fl]"N + Q#li-Q[last.line]Ux + 1024%[cur.fl] + @:EU[styles]{\[last.line]U.l \x<\[cur.fl],Q.lESSETFOLDLEVEL %.l>^J} + ' + Q#li+1U[last.line] Q#flU[cur.fl] + (1024+Q#fl-1)#(2^*13)U#fl + @:EU[styles]{\#fl,\#liESSETFOLDLEVEL^J} + ' +%#li> +Q[cur.fl]"N + Q#li-Q[last.line]Ux + 1024%[cur.fl] + @:EU[styles]{\[last.line]U.l \x<\[cur.fl],Q.lESSETFOLDLEVEL %.l>^J} +' + +!* + * Save the clear-text part of the document into + *! +2EL EW + +EQ[styles] + +!* Generate topic index *! +J I!*Q[topics]*!^J + +2EL EWQ[getopt.t] + +-EX diff --git a/doc/tedoc.tes b/doc/tedoc.tes deleted file mode 100755 index cc4f726..0000000 --- a/doc/tedoc.tes +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/local/bin/sciteco -m -!* tedoc.tes [-C] [--] *! - -0,2EJ !* FIXME: Memory limiting is too slow *! - -:EIQ[$SCITECOPATH]/getopt.tes - -@[format_header]{ - FD--S .,(:L"S.|Z')@Xa I^J - - EBN[\#tm] - I\# GENERATED FROM Q.#sc (\.#sc):^J - I.SS  Ga -A-10"N I^J ' - :Q.[topics]"> - I.SCITECO_TOPIC  G.[topics] - ' - - EQ.[header] - J - J < - SMA; .U.t - 1Ua <."=1;' -A"A|1;' -A"V -1Ua 1;' R> - Qa"S - Q.tJ - | - .,Q.t@Xa - I^J.B Qa^J - ' - > - J < - S[[MC]]; 1Xa D - I^J.RI [ Qa ]^J - > - J \(->;> - J < - SMCM[|MC]; - .U.t <-A"C|-A-|"N1;'' R> - .,Q.t@Xa EQa - - EQ.[header] - I^J.IR Qa^J - > - J - J - J - J 0A-10"=D' - ZJ -A-10"=-D' - EBN[\#tm] - G.[header] - I^J.^J -} - -@[format_body]{ - I.LP^J - - J - J - !* set margin for list paragraphs *! - J 0U.n < - Z-.-3"<1;' - .,.+3:S.LP"S - Q.n"> - 0L I.RE^J 0U.n - ' - | - .,.+3:S.IP"S - Q.n"=0L I.RS^J %.n ' - ' - ' - :L; - > - Q.n"> ZJ I^J.RE ' - J ; -D I^J -S< -D I^J.I > - J - J - EBN[\#tm] - G.c I^J.^J.^J -} - -!* process command-line options *! -[optstring]C -M[getopt]U#ou Q#ou"< Invalid command-line^J 1 ' -:Q[getopt.C]"< - [comment.start]!* [comment.end]*! -| - [comment.start]/* [comment.end]*/ -' -Q#ou+1U#tm Q#tmU.i <:Q[\.i]:; EBN[\.i] %.i> - -!* switch to the main troff template (#tm) *! -EB EF - -I\# -\# AUTOGENERATED FROM Q[\#tm] -\# DO NOT EDIT MANUALLY!!! -\#^J - -!* find insertion point *! -:FS^J.TEDOC^J^J"F Missing .TEDOC call^J 1 ' - -EJ-1< - < - 2U* [*].#sc - - !* extract comment *! - SQ[comment.start]$; - .-:Q[comment.start]-1U.#sc - SQ[comment.end] - Q.#sc+:Q[comment.start]+1,.-:Q[comment.end]X.c - EQ.c - - J - J 0A-10"N @X.[topics] ' - <0A-10"N 0A- "N 0A-9"N 1; ' ' ' D> - ZJ <-A-10"N -A- "N -A-9"N 1; ' ' ' -D> - - !* extract header *! - H:FD^J^J"F ZJ ' - 0,.@X.[header] - - EQ.[header] - :M[format_header] - EQ.c - :M[format_body] - > - EF -> - -2EL EWQ[\#ou] -EX diff --git a/doc/tedoc.tes.in b/doc/tedoc.tes.in new file mode 100755 index 0000000..cc4f726 --- /dev/null +++ b/doc/tedoc.tes.in @@ -0,0 +1,130 @@ +#!/usr/local/bin/sciteco -m +!* tedoc.tes [-C] [--] *! + +0,2EJ !* FIXME: Memory limiting is too slow *! + +:EIQ[$SCITECOPATH]/getopt.tes + +@[format_header]{ + FD--S .,(:L"S.|Z')@Xa I^J + + EBN[\#tm] + I\# GENERATED FROM Q.#sc (\.#sc):^J + I.SS  Ga -A-10"N I^J ' + :Q.[topics]"> + I.SCITECO_TOPIC  G.[topics] + ' + + EQ.[header] + J + J < + SMA; .U.t + 1Ua <."=1;' -A"A|1;' -A"V -1Ua 1;' R> + Qa"S + Q.tJ + | + .,Q.t@Xa + I^J.B Qa^J + ' + > + J < + S[[MC]]; 1Xa D + I^J.RI [ Qa ]^J + > + J \(->;> + J < + SMCM[|MC]; + .U.t <-A"C|-A-|"N1;'' R> + .,Q.t@Xa EQa + + EQ.[header] + I^J.IR Qa^J + > + J + J + J + J 0A-10"=D' + ZJ -A-10"=-D' + EBN[\#tm] + G.[header] + I^J.^J +} + +@[format_body]{ + I.LP^J + + J + J + !* set margin for list paragraphs *! + J 0U.n < + Z-.-3"<1;' + .,.+3:S.LP"S + Q.n"> + 0L I.RE^J 0U.n + ' + | + .,.+3:S.IP"S + Q.n"=0L I.RS^J %.n ' + ' + ' + :L; + > + Q.n"> ZJ I^J.RE ' + J ; -D I^J -S< -D I^J.I > + J + J + EBN[\#tm] + G.c I^J.^J.^J +} + +!* process command-line options *! +[optstring]C +M[getopt]U#ou Q#ou"< Invalid command-line^J 1 ' +:Q[getopt.C]"< + [comment.start]!* [comment.end]*! +| + [comment.start]/* [comment.end]*/ +' +Q#ou+1U#tm Q#tmU.i <:Q[\.i]:; EBN[\.i] %.i> + +!* switch to the main troff template (#tm) *! +EB EF + +I\# +\# AUTOGENERATED FROM Q[\#tm] +\# DO NOT EDIT MANUALLY!!! +\#^J + +!* find insertion point *! +:FS^J.TEDOC^J^J"F Missing .TEDOC call^J 1 ' + +EJ-1< + < + 2U* [*].#sc + + !* extract comment *! + SQ[comment.start]$; + .-:Q[comment.start]-1U.#sc + SQ[comment.end] + Q.#sc+:Q[comment.start]+1,.-:Q[comment.end]X.c + EQ.c + + J + J 0A-10"N @X.[topics] ' + <0A-10"N 0A- "N 0A-9"N 1; ' ' ' D> + ZJ <-A-10"N -A- "N -A-9"N 1; ' ' ' -D> + + !* extract header *! + H:FD^J^J"F ZJ ' + 0,.@X.[header] + + EQ.[header] + :M[format_header] + EQ.c + :M[format_body] + > + EF +> + +2EL EWQ[\#ou] +EX diff --git a/freebsd/Makefile b/freebsd/Makefile index f4f0423..b182771 100644 --- a/freebsd/Makefile +++ b/freebsd/Makefile @@ -33,10 +33,6 @@ CONFIGURE_OUTSOURCE= yes MAKEFILE= GNUmakefile TEST_TARGET= check -# SciTECO uses an install-exec-hook to fix up hash-bang lines. -# This is broken by the default 0555 mode. -BINMODE= 755 - # NOTE: Unlike on Debian, we cannot build a sciteco-common package. # FreeBSD does not yet support subpackages. # Therefore both flavors will install totally independant -- cgit v1.2.3