Next: Continuations, Previous: Callbacks, Up: Operations [Contents][Index]
These type conversion functions are very useful for connecting SCM and C code. Most are defined in rope.c.
Return an object of type SCM
corresponding to the long
or
unsigned long
argument n. If n cannot be converted,
BOOL_F
is returned. Which numbers can be converted depends on
whether SCM was compiled with the BIGDIG
or FLOATS
flags.
To convert integer numbers of smaller types (short
or
char
), use the macro MAKINUM(n)
.
These functions are used to check and convert SCM
arguments to
the named C type. The first argument num is checked to see it it
is within the range of the destination type. If so, the converted
number is returned. If not, the ASRTER
macro calls wta
with num and strings pos and s_caller. For a listing
of useful predefined pos macros, See C Macros.
Note Inexact numbers are accepted only by num2dbl
,
num2long
, and num2ulong
(for when SCM
is compiled
without bignums). To convert inexact numbers to exact numbers,
See inexact->exact in Revised(5) Scheme.
Returns a pointer (cast to an unsigned long
) to the storage
corresponding to the location accessed by
aref(CAR(args),CDR(args))
. The string s_name is used in
any messages from error calls by scm_addr
.
scm_addr
is useful for performing C operations on strings or
other uniform arrays (see Uniform Array).
Returns a pointer (cast to an unsigned long
) to the beginning
of storage of array ra. Note that if ra is a
shared-array, the strorage accessed this way may be much larger than
ra.
Note While you use a pointer returned from scm_addr
or
scm_base_addr
you must keep a pointer to the associated
SCM
object in a stack allocated variable or GC-protected
location in order to assure that SCM does not reuse that storage
before you are done with it. See scm_gc_protect.
Return a newly allocated string SCM
object copy of the
null-terminated string src or the string src of length
len, respectively.
Returns a newly allocated SCM
list of strings corresponding to
the argc length array of null-terminated strings argv. If
argv is less than 0
, argv is assumed to be
NULL
terminated. makfromstrs
is used by
scm_init_from_argv
to convert the arguments SCM was called with
to a SCM
list which is the value of SCM procedure calls to
program-arguments
(see program-arguments).
Returns a NULL
terminated list of null-terminated strings copied
from the SCM
list of strings args. The string s_name
is used in messages from error calls by makargvfrmstrs
.
makargvfrmstrs
is useful for constructing argument lists suitable
for passing to main
functions.
Frees the storage allocated to create argv by a call to
makargvfrmstrs
.
Next: Continuations, Previous: Callbacks, Up: Operations [Contents][Index]