aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/symbols-extract.tes
blob: 48d749c7a3af9ec71b85a13de0e6bb73fb6ca289 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!./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} '
  '
}

! read commandline arguments !
LR 0X#in 2LR 0X#ou 2LR 0X#pa 2LR 0X#na HK

! copy all defines in input file beginning with prefix !
EBQ#in <S#defineS[Q#pa]; -SS :Xa> EF

! sort all defines !
Ga ZJB 0,.M{qsort} J

! format as C/C++ array !
I/*
 * AUTOGENERATED FROM Q#in
 * DO NOT EDIT
 */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <glib.h>

#include "Q#in"
#include "sciteco.h"
#include "symbols.h"

static class SymbolListInitializer_Q#na {
	static const SymbolList::Entry entries[];

public:
	SymbolListInitializer_Q#na();
} initializer INIT_PRIO(PRIO_SYMBOLS);

const SymbolList::Entry SymbolListInitializer_Q#na::entries[] = {

<
  .,W.Xa 0KK
  I#ifdef Qa
	{"Qa", Qa},
#endif

.-Z;>
I};

SymbolListInitializer_Q#na::SymbolListInitializer_Q#na()
{
	Symbols::Q#na.entries = entries;
	Symbols::Q#na.size = G_N_ELEMENTS(entries);
}


! write output file !
EWQ#ou

EX