Reading and writing memory directly
Factor handbook » C library interface » Passing data between Factor and C » Passing pointers to C functions » Alien addresses

Prev:Alien expiry


Numerical values can be read from memory addresses and converted to Factor objects using the various typed memory accessor words:
alien-signed-1 ( c-ptr n -- value )

alien-unsigned-1 ( c-ptr n -- value )

alien-signed-2 ( c-ptr n -- value )

alien-unsigned-2 ( c-ptr n -- value )

alien-signed-4 ( c-ptr n -- value )

alien-unsigned-4 ( c-ptr n -- value )

alien-signed-cell ( c-ptr n -- value )

alien-unsigned-cell ( c-ptr n -- value )

alien-signed-8 ( c-ptr n -- value )

alien-unsigned-8 ( c-ptr n -- value )

alien-float ( c-ptr n -- value )

alien-double ( c-ptr n -- value )


Factor numbers can also be converted to C values and stored to memory:
set-alien-signed-1 ( value c-ptr n -- )

set-alien-unsigned-1 ( value c-ptr n -- )

set-alien-signed-2 ( value c-ptr n -- )

set-alien-unsigned-2 ( value c-ptr n -- )

set-alien-signed-4 ( value c-ptr n -- )

set-alien-unsigned-4 ( value c-ptr n -- )

set-alien-signed-cell ( value c-ptr n -- )

set-alien-unsigned-cell ( value c-ptr n -- )

set-alien-signed-8 ( value c-ptr n -- )

set-alien-unsigned-8 ( value c-ptr n -- )

set-alien-float ( value c-ptr n -- )

set-alien-double ( value c-ptr n -- )