next up previous contents
Next: 10. Internal representation of Up: QScheme Documentation Previous: 8. Running QScheme   Contents

Subsections

9. Data types

9.1 Builtin data types

The table 6

Table 6: Builtin Scheme object type
Type Description Example
SOBJ_T_VOID When returned no print occurs  
SOBJ_T_PAIR result of a cons (cons 1 2) => (1 . 2)
SOBJ_T_INUM small integer number. 31 bits 123
SOBJ_T_FNUM double 1.2
SOBJ_T_BNUM big integer number 108230980172834891
SOBJ_T_ATOM an atom 'a
SOBJ_T_KEYWORD start with ':' and evaluate to itself :keyword
SOBJ_T_SYMBOL a symbol symbol
SOBJ_T_LSYMBOL local symbol x
SOBJ_T_LABEL label for named let  
SOBJ_T_MODULE module description  
SOBJ_T_CHAR a character #\space
SOBJ_T_STRING a string ``Hello world''
SOBJ_T_PRIM Internal VM primitive %push
SOBJ_T_CPRIM Primitive coded in C display
SOBJ_T_SYNTAX Syntax object define
SOBJ_T_CODE Code without parameter  
SOBJ_T_PROC Procedure: has parameter  
SOBJ_T_ENV environment  
SOBJ_T_CLOSURE closure  
SOBJ_T_MACRO macro  
SOBJ_T_PORT port  
SOBJ_T_BOOLEAN #t or #f  
SOBJ_T_UNBOUND Value of an unbound symbol  
SOBJ_T_UNDEFINED Value of an undefined value  
SOBJ_T_EOF The EOF value  
SOBJ_T_CONT Continuation  
SOBJ_T_ARRAY Array  
SOBJ_T_HASH Hash  
SOBJ_T_POINTER Generic pointer  
SOBJ_T_EXTFUNC External function, dynamically loaded  
SOBJ_T_EXTVAR Reference to an external variable  
SOBJ_T_VAR Reference to an external variable  
SOBJ_T_VMFUNC VM extension functions  
SOBJ_T_CCNTXT Catch context  
SOBJ_T_USER User defined types  




describes the currently defined scheme object type.

9.2 Adding new scheme object type

The built-in data types can be extended by user defined data types. New user types can be registered using the following API.

SOBJ_TYPE_DESCR

The structure describing a type. See definitions in file s.h

SOBJ_TYPE_DESCR scm_type_hook[SOBJ_T_MAX]

The global type structure. You don't have to manipulate directly this table.

int scm_add_type(SOBJ_TYPE_DESCR *type)

This function add a new type to the scm_type_hook[] array. The integer returned is the type descriptor.

So to add a new Scheme object type, you will have to:

Real working example of how to build a new scheme object type can be found in the regex.c file.


next up previous contents
Next: 10. Internal representation of Up: QScheme Documentation Previous: 8. Running QScheme   Contents
Daniel Crettol
1999-09-01