--- stack/stack.h 2002/03/07 01:21:07 1.3 +++ stack/stack.h 2002/03/08 16:09:30 1.5 @@ -1,3 +1,24 @@ +/* + stack - an interactive interpreter for a stack-based language + Copyright (C) 2002 Mats Alritzson and Teddy Hogeborn + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Authors: Mats Alritzson + Teddy Hogeborn +*/ #define HASHTBLSIZE 2048 @@ -7,17 +28,19 @@ typedef struct { enum { integer, + tfloat, string, func, /* Function pointer */ symb, list - } type:3; /* Type of stack element */ + } type:4; /* Type of stack element */ int gc_garb:1; union { void *ptr; /* Pointer to the content */ - int val; /* ...or an integer */ + int i; /* ...or an integer */ + float f; } content; /* Stores a pointer or an integer */ } value; @@ -54,7 +77,7 @@ int err; /* Error flag */ char *in_string; /* Input pending to be read */ char *free_string; /* Free this string when all input is - read from in_string */ + read from in_string */ FILE *inputstream; /* stdin or a file, most likely */ int interactive; /* print prompts, stack, etc */ } environment; @@ -72,6 +95,7 @@ extern void gc_init(environment*); void push_val(environment*, value*); void push_int(environment*, int); +void push_float(environment*, float); void push_cstring(environment*, const char*); char *mangle_str(const char*); extern void mangle(environment*); @@ -117,3 +141,11 @@ extern void foreach(environment*); void protect(environment*, value*); void unprotect(environment*); +extern void copying(environment*); +extern void warranty(environment*); +extern void sx_2a(environment*); +extern void sx_2f(environment*); +extern void mod(environment*); +extern void sx_3c(environment*); +extern void sx_3c3d(environment*); +extern void sx_3e3d(environment*);