aboutsummaryrefslogtreecommitdiffhomepage
path: root/symbols-extract.tes
diff options
context:
space:
mode:
Diffstat (limited to 'symbols-extract.tes')
-rwxr-xr-xsymbols-extract.tes80
1 files changed, 80 insertions, 0 deletions
diff --git a/symbols-extract.tes b/symbols-extract.tes
new file mode 100755
index 0000000..08ab2d7
--- /dev/null
+++ b/symbols-extract.tes
@@ -0,0 +1,80 @@
+#!./sciteco-minimal -m
+! ./symbols-extract.tes <input file> <output file> <prefix> <array name> !
+
+! <pos1,pos2>Mc - Compare string at pos1 with string at pos2 !
+@^Uc{
+ U.2U.1 -.%.1^[ -.%.2^[
+ <Q.1A-(Q.2A)U.c Q.1A"A|Q.2A"A|;'' Q.c"N;' %.1^[%.2>
+ Q.c
+}
+
+! <i,j>Mx - Exchange line at I with line at J (I < J), returning new J !
+@^Ux{
+ 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>Mq - Sort lines beginning at I until J using Quicksort algorithm !
+@^Uq{
+ U.rU.l
+
+ Q.l-Q.r"<
+ Q.lU.i Q.rJB .U.j
+
+ <
+ Q.iJ <.,Q.rMc-1; .-Q.r; L> .U.i
+ Q.jJ <.,Q.rMc:; .-Q.l-1:; B> .U.j
+
+ Q.i-Q.j;
+
+ Q.i,Q.jMxU.j
+ >
+
+ Q.i,Q.rMc"> Q.i,Q.rMxU.r '
+
+ Q.l-Q.i"< Q.iJB Q.l,.Mq '
+ Q.i-Q.r"< Q.iJL .,Q.rMq '
+ '
+}
+
+! read commandline arguments !
+LR 0Xi 2LR 0Xo 2LR 0Xp 2LR 0Xn HK
+
+! copy all defines in input file beginning with prefix !
+EBQi <S#define^SQp; :Xa> EF
+
+! sort all defines !
+Ga ZJB 0,.Mq J
+
+! format as C/C++ array !
+I/*
+ * AUTOGENERATED - DO NOT EDIT
+ */
+#include <glib.h>
+
+#include "Qi"
+#include "symbols.h"
+
+static const SymbolList::Entry entries[] = {
+
+<
+ .,W.Xa 0K
+ I#ifdef QpQa
+
+ ^I{"Qa", V I ^EQp^EQa},
+#endif
+ L .-Z;
+>
+I};
+
+/* overwrites weak object in symbols.cpp */
+SymbolList Symbols::Qn(entries, G_N_ELEMENTS(entries));
+
+
+! write output file !
+EWQo
+
+EX