summaryrefslogtreecommitdiff
path: root/apl9.h
diff options
context:
space:
mode:
Diffstat (limited to 'apl9.h')
-rw-r--r--apl9.h30
1 files changed, 20 insertions, 10 deletions
diff --git a/apl9.h b/apl9.h
index 4c28315..8b32141 100644
--- a/apl9.h
+++ b/apl9.h
@@ -104,7 +104,7 @@ struct Array
struct Statement
{
int ntoks;
- Datum *toks;
+ Datum **toks;
Statement *guard;
Statement *next;
};
@@ -144,6 +144,7 @@ struct Datum
{
datumTag tag;
int shy;
+ int refs;
union {
Array *array;
Statement stmt;
@@ -159,9 +160,9 @@ struct Symbol
{
int undefined;
Rune *name;
- Datum value;
+ Datum *value;
Datum *(*getfn)(void);
- void (*setfn)(Datum);
+ void (*setfn)(Datum *);
};
struct Symtab
@@ -182,7 +183,7 @@ struct QuadnameDef
Rune *name;
datumTag tag;
Datum *(*get)(void);
- void (*set)(Datum);
+ void (*set)(Datum *);
fnmonad monadfn;
fndyad dyadfn;
opmonad monadop;
@@ -225,11 +226,10 @@ struct Mail
/* Function prototypes for the different source files */
/* main.c */
Datum *evalline(Rune *, Biobuf *, int);
-Rune *prompt(Rune *);
/* print.c */
-Rune *ppdatum(Datum);
-Rune *ppdatums(Datum *, int);
+Rune *ppdatum(Datum *);
+Rune *ppdatums(Datum **, int);
Rune *pparray(Array *);
Rune *ppoperator(Operator);
Rune *ppfunction(Function);
@@ -273,11 +273,20 @@ void globalDIVset(int);
/* memory.c */
void *emalloc(ulong);
+void *emallocz(ulong, int);
+void *erealloc(void *, ulong);
void checkmem(char *);
-
Array *allocarray(int, int, int);
void freearray(Array *);
void incarrayref(Array *);
+Datum *allocdatum(int, int);
+void freedatum(Datum *);
+void incdatumref(Datum *);
+void freefunction(Function);
+void freeoperator(Operator);
+void freestatement(Statement);
+Function dupfunction(Function);
+Operator dupoperator(Operator);
/* functions.c */
Array *runfunc(Function, Array *,Array *);
@@ -286,7 +295,7 @@ Array *runtrain(Function *, int, Array *, Array *, Array *);
/* quadnames.c */
void initquadnames(void);
-Datum quadnamedatum(QuadnameDef);
+Datum *quadnamedatum(QuadnameDef);
/* error.c */
void throwerror(Rune *, int);
@@ -442,7 +451,8 @@ extern opmonad monadoperatordefs[]; /* operators.c */
extern opdyad dyadoperatordefs[]; /* operators.c */
extern fndyad hybridfunctiondefs[]; /* hybrids.c */
extern opmonad hybridoperatordefs[]; /* hybrids.c */
-extern int alloccounts; /* memory.c */
+extern int arrayalloccounts; /* memory.c */
+extern int datumalloccounts; /* memory.c */
extern QuadnameDef quadnames[]; /* quadnames.c */
extern int printprecision; /* print.c */
extern ErrorHandler globalerror; /* error.c */