From b08d5e7dad907493bc6946ab708640b567e2dffe Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Fri, 15 Feb 2013 05:26:16 +0100 Subject: install standard macros into special standard library path (pkgdatadir/lib) * SCITECOPATH environment variable defaults to this directory * manpage updated * default teco.ini updated: no need to generate it anymore --- Makefile.am | 11 ++-- bootstrap.am | 1 + configure.ac | 7 ++- doc/sciteco.1.in | 21 ++++++++ lexer.tes | 150 ------------------------------------------------------- lib/Makefile.am | 2 + lib/lexer.tes | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/Makefile.am | 2 +- src/main.cpp | 6 ++- teco.ini | 18 +++++++ teco.ini.in | 18 ------- 11 files changed, 207 insertions(+), 179 deletions(-) delete mode 100644 lexer.tes create mode 100644 lib/Makefile.am create mode 100644 lib/lexer.tes create mode 100644 teco.ini delete mode 100644 teco.ini.in diff --git a/Makefile.am b/Makefile.am index db0a39b..e94317d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,16 +1,11 @@ -include $(top_srcdir)/bootstrap.am +SUBDIRS = src lib doc -SUBDIRS = src doc - -pkgdata_DATA = teco.ini -EXTRA_DIST = teco.ini.in -CLEANFILES = teco.ini -dist_pkgdata_DATA = lexer.tes +dist_pkgdata_DATA = teco.ini noinst_HEADERS = compat/bsd/sys/cdefs.h \ compat/bsd/sys/queue.h \ compat/bsd/sys/tree.h -EXTRA_DIST += patches/scintilla-teco-control-codes.patch +EXTRA_DIST = patches/scintilla-teco-control-codes.patch EXTRA_DIST += TODO diff --git a/bootstrap.am b/bootstrap.am index dabf475..2fc6285 100644 --- a/bootstrap.am +++ b/bootstrap.am @@ -11,6 +11,7 @@ SUBST_MACRO = eb$<\e \ j \ j \ j \ + j \ j \ ew$@\e diff --git a/configure.ac b/configure.ac index 4a9d500..f3da0b5 100644 --- a/configure.ac +++ b/configure.ac @@ -15,6 +15,10 @@ AC_CONFIG_HEADERS([config.h]) AC_CANONICAL_BUILD AC_CANONICAL_HOST +# Standard macro path ($SCITECOPATH) +scitecopathdir=$datadir/$PACKAGE/lib +AC_SUBST(scitecopathdir) + # Checks for programs. LT_INIT AC_PROG_CXX @@ -154,5 +158,6 @@ AC_ARG_ENABLE(bootstrap, [bootstrap=$enableval]) AM_CONDITIONAL(BOOTSTRAP, [test x$bootstrap = xyes]) -AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile]) +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([src/Makefile lib/Makefile doc/Makefile]) AC_OUTPUT diff --git a/doc/sciteco.1.in b/doc/sciteco.1.in index 8e9b88f..ea28c98 100644 --- a/doc/sciteco.1.in +++ b/doc/sciteco.1.in @@ -128,6 +128,27 @@ Default is batch mode processing. . . +.SH ENVIRONMENT +. +Before \*(ST executes any macro, all of the variables in the process +environment are inserted into the global +.I Q-Register +table. +A dollar sign is prepended before each variable name, so that for +instance the variable \(lqHOME\(rq can be examined by macros by +reading the string-content of Q-Register \(lq$HOME\(rq. +The following environment variables have a special meaning for +\*(ST: +.TP +.B SCITECOPATH +Standard library macro path. +Macros can expect to find standard library macros in this +directory. +Therefore if undefined it defaults to the standard library +installation directory +.BR "@scitecopathdir@" . +. +. .SH FILES . .TP diff --git a/lexer.tes b/lexer.tes deleted file mode 100644 index cc8dffb..0000000 --- a/lexer.tes +++ /dev/null @@ -1,150 +0,0 @@ -! Lexer configuration and styles (ED hook) ! - -[_ U.0 Q.0Oadd,edit,close,quit - -!add! -! black, red, green, yellow, blue, magenta, cyan, white ! -@.c{ - U.c ((Q.c&1)*255) # ((Q.c/2 & 1)*255*256) # ((Q.c/4 & 1)*255*256*256) -} - -! M.r ! -@.r{ - U.sU.vU.bU.h - Q.v:M.c,Q.sESSTYLESETFORE - Q.b:M.c,Q.sESSTYLESETBACK - Q.h,Q.sESSTYLESETBOLD -} - -! Bracelight ! 0,7,0,34:M.r -! Bracebad ! 1,0,1,35:M.r - -EQ* HX.f EQ.f ZJ i J - -! C/C++ ! -:S.[c,cc,cpp,cxx,h,hh,hpp,hxx,ipp,m,mm,sma]"S - -D EBQ.f - ESSETLEXER,SCLEX_CPP - 0ESSETKEYWORDS - and and_eq asm auto bitand bitor bool break - case catch char class compl const const_cast continue - default delete do double dynamic_cast else enum explicit export extern false float for - friend goto if inline int long mutable namespace new not not_eq - operator or or_eq private protected public - register reinterpret_cast return short signed sizeof static static_cast struct switch - template this throw true try typedef typeid typename union unsigned using - virtual void volatile wchar_t while xor xor_eq - ! Doxygen keywords ! - 2ESSETKEYWORDS - a addindex addtogroup anchor arg attention - author b brief bug c class code date def defgroup deprecated dontinclude - e em endcode endhtmlonly endif endlatexonly endlink endverbatim enum example exception - f$ f[ f] file fn hideinitializer htmlinclude htmlonly - if image include ingroup internal invariant interface latexonly li line link - mainpage name namespace nosubgrouping note overload - p page par param post pre ref relates remarks return retval - sa section see showinitializer since skip skipline struct subsection - test throw todo typedef union until - var verbatim verbinclude version warning weakgroup $ @ \ & < > # { } - ! Comments ! 1,0,0,1:M.r 1,0,0,2:M.r 1,0,0,3:M.r - ! Number ! 0,0,6,4:M.r - ! Keywords ! 1,0,7,5:M.r - ! Strings ! 0,0,2,6:M.r 0,0,2,7:M.r - ! Preprocessor ! 0,0,5,9:M.r - ! Operators ! 0,0,3,10:M.r -Oedit' - -:S[makefile,.mak]"S - -D EBQ.f - ESSETLEXER,SCLEX_MAKEFILE - ! Comments ! 1,0,0,1:M.r - ! Preprocessor ! 0,0,5,2:M.r - ! Variables ! 1,0,4,3:M.r - ! Operators ! 0,0,3,4:M.r - ! Target ! 1,0,3,5:M.r - ! Error ! 1,0,1,6:M.r -Oedit' - -:S.[diff,patch]"S - -D EBQ.f - ESSETLEXER,SCLEX_DIFF - ! Comments ! 1,0,0,1:M.r - ! Command ! 1,0,7,2:M.r - ! Source/Dest ! 0,0,4,3:M.r - ! Position @@ ! 1,0,4,4:M.r - ! Deletion ! 1,0,1,5:M.r - ! Addition ! 1,0,2,6:M.r - ! Change ! 1,0,3,7:M.r -Oedit' - -:S[.sh,.bsh,configure,.ksh]"S - -D EBQ.f - ESSETLEXER,SCLEX_BASH - 0ESSETKEYWORDS - alias ar asa awk banner basename bash bc bdiff break - bunzip2 bzip2 cal calendar case cat cc cd chmod cksum - clear cmp col comm compress continue cp cpio crypt - csplit ctags cut date dc dd declare deroff dev df diff diff3 - dircmp dirname do done du echo ed egrep elif else env - esac eval ex exec exit expand export expr false fc - fgrep fi file find fmt fold for function functions - getconf getopt getopts grep gres hash head help - history iconv id if in integer jobs join kill local lc - let line ln logname look ls m4 mail mailx make - man mkdir more mt mv newgrp nl nm nohup ntps od - pack paste patch pathchk pax pcat perl pg pr print - printf ps pwd read readonly red return rev rm rmdir - sed select set sh shift size sleep sort spell - split start stop strings strip stty sum suspend - sync tail tar tee test then time times touch tr - trap true tsort tty type typeset ulimit umask unalias - uname uncompress unexpand uniq unpack unset until - uudecode uuencode vi vim vpax wait wc whence which - while who wpaste wstart xargs zcat - - chgrp chown chroot dir dircolors - factor groups hostid install link md5sum mkfifo - mknod nice pinky printenv ptx readlink seq - sha1sum shred stat su tac unlink users vdir whoami yes - ! Error ! 1,0,1,1:M.r - ! Comments ! 1,0,0,2:M.r - ! Numbers ! 0,0,6,3:M.r - ! Keywords ! 1,0,7,4:M.r - ! Strings ! 0,0,2,5:M.r 0,0,2,6:M.r - ! Operators ! 0,0,3,7:M.r - ! Identifiers ! 0,0,4,8:M.r - ! Variables $ ! 1,0,4,9:M.r 1,0,4,10:M.r - ! Backticks ! 0,0,2,11:M.r -Oedit' - -:S.[bat,cmd,nt]"S - -D EBQ.f - ESSETLEXER,SCLEX_BATCH - 0ESSETKEYWORDS - rem set if exist errorlevel for in do - break call chcp cd chdir choice cls country ctty date del erase dir echo - exit goto loadfix loadhigh mkdir md move path pause prompt rename ren - rmdir rd shift time type ver verify vol - com con lpt nul - color copy defined else not start - ! Comments ! 1,0,0,1:M.r - ! Keywords ! 1,0,7,2:M.r - ! Labels ! 1,0,1,3:M.r - ! Hide Cmd @ ! 0,0,5,4:M.r - ! External Cmd ! 0,0,4,5:M.r - ! Variables ! 1,0,4,6:M.r - ! Operators ! 0,0,3,7:M.r -Oedit' - -Z-1,ZD EBQ.f -! fall through ! - -!edit! -!close! -!quit! -! fall through ! - -!end! -! Dispatch to user-defined macro 1 ! -Q.0M1 -]_ diff --git a/lib/Makefile.am b/lib/Makefile.am new file mode 100644 index 0000000..89c5e94 --- /dev/null +++ b/lib/Makefile.am @@ -0,0 +1,2 @@ + +dist_scitecopath_DATA = lexer.tes diff --git a/lib/lexer.tes b/lib/lexer.tes new file mode 100644 index 0000000..cc8dffb --- /dev/null +++ b/lib/lexer.tes @@ -0,0 +1,150 @@ +! Lexer configuration and styles (ED hook) ! + +[_ U.0 Q.0Oadd,edit,close,quit + +!add! +! black, red, green, yellow, blue, magenta, cyan, white ! +@.c{ + U.c ((Q.c&1)*255) # ((Q.c/2 & 1)*255*256) # ((Q.c/4 & 1)*255*256*256) +} + +! M.r ! +@.r{ + U.sU.vU.bU.h + Q.v:M.c,Q.sESSTYLESETFORE + Q.b:M.c,Q.sESSTYLESETBACK + Q.h,Q.sESSTYLESETBOLD +} + +! Bracelight ! 0,7,0,34:M.r +! Bracebad ! 1,0,1,35:M.r + +EQ* HX.f EQ.f ZJ i J + +! C/C++ ! +:S.[c,cc,cpp,cxx,h,hh,hpp,hxx,ipp,m,mm,sma]"S + -D EBQ.f + ESSETLEXER,SCLEX_CPP + 0ESSETKEYWORDS + and and_eq asm auto bitand bitor bool break + case catch char class compl const const_cast continue + default delete do double dynamic_cast else enum explicit export extern false float for + friend goto if inline int long mutable namespace new not not_eq + operator or or_eq private protected public + register reinterpret_cast return short signed sizeof static static_cast struct switch + template this throw true try typedef typeid typename union unsigned using + virtual void volatile wchar_t while xor xor_eq + ! Doxygen keywords ! + 2ESSETKEYWORDS + a addindex addtogroup anchor arg attention + author b brief bug c class code date def defgroup deprecated dontinclude + e em endcode endhtmlonly endif endlatexonly endlink endverbatim enum example exception + f$ f[ f] file fn hideinitializer htmlinclude htmlonly + if image include ingroup internal invariant interface latexonly li line link + mainpage name namespace nosubgrouping note overload + p page par param post pre ref relates remarks return retval + sa section see showinitializer since skip skipline struct subsection + test throw todo typedef union until + var verbatim verbinclude version warning weakgroup $ @ \ & < > # { } + ! Comments ! 1,0,0,1:M.r 1,0,0,2:M.r 1,0,0,3:M.r + ! Number ! 0,0,6,4:M.r + ! Keywords ! 1,0,7,5:M.r + ! Strings ! 0,0,2,6:M.r 0,0,2,7:M.r + ! Preprocessor ! 0,0,5,9:M.r + ! Operators ! 0,0,3,10:M.r +Oedit' + +:S[makefile,.mak]"S + -D EBQ.f + ESSETLEXER,SCLEX_MAKEFILE + ! Comments ! 1,0,0,1:M.r + ! Preprocessor ! 0,0,5,2:M.r + ! Variables ! 1,0,4,3:M.r + ! Operators ! 0,0,3,4:M.r + ! Target ! 1,0,3,5:M.r + ! Error ! 1,0,1,6:M.r +Oedit' + +:S.[diff,patch]"S + -D EBQ.f + ESSETLEXER,SCLEX_DIFF + ! Comments ! 1,0,0,1:M.r + ! Command ! 1,0,7,2:M.r + ! Source/Dest ! 0,0,4,3:M.r + ! Position @@ ! 1,0,4,4:M.r + ! Deletion ! 1,0,1,5:M.r + ! Addition ! 1,0,2,6:M.r + ! Change ! 1,0,3,7:M.r +Oedit' + +:S[.sh,.bsh,configure,.ksh]"S + -D EBQ.f + ESSETLEXER,SCLEX_BASH + 0ESSETKEYWORDS + alias ar asa awk banner basename bash bc bdiff break + bunzip2 bzip2 cal calendar case cat cc cd chmod cksum + clear cmp col comm compress continue cp cpio crypt + csplit ctags cut date dc dd declare deroff dev df diff diff3 + dircmp dirname do done du echo ed egrep elif else env + esac eval ex exec exit expand export expr false fc + fgrep fi file find fmt fold for function functions + getconf getopt getopts grep gres hash head help + history iconv id if in integer jobs join kill local lc + let line ln logname look ls m4 mail mailx make + man mkdir more mt mv newgrp nl nm nohup ntps od + pack paste patch pathchk pax pcat perl pg pr print + printf ps pwd read readonly red return rev rm rmdir + sed select set sh shift size sleep sort spell + split start stop strings strip stty sum suspend + sync tail tar tee test then time times touch tr + trap true tsort tty type typeset ulimit umask unalias + uname uncompress unexpand uniq unpack unset until + uudecode uuencode vi vim vpax wait wc whence which + while who wpaste wstart xargs zcat + + chgrp chown chroot dir dircolors + factor groups hostid install link md5sum mkfifo + mknod nice pinky printenv ptx readlink seq + sha1sum shred stat su tac unlink users vdir whoami yes + ! Error ! 1,0,1,1:M.r + ! Comments ! 1,0,0,2:M.r + ! Numbers ! 0,0,6,3:M.r + ! Keywords ! 1,0,7,4:M.r + ! Strings ! 0,0,2,5:M.r 0,0,2,6:M.r + ! Operators ! 0,0,3,7:M.r + ! Identifiers ! 0,0,4,8:M.r + ! Variables $ ! 1,0,4,9:M.r 1,0,4,10:M.r + ! Backticks ! 0,0,2,11:M.r +Oedit' + +:S.[bat,cmd,nt]"S + -D EBQ.f + ESSETLEXER,SCLEX_BATCH + 0ESSETKEYWORDS + rem set if exist errorlevel for in do + break call chcp cd chdir choice cls country ctty date del erase dir echo + exit goto loadfix loadhigh mkdir md move path pause prompt rename ren + rmdir rd shift time type ver verify vol + com con lpt nul + color copy defined else not start + ! Comments ! 1,0,0,1:M.r + ! Keywords ! 1,0,7,2:M.r + ! Labels ! 1,0,1,3:M.r + ! Hide Cmd @ ! 0,0,5,4:M.r + ! External Cmd ! 0,0,4,5:M.r + ! Variables ! 1,0,4,6:M.r + ! Operators ! 0,0,3,7:M.r +Oedit' + +Z-1,ZD EBQ.f +! fall through ! + +!edit! +!close! +!quit! +! fall through ! + +!end! +! Dispatch to user-defined macro 1 ! +Q.0M1 +]_ diff --git a/src/Makefile.am b/src/Makefile.am index 9f40524..60cb387 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/bootstrap.am AM_CFLAGS = -Wall -std=c99 AM_CXXFLAGS = -Wall -AM_CPPFLAGS = +AM_CPPFLAGS = -D'DEFAULT_SCITECOPATH="@scitecopathdir@"' if NEED_COMPAT AM_CPPFLAGS += -I@top_srcdir@/compat endif diff --git a/src/main.cpp b/src/main.cpp index c1da584..2834709 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -168,7 +168,11 @@ process_options(int &argc, char **&argv) static inline void initialize_environment(void) { - gchar **environ = g_get_environ(); + gchar **environ; + + g_setenv("SCITECOPATH", DEFAULT_SCITECOPATH, FALSE); + + environ = g_get_environ(); for (gchar **p = environ; *p; p++) { gchar *value = strchr(*p, '=') + 1; diff --git a/teco.ini b/teco.ini new file mode 100644 index 0000000..5b4c752 --- /dev/null +++ b/teco.ini @@ -0,0 +1,18 @@ +! TECO.INI ! + +EQ0Q{$SCITECOPATH}/lexer.tes +@1{ + ! lexer.tes calls this ! +} +ED#32ED + +! margins ! +5,0ESSETMARGINWIDTHN +0,1ESSETMARGINWIDTHN +1,2ESSETMARGINWIDTHN + +! open all files specified on the commandline ! +[.f + <:L;R 0X.f EBQ.f EB L> +].f +-EF diff --git a/teco.ini.in b/teco.ini.in deleted file mode 100644 index fcf344a..0000000 --- a/teco.ini.in +++ /dev/null @@ -1,18 +0,0 @@ -! TECO.INI ! - -EQ0@pkgdatadir@/lexer.tes -@1{ - ! lexer.tes calls this ! -} -ED#32ED - -! margins ! -5,0ESSETMARGINWIDTHN -0,1ESSETMARGINWIDTHN -1,2ESSETMARGINWIDTHN - -! open all files specified on the commandline ! -[.f - <:L;R 0X.f EBQ.f EB L> -].f --EF -- cgit v1.2.3