aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/symbols-extract.tes
blob: 356bdd1941f1e1bc3c401f9bb62fce661fdae34f (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
#!/usr/local/bin/sciteco -m
!*
 * ./symbols-extract.tes [-p <prefix pattern list>] -n <SymbolList object> [--] \
 *                       <output file> <input header>
 *!

0,2EJ !* FIXME: Memory limiting is too slow *!

:EMQ[$SCITECOPATH]/getopt.tes
EMQ[$SCITECOPATH]/string.tes

!* 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 *!
EBN#in <S#defineS[Q[getopt.p]]; -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 const teco_symbol_entry_t entries[] = {^J
<
  .,W.Xa 0KK
  I#ifdef Qa^J^I{"Qa", Qa},^J#endif^J
.-Z;>
I};

static void __attribute__((constructor))
teco_symbols_init(void)
{
	teco_symbol_list_init(&Q[getopt.n], entries, G_N_ELEMENTS(entries), FALSE);
}

#ifndef NDEBUG
static void __attribute__((destructor))
teco_cmdline_cleanup(void)
{
	teco_symbol_list_clear(&Q[getopt.n]);
}
#endif^J

!* write output file *!
EWQ#ou

EX