sandbox/misc/kforth/v1/system.h

32 lines
620 B
C
Raw Permalink Normal View History

2018-02-25 06:35:58 +00:00
#ifndef __KF_CORE_H__
#define __KF_CORE_H__
#include "defs.h"
#include "io.h"
#include "stack.h"
typedef enum _SYS_STATUS : uint8_t {
STATUS_OK = 0,
STATUS_STACK_OVERFLOW = 1,
STATUS_STACK_UNDERFLOW = 2,
STATUS_EXECUTION_FAILURE = 3,
STATUS_UNKNOWN_WORD = 4,
STATUS_RSTACK_OVERFLOW = 5,
STATUS_RSTACK_UNDERFLOW = 6
} SYS_STATUS;
class Word;
2018-02-25 06:35:58 +00:00
typedef struct _System {
Stack<KF_INT> dstack;
Stack<KF_ADDR> rstack;
2018-02-25 06:35:58 +00:00
IO *interface;
Word *dict;
SYS_STATUS status;
uint8_t arena[ARENA_SIZE];
2018-02-25 06:35:58 +00:00
} System;
void system_clear_error(System *sys);
void system_write_status(System *sys);
2018-02-25 06:35:58 +00:00
#endif // __KF_CORE_H__