chiark / gitweb /
document tcmdifgen (and split from app, in theory)
[chiark-tcl.git] / base / tables-examples.tct
1 Type hb:                        HBytes_Value @
2 Init hb                         hbytes_sentinel(&@);
3
4 Type hbv:                       HBytes_Var @
5 Init hbv                        @.hb=0; @.obj=0; @.var=0; @.copied=0;
6 Fini hbv                        fini_hbv(ip, rc, &@);
7
8 Type sockaddr:                  SockAddr_Value @
9 Init sockaddr                   sockaddr_clear(&@);
10
11 Type iddata(IdDataTable *tab):  void *@
12 Type ulong:                     uint32_t @
13 Type long:                      long @
14 Type string:                    const char *@
15
16 Type charfrom(const char *opts, const char *what):      int
17
18 H-Include       "hbytes.h"
19
20 Table toplevel TopLevel_Command
21         hbytes
22                 subcmd  enum(HBytes_SubCommand, "hbytes subcommand")
23                 ...     obj
24         dgram-socket
25                 subcmd  enum(DgramSocket_SubCommand,"dgram-socket subcommand")
26                 ...     obj
27         tuntap-socket-raw
28             subcmd enum(TunSocket_SubCommand,"tuntap-socket-raw subcommand")
29             ... obj
30         ulong
31                 subcmd  enum(ULong_SubCommand,"ulong subcommand")
32                 ...     obj
33
34 Table ulong ULong_SubCommand
35         ul2int
36                 v       ulong
37                 =>      int
38         int2ul
39                 v       int
40                 =>      ulong
41         mask
42                 a       ulong
43                 b       ulong
44                 =>      ulong
45         add
46                 a       ulong
47                 b       ulong
48                 =>      ulong
49         multiply
50                 a       ulong
51                 b       ulong
52                 =>      ulong
53         subtract
54                 a       ulong
55                 b       ulong
56                 =>      ulong
57         compare
58                 a       ulong
59                 b       ulong
60                 =>      int
61         shift
62                 right   charfrom("lr", "shift direction")
63                 v       ulong
64                 bits    int
65                 =>      ulong
66         ul2bitfields
67                 value   ulong
68                 ...     obj
69                 =>      int
70         bitfields2ul
71                 base    ulong
72                 ...     obj
73                 =>      ulong
74
75 Table hbytes HBytes_SubCommand
76         raw2h
77                 binary  obj
78                 =>      hb
79         h2raw
80                 hex     hb
81                 =>      obj
82         ushort2h
83                 value   long
84                 =>      hb
85         h2ushort
86                 hex     hb
87                 =>      long
88         length
89                 v       hb
90                 =>      int
91         compare
92                 a       hb
93                 b       hb
94                 =>      int
95         range
96                 v       hb
97                 start   int
98                 size    int
99                 =>      hb
100         prepend
101                 v       hbv
102                 ...     str
103         append
104                 v       hbv
105                 ...     str
106         rep-info
107                 v       obj
108                 =>      obj
109         concat
110                 ...     str
111                 =>      hb
112         unprepend
113                 v       hbv
114                 length  int
115                 =>      hb
116         unappend
117                 v       hbv
118                 length  int
119                 =>      hb
120         chopto
121                 v       hbv
122                 length  int
123                 =>      hb
124         overwrite
125                 v       hbv
126                 start   int
127                 sub     hb
128         trimleft
129                 v       hbv
130         zeroes
131                 length  int
132                 =>      hb
133         repeat
134                 v       hb
135                 count   int
136                 =>      hb
137         xor
138                 v       hbv
139                 d       hb
140         random
141                 length  int
142                 =>      hb
143         pad
144                 op      enum(PadOp, "hbytes pad subcommand")
145                 v       hbv
146                 blocksz obj
147                 meth    enum(PadMethodInfo, "pad method")
148                 ...     methargs
149         blockcipher
150                 op      enum(BlockCipherOp, "op")
151                 ...     obj
152         hash
153                 alg     enum(HashAlgInfo, "hash alg")
154                 message hb
155                 =>      hb
156         hmac
157                 alg     enum(HashAlgInfo, "hash alg for hmac")
158                 message hb
159                 key     obj
160                 ?maclen obj
161                 =>      hb
162         hash-prop
163                 prop    enum(HashAlgPropInfo, "prop")
164                 alg     enum(HashAlgInfo, "alg")
165                 =>      int
166
167 Table padmethodinfo PadMethodInfo
168         pkcs5
169                 =>      int
170         rfc2406
171                 nxthdr  obj
172                 =>      int
173
174 Table dgram_socket DgramSocket_SubCommand
175         create
176                 local   sockaddr
177                 =>      iddata(&dgram_socks)
178         close
179                 sock    iddata(&dgram_socks)
180         transmit
181                 sock    iddata(&dgram_socks)
182                 data    hb
183                 remote  sockaddr
184         on-receive
185                 sock    iddata(&dgram_socks)
186                 ?script obj
187
188 Table tuntap_socket_raw TunSocket_SubCommand
189         create
190                 ?ifname string
191                 =>      iddata(&tuntap_socks)
192         close
193                 sock    iddata(&tuntap_socks)
194         ifname
195                 sock    iddata(&tuntap_socks)
196                 =>      string
197         receive
198                 sock    iddata(&tuntap_socks)
199                 data    hb
200         on-transmit
201                 sock    iddata(&tuntap_socks)
202                 mtu     long
203                 ?script obj
204
205 Table blockcipherop BlockCipherOp
206         e       1
207                 v       hbv
208                 alg     enum(BlockCipherAlgInfo, "alg")
209                 key     obj
210                 mode    enum(BlockCipherModeInfo, "mode")
211                 ?iv     hb
212                 =>      hb
213         d       0
214                 v       hbv
215                 alg     enum(BlockCipherAlgInfo, "alg")
216                 key     obj
217                 mode    enum(BlockCipherModeInfo, "mode")
218                 ?iv     hb
219                 =>      hb
220         mac     -1
221                 msg     hb
222                 alg     enum(BlockCipherAlgInfo, "alg")
223                 key     obj
224                 mode    enum(BlockCipherModeInfo, "mode")
225                 iv      hb
226                 =>      hb
227         prop    -1
228                 prop    enum(BlockCipherPropInfo, "prop")
229                 alg     enum(BlockCipherAlgInfo, "alg")
230                 =>      int
231
232 EntryExtra BlockCipherOp
233         int encrypt;