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