-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathfirmforth.h
More file actions
35 lines (28 loc) · 761 Bytes
/
firmforth.h
File metadata and controls
35 lines (28 loc) · 761 Bytes
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
33
34
35
#ifndef FIRMFORTH_H
#define FIRMFORTH_H
#include <stdint.h>
#include <stdbool.h>
#include <libfirm/firm.h>
/* Type of elements on the forth data stack */
union cell {
intptr_t i;
uintptr_t u;
char *s;
const char *cs;
void *a;
void **aa;
};
typedef union cell cell;
/* Type of functions implementing forth words */
typedef cell* (*word)(cell *sp);
#define WORD(name) cell* (name)(cell *sp)
struct dict {
const char *name; /* Forth word */
int immediate : 1; /* execute even when compiling */
word code; /* pointer to function implementing the word */
ir_entity *entity; /* Firm entity for function */
const char *ldname; /* Optionally override .name as linker symbol */
struct dict *next;
};
extern struct dict *dictionary;
#endif