Exemple #1
0
static void init2(void)
{
	defsubr((STR)"progn",		(CELLP)progn_f,	_FSUBR);
	defsubr((STR)"throw",		(CELLP)throw_f,	_FSUBR);
	defsubr((STR)"catch",		(CELLP)catch_f,	_FSUBR);
	defsubr((STR)"catcherror",	(CELLP)cerr_f,	_FSUBR);
	defsubr((STR)"let",			(CELLP)let_f,	_FSUBR);
	defsubr((STR)"let*",		(CELLP)lets_f,	_FSUBR);
	defsubr((STR)"prog",		(CELLP)prog_f,	_FSUBR);
	defsubr((STR)"return",		(CELLP)ret_f,	_SUBR);
	defsubr((STR)"go",			(CELLP)go_f,	_FSUBR);
}
Exemple #2
0
int main(void)
{
  int i;
  extern int yyparse();
  topenv = Qnil;
  freelist = NULL;

  envstack.envs = NULL;
  envstack.len = 0;

  static Subr subrs[] = {procedure_car, procedure_cdr, procedure_cons, eq, atom, add, sub, mul, divide, mod, cond, lambda, quote, define, define_macro, set};
  
  static const char* subrnames[] = {"car", "cdr", "cons", "=", "atom", "+", "-", "*", "/", "%", "cond", "lambda", "quote", "define", "define-macro", "set!"};


  for(i = 0; i < NELEMS(subrs); i++)
    {
      defsubr(subrnames[i], subrs[i]);
    }

  prompt();
  while(yyparse());

  return 0;
}
Exemple #3
0
void initsubr(void){
    defsubr("+",f_plus);
    defsubr("-",f_minus);
    defsubr("*",f_mult);
    defsubr("/",f_div);
    defsubr("exit",f_exit);
    defsubr("hdmp",f_heapdump);
    defsubr("car",f_car);
    defsubr("cdr",f_cdr);
    defsubr("cons",f_cons);
    defsubr("list",f_list);
    defsubr("eq",f_eq);
    defsubr("null",f_nullp);
    defsubr("atom",f_atomp);
    defsubr("oblist",f_oblist);
    defsubr("gbc",f_gbc);
    defsubr("read",f_read);
    defsubr("eval",f_eval);
    defsubr("apply",f_apply);
    defsubr("print",f_print);
    defsubr("=",f_numeqp);
    defsubr(">",f_greater);
    defsubr(">=",f_eqgreater);
    defsubr("<",f_smaller);
    defsubr("<=",f_eqsmaller);
    defsubr("numberp",f_numberp);
    defsubr("symbolp",f_symbolp);
    defsubr("listp",f_listp);
    deffsubr("setq",f_setq);
    deffsubr("defun",f_defun);
    deffsubr("if",f_if);
    deffsubr("begin",f_begin);
    deffsubr("cond",f_cond);
}
Exemple #4
0
void initsubr(void){
        defsubr("+",(int)f_plus);
    defsubr("-",(int)f_minus);
    defsubr("*",(int)f_mult);
    defsubr("exit",(int)f_exit);
    defsubr("dump",(int)f_dump);
    defsubr("error",(int)f_error);
    defsubr("car",(int)f_car);
    defsubr("cdr",(int)f_cdr);
    defsubr("cons",(int)f_cons);
    defsubr("eq",(int)f_eq);
    defsubr("oblist",(int)f_oblist);
    deffsubr("setq",(int)f_setq);
    deffsubr("defun",(int)f_defun);
    
}
Exemple #5
0
void initsubr(void){
	defsubr("+",(int)f_plus);
    defsubr("-",(int)f_minus);
    defsubr("*",(int)f_mult);
    defsubr("/",(int)f_div);
    defsubr("evenp",(int)f_evenp);
    defsubr("oddp",(int)f_oddp);
    defsubr("exit",(int)f_exit);
    defsubr("hdmp",(int)f_heapdump);
    defsubr("sdmp",(int)f_stackdump);
    defsubr("admp",(int)f_argstkdump);
    defsubr("car",(int)f_car);
    defsubr("cdr",(int)f_cdr);
    defsubr("cons",(int)f_cons);
    defsubr("list",(int)f_list);
    defsubr("rplaca",(int)f_rplaca);
    defsubr("rplacd",(int)f_rplacd);
    defsubr("eq",(int)f_eq);
    defsubr("null",(int)f_nullp);
    defsubr("atom",(int)f_atomp);
    defsubr("oblist",(int)f_oblist);
    defsubr("gbc",(int)f_gbc);
    defsubr("reg",(int)f_register);
    defsubr("reset",(int)f_reset);
    defsubr("read",(int)f_read);
    defsubr("eval",(int)f_eval);
    defsubr("apply",(int)f_apply);
    defsubr("print",(int)f_print);
    defsubr("princ",(int)f_princ);
    defsubr("=",(int)f_numeqp);
    defsubr(">",(int)f_greater);
    defsubr(">=",(int)f_eqgreater);
    defsubr("<",(int)f_smaller);
    defsubr("<=",(int)f_eqsmaller);
    defsubr("length",(int)f_length);
    defsubr("numberp",(int)f_numberp);
    defsubr("symbolp",(int)f_symbolp);
    defsubr("listp",(int)f_listp);
    defsubr("addr",(int)f_addr);
    
    deffsubr("setq",(int)f_setq);
    deffsubr("defun",(int)f_defun);
    deffsubr("if",(int)f_if);
    deffsubr("begin",(int)f_begin);
    deffsubr("cond",(int)f_cond);
    deffsubr("regsetq",(int)f_regsetq);
}
Exemple #6
0
static void init4(void)
{
	defsubr((STR)"and",			(CELLP)and_f,		_FSUBR);
	defsubr((STR)"or",			(CELLP)or_f,		_FSUBR);
	defsubr((STR)"psetf",		(CELLP)psetq_f,		_FSUBR);
	defsubr((STR)"set",			(CELLP)set_f,		_FSUBR);
	defsubr((STR)"append",		(CELLP)append_f,	_SUBR);
	defsubr((STR)"nconc",		(CELLP)nconc_f,		_SUBR);
	defsubr((STR)"list",		(CELLP)list_f,		_SUBR);
	defsubr((STR)"reverse",		(CELLP)reverse_f,	_SUBR);
	defsubr((STR)"assoc",		(CELLP)assoc_f,		_SUBR);
	defsubr((STR)"rplaca",		(CELLP)rplaca_f,	_SUBR);
	defsubr((STR)"rplacd",		(CELLP)rplacd_f,	_SUBR);
	defsubr((STR)"length",		(CELLP)length_f,	_SUBR);
	defsubr((STR)"member",		(CELLP)member_f,	_SUBR);
	defsubr((STR)"null",		(CELLP)null_f,		_SUBR);
	defsubr((STR)"zerop",		(CELLP)zerop_f,		_SUBR);
	defsubr((STR)"numberp",		(CELLP)numberp_f,	_SUBR);
	defsubr((STR)"<",			(CELLP)lessp_f,		_SUBR);
	defsubr((STR)">",			(CELLP)greaterp_f,	_SUBR);
	defsubr((STR)"ascii",		(CELLP)ascii_f,		_SUBR);
	defsubr((STR)"implode",		(CELLP)implode_f,	_SUBR);
	defsubr((STR)"explode",		(CELLP)explode_f,	_SUBR);
	defsubr((STR)"alen",		(CELLP)alen_f,		_SUBR);
	defsubr((STR)"1+",			(CELLP)add1_f,		_SUBR);
	defsubr((STR)"1-",			(CELLP)sub1_f,		_SUBR);
	defsubr((STR)"+",			(CELLP)plus_f,		_SUBR);
	defsubr((STR)"-",			(CELLP)difference_f,	_SUBR);
	defsubr((STR)"*",			(CELLP)times_f,		_SUBR);
	defsubr((STR)"/",			(CELLP)quotient_f,	_SUBR);
	defsubr((STR)"%",			(CELLP)remainder_f,	_SUBR);
	defsubr((STR)"divide",		(CELLP)divide_f,	_SUBR);
}
Exemple #7
0
static void init3(void)
{
	defsubr((STR)"format",		(CELLP)format_f,	_SUBR);
	defsubr((STR)"prompt",		(CELLP)prompt_f,	_SUBR);
	defsubr((STR)"load",		(CELLP)load_f,		_SUBR);
	defsubr((STR)"open",		(CELLP)open_f,		_SUBR);
	defsubr((STR)"close",		(CELLP)close_f,		_SUBR);
	defsubr((STR)"fmode",		(CELLP)fmode_f,		_SUBR);
	defsubr((STR)"readch",		(CELLP)readch_f,	_SUBR);
	defsubr((STR)"dirin",		(CELLP)dirin_f,		_SUBR);
	defsubr((STR)"dirout",		(CELLP)dirout_f,	_SUBR);
	defsubr((STR)"curin",		(CELLP)curin_f,		_SUBR);
	defsubr((STR)"curout",		(CELLP)curout_f,	_SUBR);
}
Exemple #8
0
static void init1(void)
{
	defsubr((STR)"reclaim",	(CELLP)reclaim_f,	_SUBR);
	defsubr((STR)"verbos",	(CELLP)verbos_f,	_SUBR);
}
Exemple #9
0
static void init0(void)
{
	defsubr((STR)"car",		(CELLP)car_f,		_SUBR);
	defsubr((STR)"cdr",		(CELLP)cdr_f,		_SUBR);
	defsubr((STR)"cons",	(CELLP)cons_f,		_SUBR);
	defsubr((STR)"atom",	(CELLP)atom_f,		_SUBR);
	defsubr((STR)"eq",		(CELLP)eq_f,		_SUBR);
	defsubr((STR)"equal",	(CELLP)equal_f,		_SUBR);
	defsubr((STR)"defun",	(CELLP)defun_f,		_FSUBR);
	defsubr((STR)"cond",	(CELLP)cond_f,		_FSUBR);
	defsubr((STR)"setf",	(CELLP)setf_f,		_FSUBR);
	defsubr((STR)"oblist",	(CELLP)oblist_f,	_SUBR);
	defsubr((STR)"quit",	(CELLP)quit_f,		_SUBR);
	defsubr((STR)"putprop",	(CELLP)putprop_f,	_SUBR);
	defsubr((STR)"get",		(CELLP)get_f,		_SUBR);
	defsubr((STR)"remprop", (CELLP)remprop_f,	_SUBR);
	defsubr((STR)"read",	(CELLP)read_f,		_SUBR);
	defsubr((STR)"terpri",	(CELLP)terpri_f,	_SUBR);
	defsubr((STR)"print",	(CELLP)print_f,		_SUBR);
	defsubr((STR)"prin1",	(CELLP)prin1_f,		_SUBR);
	defsubr((STR)"princ",	(CELLP)princ_f,		_SUBR);
	defsubr((STR)"minus",	(CELLP)minus_f,		_SUBR);
	defsubr((STR)"plus",	(CELLP)plus_f,		_SUBR);
}