15.  Appendix C: Summary of Functions, Macros, Types, and Variables  

      This appendix provides a quick overview of the functions and other definitions exported by the Elk kernel. The list is divided in groups of definitions with related functionality; the entries are presented in roughly the same order in which they are introduced in the above chapters. Full function prototypes are given for functions; in some prototypes, arguments are given names for clarification. The initial keywords function, macro, typedef, and variable indicate the type of each entry (function, preprocessor symbol with or without arguments, type definition, and external variable defined by Elk, respectively). The functions corresponding to Scheme primitives (as described in section @(ch-prims)) have been omitted from the list.

Accessing the Scheme Object Representation

typedef Object

macro TYPE(obj)
macro POINTER(obj)
macro ISCONST(obj)
macro SETCONST(obj)
macro SET(obj, type, ptr)
macro EQ(obj1, obj2)

Defining Scheme Primitives

function void Define_Primitive((Object (*func)()), const char *name,
               int minargs, int maxargs, enum discipline disc);

Making Objects Known to the Garbage Collector

macro GC_Node, GC_Node2, ...
macro GC_Link(obj), GC_Link2(obj1, obj2), ...
macro GC_Unlink
macro Global_GC_Link(obj)
function void Func_Global_GC_Link(obj_ptr);


macro T_Boolean
macro Truep(obj)

variable Object True
variable Object False

function int Eqv(Object, Object);
function int Equal(Object, Object);


macro T_Character
macro CHAR(char_obj)
function Object Make_Char(int);
variable Object Newline

Pairs and Lists

macro T_Null
macro Nullp(obj)
variable Null

macro T_Pair
macro PAIR(pair_obj)
macro Car(obj)
macro Cdr(obj)
macro Cons(obj1, obj2)

macro Check_List(obj)
function int Fast_Length(Object);
function Object Copy_List(Object);

Integers (Fixnums and Bignums)

macro T_Fixnum
macro T_Bignum
macro FIXNUM_FITS(integer)
macro UFIXNUM_FITS(unsigned_integer)
macro FIXNUM(fixnum_obj)
macro BIGNUM(bignum_obj)

macro Check_Integer(obj)
macro Check_Number(obj)

function Object Make_Integer(int);
function Object Make_Unsigned(unsigned);
function Object Make_Long(long);
function Object Make_Unsigned_Long(unsigned long);

function int Get_Integer(Object);
function unsigned Get_Unsigned(Object);
function long Get_Long(Object);
function unsigned long Get_Unsigned_Long(Object);

function int Get_Exact_Integer(Object);
function unsigned Get_Exact_Unsigned(Object);
function long Get_Exact_Long(Object);
function unsigned long Get_Exact_Unsigned_Long(Object);

Floating Point Numbers (Reals)

macro T_Flonum
macro FLONUM(flonum_obj)
function Object Make_Flonum(double);
function Object Make_Reduced_Flonum(double);
function double Get_Double(Object);


macro T_Symbol
macro SYMBOL(symbol_obj)
function Object Intern(const char *);
function Object CI_Intern(const char *);
function void Define_Symbol(Object *var, const char *name);
variable Object Void

typedef SYMDESCR
function unsigned long Symbols_To_Bits(Object syms, int mask_flag,
               SYMDESCR *table);
function Object Bits_To_Symbols(unsigned long bits, int mask_flag,
               SYMDESCR *table);


macro T_String
macro STRING(string_obj)
function Object Make_String(const char *init, int size);
function char *Get_String(Object);
function char *Get_Strsym(Object);
macro Get_String_Stack(obj, char_ptr)
macro Get_Strsym_Stack(obj, char_ptr)


macro T_Vector
macro VECTOR(vector_obj)
function Object Make_Vector(int size, Object fill);


macro T_Port
macro PORT(port_obj)
function Object Make_Port(int flags, FILE *f, Object name);
function Object Terminate_File(Object port);
macro Check_Input_Port(obj)
macro Check_Output_Port(obj)
variable Object Curr_Input_Port, Curr_Output_Port
variable Object Standard_Input_Port, Standard_Output_Port
function void Reset_IO(int destructive_flag);
function void Printf(Object port, char *fmt, ...);
function void Print_Object(Object obj, Object port, int raw_flag,
               int print_depth, int print_length);
macro Print(obj)
function void Load_Source_Port(Object port);
function void Load_File(char *filename);

Miscellaneous Types

macro T_End_Of_File
variable Object Eof

macro T_Environment
variable Object The_Environment, Global_Environment

macro T_Primitive
macro T_Compound
function void Check_Procedure(Object);

macro T_Control_Point
macro T_Promise
macro T_Macro

Defining Scheme Types and Allocating Objects

function int Define_Type(int zero, const char *name,
               int (*size)(Object), int const_size,
               int (*eqv)(Object, Object),
               int (*equal)(Object, Object),
               int (*print)(Object, Object, int, int, int),
               int (*visit)(Object*, int (*)(Object*)));
function Object Alloc_Object(int size, int type, int const_flag);

Calling Scheme Procedures and Evaluating Scheme Code

function Object Funcall(Object fun, Object argl, int eval_flag);
function Object Eval(Object expr);
function char *String_Eval(char *expr);

Weak Pointers and Object Termination

function void Register_Before_GC((void (*func)(void)));
function void Register_After_GC((void (*func)(void)));

macro IS_ALIVE(obj)
macro WAS_FORWARDED(obj)
macro UPDATE_OBJ(obj)

function void Register_Object(Object obj, char *group,
               (Object (*term)(Object)), int leader_flag);
function void Deregister_Object(Object obj);
function void Terminate_Type(int type);
function void Terminate_Group(char *group);
function Object Find_Object(int type, char *group,
               (int (*match_func)(Object, ...)), ...);

Signaling Errors

function void Primitive_Error(char *fmt, ...);
function void Set_Error_Tag(const char *tag);
function char *Get_Error_Tag(void);
function void Set_App_Name(char *name);
function void Range_Error(Object offending_obj);
function void Wrong_Type(Object offending_obj, int expected_type);
function void Wrong_Type_Combination(Object offending_obj,
	       char *expected_type);
function void Fatal_Error(char *fmt, ...);
function void Panic(char *msg);
variable int Saved_Errno

Exceptions (Signals)

macro Disable_Interrupts, Enable_Interrupts
macro Force_Disable_Interrupts, Force_Enable_Interrupts
function void Signal_Exit(int signal_number);

Defining and Using Scheme Variables

function void Define_Variable(Object *var, const char *name, Object init);
function void Var_Set(Object var, Object val);
function Object Var_Get(Object var);
function int Var_Is_True(Object var);

Defining Reader Functions

function void Define_Reader(int c,
               (Object (*func)(Object port, int c, int const_flag)));

Fork Handlers

function void Register_Onfork((void (*func)(void)));
function void Call_Onfork(void);

Allocating Memory

function char *Safe_Malloc(unsigned size);
function char *Safe_Realloc(char *old_pointer, unsigned size);

macro Alloca_Begin, Alloca_End
macro Alloca(char_ptr, type, size)

Initializing Elk from an Application's main()

function void Elk_Init(int argc, char **argv, int init_flag,
	       char *filename);

Miscellaneous Macros


Markup created by unroff 1.0,    September 24, 1996,    net@informatik.uni-bremen.de