aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/Makefile.am4
-rwxr-xr-xdoc/grosciteco.tes13
-rw-r--r--doc/grosciteco.tes.1.in10
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/getopt.tes52
-rw-r--r--src/Makefile.am10
-rwxr-xr-xsrc/symbols-extract.tes30
7 files changed, 93 insertions, 28 deletions
diff --git a/doc/Makefile.am b/doc/Makefile.am
index e63284a..fed0ebb 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -40,8 +40,8 @@ CLEANFILES += $(women_DATA)
# cannot currently read stdin, so the grosciteco postprocessor
# has to be run on a separate file.
%.woman %.woman.tec : %.intermediate grosciteco.tes
- $(SCITECO_FULL) -m @srcdir@/grosciteco.tes \
- $(basename $<).woman $(basename $<).woman.tec $<
+ $(SCITECO_FULL) -m -- @srcdir@/grosciteco.tes \
+ $@ $<
%.intermediate : % sciteco.tmac
@GROFF@ -Z -Tascii -t -man -M@srcdir@ -msciteco $< >$@
diff --git a/doc/grosciteco.tes b/doc/grosciteco.tes
index 7be01fb..262f2c0 100755
--- a/doc/grosciteco.tes
+++ b/doc/grosciteco.tes
@@ -1,9 +1,14 @@
#!/usr/local/bin/sciteco -m
-!* grosciteco.tes <output-woman> <output-tec> <input> *!
+!* grosciteco.tes [-t <output-tec>] [--] <output-woman> <input> *!
+
+:EMQ[$SCITECOPATH]/getopt.tes
!* Process command-line options *!
-LR 0X[output-woman] 2LR 0X[output-tec] 2LR 0X[input] HK
-EBQ[input]
+[optstring]t: M[getopt]"F (0/0) '
+LR 0X[output-woman] 2LR 0X[input] HK
+:Q[getopt.t]"< EU[getopt.t]Q[output-woman].tec '
+
+EBN[input]
! skip whitespace characters !
@#sw{
@@ -278,6 +283,6 @@ EQ[styles]
!* Generate topic index *!
J I!*Q[topics]*!^J
-EWQ[output-tec]
+EWQ[getopt.t]
-EX
diff --git a/doc/grosciteco.tes.1.in b/doc/grosciteco.tes.1.in
index e890a96..0aac8dc 100644
--- a/doc/grosciteco.tes.1.in
+++ b/doc/grosciteco.tes.1.in
@@ -15,8 +15,9 @@ GNU roff post-processor for \*(ST
.SH SYNOPSIS
.
.SY grosciteco.tes
+.OP "-t" tec_output
+.OP "--"
.I text_output
-.I tec_output
.I input
.YS
.
@@ -66,9 +67,7 @@ documentation within \*(ST.
.
.SH OPTIONS
.
-.IP "\fItext_output\fP
-The plain-text output file, e.g. \(lqgreat-macro.woman\(rq.
-.IP "\fItec_output\fP
+.IP "\fB-t \fItec_output\fR"
The \*(ST script that when executed after loading
\fItext_output\fP into a Scintilla view, styles that document.
It can be thought of as representing meta-information
@@ -76,6 +75,9 @@ for \fItext_output\fP.
In order to cooperate with the \(lqwoman\(rq lexer and
\*(ST's \fB?\fP command, its file name should be
\fItext_output\fP.tec, e.g. \(lqgreat-macro.woman.tec\(rq.
+This is also the default when omitted.
+.IP "\fItext_output\fP
+The plain-text output file, e.g. \(lqgreat-macro.woman\(rq.
.IP "\fIinput\fP"
The \fIinput\fP file is in \fBtroff\fP's device-independant
output format.
diff --git a/lib/Makefile.am b/lib/Makefile.am
index a66aaef..69a7c02 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,6 +1,6 @@
dist_scitecolib_DATA = color.tes lexer.tes session.tes fnkeys.tes
-dist_scitecolib_DATA += string.tes
+dist_scitecolib_DATA += string.tes getopt.tes
# Helper script for creating lexer definitions
EXTRA_DIST = scite2co.lua
diff --git a/lib/getopt.tes b/lib/getopt.tes
new file mode 100644
index 0000000..a2bcb31
--- /dev/null
+++ b/lib/getopt.tes
@@ -0,0 +1,52 @@
+!*$
+ * M[getopt] -> Success|Failure -- Parse options
+ *
+ * Parses command line options according to the string
+ * \(lqoptstring\(rq, similar to \fBgetopt\P(3).
+ * \(lqoptstring\(rq is a list of single character
+ * option names.
+ * If followed by a colon, the option takes an argument
+ * (which can be part of the same command line argument as in
+ * \(lq-Ofoo\(rq).
+ * If followed by two colons, the option argument is optional.
+ * For every detected option \fIX\fP, a register \fBgetopt.\fIX\fR is
+ * defined with -1 (true) in its integer part.
+ * If the option had an argument, it is stored in the register's
+ * string part.
+ *
+ * A condition boolean is returned to signify whether
+ * there was a parsing error.
+ *!
+[optstring]
+@[getopt]{
+ .U.d
+ <
+ .-Z"= 1; ' 0A-^^-"N :L; F< '
+
+ 1A-^^-"= K 1; '
+
+ 0U.i <
+ :Q[optstring]-Q.i"= Q.dJ 0 '
+ Q.iQ[optstring]U.c
+
+ 0U.#ar <
+ %.i-:Q[optstring]"= 1; '
+ Q.iQ[optstring]-^^:"N 1; '
+ %.#ar>
+
+ 1A-Q.c"=
+ -U[getopt.U.c]
+ Q.#ar">
+ 2A-10"=
+ K Q.#ar-1"> 0A-^^-"= 0U.i F< ' '
+ |
+ 2D
+ '
+ LR 0X[getopt.U.c] 0L
+ '
+ K 1;
+ '
+ >
+ >
+ Q.dJ
+-1}
diff --git a/src/Makefile.am b/src/Makefile.am
index 72e9157..facf963 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,8 +23,10 @@ endif
BUILT_SOURCES =
-EXTRA_DIST = symbols-extract.tes \
- sciteco.html
+dist_noinst_SCRIPTS = symbols-extract.tes
+
+# Emscripten HTML page:
+EXTRA_DIST = sciteco.html
noinst_LTLIBRARIES = libsciteco-base.la
libsciteco_base_la_SOURCES = main.cpp sciteco.h \
@@ -77,12 +79,12 @@ CLEANFILES = $(BUILT_SOURCES) \
symbols-scintilla.cpp : @SCINTILLA_PATH@/include/Scintilla.h \
symbols-extract.tes
$(SCITECO_MINIMAL) -m -- @srcdir@/symbols-extract.tes \
- $< $@ "SCI_" scintilla
+ -p "SCI_" -n scintilla $@ $<
symbols-scilexer.cpp : @SCINTILLA_PATH@/include/SciLexer.h \
symbols-extract.tes
$(SCITECO_MINIMAL) -m -- @srcdir@/symbols-extract.tes \
- $< $@ "SCLEX_,SCE_" scilexer
+ -p "SCLEX_,SCE_" -n scilexer $@ $<
# This installs a wrapper script to libexecdir to be used as
# the SciTECO interpreter in Hash-Bang lines.
diff --git a/src/symbols-extract.tes b/src/symbols-extract.tes
index e81331a..a88731d 100755
--- a/src/symbols-extract.tes
+++ b/src/symbols-extract.tes
@@ -1,18 +1,24 @@
#!/usr/local/bin/sciteco -m
-! ./symbols-extract.tes <input file> <output file> <prefix pattern list> <array name> !
+!*
+ * ./symbols-extract.tes [-p <prefix pattern list>] -n <SymbolList object> [--] \
+ * <output file> <input header>
+ *!
+:EMQ[$SCITECOPATH]/getopt.tes
EMQ[$SCITECOPATH]/string.tes
-! read commandline arguments !
-LR 0X#in 2LR 0X#ou 2LR 0X#pa 2LR 0X#na HK
+!* read commandline arguments *!
+[getopt.p]
+[optstring]p:n: M[getopt]"F (0/0) '
+LR 0X#ou 2LR 0X#in HK
-! copy all defines in input file beginning with prefix !
-EBQ#in <S#defineS[Q#pa]; -SS :Xa> EF
+!* copy all defines in input file beginning with prefix *!
+EBN#in <S#defineS[Q[getopt.p]]; -SS :Xa> EF
-! sort all defines !
+!* sort all defines *!
Ga ZJB 0,.M[qsort] J
-! format as C/C++ array !
+!* format as C/C++ array *!
I/*
* AUTOGENERATED FROM Q#in
* DO NOT EDIT
@@ -29,20 +35,18 @@ I/*
namespace SciTECO {
-static const SymbolList::Entry entries[] = {
-
+static const SymbolList::Entry entries[] = {^J
<
.,W.Xa 0KK
I#ifdef Qa^J^I{"Qa", Qa},^J#endif^J
.-Z;>
I};
-SymbolList Symbols::Q#na(entries, G_N_ELEMENTS(entries));
+SymbolList Symbols::Q[getopt.n](entries, G_N_ELEMENTS(entries));
-} /* namespace SciTECO */
-
+} /* namespace SciTECO */^J
-! write output file !
+!* write output file *!
EWQ#ou
EX