void compInit(void) { int gclevel; gclevel = compDoGc ? StoCtl_GcLevel_Automatic : compDoGcFile ? StoCtl_GcLevel_Demand : StoCtl_GcLevel_Never; /* If and when to GG. */ stoCtl(StoCtl_GcLevel, gclevel); if (compDoGcVerbose) /* Put GC messages on osStdout. */ stoCtl(StoCtl_GcFile, osStdout); else stoCtl(StoCtl_GcFile, (FILE *) NULL); /* Do not initialize pieces. */ stoCtl(StoCtl_Wash, false); obInit(); dbInit(); comsgOpen(); compInfoAudit(); osSetBreakHandler(compSignalHandler); osSetFaultHandler(compSignalHandler); osSetLimitHandler(compSignalHandler); osSetDangerHandler(compSignalHandler); exitSetHandler (compExitHandler); fileSetHandler (compFileError); stoSetHandler (compStoreError); sxiSetHandler (compSExprError); pathInit(); if (compRootDir) { fileAddLibraryDirectory(fileSubdir(compRootDir, "lib")); fileAddLibraryDirectory(fileSubdir(fileSubdir(compRootDir, "share"), "lib")); fileAddIncludeDirectory(fileSubdir(compRootDir, "include")); ccSetRoot(compRootDir); } fileAddLibraryDirectory(osCurDirName()); compCfgInit(compRootDir); arInit(compLibraryFiles, compLibraryKeys); sxiInit(); keyInit(); ssymInit(); stabInitGlobal(); tfInit(); fmttsInit(); foamInit(); optInit(); tinferInit(); }
/* * Usage: showexports libName type-expression * Example: showexports libaldor.al 'List(Integer)' */ int main(int argc, char *argv[]) { osInit(); sxiInit(); keyInit(); ssymInit(); dbInit(); stabInitGlobal(); tfInit(); foamInit(); optInit(); tinferInit(); pathInit(); sposInit(); ablogInit(); comsgInit(); macexInitFile(); comsgInit(); scobindInitFile(); stabInitFile(); fileAddLibraryDirectory("."); String archive = argv[1]; String expression = argv[2]; scmdHandleLibrary("LIB", archive); AbSyn ab = shexpParse(expression); Stab stab = stabFile(); Syme syme = stabGetArchive(symInternConst("LIB")); AbSyn arAbSyn = abNewId(sposNone, symInternConst("LIB")); stabImportTForm(stab, tiGetTForm(stab, arAbSyn)); abPutUse(ab, AB_Use_Value); scopeBind(stab, ab); typeInfer(stab, ab); TForm tf = tiGetTForm(stab, ab); SymeList list = tfStabGetDomImports(stab, tf); for (; list != listNil(Syme); list = cdr(list)) { Syme syme = car(list); aprintf("%s %d %d %s\n", symeString(syme), symeDefnNum(syme), symeConstNum(syme), tfPretty(symeType(syme))); } scobindFiniFile(); stabFiniFile(); comsgFini(); macexFiniFile(); }
void init() { osInit(); sxiInit(); keyInit(); ssymInit(); dbInit(); stabInitGlobal(); tfInit(); foamInit(); optInit(); tinferInit(); sposInit(); ablogInit(); comsgInit(); }
/* * Usage: showexports libName type-expression * Example: showexports libaldor.al 'List(Integer)' */ int main(int argc, char *argv[]) { osInit(); sxiInit(); keyInit(); ssymInit(); dbInit(); stabInitGlobal(); tfInit(); foamInit(); optInit(); tinferInit(); pathInit(); sposInit(); ablogInit(); comsgInit(); macexInitFile(); comsgInit(); scobindInitFile(); stabInitFile(); fileAddLibraryDirectory("."); String archive = argv[1]; String expression = argv[2]; scmdHandleLibrary("LIB", archive); AbSyn ab = shexpParse(expression); Stab stab = stabFile(); Syme syme = stabGetArchive(symInternConst("LIB")); AbSyn arAbSyn = abNewId(sposNone, symInternConst("LIB")); AbSyn boolean = abNewId(sposNone, symInternConst("Boolean")); stabImportTForm(stab, tiGetTForm(stab, arAbSyn)); stabImportTForm(stab, tiGetTForm(stab, boolean)); abPutUse(ab, AB_Use_Value); scopeBind(stab, ab); typeInfer(stab, ab); TForm tf = tiGetTForm(stab, ab); aprintf("Type: %s Cat: %d\n", tfPretty(tf), tfSatCat(tf)); if (tfSatDom(tf)) { SymeList list = tfGetCatExports(tf); aprintf("Category\n"); for (; list != listNil(Syme); list = cdr(list)) { Syme syme = car(list); aprintf("%5s %3d %s %pAbSynList\n", symeString(syme), symeHasDefault(syme), tfPretty(symeType(syme)), symeCondition(syme)); } } else { aprintf(">>> Exports\n"); SymeList list = tfStabGetDomImports(stab, tf); for (; list != listNil(Syme); list = cdr(list)) { Syme syme = car(list); aprintf("%s %d %d %s\n", symeString(syme), symeDefnNum(syme), symeConstNum(syme), tfPretty(symeType(syme))); } TQualList tqList; aprintf(">>> Cascades\n"); tqList = tfGetDomCascades(tf); for (; tqList != listNil(TQual); tqList = cdr(tqList)) { TQual tq = car(tqList); aprintf("--> %s\n", tfPretty(tqBase(tq))); } } scobindFiniFile(); stabFiniFile(); comsgFini(); macexFiniFile(); }