static LispObject SelfValue(LispObject o1, LispObject o2) { if (TYPE(o1) == TYPE(o2)) { switch (TYPE(o2)) { case LISP_INTEGER: o1 = o2; break; case LISP_SYMBOL: LSYMBOL(o1)->name = StringAlloc(LSYMBOL(o2)->name); break; case LISP_STRING: LSTRING(o1)->str = StringAlloc(LSTRING(o2)->str); break; case LISP_FLOAT: LFLOAT(o1)->value = LFLOAT(o2)->value; break; } } else { o1 = CopyObject(o2); } return o1; }
void RequestInit(TSession * const sessionP, TConn * const connectionP) { sessionP->validRequest = false; /* Don't have valid request yet */ time(&sessionP->date); sessionP->connP = connectionP; sessionP->responseStarted = FALSE; sessionP->chunkedwrite = FALSE; sessionP->chunkedwritemode = FALSE; sessionP->continueRequired = FALSE; ListInit(&sessionP->cookies); ListInit(&sessionP->ranges); TableInit(&sessionP->requestHeaderFields); TableInit(&sessionP->responseHeaderFields); sessionP->status = 0; /* No status from handler yet */ StringAlloc(&(sessionP->header)); }
void RequestInit(TSession * const sessionP, TConn * const connectionP) { time_t nowtime; sessionP->validRequest = false; /* Don't have valid request yet */ time(&nowtime); sessionP->date = *gmtime(&nowtime); sessionP->conn = connectionP; sessionP->responseStarted = FALSE; sessionP->chunkedwrite = FALSE; sessionP->chunkedwritemode = FALSE; ListInit(&sessionP->cookies); ListInit(&sessionP->ranges); TableInit(&sessionP->request_headers); TableInit(&sessionP->response_headers); sessionP->status = 0; /* No status from handler yet */ StringAlloc(&(sessionP->header)); }
void String_Init() { MemHandle Resource; DmResID Id; context* p = Context(); StringAlloc(); for (Id=1000;Id<1000+32;++Id) { Resource = DmGetResource('lang',Id); if (Resource) { int Size = MemHandleSize(Resource); void* Data = MemHandleLock(Resource); if (Size && Data && StringAddBinary(Data,Size)) ArrayAppend(&p->StrModule,&Resource,sizeof(Resource),16); else { if (Data) MemHandleUnlock(Resource); DmReleaseResource(Resource); } } } }
LispObject GC_MakeSymbol(char *name) { LispObject o; struct LispSymbol *s = SYMBOL_NEW(); s->name = StringAlloc(name); SET_SYMBOL(o, s); return o; }
LispObject Alloc_MakeSymbol(char *name) { LispObject o; struct LispSymbol *s = (struct LispSymbol *)Malloc(sizeof(struct LispSymbol)); s->name = StringAlloc(name); SET_SYMBOL(o, s); return o; }
LispObject Alloc_MakeString(char *str) { LispObject o; struct LispString *s = (struct LispString *)Malloc(sizeof(struct LispString)); s->str = StringAlloc(str); s->len = (int)strlen(str); SET_STRING(o, s); return o; }
LispObject GC_MakeString(char *str) { LispObject o; struct LispString *s = STRING_NEW(); s->str = StringAlloc(str); s->len = (int)strlen(str); SET_STRING(o, s); return o; }
static void LispPushStack(struct LispStack *s, LispObject symbol, LispObject value) { struct StackFrame *stack = s->stack; CHECK_SYMBOL(symbol); stack[s->stackPointer].name = StringAlloc(LSYMBOL(symbol)->name); stack[s->stackPointer].value = value; s->stackPointer++; if (s->stackPointer == MAX_STACK_SIZE) { LISP_ERROR("stack over\n"); } }
void SetUp() { TCHAR* cmdLine; DWORD len; // Get the relevant part of the command line and copy it to // writable memory as required by CreateProcess cmdLine = SkipFirstCmdLineArg(GetCommandLine(), TRUE); if ((gCmdLine = StringAllocAndCopy(cmdLine)) == NULL) SYS_ERROR(); gExiting = FALSE; len = GetCurrentDirectory(0, NULL); gCurrentDirectory = StringAlloc(len); GetCurrentDirectory(len + 1, gCurrentDirectory); gIpcPipe = INVALID_HANDLE_VALUE; gStdInPipe = INVALID_HANDLE_VALUE; gStdOutPipe = INVALID_HANDLE_VALUE; gStdErrPipe = INVALID_HANDLE_VALUE; }
void String_Init() { void* Buffer; StringAlloc(); Buffer = malloc(MAXTEXT); if (Buffer) { #ifdef NO_PLUGINS { int n; HANDLE Module = GetModuleHandle(NULL); HRSRC Rsrc = FindResource(Module,MAKEINTRESOURCE(2000),T("LANGTAR")); if (Rsrc) { int Size = SizeofResource(Module,Rsrc); HGLOBAL Global = LoadResource(Module,Rsrc); if (Global) { void* p = LockResource(Global); if (p) { stream* Stream = StreamOpenMem(p,Size); if (Stream) { LoadTGZ(Stream,Buffer); StreamCloseMem(Stream); } } } } for (n=2000;(Rsrc = FindResource(Module,MAKEINTRESOURCE(n),T("LANG")))!=NULL;++n) { int Size = SizeofResource(Module,Rsrc); HGLOBAL Global = LoadResource(Module,Rsrc); if (Global) { void* p = LockResource(Global); if (p) StringAddText(p,Size); } } } #endif #ifndef NO_LANG { tchar_t Path[MAXPATH]; stream* p; GetModulePath(Path,T("common.dll")); tcscat_s(Path,TSIZEOF(Path),T("language.tgz")); p = StreamOpen(Path,0); if (p) { LoadTGZ(p,Buffer); StreamClose(p); } GetModulePath(Path,T("common.dll")); FindFiles(Path,T("*.txt"),LoadTXT,Buffer); } #endif free(Buffer); } }