Giter Club home page Giter Club logo

Comments (3)

lithiumtoast avatar lithiumtoast commented on August 23, 2024

Object-like macros have been implemented. It would just be taking it to the next level with function-like macros.

from c2cs.

lithiumtoast avatar lithiumtoast commented on August 23, 2024

C header .h files may contain source code. Since function macros could technically be seen as "source code" and subject to terms and agreements or otherwise licensing, transpiling C function macros into C# code would have to be optional. For libraries that are free and open source, I would recommend transpiling function-like macros; otherwise, I would advise caution and suggest you don't use the option unless you know 100% what you are doing.

from c2cs.

lithiumtoast avatar lithiumtoast commented on August 23, 2024

Now that object-like macros are working well enough, this should be explored more. I need it for flecs-cs.

E.g. the function-like macro ECS_COMPONENT_DEFINE which takes an ecs_world, and id as "parameters". Inferring the type should be possible for world but the type for id would need to be a generic type in C#. It's not clear right now how to reliably tell when a function-like macro "parameter" is a type.

#define ECS_COMPONENT_DEFINE(world, id) \
    {\
        ecs_component_desc_t desc = {0}; \
        desc.entity.entity = ecs_id(id); \
        desc.entity.name = #id; \
        desc.entity.symbol = #id; \
        desc.size = sizeof(id); \
        desc.alignment = ECS_ALIGNOF(id); \
        ecs_id(id) = ecs_component_init(world, &desc);\
        ecs_assert(ecs_id(id) != 0, ECS_INVALID_PARAMETER, NULL);\
    }

from c2cs.

Related Issues (20)

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.