// Primitive Function Definitions. // // File: prims.h // Author: course // Version: 3 #ifndef PRIMS_H #define PRIMS_H // Install all primitive functions in the symbol table. // void initialize_primitive_functions(); // Declarations for the primitive functions supplied // with LISP. // // Except as noted, all primitives conform to the rules // of the COMMONLISP version, but with no optional // arguments save :TEST arguments. // // Arithmetic functions // object * prim_plus (object * arglist); // + object * prim_diff (object * arglist); // - object * prim_times (object * arglist); // * object * prim_floor (object * arglist); object * prim_mod (object * arglist); object * prim_expt (object * arglist); object * prim_random (object * arglist); // Arithmetic Comparison Functions // object * prim_matheq (object * arglist); // = object * prim_mathlt (object * arglist); // < // List manipulating functions // object * prim_cons (object * arglist); object * prim_car (object * arglist); object * prim_cdr (object * arglist); // Symbol Primitives // object * prim_symbol_value (object * arglist); object * prim_symbol_function (object * arglist); object * prim_symbol_plist (object * arglist); // Primitive Predicates // // PRIMITIVE-FUNCTIONP is not standard COMMONLISP, // but returns true for a primitive function, // non-special or special. // // SPECIAL-PRIMITIVEP is not standard COMMONLISP, // but returns true for a special primitive // function only. // object * prim_boundp (object * arglist); object * prim_symbolp (object * arglist); object * prim_fixnump (object * arglist); object * prim_consp (object * arglist); object * prim_primitive_functionp (object * arglist); object * prim_special_primitivep (object * arglist); object * prim_eql (object * arglist); // Mutators // // SET-SYMBOL-FUNCTION and SET-SYMBOL-PLIST are not // standard COMMONLISP, but are the implementation // dependent LISP functions one would expect // (SETF (SYMBOL-FUNCTION x) y) and // (SETF (SYMBOL-PLIST x) y) to expand to. The // first argument of each is a symbol, and the // second is the function binding or plist value. // object * prim_rplaca (object * arglist); object * prim_rplacd (object * arglist); object * prim_set (object * arglist); object * prim_set_symbol_function (object * arglist); object * prim_set_symbol_plist (object * arglist); object * prim_setq (object * arglist); // Input and Output Primitives // // READ will take up to three arguments, but the // first, if given, must be NIL, to specify the // default input stream. The other two arguments // specify behavior on end of file. // // ERROR is not standard COMMONLISP in that it will // take any LISP object as a single argument and // print it. // // RUN is not standard COMMONLISP. It takes one // or two arguments, the first an input file name, // and the second an optional output file name // (standard output is default). It applies the // read-eval-print loop to the input, echoing all // input, and catching errors and continuing, as // would a true toplevel. // object * prim_read (object * arglist); object * prim_princ (object * arglist); object * prim_terpri (object * arglist); object * prim_load (object * arglist); object * prim_run (object * arglist); // Miscellaneous primitives // // EXIT is not COMMONLISP. It takes an optional // argument (default EXIT_SUCCESS) and exits from // lisp51 with that argument as the program // completion code. // // GC is not COMMONLISP. It takes no arguments and // simply does a garbage collection. // // GC-LIMIT and SET-GC-LIMIT are not COMMONLISP. // The gc limit is the number of objects allocated // before a garbage collection is automatically // initiated. This may be read and set by these // functions. // object * prim_function (object * arglist); object * prim_quote (object * arglist); object * prim_cond (object * arglist); object * prim_exit (object * arglist); object * prim_error (object * arglist); object * prim_eval (object * arglist); object * prim_macroexpand_1 (object * arglist); object * prim_apply (object * arglist); object * prim_funcall (object * arglist); object * prim_gc (object * arglist); object * prim_gc_limit (object * arglist); object * prim_set_gc_limit (object * arglist); #endif // PRIMS_H