diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2013-02-24 13:34:10 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2013-02-24 13:34:10 +0100 |
commit | e3ea9032f6e3105d9c0a720db8bc413b4a3e016f (patch) | |
tree | 8959b4c197a16f034756574501e75bf5450e17c5 | |
parent | f5253185aa55a46cb3da80f66e7127a45c82052f (diff) | |
download | sciteco-e3ea9032f6e3105d9c0a720db8bc413b4a3e016f.tar.gz |
moved QuickSort macros from symbols-extract script into own string.tes macro library
* therefore for bootstrapping to work, the SCITECOPATH is always set explicitly
-rw-r--r-- | bootstrap.am | 5 | ||||
-rw-r--r-- | lib/Makefile.am | 1 | ||||
-rw-r--r-- | lib/string.tes | 45 | ||||
-rwxr-xr-x | src/symbols-extract.tes | 44 |
4 files changed, 50 insertions, 45 deletions
diff --git a/bootstrap.am b/bootstrap.am index 58a1aa1..fa15770 100644 --- a/bootstrap.am +++ b/bootstrap.am @@ -1,7 +1,8 @@ +BOOTSTRAP_SCITECO = SCITECOPATH=@top_srcdir@/lib if BOOTSTRAP -BOOTSTRAP_SCITECO = @top_builddir@/src/sciteco-minimal$(EXEEXT) +BOOTSTRAP_SCITECO += @top_builddir@/src/sciteco-minimal$(EXEEXT) else -BOOTSTRAP_SCITECO = @SCITECO@ +BOOTSTRAP_SCITECO += @SCITECO@ endif SUBST_MACRO = eb$<\e \ diff --git a/lib/Makefile.am b/lib/Makefile.am index 6bfb55a..5ac3d33 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,2 +1,3 @@ dist_scitecolib_DATA = lexer.tes fnkeys.tes +dist_scitecolib_DATA += string.tes diff --git a/lib/string.tes b/lib/string.tes new file mode 100644 index 0000000..274873b --- /dev/null +++ b/lib/string.tes @@ -0,0 +1,45 @@ +! String utility macros ! + +! <pos1,pos2>M{symcasecmp} - Compare symbol at pos1 with symbol at pos2 (caseless) ! +@{symcasecmp}{ + U.2U.1 -.%.1 -.%.2 + @.#lo{ + U.v Q.v"W a-A%.v | Q.v"CQ.v|0' ' + } + <Q.1A:M.#loU.a Q.2A:M.#loU.b + Q.a-Q.bU.c Q.c"N;' -Q.a; + %.1%.2> + Q.c +} + +! <i,j>M{exchange} - Exchange line at I with line at J (I < J), returning new J ! +@{exchange}{ + U.jU.i + Q.jJ X.xK + Q.iJ G.x .-Q.i%.j .-(X.xL.)%.j -K + Q.jJ G.x + Q.j +} + +! <i,j>M{qsort} - Sort lines beginning at I until J using Quicksort algorithm ! +@{qsort}{ + U.rU.l + + Q.l-Q.r"< + Q.lU.i Q.rJB .U.j + + < + Q.iJ <.,Q.rM{symcasecmp}-1; .-Q.r; L> .U.i + Q.jJ <.,Q.rM{symcasecmp}:; .-Q.l-1:; B> .U.j + + Q.i-Q.j; + + Q.i,Q.jM{exchange}U.j + > + + Q.i,Q.rM{symcasecmp}"> Q.i,Q.rM{exchange}U.r ' + + Q.l-Q.i"< Q.iJB Q.l,.M{qsort} ' + Q.i-Q.r"< Q.iJL .,Q.rM{qsort} ' + ' +} diff --git a/src/symbols-extract.tes b/src/symbols-extract.tes index 48d749c..6e09380 100755 --- a/src/symbols-extract.tes +++ b/src/symbols-extract.tes @@ -1,49 +1,7 @@ #!./sciteco-minimal -m ! ./symbols-extract.tes <input file> <output file> <prefix pattern list> <array name> ! -! <pos1,pos2>M{symcasecmp} - Compare symbol at pos1 with symbol at pos2 (caseless) ! -@{symcasecmp}{ - U.2U.1 -.%.1 -.%.2 - @.#lo{ - U.v Q.v"W a-A%.v | Q.v"CQ.v|0' ' - } - <Q.1A:M.#loU.a Q.2A:M.#loU.b - Q.a-Q.bU.c Q.c"N;' -Q.a; - %.1%.2> - Q.c -} - -! <i,j>M{exchange} - Exchange line at I with line at J (I < J), returning new J ! -@{exchange}{ - U.jU.i - Q.jJ X.xK - Q.iJ G.x .-Q.i%.j .-(X.xL.)%.j -K - Q.jJ G.x - Q.j -} - -! <i,j>M{qsort} - Sort lines beginning at I until J using Quicksort algorithm ! -@{qsort}{ - U.rU.l - - Q.l-Q.r"< - Q.lU.i Q.rJB .U.j - - < - Q.iJ <.,Q.rM{symcasecmp}-1; .-Q.r; L> .U.i - Q.jJ <.,Q.rM{symcasecmp}:; .-Q.l-1:; B> .U.j - - Q.i-Q.j; - - Q.i,Q.jM{exchange}U.j - > - - Q.i,Q.rM{symcasecmp}"> Q.i,Q.rM{exchange}U.r ' - - Q.l-Q.i"< Q.iJB Q.l,.M{qsort} ' - Q.i-Q.r"< Q.iJL .,Q.rM{qsort} ' - ' -} +[.m EQ.mQ{$SCITECOPATH}/string.tes M.m ].m ! read commandline arguments ! LR 0X#in 2LR 0X#ou 2LR 0X#pa 2LR 0X#na HK |