961 |
@var{x} is not a subr. |
@var{x} is not a subr. |
962 |
@end deftypefn |
@end deftypefn |
963 |
|
|
964 |
@deftypefun SCM scm_make_gsubr (char *@var{name}, int @var{req}, int @var{opt}, int @var{rest}, SCM (*@var{function})()) |
@deftypefun SCM scm_c_define_gsubr (char *@var{name}, int @var{req}, int @var{opt}, int @var{rest}, SCM (*@var{function})()) |
965 |
Create a new subr object named @var{name}, based on the C function |
Create a new subr object named @var{name}, based on the C function |
966 |
@var{function}, make it visible to Scheme the value of as a global |
@var{function}, make it visible to Scheme the value of as a global |
967 |
variable named @var{name}, and return the subr object. |
variable named @var{name}, and return the subr object. |
986 |
subr can take one required argument, or one required and one optional |
subr can take one required argument, or one required and one optional |
987 |
argument, but a subr can't take one required and two optional arguments. |
argument, but a subr can't take one required and two optional arguments. |
988 |
It's bizarre, but that's the way the interpreter was written. If the |
It's bizarre, but that's the way the interpreter was written. If the |
989 |
arguments to @code{scm_make_gsubr} do not fit one of the predefined |
arguments to @code{scm_c_define_gsubr} do not fit one of the predefined |
990 |
patterns, then @code{scm_make_gsubr} will return a compiled closure |
patterns, then @code{scm_c_define_gsubr} will return a compiled closure |
991 |
object instead of a subr object. |
object instead of a subr object. |
992 |
@end deftypefun |
@end deftypefun |
993 |
|
|
1048 |
|
|
1049 |
In fact, there are two basic C data types to represent objects in Guile: |
In fact, there are two basic C data types to represent objects in Guile: |
1050 |
|
|
1051 |
@itemize @bullet |
@deftp {Data type} SCM |
|
@item |
|
1052 |
@code{SCM} is the user level abstract C type that is used to represent |
@code{SCM} is the user level abstract C type that is used to represent |
1053 |
all of Guile's Scheme objects, no matter what the Scheme object type is. |
all of Guile's Scheme objects, no matter what the Scheme object type is. |
1054 |
No C operation except assignment is guaranteed to work with variables of |
No C operation except assignment is guaranteed to work with variables of |
1055 |
type @code{SCM}, so you should only use macros and functions to work |
type @code{SCM}, so you should only use macros and functions to work |
1056 |
with @code{SCM} values. Values are converted between C data types and |
with @code{SCM} values. Values are converted between C data types and |
1057 |
the @code{SCM} type with utility functions and macros. |
the @code{SCM} type with utility functions and macros. |
1058 |
|
@end deftp |
1059 |
|
@cindex SCM data type |
1060 |
|
|
1061 |
@item |
@deftp {Data type} scm_t_bits |
1062 |
@code{scm_t_bits} is an integral data type that is guaranteed to be |
@code{scm_t_bits} is an integral data type that is guaranteed to be |
1063 |
large enough to hold all information that is required to represent any |
large enough to hold all information that is required to represent any |
1064 |
Scheme object. While this data type is mostly used to implement Guile's |
Scheme object. While this data type is mostly used to implement Guile's |
1065 |
internals, the use of this type is also necessary to write certain kinds |
internals, the use of this type is also necessary to write certain kinds |
1066 |
of extensions to Guile. |
of extensions to Guile. |
1067 |
@end itemize |
@end deftp |
1068 |
|
|
1069 |
@menu |
@menu |
1070 |
* Relationship between SCM and scm_t_bits:: |
* Relationship between SCM and scm_t_bits:: |