public Function FindFunction(string name) { var func = Functions.SingleOrDefault(f => f.Name == name); if (func != null) { return(func); } func = ExternFunctions.SingleOrDefault(f => f.Name == name); if (func != null) { return(func); } if (ParentModule == null) { return(null); } func = ParentModule.FindFunction(name); return(func ?? null); }
public override string ToString() { var standardIncludes = new[] { "rhea" }; var standardIncludeStatements = string.Join( "\n", standardIncludes.Select(i => $"#include \"{i}.h\"")); var externFunctionDeclarations = string.Join( "\n", ExternFunctions.Select(f => f.Declaration)); var structs = string.Join( "\n", Structs .Select(s => s.ToString())); var forwardDeclarations = string.Join( "\n", Functions .Where(f => f.Name != "main") .Select(f => f.Declaration)); var functionDefinitions = string.Join( "\n\n", Functions .Select(f => f.ToString())); var program = $"{standardIncludeStatements}\n\n{externFunctionDeclarations}\n\n{structs}\n\n{forwardDeclarations}\n\n{functionDefinitions}"; program = Regex.Replace(program, @"\n{2,}", "\n\n").Trim();; return(program); }
void IMeetingPanelView.ShowView() { if (!mp.IsVisible) { ExternFunctions.POINT mousepos = new ExternFunctions.POINT(); ExternFunctions.GetCursorPos(out mousepos); mp.Left = mousepos.X; mp.Top = mousepos.Y; ArrayList templist = mctrl.GetAllDays(); List <MainModel.JSONItem> markeditems = new List <MainModel.JSONItem>(); string tempmeeting = ""; string hoveredcelltext = ViewsConstructor.GetMainWindowController(mctrl.ctrlList).hoveredcell.Text.Substring(0, 1); foreach (object item in templist) { if (item.GetType() != typeof(MainModel.JSONHeader) && ((MainModel.JSONItem)item).meeting != null) { markeditems.Add((MainModel.JSONItem)item); } } templist = null; foreach (MainModel.JSONItem item in markeditems) { tempmeeting = ""; foreach (MainModel.MeetingObject meeting in item.meeting) { if ( item.meeting.Count > 5 ) { if (meeting != item.meeting.ElementAt(5)) { if (hoveredcelltext == item.date.Day.ToString()) { tempmeeting += meeting.time.ToShortTimeString() + " : " + meeting.subject + "\n"; } } else { tempmeeting += "...\n"; } } else { if (hoveredcelltext == item.date.Day.ToString()) { tempmeeting += meeting.time.ToShortTimeString() + " : " + meeting.subject + "\n"; } } } if (hoveredcelltext == item.date.Day.ToString()) { mp.TB_Meeting.Text = tempmeeting; } } } mp.Show(); }