Annotation of gforth/vmgen-ex/mini.h, revision 1.1
1.1 ! anton 1: /* support functions for vmgen example
! 2:
! 3: Copyright (C) 2001 Free Software Foundation, Inc.
! 4:
! 5: This file is part of Gforth.
! 6:
! 7: Gforth is free software; you can redistribute it and/or
! 8: modify it under the terms of the GNU General Public License
! 9: as published by the Free Software Foundation; either version 2
! 10: of the License, or (at your option) any later version.
! 11:
! 12: This program is distributed in the hope that it will be useful,
! 13: but WITHOUT ANY WARRANTY; without even the implied warranty of
! 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! 15: GNU General Public License for more details.
! 16:
! 17: You should have received a copy of the GNU General Public License
! 18: along with this program; if not, write to the Free Software
! 19: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
! 20: */
! 21:
! 22: #include <stdio.h>
! 23:
! 24: typedef void *Label;
! 25: typedef void *Inst; /* for direct threading, the same as Label */
! 26: typedef long Cell;
! 27:
! 28: extern Inst *vm_prim;
! 29: extern int locals;
! 30: extern Cell peeptable;
! 31: extern int vm_debug;
! 32: extern FILE *yyin;
! 33: extern int yylineno;
! 34: extern char *program_name;
! 35: extern FILE *vm_out;
! 36: extern Inst *vmcodep;
! 37: extern Inst *last_compiled;
! 38:
! 39: /* generic vmgen support functions (e.g., wrappers) */
! 40: void gen_inst(Inst **vmcodepp, Inst i);
! 41: void init_peeptable(void);
! 42: void vm_disassemble(Inst *ip, Inst *endp, Inst prim[]);
! 43: void vm_count_block(Inst *ip);
! 44: struct block_count *block_insert(Inst *ip);
! 45:
! 46: /* mini type-specific support functions */
! 47: void genarg_i(Inst **vmcodepp, Cell i);
! 48: void printarg_i(Cell i);
! 49: void genarg_target(Inst **vmcodepp, Inst *target);
! 50: void printarg_target(Inst *target);
! 51: void printarg_a(char *a);
! 52:
! 53: /* engine functions (type not fixed) */
! 54: Cell engine(Inst *ip0, Cell *sp, char *fp);
! 55: Cell engine_debug(Inst *ip0, Cell *sp, char *fp);
! 56:
! 57:
! 58: /* other generic functions */
! 59: int yyparse(void);
! 60:
! 61: /* mini-specific functions */
! 62: void insert_func(char *name, Inst *start, int locals, int nonparams);
! 63: Inst *func_addr(char *name);
! 64: Cell func_calladjust(char *name);
! 65: void insert_local(char *name);
! 66: Cell var_offset(char *name);
! 67: void gen_main_end(void);
! 68:
! 69: /* stack pointer change for a function with n nonparams */
! 70: #define adjust(n) ((n) * -sizeof(Cell))
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>