| 1 |
|
/* |
| 2 |
|
stack - an interactive interpreter for a stack-based language |
| 3 |
|
Copyright (C) 2002 Mats Alritzson and Teddy Hogeborn |
| 4 |
|
|
| 5 |
|
This program is free software; you can redistribute it and/or modify |
| 6 |
|
it under the terms of the GNU General Public License as published by |
| 7 |
|
the Free Software Foundation; either version 2 of the License, or |
| 8 |
|
(at your option) any later version. |
| 9 |
|
|
| 10 |
|
This program is distributed in the hope that it will be useful, |
| 11 |
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
|
GNU General Public License for more details. |
| 14 |
|
|
| 15 |
|
You should have received a copy of the GNU General Public License |
| 16 |
|
along with this program; if not, write to the Free Software |
| 17 |
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 |
|
|
| 19 |
|
Authors: Mats Alritzson <masse@fukt.bth.se> |
| 20 |
|
Teddy Hogeborn <teddy@fukt.bth.se> |
| 21 |
|
*/ |
| 22 |
|
|
| 23 |
#define HASHTBLSIZE 2048 |
#define HASHTBLSIZE 2048 |
| 24 |
|
|
| 67 |
defined symbols */ |
defined symbols */ |
| 68 |
typedef struct { |
typedef struct { |
| 69 |
stackitem *gc_ref; |
stackitem *gc_ref; |
| 70 |
|
stackitem *gc_protect; |
| 71 |
int gc_limit, gc_count; |
int gc_limit, gc_count; |
| 72 |
|
|
| 73 |
stackitem *head; /* Head of the stack */ |
stackitem *head; /* Head of the stack */ |
| 75 |
int err; /* Error flag */ |
int err; /* Error flag */ |
| 76 |
char *in_string; /* Input pending to be read */ |
char *in_string; /* Input pending to be read */ |
| 77 |
char *free_string; /* Free this string when all input is |
char *free_string; /* Free this string when all input is |
| 78 |
read from in_string */ |
read from in_string */ |
| 79 |
FILE *inputstream; /* stdin or a file, most likely */ |
FILE *inputstream; /* stdin or a file, most likely */ |
| 80 |
int interactive; /* print prompts, stack, etc */ |
int interactive; /* print prompts, stack, etc */ |
| 81 |
} environment; |
} environment; |
| 136 |
extern void readline(environment*); |
extern void readline(environment*); |
| 137 |
extern void sx_72656164(environment*); |
extern void sx_72656164(environment*); |
| 138 |
extern void foreach(environment*); |
extern void foreach(environment*); |
| 139 |
|
void protect(environment*, value*); |
| 140 |
|
void unprotect(environment*); |
| 141 |
|
extern void copying(environment *env); |
| 142 |
|
extern void warranty(environment *env); |