-
Notifications
You must be signed in to change notification settings - Fork 5
/
library.dylan
154 lines (128 loc) · 3.95 KB
/
library.dylan
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
Module: dylan-user
author: Andreas Bogk and Hannes Mehnert
copyright: 2005-2011 Andreas Bogk and Hannes Mehnert. All rights reserved.
license: see LICENSE.txt in this distribution
define library binary-data
use common-dylan;
use io;
export binary-data;
end library binary-data;
define module binary-data
use common-dylan, exclude: { format-to-string };
use byte-vector;
use format;
use print, import: { print-object };
use streams;
export <stretchy-vector-subsequence>,
<stretchy-byte-vector-subsequence>,
<stretchy-byte-vector>,
subsequence,
start-index, end-index,
<out-of-bound-error>,
encode-integer, decode-integer;
export data,
concrete-frame-fields,
<repeated-field>;
export byte-aligned, high-level-type;
export n-byte-vector-definer, n-bit-unsigned-integer-definer;
export hexdump;
export <unsigned-byte>, <boolean-bit>,
<3byte-big-endian-unsigned-integer>,
<2byte-big-endian-unsigned-integer>, <2byte-little-endian-unsigned-integer>,
<3byte-little-endian-unsigned-integer>,
<1bit-unsigned-integer>, <2bit-unsigned-integer>, <3bit-unsigned-integer>,
<4bit-unsigned-integer>, <5bit-unsigned-integer>, <6bit-unsigned-integer>,
<7bit-unsigned-integer>, <9bit-unsigned-integer>, <10bit-unsigned-integer>,
<11bit-unsigned-integer>, <12bit-unsigned-integer>, <13bit-unsigned-integer>,
<14bit-unsigned-integer>, <15bit-unsigned-integer>, <20bit-unsigned-integer>;
export <variable-size-byte-vector>, <externally-delimited-string>,
<raw-frame>;
export $empty-externally-delimited-string, $empty-raw-frame;
//XXX: evil hacks
export float-to-byte-vector-le, byte-vector-to-float-le,
float-to-byte-vector-be, byte-vector-to-float-be,
<big-endian-unsigned-integer-4byte>, big-endian-unsigned-integer-4byte,
<little-endian-unsigned-integer-4byte>, little-endian-unsigned-integer-4byte,;
export <null-frame>;
export <fixed-size-translated-leaf-frame>, <byte-sequence>,
<fixed-size-byte-vector-frame>;
export <integer-or-unknown>, $unknown-at-compile-time;
export <malformed-data-error>, <parse-error>;
export <frame-field>,
<repeated-frame-field>,
<rep-frame-field>,
<position-mixin>,
parent-frame-field,
frame-field-list,
start-offset,
length,
end-offset,
frame,
field,
value;
export <field>,
static-start,
static-length,
static-end,
field-name,
field-size,
getter,
setter,
fixup-function,
type;
export <frame>,
<leaf-frame>,
parse-frame,
assemble-frame,
assemble-frame-into,
assemble-frame-into-as,
assemble-frame!,
copy-frame,
read-frame,
summary;
export sorted-frame-fields,
get-frame-field,
fields,
find-protocol,
find-protocol-field;
export <container-frame>,
<unparsed-container-frame>,
<decoded-container-frame>,
fields-initializer,
frame-name,
unparsed-class,
decoded-class,
field-count,
fixup!,
parent, parent-setter,
packet, packet-setter,
cache,
source-address, source-address-setter,
destination-address, destination-address-setter,
payload-type,
container-frame-size,
layer-magic,
lookup-layer, reverse-lookup-layer;
export <header-frame>,
<unparsed-header-frame>,
<decoded-header-frame>,
payload, payload-setter;
export <inline-layering-error>,
<missing-inline-layering-error>,
<variably-typed-container-frame>,
<unparsed-variably-typed-container-frame>,
<decoded-variably-typed-container-frame>;
export frame-size,
byte-offset,
bit-offset;
//utilities
export find-frame-field,
compute-absolute-offset,
compute-length,
find-frame-at-offset;
export binary-data-definer;
//XXX: we shouldn't need to export those
export real-class-definer, decoded-class-definer, gen-classes,
frame-field-generator, summary-generator, enum-frame-field-generator,
unparsed-frame-field-generator;
end module binary-data;