Handbook
Glossary
unbox ( src c-type -- vregs reps )
Vocabulary
compiler
.
cfg
.
builder
.
alien
.
boxing
Inputs
src
an
object
c-type
an
object
Outputs
vregs
an
object
reps
an
object
Definition
IN:
compiler.cfg.builder.alien.boxing
GENERIC:
unbox
( src c-type -- vregs reps )
Methods
USING:
accessors
alien.c-types
arrays
combinators
compiler.cfg.builder.alien.boxing
compiler.cfg.hats
kernel
layouts
sequences
;
M:
c-type
unbox
[
rep>>
]
[
unboxer>>
]
bi
[
{
{
"to_float"
[
drop
]
}
{
"to_double"
[
drop
]
}
{
"to_signed_1"
[
drop
]
}
{
"to_unsigned_1"
[
drop
]
}
{
"to_signed_2"
[
drop
]
}
{
"to_unsigned_2"
[
drop
]
}
{
"alien_offset"
[
drop
^^unbox-any-c-ptr
]
}
[
dup
{
"to_signed_4"
"to_unsigned_4"
}
member?
[
cell
8
=
not
]
[
t
]
if
[
swap
^^unbox
]
[
2drop
]
if
]
}
case
1array
]
[
drop
f
f
3array
1array
]
2bi
record-reg-reps
;
USING:
accessors
alien.c-types
arrays
compiler.cfg.builder.alien.boxing
compiler.cfg.instructions
compiler.cfg.registers
cpu.architecture
kernel
;
M:
long-long-type
unbox
[
next-vreg
next-vreg
2dup
]
2dip
unboxer>>
##unbox-long-long,
2array
int-rep
long-long-on-stack?
long-long-odd-register?
3array
int-rep
long-long-on-stack?
f
3array
2array
record-reg-reps
;
USING:
classes.struct
compiler.cfg.builder.alien.boxing
compiler.cfg.hats
kernel
;
M:
struct-c-type
unbox
[
^^unbox-any-c-ptr
]
dip
explode-struct
;