void mathmodinit(void) { builtinmod("$Math", Mathmodtab, Mathmodlen); fmtinstall('g', gfltconv); fmtinstall('G', gfltconv); fmtinstall('e', gfltconv); /* fmtinstall('E', gfltconv); */ /* avoid clash with ether address */ fmtinstall(0x00c9, gfltconv); /* L'É' */ fmtinstall('f', gfltconv); }
Module* newdyncode(int fd, char *path, Dir *dir) { Module *m; void *v; Runtab *r; Dynobj *o; char *name; DBG("module path is %s\n", path); m = nil; o = dynld(fd); if(o == nil) { DBG("%s\n", enverror()); goto Error; } v = addr("XXX", "module", o, signof(char*)); if(v == nil) goto Error; name = *(char**)v; DBG("module name is %s\n", name); r = addr(name, "modtab", o, signof(Runtab[])); if(r == nil) goto Error; m = builtinmod(name, r, 0); m->rt = DYNMOD; m->dev = dir->dev; m->dtype = dir->type; m->qid = dir->qid; m->mtime = dir->mtime; m->path = strdup(path); if(m->path == nil) goto Error; m->dlm = o; DBG("module base is 0x%p\n", o->base); return m; Error: if(o != nil) dynobjfree(o); if(m != nil) freemod(m); return nil; }