void elk_init_unix_wait() { Def_Prim(P_Wait, "unix-wait-vector-fill!", 2, 3, VARARGS); #ifdef WAIT_PROCESS Def_Prim(P_Wait_Process, "unix-wait-process-vector-fill!", 3, 4, VARARGS); P_Provide(Intern("unix:wait-process")); #endif #ifdef WAIT_OPTIONS P_Provide(Intern("unix:wait-options")); #endif }
void HTMLTableSectionElementImp::handleMutation(events::MutationEvent mutation) { switch (Intern(mutation.getAttrName().c_str())) { // Styles case Intern(u"background"): handleMutationBackground(mutation); break; default: HTMLElementImp::handleMutation(mutation); break; } }
void HTMLFontElementImp::handleMutation(events::MutationEvent mutation) { switch (Intern(mutation.getAttrName().c_str())) { // Styles case Intern(u"color"): handleMutationColor(mutation, u"color"); break; default: HTMLElementImp::handleMutation(mutation); break; } }
void HTMLPreElementImp::handleMutation(events::MutationEvent mutation) { std::u16string value = mutation.getNewValue(); css::CSSStyleDeclaration style(getStyle()); switch (Intern(mutation.getAttrName().c_str())) { // Styles case Intern(u"width"): if (mapToDimension(value)) style.setProperty(u"width", value, u"non-css"); break; default: HTMLElementImp::handleMutation(mutation); break; } }
Object P_Type (Object x) { register int t = TYPE(x); if (t < 0 || t >= Num_Types) Panic ("bad type2"); return Intern (Types[t].name); }
void HTMLMarqueeElementImp::handleMutation(events::MutationEvent mutation) { ECMAScriptContext* context = getOwnerDocumentImp()->getContext(); css::CSSStyleDeclaration style(getStyle()); std::u16string value = mutation.getNewValue(); bool compile = false; if (!value.empty()) { switch (mutation.getAttrChange()) { case events::MutationEvent::MODIFICATION: case events::MutationEvent::ADDITION: compile = true; break; default: break; } } switch (Intern(mutation.getAttrName().c_str())) { // Styles case Intern(u"height"): if (mapToDimension(value = mutation.getNewValue())) style.setProperty(u"height", value, u"non-css"); break; case Intern(u"hspace"): if (mapToDimension(value)) { style.setProperty(u"margin-left", value, u"non-css"); style.setProperty(u"margin-right", value, u"non-css"); } break; case Intern(u"vspace"): if (mapToDimension(value)) { style.setProperty(u"margin-top", value, u"non-css"); style.setProperty(u"margin-bottom", value, u"non-css"); } break; case Intern(u"width"): if (mapToDimension(value = mutation.getNewValue())) style.setProperty(u"width", value, u"non-css"); break; // Event handlers case Intern(u"onbounce"): setOnbounce(compile ? context->compileFunction(value).self() : nullptr); break; case Intern(u"onfinish"): setOnfinish(compile ? context->compileFunction(value).self() : nullptr); break; case Intern(u"onstart"): setOnstart(compile ? context->compileFunction(value).self() : nullptr); break; default: HTMLElementImp::handleMutation(mutation); break; } }
void Init_Prim () { register struct Prim_Init *p; Object frame, prim, sym; for (frame = Car (The_Environment), p = Primitives; p->fun; p++) { prim = Make_Primitive (p->fun, p->name, p->minargs, p->maxargs, p->disc); sym = Intern (p->name); frame = Add_Binding (frame, sym, prim); } Car (The_Environment) = frame; Memoize_Frame (frame); }
void HTMLTableRowElementImp::handleMutation(events::MutationEvent mutation) { std::u16string value; css::CSSStyleDeclaration style(getStyle()); switch (Intern(mutation.getAttrName().c_str())) { // Styles case Intern(u"background"): handleMutationBackground(mutation); break; case Intern(u"bgcolor"): handleMutationColor(mutation, u"background-color"); break; // Styles case Intern(u"height"): if (mapToDimension(value = mutation.getNewValue())) style.setProperty(u"height", value, u"non-css"); break; default: HTMLElementImp::handleMutation(mutation); break; } }
void HTMLImageElementImp::handleMutation(events::MutationEvent mutation) { std::u16string value = mutation.getNewValue(); css::CSSStyleDeclaration style(getStyle()); switch (Intern(mutation.getAttrName().c_str())) { case Intern(u"src"): if (DocumentImp* document = getOwnerDocumentImp()) { if (request) request->abort(); else request = new(std::nothrow) HttpRequest(document->getDocumentURI()); if (request) { request->open(u"GET", getSrc()); request->setHandler(boost::bind(&HTMLImageElementImp::notify, this)); document->incrementLoadEventDelayCount(); request->send(); } else active = false; } break; // Styles case Intern(u"border"): handleMutationBorder(mutation); break; case Intern(u"height"): if (mapToDimension(value)) style.setProperty(u"height", value, u"non-css"); break; case Intern(u"hspace"): if (mapToDimension(value)) { style.setProperty(u"margin-left", value, u"non-css"); style.setProperty(u"margin-right", value, u"non-css"); } break; case Intern(u"vspace"): if (mapToDimension(value)) { style.setProperty(u"margin-top", value, u"non-css"); style.setProperty(u"margin-bottom", value, u"non-css"); } break; case Intern(u"width"): if (mapToDimension(value)) style.setProperty(u"width", value, u"non-css"); break; default: HTMLElementImp::handleMutation(mutation); break; } }
void Define_Primitive (Object (*fun)(), char const *name, int min, int max, enum discipline disc) { Object prim, sym, frame; GC_Node2; Set_Error_Tag ("define-primitive"); prim = Make_Primitive (fun, name, min, max, disc); sym = Null; GC_Link2 (prim, sym); sym = Intern (name); if (disc == EVAL && min != max) Primitive_Error ("~s: number of arguments must be fixed", sym); frame = Add_Binding (Car (The_Environment), sym, prim); SYMBOL(sym)->value = prim; Car (The_Environment) = frame; GC_Unlink; }
Object Make_Window (int finalize, Display *dpy, Window win) { Object w; if (win == None) return Sym_None; if (win == PointerRoot) return Intern ("pointer-root"); w = Find_Object (T_Window, (GENERIC)dpy, Match_X_Obj, win); if (Nullp (w)) { w = Alloc_Object (sizeof (struct S_Window), T_Window, 0); WINDOW(w)->tag = Null; WINDOW(w)->win = win; WINDOW(w)->dpy = dpy; WINDOW(w)->free = 0; WINDOW(w)->finalize = finalize; Register_Object (w, (GENERIC)dpy, finalize ? P_Destroy_Window : (PFO)0, 0); } return w; }
void elk_init_unix_file() { Def_Prim(P_Accessp, "unix-access?", 2, 2, EVAL); Def_Prim(P_Chdir, "unix-chdir", 1, 1, EVAL); Def_Prim(P_Chmod, "unix-chmod", 2, 2, EVAL); Def_Prim(P_Chown, "unix-chown", 3, 3, EVAL); Def_Prim(P_Link, "unix-link", 2, 2, EVAL); Def_Prim(P_Mkdir, "unix-mkdir", 2, 2, EVAL); Def_Prim(P_Read_Directory, "unix-read-directory", 1, 1, EVAL); Def_Prim(P_Rename, "unix-rename", 2, 2, EVAL); Def_Prim(P_Stat, "unix-stat-vector-fill!", 2, 2, EVAL); #ifdef SYMLINKS Def_Prim(P_Lstat, "unix-lstat-vector-fill!", 2, 2, EVAL); Def_Prim(P_Readlink, "unix-readlink", 1, 1, EVAL); Def_Prim(P_Rmdir, "unix-rmdir", 1, 1, EVAL); Def_Prim(P_Symlink, "unix-symlink", 2, 2, EVAL); P_Provide(Intern("unix:symlinks")); #endif Def_Prim(P_Unlink, "unix-unlink", 1, 1, EVAL); Def_Prim(P_Utime, "unix-utime", 1, 3, VARARGS); }
void elk_init_lib_hack () { Define_Primitive (P_Hack_Procedure_Environment, "hack-procedure-environment!", 2, 2, EVAL); P_Provide (Intern ("hack.la")); }
static Object General_Wait(Object ret, Object ruret, int haspid, int pid, int options) { #ifndef WIN32 int retpid, st, code; char *status; #ifdef WAIT_RUSAGE struct rusage ru; Object sec; #endif Object x; GC_Node3; x = Null; Check_Result_Vector(ret, 5); Check_Result_Vector(ruret, 2); if (haspid) { #ifdef HAVE_WAIT4 retpid = wait4(pid, &st, options, &ru); #else #ifdef HAVE_WAITPID retpid = waitpid(pid, &st, options); #endif #endif } else { #ifdef HAVE_WAIT3 retpid = wait3(&st, options, &ru); #else retpid = wait(&st); #endif } if (retpid == -1 && errno != ECHILD) Raise_System_Error("~E"); GC_Link3(ret, ruret, x); x = Make_Integer(retpid); VECTOR(ret)->data[0] = x; if (retpid == 0 || retpid == -1) { status = "none"; st = code = 0; #ifdef WAIT_RUSAGE memset((char *)&ru, 0, sizeof(ru)); #endif } else if (WIFSTOPPED(st)) { status = "stopped"; code = WSTOPSIG(st); } else if (WIFSIGNALED(st)) { status = "signaled"; code = WTERMSIG(st); } else { status = "exited"; code = WEXITSTATUS(st); } x = Intern(status); VECTOR(ret)->data[1] = x; x = Make_Integer(code); VECTOR(ret)->data[2] = x; VECTOR(ret)->data[3] = st & 0200 ? True : False; #ifdef WAIT_RUSAGE x = Cons(Null, Make_Unsigned_Long((unsigned long)ru.ru_utime.tv_usec * 1000)); sec = Make_Unsigned_Long((unsigned long)ru.ru_utime.tv_sec); Car(x) = sec; VECTOR(ruret)->data[0] = x; x = Cons(Null, Make_Unsigned_Long((unsigned long)ru.ru_stime.tv_usec * 1000)); sec = Make_Unsigned_Long((unsigned long)ru.ru_stime.tv_sec); Car(x) = sec; VECTOR(ruret)->data[1] = x; #endif GC_Unlink; #endif return Void; }
Object Read_Special (Object port, int konst) { Object ret; register int c, str; register FILE *f; #define READ_QUOTE(sym) \ ( ret = Read_Atom (port, konst),\ konst ? (ret = Const_Cons (ret, Null), Const_Cons (sym, ret))\ : (ret = Cons (ret, Null), Cons (sym, ret))) f = PORT(port)->file; str = PORT(port)->flags & P_STRING; again: Reader_Getc; switch (c) { case EOF: eof: Reader_Tweak_Stream; Reader_Error (port, "premature end of file"); case ';': if (Skip_Comment (port) == EOF) goto eof; goto again; case ']': case ')': SET(ret, T_Special, c); return ret; case '[': case '(': return Read_Sequence (port, 0, konst, c); case '\'': return READ_QUOTE(Sym_Quote); case '`': return READ_QUOTE(Sym_Quasiquote); case ',': Reader_Getc; if (c == EOF) goto eof; if (c == '@') { return READ_QUOTE(Sym_Unquote_Splicing); } else { Reader_Ungetc; return READ_QUOTE(Sym_Unquote); } case '"': return Read_String (port, konst); case '#': ret = Read_Sharp (port, konst); if (TYPE(ret) == T_Special) goto again; return ret; default: if (Whitespace (c)) goto again; Read_Reset (); if (c == '.') { Reader_Getc; if (c == EOF) goto eof; if (Whitespace (c)) { Reader_Ungetc; SET(ret, T_Special, '.'); return ret; } Read_Store ('.'); } while (!Whitespace (c) && !Delimiter (c) && c != EOF) { if (c == '\\') { Reader_Getc; if (c == EOF) break; } Read_Store (c); Reader_Getc; } Read_Store ('\0'); if (c != EOF) Reader_Ungetc; ret = Parse_Number (port, Read_Buf, 10); if (Nullp (ret)) ret = Intern (Read_Buf); return ret; } /*NOTREACHED*/ }
SReference SExpressionHashPackage::MakeSymbol(const char *name) { return Intern(name); }
static Object General_Stat(Object obj, Object ret, int l) { Object x; struct stat st; char *s, *fn = NULL; int fd = -1, result = 0; GC_Node; Check_Result_Vector(ret, 11); if (l) { #ifdef SYMLINKS result = lstat(Get_Strsym(obj), &st); #endif } else { Get_Filename_Or_Filedescr(obj, fd, fn); result = fn ? stat(fn, &st) : fstat(fd, &st); } if (result == -1) Raise_System_Error1("~s: ~E", obj); switch (st.st_mode & S_IFMT) { case S_IFDIR: s = "directory"; break; case S_IFCHR: s = "character-special"; break; case S_IFBLK: s = "block-special"; break; case S_IFREG: s = "regular"; break; #ifdef S_IFLNK case S_IFLNK: s = "symlink"; break; #endif #ifdef S_IFSOCK case S_IFSOCK: s = "socket"; break; #endif #ifdef S_IFFIFO case S_IFFIFO: s = "fifo"; break; #endif default: s = "unknown"; break; } /* Bad assumption: any of the st_ fields fits into an unsigned int. */ GC_Link(ret); x = Intern(s); VECTOR(ret)->data[0] = x; x = Make_Unsigned((unsigned)st.st_mode & ~S_IFMT); VECTOR(ret)->data[1] = x; x = Make_Unsigned_Long((unsigned long)st.st_ino); VECTOR(ret)->data[2] = x; x = Make_Unsigned((unsigned)st.st_dev); VECTOR(ret)->data[3] = x; x = Make_Unsigned((unsigned)st.st_nlink); VECTOR(ret)->data[4] = x; x = Make_Unsigned((unsigned)st.st_uid); VECTOR(ret)->data[5] = x; x = Make_Unsigned((unsigned)st.st_gid); VECTOR(ret)->data[6] = x; x = Make_Long((long)st.st_size); VECTOR(ret)->data[7] = x; x = Make_Unsigned_Long((unsigned long)st.st_atime); VECTOR(ret)->data[8] = x; x = Make_Unsigned_Long((unsigned long)st.st_mtime); VECTOR(ret)->data[9] = x; x = Make_Unsigned_Long((unsigned long)st.st_ctime); VECTOR(ret)->data[10] = x; GC_Unlink; return Void; }