- Notifications
You must be signed in to change notification settings - Fork3
ccpp, a general purpose single-header preprocessor library.
License
NotificationsYou must be signed in to change notification settings
codecat/ccpp
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A general purpose single-header preprocessor library.
The following directives are currently supported:
#define <word>
#undef <word>
#if <condition>
#elif <condition>
#else
#endif
#include
(viaset_include_callback
)- Other arbitrary directives (via
set_command_callback
)
staticchar*read_file(constchar* path,size_t* out_size) {/* ...*/ }intmain(){// Read contents of file "SomeFile.txt" into "buffer"size_t size;char* buffer =read_file("SomeFile.txt", &size);// Create a preprocessor ccpp::processor p;// Add some definitions p.add_define("SOME_DEFINE");// Begin processing p.process(buffer, size);// Dump outputprintf("%s\n", buffer);return0;}
I couldn't find a good simple no-dependencies preprocessor library for general purpose use that was also permissively licensed, so I decided to make my own.
This was made primarily as a preprocessor forOpenplanet's scripts.