[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gforth embedding

From: Serge Balakshiy
Subject: gforth embedding
Date: Sun, 12 Jul 2020 04:58:27 +0300

Anton Ertl
I have myprog program. This program is written in C. The program has a global 
pointer to all * mypoint. I want to embed gforth in my program. I need to write 
a function in this program
void p_setpoint( int x, int y, int mode ){
mypoint->setpoint(x, y, mode);
static struct primfcn  funcs [] = {
  {"0SETPOINT", p_setpoint},
    {NULL, (codeptr) 0}
void run_gforth_script(){
// I want to write something like this here
gforth_run( myscript );
// gforth_main(...);
file myscript.fs
10 10 1 setpoint
Question. How to do it?
You offer the following interface
void *gforth_engine(Xt *, stackpointers *);
Cell gforth_main(int argc, char **argv, char **env);
int gforth_args(int argc, char **argv, char **path, char **imagename);
ImageHeader* gforth_loader(char* imagename, char* path);
user_area* gforth_stacks(Cell dsize, Cell rsize, Cell fsize, Cell lsize);
void gforth_free_stacks(user_area* t);
void gforth_setstacks(user_area * t);
void gforth_free_dict();
Cell gforth_go(Xt* ip0);
Cell gforth_boot(int argc, char** argv, char* path);
void gforth_bootmessage();
Cell gforth_start(int argc, char ** argv);
Cell gforth_quit();
Xt gforth_find(Char * name);
Cell gforth_execute(Xt xt);
void gforth_cleanup();
void gforth_printmetrics();
void gforth_setwinch();
What function can I use as primdef ()?
Сергей Балакший

reply via email to

[Prev in Thread] Current Thread [Next in Thread]