int ejOpenEngine(sym_fd_t variables, sym_fd_t functions) { ej_t *ep; int eid, vid; if ((eid = hAllocEntry((void***) &ejHandles, &ejMax, sizeof(ej_t))) < 0) { return -1; } ep = ejHandles[eid]; ep->eid = eid; /* * Create a top level symbol table if one is not provided for variables and * functions. Variables may create other symbol tables for block level * declarations so we use hAlloc to manage a list of variable tables. */ if ((vid = hAlloc((void***) &ep->variables)) < 0) { ejMax = hFree((void***) &ejHandles, ep->eid); return -1; } if (vid >= ep->variableMax) { ep->variableMax = vid + 1; } if (variables == -1) { ep->variables[vid] = symOpen(64) + EJ_OFFSET; ep->flags |= FLAGS_VARIABLES; } else { ep->variables[vid] = variables + EJ_OFFSET; } if (functions == -1) { ep->functions = symOpen(64); ep->flags |= FLAGS_FUNCTIONS; } else { ep->functions = functions; } ejLexOpen(ep); /* * Define standard constants */ ejSetGlobalVar(ep->eid, T("null"), NULL); #ifdef EMF ejEmfOpen(ep->eid); #endif return ep->eid; }
int websAspOpen() { if (++aspOpenCount == 1) { /* * Create the table for ASP functions */ websAspFunctions = symOpen(WEBS_SYM_INIT * 2); /* * Create standard ASP commands */ websAspDefine(T("write"), websAspWrite); } return 0; }
int websRomOpen() { websRomPageIndexType *wip; int nchars; char_t name[SYM_MAX]; romTab = symOpen(WEBS_SYM_INIT); for (wip = websRomPageIndex; wip->path; wip++) { gstrncpy(name, wip->path, SYM_MAX); nchars = gstrlen(name) - 1; if (nchars > 0 && (name[nchars] == '/' || name[nchars] == '\\')) { name[nchars] = '\0'; } symEnter(romTab, name, valueInteger((int) wip), 0); } return 0; }
int ejOpenBlock(int eid) { ej_t *ep; int vid; if((ep = ejPtr(eid)) == NULL) { return -1; } if ((vid = hAlloc((void***) &ep->variables)) < 0) { return -1; } if (vid >= ep->variableMax) { ep->variableMax = vid + 1; } ep->variables[vid] = symOpen(64) + EJ_OFFSET; return vid; }
void websFormOpen() { formSymtab = symOpen(WEBS_SYM_INIT); }