My question is what is going to be returned from TS in the list argument? A pointer to a C array/structure/... or a delimited string?
Hi John,
TinyScheme should send a
pointer (that's a #define that denotes a
cell*) to a compound structure
cell of the following kind:
/* cell structure */
struct cell {
unsigned int _flag;
union {
struct {
char* _svalue;
__int64 _length;
} _string;
num _number;
port* _port;
foreign_func _ff;
struct {
struct cell* _car;
struct cell* _cdr;
} _cons;
} _object;
};wherein
_cons (which means a "pair") is the member that denotes a list. It comprises two members:
1. a
cell* member (in fact, another
pointer) called
_car that would point to a structure
cell which is the list's first element (of whatever type); and
2. one more
cell* member called
_cdr that would point to yet another list that hosts the list's other elements (those can also be of whatever type).
That said, from the C language perspective a TinyScheme
list is a tree-like linked list of
cell structures each of which can represent any
typedef -- a
_string, a
num, a
port, a
foreign_func, or yet another
_cons, i.e. a
pair (2-element list) where
_car is the list's first element, and
_cdr is still another list of its other elements.
The type of data that a given
cell represents is coded in its
_flag member. See
scheme.h for what
num and
foreign_func look like, and
scheme-private.h, for
cell and
port structures.
P.S. Yes, interfacing TinyScheme with SB seamlessly would require profound knowledge of C. It's up to you to decide if it's worth your effort.