//Конструктор, на входе рекордсет с таблицей FunctionsOverloads public FunOverload(IRecordRead reco, FunClass funClass) { Owner = funClass; Number = reco.GetInt("RunNumber"); IsCombined = reco.GetBool("IsCombined"); for (int i = 1; i <= 9; ++i) { var t = reco.GetString("Operand" + i); if (t.IsEmpty()) { break; } Inputs.Add(new FunParam(TypeFromString(t), reco.GetString("Default" + i))); } for (int i = 1; i <= 2; ++i) { var t = reco.GetString("More" + i); if (t.IsEmpty()) { break; } InputsMore.Add(new FunParam(TypeFromString(t))); } var s = reco.GetString("Result"); if (!IsCombined) { Result = TypeFromString(s); } else { var p = s.Split('+'); foreach (string c in p) { if (c == "M1") { InputsMore[0].FormResult = true; } else if (c == "M2") { InputsMore[1].FormResult = true; } else { Inputs[int.Parse(c) - 1].FormResult = true; } } } }
//\ab //Загрузка списка функций public void LoadFunctions() { try { Funs.Clear(); using (var g = new DaoDb(_infoTaskDir + @"\General\General.accdb")) { using (var rec = new ReaderAdo(g, "SELECT * FROM Functions WHERE NotLoad = False")) while (rec.Read()) { //Сначала читаем сами функции var f = new FunClass(rec); Funs.Add(f.Name, f); if (f.Synonym != null) { Funs.Add(f.Synonym, f); } FunsId.Add(rec.GetInt("Id"), f); } using (var rec = new ReaderAdo(g, "SELECT FunctionsOverloads.* FROM Functions INNER JOIN FunctionsOverloads ON Functions.Id = FunctionsOverloads.FunctionId " + "WHERE Functions.NotLoad = False ORDER BY FunctionsOverloads.FunctionId, FunctionsOverloads.RunNumber")) { rec.Read(); while (!rec.EOF) { //Потом их перегрузки var id = rec.GetInt("FunctionId"); var fun = _funsId[id]; while (rec.GetInt("FunctionId") == id) { fun.Overloads.Add(new FunOverload(rec, fun)); if (!rec.Read()) { break; } } } } } } catch (Exception ex) { ex.MessageError("Системная ошибка компилятора. Ошибка загрузки функций"); } }
public ExprLexeme(Lexeme lexeme, FunClass fun, ExprType type = ExprType.Fun) { ExprType = type; Lexeme = lexeme; FunOverload = fun.Overloads[0]; }