diff --git a/lib/bcore/bcore_precoder.c b/lib/bcore/bcore_precoder.c index f6270ad2..686554ec 100644 --- a/lib/bcore/bcore_precoder.c +++ b/lib/bcore/bcore_precoder.c @@ -880,15 +880,29 @@ static bl_t bcore_precoder_s_register_group( bcore_precoder_s* o, const bcore_pr static void bcore_precoder_group_s_compile( bcore_precoder_group_s* o, bcore_source* source ) { + sc_t precode_termination = NULL; + while( !bcore_source_a_eos( source ) ) { - if( bcore_source_a_parse_bl_fa( source, "#?'/*'" ) ) break; + if( bcore_source_a_parse_bl_fa( source, "#?'/*'" ) ) + { + bcore_source_a_parse_fa( source, "#skip'*'" ); + precode_termination = " #?'*/'"; + break; + } + else if( bcore_source_a_parse_bl_fa( source, "#?'#ifdef'" ) ) + { + bcore_source_a_parse_fa( source, " BETH_PRECODE_SECTION " ); + precode_termination = " #?'#endif'"; + break; + } + char c = bcore_source_a_get_u0( source ); - if( c != ' ' && c != '\t' && c != '\n' ) bcore_source_a_parse_err_fa( source, "Opening c-style comment '/*' expected." ); + if( c != ' ' && c != '\t' && c != '\n' ) bcore_source_a_parse_err_fa( source, "Opening c-style comment '/*' or '#' expected.", "#ifdef BETH_PRECODE_SECTION" ); } - bcore_source_a_parse_fa( source, "#skip'*'" ); - while( !bcore_source_a_parse_bl_fa( source, " #?'*/'" ) ) + + while( !bcore_source_a_parse_bl_fa( source, precode_termination ) ) { if( bcore_source_a_eos( source ) ) bcore_source_a_parse_err_fa( source, "Closing c-style comment '*/' expected." ); @@ -1118,7 +1132,7 @@ static void bcore_precoder_source_s_compile( bcore_precoder_source_s* o, bcore_s { while( !bcore_source_a_eos( source ) ) { - if( bcore_source_a_parse_bl_fa( source, "#?'BETH_PRECODE'" ) ) + if( bcore_source_a_parse_bl_fa( source, "#?w'BETH_PRECODE'" ) ) { bcore_precoder_group_s* group = bcore_precoder_group_s_create(); group->source = o; diff --git a/lib/bcore/bcore_precoder.h b/lib/bcore/bcore_precoder.h index c0886b68..733f8653 100644 --- a/lib/bcore/bcore_precoder.h +++ b/lib/bcore/bcore_precoder.h @@ -30,13 +30,20 @@ * * Usage: * BCORE_PRECODE( ) - * + * * feature [strict] '' ( const | mutable, ) [ = ]; * * self = { reflection-definition }; * * ... - * + * + * + * precode-opener: + * c-style comment-opener or '#ifdef BETH_PRECODE_SECTION' + * Macro BETH_PRECODE_SECTION must never be defined. + * + * precode-closer: + * c-style comment-closer or '#endif' (depending on what was used for precode-opener) * * feature: * The feature definition triggers implicit definition of a perspective diff --git a/lib/bmath/bmath_adaptive.h b/lib/bmath/bmath_adaptive.h index b34d1c49..c9749a25 100644 --- a/lib/bmath/bmath_adaptive.h +++ b/lib/bmath/bmath_adaptive.h @@ -73,7 +73,7 @@ f3_t bmath_adaptive_a_adapt_1( bmath_adaptive* o, const bmath_vf3_s* in, f3_t ta /// training challenge: distinguish a sine wave from random walk void bmath_adaptive_a_test_sine_random( const bmath_adaptive* o ); -/// training challenge: learn binay adding of numbers +/// training challenge: learn binary adding of numbers void bmath_adaptive_a_test_encode_add( const bmath_adaptive* o ); /**********************************************************************************************************************/