Skip to content

Wrapping macro and conditional compilation semantics #21

Description

@haxscramper

C macros can do anything - create types, procs, conditionally enable parts of the code or define simple constants. All of this has to be somehow converted to nim macros if possible. Boost wave should be pretty useful for solving this problem.

Many macro definitions are relatively simple, which means there are multiple steps of different complexity:

  • Wrap standalone macro constants like #define GIT_CLONE_OPTIONS_VERSION 1
  • Wrap group of macros that should've been an enum - Automatically generate boilerplate code that makes wrappers easier to use #10
  • Convert macros to templates #define get_field(arg) (arg)->name
  • Map macro semantics to the nim macro - need to find concrete examples of where this is done and how to meaningfully port this to nim. #define MAKE_STRUCT(name) struct name {};. Maybe Qt macros from Qt support #25 would be a good starting point?
  • Macro can be hidden inside of the ifdef section, this should be accounted for as well. Need to get the AST of the macro preprocessor

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions