Giter VIP home page Giter VIP logo

cppheadertocsharpconverter's People

Contributors

sunsetquest avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cppheadertocsharpconverter's Issues

Generated enum types can fail if comments with commas in them

Running on a source file with the following text:

`
typedef enum
{
MI_INVALID_0 = 0, // do not modify
MI_OOB, // do not modify
MI_ErrorMessage, // do not modify
MI_MessageCode, // do not modify

// NOTE: try to put messages that are likely to be used by *any* system in the first group, this may be fixed for these, sometime
MI_REG_START, // used for looping
MI_Fans = MI_REG_START, // fan data
MI_Currents, // current data from water probe etc.
MI_State1, // a regular dump of all data 1 (includes event data, allows synchronisation without restart)
MI_State2, // a regular dump of all data 2 (ditto)
MI_State3,
MI_REG_END = MI_State3, // used for looping


MI_INVALID_MAX = 0xFF // do not modify

} MsgIds_t;
`

And receive the following output
[Flags] public enum MsgIds_t { MI_INVALID_0 = 0, MI_OOB, MI_ErrorMessage, MI_MessageCode, group, these, MI_REG_START, MI_Fans = MI_REG_START, MI_Currents, MI_State1, data, MI_State2, MI_State3, MI_REG_END = MI_State3, MI_INVALID_MAX = 0xFF // do not modify, };

I applied a minor patch to strip any comments out from the rows, diff below.
I'm using your tool in a multi-header use though, so I may send a few more fixes through, at the moment I have 20 files all with a constant class :). Apart from that, I'm hoping this will save me a bit of effort on keeping a embedded projects header files in step with the C# backend that is receiving messages from it.
Thanks for the work!

`
cppHeaderParse/Program.cs | 1 +
1 file changed, 1 insertion(+)

diff --git a/cppHeaderParse/Program.cs b/cppHeaderParse/Program.cs
index abccfff..bed3d4c 100644
--- a/cppHeaderParse/Program.cs
+++ b/cppHeaderParse/Program.cs
@@ -290,6 +290,7 @@ namespace cppHeaderParse
string rows = match.Groups["enum_rows"].ToString() + ",";
sb.AppendLine(" public enum " + name);
sb.AppendLine(" {");

  •                    rows = Regex.Replace(rows, @"//.*", string.Empty);
                       MatchCollection items = Regex.Matches(rows,
                           @"\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*(?:\s*=\s*([^\,(?:\r?\n)\{\}\;]*?))?\s*,");
                       foreach (Match r in items)
    

`

Handling nested include files and typedefs

Can you tell me if this tool has any support for:

  • nested include files
  • structures defined with typedef
  • resolving field types like DWORD or UINT32, which might be defined as macros or as typedefs
  • predefined macros, like _MSC_VER

All of these would be common requirements on the kind of project I work on.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.