Handbook
Glossary
write-pair ( name: string obj -- )
Vocabulary
bson
.
private
Inputs
name
a
string
obj
an
object
Outputs
None
Definition
USING:
arrays
bson.constants
byte-arrays
calendar
combinators
combinators.short-circuit
dlists
hashtables
kernel
linked-assocs
math
quotations
strings
typed
vectors
words
;
IN:
bson.private
TYPED:
write-pair
( name: string obj -- )
{
{
[
dup
{
[
hashtable?
]
[
linked-assoc?
]
}
1||
]
[
T_Object
write-header
write-assoc
]
}
{
[
dup
{
[
array?
]
[
vector?
]
[
dlist?
]
}
1||
]
[
T_Array
write-header
write-sequence
]
}
{
[
dup
byte-array?
]
[
T_Binary
write-header
write-byte-array
]
}
{
[
dup
string?
]
[
T_String
write-header
write-string
]
}
{
[
dup
oid?
]
[
T_OID
write-header
write-oid
]
}
{
[
dup
integer?
]
[
T_Integer
write-header
write-int32
]
}
{
[
dup
boolean?
]
[
T_Boolean
write-header
write-boolean
]
}
{
[
dup
real?
]
[
T_Double
write-header
>float
write-double
]
}
{
[
dup
timestamp?
]
[
T_Date
write-header
timestamp>millis
write-longlong
]
}
{
[
dup
mdbregexp?
]
[
T_Regexp
write-header
write-mdbregexp
]
}
{
[
dup
quotation?
]
[
T_Binary
write-header
(serialize-code)
]
}
{
[
dup
word?
]
[
T_Binary
write-header
(serialize-code)
]
}
{
[
dup
dbref?
]
[
T_Object
write-header
dbref>assoc
write-assoc
]
}
{
[
dup
f
=
]
[
T_NULL
write-header
drop
]
}
}
cond
;