//- reading declarations ------------------------------------ public FuncDefNode loadFuncDef(String path) { localSymbols.Clear(); FuncDefNode func = new FuncDefNode(); func.name = oilcan.getStringValue(path + ".name", ""); func.returnType = loadTypeDecl(path + ".return-type"); List <String> paramnames = oilcan.getPathKeys(path + ".params"); foreach (String pname in paramnames) { ParamDeclNode p = loadParamDecl(path + ".params." + pname); func.paramList.Add(p); localSymbols[pname] = p; } List <String> localnames = oilcan.getPathKeys(path + ".locals"); foreach (String lname in localnames) { VarDeclNode l = loadVarDecl(path + ".locals." + lname); func.locals.Add(l); localSymbols[lname] = l; } func.body = loadStatementList(path + ".body"); return(func); }
public static WebFolder loadFolder(EnamlData silk, string path, string name, WebFolder parent) { WebFolder folder = new WebFolder(name, parent); string fullpath = (path.Length > 0) ? path + "." + name + "." : ""; List <String> pagenames = silk.getPathKeys(fullpath + "pages"); foreach (String pagename in pagenames) { WebPage page = WebPage.loadPage(silk, fullpath + "pages", pagename, folder); folder.pages.Add(page); } List <String> resourcenames = silk.getPathKeys(fullpath + "resources"); foreach (String resname in resourcenames) { WebResource resource = WebResource.loadResource(silk, fullpath + "resources", resname, folder); folder.resources.Add(resource); } List <String> foldernames = silk.getPathKeys(fullpath + "folders"); foreach (String foldername in foldernames) { WebFolder subfolder = WebFolder.loadFolder(silk, fullpath + "folders", foldername, folder); folder.folders.Add(subfolder); } return(folder); }
public Module load() { Module module = null; try { globalSymbols = new Dictionary <string, Declaration>(); localSymbols = new Dictionary <string, Declaration>(); oilcan = EnamlData.loadFromFile(filename); string oilVersion = oilcan.getStringValue("OILCan.version", ""); string modname = oilcan.getStringValue("module.name", ""); module = new Module(modname); List <String> funcs = oilcan.getPathKeys("module.funcs"); foreach (String funcname in funcs) { FuncDefNode func = loadFuncDef("module.funcs." + funcname); module.funcs.Add(func); globalSymbols[funcname] = func; } } catch (ENAMLException e) { return(null); } return(module); }
//--------------------------------------------------------------------- public static VSTRig loadFromFile(String path, ControlPanel controlPanel) { VSTRig rig = null; EnamlData rigData = EnamlData.loadFromFile(path); //load data from file if (rigData != null) { rig = new VSTRig(controlPanel); //load plugins List <String> plugs = rigData.getPathKeys("plugin-list"); Dictionary <String, VSTPanel> plugList = new Dictionary <string, VSTPanel>(); //temp dict for matching plugins to patches foreach (String plug in plugs) { String plugPath = rigData.getStringValue("plugin-list." + plug + ".path", ""); String plugAudioOut = rigData.getStringValue("plugin-list." + plug + ".audio-out", ""); String plugMidiIn = rigData.getStringValue("plugin-list." + plug + ".midi-in", ""); VSTPanel panel = rig.addPanel(plugPath); //panel.plugin.setAudioOut(plugAudioOut); panel.setMidiIn(plugMidiIn); plugList[plug] = panel; } //load patches List <String> pats = rigData.getPathKeys("patch-list"); foreach (String pat in pats) { String patchName = rigData.getStringValue("patch-list." + pat + ".name", ""); Patch patch = new Patch(patchName); foreach (String plug in plugs) { int patnum = rigData.getIntValue("patch-list." + pat + "." + plug, 0); patch.addPanel(plugList[plug], patnum); } rig.patches.Add(patch); } rig.setCurrentPatch(0); } return(rig); }
//use hard coded fields for now public static Format loadFormatFile(string filepath) { Format format = new Format(); EnamlData gosling = EnamlData.loadFromFile(filepath); string gosVersion = gosling.getStringValue("Gosling.version", ""); //read in structure data List <String> structs = gosling.getPathKeys("structs"); foreach (String structname in structs) { FStruct fs = new FStruct(format, structname); List <String> fields = gosling.getPathKeys("structs." + structname); String fieldpath = "structs." + structname + "."; foreach (String fieldname in fields) { String fline = gosling.getStringValue(fieldpath + fieldname, ""); List <String> parms = getParams(fline); FField f = loadField(fs, fieldname, parms); fs.fields.Add(f); fs.symTable.addEntry(fieldname, f); } format.structs.addEntry(structname, fs); } //read in file structure data format.fyle = new FStruct(format, "file"); List <String> ffields = gosling.getPathKeys("file"); foreach (String fieldname in ffields) { String fline = gosling.getStringValue("file." + fieldname, "").Trim(); List <String> parms = getParams(fline); FField f = loadField(format.fyle, fieldname, parms); format.fyle.fields.Add(f); format.fyle.symTable.addEntry(fieldname, f); } return(format); }