moved buffer into heap, prep to remove substates

This commit is contained in:
2021-11-15 23:47:29 +01:00
parent d79898fa20
commit 7f08e8717f
7 changed files with 53 additions and 13 deletions
+2
View File
@@ -7,6 +7,8 @@
#ifndef FORTH_FH_MEM_H
#define FORTH_FH_MEM_H
void fh_fill_input_buffer(struct fh_thread_s *fh, const char *data, size_t num);
void fh_align(struct fh_thread_s *fh);
void fh_setbase(struct fh_thread_s *fh, uint32_t base);
+9
View File
@@ -148,6 +148,11 @@ struct fh_thread_s {
/** Address of the last dict word */
uint32_t dict_last;
/** Input buffer parse position */
uint32_t inputptr;
/** Input buffer total content size */
uint32_t inputlen;
/** Forth state */
enum fh_state state;
@@ -158,6 +163,10 @@ struct fh_thread_s {
uint32_t base;
};
#define HEAP_END (HEAP_SIZE - WORDBUF_SIZE - INPUT_BUFFER_SIZE)
#define WORDBUF_ADDR HEAP_END
#define INPUTBUF_ADDR (HEAP_END + WORDBUF_SIZE)
enum fh_error fh_add_word(const struct fh_word_s *w, struct fh_thread_s *fh);
void fh_setstate(struct fh_thread_s *fh, enum fh_state state, enum fh_substate substate);
+1 -1
View File
@@ -16,6 +16,6 @@
struct fh_thread_s;
enum fh_error fh_init(struct fh_thread_s *fh);
enum fh_error fh_process_line(struct fh_thread_s *fh, const char *linebuf);
enum fh_error fh_process_line(struct fh_thread_s *fh, const char *linebuf, size_t len);
#endif //FORTH_H