26 points · by in4lio · 11y ago · 9 comments
Although it gives me an idea, a converter that takes a valid C program (with macros) and replaces the C macros with some other macros (in this case yupp macros) that perform the same task. e.g.,
replacing
#include <stdio.h>
with something like:
($include "stdio.h")
($define,,assert_bit_mask( value, mask, op ),,($do ]
bool test = ((( value ) & ( mask )) == ( mask ));
if ( !test ) {
ut_fault( "expected mask to be set", __FILE__, __FUNCTION__, __LINE__ );
op;
}
[ ))
will result in: #define assert_bit_mask( value, mask, op ) do { \
bool test = ((( value ) & ( mask )) == ( mask )); \
if ( !test ) { \
ut_fault( "expected mask to be set", __FILE__, __FUNCTION__, __LINE__ ); \
op; \
} \
} while ( 0 )
but you don't need to think about backslashes)yupp can even be used with Python, as it allows to make the right indentation, e.g. https://github.com/in4lio/yupp/blob/master/eg/dict.yu-py
yupp allows to generate a readable, well-formatted text. Special
attention is paid to providing complete diagnostic information and
navigational capabilities.
so generate proper markdown for the github page...