forked from urbit/vere
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serial.h
137 lines (111 loc) · 3.27 KB
/
serial.h
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/// @file
#ifndef U3_SERIAL_H
#define U3_SERIAL_H
#include "c3.h"
#include "imprison.h"
#include "types.h"
/* constants
*/
/* u3_dit_y: digit table for @ux/@uv/@uw.
*/
extern const c3_y u3s_dit_y[64];
/* opaque handles
*/
/* u3_cue_xeno: handle for cue-ing with an off-loom dictionary.
*/
typedef struct _u3_cue_xeno u3_cue_xeno;
/* Noun serialization. All noun arguments RETAINED.
*/
/* u3s_jam_fib(): jam without atom allocation.
**
** returns atom-suitable words, and *bit_w will have
** the length (in bits). return should be freed with u3a_wfree().
*/
c3_w
u3s_jam_fib(u3i_slab* sab_u, u3_noun a);
/* u3s_jam_xeno(): jam with off-loom buffer (re-)allocation.
*/
c3_d
u3s_jam_xeno(u3_noun a, c3_d* len_d, c3_y** byt_y);
/* u3s_cue(): cue [a]
*/
u3_noun
u3s_cue(u3_atom a);
/* u3s_cue_xeno_init_with(): initialize a cue_xeno handle as specified.
*/
u3_cue_xeno*
u3s_cue_xeno_init_with(c3_d pre_d, c3_d siz_d);
/* u3s_cue_xeno_init(): initialize a cue_xeno handle.
*/
u3_cue_xeno*
u3s_cue_xeno_init(void);
/* u3s_cue_xeno_init(): cue on-loom, with off-loom dictionary in handle.
*/
u3_weak
u3s_cue_xeno_with(u3_cue_xeno* sil_u,
c3_d len_d,
const c3_y* byt_y);
/* u3s_cue_xeno_init(): dispose cue_xeno handle.
*/
void
u3s_cue_xeno_done(u3_cue_xeno* sil_u);
/* u3s_cue_xeno(): cue on-loom, with off-loom dictionary.
*/
u3_weak
u3s_cue_xeno(c3_d len_d,
const c3_y* byt_y);
/* u3s_cue_bytes(): cue bytes onto the loom.
*/
u3_noun
u3s_cue_bytes(c3_d len_d, const c3_y* byt_y);
/* u3s_cue_atom(): cue atom.
*/
u3_noun
u3s_cue_atom(u3_atom a);
/* u3s_etch_ud_smol(): c3_d to @ud
**
** =(26 (met 3 (scot %ud (dec (bex 64)))))
*/
c3_y*
u3s_etch_ud_smol(c3_d a_d, c3_y hun_y[26]);
/* u3s_etch_ud(): atom to @ud.
*/
u3_atom
u3s_etch_ud(u3_atom a);
/* u3s_etch_ud_c(): atom to @ud, as a malloc'd c string.
*/
size_t
u3s_etch_ud_c(u3_atom a, c3_c** out_c);
/* u3s_etch_ux(): atom to @ux.
*/
u3_atom
u3s_etch_ux(u3_atom a);
/* u3s_etch_ux_c(): atom to @ux, as a malloc'd c string.
*/
size_t
u3s_etch_ux_c(u3_atom a, c3_c** out_c);
/* u3s_etch_uv(): atom to @uv.
*/
u3_atom
u3s_etch_uv(u3_atom a);
/* u3s_etch_uv_c(): atom to @uv, as a malloc'd c string.
*/
size_t
u3s_etch_uv_c(u3_atom a, c3_c** out_c);
/* u3s_etch_uw(): atom to @uw.
*/
u3_atom
u3s_etch_uw(u3_atom a);
/* u3s_etch_uw_c(): atom to @uw, as a malloc'd c string.
*/
size_t
u3s_etch_uw_c(u3_atom a, c3_c** out_c);
/* u3s_sift_ud_bytes: parse @ud.
*/
u3_weak
u3s_sift_ud_bytes(c3_w len_w, c3_y* byt_y);
/* u3s_sift_ud: parse @ud.
*/
u3_weak
u3s_sift_ud(u3_atom a);
#endif /* ifndef U3_SERIAL_H */