Skip to content

Commit

Permalink
work on precoder
Browse files Browse the repository at this point in the history
  • Loading branch information
johsteffens committed May 6, 2019
1 parent 5b527a9 commit 4169f44
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
24 changes: 19 additions & 5 deletions lib/bcore/bcore_precoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 '#<sc_t>' 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." );

Expand Down Expand Up @@ -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;
Expand Down
11 changes: 9 additions & 2 deletions lib/bcore/bcore_precoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,20 @@
*
* Usage:
* BCORE_PRECODE( <group_name> )
* <opening c-comment>
* <precode-opener>
* feature [strict] '<flags>' <ret> <func_name>( const | mutable, <args> ) [ = <default_func> ];
*
* self <name> = <trait> { reflection-definition };
*
* ...
* <closing c-comment>
* <precode-closer>
*
* 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 <group_name>
Expand Down
2 changes: 1 addition & 1 deletion lib/bmath/bmath_adaptive.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

/**********************************************************************************************************************/
Expand Down

0 comments on commit 4169f44

Please sign in to comment.