static void Kill(Engine *engine) { XEngine *xeng= (XEngine *)engine; p_win *w = xeng->win; ShutDown(xeng); if (w) p_destroy(w); /* for program-driven Kill(), can take care of p_disconnect immediately */ g_do_disconnect(); }
static void dispatch(const char *file_name, int print_only) { char *source = read_whole_file(file_name); program_t *prog = p_new(source, 1024); if (print_only) { bc_dump(stdout, prog->bytecode); } else { p_exec(prog, 30000); } p_destroy(prog); }
static void Kill(Engine *engine) { XEngine *xeng= (XEngine *)engine; p_win *w = xeng->win; ShutDown(xeng); if (w) { p_destroy(w); } /* for program-driven Kill(), can take care of p_disconnect immediately */ if (g_pending_task) g_pending_task(); }
int GxDirect(Engine *engine) { XEngine *xeng = GisXEngine(engine); if (!xeng || !xeng->w || xeng->w==xeng->win) return 1; p_destroy(xeng->w); xeng->w = xeng->win; /* set coordinate map and clipping to values for graphics window */ xeng->e.transform = xeng->swapped; GpDeviceMap((Engine *)xeng); ChangeMap((Engine *)xeng); return 0; }
static void ShutDown(XEngine *xeng) { p_scr *s = xeng->s; p_win *w = xeng->w; p_win *win = xeng->win; if ((Engine *)xeng == gxCurrentEngine) gxCurrentEngine = NULL; xeng->mapped= 0; /* turn off all event callbacks (probably unnecessary) */ xeng->e.on = 0; /* destroy any hlevel references without further ado */ if (HLevelHook) HLevelHook((Engine *)xeng); xeng->w = xeng->win = 0; xeng->s = 0; /* note that p_destroy and GpDelEngine call on_destroy in Windows */ if (w && w!=win) p_destroy(w); GpDelEngine(&xeng->e); if (s) { if (!p_wincount(s)) g_pending_task = g_do_disconnect; } }
static void ShutDown(XEngine *xeng) { p_scr *s = xeng->s; p_win *w = xeng->w; p_win *win = xeng->win; xeng->mapped= 0; /* destroy any hlevel references without further ado */ if (HLevelHook) HLevelHook((Engine *)xeng); xeng->w = xeng->win = 0; xeng->s = 0; if (w && w!=win) p_destroy(w); GpDelEngine(&xeng->e); if (s) { Engine *eng; XEngine *xe2; for (eng=GpNextEngine(0) ; eng ; eng=GpNextEngine(eng)) { xe2 = GisXEngine(eng); if (xe2 && xe2->s==s) break; } if (!eng) { int i; if (g_pending_task == g_do_disconnect) { for (i=0 ; i<=G_N_PENDING ; i++) if (g_pending_scr[i] == s) break; if (i >= G_N_PENDING) { for (i=0 ; i<=G_N_PENDING ; i++) if (!g_pending_scr[i]) break; if (i < G_N_PENDING) g_pending_scr[i] = s; } } else { g_pending_scr[0] = s; for (i=1 ; i<=G_N_PENDING ; i++) g_pending_scr[i] = 0; g_pending_task = g_do_disconnect; } } } }