Handbook
Glossary
write-bare ( obj schema -- )
Binary Application Record Encoding (BARE)
Prev:
bare> ( encoded schema -- obj )
Next:
>bare ( obj schema -- encoded )
Vocabulary
bare
Inputs
obj
an
object
schema
schema
Outputs
None
Word description
Encodes an object into the BARE format using
schema
, writing to an
output-stream
.
Definition
IN:
bare
GENERIC:
write-bare
( obj schema -- )
Methods
USING:
bare
kernel
;
M:
bool
write-bare
drop
>boolean
1 0
?
u8
write-bare
;
USING:
accessors
bare
io
kernel
sequences
;
M:
data
write-bare
length>>
[
dup
length
uint
write-bare
]
unless
write
;
USING:
accessors
assocs
bare
kernel
;
M:
enum
write-bare
values>>
?at
[
uint
write-bare
]
[
invalid-enum
]
if
;
USING:
bare
kernel
math
;
M:
f32
write-bare
drop
float>bits
u32
write-bare
;
USING:
bare
kernel
math
;
M:
f64
write-bare
drop
double>bits
u64
write-bare
;
USING:
bare
endian
io
kernel
;
M:
i16
write-bare
drop
2
>le
write
;
USING:
bare
endian
io
kernel
;
M:
i32
write-bare
drop
4
>le
write
;
USING:
bare
endian
io
kernel
;
M:
i64
write-bare
drop
8
>le
write
;
USING:
bare
endian
io
kernel
;
M:
i8
write-bare
drop
1
>le
write
;
USING:
bare
kernel
math
;
M:
int
write-bare
drop
2
*
dup
0
<
[
neg
1
-
]
when
uint
write-bare
;
USING:
accessors
bare
kernel
sequences
;
M:
list
write-bare
[
length>>
[
dup
length
uint
write-bare
]
unless
]
[
type>>
[
write-bare
]
curry
each
]
bi
;
USING:
accessors
assocs
bare
kernel
;
M:
map
write-bare
over
assoc-size
uint
write-bare
[
from>>
]
[
to>>
]
bi
[
write-bare
]
bi-curry@
[
bi*
]
2curry
assoc-each
;
USING:
accessors
bare
kernel
;
M:
optional
write-bare
over
1 0
?
u8
write-bare
[
type>>
write-bare
]
curry
when*
;
USING:
bare
io.encodings.string
io.encodings.utf8
kernel
;
M:
str
write-bare
drop
utf8
encode
T{
data
}
write-bare
;
USING:
accessors
assocs
bare
kernel
;
M:
struct
write-bare
fields>>
[
[
dupd
of
]
[
write-bare
]
bi*
]
assoc-each
drop
;
USING:
bare
endian
io
kernel
;
M:
u16
write-bare
drop
2
>le
write
;
USING:
bare
endian
io
kernel
;
M:
u32
write-bare
drop
4
>le
write
;
USING:
bare
endian
io
kernel
;
M:
u64
write-bare
drop
8
>le
write
;
USING:
bare
io
kernel
;
M:
u8
write-bare
drop
write1
;
USING:
bare
io
kernel
math
;
M:
uint
write-bare
drop
[
dup
128
>=
]
[
[
127
bitand
128
bitor
write1
]
[
-7
shift
]
bi
]
while
write1
;
USING:
bare
kernel
;
M:
void
write-bare
2drop
;