summaryrefslogtreecommitdiff
path: root/apps/interpreters/bas/global.h
blob: 0fd211c055c766793d4b22d7df0a91784dc68378 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef GLOBAL_H
#define GLOBAL_H

#include "token.h"
#include "value.h"
#include "var.h"

#define GLOBAL_HASHSIZE 31

struct GlobalFunctionChain
{
  struct Pc begin,end;
  struct GlobalFunctionChain *next;
};

struct Global
{
  struct String command;
  struct Symbol *table[GLOBAL_HASHSIZE];
  struct GlobalFunctionChain *chain;
};

extern struct Global *Global_new(struct Global *this);
extern void Global_destroy(struct Global *this);
extern void Global_clear(struct Global *this);
extern void Global_clearFunctions(struct Global *this);
extern int Global_find(struct Global *this, struct Identifier *ident, int oparen);
extern int Global_function(struct Global *this, struct Identifier *ident, enum ValueType type, struct Pc *deffn, struct Pc *begin, int argTypesLength, enum ValueType *argTypes);
extern void Global_endfunction(struct Global *this, struct Identifier *ident, struct Pc *end);
extern int Global_variable(struct Global *this, struct Identifier *ident, enum ValueType type, enum SymbolType symbolType, int redeclare);

#endif