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 221
  • Win 0
  • Mac 85
  • Linux 136
Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8
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 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
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”