chiark / gitweb /
does modexps, makes signatures, needs sane hexstring handling
[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;
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:                     unsigned long @
13
14 H-Include       "hbytes.h"
15
16 Table toplevel TopLevel_Command
17         hbytes
18                 subcmd  enum(HBytes_SubCommand, "hbytes subcommand")
19                 ...     obj
20         dgram-socket
21                 subcmd  enum(DgramSocket_SubCommand,"dgram-socket subcommand")
22                 ...     obj
23         ulong
24                 subcmd  enum(ULong_SubCommand,"ulong subcommand")
25                 ...     obj
26
27 Table ulong ULong_SubCommand
28         shift
29                 right   charfrom("lr", "shift direction")
30                 v       ulong
31                 bits    int
32                 =>      ulong
33         mask
34                 a       ulong
35                 b       ulong
36                 =>      ulong
37         compare
38                 a       ulong
39                 b       ulong
40                 =>      int
41         ul2int
42                 v       ulong
43                 =>      int
44         int2ul
45                 v       int
46                 =>      ulong
47         ul2bitfields
48                 value   ulong
49                 ...     obj
50                 =>      int
51         bitfields2ul
52                 base    ulong
53                 ...     obj
54                 =>      ulong
55
56 Table hbytes HBytes_SubCommand
57         raw2h
58                 binary  obj
59                 =>      hb
60         h2raw
61                 hex     hb
62                 =>      obj
63         ulong2h
64                 value   ulong
65                 =>      hb
66         h2ulong
67                 hex     hb
68                 =>      ulong
69         ushort2h
70                 value   ulong
71                 =>      hb
72         h2ushort
73                 hex     hb
74                 =>      ulong
75         length
76                 v       hb
77                 =>      int
78         compare
79                 a       hb
80                 b       hb
81                 =>      int
82         range
83                 v       hb
84                 start   int
85                 size    int
86                 =>      hb
87         prepend
88                 v       hbv
89                 ...     str
90         append
91                 v       hbv
92                 ...     str
93         rep-info
94                 v       obj
95                 =>      obj
96         concat
97                 ...     str
98                 =>      hb
99         unprepend
100                 v       hbv
101                 length  int
102                 =>      hb
103         unappend
104                 v       hbv
105                 length  int
106                 =>      hb
107         chopto
108                 v       hbv
109                 length  int
110                 =>      hb
111         overwrite
112                 v       hbv
113                 start   int
114                 sub     hb
115         trimleft
116                 v       hbv
117         zeroes
118                 length  int
119                 =>      hb
120         repeat
121                 v       hb
122                 count   int
123                 =>      hb
124         random
125                 length  int
126                 =>      hb
127         pkcs5
128                 meth    enum(PadMethod, "hbytes pad subcommand")
129                 v       hbv
130                 block   obj
131                 =>      int
132         blockcipher
133                 encrypt charfrom("de","encrypt/decrypt")
134                 v       hbv
135                 alg     enum(BlockCipherAlgInfo, "alg")
136                 key     obj
137                 mode    enum(BlockCipherModeInfo, "mode")
138                 ?iv     hb
139                 =>      hb
140         hash
141                 alg     enum(HashAlgInfo, "hash alg")
142                 message hb
143                 =>      hb
144         hmac
145                 alg     enum(HashAlgInfo, "hash alg for hmac")
146                 message hb
147                 key     obj
148                 ?maclen obj
149                 =>      hb
150
151 Table dgram_socket DgramSocket_SubCommand
152         create
153                 local   sockaddr
154                 =>      sockid
155         close
156                 sock    sockid
157         transmit
158                 sock    sockid
159                 data    hb
160                 remote  sockaddr
161         on-receive
162                 sock    sockid
163                 ?script obj