ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Expand​CMacro

by pl-ca MacLinux ALL

Sublime Text 3 plugin that expands C/C++ macros.

Labels Expand, Macro, Expansion, C, C++

Details

Installs

  • Total 222
  • Win 0
  • Mac 86
  • Linux 136
Dec 26 Dec 25 Dec 24 Dec 23 Dec 22 Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mac 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

ExpandCMacro

Sublime Text 3 plugin that expands C/C++ macros. Currently only works on Linux/OS X

Example

#include <stdio.h>


#define PRINT_2(MSG, ARGS...) printf(MSG, ##ARGS);
#define PRINT(MSG,ARGS...) PRINT_2(MSG,##ARGS)
#define MACRO(X)                                              \
{                                                             \
    if (1)                                                    \
        PRINT("this is a test %d\n", X)                       \
    else                                                      \
        PRINT("---- %s -----\n", "this is another test")      \
}

int main()
{
    MACRO(25)
    return 0;
}

Executing the command on the line MACRO(25) will result in following output

{ if (1) printf("this is a test %d\n", 25); else printf("---- %s -----\n", "this is another test"); }`

Installation

  1. Install “clang” or “gcc”.
  2. Clone this repository and put it in your Sublime's packages directory (only if installing manually from GitHub).
  3. Edit the settings to your needs.
  4. Default key bindings are: “ctrl-alt-z” to put result output panel.
  5. To modify those bindings, simply edit “Default (OSX).sublime-keymap” or its linux counterpart.

Settings

  • include_dirs: List of directories where relevant header files are located
  • compiler: Use gcc or clang to get result
  • other_flags: You can define compile time macros here with “-D DEFINE_SOMETHING”