public void Save(CGenerator cGenerator) { CFile cFile = new CFile(); cFile.AddElement(new Comment("Generated by LwipMibCompiler")); cFile.AddElement(EmptyLine.SingleLine); string headerDefine = cGenerator.FileName; headerDefine = new Regex("[^a-zA-Z0-9]").Replace(headerDefine, "_"); headerDefine = headerDefine.ToUpperInvariant(); CodeContainerBase e = cFile.AddElement(new PP_Ifdef(headerDefine, inverted: true)) as CodeContainerBase; e.AddElement(new PP_Macro(headerDefine, headerDefine)); e.AddElement(EmptyLine.SingleLine); e.AddElement(new PP_Include(LwipDefs.Incl_SnmpOpts)); e = e.AddElement(new PP_If(LwipDefs.Opt_SnmpEnabled)) as CodeContainerBase; e.AddElement(EmptyLine.SingleLine); CodeContainerBase cplusplusopen = e.AddElement(new PP_Ifdef("__cplusplus")) as CodeContainerBase; cplusplusopen.AddElement(new Code("extern \"C\" {")); e.AddElement(EmptyLine.SingleLine); if (this.includes.Count > 0) { e.AddElements(this.includes); e.AddElement(EmptyLine.SingleLine); } if (this.defines.Count > 0) { e.AddElements(this.defines); e.AddElement(EmptyLine.SingleLine); } e.AddElements(this.functionDeclarations, EmptyLine.SingleLine); e.AddElements(this.variableDeclarations, EmptyLine.SingleLine); e.AddElement(EmptyLine.SingleLine); CodeContainerBase cplusplusclose = e.AddElement(new PP_Ifdef("__cplusplus")) as CodeContainerBase; cplusplusclose.AddElement(new Code("}")); e.AddElement(EmptyLine.SingleLine); cFile.Save(cGenerator); }