Trying to build a forth runtime in C
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
forth/include/fh_mem.h

40 lines
1.3 KiB

3 years ago
/**
* Forth heap and compile memory
*
* Created on 2021/11/13.
*/
#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);
3 years ago
void fh_setbase(struct fh_thread_s *fh, uint32_t base);
3 years ago
enum fh_error fh_fetch(struct fh_thread_s *fh, uint32_t addr, uint32_t *dst);
enum fh_error fh_fetch_char(struct fh_thread_s *fh, uint32_t addr, char *dst);
enum fh_error fh_store(struct fh_thread_s *fh, uint32_t addr, uint32_t val);
enum fh_error fh_store_char(struct fh_thread_s *fh, uint32_t addr, char val);
3 years ago
enum fh_error fh_heap_reserve(
struct fh_thread_s *fh,
size_t len,
uint32_t *addr
);
void fh_heap_write(struct fh_thread_s *fh, uint32_t addr, const void *src, uint32_t len);
enum fh_error fh_heap_put(struct fh_thread_s *fh, const void *src, uint32_t len);
void fh_heap_copy(struct fh_thread_s *fh, uint32_t addr, uint32_t srcaddr, uint32_t len);
3 years ago
enum fh_error fh_put_instr(struct fh_thread_s *fh, enum fb_instruction_kind kind, uint32_t data);
char *fh_str_at(struct fh_thread_s *fh, uint32_t addr);
struct fh_instruction_s *fh_instr_at(struct fh_thread_s *fh, uint32_t addr);
struct fh_word_s *fh_word_at(struct fh_thread_s *fh, uint32_t addr);
3 years ago
#endif //FORTH_FH_MEM_H