summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bytecode.c1232
-rw-r--r--src/bytecode.h94
-rw-r--r--src/codevect.c66
-rw-r--r--src/compiler.cc14
-rw-r--r--src/ctinput.cc86
-rw-r--r--src/debug.c6
-rw-r--r--src/fsmcodegen.cc6
-rw-r--r--src/fsmcodegen.h4
-rw-r--r--src/fsmexec.cc70
-rw-r--r--src/input.c378
-rw-r--r--src/input.h64
-rw-r--r--src/iter.c326
-rw-r--r--src/list.c64
-rw-r--r--src/map.c266
-rw-r--r--src/map.h64
-rw-r--r--src/pdabuild.cc420
-rw-r--r--src/pdacodegen.cc330
-rw-r--r--src/pdarun.c1572
-rw-r--r--src/pdarun.h272
-rw-r--r--src/pool.c106
-rw-r--r--src/pool.h4
-rw-r--r--src/program.c120
-rw-r--r--src/program.h126
-rw-r--r--src/redfsm.cc76
-rw-r--r--src/string.c66
-rw-r--r--src/struct.c40
-rw-r--r--src/struct.h26
-rw-r--r--src/tree.c930
-rw-r--r--src/tree.h234
-rw-r--r--test/ext1.lm4
30 files changed, 3533 insertions, 3533 deletions
diff --git a/src/bytecode.c b/src/bytecode.c
index d3d7782b..c956e477 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -122,21 +122,21 @@ static void rcode_downref( program_t *prg, tree_t **sp, code_t *instr );
void colm_parser_set_context( program_t *prg, tree_t **sp, parser_t *parser, struct_t *val )
{
- parser->pdaRun->context = val;
+ parser->pda_run->context = val;
}
static head_t *tree_to_str( program_t *prg, tree_t **sp, tree_t *tree, int trim )
{
/* Collect the tree data. */
StrCollect collect;
- initStrCollect( &collect );
+ init_str_collect( &collect );
- printTreeCollect( prg, sp, &collect, tree, trim );
+ print_tree_collect( prg, sp, &collect, tree, trim );
/* Set up the input stream. */
- head_t *ret = stringAllocFull( prg, collect.data, collect.length );
+ head_t *ret = string_alloc_full( prg, collect.data, collect.length );
- strCollectDestroy( &collect );
+ str_collect_destroy( &collect );
return ret;
}
@@ -144,26 +144,26 @@ static head_t *tree_to_str( program_t *prg, tree_t **sp, tree_t *tree, int trim
static word_t stream_append_tree( program_t *prg, tree_t **sp, stream_t *dest, tree_t *input )
{
long length = 0;
- struct stream_impl *impl = streamToImpl( dest );
+ struct stream_impl *impl = stream_to_impl( dest );
if ( input->id == LEL_ID_STR ) {
/* Collect the tree data. */
StrCollect collect;
- initStrCollect( &collect );
- printTreeCollect( prg, sp, &collect, input, false );
+ init_str_collect( &collect );
+ print_tree_collect( prg, sp, &collect, input, false );
/* Load it into the input. */
- impl->funcs->appendData( impl, collect.data, collect.length );
+ impl->funcs->append_data( impl, collect.data, collect.length );
length = collect.length;
- strCollectDestroy( &collect );
+ str_collect_destroy( &collect );
}
else if ( input->id == LEL_ID_PTR ) {
colm_tree_upref( input );
- impl->funcs->appendStream( impl, input );
+ impl->funcs->append_stream( impl, input );
}
else {
colm_tree_upref( input );
- impl->funcs->appendTree( impl, input );
+ impl->funcs->append_tree( impl, input );
}
return length;
@@ -173,8 +173,8 @@ static word_t stream_append_stream( program_t *prg, tree_t **sp, stream_t *dest,
{
long length = 0;
- struct stream_impl *impl = streamToImpl( dest );
- impl->funcs->appendStream( impl, stream );
+ struct stream_impl *impl = stream_to_impl( dest );
+ impl->funcs->append_stream( impl, stream );
return length;
}
@@ -183,11 +183,11 @@ static void stream_undo_append( program_t *prg, tree_t **sp,
struct stream_impl *is, tree_t *input, long length )
{
if ( input->id == LEL_ID_STR )
- is->funcs->undoAppendData( is, length );
+ is->funcs->undo_append_data( is, length );
else if ( input->id == LEL_ID_PTR )
- is->funcs->undoAppendStream( is );
+ is->funcs->undo_append_stream( is );
else {
- tree_t *tree = is->funcs->undoAppendTree( is );
+ tree_t *tree = is->funcs->undo_append_tree( is );
colm_tree_downref( prg, sp, tree );
}
}
@@ -195,24 +195,24 @@ static void stream_undo_append( program_t *prg, tree_t **sp,
static void stream_undo_append_stream( program_t *prg, tree_t **sp, struct stream_impl *is,
tree_t *input, long length )
{
- is->funcs->undoAppendStream( is );
+ is->funcs->undo_append_stream( is );
}
-static tree_t *stream_pull_bc( program_t *prg, tree_t **sp, struct pda_run *pdaRun,
+static tree_t *stream_pull_bc( program_t *prg, tree_t **sp, struct pda_run *pda_run,
stream_t *stream, tree_t *length )
{
long len = ((long)length);
- struct stream_impl *impl = streamToImpl( stream );
- head_t *tokdata = colm_stream_pull( prg, sp, pdaRun, impl, len );
- return constructString( prg, tokdata );
+ struct stream_impl *impl = stream_to_impl( stream );
+ head_t *tokdata = colm_stream_pull( prg, sp, pda_run, impl, len );
+ return construct_string( prg, tokdata );
}
static void undo_pull( program_t *prg, stream_t *stream, tree_t *str )
{
- struct stream_impl *impl = streamToImpl( stream );
- const char *data = stringData( ( (str_t*)str )->value );
- long length = stringLength( ( (str_t*)str )->value );
- undoStreamPull( impl, data, length );
+ struct stream_impl *impl = stream_to_impl( stream );
+ const char *data = string_data( ( (str_t*)str )->value );
+ long length = string_length( ( (str_t*)str )->value );
+ undo_stream_pull( impl, data, length );
}
static long stream_push( program_t *prg, tree_t **sp, struct stream_impl *in, tree_t *tree, int ignore )
@@ -224,12 +224,12 @@ static long stream_push( program_t *prg, tree_t **sp, struct stream_impl *in, tr
/* Collect the tree data. */
StrCollect collect;
- initStrCollect( &collect );
- printTreeCollect( prg, sp, &collect, tree, false );
+ init_str_collect( &collect );
+ print_tree_collect( prg, sp, &collect, tree, false );
colm_stream_push_text( in, collect.data, collect.length );
long length = collect.length;
- strCollectDestroy( &collect );
+ str_collect_destroy( &collect );
return length;
}
@@ -262,16 +262,16 @@ static void set_local( Execution *exec, long field, tree_t *tree )
static tree_t *get_local_split( program_t *prg, Execution *exec, long field )
{
tree_t *val = vm_get_local( exec, field );
- tree_t *split = splitTree( prg, val );
+ tree_t *split = split_tree( prg, val );
vm_set_local( exec, field, split );
return split;
}
static void downref_local_trees( program_t *prg, tree_t **sp,
- Execution *exec, struct local_info *locals, long localsLen )
+ Execution *exec, struct local_info *locals, long locals_len )
{
long i;
- for ( i = localsLen-1; i >= 0; i-- ) {
+ for ( i = locals_len-1; i >= 0; i-- ) {
if ( locals[i].type == LI_Tree ) {
debug( prg, REALM_BYTECODE, "local tree downref: %ld\n",
(long)locals[i].offset );
@@ -283,10 +283,10 @@ static void downref_local_trees( program_t *prg, tree_t **sp,
}
static void downref_locals( program_t *prg, tree_t ***psp,
- Execution *exec, struct local_info *locals, long localsLen )
+ Execution *exec, struct local_info *locals, long locals_len )
{
long i;
- for ( i = localsLen-1; i >= 0; i-- ) {
+ for ( i = locals_len-1; i >= 0; i-- ) {
switch ( locals[i].type ) {
case LI_Tree: {
debug( prg, REALM_BYTECODE, "local tree downref: %ld\n",
@@ -326,7 +326,7 @@ static tree_t *construct_arg0( program_t *prg, int argc, const char **argv )
tree_t *arg0 = 0;
if ( argc > 0 ) {
head_t *head = colm_string_alloc_pointer( prg, argv[0], strlen(argv[0]) );
- arg0 = constructString( prg, head );
+ arg0 = construct_string( prg, head );
colm_tree_upref( arg0 );
}
return arg0;
@@ -334,18 +334,18 @@ static tree_t *construct_arg0( program_t *prg, int argc, const char **argv )
static list_t *construct_argv( program_t *prg, int argc, const char **argv )
{
- list_t *list = (list_t*)colm_construct_generic( prg, prg->rtd->argvGenericId );
+ list_t *list = (list_t*)colm_construct_generic( prg, prg->rtd->argv_generic_id );
int i;
for ( i = 1; i < argc; i++ ) {
head_t *head = colm_string_alloc_pointer( prg, argv[i], strlen(argv[i]) );
- tree_t *arg = constructString( prg, head );
+ tree_t *arg = construct_string( prg, head );
colm_tree_upref( arg );
struct_t *strct = colm_struct_new_size( prg, 16 );
- strct->id = prg->rtd->argvElId;
+ strct->id = prg->rtd->argv_el_id;
colm_struct_set_field( strct, tree_t*, 0, arg );
- list_el_t *listEl = colm_struct_get_addr( strct, list_el_t*, 1 );
- colm_list_append( list, listEl );
+ list_el_t *list_el = colm_struct_get_addr( strct, list_el_t*, 1 );
+ colm_list_append( list, list_el );
}
return list;
@@ -357,34 +357,34 @@ static list_t *construct_argv( program_t *prg, int argc, const char **argv )
void colm_rcode_downref_all( program_t *prg, tree_t **sp, struct rt_code_vect *rev )
{
- while ( rev->tabLen > 0 ) {
+ while ( rev->tab_len > 0 ) {
/* Read the length */
- code_t *prcode = rev->data + rev->tabLen - SIZEOF_WORD;
+ code_t *prcode = rev->data + rev->tab_len - SIZEOF_WORD;
word_t len;
read_word_p( len, prcode );
/* Find the start of block. */
- long start = rev->tabLen - len - SIZEOF_WORD;
+ long start = rev->tab_len - len - SIZEOF_WORD;
prcode = rev->data + start;
/* Execute it. */
rcode_downref( prg, sp, prcode );
/* Backup over it. */
- rev->tabLen -= len + SIZEOF_WORD;
+ rev->tab_len -= len + SIZEOF_WORD;
}
}
void colm_execute( program_t *prg, Execution *exec, code_t *code )
{
- tree_t **sp = prg->stackRoot;
+ tree_t **sp = prg->stack_root;
- struct frame_info *fi = &prg->rtd->frameInfo[prg->rtd->rootFrameId];
+ struct frame_info *fi = &prg->rtd->frame_info[prg->rtd->root_frame_id];
/* Set up the stack as if we have
* called. We allow a return value. */
- long stretch = FR_AA + fi->frameSize;
+ long stretch = FR_AA + fi->frame_size;
vm_contiguous( stretch );
vm_push_tree( 0 );
@@ -393,27 +393,27 @@ void colm_execute( program_t *prg, Execution *exec, code_t *code )
vm_push_tree( 0 );
vm_push_tree( 0 );
- exec->framePtr = vm_ptop();
- vm_pushn( fi->frameSize );
- memset( vm_ptop(), 0, sizeof(word_t) * fi->frameSize );
+ exec->frame_ptr = vm_ptop();
+ vm_pushn( fi->frame_size );
+ memset( vm_ptop(), 0, sizeof(word_t) * fi->frame_size );
/* Execution loop. */
sp = colm_execute_code( prg, exec, sp, code );
- downref_locals( prg, &sp, exec, fi->locals, fi->localsLen );
- vm_popn( fi->frameSize );
+ downref_locals( prg, &sp, exec, fi->locals, fi->locals_len );
+ vm_popn( fi->frame_size );
vm_pop_ignore();
vm_pop_ignore();
- colm_tree_downref( prg, sp, prg->returnVal );
- prg->returnVal = vm_pop_tree();
+ colm_tree_downref( prg, sp, prg->return_val );
+ prg->return_val = vm_pop_tree();
vm_pop_ignore();
- prg->stackRoot = sp;
+ prg->stack_root = sp;
}
-tree_t *colm_run_func( struct colm_program *prg, int frameId,
- const char **params, int paramCount )
+tree_t *colm_run_func( struct colm_program *prg, int frame_id,
+ const char **params, int param_count )
{
/* Make the arguments available to the program. */
prg->argc = 0;
@@ -422,155 +422,155 @@ tree_t *colm_run_func( struct colm_program *prg, int frameId,
Execution execution;
memset( &execution, 0, sizeof(execution) );
- tree_t **sp = prg->stackRoot;
+ tree_t **sp = prg->stack_root;
- struct frame_info *fi = &prg->rtd->frameInfo[frameId];
+ struct frame_info *fi = &prg->rtd->frame_info[frame_id];
code_t *code = fi->codeWC;
- vm_pushn( paramCount );
- execution.callArgs = vm_ptop();
- memset( vm_ptop(), 0, sizeof(word_t) * paramCount );
+ vm_pushn( param_count );
+ execution.call_args = vm_ptop();
+ memset( vm_ptop(), 0, sizeof(word_t) * param_count );
int p;
- for ( p = 0; p < paramCount; p++ ) {
+ for ( p = 0; p < param_count; p++ ) {
if ( params[p] == 0 ) {
- ((value_t*)execution.callArgs)[p] = 0;
+ ((value_t*)execution.call_args)[p] = 0;
}
else {
head_t *head = colm_string_alloc_pointer( prg, params[p], strlen(params[p]) );
- tree_t *tree = constructString( prg, head );
+ tree_t *tree = construct_string( prg, head );
colm_tree_upref( tree );
- ((tree_t**)execution.callArgs)[p] = tree;
+ ((tree_t**)execution.call_args)[p] = tree;
}
}
- long stretch = FR_AA + fi->frameSize;
+ long stretch = FR_AA + fi->frame_size;
vm_contiguous( stretch );
/* Set up the stack as if we have called. We allow a return value. */
- vm_push_tree( (tree_t*)execution.callArgs );
+ vm_push_tree( (tree_t*)execution.call_args );
vm_push_tree( 0 );
vm_push_tree( 0 );
vm_push_tree( 0 );
vm_push_tree( 0 );
- execution.frameId = frameId;
+ execution.frame_id = frame_id;
- execution.framePtr = vm_ptop();
- vm_pushn( fi->frameSize );
- memset( vm_ptop(), 0, sizeof(word_t) * fi->frameSize );
+ execution.frame_ptr = vm_ptop();
+ vm_pushn( fi->frame_size );
+ memset( vm_ptop(), 0, sizeof(word_t) * fi->frame_size );
/* Execution loop. */
sp = colm_execute_code( prg, &execution, sp, code );
- colm_tree_downref( prg, sp, prg->returnVal );
- prg->returnVal = execution.retVal;
+ colm_tree_downref( prg, sp, prg->return_val );
+ prg->return_val = execution.ret_val;
- vm_popn( paramCount );
+ vm_popn( param_count );
- assert( sp == prg->stackRoot );
+ assert( sp == prg->stack_root );
- return prg->returnVal;
+ return prg->return_val;
};
-int colm_make_reverse_code( struct pda_run *pdaRun )
+int colm_make_reverse_code( struct pda_run *pda_run )
{
- struct rt_code_vect *reverseCode = &pdaRun->reverseCode;
- struct rt_code_vect *rcodeCollect = &pdaRun->rcodeCollect;
+ struct rt_code_vect *reverse_code = &pda_run->reverse_code;
+ struct rt_code_vect *rcode_collect = &pda_run->rcode_collect;
/* Do we need to revert the left hand side? */
/* Check if there was anything generated. */
- if ( rcodeCollect->tabLen == 0 )
+ if ( rcode_collect->tab_len == 0 )
return false;
- if ( pdaRun->rcBlockCount == 0 ) {
+ if ( pda_run->rc_block_count == 0 ) {
/* One reverse code run for the DECK terminator. */
- append_code_val( reverseCode, IN_PCR_END_DECK );
- append_code_val( reverseCode, IN_PCR_RET );
- append_word( reverseCode, 2 );
- pdaRun->rcBlockCount += 1;
- colm_increment_steps( pdaRun );
+ append_code_val( reverse_code, IN_PCR_END_DECK );
+ append_code_val( reverse_code, IN_PCR_RET );
+ append_word( reverse_code, 2 );
+ pda_run->rc_block_count += 1;
+ colm_increment_steps( pda_run );
}
- long startLength = reverseCode->tabLen;
+ long start_length = reverse_code->tab_len;
/* Go backwards, group by group, through the reverse code. Push each group
* to the global reverse code stack. */
- code_t *p = rcodeCollect->data + rcodeCollect->tabLen;
- while ( p != rcodeCollect->data ) {
+ code_t *p = rcode_collect->data + rcode_collect->tab_len;
+ while ( p != rcode_collect->data ) {
p--;
long len = *p;
p = p - len;
- append_code_vect( reverseCode, p, len );
+ append_code_vect( reverse_code, p, len );
}
/* Stop, then place a total length in the global stack. */
- append_code_val( reverseCode, IN_PCR_RET );
- long length = reverseCode->tabLen - startLength;
- append_word( reverseCode, length );
+ append_code_val( reverse_code, IN_PCR_RET );
+ long length = reverse_code->tab_len - start_length;
+ append_word( reverse_code, length );
/* Clear the revere code buffer. */
- rcodeCollect->tabLen = 0;
+ rcode_collect->tab_len = 0;
- pdaRun->rcBlockCount += 1;
- colm_increment_steps( pdaRun );
+ pda_run->rc_block_count += 1;
+ colm_increment_steps( pda_run );
return true;
}
-void colm_transfer_reverse_code( struct pda_run *pdaRun, parse_tree_t *parseTree )
+void colm_transfer_reverse_code( struct pda_run *pda_run, parse_tree_t *parse_tree )
{
- if ( pdaRun->rcBlockCount > 0 ) {
+ if ( pda_run->rc_block_count > 0 ) {
//debug( REALM_PARSE, "attaching reverse code to token\n" );
- parseTree->flags |= PF_HAS_RCODE;
- pdaRun->rcBlockCount = 0;
+ parse_tree->flags |= PF_HAS_RCODE;
+ pda_run->rc_block_count = 0;
}
}
static void rcode_unit_term( Execution *exec )
{
- append_code_val( &exec->parser->pdaRun->rcodeCollect, exec->rcodeUnitLen );
- exec->rcodeUnitLen = 0;
+ append_code_val( &exec->parser->pda_run->rcode_collect, exec->rcode_unit_len );
+ exec->rcode_unit_len = 0;
}
static void rcode_unit_start( Execution *exec )
{
- exec->rcodeUnitLen = 0;
+ exec->rcode_unit_len = 0;
}
static void rcode_code( Execution *exec, const code_t code )
{
- append_code_val( &exec->parser->pdaRun->rcodeCollect, code );
- exec->rcodeUnitLen += SIZEOF_CODE;
+ append_code_val( &exec->parser->pda_run->rcode_collect, code );
+ exec->rcode_unit_len += SIZEOF_CODE;
}
-static void rcodeHalf( Execution *exec, const half_t half )
+static void rcode_half( Execution *exec, const half_t half )
{
- append_half( &exec->parser->pdaRun->rcodeCollect, half );
- exec->rcodeUnitLen += SIZEOF_HALF;
+ append_half( &exec->parser->pda_run->rcode_collect, half );
+ exec->rcode_unit_len += SIZEOF_HALF;
}
static void rcode_word( Execution *exec, const word_t word )
{
- append_word( &exec->parser->pdaRun->rcodeCollect, word );
- exec->rcodeUnitLen += SIZEOF_WORD;
+ append_word( &exec->parser->pda_run->rcode_collect, word );
+ exec->rcode_unit_len += SIZEOF_WORD;
}
-code_t *colm_pop_reverse_code( struct rt_code_vect *allRev )
+code_t *colm_pop_reverse_code( struct rt_code_vect *all_rev )
{
/* Read the length */
- code_t *prcode = allRev->data + allRev->tabLen - SIZEOF_WORD;
+ code_t *prcode = all_rev->data + all_rev->tab_len - SIZEOF_WORD;
word_t len;
read_word_p( len, prcode );
/* Find the start of block. */
- long start = allRev->tabLen - len - SIZEOF_WORD;
- prcode = allRev->data + start;
+ long start = all_rev->tab_len - len - SIZEOF_WORD;
+ prcode = all_rev->data + start;
/* Backup over it. */
- allRev->tabLen -= len + SIZEOF_WORD;
+ all_rev->tab_len -= len + SIZEOF_WORD;
return prcode;
}
@@ -591,8 +591,8 @@ again:
read_tree( restore );
debug( prg, REALM_BYTECODE, "IN_RESTORE_LHS\n" );
- colm_tree_downref( prg, sp, exec->parser->pdaRun->parseInput->shadow->tree );
- exec->parser->pdaRun->parseInput->shadow->tree = restore;
+ colm_tree_downref( prg, sp, exec->parser->pda_run->parse_input->shadow->tree );
+ exec->parser->pda_run->parse_input->shadow->tree = restore;
break;
}
case IN_LOAD_NIL: {
@@ -618,13 +618,13 @@ again:
case IN_LOAD_TRUE: {
debug( prg, REALM_BYTECODE, "IN_LOAD_TRUE\n" );
//colm_tree_upref( prg->trueVal );
- vm_push_tree( prg->trueVal );
+ vm_push_tree( prg->true_val );
break;
}
case IN_LOAD_FALSE: {
debug( prg, REALM_BYTECODE, "IN_LOAD_FALSE\n" );
//colm_tree_upref( prg->falseVal );
- vm_push_tree( prg->falseVal );
+ vm_push_tree( prg->false_val );
break;
}
case IN_LOAD_INT: {
@@ -643,8 +643,8 @@ again:
debug( prg, REALM_BYTECODE, "IN_LOAD_STR %d\n", offset );
- head_t *lit = makeLiteral( prg, offset );
- tree_t *tree = constructString( prg, lit );
+ head_t *lit = make_literal( prg, offset );
+ tree_t *tree = construct_string( prg, lit );
colm_tree_upref( tree );
vm_push_tree( tree );
break;
@@ -659,7 +659,7 @@ again:
arg[i] = vm_pop_tree();
for ( i = 0; i < n; i++ )
- printTreeFile( prg, sp, stdout, arg[i], false );
+ print_tree_file( prg, sp, stdout, arg[i], false );
for ( i = 0; i < n; i++ )
colm_tree_downref( prg, sp, arg[i] );
@@ -674,13 +674,13 @@ again:
for ( i = n-1; i >= 0; i-- )
arg[i] = vm_pop_tree();
stream_t *stream = vm_pop_stream();
- struct stream_impl *si = streamToImpl( stream );
+ struct stream_impl *si = stream_to_impl( stream );
for ( i = 0; i < n; i++ ) {
if ( si->file != 0 )
- printTreeFile( prg, sp, si->file, arg[i], false );
+ print_tree_file( prg, sp, si->file, arg[i], false );
else
- printTreeFd( prg, sp, si->fd, arg[i], false );
+ print_tree_fd( prg, sp, si->fd, arg[i], false );
}
for ( i = 0; i < n; i++ )
@@ -698,7 +698,7 @@ again:
arg[i] = vm_pop_tree();
for ( i = 0; i < n; i++ )
- printXmlStdout( prg, sp, arg[i], true, true );
+ print_xml_stdout( prg, sp, arg[i], true, true );
for ( i = 0; i < n; i++ )
colm_tree_downref( prg, sp, arg[i] );
@@ -714,7 +714,7 @@ again:
arg[i] = vm_pop_tree();
for ( i = 0; i < n; i++ )
- printXmlStdout( prg, sp, arg[i], false, true );
+ print_xml_stdout( prg, sp, arg[i], false, true );
for ( i = 0; i < n; i++ )
colm_tree_downref( prg, sp, arg[i] );
@@ -782,26 +782,26 @@ again:
break;
}
case IN_LOAD_INPUT_BKT: {
- tree_t *accumStream;
- read_tree( accumStream );
+ tree_t *accum_stream;
+ read_tree( accum_stream );
debug( prg, REALM_BYTECODE, "IN_LOAD_INPUT_BKT\n" );
- colm_tree_upref( accumStream );
- vm_push_tree( accumStream );
+ colm_tree_upref( accum_stream );
+ vm_push_tree( accum_stream );
break;
}
case IN_LOAD_CONTEXT_R: {
debug( prg, REALM_BYTECODE, "IN_LOAD_CONTEXT_R\n" );
- vm_push_type( struct_t*, exec->parser->pdaRun->context );
+ vm_push_type( struct_t*, exec->parser->pda_run->context );
break;
}
case IN_LOAD_CONTEXT_WV: {
debug( prg, REALM_BYTECODE, "IN_LOAD_CONTEXT_WV\n" );
- vm_push_type( struct_t *, exec->parser->pdaRun->context );
+ vm_push_type( struct_t *, exec->parser->pda_run->context );
/* Set up the reverse instruction. */
rcode_unit_start( exec );
@@ -813,13 +813,13 @@ again:
/* This is identical to the _R version, but using it for writing
* would be confusing. */
- vm_push_type( struct_t *, exec->parser->pdaRun->context );
+ vm_push_type( struct_t *, exec->parser->pda_run->context );
break;
}
case IN_LOAD_CONTEXT_BKT: {
debug( prg, REALM_BYTECODE, "IN_LOAD_CONTEXT_BKT\n" );
- vm_push_type( struct_t *, exec->parser->pdaRun->context );
+ vm_push_type( struct_t *, exec->parser->pda_run->context );
break;
}
@@ -842,16 +842,16 @@ again:
/* If there are captures (this is a translate block) then copy them into
* the local frame now. */
- struct lang_el_info *lelInfo = prg->rtd->lelInfo;
- char **mark = exec->parser->pdaRun->mark;
+ struct lang_el_info *lel_info = prg->rtd->lel_info;
+ char **mark = exec->parser->pda_run->mark;
int i;
- for ( i = 0; i < lelInfo[exec->parser->pdaRun->tokenId].numCaptureAttr; i++ ) {
- struct lang_el_info *lei = &lelInfo[exec->parser->pdaRun->tokenId];
- CaptureAttr *ca = &prg->rtd->captureAttr[lei->captureAttr + i];
- head_t *data = stringAllocFull( prg, mark[ca->mark_enter],
+ for ( i = 0; i < lel_info[exec->parser->pda_run->token_id].num_capture_attr; i++ ) {
+ struct lang_el_info *lei = &lel_info[exec->parser->pda_run->token_id];
+ CaptureAttr *ca = &prg->rtd->capture_attr[lei->capture_attr + i];
+ head_t *data = string_alloc_full( prg, mark[ca->mark_enter],
mark[ca->mark_leave] - mark[ca->mark_enter] );
- tree_t *string = constructString( prg, data );
+ tree_t *string = construct_string( prg, data );
colm_tree_upref( string );
set_local( exec, -1 - i, string );
}
@@ -865,7 +865,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_INIT_RHS_EL %hd\n", field );
- tree_t *val = getRhsEl( prg, exec->parser->pdaRun->redLel->shadow->tree, position );
+ tree_t *val = get_rhs_el( prg, exec->parser->pda_run->red_lel->shadow->tree, position );
colm_tree_upref( val );
vm_set_local(exec, field, val);
break;
@@ -878,13 +878,13 @@ again:
debug( prg, REALM_BYTECODE, "IN_INIT_LHS_EL %hd\n", field );
/* We transfer it to to the local field. Possibly take a copy. */
- tree_t *val = exec->parser->pdaRun->redLel->shadow->tree;
+ tree_t *val = exec->parser->pda_run->red_lel->shadow->tree;
/* Save it. */
colm_tree_upref( val );
- exec->parser->pdaRun->parsed = val;
+ exec->parser->pda_run->parsed = val;
- exec->parser->pdaRun->redLel->shadow->tree = 0;
+ exec->parser->pda_run->red_lel->shadow->tree = 0;
vm_set_local(exec, field, val);
break;
}
@@ -896,7 +896,7 @@ again:
tree_t *val = vm_get_local(exec, field);
vm_set_local(exec, field, 0);
- exec->parser->pdaRun->redLel->shadow->tree = val;
+ exec->parser->pda_run->red_lel->shadow->tree = val;
break;
}
case IN_UITER_ADVANCE: {
@@ -908,15 +908,15 @@ again:
/* Get the iterator. */
user_iter_t *uiter = (user_iter_t*) vm_get_local(exec, field);
- long yieldSize = vm_ssize() - uiter->rootSize;
- assert( uiter->yieldSize == yieldSize );
+ long yield_size = vm_ssize() - uiter->root_size;
+ assert( uiter->yield_size == yield_size );
/* Fix the return instruction pointer. */
- uiter->stackRoot[-IFR_AA + IFR_RIN] = (SW)instr;
+ uiter->stack_root[-IFR_AA + IFR_RIN] = (SW)instr;
instr = uiter->resume;
- exec->framePtr = uiter->frame;
- exec->iframePtr = &uiter->stackRoot[-IFR_AA];
+ exec->frame_ptr = uiter->frame;
+ exec->iframe_ptr = &uiter->stack_root[-IFR_AA];
break;
}
case IN_UITER_GET_CUR_R: {
@@ -938,7 +938,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_UITER_GET_CUR_WC\n" );
user_iter_t *uiter = (user_iter_t*) vm_get_local(exec, field);
- splitRef( prg, &sp, &uiter->ref );
+ split_ref( prg, &sp, &uiter->ref );
tree_t *split = uiter->ref.kid->tree;
colm_tree_upref( split );
vm_push_tree( split );
@@ -952,9 +952,9 @@ again:
tree_t *t = vm_pop_tree();
user_iter_t *uiter = (user_iter_t*) vm_get_local(exec, field);
- splitRef( prg, &sp, &uiter->ref );
+ split_ref( prg, &sp, &uiter->ref );
tree_t *old = uiter->ref.kid->tree;
- setUiterCur( prg, uiter, t );
+ set_uiter_cur( prg, uiter, t );
colm_tree_downref( prg, sp, old );
break;
}
@@ -1035,7 +1035,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_GET_LOCAL_REF_WC\n" );
ref_t *ref = (ref_t*) vm_get_plocal(exec, field);
- splitRef( prg, &sp, ref );
+ split_ref( prg, &sp, ref );
tree_t *val = ref->kid->tree;
colm_tree_upref( val );
vm_push_tree( val );
@@ -1049,8 +1049,8 @@ again:
tree_t *val = vm_pop_tree();
ref_t *ref = (ref_t*) vm_get_plocal(exec, field);
- splitRef( prg, &sp, ref );
- refSetValue( prg, sp, ref, val );
+ split_ref( prg, &sp, ref );
+ ref_set_value( prg, sp, ref, val );
break;
}
case IN_GET_FIELD_TREE_R: {
@@ -1076,7 +1076,7 @@ again:
tree_t *obj = vm_pop_tree();
colm_tree_downref( prg, sp, obj );
- tree_t *split = getFieldSplit( prg, obj, field );
+ tree_t *split = get_field_split( prg, obj, field );
colm_tree_upref( split );
vm_push_tree( split );
break;
@@ -1090,13 +1090,13 @@ again:
tree_t *obj = vm_pop_tree();
colm_tree_downref( prg, sp, obj );
- tree_t *split = getFieldSplit( prg, obj, field );
+ tree_t *split = get_field_split( prg, obj, field );
colm_tree_upref( split );
vm_push_tree( split );
/* Set up the reverse instruction. */
rcode_code( exec, IN_GET_FIELD_TREE_BKT );
- rcodeHalf( exec, field );
+ rcode_half( exec, field );
break;
}
case IN_GET_FIELD_TREE_BKT: {
@@ -1108,7 +1108,7 @@ again:
tree_t *obj = vm_pop_tree();
colm_tree_downref( prg, sp, obj );
- tree_t *split = getFieldSplit( prg, obj, field );
+ tree_t *split = get_field_split( prg, obj, field );
colm_tree_upref( split );
vm_push_tree( split );
break;
@@ -1146,7 +1146,7 @@ again:
/* Set up the reverse instruction. */
rcode_code( exec, IN_SET_FIELD_TREE_BKT );
- rcodeHalf( exec, field );
+ rcode_half( exec, field );
rcode_word( exec, (word_t)prev );
rcode_unit_term( exec );
break;
@@ -1275,7 +1275,7 @@ again:
/* Set up the reverse instruction. */
rcode_code( exec, IN_GET_STRUCT_BKT );
- rcodeHalf( exec, field );
+ rcode_half( exec, field );
break;
}
case IN_GET_STRUCT_BKT: {
@@ -1287,7 +1287,7 @@ again:
tree_t *obj = vm_pop_tree();
colm_tree_downref( prg, sp, obj );
- tree_t *split = getFieldSplit( prg, obj, field );
+ tree_t *split = get_field_split( prg, obj, field );
colm_tree_upref( split );
vm_push_tree( split );
break;
@@ -1322,7 +1322,7 @@ again:
/* Set up the reverse instruction. */
rcode_code( exec, IN_SET_STRUCT_BKT );
- rcodeHalf( exec, field );
+ rcode_half( exec, field );
rcode_word( exec, (word_t)prev );
rcode_unit_term( exec );
break;
@@ -1380,7 +1380,7 @@ again:
colm_struct_set_field( strct, tree_t*, field, val );
rcode_code( exec, IN_SET_STRUCT_VAL_BKT );
- rcodeHalf( exec, field );
+ rcode_half( exec, field );
rcode_word( exec, (word_t)prev );
rcode_unit_term( exec );
break;
@@ -1408,11 +1408,11 @@ again:
read_byte( len );
for ( i = 0; i < len; i++ ) {
- uchar prodNum, childNum;
- read_byte( prodNum );
- read_byte( childNum );
- if ( !done && obj->prod_num == prodNum ) {
- val = getRhsEl( prg, obj, childNum );
+ uchar prod_num, child_num;
+ read_byte( prod_num );
+ read_byte( child_num );
+ if ( !done && obj->prod_num == prod_num ) {
+ val = get_rhs_el( prg, obj, child_num );
done = 1;
}
}
@@ -1449,8 +1449,8 @@ again:
vm_pop_tree();
value_t integer = vm_pop_value();
str_t *format = vm_pop_string();
- head_t *res = stringSprintf( prg, format, (long)integer );
- str_t *str = (str_t*)constructString( prg, res );
+ head_t *res = string_sprintf( prg, format, (long)integer );
+ str_t *str = (str_t*)construct_string( prg, res );
colm_tree_upref( (tree_t*)str );
vm_push_string( str );
colm_tree_downref( prg, sp, (tree_t*)format );
@@ -1460,8 +1460,8 @@ again:
debug( prg, REALM_BYTECODE, "IN_INT_TO_STR\n" );
value_t i = vm_pop_value();
- head_t *res = intToStr( prg, (long)i );
- tree_t *str = constructString( prg, res );
+ head_t *res = int_to_str( prg, (long)i );
+ tree_t *str = construct_string( prg, res );
colm_tree_upref( str );
vm_push_tree( str );
break;
@@ -1471,7 +1471,7 @@ again:
tree_t *tree = vm_pop_tree();
head_t *res = tree_to_str( prg, sp, tree, false );
- tree_t *str = constructString( prg, res );
+ tree_t *str = construct_string( prg, res );
colm_tree_upref( str );
vm_push_tree( str );
colm_tree_downref( prg, sp, tree );
@@ -1482,7 +1482,7 @@ again:
tree_t *tree = vm_pop_tree();
head_t *res = tree_to_str( prg, sp, tree, true );
- tree_t *str = constructString( prg, res );
+ tree_t *str = construct_string( prg, res );
colm_tree_upref( str );
vm_push_tree( str );
colm_tree_downref( prg, sp, tree );
@@ -1492,7 +1492,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_TREE_TRIM\n" );
tree_t *tree = vm_pop_tree();
- tree_t *trimmed = treeTrim( prg, sp, tree );
+ tree_t *trimmed = tree_trim( prg, sp, tree );
vm_push_tree( trimmed );
break;
}
@@ -1501,8 +1501,8 @@ again:
str_t *s2 = vm_pop_string();
str_t *s1 = vm_pop_string();
- head_t *res = concatStr( s1->value, s2->value );
- tree_t *str = constructString( prg, res );
+ head_t *res = concat_str( s1->value, s2->value );
+ tree_t *str = construct_string( prg, res );
colm_tree_upref( str );
colm_tree_downref( prg, sp, (tree_t*)s1 );
colm_tree_downref( prg, sp, (tree_t*)s2 );
@@ -1514,7 +1514,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_STR_LENGTH\n" );
str_t *str = vm_pop_string();
- long len = stringLength( str->value );
+ long len = string_length( str->value );
value_t res = len;
vm_push_value( res );
colm_tree_downref( prg, sp, (tree_t*)str );
@@ -1527,7 +1527,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_JMP_FALSE_TREE %d\n", dist );
tree_t *tree = vm_pop_tree();
- if ( testFalse( prg, tree ) )
+ if ( test_false( prg, tree ) )
instr += dist;
colm_tree_downref( prg, sp, tree );
break;
@@ -1539,7 +1539,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_JMP_TRUE_TREE %d\n", dist );
tree_t *tree = vm_pop_tree();
- if ( !testFalse( prg, tree ) )
+ if ( !test_false( prg, tree ) )
instr += dist;
colm_tree_downref( prg, sp, tree );
break;
@@ -1577,7 +1577,7 @@ again:
}
case IN_REJECT: {
debug( prg, REALM_BYTECODE, "IN_REJECT\n" );
- exec->parser->pdaRun->reject = true;
+ exec->parser->pda_run->reject = true;
break;
}
@@ -1734,7 +1734,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_TST_NZ_TREE\n" );
tree_t *tree = vm_pop_tree();
- long r = !testFalse( prg, tree );
+ long r = !test_false( prg, tree );
colm_tree_downref( prg, sp, tree );
vm_push_value( r );
break;
@@ -1753,7 +1753,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_NOT_TREE\n" );
tree_t *tree = vm_pop_tree();
- long r = testFalse( prg, tree );
+ long r = test_false( prg, tree );
value_t val = r ? TRUE_VAL : FALSE_VAL;
vm_push_value( val );
colm_tree_downref( prg, sp, tree );
@@ -1817,25 +1817,25 @@ again:
}
case IN_TRITER_FROM_REF: {
short field;
- half_t argSize;
- half_t searchTypeId;
+ half_t arg_size;
+ half_t search_type_id;
read_half( field );
- read_half( argSize );
- read_half( searchTypeId );
+ read_half( arg_size );
+ read_half( search_type_id );
debug( prg, REALM_BYTECODE, "IN_TRITER_FROM_REF "
- "%hd %hd %hd\n", field, argSize, searchTypeId );
+ "%hd %hd %hd\n", field, arg_size, search_type_id );
- ref_t rootRef;
- rootRef.kid = vm_pop_kid();
- rootRef.next = vm_pop_ref();
+ ref_t root_ref;
+ root_ref.kid = vm_pop_kid();
+ root_ref.next = vm_pop_ref();
void *mem = vm_get_plocal(exec, field);
- tree_t **stackRoot = vm_ptop();
- long rootSize = vm_ssize();
+ tree_t **stack_root = vm_ptop();
+ long root_size = vm_ssize();
- colm_init_tree_iter( (tree_iter_t*)mem, stackRoot,
- argSize, rootSize, &rootRef, searchTypeId );
+ colm_init_tree_iter( (tree_iter_t*)mem, stack_root,
+ arg_size, root_size, &root_ref, search_type_id );
break;
}
case IN_TRITER_UNWIND:
@@ -1845,30 +1845,30 @@ again:
tree_iter_t *iter = (tree_iter_t*) vm_get_plocal(exec, field);
debug( prg, REALM_BYTECODE, "IN_TRITER_DESTROY %hd %d\n",
- field, iter->yieldSize );
+ field, iter->yield_size );
colm_tree_iter_destroy( prg, &sp, iter );
break;
}
case IN_REV_TRITER_FROM_REF: {
short field;
- half_t argSize;
- half_t searchTypeId;
+ half_t arg_size;
+ half_t search_type_id;
read_half( field );
- read_half( argSize );
- read_half( searchTypeId );
+ read_half( arg_size );
+ read_half( search_type_id );
debug( prg, REALM_BYTECODE, "IN_REV_TRITER_FROM_REF "
- "%hd %hd %hd\n", field, argSize, searchTypeId );
+ "%hd %hd %hd\n", field, arg_size, search_type_id );
- ref_t rootRef;
- rootRef.kid = vm_pop_kid();
- rootRef.next = vm_pop_ref();
+ ref_t root_ref;
+ root_ref.kid = vm_pop_kid();
+ root_ref.next = vm_pop_ref();
- tree_t **stackRoot = vm_ptop();
- long rootSize = vm_ssize();
+ tree_t **stack_root = vm_ptop();
+ long root_size = vm_ssize();
int children = 0;
- kid_t *kid = treeChild( prg, rootRef.kid->tree );
+ kid_t *kid = tree_child( prg, root_ref.kid->tree );
while ( kid != 0 ) {
vm_push_kid( kid );
kid = kid->next;
@@ -1876,8 +1876,8 @@ again:
}
void *mem = vm_get_plocal(exec, field);
- colm_init_rev_tree_iter( (rev_tree_iter_t*)mem, stackRoot,
- argSize, rootSize, &rootRef, searchTypeId, children );
+ colm_init_rev_tree_iter( (rev_tree_iter_t*)mem, stack_root,
+ arg_size, root_size, &root_ref, search_type_id, children );
break;
}
case IN_REV_TRITER_UNWIND:
@@ -1898,7 +1898,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_TREE_SEARCH\n" );
tree_t *tree = vm_pop_tree();
- tree_t *res = treeSearch( prg, tree, id );
+ tree_t *res = tree_search( prg, tree, id );
colm_tree_upref( res );
vm_push_tree( res );
colm_tree_downref( prg, sp, tree );
@@ -1911,7 +1911,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_TRITER_ADVANCE\n" );
tree_iter_t *iter = (tree_iter_t*) vm_get_plocal(exec, field);
- tree_t *res = treeIterAdvance( prg, &sp, iter );
+ tree_t *res = tree_iter_advance( prg, &sp, iter );
//colm_tree_upref( res );
vm_push_tree( res );
break;
@@ -1923,7 +1923,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_TRITER_NEXT_CHILD\n" );
tree_iter_t *iter = (tree_iter_t*) vm_get_plocal(exec, field);
- tree_t *res = treeIterNextChild( prg, &sp, iter );
+ tree_t *res = tree_iter_next_child( prg, &sp, iter );
//colm_tree_upref( res );
vm_push_tree( res );
break;
@@ -1935,7 +1935,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_REV_TRITER_PREV_CHILD\n" );
rev_tree_iter_t *iter = (rev_tree_iter_t*) vm_get_plocal(exec, field);
- tree_t *res = treeRevIterPrevChild( prg, &sp, iter );
+ tree_t *res = tree_rev_iter_prev_child( prg, &sp, iter );
//colm_tree_upref( res );
vm_push_tree( res );
break;
@@ -1947,7 +1947,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_TRITER_NEXT_REPEAT\n" );
tree_iter_t *iter = (tree_iter_t*) vm_get_plocal(exec, field);
- tree_t *res = treeIterNextRepeat( prg, &sp, iter );
+ tree_t *res = tree_iter_next_repeat( prg, &sp, iter );
//colm_tree_upref( res );
vm_push_tree( res );
break;
@@ -1959,7 +1959,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_TRITER_PREV_REPEAT\n" );
tree_iter_t *iter = (tree_iter_t*) vm_get_plocal(exec, field);
- tree_t *res = treeIterPrevRepeat( prg, &sp, iter );
+ tree_t *res = tree_iter_prev_repeat( prg, &sp, iter );
//colm_tree_upref( res );
vm_push_tree( res );
break;
@@ -1971,7 +1971,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_TRITER_GET_CUR_R\n" );
tree_iter_t *iter = (tree_iter_t*) vm_get_plocal(exec, field);
- tree_t *tree = treeIterDerefCur( iter );
+ tree_t *tree = tree_iter_deref_cur( iter );
colm_tree_upref( tree );
vm_push_tree( tree );
break;
@@ -1983,8 +1983,8 @@ again:
debug( prg, REALM_BYTECODE, "IN_TRITER_GET_CUR_WC\n" );
tree_iter_t *iter = (tree_iter_t*) vm_get_plocal(exec, field);
- splitIterCur( prg, &sp, iter );
- tree_t *tree = treeIterDerefCur( iter );
+ split_iter_cur( prg, &sp, iter );
+ tree_t *tree = tree_iter_deref_cur( iter );
colm_tree_upref( tree );
vm_push_tree( tree );
break;
@@ -1997,33 +1997,33 @@ again:
tree_t *tree = vm_pop_tree();
tree_iter_t *iter = (tree_iter_t*) vm_get_plocal(exec, field);
- splitIterCur( prg, &sp, iter );
- tree_t *old = treeIterDerefCur( iter );
- setTriterCur( prg, iter, tree );
+ split_iter_cur( prg, &sp, iter );
+ tree_t *old = tree_iter_deref_cur( iter );
+ set_triter_cur( prg, iter, tree );
colm_tree_downref( prg, sp, old );
break;
}
case IN_GEN_ITER_FROM_REF: {
short field;
- half_t argSize;
- half_t genericId;
+ half_t arg_size;
+ half_t generic_id;
read_half( field );
- read_half( argSize );
- read_half( genericId );
+ read_half( arg_size );
+ read_half( generic_id );
debug( prg, REALM_BYTECODE, "IN_LIST_ITER_FROM_REF "
- "%hd %hd %hd\n", field, argSize, genericId );
+ "%hd %hd %hd\n", field, arg_size, generic_id );
- ref_t rootRef;
- rootRef.kid = vm_pop_kid();
- rootRef.next = vm_pop_ref();
+ ref_t root_ref;
+ root_ref.kid = vm_pop_kid();
+ root_ref.next = vm_pop_ref();
void *mem = vm_get_plocal(exec, field);
- tree_t **stackRoot = vm_ptop();
- long rootSize = vm_ssize();
+ tree_t **stack_root = vm_ptop();
+ long root_size = vm_ssize();
- colm_init_list_iter( (generic_iter_t*)mem, stackRoot, argSize,
- rootSize, &rootRef, genericId );
+ colm_init_list_iter( (generic_iter_t*)mem, stack_root, arg_size,
+ root_size, &root_ref, generic_id );
break;
}
case IN_GEN_ITER_UNWIND:
@@ -2033,7 +2033,7 @@ again:
generic_iter_t *iter = (generic_iter_t*) vm_get_plocal(exec, field);
- debug( prg, REALM_BYTECODE, "IN_LIST_ITER_DESTROY %d\n", iter->yieldSize );
+ debug( prg, REALM_BYTECODE, "IN_LIST_ITER_DESTROY %d\n", iter->yield_size );
colm_list_iter_destroy( prg, &sp, iter );
break;
@@ -2086,33 +2086,33 @@ again:
break;
}
case IN_MATCH: {
- half_t patternId;
- read_half( patternId );
+ half_t pattern_id;
+ read_half( pattern_id );
debug( prg, REALM_BYTECODE, "IN_MATCH\n" );
tree_t *tree = vm_pop_tree();
/* Run the match, push the result. */
- int rootNode = prg->rtd->patReplInfo[patternId].offset;
+ int root_node = prg->rtd->pat_repl_info[pattern_id].offset;
/* Bindings are indexed starting at 1. Zero bindId to represent no
* binding. We make a space for it here rather than do math at
* access them. */
- long numBindings = prg->rtd->patReplInfo[patternId].numBindings;
- tree_t *bindings[1+numBindings];
- memset( bindings, 0, sizeof(tree_t*)*(1+numBindings) );
+ long num_bindings = prg->rtd->pat_repl_info[pattern_id].num_bindings;
+ tree_t *bindings[1+num_bindings];
+ memset( bindings, 0, sizeof(tree_t*)*(1+num_bindings) );
kid_t kid;
kid.tree = tree;
kid.next = 0;
- int matched = matchPattern( bindings, prg, rootNode, &kid, false );
+ int matched = match_pattern( bindings, prg, root_node, &kid, false );
if ( !matched )
- memset( bindings, 0, sizeof(tree_t*)*(1+numBindings) );
+ memset( bindings, 0, sizeof(tree_t*)*(1+num_bindings) );
else {
int b;
- for ( b = 1; b <= numBindings; b++ )
+ for ( b = 1; b <= num_bindings; b++ )
assert( bindings[b] != 0 );
}
@@ -2120,7 +2120,7 @@ again:
colm_tree_upref( result );
vm_push_tree( result ? tree : 0 );
int b;
- for ( b = 1; b <= numBindings; b++ ) {
+ for ( b = 1; b <= num_bindings; b++ ) {
colm_tree_upref( bindings[b] );
vm_push_tree( bindings[b] );
}
@@ -2171,7 +2171,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_PARSE_APPEND_BKT\n" );
- struct stream_impl *si = streamToImpl( ((parser_t*)pptr)->input );
+ struct stream_impl *si = stream_to_impl( ((parser_t*)pptr)->input );
stream_undo_append( prg, sp, si, input, len );
colm_tree_downref( prg, sp, input );
@@ -2218,7 +2218,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_PARSE_APPEND_STREAM_BKT\n" );
- struct stream_impl *si = streamToImpl( ((parser_t*)pptr)->input );
+ struct stream_impl *si = stream_to_impl( ((parser_t*)pptr)->input );
stream_undo_append_stream( prg, sp, si, input, len );
colm_tree_downref( prg, sp, input );
@@ -2266,8 +2266,8 @@ again:
debug( prg, REALM_BYTECODE, "IN_PARSE_LOAD\n" );
parser_t *parser = vm_pop_parser();
- struct pda_run *pdaRun = parser->pdaRun;
- long steps = pdaRun->steps;
+ struct pda_run *pda_run = parser->pda_run;
+ long steps = pda_run->steps;
vm_push_parser( exec->parser );
vm_push_type( long, exec->pcr );
@@ -2303,62 +2303,62 @@ again:
case IN_PCR_CALL: {
debug( prg, REALM_BYTECODE, "IN_PCR_CALL\n" );
- int frameSize = 0;
- if ( exec->parser->pdaRun->frameId >= 0 ) {
- struct frame_info *fi = &prg->rtd->frameInfo[exec->parser->pdaRun->frameId];
- frameSize = fi->frameSize;
+ int frame_size = 0;
+ if ( exec->parser->pda_run->frame_id >= 0 ) {
+ struct frame_info *fi = &prg->rtd->frame_info[exec->parser->pda_run->frame_id];
+ frame_size = fi->frame_size;
}
- vm_contiguous( 4 + frameSize );
+ vm_contiguous( 4 + frame_size );
- vm_push_type( tree_t**, exec->framePtr );
- vm_push_type( tree_t**, exec->iframePtr );
- vm_push_type( long, exec->frameId );
+ vm_push_type( tree_t**, exec->frame_ptr );
+ vm_push_type( tree_t**, exec->iframe_ptr );
+ vm_push_type( long, exec->frame_id );
/* Return location one instruction back. Depends on the size of of
* the frag/finish. */
- code_t *returnTo = instr - ( SIZEOF_CODE + SIZEOF_CODE + SIZEOF_HALF );
- vm_push_type( code_t*, returnTo );
+ code_t *return_to = instr - ( SIZEOF_CODE + SIZEOF_CODE + SIZEOF_HALF );
+ vm_push_type( code_t*, return_to );
- exec->framePtr = 0;
- exec->iframePtr = 0;
- exec->frameId = 0;
+ exec->frame_ptr = 0;
+ exec->iframe_ptr = 0;
+ exec->frame_id = 0;
- instr = exec->parser->pdaRun->code;
+ instr = exec->parser->pda_run->code;
- exec->frameId = exec->parser->pdaRun->frameId;
+ exec->frame_id = exec->parser->pda_run->frame_id;
- if ( exec->parser->pdaRun->frameId >= 0 ) {
- struct frame_info *fi = &prg->rtd->frameInfo[exec->parser->pdaRun->frameId];
+ if ( exec->parser->pda_run->frame_id >= 0 ) {
+ struct frame_info *fi = &prg->rtd->frame_info[exec->parser->pda_run->frame_id];
- exec->framePtr = vm_ptop();
- vm_pushn( fi->frameSize );
- memset( vm_ptop(), 0, sizeof(word_t) * fi->frameSize );
+ exec->frame_ptr = vm_ptop();
+ vm_pushn( fi->frame_size );
+ memset( vm_ptop(), 0, sizeof(word_t) * fi->frame_size );
}
break;
}
case IN_LOAD_RETVAL: {
debug( prg, REALM_BYTECODE, "IN_LOAD_RETVAL\n" );
- vm_push_tree( exec->retVal );
+ vm_push_tree( exec->ret_val );
break;
}
case IN_PCR_RET: {
debug( prg, REALM_BYTECODE, "IN_PCR_RET\n" );
- if ( exec->frameId >= 0 ) {
- struct frame_info *fi = &prg->rtd->frameInfo[exec->frameId];
- downref_local_trees( prg, sp, exec, fi->locals, fi->localsLen );
- debug( prg, REALM_BYTECODE, "RET: %d\n", fi->frameSize );
+ if ( exec->frame_id >= 0 ) {
+ struct frame_info *fi = &prg->rtd->frame_info[exec->frame_id];
+ downref_local_trees( prg, sp, exec, fi->locals, fi->locals_len );
+ debug( prg, REALM_BYTECODE, "RET: %d\n", fi->frame_size );
- vm_popn( fi->frameSize );
+ vm_popn( fi->frame_size );
}
instr = vm_pop_type(code_t*);
- exec->frameId = vm_pop_type(long);
- exec->iframePtr = vm_pop_type(tree_t**);
- exec->framePtr = vm_pop_type(tree_t**);
+ exec->frame_id = vm_pop_type(long);
+ exec->iframe_ptr = vm_pop_type(tree_t**);
+ exec->frame_ptr = vm_pop_type(tree_t**);
if ( instr == 0 ) {
fflush( stdout );
@@ -2369,18 +2369,18 @@ again:
case IN_PCR_END_DECK: {
debug( prg, REALM_BYTECODE, "IN_PCR_END_DECK\n" );
- exec->parser->pdaRun->onDeck = false;
+ exec->parser->pda_run->on_deck = false;
break;
}
case IN_PARSE_FRAG_WC: {
- half_t stopId;
- read_half( stopId );
+ half_t stop_id;
+ read_half( stop_id );
- debug( prg, REALM_BYTECODE, "IN_PARSE_FRAG_WC %hd\n", stopId );
+ debug( prg, REALM_BYTECODE, "IN_PARSE_FRAG_WC %hd\n", stop_id );
- exec->pcr = colm_parse_frag( prg, sp, exec->parser->pdaRun,
- exec->parser->input, stopId, exec->pcr );
+ exec->pcr = colm_parse_frag( prg, sp, exec->parser->pda_run,
+ exec->parser->input, stop_id, exec->pcr );
/* If done, jump to the terminating instruction, otherwise fall
* through to call some code, then jump back here. */
@@ -2400,20 +2400,20 @@ again:
vm_push_parser( parser );
- if ( prg->induceExit )
+ if ( prg->induce_exit )
goto out;
break;
}
case IN_PARSE_FRAG_WV: {
- half_t stopId;
- read_half( stopId );
+ half_t stop_id;
+ read_half( stop_id );
- debug( prg, REALM_BYTECODE, "IN_PARSE_FRAG_WV %hd\n", stopId );
+ debug( prg, REALM_BYTECODE, "IN_PARSE_FRAG_WV %hd\n", stop_id );
- exec->pcr = colm_parse_frag( prg, sp, exec->parser->pdaRun,
- exec->parser->input, stopId, exec->pcr );
+ exec->pcr = colm_parse_frag( prg, sp, exec->parser->pda_run,
+ exec->parser->input, stop_id, exec->pcr );
/* If done, jump to the terminating instruction, otherwise fall
* through to call some code, then jump back here. */
@@ -2440,23 +2440,23 @@ again:
rcode_word( exec, (word_t) PCR_START );
rcode_word( exec, steps );
rcode_code( exec, IN_PARSE_FRAG_BKT );
- rcodeHalf( exec, 0 );
+ rcode_half( exec, 0 );
rcode_code( exec, IN_PCR_CALL );
rcode_code( exec, IN_PARSE_FRAG_EXIT_BKT );
rcode_unit_term( exec );
- if ( prg->induceExit )
+ if ( prg->induce_exit )
goto out;
break;
}
case IN_PARSE_FRAG_BKT: {
- half_t stopId;
- read_half( stopId );
+ half_t stop_id;
+ read_half( stop_id );
- debug( prg, REALM_BYTECODE, "IN_PARSE_FRAG_BKT %hd\n", stopId );
+ debug( prg, REALM_BYTECODE, "IN_PARSE_FRAG_BKT %hd\n", stop_id );
- exec->pcr = colm_parse_undo_frag( prg, sp, exec->parser->pdaRun,
+ exec->pcr = colm_parse_undo_frag( prg, sp, exec->parser->pda_run,
exec->parser->input, exec->steps, exec->pcr );
if ( exec->pcr == PCR_DONE )
@@ -2475,14 +2475,14 @@ again:
}
case IN_PARSE_FINISH_WC: {
- half_t stopId;
- read_half( stopId );
+ half_t stop_id;
+ read_half( stop_id );
- debug( prg, REALM_BYTECODE, "IN_PARSE_FINISH_WC %hd\n", stopId );
+ debug( prg, REALM_BYTECODE, "IN_PARSE_FINISH_WC %hd\n", stop_id );
tree_t *result = 0;
exec->pcr = colm_parse_finish( &result, prg, sp,
- exec->parser->pdaRun, exec->parser->input, false, exec->pcr );
+ exec->parser->pda_run, exec->parser->input, false, exec->pcr );
exec->parser->result = result;
@@ -2504,20 +2504,20 @@ again:
vm_push_parser( parser );
- if ( prg->induceExit )
+ if ( prg->induce_exit )
goto out;
break;
}
case IN_PARSE_FINISH_WV: {
- half_t stopId;
- read_half( stopId );
+ half_t stop_id;
+ read_half( stop_id );
- debug( prg, REALM_BYTECODE, "IN_PARSE_FINISH_WV %hd\n", stopId );
+ debug( prg, REALM_BYTECODE, "IN_PARSE_FINISH_WV %hd\n", stop_id );
tree_t *result = 0;
- exec->pcr = colm_parse_finish( &result, prg, sp, exec->parser->pdaRun,
+ exec->pcr = colm_parse_finish( &result, prg, sp, exec->parser->pda_run,
exec->parser->input, true, exec->pcr );
exec->parser->result = result;
@@ -2545,24 +2545,24 @@ again:
rcode_word( exec, (word_t)PCR_START );
rcode_word( exec, steps );
rcode_code( exec, IN_PARSE_FINISH_BKT );
- rcodeHalf( exec, 0 );
+ rcode_half( exec, 0 );
rcode_code( exec, IN_PCR_CALL );
rcode_code( exec, IN_PARSE_FINISH_EXIT_BKT );
rcode_unit_term( exec );
- if ( prg->induceExit )
+ if ( prg->induce_exit )
goto out;
break;
}
case IN_PARSE_FINISH_BKT: {
- half_t stopId;
- read_half( stopId );
+ half_t stop_id;
+ read_half( stop_id );
- debug( prg, REALM_BYTECODE, "IN_PARSE_FINISH_BKT %hd\n", stopId );
+ debug( prg, REALM_BYTECODE, "IN_PARSE_FINISH_BKT %hd\n", stop_id );
- exec->pcr = colm_parse_undo_frag( prg, sp, exec->parser->pdaRun,
+ exec->pcr = colm_parse_undo_frag( prg, sp, exec->parser->pda_run,
exec->parser->input, exec->steps, exec->pcr );
if ( exec->pcr == PCR_DONE )
@@ -2579,8 +2579,8 @@ again:
exec->pcr = vm_pop_type(long);
exec->parser = vm_pop_parser();
- struct stream_impl *si = streamToImpl( parser->input );
- si->funcs->unsetEof( si );
+ struct stream_impl *si = stream_to_impl( parser->input );
+ si->funcs->unset_eof( si );
break;
}
@@ -2589,8 +2589,8 @@ again:
stream_t *stream = vm_pop_stream();
tree_t *len = vm_pop_tree();
- struct pda_run *pdaRun = exec->parser != 0 ? exec->parser->pdaRun : 0;
- tree_t *string = stream_pull_bc( prg, sp, pdaRun, stream, len );
+ struct pda_run *pda_run = exec->parser != 0 ? exec->parser->pda_run : 0;
+ tree_t *string = stream_pull_bc( prg, sp, pda_run, stream, len );
colm_tree_upref( string );
vm_push_tree( string );
@@ -2609,8 +2609,8 @@ again:
stream_t *stream = vm_pop_stream();
tree_t *len = vm_pop_tree();
- struct pda_run *pdaRun = exec->parser != 0 ? exec->parser->pdaRun : 0;
- tree_t *string = stream_pull_bc( prg, sp, pdaRun, stream, len );
+ struct pda_run *pda_run = exec->parser != 0 ? exec->parser->pda_run : 0;
+ tree_t *string = stream_pull_bc( prg, sp, pda_run, stream, len );
colm_tree_upref( string );
vm_push_tree( string );
@@ -2634,7 +2634,7 @@ again:
stream_t *input = vm_pop_stream();
tree_t *tree = vm_pop_tree();
- long len = stream_push( prg, sp, streamToImpl( input ), tree, false );
+ long len = stream_push( prg, sp, stream_to_impl( input ), tree, false );
vm_push_tree( 0 );
/* Single unit. */
@@ -2650,7 +2650,7 @@ again:
stream_t *input = vm_pop_stream();
tree_t *tree = vm_pop_tree();
- long len = stream_push( prg, sp, streamToImpl( input ), tree, true );
+ long len = stream_push( prg, sp, stream_to_impl( input ), tree, true );
vm_push_tree( 0 );
/* Single unit. */
@@ -2668,15 +2668,15 @@ again:
debug( prg, REALM_BYTECODE, "IN_INPUT_PUSH_BKT %d\n", len );
stream_t *input = vm_pop_stream();
- colm_undo_stream_push( prg, sp, streamToImpl( input ), len );
+ colm_undo_stream_push( prg, sp, stream_to_impl( input ), len );
break;
}
case IN_INPUT_PUSH_STREAM_WV: {
debug( prg, REALM_BYTECODE, "IN_INPUT_PUSH_STREAM_WV\n" );
stream_t *input = vm_pop_stream();
- stream_t *toPush = vm_pop_stream();
- long len = stream_push_stream( prg, sp, streamToImpl( input ), toPush );
+ stream_t *to_push = vm_pop_stream();
+ long len = stream_push_stream( prg, sp, stream_to_impl( input ), to_push );
vm_push_tree( 0 );
/* Single unit. */
@@ -2692,63 +2692,63 @@ again:
debug( prg, REALM_BYTECODE, "IN_INPUT_PUSH_STREAM_BKT %d\n", len );
stream_t *input = vm_pop_stream();
- colm_undo_stream_push( prg, sp, streamToImpl( input ), len );
+ colm_undo_stream_push( prg, sp, stream_to_impl( input ), len );
break;
}
case IN_CONS_GENERIC: {
- half_t genericId;
- read_half( genericId );
+ half_t generic_id;
+ read_half( generic_id );
- debug( prg, REALM_BYTECODE, "IN_CONS_GENERIC %hd\n", genericId );
+ debug( prg, REALM_BYTECODE, "IN_CONS_GENERIC %hd\n", generic_id );
- struct_t *gen = colm_construct_generic( prg, genericId );
+ struct_t *gen = colm_construct_generic( prg, generic_id );
vm_push_struct( gen );
break;
}
case IN_CONS_OBJECT: {
- half_t langElId;
- read_half( langElId );
+ half_t lang_el_id;
+ read_half( lang_el_id );
- debug( prg, REALM_BYTECODE, "IN_CONS_OBJECT %hd\n", langElId );
+ debug( prg, REALM_BYTECODE, "IN_CONS_OBJECT %hd\n", lang_el_id );
- tree_t *replTree = colm_construct_object( prg, 0, 0, langElId );
- vm_push_tree( replTree );
+ tree_t *repl_tree = colm_construct_object( prg, 0, 0, lang_el_id );
+ vm_push_tree( repl_tree );
break;
}
case IN_CONSTRUCT: {
- half_t patternId;
- read_half( patternId );
+ half_t pattern_id;
+ read_half( pattern_id );
debug( prg, REALM_BYTECODE, "IN_CONSTRUCT\n" );
//struct lang_el_info *lelInfo = prg->rtd->lelInfo;
//struct pat_cons_node *nodes = prg->rtd->patReplNodes;
- int rootNode = prg->rtd->patReplInfo[patternId].offset;
+ int root_node = prg->rtd->pat_repl_info[pattern_id].offset;
/* Note that bindIds are indexed at one. Add one spot for them. */
- int numBindings = prg->rtd->patReplInfo[patternId].numBindings;
- tree_t *bindings[1+numBindings];
+ int num_bindings = prg->rtd->pat_repl_info[pattern_id].num_bindings;
+ tree_t *bindings[1+num_bindings];
int b;
- for ( b = 1; b <= numBindings; b++ ) {
+ for ( b = 1; b <= num_bindings; b++ ) {
bindings[b] = vm_pop_tree();
assert( bindings[b] != 0 );
}
- tree_t *replTree = colm_construct_tree( prg, 0, bindings, rootNode );
+ tree_t *repl_tree = colm_construct_tree( prg, 0, bindings, root_node );
- vm_push_tree( replTree );
+ vm_push_tree( repl_tree );
break;
}
case IN_CONSTRUCT_TERM: {
- half_t tokenId;
- read_half( tokenId );
+ half_t token_id;
+ read_half( token_id );
debug( prg, REALM_BYTECODE, "IN_CONSTRUCT_TERM\n" );
/* Pop the string we are constructing the token from. */
str_t *str = vm_pop_string();
- tree_t *res = colm_construct_term( prg, tokenId, str->value );
+ tree_t *res = colm_construct_term( prg, token_id, str->value );
colm_tree_upref( res );
vm_push_tree( res );
break;
@@ -2781,7 +2781,7 @@ again:
for ( i = nargs-1; i >= 0; i-- )
arg[i] = vm_pop_tree();
- tree_t *result = makeTree( prg, arg, nargs );
+ tree_t *result = make_tree( prg, arg, nargs );
for ( i = 1; i < nargs; i++ )
colm_tree_downref( prg, sp, arg[i] );
@@ -2789,13 +2789,13 @@ again:
break;
}
case IN_TREE_CAST: {
- half_t langElId;
- read_half( langElId );
+ half_t lang_el_id;
+ read_half( lang_el_id );
- debug( prg, REALM_BYTECODE, "IN_TREE_CAST %hd\n", langElId );
+ debug( prg, REALM_BYTECODE, "IN_TREE_CAST %hd\n", lang_el_id );
tree_t *tree = vm_pop_tree();
- tree_t *res = castTree( prg, langElId, tree );
+ tree_t *res = cast_tree( prg, lang_el_id, tree );
colm_tree_upref( res );
colm_tree_downref( prg, sp, tree );
vm_push_tree( res );
@@ -2859,7 +2859,7 @@ again:
ref_t *ref = (ref_t*)(sp + back);
tree_t *obj = ref->kid->tree;
- kid_t *attr_kid = getFieldKid( obj, field );
+ kid_t *attr_kid = get_field_kid( obj, field );
vm_contiguous( 2 );
vm_push_ref( ref );
@@ -2878,22 +2878,22 @@ again:
ref_t *ref = (ref_t*)(sp + back);
tree_t *obj = ref->kid->tree;
- kid_t *attrKid = 0;
+ kid_t *attr_kid = 0;
read_byte( len );
for ( i = 0; i < len; i++ ) {
- uchar prodNum, childNum;
- read_byte( prodNum );
- read_byte( childNum );
- if ( !done && obj->prod_num == prodNum ) {
- attrKid = getRhsElKid( prg, obj, childNum );
+ uchar prod_num, child_num;
+ read_byte( prod_num );
+ read_byte( child_num );
+ if ( !done && obj->prod_num == prod_num ) {
+ attr_kid = get_rhs_el_kid( prg, obj, child_num );
done = 1;
}
}
vm_contiguous( 2 );
vm_push_ref( ref );
- vm_push_kid( attrKid );
+ vm_push_kid( attr_kid );
break;
}
case IN_REF_FROM_BACK: {
@@ -2940,8 +2940,8 @@ again:
debug( prg, REALM_BYTECODE, "IN_GET_TOKEN_DATA_R\n" );
tree_t *tree = vm_pop_tree();
- head_t *data = stringCopy( prg, tree->tokdata );
- tree_t *str = constructString( prg, data );
+ head_t *data = string_copy( prg, tree->tokdata );
+ tree_t *str = construct_string( prg, data );
colm_tree_upref( str );
vm_push_tree( str );
colm_tree_downref( prg, sp, tree );
@@ -2952,8 +2952,8 @@ again:
tree_t *tree = vm_pop_tree();
tree_t *val = vm_pop_tree();
- head_t *head = stringCopy( prg, ((str_t*)val)->value );
- stringFree( prg, tree->tokdata );
+ head_t *head = string_copy( prg, ((str_t*)val)->value );
+ string_free( prg, tree->tokdata );
tree->tokdata = head;
colm_tree_downref( prg, sp, tree );
@@ -2967,7 +2967,7 @@ again:
tree_t *val = vm_pop_tree();
head_t *oldval = tree->tokdata;
- head_t *head = stringCopy( prg, ((str_t*)val)->value );
+ head_t *head = string_copy( prg, ((str_t*)val)->value );
tree->tokdata = head;
/* Set up reverse code. Needs no args. */
@@ -2987,7 +2987,7 @@ again:
tree_t *tree = vm_pop_tree();
head_t *head = (head_t*)oldval;
- stringFree( prg, tree->tokdata );
+ string_free( prg, tree->tokdata );
tree->tokdata = head;
colm_tree_downref( prg, sp, tree );
break;
@@ -3018,15 +3018,15 @@ again:
case IN_GET_MATCH_LENGTH_R: {
debug( prg, REALM_BYTECODE, "IN_GET_MATCH_LENGTH_R\n" );
- value_t integer = stringLength(exec->parser->pdaRun->tokdata);
+ value_t integer = string_length(exec->parser->pda_run->tokdata);
vm_push_value( integer );
break;
}
case IN_GET_MATCH_TEXT_R: {
debug( prg, REALM_BYTECODE, "IN_GET_MATCH_TEXT_R\n" );
- head_t *s = stringCopy( prg, exec->parser->pdaRun->tokdata );
- tree_t *tree = constructString( prg, s );
+ head_t *s = string_copy( prg, exec->parser->pda_run->tokdata );
+ tree_t *tree = construct_string( prg, s );
colm_tree_upref( tree );
vm_push_tree( tree );
break;
@@ -3042,29 +3042,29 @@ again:
break;
}
case IN_GET_LIST_EL_MEM_R: {
- short genId, field;
- read_half( genId );
+ short gen_id, field;
+ read_half( gen_id );
read_half( field );
debug( prg, REALM_BYTECODE, "IN_GET_LIST_EL_MEM_R\n" );
struct_t *s = vm_pop_struct();
- list_el_t *listEl = colm_struct_to_list_el( prg, s, genId );
- struct_t *val = colm_list_el_get( prg, listEl, genId, field );
+ list_el_t *list_el = colm_struct_to_list_el( prg, s, gen_id );
+ struct_t *val = colm_list_el_get( prg, list_el, gen_id, field );
vm_push_struct( val );
break;
}
case IN_GET_LIST_MEM_R: {
- short genId, field;
- read_half( genId );
+ short gen_id, field;
+ read_half( gen_id );
read_half( field );
debug( prg, REALM_BYTECODE,
- "IN_GET_LIST_MEM_R %hd %hd\n", genId, field );
+ "IN_GET_LIST_MEM_R %hd %hd\n", gen_id, field );
list_t *list = vm_pop_list();
- struct_t *val = colm_list_get( prg, list, genId, field );
+ struct_t *val = colm_list_get( prg, list, gen_id, field );
vm_push_struct( val );
break;
}
@@ -3077,7 +3077,7 @@ again:
tree_t *obj = vm_pop_tree();
colm_tree_downref( prg, sp, obj );
- tree_t *val = getListMemSplit( prg, (list_t*)obj, field );
+ tree_t *val = get_list_mem_split( prg, (list_t*)obj, field );
colm_tree_upref( val );
vm_push_tree( val );
break;
@@ -3091,13 +3091,13 @@ again:
tree_t *obj = vm_pop_tree();
colm_tree_downref( prg, sp, obj );
- tree_t *val = getListMemSplit( prg, (list_t*)obj, field );
+ tree_t *val = get_list_mem_split( prg, (list_t*)obj, field );
colm_tree_upref( val );
vm_push_tree( val );
/* Set up the reverse instruction. */
rcode_code( exec, IN_GET_LIST_MEM_BKT );
- rcodeHalf( exec, field );
+ rcode_half( exec, field );
break;
}
case IN_GET_LIST_MEM_BKT: {
@@ -3109,21 +3109,21 @@ again:
tree_t *obj = vm_pop_tree();
colm_tree_downref( prg, sp, obj );
- tree_t *res = getListMemSplit( prg, (list_t*)obj, field );
+ tree_t *res = get_list_mem_split( prg, (list_t*)obj, field );
colm_tree_upref( res );
vm_push_tree( res );
break;
}
case IN_GET_VLIST_MEM_R: {
- short genId, field;
- read_half( genId );
+ short gen_id, field;
+ read_half( gen_id );
read_half( field );
debug( prg, REALM_BYTECODE,
- "IN_GET_VLIST_MEM_R %hd %hd\n", genId, field );
+ "IN_GET_VLIST_MEM_R %hd %hd\n", gen_id, field );
list_t *list = vm_pop_list();
- struct_t *el = colm_list_get( prg, list, genId, field );
+ struct_t *el = colm_list_get( prg, list, gen_id, field );
value_t val = colm_struct_get_field( el, value_t, 0 );
vm_push_value( val );
@@ -3138,7 +3138,7 @@ again:
tree_t *obj = vm_pop_tree();
colm_tree_downref( prg, sp, obj );
- tree_t *val = getListMemSplit( prg, (list_t*)obj, field );
+ tree_t *val = get_list_mem_split( prg, (list_t*)obj, field );
colm_tree_upref( val );
vm_push_tree( val );
break;
@@ -3152,13 +3152,13 @@ again:
tree_t *obj = vm_pop_tree();
colm_tree_downref( prg, sp, obj );
- tree_t *val = getListMemSplit( prg, (list_t*)obj, field );
+ tree_t *val = get_list_mem_split( prg, (list_t*)obj, field );
colm_tree_upref( val );
vm_push_tree( val );
/* Set up the reverse instruction. */
rcode_code( exec, IN_GET_LIST_MEM_BKT );
- rcodeHalf( exec, field );
+ rcode_half( exec, field );
break;
}
case IN_GET_VLIST_MEM_BKT: {
@@ -3170,7 +3170,7 @@ again:
tree_t *obj = vm_pop_tree();
colm_tree_downref( prg, sp, obj );
- tree_t *res = getListMemSplit( prg, (list_t*)obj, field );
+ tree_t *res = get_list_mem_split( prg, (list_t*)obj, field );
colm_tree_upref( res );
vm_push_tree( res );
break;
@@ -3182,7 +3182,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_GET_PARSER_MEM_R %hd\n", field );
tree_t *obj = vm_pop_tree();
- tree_t *val = getParserMem( (parser_t*)obj, field );
+ tree_t *val = get_parser_mem( (parser_t*)obj, field );
colm_tree_upref( val );
/* In at least one case we extract the result on a parser with ref
@@ -3193,16 +3193,16 @@ again:
}
case IN_GET_MAP_EL_MEM_R: {
- short genId, field;
- read_half( genId );
+ short gen_id, field;
+ read_half( gen_id );
read_half( field );
debug( prg, REALM_BYTECODE, "IN_GET_MAP_EL_MEM_R\n" );
struct_t *strct = vm_pop_struct();
- map_el_t *mapEl = colm_struct_to_map_el( prg, strct, genId );
- struct_t *val = colm_map_el_get( prg, mapEl, genId, field );
+ map_el_t *map_el = colm_struct_to_map_el( prg, strct, gen_id );
+ struct_t *val = colm_map_el_get( prg, map_el, gen_id, field );
vm_push_struct( val );
break;
}
@@ -3210,7 +3210,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_MAP_LENGTH\n" );
tree_t *obj = vm_pop_tree();
- long len = mapLength( (map_t*)obj );
+ long len = map_length( (map_t*)obj );
value_t res = len;
vm_push_value( res );
@@ -3218,15 +3218,15 @@ again:
break;
}
case IN_GET_MAP_MEM_R: {
- short genId, field;
- read_half( genId );
+ short gen_id, field;
+ read_half( gen_id );
read_half( field );
debug( prg, REALM_BYTECODE,
- "IN_GET_MAP_MEM_R %hd %hd\n", genId, field );
+ "IN_GET_MAP_MEM_R %hd %hd\n", gen_id, field );
map_t *map = vm_pop_map();
- struct_t *val = colm_map_get( prg, map, genId, field );
+ struct_t *val = colm_map_get( prg, map, gen_id, field );
vm_push_struct( val );
break;
}
@@ -3239,7 +3239,7 @@ again:
tree_t *obj = vm_pop_tree();
colm_tree_downref( prg, sp, obj );
- tree_t *val = getListMemSplit( prg, (list_t*)obj, field );
+ tree_t *val = get_list_mem_split( prg, (list_t*)obj, field );
colm_tree_upref( val );
vm_push_tree( val );
break;
@@ -3253,13 +3253,13 @@ again:
tree_t *obj = vm_pop_tree();
colm_tree_downref( prg, sp, obj );
- tree_t *val = getListMemSplit( prg, (list_t*)obj, field );
+ tree_t *val = get_list_mem_split( prg, (list_t*)obj, field );
colm_tree_upref( val );
vm_push_tree( val );
/* Set up the reverse instruction. */
rcode_code( exec, IN_GET_MAP_MEM_BKT );
- rcodeHalf( exec, field );
+ rcode_half( exec, field );
break;
}
case IN_GET_MAP_MEM_BKT: {
@@ -3271,7 +3271,7 @@ again:
tree_t *obj = vm_pop_tree();
colm_tree_downref( prg, sp, obj );
- tree_t *res = getListMemSplit( prg, (list_t*)obj, field );
+ tree_t *res = get_list_mem_split( prg, (list_t*)obj, field );
colm_tree_upref( res );
vm_push_tree( res );
break;
@@ -3287,7 +3287,7 @@ again:
while ( size > 0 ) {
value_t v = vm_pop_value();
- ((value_t*)exec->callArgs)[pos] = v;
+ ((value_t*)exec->call_args)[pos] = v;
size -= 1;
pos += 1;
}
@@ -3301,9 +3301,9 @@ again:
debug( prg, REALM_BYTECODE, "IN_PREP_ARGS %hd\n", size );
- vm_push_type( tree_t**, exec->callArgs );
+ vm_push_type( tree_t**, exec->call_args );
vm_pushn( size );
- exec->callArgs = vm_ptop();
+ exec->call_args = vm_ptop();
memset( vm_ptop(), 0, sizeof(word_t) * size );
break;
}
@@ -3315,67 +3315,67 @@ again:
debug( prg, REALM_BYTECODE, "IN_CLEAR_ARGS %hd\n", size );
vm_popn( size );
- exec->callArgs = vm_pop_type( tree_t** );
+ exec->call_args = vm_pop_type( tree_t** );
break;
}
case IN_HOST: {
- half_t funcId;
- read_half( funcId );
+ half_t func_id;
+ read_half( func_id );
- debug( prg, REALM_BYTECODE, "IN_HOST %hd\n", funcId );
+ debug( prg, REALM_BYTECODE, "IN_HOST %hd\n", func_id );
- sp = host_call( prg, funcId, sp );
+ sp = host_call( prg, func_id, sp );
break;
}
case IN_CALL_WV: {
- half_t funcId;
- read_half( funcId );
+ half_t func_id;
+ read_half( func_id );
- struct function_info *fi = &prg->rtd->functionInfo[funcId];
- struct frame_info *fr = &prg->rtd->frameInfo[fi->frameId];
+ struct function_info *fi = &prg->rtd->function_info[func_id];
+ struct frame_info *fr = &prg->rtd->frame_info[fi->frame_id];
debug( prg, REALM_BYTECODE, "IN_CALL_WV %s\n", fr->name );
- vm_contiguous( FR_AA + fi->frameSize );
+ vm_contiguous( FR_AA + fi->frame_size );
- vm_push_type( tree_t**, exec->callArgs );
+ vm_push_type( tree_t**, exec->call_args );
vm_push_value( 0 ); /* Return value. */
vm_push_type( code_t*, instr );
- vm_push_type( tree_t**, exec->framePtr );
- vm_push_type( long, exec->frameId );
+ vm_push_type( tree_t**, exec->frame_ptr );
+ vm_push_type( long, exec->frame_id );
instr = fr->codeWV;
- exec->frameId = fi->frameId;
+ exec->frame_id = fi->frame_id;
- exec->framePtr = vm_ptop();
- vm_pushn( fr->frameSize );
- memset( vm_ptop(), 0, sizeof(word_t) * fr->frameSize );
+ exec->frame_ptr = vm_ptop();
+ vm_pushn( fr->frame_size );
+ memset( vm_ptop(), 0, sizeof(word_t) * fr->frame_size );
break;
}
case IN_CALL_WC: {
- half_t funcId;
- read_half( funcId );
+ half_t func_id;
+ read_half( func_id );
- struct function_info *fi = &prg->rtd->functionInfo[funcId];
- struct frame_info *fr = &prg->rtd->frameInfo[fi->frameId];
+ struct function_info *fi = &prg->rtd->function_info[func_id];
+ struct frame_info *fr = &prg->rtd->frame_info[fi->frame_id];
- debug( prg, REALM_BYTECODE, "IN_CALL_WC %s %d\n", fr->name, fr->frameSize );
+ debug( prg, REALM_BYTECODE, "IN_CALL_WC %s %d\n", fr->name, fr->frame_size );
- vm_contiguous( FR_AA + fi->frameSize );
+ vm_contiguous( FR_AA + fi->frame_size );
- vm_push_type( tree_t**, exec->callArgs );
+ vm_push_type( tree_t**, exec->call_args );
vm_push_value( 0 ); /* Return value. */
vm_push_type( code_t*, instr );
- vm_push_type( tree_t**, exec->framePtr );
- vm_push_type( long, exec->frameId );
+ vm_push_type( tree_t**, exec->frame_ptr );
+ vm_push_type( long, exec->frame_id );
instr = fr->codeWC;
- exec->frameId = fi->frameId;
+ exec->frame_id = fi->frame_id;
- exec->framePtr = vm_ptop();
- vm_pushn( fr->frameSize );
- memset( vm_ptop(), 0, sizeof(word_t) * fr->frameSize );
+ exec->frame_ptr = vm_ptop();
+ vm_pushn( fr->frame_size );
+ memset( vm_ptop(), 0, sizeof(word_t) * fr->frame_size );
break;
}
case IN_YIELD: {
@@ -3386,23 +3386,23 @@ again:
user_iter_t *uiter = (user_iter_t*) vm_plocal_iframe( IFR_AA );
if ( kid == 0 || kid->tree == 0 ||
- kid->tree->id == uiter->searchId ||
- uiter->searchId == prg->rtd->anyId )
+ kid->tree->id == uiter->search_id ||
+ uiter->search_id == prg->rtd->any_id )
{
/* Store the yeilded value. */
uiter->ref.kid = kid;
uiter->ref.next = next;
- uiter->yieldSize = vm_ssize() - uiter->rootSize;
+ uiter->yield_size = vm_ssize() - uiter->root_size;
uiter->resume = instr;
- uiter->frame = exec->framePtr;
+ uiter->frame = exec->frame_ptr;
/* Restore the instruction and frame pointer. */
instr = (code_t*) vm_local_iframe(IFR_RIN);
- exec->framePtr = (tree_t**) vm_local_iframe(IFR_RFR);
- exec->iframePtr = (tree_t**) vm_local_iframe(IFR_RIF);
+ exec->frame_ptr = (tree_t**) vm_local_iframe(IFR_RFR);
+ exec->iframe_ptr = (tree_t**) vm_local_iframe(IFR_RIF);
/* Return the yield result on the top of the stack. */
- tree_t *result = uiter->ref.kid != 0 ? prg->trueVal : prg->falseVal;
+ tree_t *result = uiter->ref.kid != 0 ? prg->true_val : prg->false_val;
//colm_tree_upref( result );
vm_push_tree( result );
}
@@ -3410,18 +3410,18 @@ again:
}
case IN_UITER_CREATE_WV: {
short field;
- half_t funcId, searchId;
+ half_t func_id, search_id;
read_half( field );
- read_half( funcId );
- read_half( searchId );
+ read_half( func_id );
+ read_half( search_id );
debug( prg, REALM_BYTECODE, "IN_UITER_CREATE_WV\n" );
- struct function_info *fi = prg->rtd->functionInfo + funcId;
+ struct function_info *fi = prg->rtd->function_info + func_id;
- vm_contiguous( (sizeof(user_iter_t) / sizeof(word_t)) + FR_AA + fi->frameSize );
+ vm_contiguous( (sizeof(user_iter_t) / sizeof(word_t)) + FR_AA + fi->frame_size );
- user_iter_t *uiter = colm_uiter_create( prg, &sp, fi, searchId );
+ user_iter_t *uiter = colm_uiter_create( prg, &sp, fi, search_id );
vm_set_local(exec, field, (SW) uiter);
/* This is a setup similar to as a call, only the frame structure
@@ -3429,34 +3429,34 @@ again:
* the call. We don't need to set up the return ip because the
* uiter advance will set it. The frame we need to do because it
* is set once for the lifetime of the iterator. */
- vm_push_type( tree_t**, exec->callArgs );
+ vm_push_type( tree_t**, exec->call_args );
vm_push_value( 0 );
vm_push_type( code_t*, 0 ); /* Return instruction pointer, */
- vm_push_type( tree_t**, exec->iframePtr ); /* Return iframe. */
- vm_push_type( tree_t**, exec->framePtr ); /* Return frame. */
+ vm_push_type( tree_t**, exec->iframe_ptr ); /* Return iframe. */
+ vm_push_type( tree_t**, exec->frame_ptr ); /* Return frame. */
uiter->frame = vm_ptop();
- vm_pushn( fi->frameSize );
- memset( vm_ptop(), 0, sizeof(word_t) * fi->frameSize );
+ vm_pushn( fi->frame_size );
+ memset( vm_ptop(), 0, sizeof(word_t) * fi->frame_size );
- uiterInit( prg, sp, uiter, fi, true );
+ uiter_init( prg, sp, uiter, fi, true );
break;
}
case IN_UITER_CREATE_WC: {
short field;
- half_t funcId, searchId;
+ half_t func_id, search_id;
read_half( field );
- read_half( funcId );
- read_half( searchId );
+ read_half( func_id );
+ read_half( search_id );
debug( prg, REALM_BYTECODE, "IN_UITER_CREATE_WC\n" );
- struct function_info *fi = prg->rtd->functionInfo + funcId;
+ struct function_info *fi = prg->rtd->function_info + func_id;
- vm_contiguous( (sizeof(user_iter_t) / sizeof(word_t)) + FR_AA + fi->frameSize );
+ vm_contiguous( (sizeof(user_iter_t) / sizeof(word_t)) + FR_AA + fi->frame_size );
- user_iter_t *uiter = colm_uiter_create( prg, &sp, fi, searchId );
+ user_iter_t *uiter = colm_uiter_create( prg, &sp, fi, search_id );
vm_set_local(exec, field, (SW) uiter);
/* This is a setup similar to as a call, only the frame structure
@@ -3464,18 +3464,18 @@ again:
* the call. We don't need to set up the return ip because the
* uiter advance will set it. The frame we need to do because it
* is set once for the lifetime of the iterator. */
- vm_push_type( tree_t**, exec->callArgs );
+ vm_push_type( tree_t**, exec->call_args );
vm_push_value( 0 );
vm_push_type( code_t*, 0 ); /* Return instruction pointer, */
- vm_push_type( tree_t**, exec->iframePtr ); /* Return iframe. */
- vm_push_type( tree_t**, exec->framePtr ); /* Return frame. */
+ vm_push_type( tree_t**, exec->iframe_ptr ); /* Return iframe. */
+ vm_push_type( tree_t**, exec->frame_ptr ); /* Return frame. */
uiter->frame = vm_ptop();
- vm_pushn( fi->frameSize );
- memset( vm_ptop(), 0, sizeof(word_t) * fi->frameSize );
+ vm_pushn( fi->frame_size );
+ memset( vm_ptop(), 0, sizeof(word_t) * fi->frame_size );
- uiterInit( prg, sp, uiter, fi, false );
+ uiter_init( prg, sp, uiter, fi, false );
break;
}
case IN_UITER_DESTROY: {
@@ -3501,18 +3501,18 @@ again:
}
case IN_RET: {
- struct frame_info *fi = &prg->rtd->frameInfo[exec->frameId];
- downref_local_trees( prg, sp, exec, fi->locals, fi->localsLen );
- vm_popn( fi->frameSize );
+ struct frame_info *fi = &prg->rtd->frame_info[exec->frame_id];
+ downref_local_trees( prg, sp, exec, fi->locals, fi->locals_len );
+ vm_popn( fi->frame_size );
- exec->frameId = vm_pop_type(long);
- exec->framePtr = vm_pop_type(tree_t**);
+ exec->frame_id = vm_pop_type(long);
+ exec->frame_ptr = vm_pop_type(tree_t**);
instr = vm_pop_type(code_t*);
- exec->retVal = vm_pop_tree();
+ exec->ret_val = vm_pop_tree();
vm_pop_value();
//vm_popn( fi->argSize );
- fi = &prg->rtd->frameInfo[exec->frameId];
+ fi = &prg->rtd->frame_info[exec->frame_id];
debug( prg, REALM_BYTECODE, "IN_RET %s\n", fi->name );
/* This if for direct calls of functions. */
@@ -3538,8 +3538,8 @@ again:
debug( prg, REALM_BYTECODE, "IN_TO_UPPER\n" );
tree_t *in = vm_pop_tree();
- head_t *head = stringToUpper( in->tokdata );
- tree_t *upper = constructString( prg, head );
+ head_t *head = string_to_upper( in->tokdata );
+ tree_t *upper = construct_string( prg, head );
colm_tree_upref( upper );
vm_push_tree( upper );
colm_tree_downref( prg, sp, in );
@@ -3549,8 +3549,8 @@ again:
debug( prg, REALM_BYTECODE, "IN_TO_LOWER\n" );
tree_t *in = vm_pop_tree();
- head_t *head = stringToLower( in->tokdata );
- tree_t *lower = constructString( prg, head );
+ head_t *head = string_to_lower( in->tokdata );
+ tree_t *lower = construct_string( prg, head );
colm_tree_upref( lower );
vm_push_tree( lower );
colm_tree_downref( prg, sp, in );
@@ -3572,10 +3572,10 @@ again:
/* Pop the root object. */
vm_pop_tree();
- if ( prg->stdinVal == 0 )
- prg->stdinVal = colm_stream_open_fd( prg, "<stdin>", 0 );
+ if ( prg->stdin_val == 0 )
+ prg->stdin_val = colm_stream_open_fd( prg, "<stdin>", 0 );
- vm_push_stream( prg->stdinVal );
+ vm_push_stream( prg->stdin_val );
break;
}
case IN_GET_STDOUT: {
@@ -3583,10 +3583,10 @@ again:
/* Pop the root object. */
vm_pop_tree();
- if ( prg->stdoutVal == 0 )
- prg->stdoutVal = colm_stream_open_fd( prg, "<stdout>", 1 );
+ if ( prg->stdout_val == 0 )
+ prg->stdout_val = colm_stream_open_fd( prg, "<stdout>", 1 );
- vm_push_stream( prg->stdoutVal );
+ vm_push_stream( prg->stdout_val );
break;
}
case IN_GET_STDERR: {
@@ -3594,10 +3594,10 @@ again:
/* Pop the root object. */
vm_pop_tree();
- if ( prg->stderrVal == 0 )
- prg->stderrVal = colm_stream_open_fd( prg, "<stderr>", 2 );
+ if ( prg->stderr_val == 0 )
+ prg->stderr_val = colm_stream_open_fd( prg, "<stderr>", 2 );
- vm_push_stream( prg->stderrVal );
+ vm_push_stream( prg->stderr_val );
break;
}
case IN_SYSTEM: {
@@ -3633,7 +3633,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_STR_ATOI\n" );
str_t *str = vm_pop_string();
- word_t res = strAtoi( str->value );
+ word_t res = str_atoi( str->value );
value_t integer = res;
vm_push_value( integer );
colm_tree_downref( prg, sp, (tree_t*)str );
@@ -3643,7 +3643,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_STR_ATOO\n" );
str_t *str = vm_pop_string();
- word_t res = strAtoo( str->value );
+ word_t res = str_atoo( str->value );
value_t integer = res;
vm_push_value( integer );
colm_tree_downref( prg, sp, (tree_t*)str );
@@ -3653,7 +3653,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_STR_UORD8\n" );
str_t *str = vm_pop_string();
- word_t res = strUord8( str->value );
+ word_t res = str_uord8( str->value );
value_t integer = res;
vm_push_value( integer );
colm_tree_downref( prg, sp, (tree_t*)str );
@@ -3663,7 +3663,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_STR_UORD16\n" );
str_t *str = vm_pop_string();
- word_t res = strUord16( str->value );
+ word_t res = str_uord16( str->value );
value_t integer = res;
vm_push_value( integer );
colm_tree_downref( prg, sp, (tree_t*)str );
@@ -3746,35 +3746,35 @@ again:
}
case IN_LIST_PUSH_HEAD_WC: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
debug( prg, REALM_BYTECODE, "IN_LIST_PUSH_HEAD_WC\n" );
list_t *list = vm_pop_list();
struct_t *s = vm_pop_struct();
- list_el_t *listEl = colm_struct_to_list_el( prg, s, genId );
- colm_list_prepend( list, listEl );
+ list_el_t *list_el = colm_struct_to_list_el( prg, s, gen_id );
+ colm_list_prepend( list, list_el );
//colm_tree_upref( prg->trueVal );
- vm_push_tree( prg->trueVal );
+ vm_push_tree( prg->true_val );
break;
}
case IN_LIST_PUSH_HEAD_WV: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
debug( prg, REALM_BYTECODE, "IN_LIST_PUSH_HEAD_WV\n" );
list_t *list = vm_pop_list();
struct_t *s = vm_pop_struct();
- list_el_t *listEl = colm_struct_to_list_el( prg, s, genId );
- colm_list_prepend( list, listEl );
+ list_el_t *list_el = colm_struct_to_list_el( prg, s, gen_id );
+ colm_list_prepend( list, list_el );
//colm_tree_upref( prg->trueVal );
- vm_push_tree( prg->trueVal );
+ vm_push_tree( prg->true_val );
/* Set up reverse code. Needs no args. */
rcode_code( exec, IN_FN );
@@ -3790,35 +3790,35 @@ again:
break;
}
case IN_LIST_PUSH_TAIL_WC: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
debug( prg, REALM_BYTECODE, "IN_LIST_PUSH_TAIL_WC\n" );
list_t *list = vm_pop_list();
struct_t *s = vm_pop_struct();
- list_el_t *listEl = colm_struct_to_list_el( prg, s, genId );
- colm_list_append( list, listEl );
+ list_el_t *list_el = colm_struct_to_list_el( prg, s, gen_id );
+ colm_list_append( list, list_el );
//colm_tree_upref( prg->trueVal );
- vm_push_tree( prg->trueVal );
+ vm_push_tree( prg->true_val );
break;
}
case IN_LIST_PUSH_TAIL_WV: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
debug( prg, REALM_BYTECODE, "IN_LIST_PUSH_TAIL_WV\n" );
list_t *list = vm_pop_list();
struct_t *s = vm_pop_struct();
- list_el_t *listEl = colm_struct_to_list_el( prg, s, genId );
- colm_list_append( list, listEl );
+ list_el_t *list_el = colm_struct_to_list_el( prg, s, gen_id );
+ colm_list_append( list, list_el );
//colm_tree_upref( prg->trueVal );
- vm_push_tree( prg->trueVal );
+ vm_push_tree( prg->true_val );
/* Set up reverse code. Needs no args. */
rcode_code( exec, IN_FN );
@@ -3834,8 +3834,8 @@ again:
break;
}
case IN_LIST_POP_TAIL_WC: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
debug( prg, REALM_BYTECODE, "IN_LIST_POP_TAIL_WC\n" );
@@ -3843,14 +3843,14 @@ again:
list_el_t *tail = list->tail;
colm_list_detach_tail( list );
- struct_t *s = colm_generic_el_container( prg, tail, genId );
+ struct_t *s = colm_generic_el_container( prg, tail, gen_id );
vm_push_struct( s );
break;
}
case IN_LIST_POP_TAIL_WV: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
debug( prg, REALM_BYTECODE, "IN_LIST_POP_TAIL_WV\n" );
@@ -3858,7 +3858,7 @@ again:
list_el_t *tail = list->tail;
colm_list_detach_tail( list );
- struct_t *s = colm_generic_el_container( prg, tail, genId );
+ struct_t *s = colm_generic_el_container( prg, tail, gen_id );
vm_push_struct( s );
@@ -3866,15 +3866,15 @@ again:
* Need it up referenced for the reverse code too. */
rcode_code( exec, IN_FN );
rcode_code( exec, IN_LIST_POP_TAIL_BKT );
- rcodeHalf( exec, genId );
+ rcode_half( exec, gen_id );
rcode_word( exec, (word_t)s );
rcode_unit_term( exec );
break;
}
case IN_LIST_POP_TAIL_BKT: {
- short genId;
+ short gen_id;
tree_t *val;
- read_half( genId );
+ read_half( gen_id );
read_tree( val );
debug( prg, REALM_BYTECODE, "IN_LIST_POP_TAIL_BKT\n" );
@@ -3882,14 +3882,14 @@ again:
list_t *list = vm_pop_list();
struct_t *s = (struct_t*) val;
- list_el_t *listEl = colm_struct_to_list_el( prg, s, genId );
+ list_el_t *list_el = colm_struct_to_list_el( prg, s, gen_id );
- colm_list_append( list, listEl );
+ colm_list_append( list, list_el );
break;
}
case IN_LIST_POP_HEAD_WC: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
debug( prg, REALM_BYTECODE, "IN_LIST_POP_HEAD_WC\n" );
@@ -3897,14 +3897,14 @@ again:
list_el_t *head = list->head;
colm_list_detach_head( list );
- struct_t *s = colm_generic_el_container( prg, head, genId );
+ struct_t *s = colm_generic_el_container( prg, head, gen_id );
vm_push_struct( s );
break;
}
case IN_LIST_POP_HEAD_WV: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
debug( prg, REALM_BYTECODE, "IN_LIST_POP_HEAD_WV\n" );
@@ -3912,7 +3912,7 @@ again:
list_el_t *head = list->head;
colm_list_detach_head( list );
- struct_t *s = colm_generic_el_container( prg, head, genId );
+ struct_t *s = colm_generic_el_container( prg, head, gen_id );
vm_push_struct( s );
@@ -3920,15 +3920,15 @@ again:
* Need it up referenced for the reverse code too. */
rcode_code( exec, IN_FN );
rcode_code( exec, IN_LIST_POP_HEAD_BKT );
- rcodeHalf( exec, genId );
+ rcode_half( exec, gen_id );
rcode_word( exec, (word_t)s );
rcode_unit_term( exec );
break;
}
case IN_LIST_POP_HEAD_BKT: {
- short genId;
+ short gen_id;
tree_t *val;
- read_half( genId );
+ read_half( gen_id );
read_tree( val );
debug( prg, REALM_BYTECODE, "IN_LIST_POP_HEAD_BKT\n" );
@@ -3936,83 +3936,83 @@ again:
list_t *list = vm_pop_list();
struct_t *s = (struct_t*) val;
- list_el_t *listEl = colm_struct_to_list_el( prg, s, genId );
+ list_el_t *list_el = colm_struct_to_list_el( prg, s, gen_id );
- colm_list_prepend( list, listEl );
+ colm_list_prepend( list, list_el );
break;
}
case IN_MAP_FIND: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
- debug( prg, REALM_BYTECODE, "IN_MAP_FIND %hd\n", genId );
+ debug( prg, REALM_BYTECODE, "IN_MAP_FIND %hd\n", gen_id );
map_t *map = vm_pop_map();
tree_t *key = vm_pop_tree();
- map_el_t *mapEl = colm_map_find( prg, map, key );
+ map_el_t *map_el = colm_map_find( prg, map, key );
- struct colm_struct *strct = mapEl != 0 ?
- colm_generic_el_container( prg, mapEl, genId ) : 0;
+ struct colm_struct *strct = map_el != 0 ?
+ colm_generic_el_container( prg, map_el, gen_id ) : 0;
vm_push_struct( strct );
- if ( map->genericInfo->keyType == TYPE_TREE )
+ if ( map->generic_info->key_type == TYPE_TREE )
colm_tree_downref( prg, sp, key );
break;
}
case IN_MAP_INSERT_WC: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
- debug( prg, REALM_BYTECODE, "IN_MAP_INSERT_WC %hd\n", genId );
+ debug( prg, REALM_BYTECODE, "IN_MAP_INSERT_WC %hd\n", gen_id );
map_t *map = vm_pop_map();
struct_t *s = vm_pop_struct();
- map_el_t *mapEl = colm_struct_to_map_el( prg, s, genId );
+ map_el_t *map_el = colm_struct_to_map_el( prg, s, gen_id );
- colm_map_insert( prg, map, mapEl );
+ colm_map_insert( prg, map, map_el );
//colm_tree_upref( prg->trueVal );
- vm_push_tree( prg->trueVal );
+ vm_push_tree( prg->true_val );
break;
}
case IN_MAP_INSERT_WV: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
- debug( prg, REALM_BYTECODE, "IN_MAP_INSERT_WV %hd\n", genId );
+ debug( prg, REALM_BYTECODE, "IN_MAP_INSERT_WV %hd\n", gen_id );
map_t *map = vm_pop_map();
struct_t *s = vm_pop_struct();
- map_el_t *mapEl = colm_struct_to_map_el( prg, s, genId );
+ map_el_t *map_el = colm_struct_to_map_el( prg, s, gen_id );
- map_el_t *inserted = colm_map_insert( prg, map, mapEl );
+ map_el_t *inserted = colm_map_insert( prg, map, map_el );
//colm_tree_upref( prg->trueVal );
- vm_push_tree( prg->trueVal );
+ vm_push_tree( prg->true_val );
rcode_code( exec, IN_FN );
rcode_code( exec, IN_MAP_INSERT_BKT );
- rcodeHalf( exec, genId );
+ rcode_half( exec, gen_id );
rcode_code( exec, inserted != 0 ? 1 : 0 );
- rcode_word( exec, (word_t)mapEl );
+ rcode_word( exec, (word_t)map_el );
rcode_unit_term( exec );
break;
}
case IN_MAP_INSERT_BKT: {
- short genId;
+ short gen_id;
uchar inserted;
- word_t wmapEl;
+ word_t wmap_el;
- read_half( genId );
+ read_half( gen_id );
read_byte( inserted );
- read_word( wmapEl );
+ read_word( wmap_el );
- map_el_t *mapEl = (map_el_t*)wmapEl;
+ map_el_t *map_el = (map_el_t*)wmap_el;
debug( prg, REALM_BYTECODE, "IN_MAP_INSERT_BKT %d\n",
(int)inserted );
@@ -4020,24 +4020,24 @@ again:
map_t *map = vm_pop_map();
if ( inserted )
- colm_map_detach( prg, map, mapEl );
+ colm_map_detach( prg, map, map_el );
break;
}
case IN_MAP_DETACH_WC: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
- debug( prg, REALM_BYTECODE, "IN_MAP_DETACH_WC %hd\n", genId );
+ debug( prg, REALM_BYTECODE, "IN_MAP_DETACH_WC %hd\n", gen_id );
map_t *map = vm_pop_map();
struct_t *s = vm_pop_struct();
- map_el_t *mapEl = colm_struct_to_map_el( prg, s, genId );
+ map_el_t *map_el = colm_struct_to_map_el( prg, s, gen_id );
- colm_map_detach( prg, map, mapEl );
+ colm_map_detach( prg, map, map_el );
//colm_tree_upref( prg->trueVal );
- vm_push_tree( prg->trueVal );
+ vm_push_tree( prg->true_val );
break;
}
case IN_MAP_DETACH_WV: {
@@ -4045,7 +4045,7 @@ again:
tree_t *obj = vm_pop_tree();
tree_t *key = vm_pop_tree();
- struct tree_pair pair = mapRemove( prg, (map_t*)obj, key );
+ struct tree_pair pair = map_remove( prg, (map_t*)obj, key );
colm_tree_upref( pair.val );
vm_push_tree( pair.val );
@@ -4074,17 +4074,17 @@ again:
tree_t *obj = vm_pop_tree();
#if 0
if ( key != 0 )
- mapUnremove( prg, (map_t*)obj, key, val );
+ map_unremove( prg, (map_t*)obj, key, val );
#endif
colm_tree_downref( prg, sp, obj );
break;
}
case IN_VMAP_INSERT_WC: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
- debug( prg, REALM_BYTECODE, "IN_VMAP_INSERT_WC %hd\n", genId );
+ debug( prg, REALM_BYTECODE, "IN_VMAP_INSERT_WC %hd\n", gen_id );
map_t *map = vm_pop_map();
struct_t *value = vm_pop_struct();
@@ -4093,14 +4093,14 @@ again:
colm_vmap_insert( prg, map, key, value );
//colm_tree_upref( prg->trueVal );
- vm_push_tree( prg->trueVal );
+ vm_push_tree( prg->true_val );
break;
}
case IN_VMAP_REMOVE_WC: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
- debug( prg, REALM_BYTECODE, "IN_VMAP_REMOVE_WC %hd\n", genId );
+ debug( prg, REALM_BYTECODE, "IN_VMAP_REMOVE_WC %hd\n", gen_id );
map_t *map = vm_pop_map();
tree_t *key = vm_pop_tree();
@@ -4108,14 +4108,14 @@ again:
colm_vmap_remove( prg, map, key );
//colm_tree_upref( prg->trueVal );
- vm_push_tree( prg->trueVal );
+ vm_push_tree( prg->true_val );
break;
}
case IN_VMAP_FIND: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
- debug( prg, REALM_BYTECODE, "IN_VMAP_FIND %hd\n", genId );
+ debug( prg, REALM_BYTECODE, "IN_VMAP_FIND %hd\n", gen_id );
map_t *map = vm_pop_map();
tree_t *key = vm_pop_tree();
@@ -4124,43 +4124,43 @@ again:
vm_push_tree( result );
- if ( map->genericInfo->keyType == TYPE_TREE )
+ if ( map->generic_info->key_type == TYPE_TREE )
colm_tree_downref( prg, sp, key );
break;
}
case IN_VLIST_PUSH_TAIL_WC: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
- debug( prg, REALM_BYTECODE, "IN_VLIST_PUSH_TAIL_WC %hd\n", genId );
+ debug( prg, REALM_BYTECODE, "IN_VLIST_PUSH_TAIL_WC %hd\n", gen_id );
list_t *list = vm_pop_list();
value_t value = vm_pop_value();
colm_vlist_append( prg, list, value );
- vm_push_tree( prg->trueVal );
+ vm_push_tree( prg->true_val );
break;
}
case IN_VLIST_PUSH_HEAD_WC: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
- debug( prg, REALM_BYTECODE, "IN_VLIST_PUSH_HEAD_WC %hd\n", genId );
+ debug( prg, REALM_BYTECODE, "IN_VLIST_PUSH_HEAD_WC %hd\n", gen_id );
list_t *list = vm_pop_list();
value_t value = vm_pop_value();
colm_vlist_prepend( prg, list, value );
- vm_push_tree( prg->trueVal );
+ vm_push_tree( prg->true_val );
break;
}
case IN_VLIST_POP_HEAD_WC: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
- debug( prg, REALM_BYTECODE, "IN_VLIST_POP_HEAD_WC %hd\n", genId );
+ debug( prg, REALM_BYTECODE, "IN_VLIST_POP_HEAD_WC %hd\n", gen_id );
list_t *list = vm_pop_list();
@@ -4169,10 +4169,10 @@ again:
break;
}
case IN_VLIST_POP_TAIL_WC: {
- short genId;
- read_half( genId );
+ short gen_id;
+ read_half( gen_id );
- debug( prg, REALM_BYTECODE, "IN_VLIST_POP_TAIL_WC %hd\n", genId );
+ debug( prg, REALM_BYTECODE, "IN_VLIST_POP_TAIL_WC %hd\n", gen_id );
list_t *list = vm_pop_list();
@@ -4185,9 +4185,9 @@ again:
debug( prg, REALM_BYTECODE, "IN_EXIT\n" );
vm_pop_tree();
- prg->exitStatus = vm_pop_type(long);
- prg->induceExit = 1;
- exit( prg->exitStatus );
+ prg->exit_status = vm_pop_type(long);
+ prg->induce_exit = 1;
+ exit( prg->exit_status );
}
case IN_EXIT: {
/* The unwind code follows the exit call (exception, see
@@ -4198,43 +4198,43 @@ again:
debug( prg, REALM_BYTECODE, "IN_EXIT, unwind len: %hd\n", unwind_len );
vm_pop_tree();
- prg->exitStatus = vm_pop_type(long);
- prg->induceExit = 1;
+ prg->exit_status = vm_pop_type(long);
+ prg->induce_exit = 1;
while ( true ) {
/* We stop on the root, leaving the psuedo-call setup on the
* stack. Note we exclude the local data. */
- if ( exec->frameId == prg->rtd->rootFrameId )
+ if ( exec->frame_id == prg->rtd->root_frame_id )
break;
- struct frame_info *fi = &prg->rtd->frameInfo[exec->frameId];
+ struct frame_info *fi = &prg->rtd->frame_info[exec->frame_id];
debug( prg, REALM_BYTECODE, "IN_EXIT, popping frame %s, "
"unwind-len %hd, arg-size %ld\n",
( fi->name != 0 ? fi->name : "<no-name>" ),
- unwind_len, fi->argSize );
+ unwind_len, fi->arg_size );
if ( unwind_len > 0 )
sp = colm_execute_code( prg, exec, sp, instr );
- downref_locals( prg, &sp, exec, fi->locals, fi->localsLen );
- vm_popn( fi->frameSize );
+ downref_locals( prg, &sp, exec, fi->locals, fi->locals_len );
+ vm_popn( fi->frame_size );
/* Call layout. */
- exec->frameId = vm_pop_type(long);
- exec->framePtr = vm_pop_type(tree_t**);
+ exec->frame_id = vm_pop_type(long);
+ exec->frame_ptr = vm_pop_type(tree_t**);
instr = vm_pop_type(code_t*);
- tree_t *retVal = vm_pop_tree();
+ tree_t *ret_val = vm_pop_tree();
vm_pop_value();
/* The IN_PREP_ARGS stack data. */
- vm_popn( fi->argSize );
+ vm_popn( fi->arg_size );
vm_pop_value();
- if ( fi->retTree ) {
+ if ( fi->ret_tree ) {
/* Problem here. */
- colm_tree_downref( prg, sp, retVal );
+ colm_tree_downref( prg, sp, ret_val );
}
read_half( unwind_len );
@@ -4269,7 +4269,7 @@ again:
goto again;
out:
- if ( ! prg->induceExit )
+ if ( ! prg->induce_exit )
assert( sp == root );
return sp;
}
@@ -4316,8 +4316,8 @@ again:
}
case IN_PARSE_FRAG_BKT: {
- half_t stopId;
- read_half( stopId );
+ half_t stop_id;
+ read_half( stop_id );
debug( prg, REALM_BYTECODE, "IN_PARSE_FRAG_BKT\n" );
break;
}
@@ -4326,8 +4326,8 @@ again:
break;
}
case IN_PARSE_FINISH_BKT: {
- half_t stopId;
- read_half( stopId );
+ half_t stop_id;
+ read_half( stop_id );
debug( prg, REALM_BYTECODE, "IN_PARSE_FINISH_BKT\n" );
break;
}
@@ -4446,7 +4446,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_SET_TOKEN_DATA_BKT\n" );
head_t *head = (head_t*)oldval;
- stringFree( prg, head );
+ string_free( prg, head );
break;
}
case IN_GET_LIST_MEM_BKT: {
diff --git a/src/bytecode.h b/src/bytecode.h
index c92e6cb6..af03db77 100644
--- a/src/bytecode.h
+++ b/src/bytecode.h
@@ -557,8 +557,8 @@ enum LEL_ID {
#define vm_ssize() ( prg->sb_total + (prg->sb_end - sp) )
-#define vm_local_iframe(o) (exec->iframePtr[o])
-#define vm_plocal_iframe(o) (&exec->iframePtr[o])
+#define vm_local_iframe(o) (exec->iframe_ptr[o])
+#define vm_plocal_iframe(o) (&exec->iframe_ptr[o])
void vm_init( struct colm_program * );
tree_t** vm_bs_add( struct colm_program *, tree_t **, int );
@@ -576,17 +576,17 @@ typedef tree_t **StackPtr;
typedef struct colm_execution
{
- tree_t **framePtr;
- tree_t **iframePtr;
- long frameId;
- tree_t **callArgs;
+ tree_t **frame_ptr;
+ tree_t **iframe_ptr;
+ long frame_id;
+ tree_t **call_args;
- long rcodeUnitLen;
+ long rcode_unit_len;
parser_t *parser;
long steps;
long pcr;
- tree_t *retVal;
+ tree_t *ret_val;
} Execution;
struct colm_execution;
@@ -594,77 +594,77 @@ struct colm_execution;
static inline tree_t **vm_get_plocal( struct colm_execution *exec, int o )
{
if ( o >= FR_AA ) {
- tree_t **callArgs = (tree_t**)exec->framePtr[FR_CA];
- return &callArgs[o - FR_AA];
+ tree_t **call_args = (tree_t**)exec->frame_ptr[FR_CA];
+ return &call_args[o - FR_AA];
}
else {
- return &exec->framePtr[o];
+ return &exec->frame_ptr[o];
}
}
static inline tree_t *vm_get_local( struct colm_execution *exec, int o )
{
if ( o >= FR_AA ) {
- tree_t **callArgs = (tree_t**)exec->framePtr[FR_CA];
- return callArgs[o - FR_AA];
+ tree_t **call_args = (tree_t**)exec->frame_ptr[FR_CA];
+ return call_args[o - FR_AA];
}
else {
- return exec->framePtr[o];
+ return exec->frame_ptr[o];
}
}
static inline void vm_set_local( struct colm_execution *exec, int o, tree_t* v )
{
if ( o >= FR_AA ) {
- tree_t **callArgs = (tree_t**)exec->framePtr[FR_CA];
- callArgs[o - FR_AA] = v;
+ tree_t **call_args = (tree_t**)exec->frame_ptr[FR_CA];
+ call_args[o - FR_AA] = v;
}
else {
- exec->framePtr[o] = v;
+ exec->frame_ptr[o] = v;
}
}
-long stringLength( head_t *str );
-const char *stringData( head_t *str );
-head_t *initStrSpace( long length );
-head_t *stringCopy( struct colm_program *prg, head_t *head );
-void stringFree( struct colm_program *prg, head_t *head );
-void stringShorten( head_t *tokdata, long newlen );
-head_t *concatStr( head_t *s1, head_t *s2 );
-word_t strAtoi( head_t *str );
-word_t strAtoo( head_t *str );
-word_t strUord16( head_t *head );
-word_t strUord8( head_t *head );
-word_t cmpString( head_t *s1, head_t *s2 );
-head_t *stringToUpper( head_t *s );
-head_t *stringToLower( head_t *s );
-head_t *stringSprintf( program_t *prg, str_t *format, long integer );
-
-head_t *makeLiteral( struct colm_program *prg, long litoffset );
-head_t *intToStr( struct colm_program *prg, word_t i );
+long string_length( head_t *str );
+const char *string_data( head_t *str );
+head_t *init_str_space( long length );
+head_t *string_copy( struct colm_program *prg, head_t *head );
+void string_free( struct colm_program *prg, head_t *head );
+void string_shorten( head_t *tokdata, long newlen );
+head_t *concat_str( head_t *s1, head_t *s2 );
+word_t str_atoi( head_t *str );
+word_t str_atoo( head_t *str );
+word_t str_uord16( head_t *head );
+word_t str_uord8( head_t *head );
+word_t cmp_string( head_t *s1, head_t *s2 );
+head_t *string_to_upper( head_t *s );
+head_t *string_to_lower( head_t *s );
+head_t *string_sprintf( program_t *prg, str_t *format, long integer );
+
+head_t *make_literal( struct colm_program *prg, long litoffset );
+head_t *int_to_str( struct colm_program *prg, word_t i );
void colm_execute( struct colm_program *prg, Execution *exec, code_t *code );
-void reductionExecution( Execution *exec, tree_t **sp );
-void generationExecution( Execution *exec, tree_t **sp );
-void reverseExecution( Execution *exec, tree_t **sp, struct rt_code_vect *allRev );
+void reduction_execution( Execution *exec, tree_t **sp );
+void generation_execution( Execution *exec, tree_t **sp );
+void reverse_execution( Execution *exec, tree_t **sp, struct rt_code_vect *all_rev );
-kid_t *allocAttrs( struct colm_program *prg, long length );
-void freeAttrs( struct colm_program *prg, kid_t *attrs );
-kid_t *getAttrKid( tree_t *tree, long pos );
+kid_t *alloc_attrs( struct colm_program *prg, long length );
+void free_attrs( struct colm_program *prg, kid_t *attrs );
+kid_t *get_attr_kid( tree_t *tree, long pos );
-tree_t *splitTree( struct colm_program *prg, tree_t *t );
+tree_t *split_tree( struct colm_program *prg, tree_t *t );
void colm_rcode_downref_all( struct colm_program *prg, tree_t **sp, struct rt_code_vect *cv );
-int colm_make_reverse_code( struct pda_run *pdaRun );
-void colm_transfer_reverse_code( struct pda_run *pdaRun, parse_tree_t *tree );
+int colm_make_reverse_code( struct pda_run *pda_run );
+void colm_transfer_reverse_code( struct pda_run *pda_run, parse_tree_t *tree );
-void splitRef( struct colm_program *prg, tree_t ***sp, ref_t *fromRef );
+void split_ref( struct colm_program *prg, tree_t ***sp, ref_t *from_ref );
-void allocGlobal( struct colm_program *prg );
+void alloc_global( struct colm_program *prg );
tree_t **colm_execute_code( struct colm_program *prg,
Execution *exec, tree_t **sp, code_t *instr );
-code_t *colm_pop_reverse_code( struct rt_code_vect *allRev );
+code_t *colm_pop_reverse_code( struct rt_code_vect *all_rev );
#ifdef __cplusplus
}
diff --git a/src/codevect.c b/src/codevect.c
index 1b037977..9f968f73 100644
--- a/src/codevect.c
+++ b/src/codevect.c
@@ -27,42 +27,42 @@
#include <assert.h>
-void initRtCodeVect( struct rt_code_vect *vect )
+void init_rt_code_vect( struct rt_code_vect *vect )
{
vect->data = 0;
- vect->tabLen = 0;
- vect->allocLen = 0;
+ vect->tab_len = 0;
+ vect->alloc_len = 0;
}
-static long newSizeUp( long existing, long needed )
+static long new_size_up( long existing, long needed )
{
return needed > existing ? (needed<<1) : existing;
}
-static long newSizeDown( long existing, long needed )
+static long new_size_down( long existing, long needed )
{
return needed < (existing>>2) ? (needed<<1) : existing;
}
/* Up resize the data for len elements using Resize::upResize to tell us the
* new tabLen. Reads and writes allocLen. Does not read or write tabLen. */
-static void upResize( struct rt_code_vect *vect, long len )
+static void up_resize( struct rt_code_vect *vect, long len )
{
/* Ask the resizer what the new tabLen will be. */
- long newLen = newSizeUp(vect->allocLen, len);
+ long new_len = new_size_up(vect->alloc_len, len);
/* Did the data grow? */
- if ( newLen > vect->allocLen ) {
- vect->allocLen = newLen;
+ if ( new_len > vect->alloc_len ) {
+ vect->alloc_len = new_len;
if ( vect->data != 0 ) {
/* Table exists already, resize it up. */
- vect->data = (code_t*) realloc( vect->data, sizeof(code_t) * newLen );
+ vect->data = (code_t*) realloc( vect->data, sizeof(code_t) * new_len );
//if ( vect->data == 0 )
// throw std::bad_alloc();
}
else {
/* Create the data. */
- vect->data = (code_t*) malloc( sizeof(code_t) * newLen );
+ vect->data = (code_t*) malloc( sizeof(code_t) * new_len );
//if ( vect->data == 0 )
// throw std::bad_alloc();
}
@@ -71,22 +71,22 @@ static void upResize( struct rt_code_vect *vect, long len )
/* Down resize the data for len elements using Resize::downResize to determine
* the new tabLen. Reads and writes allocLen. Does not read or write tabLen. */
-static void downResize( struct rt_code_vect *vect, long len)
+static void down_resize( struct rt_code_vect *vect, long len)
{
/* Ask the resizer what the new tabLen will be. */
- long newLen = newSizeDown( vect->allocLen, len );
+ long new_len = new_size_down( vect->alloc_len, len );
/* Did the data shrink? */
- if ( newLen < vect->allocLen ) {
- vect->allocLen = newLen;
- if ( newLen == 0 ) {
+ if ( new_len < vect->alloc_len ) {
+ vect->alloc_len = new_len;
+ if ( new_len == 0 ) {
/* Simply free the data. */
free( vect->data );
vect->data = 0;
}
else {
/* Not shrinking to size zero, realloc it to the smaller size. */
- vect->data = (code_t*) realloc( vect->data, sizeof(code_t) * newLen );
+ vect->data = (code_t*) realloc( vect->data, sizeof(code_t) * new_len );
//if ( vect->data == 0 )
// throw std::bad_alloc();
}
@@ -100,28 +100,28 @@ void colm_rt_code_vect_empty( struct rt_code_vect *vect )
/* Free the data space. */
free( vect->data );
vect->data = 0;
- vect->tabLen = vect->allocLen = 0;
+ vect->tab_len = vect->alloc_len = 0;
}
}
void colm_rt_code_vect_replace( struct rt_code_vect *vect, long pos,
const code_t *val, long len )
{
- long endPos, i;
+ long end_pos, i;
//code_t *item;
/* If we are given a negative position to replace at then
* treat it as a position relative to the length. */
if ( pos < 0 )
- pos = vect->tabLen + pos;
+ pos = vect->tab_len + pos;
/* The end is the one past the last item that we want
* to write to. */
- endPos = pos + len;
+ end_pos = pos + len;
/* Make sure we have enough space. */
- if ( endPos > vect->tabLen ) {
- upResize( vect, endPos );
+ if ( end_pos > vect->tab_len ) {
+ up_resize( vect, end_pos );
/* Delete any objects we need to delete. */
//item = vect->data + pos;
@@ -129,7 +129,7 @@ void colm_rt_code_vect_replace( struct rt_code_vect *vect, long pos,
// item->~code_t();
/* We are extending the vector, set the new data length. */
- vect->tabLen = endPos;
+ vect->tab_len = end_pos;
}
else {
/* Delete any objects we need to delete. */
@@ -147,19 +147,19 @@ void colm_rt_code_vect_replace( struct rt_code_vect *vect, long pos,
void colm_rt_code_vect_remove( struct rt_code_vect *vect, long pos, long len )
{
- long newLen, lenToSlideOver, endPos;
+ long new_len, len_to_slide_over, end_pos;
code_t *dst;//, *item;
/* If we are given a negative position to remove at then
* treat it as a position relative to the length. */
if ( pos < 0 )
- pos = vect->tabLen + pos;
+ pos = vect->tab_len + pos;
/* The first position after the last item deleted. */
- endPos = pos + len;
+ end_pos = pos + len;
/* The new data length. */
- newLen = vect->tabLen - len;
+ new_len = vect->tab_len - len;
/* The place in the data we are deleting at. */
dst = vect->data + pos;
@@ -170,15 +170,15 @@ void colm_rt_code_vect_remove( struct rt_code_vect *vect, long pos, long len )
// item->~code_t();
/* Shift data over if necessary. */
- lenToSlideOver = vect->tabLen - endPos;
- if ( len > 0 && lenToSlideOver > 0 )
- memmove(dst, dst + len, sizeof(code_t)*lenToSlideOver);
+ len_to_slide_over = vect->tab_len - end_pos;
+ if ( len > 0 && len_to_slide_over > 0 )
+ memmove(dst, dst + len, sizeof(code_t)*len_to_slide_over);
/* Shrink the data if necessary. */
- downResize( vect, newLen );
+ down_resize( vect, new_len );
/* Set the new data length. */
- vect->tabLen = newLen;
+ vect->tab_len = new_len;
}
diff --git a/src/compiler.cc b/src/compiler.cc
index 085bcf07..4fac52ff 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -989,18 +989,18 @@ pda_run *Compiler::parsePattern( program_t *prg, tree_t **sp, const InputLoc &lo
stream_t *stream = colm_stream_new_struct( prg );
stream->impl = sourceStream;
- in->funcs->appendStream( in, (tree_t*)stream );
- in->funcs->setEof( in );
+ in->funcs->append_stream( in, (tree_t*)stream );
+ in->funcs->set_eof( in );
long pcr = colm_parse_loop( prg, sp, pdaRun, in, PCR_START );
assert( pcr == PCR_DONE );
- if ( pdaRun->parseError ) {
+ if ( pdaRun->parse_error ) {
cerr << ( loc.fileName != 0 ? loc.fileName : "<input>" ) <<
":" << loc.line << ":" << loc.col;
- if ( pdaRun->parseErrorText != 0 ) {
+ if ( pdaRun->parse_error_text != 0 ) {
cerr << ": relative error: " <<
- pdaRun->parseErrorText->tokdata->data;
+ pdaRun->parse_error_text->tokdata->data;
}
else {
cerr << ": parse error";
@@ -1018,9 +1018,9 @@ void Compiler::parsePatterns()
program_t *prg = colm_new_program( runtimeData );
/* Turn off context-dependent parsing. */
- prg->ctxDepParsing = 0;
+ prg->ctx_dep_parsing = 0;
- tree_t **sp = prg->stackRoot;
+ tree_t **sp = prg->stack_root;
for ( ConsList::Iter cons = replList; cons.lte(); cons++ ) {
if ( cons->langEl != 0 ) {
diff --git a/src/ctinput.cc b/src/ctinput.cc
index d16d69cb..5ae81153 100644
--- a/src/ctinput.cc
+++ b/src/ctinput.cc
@@ -43,7 +43,7 @@ struct stream_impl *colm_impl_new_pat( const char *name, Pattern *pattern )
struct stream_impl *ss = (struct stream_impl*)malloc(sizeof(struct stream_impl));
memset( ss, 0, sizeof(struct stream_impl) );
ss->pattern = pattern;
- ss->patItem = pattern->list->head;
+ ss->pat_item = pattern->list->head;
ss->funcs = &patternFuncs;
return ss;
}
@@ -51,12 +51,12 @@ struct stream_impl *colm_impl_new_pat( const char *name, Pattern *pattern )
LangEl *inputStreamPatternGetLangEl( struct stream_impl *ss, long *bindId,
char **data, long *length )
{
- LangEl *klangEl = ss->patItem->prodEl->langEl;
- *bindId = ss->patItem->bindId;
+ LangEl *klangEl = ss->pat_item->prodEl->langEl;
+ *bindId = ss->pat_item->bindId;
*data = 0;
*length = 0;
- ss->patItem = ss->patItem->next;
+ ss->pat_item = ss->pat_item->next;
ss->offset = 0;
return klangEl;
}
@@ -66,7 +66,7 @@ int inputStreamPatternGetParseBlock( struct stream_impl *ss, int skip,
{
*copied = 0;
- PatternItem *buf = ss->patItem;
+ PatternItem *buf = ss->pat_item;
int offset = ss->offset;
while ( true ) {
@@ -113,7 +113,7 @@ int inputStreamPatternGetData( struct stream_impl *ss, char *dest, int length )
{
int copied = 0;
- PatternItem *buf = ss->patItem;
+ PatternItem *buf = ss->pat_item;
int offset = ss->offset;
while ( true ) {
@@ -148,10 +148,10 @@ int inputStreamPatternGetData( struct stream_impl *ss, char *dest, int length )
void inputStreamPatternBackup( struct stream_impl *ss )
{
- if ( ss->patItem == 0 )
- ss->patItem = ss->pattern->list->tail;
+ if ( ss->pat_item == 0 )
+ ss->pat_item = ss->pattern->list->tail;
else
- ss->patItem = ss->patItem->prev;
+ ss->pat_item = ss->pat_item->prev;
}
void inputStreamPatternPushBackBuf( struct stream_impl *ss, RunBuf *runBuf )
@@ -166,19 +166,19 @@ void inputStreamPatternPushBackBuf( struct stream_impl *ss, RunBuf *runBuf )
while ( length > ss->offset ) {
length -= ss->offset;
if ( ss->offset > 0 )
- assert( memcmp( ss->patItem->data, data-length, ss->offset ) == 0 );
+ assert( memcmp( ss->pat_item->data, data-length, ss->offset ) == 0 );
inputStreamPatternBackup( ss );
- ss->offset = ss->patItem->data.length();
+ ss->offset = ss->pat_item->data.length();
}
ss->offset -= length;
- assert( memcmp( &ss->patItem->data[ss->offset], data, length ) == 0 );
+ assert( memcmp( &ss->pat_item->data[ss->offset], data, length ) == 0 );
}
void inputStreamPatternUndoConsumeLangEl( struct stream_impl *ss )
{
inputStreamPatternBackup( ss );
- ss->offset = ss->patItem->data.length();
+ ss->offset = ss->pat_item->data.length();
}
int inputStreamPatternConsumeData( program_t *prg, tree_t **sp, struct stream_impl *ss, int length, location_t *loc )
@@ -188,15 +188,15 @@ int inputStreamPatternConsumeData( program_t *prg, tree_t **sp, struct stream_im
int consumed = 0;
while ( true ) {
- if ( ss->patItem == 0 )
+ if ( ss->pat_item == 0 )
break;
- int avail = ss->patItem->data.length() - ss->offset;
+ int avail = ss->pat_item->data.length() - ss->offset;
if ( length >= avail ) {
/* Read up to the end of the data. Advance the
* pattern item. */
- ss->patItem = ss->patItem->next;
+ ss->pat_item = ss->pat_item->next;
ss->offset = 0;
length -= avail;
@@ -243,33 +243,33 @@ struct stream_impl *colm_impl_new_cons( const char *name, Constructor *construct
struct stream_impl *ss = (struct stream_impl*)malloc(sizeof(struct stream_impl));
memset( ss, 0, sizeof(struct stream_impl) );
ss->constructor = constructor;
- ss->consItem = constructor->list->head;
+ ss->cons_item = constructor->list->head;
ss->funcs = &replFuncs;
return ss;
}
LangEl *inputStreamConsGetLangEl( struct stream_impl *ss, long *bindId, char **data, long *length )
{
- LangEl *klangEl = ss->consItem->type == ConsItem::ExprType ?
- ss->consItem->langEl : ss->consItem->prodEl->langEl;
- *bindId = ss->consItem->bindId;
+ LangEl *klangEl = ss->cons_item->type == ConsItem::ExprType ?
+ ss->cons_item->langEl : ss->cons_item->prodEl->langEl;
+ *bindId = ss->cons_item->bindId;
*data = 0;
*length = 0;
- if ( ss->consItem->type == ConsItem::LiteralType ) {
- if ( ss->consItem->prodEl->typeRef->pdaLiteral != 0 ) {
+ if ( ss->cons_item->type == ConsItem::LiteralType ) {
+ if ( ss->cons_item->prodEl->typeRef->pdaLiteral != 0 ) {
bool unusedCI;
- prepareLitString( ss->consItem->data, unusedCI,
- ss->consItem->prodEl->typeRef->pdaLiteral->data,
- ss->consItem->prodEl->typeRef->pdaLiteral->loc );
+ prepareLitString( ss->cons_item->data, unusedCI,
+ ss->cons_item->prodEl->typeRef->pdaLiteral->data,
+ ss->cons_item->prodEl->typeRef->pdaLiteral->loc );
- *data = ss->consItem->data;
- *length = ss->consItem->data.length();
+ *data = ss->cons_item->data;
+ *length = ss->cons_item->data.length();
}
}
- ss->consItem = ss->consItem->next;
+ ss->cons_item = ss->cons_item->next;
ss->offset = 0;
return klangEl;
}
@@ -279,7 +279,7 @@ int inputStreamConsGetParseBlock( struct stream_impl *ss,
{
*copied = 0;
- ConsItem *buf = ss->consItem;
+ ConsItem *buf = ss->cons_item;
int offset = ss->offset;
while ( true ) {
@@ -326,7 +326,7 @@ int inputStreamConsGetData( struct stream_impl *ss, char *dest, int length )
{
int copied = 0;
- ConsItem *buf = ss->consItem;
+ ConsItem *buf = ss->cons_item;
int offset = ss->offset;
while ( true ) {
@@ -361,10 +361,10 @@ int inputStreamConsGetData( struct stream_impl *ss, char *dest, int length )
void inputStreamConsBackup( struct stream_impl *ss )
{
- if ( ss->consItem == 0 )
- ss->consItem = ss->constructor->list->tail;
+ if ( ss->cons_item == 0 )
+ ss->cons_item = ss->constructor->list->tail;
else
- ss->consItem = ss->consItem->prev;
+ ss->cons_item = ss->cons_item->prev;
}
void inputStreamConsPushBackBuf( struct stream_impl *ss, RunBuf *runBuf )
@@ -383,19 +383,19 @@ void inputStreamConsPushBackBuf( struct stream_impl *ss, RunBuf *runBuf )
while ( length > ss->offset ) {
length -= ss->offset;
if ( ss->offset > 0 )
- assert( memcmp( ss->consItem->data, data-length, ss->offset ) == 0 );
+ assert( memcmp( ss->cons_item->data, data-length, ss->offset ) == 0 );
inputStreamConsBackup( ss );
- ss->offset = ss->consItem->data.length();
+ ss->offset = ss->cons_item->data.length();
}
ss->offset -= length;
- assert( memcmp( &ss->consItem->data[ss->offset], data, length ) == 0 );
+ assert( memcmp( &ss->cons_item->data[ss->offset], data, length ) == 0 );
}
void inputStreamConsUndoConsumeLangEl( struct stream_impl *ss )
{
inputStreamConsBackup( ss );
- ss->offset = ss->consItem->data.length();
+ ss->offset = ss->cons_item->data.length();
}
int inputStreamConsConsumeData( program_t *prg, tree_t **sp,
@@ -404,15 +404,15 @@ int inputStreamConsConsumeData( program_t *prg, tree_t **sp,
int consumed = 0;
while ( true ) {
- if ( ss->consItem == 0 )
+ if ( ss->cons_item == 0 )
break;
- int avail = ss->consItem->data.length() - ss->offset;
+ int avail = ss->cons_item->data.length() - ss->offset;
if ( length >= avail ) {
/* Read up to the end of the data. Advance the
* pattern item. */
- ss->consItem = ss->consItem->next;
+ ss->cons_item = ss->cons_item->next;
ss->offset = 0;
length -= avail;
@@ -463,14 +463,14 @@ extern "C" void internalSendNamedLangEl( program_t *prg, tree_t **sp,
char *data;
long length;
- LangEl *klangEl = is->funcs->consumeLangEl( is, &bindId, &data, &length );
+ LangEl *klangEl = is->funcs->consume_lang_el( is, &bindId, &data, &length );
//cerr << "named langEl: " << prg->rtd->lelInfo[klangEl->id].name << endl;
/* Copy the token data. */
head_t *tokdata = 0;
if ( data != 0 )
- tokdata = stringAllocFull( prg, data, length );
+ tokdata = string_alloc_full( prg, data, length );
kid_t *input = make_token_with_data( prg, pdaRun, is, klangEl->id, tokdata );
@@ -484,7 +484,7 @@ extern "C" void internalSendNamedLangEl( program_t *prg, tree_t **sp,
if ( bindId > 0 )
pushBinding( pdaRun, parseTree );
- pdaRun->parseInput = parseTree;
+ pdaRun->parse_input = parseTree;
}
extern "C" void internalInitBindings( pda_run *pdaRun )
diff --git a/src/debug.c b/src/debug.c
index c43f5a68..21b7501c 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -25,7 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
-const char *const colmRealmNames[REALMS] =
+const char *const colm_realm_names[REALMS] =
{
"BYTECODE",
"PARSE",
@@ -40,7 +40,7 @@ const char *const colmRealmNames[REALMS] =
int _debug( struct colm_program *prg, long realm, const char *fmt, ... )
{
int result = 0;
- if ( prg->activeRealm & realm ) {
+ if ( prg->active_realm & realm ) {
/* Compute the index by shifting. */
int ind = 0;
while ( (realm & 0x1) != 0x1 ) {
@@ -48,7 +48,7 @@ int _debug( struct colm_program *prg, long realm, const char *fmt, ... )
ind += 1;
}
- fprintf( stderr, "%s: ", colmRealmNames[ind] );
+ fprintf( stderr, "%s: ", colm_realm_names[ind] );
va_list args;
va_start( args, fmt );
result = vfprintf( stderr, fmt, args );
diff --git a/src/fsmcodegen.cc b/src/fsmcodegen.cc
index 6fe34cec..75311bc5 100644
--- a/src/fsmcodegen.cc
+++ b/src/fsmcodegen.cc
@@ -777,10 +777,10 @@ void FsmCodeGen::writeData()
out << "\n";
out << "static long " << ENTRY_BY_REGION() << "[] = {\n\t";
- for ( int i = 0; i < fsmTables->numRegions; i++ ) {
- out << fsmTables->entryByRegion[i];
+ for ( int i = 0; i < fsmTables->num_regions; i++ ) {
+ out << fsmTables->entry_by_region[i];
- if ( i < fsmTables->numRegions-1 ) {
+ if ( i < fsmTables->num_regions-1 ) {
out << ", ";
if ( (i+1) % 8 == 0 )
out << "\n\t";
diff --git a/src/fsmcodegen.h b/src/fsmcodegen.h
index 6f0811c4..f2672166 100644
--- a/src/fsmcodegen.h
+++ b/src/fsmcodegen.h
@@ -107,7 +107,7 @@ protected:
string BLOCK_START() { return ACCESS() + "start"; }
string TOKLEN() { return ACCESS() + "toklen"; }
string ACT() { return ACCESS() + "act"; }
- string MATCHED_TOKEN() { return ACCESS() + "matchedToken"; }
+ string MATCHED_TOKEN() { return ACCESS() + "matched_token"; }
string DATA_PREFIX();
@@ -115,7 +115,7 @@ protected:
string ERROR() { return DATA_PREFIX() + "error"; }
string FIRST_FINAL() { return DATA_PREFIX() + "first_final"; }
- string ENTRY_BY_REGION() { return DATA_PREFIX() + "entryByRegion"; }
+ string ENTRY_BY_REGION() { return DATA_PREFIX() + "entry_by_region"; }
void INLINE_LIST( ostream &ret, InlineList *inlineList,
diff --git a/src/fsmexec.cc b/src/fsmexec.cc
index 6d06eba7..3b3d08f3 100644
--- a/src/fsmexec.cc
+++ b/src/fsmexec.cc
@@ -57,33 +57,33 @@ void execAction( struct pda_run *pdaRun, GenAction *genAction )
* will exist. */
pdaRun->toklen = pdaRun->tokend;
if ( item->tokenRegion->lmSwitchHandlesError && pdaRun->act == 0 ) {
- pdaRun->fsm_cs = pdaRun->fsm_tables->errorState;
+ pdaRun->fsm_cs = pdaRun->fsm_tables->error_state;
}
else {
for ( TokenInstanceListReg::Iter lmi = item->tokenRegion->tokenInstanceList;
lmi.lte(); lmi++ )
{
if ( lmi->inLmSelect && pdaRun->act == lmi->longestMatchId )
- pdaRun->matchedToken = lmi->tokenDef->tdLangEl->id;
+ pdaRun->matched_token = lmi->tokenDef->tdLangEl->id;
}
}
- pdaRun->returnResult = true;
- pdaRun->skipToklen = true;
+ pdaRun->return_result = true;
+ pdaRun->skip_toklen = true;
break;
case InlineItem::LmOnLast:
pdaRun->p += 1;
- pdaRun->matchedToken = item->longestMatchPart->tokenDef->tdLangEl->id;
- pdaRun->returnResult = true;
+ pdaRun->matched_token = item->longestMatchPart->tokenDef->tdLangEl->id;
+ pdaRun->return_result = true;
break;
case InlineItem::LmOnNext:
- pdaRun->matchedToken = item->longestMatchPart->tokenDef->tdLangEl->id;
- pdaRun->returnResult = true;
+ pdaRun->matched_token = item->longestMatchPart->tokenDef->tdLangEl->id;
+ pdaRun->return_result = true;
break;
case InlineItem::LmOnLagBehind:
pdaRun->toklen = pdaRun->tokend;
- pdaRun->matchedToken = item->longestMatchPart->tokenDef->tdLangEl->id;
- pdaRun->returnResult = true;
- pdaRun->skipToklen = true;
+ pdaRun->matched_token = item->longestMatchPart->tokenDef->tdLangEl->id;
+ pdaRun->return_result = true;
+ pdaRun->skip_toklen = true;
break;
}
}
@@ -103,25 +103,25 @@ extern "C" void internalFsmExecute( struct pda_run *pdaRun, struct stream_impl *
pdaRun->start = pdaRun->p;
/* Init the token match to nothing (the sentinal). */
- pdaRun->matchedToken = 0;
+ pdaRun->matched_token = 0;
/*_resume:*/
- if ( pdaRun->fsm_cs == pdaRun->fsm_tables->errorState )
+ if ( pdaRun->fsm_cs == pdaRun->fsm_tables->error_state )
goto out;
if ( pdaRun->p == pdaRun->pe )
goto out;
_loop_head:
- _acts = pdaRun->fsm_tables->actions + pdaRun->fsm_tables->fromStateActions[pdaRun->fsm_cs];
+ _acts = pdaRun->fsm_tables->actions + pdaRun->fsm_tables->from_state_actions[pdaRun->fsm_cs];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
- execAction( pdaRun, pdaRun->fsm_tables->actionSwitch[*_acts++] );
+ execAction( pdaRun, pdaRun->fsm_tables->action_switch[*_acts++] );
- _keys = pdaRun->fsm_tables->transKeys + pdaRun->fsm_tables->keyOffsets[pdaRun->fsm_cs];
- _trans = pdaRun->fsm_tables->indexOffsets[pdaRun->fsm_cs];
+ _keys = pdaRun->fsm_tables->trans_keys + pdaRun->fsm_tables->key_offsets[pdaRun->fsm_cs];
+ _trans = pdaRun->fsm_tables->index_offsets[pdaRun->fsm_cs];
- _klen = pdaRun->fsm_tables->singleLengths[pdaRun->fsm_cs];
+ _klen = pdaRun->fsm_tables->single_lengths[pdaRun->fsm_cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
@@ -144,7 +144,7 @@ _loop_head:
_trans += _klen;
}
- _klen = pdaRun->fsm_tables->rangeLengths[pdaRun->fsm_cs];
+ _klen = pdaRun->fsm_tables->range_lengths[pdaRun->fsm_cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
@@ -172,43 +172,43 @@ _match:
if ( pdaRun->fsm_tables->transActionsWI[_trans] == 0 )
goto _again;
- pdaRun->returnResult = false;
- pdaRun->skipToklen = false;
+ pdaRun->return_result = false;
+ pdaRun->skip_toklen = false;
_acts = pdaRun->fsm_tables->actions + pdaRun->fsm_tables->transActionsWI[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
- execAction( pdaRun, pdaRun->fsm_tables->actionSwitch[*_acts++] );
- if ( pdaRun->returnResult ) {
- if ( pdaRun->skipToklen )
+ execAction( pdaRun, pdaRun->fsm_tables->action_switch[*_acts++] );
+ if ( pdaRun->return_result ) {
+ if ( pdaRun->skip_toklen )
goto skip_toklen;
goto final;
}
_again:
- _acts = pdaRun->fsm_tables->actions + pdaRun->fsm_tables->toStateActions[pdaRun->fsm_cs];
+ _acts = pdaRun->fsm_tables->actions + pdaRun->fsm_tables->to_state_actions[pdaRun->fsm_cs];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
- execAction( pdaRun, pdaRun->fsm_tables->actionSwitch[*_acts++] );
+ execAction( pdaRun, pdaRun->fsm_tables->action_switch[*_acts++] );
- if ( pdaRun->fsm_cs == pdaRun->fsm_tables->errorState )
+ if ( pdaRun->fsm_cs == pdaRun->fsm_tables->error_state )
goto out;
if ( ++pdaRun->p != pdaRun->pe )
goto _loop_head;
out:
if ( pdaRun->eof ) {
- pdaRun->returnResult = false;
- pdaRun->skipToklen = false;
- _acts = pdaRun->fsm_tables->actions + pdaRun->fsm_tables->eofActions[pdaRun->fsm_cs];
+ pdaRun->return_result = false;
+ pdaRun->skip_toklen = false;
+ _acts = pdaRun->fsm_tables->actions + pdaRun->fsm_tables->eof_actions[pdaRun->fsm_cs];
_nacts = (unsigned int) *_acts++;
- if ( pdaRun->fsm_tables->eofTargs[pdaRun->fsm_cs] >= 0 )
- pdaRun->fsm_cs = pdaRun->fsm_tables->eofTargs[pdaRun->fsm_cs];
+ if ( pdaRun->fsm_tables->eof_targs[pdaRun->fsm_cs] >= 0 )
+ pdaRun->fsm_cs = pdaRun->fsm_tables->eof_targs[pdaRun->fsm_cs];
while ( _nacts-- > 0 )
- execAction( pdaRun, pdaRun->fsm_tables->actionSwitch[*_acts++] );
- if ( pdaRun->returnResult ) {
- if ( pdaRun->skipToklen )
+ execAction( pdaRun, pdaRun->fsm_tables->action_switch[*_acts++] );
+ if ( pdaRun->return_result ) {
+ if ( pdaRun->skip_toklen )
goto skip_toklen;
goto final;
}
diff --git a/src/input.c b/src/input.c
index fa797f90..df6120c3 100644
--- a/src/input.c
+++ b/src/input.c
@@ -37,26 +37,26 @@
#define true 1
#define false 0
-RunBuf *newRunBuf()
+RunBuf *new_run_buf()
{
RunBuf *rb = (RunBuf*)malloc(sizeof(RunBuf));
memset( rb, 0, sizeof(RunBuf) );
return rb;
}
-void initFdFuncs();
-void initFileFuncs();
-void initPatFuncs();
-void initConsFuncs();
+void init_fd_funcs();
+void init_file_funcs();
+void init_pat_funcs();
+void init_cons_funcs();
-extern struct StreamFuncs fileFuncs;
-extern struct StreamFuncs fdFuncs;
-extern struct StreamFuncs streamFuncs;
+extern struct StreamFuncs file_funcs;
+extern struct StreamFuncs fd_funcs;
+extern struct StreamFuncs stream_funcs;
void colm_clear_source_stream( struct colm_program *prg,
- tree_t **sp, struct stream_impl *sourceStream )
+ tree_t **sp, struct stream_impl *source_stream )
{
- RunBuf *buf = sourceStream->queue;
+ RunBuf *buf = source_stream->queue;
while ( buf != 0 ) {
switch ( buf->type ) {
case RunBufDataType:
@@ -75,7 +75,7 @@ void colm_clear_source_stream( struct colm_program *prg,
buf = next;
}
- sourceStream->queue = 0;
+ source_stream->queue = 0;
}
void colm_stream_destroy( program_t *prg, tree_t **sp, struct_t *s )
@@ -93,7 +93,7 @@ void colm_stream_destroy( program_t *prg, tree_t **sp, struct_t *s )
/* Keep the position up to date after consuming text. */
-void updatePosition( struct stream_impl *is, const char *data, long length )
+void update_position( struct stream_impl *is, const char *data, long length )
{
int i;
for ( i = 0; i < length; i++ ) {
@@ -109,7 +109,7 @@ void updatePosition( struct stream_impl *is, const char *data, long length )
}
/* Keep the position up to date after sending back text. */
-void undoPosition( struct stream_impl *is, const char *data, long length )
+void undo_position( struct stream_impl *is, const char *data, long length )
{
/* FIXME: this needs to fetch the position information from the parsed
* token and restore based on that.. */
@@ -123,42 +123,42 @@ void undoPosition( struct stream_impl *is, const char *data, long length )
}
-static RunBuf *sourceStreamPopHead( struct stream_impl *ss )
+static RunBuf *source_stream_pop_head( struct stream_impl *ss )
{
RunBuf *ret = ss->queue;
ss->queue = ss->queue->next;
if ( ss->queue == 0 )
- ss->queueTail = 0;
+ ss->queue_tail = 0;
else
ss->queue->prev = 0;
return ret;
}
-static void sourceStreamAppend( struct stream_impl *ss, RunBuf *runBuf )
+static void source_stream_append( struct stream_impl *ss, RunBuf *run_buf )
{
if ( ss->queue == 0 ) {
- runBuf->prev = runBuf->next = 0;
- ss->queue = ss->queueTail = runBuf;
+ run_buf->prev = run_buf->next = 0;
+ ss->queue = ss->queue_tail = run_buf;
}
else {
- ss->queueTail->next = runBuf;
- runBuf->prev = ss->queueTail;
- runBuf->next = 0;
- ss->queueTail = runBuf;
+ ss->queue_tail->next = run_buf;
+ run_buf->prev = ss->queue_tail;
+ run_buf->next = 0;
+ ss->queue_tail = run_buf;
}
}
-static void sourceStreamPrepend( struct stream_impl *ss, RunBuf *runBuf )
+static void source_stream_prepend( struct stream_impl *ss, RunBuf *run_buf )
{
if ( ss->queue == 0 ) {
- runBuf->prev = runBuf->next = 0;
- ss->queue = ss->queueTail = runBuf;
+ run_buf->prev = run_buf->next = 0;
+ ss->queue = ss->queue_tail = run_buf;
}
else {
- ss->queue->prev = runBuf;
- runBuf->prev = 0;
- runBuf->next = ss->queue;
- ss->queue = runBuf;
+ ss->queue->prev = run_buf;
+ run_buf->prev = 0;
+ run_buf->next = ss->queue;
+ ss->queue = run_buf;
}
}
@@ -166,7 +166,7 @@ static void sourceStreamPrepend( struct stream_impl *ss, RunBuf *runBuf )
* Base run-time input streams.
*/
-int fdGetParseBlock( struct stream_impl *ss, int skip, char **pdp, int *copied )
+int fd_get_parse_block( struct stream_impl *ss, int skip, char **pdp, int *copied )
{
int ret = 0;
*copied = 0;
@@ -176,17 +176,17 @@ int fdGetParseBlock( struct stream_impl *ss, int skip, char **pdp, int *copied )
while ( true ) {
if ( buf == 0 ) {
/* Got through the in-mem buffers without copying anything. */
- RunBuf *runBuf = newRunBuf();
- sourceStreamAppend( ss, runBuf );
- int received = ss->funcs->getDataSource( ss, runBuf->data, FSM_BUFSIZE );
+ RunBuf *run_buf = new_run_buf();
+ source_stream_append( ss, run_buf );
+ int received = ss->funcs->get_data_source( ss, run_buf->data, FSM_BUFSIZE );
if ( received == 0 ) {
ret = INPUT_EOD;
break;
}
- runBuf->length = received;
+ run_buf->length = received;
int slen = received;
- *pdp = runBuf->data;
+ *pdp = run_buf->data;
*copied = slen;
ret = INPUT_DATA;
break;
@@ -225,7 +225,7 @@ int fdGetParseBlock( struct stream_impl *ss, int skip, char **pdp, int *copied )
return ret;
}
-int fdGetData( struct stream_impl *ss, char *dest, int length )
+int fd_get_data( struct stream_impl *ss, char *dest, int length )
{
int copied = 0;
@@ -234,14 +234,14 @@ int fdGetData( struct stream_impl *ss, char *dest, int length )
while ( true ) {
if ( buf == 0 ) {
/* Got through the in-mem buffers without copying anything. */
- RunBuf *runBuf = newRunBuf();
- sourceStreamAppend( ss, runBuf );
- int received = ss->funcs->getDataSource( ss, runBuf->data, FSM_BUFSIZE );
- runBuf->length = received;
+ RunBuf *run_buf = new_run_buf();
+ source_stream_append( ss, run_buf );
+ int received = ss->funcs->get_data_source( ss, run_buf->data, FSM_BUFSIZE );
+ run_buf->length = received;
if ( received == 0 )
break;
- buf = runBuf;
+ buf = run_buf;
}
int avail = buf->length - buf->offset;
@@ -268,7 +268,7 @@ int fdGetData( struct stream_impl *ss, char *dest, int length )
return copied;
}
-int fdConsumeData( program_t *prg, tree_t **sp, struct stream_impl *ss, int length, location_t *loc )
+int fd_consume_data( program_t *prg, tree_t **sp, struct stream_impl *ss, int length, location_t *loc )
{
int consumed = 0;
@@ -298,7 +298,7 @@ int fdConsumeData( program_t *prg, tree_t **sp, struct stream_impl *ss, int leng
int slen = avail <= length ? avail : length;
consumed += slen;
length -= slen;
- updatePosition( ss, buf->data + buf->offset, slen );
+ update_position( ss, buf->data + buf->offset, slen );
buf->offset += slen;
ss->consumed += slen;
}
@@ -307,20 +307,20 @@ int fdConsumeData( program_t *prg, tree_t **sp, struct stream_impl *ss, int leng
if ( length == 0 )
break;
- RunBuf *runBuf = sourceStreamPopHead( ss );
- free( runBuf );
+ RunBuf *run_buf = source_stream_pop_head( ss );
+ free( run_buf );
}
return consumed;
}
-int fdUndoConsumeData( struct stream_impl *ss, const char *data, int length )
+int fd_undo_consume_data( struct stream_impl *ss, const char *data, int length )
{
- RunBuf *newBuf = newRunBuf();
- newBuf->length = length;
- memcpy( newBuf->data, data, length );
- sourceStreamPrepend( ss, newBuf );
- undoPosition( ss, data, length );
+ RunBuf *new_buf = new_run_buf();
+ new_buf->length = length;
+ memcpy( new_buf->data, data, length );
+ source_stream_prepend( ss, new_buf );
+ undo_position( ss, data, length );
ss->consumed -= length;
return length;
@@ -330,23 +330,23 @@ int fdUndoConsumeData( struct stream_impl *ss, const char *data, int length )
* File
*/
-int fileGetDataSource( struct stream_impl *ss, char *dest, int length )
+int file_get_data_source( struct stream_impl *ss, char *dest, int length )
{
//debug( REALM_INPUT, "inputStreamFileGetDataSource length = %ld\n", length );
size_t res = fread( dest, 1, length, ss->file );
return res;
}
-void initFileFuncs()
+void init_file_funcs()
{
- memset( &fileFuncs, 0, sizeof(struct StreamFuncs) );
+ memset( &file_funcs, 0, sizeof(struct StreamFuncs) );
}
/*
* FD
*/
-int fdGetDataSource( struct stream_impl *ss, char *dest, int length )
+int fd_get_data_source( struct stream_impl *ss, char *dest, int length )
{
if ( ss->eof )
return 0;
@@ -362,7 +362,7 @@ int fdGetDataSource( struct stream_impl *ss, char *dest, int length )
* StreamImpl struct, this wraps the list of input streams.
*/
-void initStreamImpl( struct stream_impl *is, const char *name )
+void init_stream_impl( struct stream_impl *is, const char *name )
{
memset( is, 0, sizeof(struct stream_impl) );
@@ -372,9 +372,9 @@ void initStreamImpl( struct stream_impl *is, const char *name )
is->byte = 0;
}
-void colm_clear_stream_impl( struct colm_program *prg, tree_t **sp, struct stream_impl *inputStream )
+void colm_clear_stream_impl( struct colm_program *prg, tree_t **sp, struct stream_impl *input_stream )
{
- RunBuf *buf = inputStream->queue;
+ RunBuf *buf = input_stream->queue;
while ( buf != 0 ) {
switch ( buf->type ) {
case RunBufDataType:
@@ -394,60 +394,60 @@ void colm_clear_stream_impl( struct colm_program *prg, tree_t **sp, struct strea
buf = next;
}
- inputStream->queue = 0;
+ input_stream->queue = 0;
}
-static void inputStreamPrepend( struct stream_impl *is, RunBuf *runBuf )
+static void input_stream_prepend( struct stream_impl *is, RunBuf *run_buf )
{
if ( is->queue == 0 ) {
- runBuf->prev = runBuf->next = 0;
- is->queue = is->queueTail = runBuf;
+ run_buf->prev = run_buf->next = 0;
+ is->queue = is->queue_tail = run_buf;
}
else {
- is->queue->prev = runBuf;
- runBuf->prev = 0;
- runBuf->next = is->queue;
- is->queue = runBuf;
+ is->queue->prev = run_buf;
+ run_buf->prev = 0;
+ run_buf->next = is->queue;
+ is->queue = run_buf;
}
}
-static RunBuf *inputStreamPopHead( struct stream_impl *is )
+static RunBuf *input_stream_pop_head( struct stream_impl *is )
{
RunBuf *ret = is->queue;
is->queue = is->queue->next;
if ( is->queue == 0 )
- is->queueTail = 0;
+ is->queue_tail = 0;
else
is->queue->prev = 0;
return ret;
}
-static void inputStreamAppend( struct stream_impl *is, RunBuf *runBuf )
+static void input_stream_append( struct stream_impl *is, RunBuf *run_buf )
{
if ( is->queue == 0 ) {
- runBuf->prev = runBuf->next = 0;
- is->queue = is->queueTail = runBuf;
+ run_buf->prev = run_buf->next = 0;
+ is->queue = is->queue_tail = run_buf;
}
else {
- is->queueTail->next = runBuf;
- runBuf->prev = is->queueTail;
- runBuf->next = 0;
- is->queueTail = runBuf;
+ is->queue_tail->next = run_buf;
+ run_buf->prev = is->queue_tail;
+ run_buf->next = 0;
+ is->queue_tail = run_buf;
}
}
-static RunBuf *inputStreamPopTail( struct stream_impl *is )
+static RunBuf *input_stream_pop_tail( struct stream_impl *is )
{
- RunBuf *ret = is->queueTail;
- is->queueTail = is->queueTail->prev;
- if ( is->queueTail == 0 )
+ RunBuf *ret = is->queue_tail;
+ is->queue_tail = is->queue_tail->prev;
+ if ( is->queue_tail == 0 )
is->queue = 0;
else
- is->queueTail->next = 0;
+ is->queue_tail->next = 0;
return ret;
}
-static int isSourceStream( struct stream_impl *is )
+static int is_source_stream( struct stream_impl *is )
{
if ( is->queue != 0 && is->queue->type == RunBufSourceType )
return true;
@@ -462,8 +462,8 @@ static void _setEof( struct stream_impl *is )
static void _unsetEof( struct stream_impl *is )
{
- if ( isSourceStream( is ) ) {
- struct stream_impl *si = streamToImpl( (stream_t*)is->queue->tree );
+ if ( is_source_stream( is ) ) {
+ struct stream_impl *si = stream_to_impl( (stream_t*)is->queue->tree );
si->eof = false;
}
else {
@@ -486,8 +486,8 @@ static int _getParseBlock( struct stream_impl *is, int skip, char **pdp, int *co
}
if ( buf->type == RunBufSourceType ) {
- struct stream_impl *si = streamToImpl( (stream_t*)buf->tree );
- int type = si->funcs->getParseBlock( si, skip, pdp, copied );
+ struct stream_impl *si = stream_to_impl( (stream_t*)buf->tree );
+ int type = si->funcs->get_parse_block( si, skip, pdp, copied );
// if ( type == INPUT_EOD && !si->eosSent ) {
// si->eosSent = 1;
@@ -583,8 +583,8 @@ static int _getData( struct stream_impl *is, char *dest, int length )
}
if ( buf->type == RunBufSourceType ) {
- struct stream_impl *si = streamToImpl( (stream_t*)buf->tree );
- int glen = si->funcs->getData( si, dest+copied, length );
+ struct stream_impl *si = stream_to_impl( (stream_t*)buf->tree );
+ int glen = si->funcs->get_data( si, dest+copied, length );
if ( glen == 0 ) {
//debug( REALM_INPUT, "skipping over input\n" );
@@ -641,8 +641,8 @@ static int _consumeData( program_t *prg, tree_t **sp, struct stream_impl *is,
break;
if ( buf->type == RunBufSourceType ) {
- struct stream_impl *si = streamToImpl( (stream_t*)buf->tree );
- int slen = si->funcs->consumeData( prg, sp, si, length, loc );
+ struct stream_impl *si = stream_to_impl( (stream_t*)buf->tree );
+ int slen = si->funcs->consume_data( prg, sp, si, length, loc );
//debug( REALM_INPUT, " got %d bytes from source\n", slen );
consumed += slen;
@@ -670,12 +670,12 @@ static int _consumeData( program_t *prg, tree_t **sp, struct stream_impl *is,
break;
}
- RunBuf *runBuf = inputStreamPopHead( is );
+ RunBuf *run_buf = input_stream_pop_head( is );
//if ( runBuf->type == RunBufSourceType ) {
// stream_t *stream = (stream_t*)runBuf->tree;
// colm_tree_downref( prg, sp, (tree_t*) stream );
//}
- free( runBuf );
+ free( run_buf );
}
return consumed;
@@ -685,16 +685,16 @@ static int _undoConsumeData( struct stream_impl *is, const char *data, int lengt
{
//debug( REALM_INPUT, "undoing consume of %ld bytes\n", length );
- if ( is->consumed == 0 && isSourceStream( is ) ) {
- struct stream_impl *si = streamToImpl( (stream_t*)is->queue->tree );
- int len = si->funcs->undoConsumeData( si, data, length );
+ if ( is->consumed == 0 && is_source_stream( is ) ) {
+ struct stream_impl *si = stream_to_impl( (stream_t*)is->queue->tree );
+ int len = si->funcs->undo_consume_data( si, data, length );
return len;
}
else {
- RunBuf *newBuf = newRunBuf();
- newBuf->length = length;
- memcpy( newBuf->data, data, length );
- inputStreamPrepend( is, newBuf );
+ RunBuf *new_buf = new_run_buf();
+ new_buf->length = length;
+ memcpy( new_buf->data, data, length );
+ input_stream_prepend( is, new_buf );
is->consumed -= length;
return length;
@@ -706,18 +706,18 @@ static tree_t *_consumeTree( struct stream_impl *is )
while ( is->queue != 0 && is->queue->type == RunBufDataType &&
is->queue->offset == is->queue->length )
{
- RunBuf *runBuf = inputStreamPopHead( is );
- free( runBuf );
+ RunBuf *run_buf = input_stream_pop_head( is );
+ free( run_buf );
}
if ( is->queue != 0 && (is->queue->type == RunBufTokenType ||
is->queue->type == RunBufIgnoreType) )
{
- RunBuf *runBuf = inputStreamPopHead( is );
+ RunBuf *run_buf = input_stream_pop_head( is );
/* FIXME: using runbufs here for this is a poor use of memory. */
- tree_t *tree = runBuf->tree;
- free(runBuf);
+ tree_t *tree = run_buf->tree;
+ free(run_buf);
return tree;
}
@@ -729,18 +729,18 @@ static void _undoConsumeTree( struct stream_impl *is, tree_t *tree, int ignore )
/* Create a new buffer for the data. This is the easy implementation.
* Something better is needed here. It puts a max on the amount of
* data that can be pushed back to the inputStream. */
- RunBuf *newBuf = newRunBuf();
- newBuf->type = ignore ? RunBufIgnoreType : RunBufTokenType;
- newBuf->tree = tree;
- inputStreamPrepend( is, newBuf );
+ RunBuf *new_buf = new_run_buf();
+ new_buf->type = ignore ? RunBufIgnoreType : RunBufTokenType;
+ new_buf->tree = tree;
+ input_stream_prepend( is, new_buf );
}
-static struct LangEl *_consumeLangEl( struct stream_impl *is, long *bindId,
+static struct LangEl *_consumeLangEl( struct stream_impl *is, long *bind_id,
char **data, long *length )
{
- if ( isSourceStream( is ) ) {
- struct stream_impl *si = streamToImpl( (stream_t*)is->queue->tree );
- return si->funcs->consumeLangEl( si, bindId, data, length );
+ if ( is_source_stream( is ) ) {
+ struct stream_impl *si = stream_to_impl( (stream_t*)is->queue->tree );
+ return si->funcs->consume_lang_el( si, bind_id, data, length );
}
else {
assert( false );
@@ -749,9 +749,9 @@ static struct LangEl *_consumeLangEl( struct stream_impl *is, long *bindId,
static void _undoConsumeLangEl( struct stream_impl *is )
{
- if ( isSourceStream( is ) ) {
- struct stream_impl *si = streamToImpl( (stream_t*)is->queue->tree );
- return si->funcs->undoConsumeLangEl( si );
+ if ( is_source_stream( is ) ) {
+ struct stream_impl *si = stream_to_impl( (stream_t*)is->queue->tree );
+ return si->funcs->undo_consume_lang_el( si );
}
else {
assert( false );
@@ -760,10 +760,10 @@ static void _undoConsumeLangEl( struct stream_impl *is )
static void _prependData( struct stream_impl *is, const char *data, long length )
{
- if ( isSourceStream( is ) &&
- streamToImpl((stream_t*)is->queue->tree)->funcs == &streamFuncs )
+ if ( is_source_stream( is ) &&
+ stream_to_impl((stream_t*)is->queue->tree)->funcs == &stream_funcs )
{
- _prependData( streamToImpl( (stream_t*)is->queue->tree ), data, length );
+ _prependData( stream_to_impl( (stream_t*)is->queue->tree ), data, length );
}
else {
/* Create a new buffer for the data. This is the easy implementation.
@@ -771,11 +771,11 @@ static void _prependData( struct stream_impl *is, const char *data, long length
* data that can be pushed back to the inputStream. */
assert( length < FSM_BUFSIZE );
- RunBuf *newBuf = newRunBuf();
- newBuf->length = length;
- memcpy( newBuf->data, data, length );
+ RunBuf *new_buf = new_run_buf();
+ new_buf->length = length;
+ memcpy( new_buf->data, data, length );
- inputStreamPrepend( is, newBuf );
+ input_stream_prepend( is, new_buf );
}
}
@@ -784,10 +784,10 @@ static void _prependTree( struct stream_impl *is, tree_t *tree, int ignore )
/* Create a new buffer for the data. This is the easy implementation.
* Something better is needed here. It puts a max on the amount of
* data that can be pushed back to the inputStream. */
- RunBuf *newBuf = newRunBuf();
- newBuf->type = ignore ? RunBufIgnoreType : RunBufTokenType;
- newBuf->tree = tree;
- inputStreamPrepend( is, newBuf );
+ RunBuf *new_buf = new_run_buf();
+ new_buf->type = ignore ? RunBufIgnoreType : RunBufTokenType;
+ new_buf->tree = tree;
+ input_stream_prepend( is, new_buf );
}
static void _prependStream( struct stream_impl *in, struct colm_tree *tree )
@@ -795,10 +795,10 @@ static void _prependStream( struct stream_impl *in, struct colm_tree *tree )
/* Create a new buffer for the data. This is the easy implementation.
* Something better is needed here. It puts a max on the amount of
* data that can be pushed back to the inputStream. */
- RunBuf *newBuf = newRunBuf();
- newBuf->type = RunBufSourceType;
- newBuf->tree = tree;
- inputStreamPrepend( in, newBuf );
+ RunBuf *new_buf = new_run_buf();
+ new_buf->type = RunBufSourceType;
+ new_buf->tree = tree;
+ input_stream_prepend( in, new_buf );
}
static int _undoPrependData( struct stream_impl *is, int length )
@@ -815,8 +815,8 @@ static int _undoPrependData( struct stream_impl *is, int length )
break;
if ( buf->type == RunBufSourceType ) {
- struct stream_impl *si = streamToImpl( (stream_t*)buf->tree );
- int slen = si->funcs->undoPrependData( si, length );
+ struct stream_impl *si = stream_to_impl( (stream_t*)buf->tree );
+ int slen = si->funcs->undo_prepend_data( si, length );
consumed += slen;
length -= slen;
@@ -840,8 +840,8 @@ static int _undoPrependData( struct stream_impl *is, int length )
if ( length == 0 )
break;
- RunBuf *runBuf = inputStreamPopHead( is );
- free( runBuf );
+ RunBuf *run_buf = input_stream_pop_head( is );
+ free( run_buf );
}
return consumed;
@@ -852,18 +852,18 @@ static tree_t *_undoPrependTree( struct stream_impl *is )
while ( is->queue != 0 && is->queue->type == RunBufDataType &&
is->queue->offset == is->queue->length )
{
- RunBuf *runBuf = inputStreamPopHead( is );
- free( runBuf );
+ RunBuf *run_buf = input_stream_pop_head( is );
+ free( run_buf );
}
if ( is->queue != 0 && (is->queue->type == RunBufTokenType ||
is->queue->type == RunBufIgnoreType) )
{
- RunBuf *runBuf = inputStreamPopHead( is );
+ RunBuf *run_buf = input_stream_pop_head( is );
/* FIXME: using runbufs here for this is a poor use of memory. */
- tree_t *tree = runBuf->tree;
- free(runBuf);
+ tree_t *tree = run_buf->tree;
+ free(run_buf);
return tree;
}
@@ -873,8 +873,8 @@ static tree_t *_undoPrependTree( struct stream_impl *is )
static void _appendData( struct stream_impl *is, const char *data, long len )
{
while ( len > 0 ) {
- RunBuf *ad = newRunBuf();
- inputStreamAppend( is, ad );
+ RunBuf *ad = new_run_buf();
+ input_stream_append( is, ad );
long consume =
len <= (long)sizeof(ad->data) ?
@@ -894,7 +894,7 @@ static tree_t *_undoAppendData( struct stream_impl *is, int length )
/* Move over skip bytes. */
while ( true ) {
- RunBuf *buf = is->queueTail;
+ RunBuf *buf = is->queue_tail;
if ( buf == 0 )
break;
@@ -918,8 +918,8 @@ static tree_t *_undoAppendData( struct stream_impl *is, int length )
if ( length == 0 )
break;
- RunBuf *runBuf = inputStreamPopTail( is );
- free( runBuf );
+ RunBuf *run_buf = input_stream_pop_tail( is );
+ free( run_buf );
}
return 0;
@@ -927,9 +927,9 @@ static tree_t *_undoAppendData( struct stream_impl *is, int length )
static void _appendTree( struct stream_impl *is, tree_t *tree )
{
- RunBuf *ad = newRunBuf();
+ RunBuf *ad = new_run_buf();
- inputStreamAppend( is, ad );
+ input_stream_append( is, ad );
ad->type = RunBufTokenType;
ad->tree = tree;
@@ -938,9 +938,9 @@ static void _appendTree( struct stream_impl *is, tree_t *tree )
static void _appendStream( struct stream_impl *in, struct colm_tree *tree )
{
- RunBuf *ad = newRunBuf();
+ RunBuf *ad = new_run_buf();
- inputStreamAppend( in, ad );
+ input_stream_append( in, ad );
ad->type = RunBufSourceType;
ad->tree = tree;
@@ -949,21 +949,21 @@ static void _appendStream( struct stream_impl *in, struct colm_tree *tree )
static tree_t *_undoAppendTree( struct stream_impl *is )
{
- RunBuf *runBuf = inputStreamPopTail( is );
- tree_t *tree = runBuf->tree;
- free( runBuf );
+ RunBuf *run_buf = input_stream_pop_tail( is );
+ tree_t *tree = run_buf->tree;
+ free( run_buf );
return tree;
}
static tree_t *_undoAppendStream( struct stream_impl *is )
{
- RunBuf *runBuf = inputStreamPopTail( is );
- tree_t *tree = runBuf->tree;
- free( runBuf );
+ RunBuf *run_buf = input_stream_pop_tail( is );
+ tree_t *tree = run_buf->tree;
+ free( run_buf );
return tree;
}
-struct StreamFuncs streamFuncs =
+struct StreamFuncs stream_funcs =
{
&_getParseBlock,
&_getData,
@@ -990,30 +990,30 @@ struct StreamFuncs streamFuncs =
&_undoAppendStream,
};
-struct StreamFuncs fdFuncs =
+struct StreamFuncs fd_funcs =
{
- .getData = &fdGetData,
- .getParseBlock = &fdGetParseBlock,
- .consumeData = &fdConsumeData,
- .undoConsumeData = &fdUndoConsumeData,
- .getDataSource = &fdGetDataSource,
+ .get_data = &fd_get_data,
+ .get_parse_block = &fd_get_parse_block,
+ .consume_data = &fd_consume_data,
+ .undo_consume_data = &fd_undo_consume_data,
+ .get_data_source = &fd_get_data_source,
};
-struct StreamFuncs fileFuncs =
+struct StreamFuncs file_funcs =
{
- .getData = &fdGetData,
- .getParseBlock = &fdGetParseBlock,
- .consumeData = &fdConsumeData,
- .undoConsumeData = &fdUndoConsumeData,
- .getDataSource = &fileGetDataSource,
+ .get_data = &fd_get_data,
+ .get_parse_block = &fd_get_parse_block,
+ .consume_data = &fd_consume_data,
+ .undo_consume_data = &fd_undo_consume_data,
+ .get_data_source = &file_get_data_source,
};
struct stream_impl *colm_impl_new_file( const char *name, FILE *file )
{
struct stream_impl *ss = (struct stream_impl*)malloc(sizeof(struct stream_impl));
- initStreamImpl( ss, name );
- ss->funcs = &fileFuncs;
+ init_stream_impl( ss, name );
+ ss->funcs = &file_funcs;
ss->file = file;
@@ -1023,8 +1023,8 @@ struct stream_impl *colm_impl_new_file( const char *name, FILE *file )
struct stream_impl *colm_impl_new_fd( const char *name, long fd )
{
struct stream_impl *ss = (struct stream_impl*)malloc(sizeof(struct stream_impl));
- initStreamImpl( ss, name );
- ss->funcs = &fdFuncs;
+ init_stream_impl( ss, name );
+ ss->funcs = &fd_funcs;
ss->fd = fd;
@@ -1034,8 +1034,8 @@ struct stream_impl *colm_impl_new_fd( const char *name, long fd )
struct stream_impl *colm_impl_new_generic( const char *name )
{
struct stream_impl *ss = (struct stream_impl*)malloc(sizeof(struct stream_impl));
- initStreamImpl( ss, name );
- ss->funcs = &streamFuncs;
+ init_stream_impl( ss, name );
+ ss->funcs = &stream_funcs;
return ss;
}
@@ -1062,30 +1062,30 @@ stream_t *colm_stream_open_fd( program_t *prg, char *name, long fd )
stream_t *colm_stream_open_file( program_t *prg, tree_t *name, tree_t *mode )
{
- head_t *headName = ((str_t*)name)->value;
- head_t *headMode = ((str_t*)mode)->value;
+ head_t *head_name = ((str_t*)name)->value;
+ head_t *head_mode = ((str_t*)mode)->value;
stream_t *stream = 0;
- const char *givenMode = stringData(headMode);
- const char *fopenMode = 0;
- if ( memcmp( givenMode, "r", stringLength(headMode) ) == 0 )
- fopenMode = "rb";
- else if ( memcmp( givenMode, "w", stringLength(headMode) ) == 0 )
- fopenMode = "wb";
- else if ( memcmp( givenMode, "a", stringLength(headMode) ) == 0 )
- fopenMode = "ab";
+ const char *given_mode = string_data(head_mode);
+ const char *fopen_mode = 0;
+ if ( memcmp( given_mode, "r", string_length(head_mode) ) == 0 )
+ fopen_mode = "rb";
+ else if ( memcmp( given_mode, "w", string_length(head_mode) ) == 0 )
+ fopen_mode = "wb";
+ else if ( memcmp( given_mode, "a", string_length(head_mode) ) == 0 )
+ fopen_mode = "ab";
else {
- fatal( "unknown file open mode: %s\n", givenMode );
+ fatal( "unknown file open mode: %s\n", given_mode );
}
/* Need to make a C-string (null terminated). */
- char *fileName = (char*)malloc(stringLength(headName)+1);
- memcpy( fileName, stringData(headName), stringLength(headName) );
- fileName[stringLength(headName)] = 0;
- FILE *file = fopen( fileName, fopenMode );
+ char *file_name = (char*)malloc(string_length(head_name)+1);
+ memcpy( file_name, string_data(head_name), string_length(head_name) );
+ file_name[string_length(head_name)] = 0;
+ FILE *file = fopen( file_name, fopen_mode );
if ( file != 0 ) {
stream = colm_stream_new_struct( prg );
- stream->impl = colm_impl_new_file( fileName, file );
+ stream->impl = colm_impl_new_file( file_name, file );
}
return stream;
@@ -1105,7 +1105,7 @@ struct stream_impl *colm_stream_impl( struct colm_struct *s )
return ((stream_t*)s)->impl;
}
-struct stream_impl *streamToImpl( stream_t *ptr )
+struct stream_impl *stream_to_impl( stream_t *ptr )
{
return ptr->impl;
}
diff --git a/src/input.h b/src/input.h
index be1b1bf5..f6f35891 100644
--- a/src/input.h
+++ b/src/input.h
@@ -70,48 +70,48 @@ typedef struct _RunBuf
struct _RunBuf *next, *prev;
} RunBuf;
-RunBuf *newRunBuf();
+RunBuf *new_run_buf();
struct StreamFuncs
{
- int (*getParseBlock)( struct stream_impl *ss, int skip, char **pdp, int *copied );
+ int (*get_parse_block)( struct stream_impl *ss, int skip, char **pdp, int *copied );
- int (*getData)( struct stream_impl *ss, char *dest, int length );
+ int (*get_data)( struct stream_impl *ss, char *dest, int length );
- int (*consumeData)( struct colm_program *prg, struct colm_tree **sp,
+ int (*consume_data)( struct colm_program *prg, struct colm_tree **sp,
struct stream_impl *ss, int length, struct colm_location *loc );
- int (*undoConsumeData)( struct stream_impl *ss, const char *data, int length );
+ int (*undo_consume_data)( struct stream_impl *ss, const char *data, int length );
- struct colm_tree *(*consumeTree)( struct stream_impl *ss );
- void (*undoConsumeTree)( struct stream_impl *ss,
+ struct colm_tree *(*consume_tree)( struct stream_impl *ss );
+ void (*undo_consume_tree)( struct stream_impl *ss,
struct colm_tree *tree, int ignore );
/* Language elments (compile-time). */
- struct LangEl *(*consumeLangEl)( struct stream_impl *ss,
- long *bindId, char **data, long *length );
- void (*undoConsumeLangEl)( struct stream_impl *ss );
+ struct LangEl *(*consume_lang_el)( struct stream_impl *ss,
+ long *bind_id, char **data, long *length );
+ void (*undo_consume_lang_el)( struct stream_impl *ss );
/* Private implmentation for some shared get data functions. */
- int (*getDataSource)( struct stream_impl *ss, char *dest, int length );
+ int (*get_data_source)( struct stream_impl *ss, char *dest, int length );
- void (*setEof)( struct stream_impl *is );
- void (*unsetEof)( struct stream_impl *is );
+ void (*set_eof)( struct stream_impl *is );
+ void (*unset_eof)( struct stream_impl *is );
/* Prepending to a stream. */
- void (*prependData)( struct stream_impl *in, const char *data, long len );
- void (*prependTree)( struct stream_impl *is, struct colm_tree *tree, int ignore );
- void (*prependStream)( struct stream_impl *in, struct colm_tree *tree );
- int (*undoPrependData)( struct stream_impl *is, int length );
- struct colm_tree *(*undoPrependTree)( struct stream_impl *is );
- struct colm_tree *(*undoPrependStream)( struct stream_impl *in );
+ void (*prepend_data)( struct stream_impl *in, const char *data, long len );
+ void (*prepend_tree)( struct stream_impl *is, struct colm_tree *tree, int ignore );
+ void (*prepend_stream)( struct stream_impl *in, struct colm_tree *tree );
+ int (*undo_prepend_data)( struct stream_impl *is, int length );
+ struct colm_tree *(*undo_prepend_tree)( struct stream_impl *is );
+ struct colm_tree *(*undo_prepend_stream)( struct stream_impl *in );
/* Appending to a stream. */
- void (*appendData)( struct stream_impl *in, const char *data, long len );
- void (*appendTree)( struct stream_impl *in, struct colm_tree *tree );
- void (*appendStream)( struct stream_impl *in, struct colm_tree *tree );
- struct colm_tree *(*undoAppendData)( struct stream_impl *in, int length );
- struct colm_tree *(*undoAppendTree)( struct stream_impl *in );
- struct colm_tree *(*undoAppendStream)( struct stream_impl *in );
+ void (*append_data)( struct stream_impl *in, const char *data, long len );
+ void (*append_tree)( struct stream_impl *in, struct colm_tree *tree );
+ void (*append_stream)( struct stream_impl *in, struct colm_tree *tree );
+ struct colm_tree *(*undo_append_data)( struct stream_impl *in, int length );
+ struct colm_tree *(*undo_append_tree)( struct stream_impl *in );
+ struct colm_tree *(*undo_append_stream)( struct stream_impl *in );
};
/* List of source streams. Enables streams to be pushed/popped. */
@@ -119,12 +119,12 @@ struct stream_impl
{
struct StreamFuncs *funcs;
- char eofSent;
+ char eof_sent;
char eof;
- char eosSent;
+ char eos_sent;
RunBuf *queue;
- RunBuf *queueTail;
+ RunBuf *queue_tail;
const char *data;
long dlen;
@@ -139,9 +139,9 @@ struct stream_impl
long fd;
struct Pattern *pattern;
- struct PatternItem *patItem;
+ struct PatternItem *pat_item;
struct Constructor *constructor;
- struct ConsItem *consItem;
+ struct ConsItem *cons_item;
int consumed;
};
@@ -152,8 +152,8 @@ struct stream_impl *colm_impl_new_file( const char *name, FILE *file );
struct stream_impl *colm_impl_new_fd( const char *name, long fd );
struct stream_impl *colm_impl_new_generic( const char *name );
-void updatePosition( struct stream_impl *inputStream, const char *data, long length );
-void undoPosition( struct stream_impl *inputStream, const char *data, long length );
+void update_position( struct stream_impl *input_stream, const char *data, long length );
+void undo_position( struct stream_impl *input_stream, const char *data, long length );
struct stream_impl *colm_stream_impl( struct colm_struct *s );
diff --git a/src/iter.c b/src/iter.c
index 92cd0669..ef7490ff 100644
--- a/src/iter.c
+++ b/src/iter.c
@@ -28,18 +28,18 @@
#define true 1
#define false 0
-void colm_init_list_iter( generic_iter_t *listIter, tree_t **stackRoot,
- long argSize, long rootSize, const ref_t *rootRef, int genericId )
+void colm_init_list_iter( generic_iter_t *list_iter, tree_t **stack_root,
+ long arg_size, long root_size, const ref_t *root_ref, int generic_id )
{
- listIter->type = IT_Tree;
- listIter->rootRef = *rootRef;
- listIter->stackRoot = stackRoot;
- listIter->yieldSize = 0;
- listIter->rootSize = rootSize;
- listIter->ref.kid = 0;
- listIter->ref.next = 0;
- listIter->argSize = argSize;
- listIter->genericId = genericId;
+ list_iter->type = IT_Tree;
+ list_iter->root_ref = *root_ref;
+ list_iter->stack_root = stack_root;
+ list_iter->yield_size = 0;
+ list_iter->root_size = root_size;
+ list_iter->ref.kid = 0;
+ list_iter->ref.next = 0;
+ list_iter->arg_size = arg_size;
+ list_iter->generic_id = generic_id;
}
void colm_list_iter_destroy( program_t *prg, tree_t ***psp, generic_iter_t *iter )
@@ -47,10 +47,10 @@ void colm_list_iter_destroy( program_t *prg, tree_t ***psp, generic_iter_t *iter
if ( (int)iter->type != 0 ) {
int i;
tree_t **sp = *psp;
- long curStackSize = vm_ssize() - iter->rootSize;
- assert( iter->yieldSize == curStackSize );
- vm_popn( iter->yieldSize );
- for ( i = 0; i < iter->argSize; i++ )
+ long cur_stack_size = vm_ssize() - iter->root_size;
+ assert( iter->yield_size == cur_stack_size );
+ vm_popn( iter->yield_size );
+ for ( i = 0; i < iter->arg_size; i++ )
colm_tree_downref( prg, sp, vm_pop_tree() );
iter->type = 0;
*psp = sp;
@@ -60,11 +60,11 @@ void colm_list_iter_destroy( program_t *prg, tree_t ***psp, generic_iter_t *iter
tree_t *colm_list_iter_advance( program_t *prg, tree_t ***psp, generic_iter_t *iter )
{
tree_t **sp = *psp;
- assert( iter->yieldSize == (vm_ssize() - iter->rootSize) );
+ assert( iter->yield_size == (vm_ssize() - iter->root_size) );
if ( iter->ref.kid == 0 ) {
/* kid_t is zero, start from the root. */
- list_t *list = *((list_t**)iter->rootRef.kid);
+ list_t *list = *((list_t**)iter->root_ref.kid);
iter->ref.kid = (kid_t*)list->head;
iter->ref.next = 0;
@@ -76,26 +76,26 @@ tree_t *colm_list_iter_advance( program_t *prg, tree_t ***psp, generic_iter_t *i
/* Have a previous item, continue searching from there. */
//iterFind( prg, psp, iter, false );
- list_el_t *listEl = (list_el_t*)iter->ref.kid;
- listEl = listEl->list_next;
- iter->ref.kid = (kid_t*)listEl;
+ list_el_t *list_el = (list_el_t*)iter->ref.kid;
+ list_el = list_el->list_next;
+ iter->ref.kid = (kid_t*)list_el;
iter->ref.next = 0;
}
sp = *psp;
- iter->yieldSize = vm_ssize() - iter->rootSize;
+ iter->yield_size = vm_ssize() - iter->root_size;
- return (iter->ref.kid ? prg->trueVal : prg->falseVal );
+ return (iter->ref.kid ? prg->true_val : prg->false_val );
}
tree_t *colm_map_iter_advance( program_t *prg, tree_t ***psp, generic_iter_t *iter )
{
tree_t **sp = *psp;
- assert( iter->yieldSize == (vm_ssize() - iter->rootSize) );
+ assert( iter->yield_size == (vm_ssize() - iter->root_size) );
if ( iter->ref.kid == 0 ) {
/* kid_t is zero, start from the root. */
- map_t *map = *((map_t**)iter->rootRef.kid);
+ map_t *map = *((map_t**)iter->root_ref.kid);
iter->ref.kid = (kid_t*)map->head;
iter->ref.next = 0;
@@ -107,91 +107,91 @@ tree_t *colm_map_iter_advance( program_t *prg, tree_t ***psp, generic_iter_t *it
/* Have a previous item, continue searching from there. */
//iterFind( prg, psp, iter, false );
- map_el_t *mapEl = (map_el_t*)iter->ref.kid;
- mapEl = mapEl->next;
- iter->ref.kid = (kid_t*)mapEl;
+ map_el_t *map_el = (map_el_t*)iter->ref.kid;
+ map_el = map_el->next;
+ iter->ref.kid = (kid_t*)map_el;
iter->ref.next = 0;
}
sp = *psp;
- iter->yieldSize = vm_ssize() - iter->rootSize;
+ iter->yield_size = vm_ssize() - iter->root_size;
- return (iter->ref.kid ? prg->trueVal : prg->falseVal );
+ return (iter->ref.kid ? prg->true_val : prg->false_val );
}
tree_t *colm_list_iter_deref_cur( program_t *prg, generic_iter_t *iter )
{
- struct generic_info *gi = &prg->rtd->genericInfo[iter->genericId];
+ struct generic_info *gi = &prg->rtd->generic_info[iter->generic_id];
list_el_t *el = (list_el_t*)iter->ref.kid;
struct colm_struct *s = el != 0 ?
- colm_struct_container( el, gi->elOffset ) : 0;
+ colm_struct_container( el, gi->el_offset ) : 0;
return (tree_t*)s;
}
value_t colm_viter_deref_cur( program_t *prg, generic_iter_t *iter )
{
- struct generic_info *gi = &prg->rtd->genericInfo[iter->genericId];
+ struct generic_info *gi = &prg->rtd->generic_info[iter->generic_id];
list_el_t *el = (list_el_t*)iter->ref.kid;
struct colm_struct *s = el != 0 ?
- colm_struct_container( el, gi->elOffset ) : 0;
+ colm_struct_container( el, gi->el_offset ) : 0;
value_t value = colm_struct_get_field( s, value_t, 0 );
- if ( gi->valueType == TYPE_TREE )
+ if ( gi->value_type == TYPE_TREE )
colm_tree_upref( (tree_t*)value );
return value;
}
-void colm_init_tree_iter( tree_iter_t *treeIter, tree_t **stackRoot,
- long argSize, long rootSize,
- const ref_t *rootRef, int searchId )
+void colm_init_tree_iter( tree_iter_t *tree_iter, tree_t **stack_root,
+ long arg_size, long root_size,
+ const ref_t *root_ref, int search_id )
{
- treeIter->type = IT_Tree;
- treeIter->rootRef = *rootRef;
- treeIter->searchId = searchId;
- treeIter->stackRoot = stackRoot;
- treeIter->yieldSize = 0;
- treeIter->rootSize = rootSize;
- treeIter->ref.kid = 0;
- treeIter->ref.next = 0;
- treeIter->argSize = argSize;
+ tree_iter->type = IT_Tree;
+ tree_iter->root_ref = *root_ref;
+ tree_iter->search_id = search_id;
+ tree_iter->stack_root = stack_root;
+ tree_iter->yield_size = 0;
+ tree_iter->root_size = root_size;
+ tree_iter->ref.kid = 0;
+ tree_iter->ref.next = 0;
+ tree_iter->arg_size = arg_size;
}
-void colm_init_rev_tree_iter( rev_tree_iter_t *revTriter, tree_t **stackRoot,
- long argSize, long rootSize,
- const ref_t *rootRef, int searchId, int children )
+void colm_init_rev_tree_iter( rev_tree_iter_t *rev_triter, tree_t **stack_root,
+ long arg_size, long root_size,
+ const ref_t *root_ref, int search_id, int children )
{
- revTriter->type = IT_RevTree;
- revTriter->rootRef = *rootRef;
- revTriter->searchId = searchId;
- revTriter->stackRoot = stackRoot;
- revTriter->yieldSize = children;
- revTriter->rootSize = rootSize;
- revTriter->kidAtYield = 0;
- revTriter->children = children;
- revTriter->ref.kid = 0;
- revTriter->ref.next = 0;
- revTriter->argSize = argSize;
+ rev_triter->type = IT_RevTree;
+ rev_triter->root_ref = *root_ref;
+ rev_triter->search_id = search_id;
+ rev_triter->stack_root = stack_root;
+ rev_triter->yield_size = children;
+ rev_triter->root_size = root_size;
+ rev_triter->kid_at_yield = 0;
+ rev_triter->children = children;
+ rev_triter->ref.kid = 0;
+ rev_triter->ref.next = 0;
+ rev_triter->arg_size = arg_size;
}
-void initUserIter( user_iter_t *userIter, tree_t **stackRoot, long rootSize,
- long argSize, long searchId )
+void init_user_iter( user_iter_t *user_iter, tree_t **stack_root, long root_size,
+ long arg_size, long search_id )
{
- userIter->type = IT_User;
- userIter->stackRoot = stackRoot;
- userIter->argSize = argSize;
- userIter->yieldSize = 0;
- userIter->rootSize = rootSize;
- userIter->resume = 0;
- userIter->frame = 0;
- userIter->searchId = searchId;
-
- userIter->ref.kid = 0;
- userIter->ref.next = 0;
+ user_iter->type = IT_User;
+ user_iter->stack_root = stack_root;
+ user_iter->arg_size = arg_size;
+ user_iter->yield_size = 0;
+ user_iter->root_size = root_size;
+ user_iter->resume = 0;
+ user_iter->frame = 0;
+ user_iter->search_id = search_id;
+
+ user_iter->ref.kid = 0;
+ user_iter->ref.next = 0;
}
-user_iter_t *colm_uiter_create( program_t *prg, tree_t ***psp, struct function_info *fi, long searchId )
+user_iter_t *colm_uiter_create( program_t *prg, tree_t ***psp, struct function_info *fi, long search_id )
{
tree_t **sp = *psp;
@@ -199,27 +199,27 @@ user_iter_t *colm_uiter_create( program_t *prg, tree_t ***psp, struct function_i
void *mem = vm_ptop();
user_iter_t *uiter = mem;
- tree_t **stackRoot = vm_ptop();
- long rootSize = vm_ssize();
+ tree_t **stack_root = vm_ptop();
+ long root_size = vm_ssize();
- initUserIter( uiter, stackRoot, rootSize, fi->argSize, searchId );
+ init_user_iter( uiter, stack_root, root_size, fi->arg_size, search_id );
*psp = sp;
return uiter;
}
-void uiterInit( program_t *prg, tree_t **sp, user_iter_t *uiter,
- struct function_info *fi, int revertOn )
+void uiter_init( program_t *prg, tree_t **sp, user_iter_t *uiter,
+ struct function_info *fi, int revert_on )
{
/* Set up the first yeild so when we resume it starts at the beginning. */
uiter->ref.kid = 0;
- uiter->yieldSize = vm_ssize() - uiter->rootSize;
+ uiter->yield_size = vm_ssize() - uiter->root_size;
// uiter->frame = &uiter->stackRoot[-IFR_AA];
- if ( revertOn )
- uiter->resume = prg->rtd->frameInfo[fi->frameId].codeWV;
+ if ( revert_on )
+ uiter->resume = prg->rtd->frame_info[fi->frame_id].codeWV;
else
- uiter->resume = prg->rtd->frameInfo[fi->frameId].codeWC;
+ uiter->resume = prg->rtd->frame_info[fi->frame_id].codeWC;
}
@@ -228,10 +228,10 @@ void colm_tree_iter_destroy( program_t *prg, tree_t ***psp, tree_iter_t *iter )
if ( (int)iter->type != 0 ) {
int i;
tree_t **sp = *psp;
- long curStackSize = vm_ssize() - iter->rootSize;
- assert( iter->yieldSize == curStackSize );
- vm_popn( iter->yieldSize );
- for ( i = 0; i < iter->argSize; i++ )
+ long cur_stack_size = vm_ssize() - iter->root_size;
+ assert( iter->yield_size == cur_stack_size );
+ vm_popn( iter->yield_size );
+ for ( i = 0; i < iter->arg_size; i++ )
colm_tree_downref( prg, sp, vm_pop_tree() );
iter->type = 0;
*psp = sp;
@@ -243,10 +243,10 @@ void colm_rev_tree_iter_destroy( struct colm_program *prg, tree_t ***psp, rev_tr
if ( (int)riter->type != 0 ) {
int i;
tree_t **sp = *psp;
- long curStackSize = vm_ssize() - riter->rootSize;
- assert( riter->yieldSize == curStackSize );
- vm_popn( riter->yieldSize );
- for ( i = 0; i < riter->argSize; i++ )
+ long cur_stack_size = vm_ssize() - riter->root_size;
+ assert( riter->yield_size == cur_stack_size );
+ vm_popn( riter->yield_size );
+ for ( i = 0; i < riter->arg_size; i++ )
colm_tree_downref( prg, sp, vm_pop_tree() );
riter->type = 0;
*psp = sp;
@@ -260,10 +260,10 @@ void colm_uiter_destroy( program_t *prg, tree_t ***psp, user_iter_t *uiter )
/* We should always be coming from a yield. The current stack size will be
* nonzero and the stack size in the iterator will be correct. */
- long curStackSize = vm_ssize() - uiter->rootSize;
- assert( uiter->yieldSize == curStackSize );
+ long cur_stack_size = vm_ssize() - uiter->root_size;
+ assert( uiter->yield_size == cur_stack_size );
- vm_popn( uiter->yieldSize );
+ vm_popn( uiter->yield_size );
vm_popn( sizeof(user_iter_t) / sizeof(word_t) );
uiter->type = 0;
@@ -279,16 +279,16 @@ void colm_uiter_unwind( program_t *prg, tree_t ***psp, user_iter_t *uiter )
/* We should always be coming from a yield. The current stack size will be
* nonzero and the stack size in the iterator will be correct. */
- long curStackSize = vm_ssize() - uiter->rootSize;
- assert( uiter->yieldSize == curStackSize );
+ long cur_stack_size = vm_ssize() - uiter->root_size;
+ assert( uiter->yield_size == cur_stack_size );
- long argSize = uiter->argSize;
+ long arg_size = uiter->arg_size;
- vm_popn( uiter->yieldSize );
+ vm_popn( uiter->yield_size );
vm_popn( sizeof(user_iter_t) / sizeof(word_t) );
/* The IN_PREP_ARGS stack data. */
- vm_popn( argSize );
+ vm_popn( arg_size );
vm_pop_value();
uiter->type = 0;
@@ -297,43 +297,43 @@ void colm_uiter_unwind( program_t *prg, tree_t ***psp, user_iter_t *uiter )
}
}
-tree_t *treeIterDerefCur( tree_iter_t *iter )
+tree_t *tree_iter_deref_cur( tree_iter_t *iter )
{
return iter->ref.kid == 0 ? 0 : iter->ref.kid->tree;
}
-void setTriterCur( program_t *prg, tree_iter_t *iter, tree_t *tree )
+void set_triter_cur( program_t *prg, tree_iter_t *iter, tree_t *tree )
{
iter->ref.kid->tree = tree;
}
-void setUiterCur( program_t *prg, user_iter_t *uiter, tree_t *tree )
+void set_uiter_cur( program_t *prg, user_iter_t *uiter, tree_t *tree )
{
uiter->ref.kid->tree = tree;
}
-void splitIterCur( program_t *prg, tree_t ***psp, tree_iter_t *iter )
+void split_iter_cur( program_t *prg, tree_t ***psp, tree_iter_t *iter )
{
if ( iter->ref.kid == 0 )
return;
- splitRef( prg, psp, &iter->ref );
+ split_ref( prg, psp, &iter->ref );
}
-void iterFind( program_t *prg, tree_t ***psp, tree_iter_t *iter, int tryFirst )
+void iter_find( program_t *prg, tree_t ***psp, tree_iter_t *iter, int try_first )
{
- int anyTree = iter->searchId == prg->rtd->anyId;
- tree_t **top = iter->stackRoot;
+ int any_tree = iter->search_id == prg->rtd->any_id;
+ tree_t **top = iter->stack_root;
kid_t *child;
tree_t **sp = *psp;
rec_call:
- if ( tryFirst && ( iter->ref.kid->tree->id == iter->searchId || anyTree ) ) {
+ if ( try_first && ( iter->ref.kid->tree->id == iter->search_id || any_tree ) ) {
*psp = sp;
return;
}
else {
- child = treeChild( prg, iter->ref.kid->tree );
+ child = tree_child( prg, iter->ref.kid->tree );
if ( child != 0 ) {
vm_contiguous( 2 );
vm_push_ref( iter->ref.next );
@@ -341,7 +341,7 @@ rec_call:
iter->ref.kid = child;
iter->ref.next = (ref_t*)vm_ptop();
while ( iter->ref.kid != 0 ) {
- tryFirst = true;
+ try_first = true;
goto rec_call;
rec_return:
iter->ref.kid = iter->ref.kid->next;
@@ -358,44 +358,44 @@ rec_call:
*psp = sp;
}
-tree_t *treeIterAdvance( program_t *prg, tree_t ***psp, tree_iter_t *iter )
+tree_t *tree_iter_advance( program_t *prg, tree_t ***psp, tree_iter_t *iter )
{
tree_t **sp = *psp;
- assert( iter->yieldSize == (vm_ssize() - iter->rootSize) );
+ assert( iter->yield_size == (vm_ssize() - iter->root_size) );
if ( iter->ref.kid == 0 ) {
/* kid_t is zero, start from the root. */
- iter->ref = iter->rootRef;
- iterFind( prg, psp, iter, true );
+ iter->ref = iter->root_ref;
+ iter_find( prg, psp, iter, true );
}
else {
/* Have a previous item, continue searching from there. */
- iterFind( prg, psp, iter, false );
+ iter_find( prg, psp, iter, false );
}
sp = *psp;
- iter->yieldSize = vm_ssize() - iter->rootSize;
+ iter->yield_size = vm_ssize() - iter->root_size;
- return (iter->ref.kid ? prg->trueVal : prg->falseVal );
+ return (iter->ref.kid ? prg->true_val : prg->false_val );
}
-tree_t *treeIterNextChild( program_t *prg, tree_t ***psp, tree_iter_t *iter )
+tree_t *tree_iter_next_child( program_t *prg, tree_t ***psp, tree_iter_t *iter )
{
tree_t **sp = *psp;
- assert( iter->yieldSize == (vm_ssize() - iter->rootSize) );
+ assert( iter->yield_size == (vm_ssize() - iter->root_size) );
kid_t *kid = 0;
if ( iter->ref.kid == 0 ) {
/* kid_t is zero, start from the first child. */
- kid_t *child = treeChild( prg, iter->rootRef.kid->tree );
+ kid_t *child = tree_child( prg, iter->root_ref.kid->tree );
if ( child == 0 )
iter->ref.next = 0;
else {
/* Make a reference to the root. */
vm_contiguous( 2 );
- vm_push_ref( iter->rootRef.next );
- vm_push_kid( iter->rootRef.kid );
+ vm_push_ref( iter->root_ref.next );
+ vm_push_kid( iter->root_ref.kid );
iter->ref.next = (ref_t*)vm_ptop();
kid = child;
@@ -406,29 +406,29 @@ tree_t *treeIterNextChild( program_t *prg, tree_t ***psp, tree_iter_t *iter )
kid = iter->ref.kid->next;
}
- if ( iter->searchId != prg->rtd->anyId ) {
+ if ( iter->search_id != prg->rtd->any_id ) {
/* Have a previous item, go to the next sibling. */
- while ( kid != 0 && kid->tree->id != iter->searchId )
+ while ( kid != 0 && kid->tree->id != iter->search_id )
kid = kid->next;
}
iter->ref.kid = kid;
- iter->yieldSize = vm_ssize() - iter->rootSize;
+ iter->yield_size = vm_ssize() - iter->root_size;
*psp = sp;
- return ( iter->ref.kid ? prg->trueVal : prg->falseVal );
+ return ( iter->ref.kid ? prg->true_val : prg->false_val );
}
-tree_t *treeRevIterPrevChild( program_t *prg, tree_t ***psp, rev_tree_iter_t *iter )
+tree_t *tree_rev_iter_prev_child( program_t *prg, tree_t ***psp, rev_tree_iter_t *iter )
{
tree_t **sp = *psp;
- assert( iter->yieldSize == ( vm_ssize() - iter->rootSize ) );
+ assert( iter->yield_size == ( vm_ssize() - iter->root_size ) );
- if ( iter->kidAtYield != iter->ref.kid ) {
+ if ( iter->kid_at_yield != iter->ref.kid ) {
/* Need to reload the kids. */
vm_popn( iter->children );
int c;
- kid_t *kid = treeChild( prg, iter->rootRef.kid->tree );
+ kid_t *kid = tree_child( prg, iter->root_ref.kid->tree );
for ( c = 0; c < iter->children; c++ ) {
vm_push_kid( kid );
kid = kid->next;
@@ -440,9 +440,9 @@ tree_t *treeRevIterPrevChild( program_t *prg, tree_t ***psp, rev_tree_iter_t *it
iter->children -= 1;
}
- if ( iter->searchId != prg->rtd->anyId ) {
+ if ( iter->search_id != prg->rtd->any_id ) {
/* Have a previous item, go to the next sibling. */
- while ( iter->children > 0 && ((kid_t*)(vm_top()))->tree->id != iter->searchId ) {
+ while ( iter->children > 0 && ((kid_t*)(vm_top()))->tree->id != iter->search_id ) {
iter->children -= 1;
vm_pop_ignore();
}
@@ -453,29 +453,29 @@ tree_t *treeRevIterPrevChild( program_t *prg, tree_t ***psp, rev_tree_iter_t *it
iter->ref.kid = 0;
}
else {
- iter->ref.next = &iter->rootRef;
+ iter->ref.next = &iter->root_ref;
iter->ref.kid = (kid_t*)vm_top();
}
/* We will use this to detect a split above the iterated tree. */
- iter->kidAtYield = iter->ref.kid;
+ iter->kid_at_yield = iter->ref.kid;
- iter->yieldSize = vm_ssize() - iter->rootSize;
+ iter->yield_size = vm_ssize() - iter->root_size;
*psp = sp;
- return (iter->ref.kid ? prg->trueVal : prg->falseVal );
+ return (iter->ref.kid ? prg->true_val : prg->false_val );
}
-void iterFindRepeat( program_t *prg, tree_t ***psp, tree_iter_t *iter, int tryFirst )
+void iter_find_repeat( program_t *prg, tree_t ***psp, tree_iter_t *iter, int try_first )
{
tree_t **sp = *psp;
- int anyTree = iter->searchId == prg->rtd->anyId;
- tree_t **top = iter->stackRoot;
+ int any_tree = iter->search_id == prg->rtd->any_id;
+ tree_t **top = iter->stack_root;
kid_t *child;
rec_call:
- if ( tryFirst && ( iter->ref.kid->tree->id == iter->searchId || anyTree ) ) {
+ if ( try_first && ( iter->ref.kid->tree->id == iter->search_id || any_tree ) ) {
*psp = sp;
return;
}
@@ -485,7 +485,7 @@ rec_call:
* root of the iteration, or if does not have any neighbours to the
* right. */
if ( top == vm_ptop() || iter->ref.kid->next == 0 ) {
- child = treeChild( prg, iter->ref.kid->tree );
+ child = tree_child( prg, iter->ref.kid->tree );
if ( child != 0 ) {
vm_contiguous( 2 );
vm_push_ref( iter->ref.next );
@@ -493,7 +493,7 @@ rec_call:
iter->ref.kid = child;
iter->ref.next = (ref_t*)vm_ptop();
while ( iter->ref.kid != 0 ) {
- tryFirst = true;
+ try_first = true;
goto rec_call;
rec_return:
iter->ref.kid = iter->ref.kid->next;
@@ -511,38 +511,38 @@ rec_call:
*psp = sp;
}
-tree_t *treeIterNextRepeat( program_t *prg, tree_t ***psp, tree_iter_t *iter )
+tree_t *tree_iter_next_repeat( program_t *prg, tree_t ***psp, tree_iter_t *iter )
{
tree_t **sp = *psp;
- assert( iter->yieldSize == ( vm_ssize() - iter->rootSize ) );
+ assert( iter->yield_size == ( vm_ssize() - iter->root_size ) );
if ( iter->ref.kid == 0 ) {
/* kid_t is zero, start from the root. */
- iter->ref = iter->rootRef;
- iterFindRepeat( prg, psp, iter, true );
+ iter->ref = iter->root_ref;
+ iter_find_repeat( prg, psp, iter, true );
}
else {
/* Have a previous item, continue searching from there. */
- iterFindRepeat( prg, psp, iter, false );
+ iter_find_repeat( prg, psp, iter, false );
}
sp = *psp;
- iter->yieldSize = vm_ssize() - iter->rootSize;
+ iter->yield_size = vm_ssize() - iter->root_size;
- return (iter->ref.kid ? prg->trueVal : prg->falseVal );
+ return (iter->ref.kid ? prg->true_val : prg->false_val );
}
-void iterFindRevRepeat( program_t *prg, tree_t ***psp, tree_iter_t *iter, int tryFirst )
+void iter_find_rev_repeat( program_t *prg, tree_t ***psp, tree_iter_t *iter, int try_first )
{
tree_t **sp = *psp;
- int anyTree = iter->searchId == prg->rtd->anyId;
- tree_t **top = iter->stackRoot;
+ int any_tree = iter->search_id == prg->rtd->any_id;
+ tree_t **top = iter->stack_root;
kid_t *child;
- if ( tryFirst ) {
+ if ( try_first ) {
while ( true ) {
if ( top == vm_ptop() || iter->ref.kid->next == 0 ) {
- child = treeChild( prg, iter->ref.kid->tree );
+ child = tree_child( prg, iter->ref.kid->tree );
if ( child == 0 )
break;
@@ -572,14 +572,14 @@ void iterFindRevRepeat( program_t *prg, tree_t ***psp, tree_iter_t *iter, int tr
* because the chain may have been split, setting it null (to
* prevent repeated walks up). */
ref_t *ref = (ref_t*)vm_ptop();
- iter->ref.kid = treeChild( prg, ref->kid->tree );
+ iter->ref.kid = tree_child( prg, ref->kid->tree );
}
else {
iter->ref.kid = vm_pop_kid();
iter->ref.next = vm_pop_ref();
}
first:
- if ( iter->ref.kid->tree->id == iter->searchId || anyTree ) {
+ if ( iter->ref.kid->tree->id == iter->search_id || any_tree ) {
*psp = sp;
return;
}
@@ -589,25 +589,25 @@ first:
}
-tree_t *treeIterPrevRepeat( program_t *prg, tree_t ***psp, tree_iter_t *iter )
+tree_t *tree_iter_prev_repeat( program_t *prg, tree_t ***psp, tree_iter_t *iter )
{
tree_t **sp = *psp;
- assert( iter->yieldSize == (vm_ssize() - iter->rootSize) );
+ assert( iter->yield_size == (vm_ssize() - iter->root_size) );
if ( iter->ref.kid == 0 ) {
/* kid_t is zero, start from the root. */
- iter->ref = iter->rootRef;
- iterFindRevRepeat( prg, psp, iter, true );
+ iter->ref = iter->root_ref;
+ iter_find_rev_repeat( prg, psp, iter, true );
}
else {
/* Have a previous item, continue searching from there. */
- iterFindRevRepeat( prg, psp, iter, false );
+ iter_find_rev_repeat( prg, psp, iter, false );
}
sp = *psp;
- iter->yieldSize = vm_ssize() - iter->rootSize;
+ iter->yield_size = vm_ssize() - iter->root_size;
- return (iter->ref.kid ? prg->trueVal : prg->falseVal );
+ return (iter->ref.kid ? prg->true_val : prg->false_val );
}
diff --git a/src/list.c b/src/list.c
index 732c2d40..55a0ce0e 100644
--- a/src/list.c
+++ b/src/list.c
@@ -31,14 +31,14 @@ static void colm_list_add_after( list_t *list, list_el_t *prev_el, list_el_t *ne
static void colm_list_add_before( list_t *list, list_el_t *next_el, list_el_t *new_el);
list_el_t *colm_list_detach( list_t *list, list_el_t *el );
-void colm_list_prepend( list_t *list, list_el_t *newEl )
+void colm_list_prepend( list_t *list, list_el_t *new_el )
{
- colm_list_add_before( list, list->head, newEl );
+ colm_list_add_before( list, list->head, new_el );
}
-void colm_list_append( list_t *list, list_el_t *newEl )
+void colm_list_append( list_t *list, list_el_t *new_el )
{
- colm_list_add_after( list, list->tail, newEl );
+ colm_list_add_after( list, list->tail, new_el );
}
list_el_t *colm_list_detach_head( list_t *list )
@@ -53,42 +53,42 @@ list_el_t *colm_list_detach_tail( list_t *list )
long colm_list_length( list_t *list )
{
- return list->listLen;
+ return list->list_len;
}
void colm_vlist_append( struct colm_program *prg, list_t *list, value_t value )
{
- struct colm_struct *s = colm_struct_new( prg, list->genericInfo->elStructId );
+ struct colm_struct *s = colm_struct_new( prg, list->generic_info->el_struct_id );
colm_struct_set_field( s, value_t, 0, value );
- list_el_t *listEl = colm_struct_get_addr( s, list_el_t*, list->genericInfo->elOffset );
+ list_el_t *list_el = colm_struct_get_addr( s, list_el_t*, list->generic_info->el_offset );
- colm_list_append( list, listEl );
+ colm_list_append( list, list_el );
}
void colm_vlist_prepend( struct colm_program *prg, list_t *list, value_t value )
{
- struct colm_struct *s = colm_struct_new( prg, list->genericInfo->elStructId );
+ struct colm_struct *s = colm_struct_new( prg, list->generic_info->el_struct_id );
colm_struct_set_field( s, value_t, 0, value );
- list_el_t *listEl = colm_struct_get_addr( s, list_el_t*, list->genericInfo->elOffset );
+ list_el_t *list_el = colm_struct_get_addr( s, list_el_t*, list->generic_info->el_offset );
- colm_list_prepend( list, listEl );
+ colm_list_prepend( list, list_el );
}
value_t colm_vlist_detach_tail( struct colm_program *prg, list_t *list )
{
- list_el_t *listEl = list->tail;
- colm_list_detach( list, listEl );
+ list_el_t *list_el = list->tail;
+ colm_list_detach( list, list_el );
- struct colm_struct *s = colm_generic_el_container( prg, listEl,
- (list->genericInfo - prg->rtd->genericInfo) );
+ struct colm_struct *s = colm_generic_el_container( prg, list_el,
+ (list->generic_info - prg->rtd->generic_info) );
value_t val = colm_struct_get_field( s, value_t, 0 );
- if ( list->genericInfo->valueType == TYPE_TREE )
+ if ( list->generic_info->value_type == TYPE_TREE )
colm_tree_upref( (tree_t*)val );
return val;
@@ -96,15 +96,15 @@ value_t colm_vlist_detach_tail( struct colm_program *prg, list_t *list )
value_t colm_vlist_detach_head( struct colm_program *prg, list_t *list )
{
- list_el_t *listEl = list->head;
- colm_list_detach( list, listEl );
+ list_el_t *list_el = list->head;
+ colm_list_detach( list, list_el );
- struct colm_struct *s = colm_generic_el_container( prg, listEl,
- (list->genericInfo - prg->rtd->genericInfo) );
+ struct colm_struct *s = colm_generic_el_container( prg, list_el,
+ (list->generic_info - prg->rtd->generic_info) );
value_t val = colm_struct_get_field( s, value_t, 0 );
- if ( list->genericInfo->valueType == TYPE_TREE )
+ if ( list->generic_info->value_type == TYPE_TREE )
colm_tree_upref( (tree_t*) val );
return val;
@@ -140,7 +140,7 @@ static void colm_list_add_after( list_t *list, list_el_t *prev_el, list_el_t *ne
}
/* Update list length. */
- list->listLen++;
+ list->list_len++;
}
static void colm_list_add_before( list_t *list, list_el_t *next_el, list_el_t *new_el)
@@ -171,7 +171,7 @@ static void colm_list_add_before( list_t *list, list_el_t *next_el, list_el_t *n
new_el->list_prev->list_next = new_el;
}
- list->listLen++;
+ list->list_len++;
}
list_el_t *colm_list_detach( list_t *list, list_el_t *el )
@@ -189,7 +189,7 @@ list_el_t *colm_list_detach( list_t *list, list_el_t *el )
el->list_next->list_prev = el->list_prev;
/* Update List length and return element we detached. */
- list->listLen--;
+ list->list_len--;
return el;
}
@@ -209,9 +209,9 @@ list_t *colm_list_new( struct colm_program *prg )
}
struct colm_struct *colm_list_get( struct colm_program *prg,
- list_t *list, word_t genId, word_t field )
+ list_t *list, word_t gen_id, word_t field )
{
- struct generic_info *gi = &prg->rtd->genericInfo[genId];
+ struct generic_info *gi = &prg->rtd->generic_info[gen_id];
list_el_t *result = 0;
switch ( field ) {
case 0:
@@ -226,21 +226,21 @@ struct colm_struct *colm_list_get( struct colm_program *prg,
}
struct colm_struct *s = result != 0 ?
- colm_struct_container( result, gi->elOffset ) : 0;
+ colm_struct_container( result, gi->el_offset ) : 0;
return s;
}
struct colm_struct *colm_list_el_get( struct colm_program *prg,
- list_el_t *listEl, word_t genId, word_t field )
+ list_el_t *list_el, word_t gen_id, word_t field )
{
- struct generic_info *gi = &prg->rtd->genericInfo[genId];
+ struct generic_info *gi = &prg->rtd->generic_info[gen_id];
list_el_t *result = 0;
switch ( field ) {
case 0:
- result = listEl->list_prev;
+ result = list_el->list_prev;
break;
case 1:
- result = listEl->list_next;
+ result = list_el->list_next;
break;
default:
assert( 0 );
@@ -248,6 +248,6 @@ struct colm_struct *colm_list_el_get( struct colm_program *prg,
}
struct colm_struct *s = result != 0 ?
- colm_struct_container( result, gi->elOffset ) : 0;
+ colm_struct_container( result, gi->el_offset ) : 0;
return s;
}
diff --git a/src/map.c b/src/map.c
index e1ef8bf6..cdf45ee8 100644
--- a/src/map.c
+++ b/src/map.c
@@ -29,16 +29,16 @@
#define false 0
struct colm_struct *colm_map_el_get( struct colm_program *prg,
- map_el_t *mapEl, word_t genId, word_t field )
+ map_el_t *map_el, word_t gen_id, word_t field )
{
- struct generic_info *gi = &prg->rtd->genericInfo[genId];
+ struct generic_info *gi = &prg->rtd->generic_info[gen_id];
map_el_t *result = 0;
switch ( field ) {
case 0:
- result = mapEl->prev;
+ result = map_el->prev;
break;
case 1:
- result = mapEl->next;
+ result = map_el->next;
break;
default:
assert( 0 );
@@ -46,14 +46,14 @@ struct colm_struct *colm_map_el_get( struct colm_program *prg,
}
struct colm_struct *s = result != 0 ?
- colm_struct_container( result, gi->elOffset ) : 0;
+ colm_struct_container( result, gi->el_offset ) : 0;
return s;
}
struct colm_struct *colm_map_get( struct colm_program *prg,
- map_t *map, word_t genId, word_t field )
+ map_t *map, word_t gen_id, word_t field )
{
- struct generic_info *gi = &prg->rtd->genericInfo[genId];
+ struct generic_info *gi = &prg->rtd->generic_info[gen_id];
map_el_t *result = 0;
switch ( field ) {
case 0:
@@ -68,16 +68,16 @@ struct colm_struct *colm_map_get( struct colm_program *prg,
}
struct colm_struct *s = result != 0 ?
- colm_struct_container( result, gi->elOffset ) : 0;
+ colm_struct_container( result, gi->el_offset ) : 0;
return s;
}
-void mapListAbandon( map_t *map )
+void map_list_abandon( map_t *map )
{
map->head = map->tail = 0;
}
-void mapListAddBefore( map_t *map, map_el_t *next_el, map_el_t *new_el )
+void map_list_add_before( map_t *map, map_el_t *next_el, map_el_t *new_el )
{
/* Set the next pointer of the new element to next_el. We do
* this regardless of the state of the list. */
@@ -106,7 +106,7 @@ void mapListAddBefore( map_t *map, map_el_t *next_el, map_el_t *new_el )
}
}
-void mapListAddAfter( map_t *map, map_el_t *prev_el, map_el_t *new_el )
+void map_list_add_after( map_t *map, map_el_t *prev_el, map_el_t *new_el )
{
/* Set the previous pointer of new_el to prev_el. We do
* this regardless of the state of the list. */
@@ -136,7 +136,7 @@ void mapListAddAfter( map_t *map, map_el_t *prev_el, map_el_t *new_el )
}
-map_el_t *mapListDetach( map_t *map, map_el_t *el )
+map_el_t *map_list_detach( map_t *map, map_el_t *el )
{
/* Set forward pointers to skip over el. */
if ( el->prev == 0 )
@@ -156,13 +156,13 @@ map_el_t *mapListDetach( map_t *map, map_el_t *el )
/* Once an insertion position is found, attach a element to the tree. */
-void mapAttachRebal( map_t *map, map_el_t *element, map_el_t *parentEl, map_el_t *lastLess )
+void map_attach_rebal( map_t *map, map_el_t *element, map_el_t *parent_el, map_el_t *last_less )
{
/* Increment the number of element in the tree. */
- map->treeSize += 1;
+ map->tree_size += 1;
/* Set element's parent. */
- element->parent = parentEl;
+ element->parent = parent_el;
/* New element always starts as a leaf with height 1. */
element->left = 0;
@@ -170,30 +170,30 @@ void mapAttachRebal( map_t *map, map_el_t *element, map_el_t *parentEl, map_el_t
element->height = 1;
/* Are we inserting in the tree somewhere? */
- if ( parentEl != 0 ) {
+ if ( parent_el != 0 ) {
/* We have a parent so we are somewhere in the tree. If the parent
* equals lastLess, then the last traversal in the insertion went
* left, otherwise it went right. */
- if ( lastLess == parentEl ) {
- parentEl->left = element;
+ if ( last_less == parent_el ) {
+ parent_el->left = element;
- mapListAddBefore( map, parentEl, element );
+ map_list_add_before( map, parent_el, element );
}
else {
- parentEl->right = element;
+ parent_el->right = element;
- mapListAddAfter( map, parentEl, element );
+ map_list_add_after( map, parent_el, element );
}
}
else {
/* No parent element so we are inserting the root. */
map->root = element;
- mapListAddAfter( map, map->tail, element );
+ map_list_add_after( map, map->tail, element );
}
/* Recalculate the heights. */
- mapRecalcHeights( map, parentEl );
+ map_recalc_heights( map, parent_el );
/* Find the first unbalance. */
map_el_t *ub = mapFindFirstUnbalGP( map, element );
@@ -203,17 +203,17 @@ void mapAttachRebal( map_t *map, map_el_t *element, map_el_t *parentEl, map_el_t
{
/* We assert that after this single rotation the
* tree is now properly balanced. */
- mapRebalance( map, ub );
+ map_rebalance( map, ub );
}
}
#if 0
/* Recursively delete all the children of a element. */
-void mapDeleteChildrenOf( map_t *map, map_el_t *element )
+void map_delete_children_of( map_t *map, map_el_t *element )
{
/* Recurse left. */
if ( element->left ) {
- mapDeleteChildrenOf( map, element->left );
+ map_delete_children_of( map, element->left );
/* Delete left element. */
delete element->left;
@@ -222,7 +222,7 @@ void mapDeleteChildrenOf( map_t *map, map_el_t *element )
/* Recurse right. */
if ( element->right ) {
- mapDeleteChildrenOf( map, element->right );
+ map_delete_children_of( map, element->right );
/* Delete right element. */
delete element->right;
@@ -230,23 +230,23 @@ void mapDeleteChildrenOf( map_t *map, map_el_t *element )
}
}
-void mapEmpty( map_t *map )
+void map_empty( map_t *map )
{
if ( map->root ) {
/* Recursively delete from the tree structure. */
- mapDeleteChildrenOf( map, map->root );
+ map_delete_children_of( map, map->root );
delete map->root;
map->root = 0;
- map->treeSize = 0;
+ map->tree_size = 0;
- mapListAbandon( map );
+ map_list_abandon( map );
}
}
#endif
/* rebalance from a element whose gradparent is unbalanced. Only
* call on a element that has a grandparent. */
-map_el_t *mapRebalance( map_t *map, map_el_t *n )
+map_el_t *map_rebalance( map_t *map, map_el_t *n )
{
long lheight, rheight;
map_el_t *a, *b, *c;
@@ -395,12 +395,12 @@ map_el_t *mapRebalance( map_t *map, map_el_t *n )
b->height = (lheight > rheight ? lheight : rheight) + 1;
/* Fix height of b's parents. */
- mapRecalcHeights( map, ggp );
+ map_recalc_heights( map, ggp );
return ggp;
}
/* Recalculates the heights of all the ancestors of element. */
-void mapRecalcHeights( map_t *map, map_el_t *element )
+void map_recalc_heights( map_t *map, map_el_t *element )
{
while ( element != 0 )
{
@@ -424,7 +424,7 @@ void mapRecalcHeights( map_t *map, map_el_t *element )
/* Finds the first element whose grandparent is unbalanced. */
map_el_t *mapFindFirstUnbalGP( map_t *map, map_el_t *element )
{
- long lheight, rheight, balanceProp;
+ long lheight, rheight, balance_prop;
map_el_t *gp;
if ( element == 0 || element->parent == 0 ||
@@ -437,9 +437,9 @@ map_el_t *mapFindFirstUnbalGP( map_t *map, map_el_t *element )
{
lheight = gp->left ? gp->left->height : 0;
rheight = gp->right ? gp->right->height : 0;
- balanceProp = lheight - rheight;
+ balance_prop = lheight - rheight;
- if ( balanceProp < -1 || balanceProp > 1 )
+ if ( balance_prop < -1 || balance_prop > 1 )
return element;
element = element->parent;
@@ -451,7 +451,7 @@ map_el_t *mapFindFirstUnbalGP( map_t *map, map_el_t *element )
/* Finds the first element that is unbalanced. */
-map_el_t *mapFindFirstUnbalEl( map_t *map, map_el_t *element )
+map_el_t *map_find_first_unbal_el( map_t *map, map_el_t *element )
{
if ( element == 0 )
return 0;
@@ -462,9 +462,9 @@ map_el_t *mapFindFirstUnbalEl( map_t *map, map_el_t *element )
element->left->height : 0;
long rheight = element->right ?
element->right->height : 0;
- long balanceProp = lheight - rheight;
+ long balance_prop = lheight - rheight;
- if ( balanceProp < -1 || balanceProp > 1 )
+ if ( balance_prop < -1 || balance_prop > 1 )
return element;
element = element->parent;
@@ -473,7 +473,7 @@ map_el_t *mapFindFirstUnbalEl( map_t *map, map_el_t *element )
}
/* Replace a element in the tree with another element not in the tree. */
-void mapReplaceEl( map_t *map, map_el_t *element, map_el_t *replacement )
+void map_replace_el( map_t *map, map_el_t *element, map_el_t *replacement )
{
map_el_t *parent = element->parent,
*left = element->left,
@@ -504,7 +504,7 @@ void mapReplaceEl( map_t *map, map_el_t *element, map_el_t *replacement )
/* Removes a element from a tree and puts filler in it's place.
* Filler should be null or a child of element. */
-void mapRemoveEl( map_t *map, map_el_t *element, map_el_t *filler )
+void map_remove_el( map_t *map, map_el_t *element, map_el_t *filler )
{
map_el_t *parent = element->parent;
@@ -527,37 +527,37 @@ void mapRemoveEl( map_t *map, map_el_t *element, map_el_t *filler )
#if 0
/* Recursive worker for tree copying. */
-map_el_t *mapCopyBranch( program_t *prg, map_t *map, map_el_t *el, kid_t *oldNextDown, kid_t **newNextDown )
+map_el_t *map_copy_branch( program_t *prg, map_t *map, map_el_t *el, kid_t *old_next_down, kid_t **new_next_down )
{
/* Duplicate element. Either the base element's copy constructor or defaul
* constructor will get called. Both will suffice for initting the
* pointers to null when they need to be. */
- map_el_t *newEl = mapElAllocate( prg );
+ map_el_t *new_el = map_el_allocate( prg );
- if ( (kid_t*)el == oldNextDown )
- *newNextDown = (kid_t*)newEl;
+ if ( (kid_t*)el == old_next_down )
+ *new_next_down = (kid_t*)new_el;
/* If the left tree is there, copy it. */
- if ( newEl->left ) {
- newEl->left = mapCopyBranch( prg, map, newEl->left, oldNextDown, newNextDown );
- newEl->left->parent = newEl;
+ if ( new_el->left ) {
+ new_el->left = map_copy_branch( prg, map, new_el->left, old_next_down, new_next_down );
+ new_el->left->parent = new_el;
}
- mapListAddAfter( map, map->tail, newEl );
+ map_list_add_after( map, map->tail, new_el );
/* If the right tree is there, copy it. */
- if ( newEl->right ) {
- newEl->right = mapCopyBranch( prg, map, newEl->right, oldNextDown, newNextDown );
- newEl->right->parent = newEl;
+ if ( new_el->right ) {
+ new_el->right = map_copy_branch( prg, map, new_el->right, old_next_down, new_next_down );
+ new_el->right->parent = new_el;
}
- return newEl;
+ return new_el;
}
#endif
static long map_cmp( program_t *prg, map_t *map, const tree_t *tree1, const tree_t *tree2 )
{
- if ( map->genericInfo->keyType == TYPE_TREE ) {
+ if ( map->generic_info->key_type == TYPE_TREE ) {
return colm_cmp_tree( prg, tree1, tree2 );
}
else {
@@ -569,123 +569,123 @@ static long map_cmp( program_t *prg, map_t *map, const tree_t *tree1, const tree
}
}
-map_el_t *mapInsertEl( program_t *prg, map_t *map, map_el_t *element, map_el_t **lastFound )
+map_el_t *map_insert_el( program_t *prg, map_t *map, map_el_t *element, map_el_t **last_found )
{
- long keyRelation;
- map_el_t *curEl = map->root, *parentEl = 0;
- map_el_t *lastLess = 0;
+ long key_relation;
+ map_el_t *cur_el = map->root, *parent_el = 0;
+ map_el_t *last_less = 0;
while ( true ) {
- if ( curEl == 0 ) {
+ if ( cur_el == 0 ) {
/* We are at an external element and did not find the key we were
* looking for. Attach underneath the leaf and rebalance. */
- mapAttachRebal( map, element, parentEl, lastLess );
+ map_attach_rebal( map, element, parent_el, last_less );
- if ( lastFound != 0 )
- *lastFound = element;
+ if ( last_found != 0 )
+ *last_found = element;
return element;
}
- keyRelation = map_cmp( prg, map,
- element->key, curEl->key );
+ key_relation = map_cmp( prg, map,
+ element->key, cur_el->key );
/* Do we go left? */
- if ( keyRelation < 0 ) {
- parentEl = lastLess = curEl;
- curEl = curEl->left;
+ if ( key_relation < 0 ) {
+ parent_el = last_less = cur_el;
+ cur_el = cur_el->left;
}
/* Do we go right? */
- else if ( keyRelation > 0 ) {
- parentEl = curEl;
- curEl = curEl->right;
+ else if ( key_relation > 0 ) {
+ parent_el = cur_el;
+ cur_el = cur_el->right;
}
/* We have hit the target. */
else {
- if ( lastFound != 0 )
- *lastFound = curEl;
+ if ( last_found != 0 )
+ *last_found = cur_el;
return 0;
}
}
}
#if 0
-map_el_t *mapInsertKey( program_t *prg, map_t *map, tree_t *key, map_el_t **lastFound )
+map_el_t *map_insert_key( program_t *prg, map_t *map, tree_t *key, map_el_t **last_found )
{
- long keyRelation;
- map_el_t *curEl = map->root, *parentEl = 0;
- map_el_t *lastLess = 0;
+ long key_relation;
+ map_el_t *cur_el = map->root, *parent_el = 0;
+ map_el_t *last_less = 0;
while ( true ) {
- if ( curEl == 0 ) {
+ if ( cur_el == 0 ) {
/* We are at an external element and did not find the key we were
* looking for. Create the new element, attach it underneath the leaf
* and rebalance. */
- map_el_t *element = mapElAllocate( prg );
+ map_el_t *element = map_el_allocate( prg );
element->key = key;
- mapAttachRebal( map, element, parentEl, lastLess );
+ map_attach_rebal( map, element, parent_el, last_less );
- if ( lastFound != 0 )
- *lastFound = element;
+ if ( last_found != 0 )
+ *last_found = element;
return element;
}
- keyRelation = map_cmp( prg, map, key, curEl->key );
+ key_relation = map_cmp( prg, map, key, cur_el->key );
/* Do we go left? */
- if ( keyRelation < 0 ) {
- parentEl = lastLess = curEl;
- curEl = curEl->left;
+ if ( key_relation < 0 ) {
+ parent_el = last_less = cur_el;
+ cur_el = cur_el->left;
}
/* Do we go right? */
- else if ( keyRelation > 0 ) {
- parentEl = curEl;
- curEl = curEl->right;
+ else if ( key_relation > 0 ) {
+ parent_el = cur_el;
+ cur_el = cur_el->right;
}
/* We have hit the target. */
else {
- if ( lastFound != 0 )
- *lastFound = curEl;
+ if ( last_found != 0 )
+ *last_found = cur_el;
return 0;
}
}
}
#endif
-map_el_t *colm_map_insert( program_t *prg, map_t *map, map_el_t *mapEl )
+map_el_t *colm_map_insert( program_t *prg, map_t *map, map_el_t *map_el )
{
- return mapInsertEl( prg, map, mapEl, 0 );
+ return map_insert_el( prg, map, map_el, 0 );
}
map_el_t *colm_vmap_insert( program_t *prg, map_t *map, struct_t *key, struct_t *value )
{
- struct colm_struct *s = colm_struct_new( prg, map->genericInfo->elStructId );
+ struct colm_struct *s = colm_struct_new( prg, map->generic_info->el_struct_id );
- colm_struct_set_field( s, struct_t*, map->genericInfo->elOffset, key );
+ colm_struct_set_field( s, struct_t*, map->generic_info->el_offset, key );
colm_struct_set_field( s, struct_t*, 0, value );
- map_el_t *mapEl = colm_struct_get_addr( s, map_el_t*, map->genericInfo->elOffset );
+ map_el_t *map_el = colm_struct_get_addr( s, map_el_t*, map->generic_info->el_offset );
- colm_map_insert( prg, map, mapEl );
+ colm_map_insert( prg, map, map_el );
return 0;
}
map_el_t *colm_vmap_remove( program_t *prg, map_t *map, tree_t *key )
{
- map_el_t *mapEl = colm_map_find( prg, map, key );
- if ( mapEl != 0 )
- colm_map_detach( prg, map, mapEl );
+ map_el_t *map_el = colm_map_find( prg, map, key );
+ if ( map_el != 0 )
+ colm_map_detach( prg, map, map_el );
return 0;
}
tree_t *colm_vmap_find( program_t *prg, map_t *map, tree_t *key )
{
- map_el_t *mapEl = colm_map_find( prg, map, key );
- if ( mapEl != 0 ) {
- struct_t *s = colm_generic_el_container( prg, mapEl,
- map->genericInfo - prg->rtd->genericInfo );
+ map_el_t *map_el = colm_map_find( prg, map, key );
+ if ( map_el != 0 ) {
+ struct_t *s = colm_generic_el_container( prg, map_el,
+ map->generic_info - prg->rtd->generic_info );
tree_t *val = colm_struct_get_field( s, tree_t*, 0 );
- if ( map->genericInfo->valueType == TYPE_TREE )
+ if ( map->generic_info->value_type == TYPE_TREE )
colm_tree_upref( val );
return val;
@@ -693,14 +693,14 @@ tree_t *colm_vmap_find( program_t *prg, map_t *map, tree_t *key )
return 0;
}
-void colm_map_detach( program_t *prg, map_t *map, map_el_t *mapEl )
+void colm_map_detach( program_t *prg, map_t *map, map_el_t *map_el )
{
- mapDetach( prg, map, mapEl );
+ map_detach( prg, map, map_el );
}
map_el_t *colm_map_find( program_t *prg, map_t *map, tree_t *key )
{
- return mapImplFind( prg, map, key );
+ return map_impl_find( prg, map, key );
}
/**
@@ -708,23 +708,23 @@ map_el_t *colm_map_find( program_t *prg, map_t *map, tree_t *key )
*
* \returns The element if key exists, null if the key does not exist.
*/
-map_el_t *mapImplFind( program_t *prg, map_t *map, tree_t *key )
+map_el_t *map_impl_find( program_t *prg, map_t *map, tree_t *key )
{
- map_el_t *curEl = map->root;
- long keyRelation;
+ map_el_t *cur_el = map->root;
+ long key_relation;
- while ( curEl != 0 ) {
- keyRelation = map_cmp( prg, map, key, curEl->key );
+ while ( cur_el != 0 ) {
+ key_relation = map_cmp( prg, map, key, cur_el->key );
/* Do we go left? */
- if ( keyRelation < 0 )
- curEl = curEl->left;
+ if ( key_relation < 0 )
+ cur_el = cur_el->left;
/* Do we go right? */
- else if ( keyRelation > 0 )
- curEl = curEl->right;
+ else if ( key_relation > 0 )
+ cur_el = cur_el->right;
/* We have hit the target. */
else {
- return curEl;
+ return cur_el;
}
}
return 0;
@@ -738,11 +738,11 @@ map_el_t *mapImplFind( program_t *prg, map_t *map, tree_t *key )
*
* \returns The element detached if the key is found, othewise returns null.
*/
-map_el_t *mapDetachByKey( program_t *prg, map_t *map, tree_t *key )
+map_el_t *map_detach_by_key( program_t *prg, map_t *map, tree_t *key )
{
- map_el_t *element = mapImplFind( prg, map, key );
+ map_el_t *element = map_impl_find( prg, map, key );
if ( element )
- mapDetach( prg, map, element );
+ map_detach( prg, map, element );
return element;
}
@@ -754,16 +754,16 @@ map_el_t *mapDetachByKey( program_t *prg, map_t *map, tree_t *key )
*
* \returns The element given.
*/
-map_el_t *mapDetach( program_t *prg, map_t *map, map_el_t *element )
+map_el_t *map_detach( program_t *prg, map_t *map, map_el_t *element )
{
map_el_t *replacement, *fixfrom;
long lheight, rheight;
/* Remove the element from the ordered list. */
- mapListDetach( map, element );
+ map_list_detach( map, element );
/* Update treeSize. */
- map->treeSize--;
+ map->tree_size--;
/* Find a replacement element. */
if (element->right)
@@ -781,8 +781,8 @@ map_el_t *mapDetach( program_t *prg, map_t *map, map_el_t *element )
else
fixfrom = replacement->parent;
- mapRemoveEl( map, replacement, replacement->right );
- mapReplaceEl( map, element, replacement );
+ map_remove_el( map, replacement, replacement->right );
+ map_replace_el( map, element, replacement );
}
else if (element->left)
{
@@ -799,8 +799,8 @@ map_el_t *mapDetach( program_t *prg, map_t *map, map_el_t *element )
else
fixfrom = replacement->parent;
- mapRemoveEl( map, replacement, replacement->left );
- mapReplaceEl( map, element, replacement );
+ map_remove_el( map, replacement, replacement->left );
+ map_replace_el( map, element, replacement );
}
else
{
@@ -808,7 +808,7 @@ map_el_t *mapDetach( program_t *prg, map_t *map, map_el_t *element )
fixfrom = element->parent;
/* The element we are deleting is a leaf element. */
- mapRemoveEl( map, element, 0 );
+ map_remove_el( map, element, 0 );
}
/* If fixfrom is null it means we just deleted
@@ -817,10 +817,10 @@ map_el_t *mapDetach( program_t *prg, map_t *map, map_el_t *element )
return element;
/* Fix the heights after the deletion. */
- mapRecalcHeights( map, fixfrom );
+ map_recalc_heights( map, fixfrom );
/* Fix every unbalanced element going up in the tree. */
- map_el_t *ub = mapFindFirstUnbalEl( map, fixfrom );
+ map_el_t *ub = map_find_first_unbal_el( map, fixfrom );
while ( ub )
{
/* Find the element to rebalance by moving down from the first unbalanced
@@ -863,10 +863,10 @@ map_el_t *mapDetach( program_t *prg, map_t *map, map_el_t *element )
/* rebalance returns the grandparant of the subtree formed
* by the element that were rebalanced.
* We must continue upward from there rebalancing. */
- fixfrom = mapRebalance( map, ub );
+ fixfrom = map_rebalance( map, ub );
/* Find the next unbalaced element. */
- ub = mapFindFirstUnbalEl( map, fixfrom );
+ ub = map_find_first_unbal_el( map, fixfrom );
}
return element;
diff --git a/src/map.h b/src/map.h
index b3a23671..737a4de7 100644
--- a/src/map.h
+++ b/src/map.h
@@ -30,45 +30,45 @@ extern "C" {
#include <colm/struct.h>
#include "internal.h"
-void mapListAbandon( map_t *map );
+void map_list_abandon( map_t *map );
-void mapListAddBefore( map_t *map, map_el_t *next_el, map_el_t *new_el );
-void mapListAddAfter( map_t *map, map_el_t *prev_el, map_el_t *new_el );
-map_el_t *mapListDetach( map_t *map, map_el_t *el );
-void mapAttachRebal( map_t *map, map_el_t *element, map_el_t *parentEl, map_el_t *lastLess );
-void mapDeleteChildrenOf( map_t *map, map_el_t *element );
-void mapEmpty( map_t *map );
-map_el_t *mapRebalance( map_t *map, map_el_t *n );
-void mapRecalcHeights( map_t *map, map_el_t *element );
+void map_list_add_before( map_t *map, map_el_t *next_el, map_el_t *new_el );
+void map_list_add_after( map_t *map, map_el_t *prev_el, map_el_t *new_el );
+map_el_t *map_list_detach( map_t *map, map_el_t *el );
+void map_attach_rebal( map_t *map, map_el_t *element, map_el_t *parent_el, map_el_t *last_less );
+void map_delete_children_of( map_t *map, map_el_t *element );
+void map_empty( map_t *map );
+map_el_t *map_rebalance( map_t *map, map_el_t *n );
+void map_recalc_heights( map_t *map, map_el_t *element );
map_el_t *mapFindFirstUnbalGP( map_t *map, map_el_t *element );
-map_el_t *mapFindFirstUnbalEl( map_t *map, map_el_t *element );
-void mapRemoveEl( map_t *map, map_el_t *element, map_el_t *filler );
-void mapReplaceEl( map_t *map, map_el_t *element, map_el_t *replacement );
-map_el_t *mapInsertEl( program_t *prg, map_t *map, map_el_t *element, map_el_t **lastFound );
-map_el_t *mapInsertKey( program_t *prg, map_t *map, tree_t *key, map_el_t **lastFound );
-map_el_t *mapImplFind( program_t *prg, map_t *map, tree_t *key );
-map_el_t *mapDetachByKey( program_t *prg, map_t *map, tree_t *key );
-map_el_t *mapDetach( program_t *prg, map_t *map, map_el_t *element );
-map_el_t *mapCopyBranch( program_t *prg, map_t *map, map_el_t *el,
- kid_t *oldNextDown, kid_t **newNextDown );
+map_el_t *map_find_first_unbal_el( map_t *map, map_el_t *element );
+void map_remove_el( map_t *map, map_el_t *element, map_el_t *filler );
+void map_replace_el( map_t *map, map_el_t *element, map_el_t *replacement );
+map_el_t *map_insert_el( program_t *prg, map_t *map, map_el_t *element, map_el_t **last_found );
+map_el_t *map_insert_key( program_t *prg, map_t *map, tree_t *key, map_el_t **last_found );
+map_el_t *map_impl_find( program_t *prg, map_t *map, tree_t *key );
+map_el_t *map_detach_by_key( program_t *prg, map_t *map, tree_t *key );
+map_el_t *map_detach( program_t *prg, map_t *map, map_el_t *element );
+map_el_t *map_copy_branch( program_t *prg, map_t *map, map_el_t *el,
+ kid_t *old_next_down, kid_t **new_next_down );
-struct tree_pair mapRemove( program_t *prg, map_t *map, tree_t *key );
+struct tree_pair map_remove( program_t *prg, map_t *map, tree_t *key );
-long cmpTree( program_t *prg, const tree_t *tree1, const tree_t *tree2 );
+long cmp_tree( program_t *prg, const tree_t *tree1, const tree_t *tree2 );
-void mapImplRemoveEl( program_t *prg, map_t *map, map_el_t *element );
-int mapImplRemoveKey( program_t *prg, map_t *map, tree_t *key );
+void map_impl_remove_el( program_t *prg, map_t *map, map_el_t *element );
+int map_impl_remove_key( program_t *prg, map_t *map, tree_t *key );
-tree_t *mapFind( program_t *prg, map_t *map, tree_t *key );
-long mapLength( map_t *map );
-tree_t *mapUnstore( program_t *prg, map_t *map, tree_t *key, tree_t *existing );
-int mapInsert( program_t *prg, map_t *map, tree_t *key, tree_t *element );
-void mapUnremove( program_t *prg, map_t *map, tree_t *key, tree_t *element );
-tree_t *mapUninsert( program_t *prg, map_t *map, tree_t *key );
-tree_t *mapStore( program_t *prg, map_t *map, tree_t *key, tree_t *element );
+tree_t *map_find( program_t *prg, map_t *map, tree_t *key );
+long map_length( map_t *map );
+tree_t *map_unstore( program_t *prg, map_t *map, tree_t *key, tree_t *existing );
+int map_insert( program_t *prg, map_t *map, tree_t *key, tree_t *element );
+void map_unremove( program_t *prg, map_t *map, tree_t *key, tree_t *element );
+tree_t *map_uninsert( program_t *prg, map_t *map, tree_t *key );
+tree_t *map_store( program_t *prg, map_t *map, tree_t *key, tree_t *element );
-map_el_t *colm_map_insert( program_t *prg, map_t *map, map_el_t *mapEl );
-void colm_map_detach( program_t *prg, map_t *map, map_el_t *mapEl );
+map_el_t *colm_map_insert( program_t *prg, map_t *map, map_el_t *map_el );
+void colm_map_detach( program_t *prg, map_t *map, map_el_t *map_el );
map_el_t *colm_map_find( program_t *prg, map_t *map, tree_t *key );
map_el_t *colm_vmap_insert( program_t *prg, map_t *map, struct_t *key, struct_t *value );
diff --git a/src/pdabuild.cc b/src/pdabuild.cc
index 6362542c..f360c3b2 100644
--- a/src/pdabuild.cc
+++ b/src/pdabuild.cc
@@ -1332,102 +1332,102 @@ void Compiler::makeRuntimeData()
* ProdCodeBlockLens
*/
- runtimeData->frameInfo = new frame_info[nextFrameId];
- runtimeData->numFrames = nextFrameId;
- memset( runtimeData->frameInfo, 0, sizeof(struct frame_info) * nextFrameId );
+ runtimeData->frame_info = new frame_info[nextFrameId];
+ runtimeData->num_frames = nextFrameId;
+ memset( runtimeData->frame_info, 0, sizeof(struct frame_info) * nextFrameId );
/*
* Init code block.
*/
if ( rootCodeBlock == 0 ) {
- runtimeData->rootCode = 0;
- runtimeData->rootCodeLen = 0;
- runtimeData->rootFrameId = 0;
+ runtimeData->root_code = 0;
+ runtimeData->root_code_len = 0;
+ runtimeData->root_frame_id = 0;
}
else {
- runtimeData->rootCode = rootCodeBlock->codeWC.data;
- runtimeData->rootCodeLen = rootCodeBlock->codeWC.length();
- runtimeData->rootFrameId = rootCodeBlock->frameId;
+ runtimeData->root_code = rootCodeBlock->codeWC.data;
+ runtimeData->root_code_len = rootCodeBlock->codeWC.length();
+ runtimeData->root_frame_id = rootCodeBlock->frameId;
}
- runtimeData->frameInfo[rootCodeBlock->frameId].codeWV = 0;
- runtimeData->frameInfo[rootCodeBlock->frameId].codeLenWV = 0;
+ runtimeData->frame_info[rootCodeBlock->frameId].codeWV = 0;
+ runtimeData->frame_info[rootCodeBlock->frameId].codeLenWV = 0;
- runtimeData->frameInfo[rootCodeBlock->frameId].locals = makeLocalInfo( rootCodeBlock->locals );
- runtimeData->frameInfo[rootCodeBlock->frameId].localsLen = rootCodeBlock->locals.locals.length();
+ runtimeData->frame_info[rootCodeBlock->frameId].locals = makeLocalInfo( rootCodeBlock->locals );
+ runtimeData->frame_info[rootCodeBlock->frameId].locals_len = rootCodeBlock->locals.locals.length();
- runtimeData->frameInfo[rootCodeBlock->frameId].frameSize = rootLocalFrame->size();
- runtimeData->frameInfo[rootCodeBlock->frameId].argSize = 0;
- runtimeData->frameInfo[rootCodeBlock->frameId].retTree = false;
+ runtimeData->frame_info[rootCodeBlock->frameId].frame_size = rootLocalFrame->size();
+ runtimeData->frame_info[rootCodeBlock->frameId].arg_size = 0;
+ runtimeData->frame_info[rootCodeBlock->frameId].ret_tree = false;
/*
* prodInfo
*/
count = prodList.length();
- runtimeData->prodInfo = new prod_info[count];
- runtimeData->numProds = count;
+ runtimeData->prod_info = new prod_info[count];
+ runtimeData->num_prods = count;
count = 0;
for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) {
- runtimeData->prodInfo[count].lhsId = prod->prodName->id;
- runtimeData->prodInfo[count].prodNum = prod->prodNum;
- runtimeData->prodInfo[count].length = prod->fsmLength;
- runtimeData->prodInfo[count].name = prod->data;
- runtimeData->prodInfo[count].frameId = -1;
+ runtimeData->prod_info[count].lhs_id = prod->prodName->id;
+ runtimeData->prod_info[count].prod_num = prod->prodNum;
+ runtimeData->prod_info[count].length = prod->fsmLength;
+ runtimeData->prod_info[count].name = prod->data;
+ runtimeData->prod_info[count].frame_id = -1;
CodeBlock *block = prod->redBlock;
if ( block != 0 ) {
- runtimeData->prodInfo[count].frameId = block->frameId;
- runtimeData->frameInfo[block->frameId].codeWV = block->codeWV.data;
- runtimeData->frameInfo[block->frameId].codeLenWV = block->codeWV.length();
+ runtimeData->prod_info[count].frame_id = block->frameId;
+ runtimeData->frame_info[block->frameId].codeWV = block->codeWV.data;
+ runtimeData->frame_info[block->frameId].codeLenWV = block->codeWV.length();
- runtimeData->frameInfo[block->frameId].locals = makeLocalInfo( block->locals );
- runtimeData->frameInfo[block->frameId].localsLen = block->locals.locals.length();
+ runtimeData->frame_info[block->frameId].locals = makeLocalInfo( block->locals );
+ runtimeData->frame_info[block->frameId].locals_len = block->locals.locals.length();
- runtimeData->frameInfo[block->frameId].frameSize = block->localFrame->size();
- runtimeData->frameInfo[block->frameId].argSize = 0;
- runtimeData->frameInfo[block->frameId].retTree = false;
+ runtimeData->frame_info[block->frameId].frame_size = block->localFrame->size();
+ runtimeData->frame_info[block->frameId].arg_size = 0;
+ runtimeData->frame_info[block->frameId].ret_tree = false;
}
- runtimeData->prodInfo[count].lhsUpref = true;
- runtimeData->prodInfo[count].copy = prod->copy.data;
- runtimeData->prodInfo[count].copyLen = prod->copy.length() / 2;
+ runtimeData->prod_info[count].lhs_upref = true;
+ runtimeData->prod_info[count].copy = prod->copy.data;
+ runtimeData->prod_info[count].copy_len = prod->copy.length() / 2;
count += 1;
}
/*
* regionInfo
*/
- runtimeData->numRegions = regionList.length()+1;
- runtimeData->regionInfo = new region_info[runtimeData->numRegions];
- memset( runtimeData->regionInfo, 0,
- sizeof(struct region_info) * runtimeData->numRegions );
+ runtimeData->num_regions = regionList.length()+1;
+ runtimeData->region_info = new region_info[runtimeData->num_regions];
+ memset( runtimeData->region_info, 0,
+ sizeof(struct region_info) * runtimeData->num_regions );
- runtimeData->regionInfo[0].defaultToken = -1;
- runtimeData->regionInfo[0].eofFrameId = -1;
- runtimeData->regionInfo[0].ciLelId = 0;
+ runtimeData->region_info[0].default_token = -1;
+ runtimeData->region_info[0].eof_frame_id = -1;
+ runtimeData->region_info[0].ci_lel_id = 0;
for ( RegionList::Iter reg = regionList; reg.lte(); reg++ ) {
long regId = reg->id+1;
- runtimeData->regionInfo[regId].defaultToken =
+ runtimeData->region_info[regId].default_token =
reg->impl->defaultTokenInstance == 0 ?
-1 :
reg->impl->defaultTokenInstance->tokenDef->tdLangEl->id;
- runtimeData->regionInfo[regId].eofFrameId = -1;
- runtimeData->regionInfo[regId].ciLelId = reg->zeroLel != 0 ? reg->zeroLel->id : 0;
+ runtimeData->region_info[regId].eof_frame_id = -1;
+ runtimeData->region_info[regId].ci_lel_id = reg->zeroLel != 0 ? reg->zeroLel->id : 0;
CodeBlock *block = reg->preEofBlock;
if ( block != 0 ) {
- runtimeData->regionInfo[regId].eofFrameId = block->frameId;
- runtimeData->frameInfo[block->frameId].codeWV = block->codeWV.data;
- runtimeData->frameInfo[block->frameId].codeLenWV = block->codeWV.length();
+ runtimeData->region_info[regId].eof_frame_id = block->frameId;
+ runtimeData->frame_info[block->frameId].codeWV = block->codeWV.data;
+ runtimeData->frame_info[block->frameId].codeLenWV = block->codeWV.length();
- runtimeData->frameInfo[block->frameId].locals = makeLocalInfo( block->locals );
- runtimeData->frameInfo[block->frameId].localsLen = block->locals.locals.length();
+ runtimeData->frame_info[block->frameId].locals = makeLocalInfo( block->locals );
+ runtimeData->frame_info[block->frameId].locals_len = block->locals.locals.length();
- runtimeData->frameInfo[block->frameId].frameSize = block->localFrame->size();
- runtimeData->frameInfo[block->frameId].argSize = 0;
- runtimeData->frameInfo[block->frameId].retTree = false;
+ runtimeData->frame_info[block->frameId].frame_size = block->localFrame->size();
+ runtimeData->frame_info[block->frameId].arg_size = 0;
+ runtimeData->frame_info[block->frameId].ret_tree = false;
}
}
@@ -1436,39 +1436,39 @@ void Compiler::makeRuntimeData()
*/
count = nextSymbolId;
- runtimeData->lelInfo = new lang_el_info[count];
- runtimeData->numLangEls = count;
- memset( runtimeData->lelInfo, 0, sizeof(struct lang_el_info)*count );
+ runtimeData->lel_info = new lang_el_info[count];
+ runtimeData->num_lang_els = count;
+ memset( runtimeData->lel_info, 0, sizeof(struct lang_el_info)*count );
for ( int i = 0; i < nextSymbolId; i++ ) {
LangEl *lel = langElIndex[i];
if ( lel != 0 ) {
- runtimeData->lelInfo[i].name = lel->fullLit;
- runtimeData->lelInfo[i].xmlTag = lel->xmlTag;
- runtimeData->lelInfo[i].repeat = lel->isRepeat;
- runtimeData->lelInfo[i].list = lel->isList;
- runtimeData->lelInfo[i].literal = lel->isLiteral;
- runtimeData->lelInfo[i].ignore = lel->isIgnore;
- runtimeData->lelInfo[i].frameId = -1;
+ runtimeData->lel_info[i].name = lel->fullLit;
+ runtimeData->lel_info[i].xml_tag = lel->xmlTag;
+ runtimeData->lel_info[i].repeat = lel->isRepeat;
+ runtimeData->lel_info[i].list = lel->isList;
+ runtimeData->lel_info[i].literal = lel->isLiteral;
+ runtimeData->lel_info[i].ignore = lel->isIgnore;
+ runtimeData->lel_info[i].frame_id = -1;
CodeBlock *block = lel->transBlock;
if ( block != 0 ) {
- runtimeData->lelInfo[i].frameId = block->frameId;
- runtimeData->frameInfo[block->frameId].codeWV = block->codeWV.data;
- runtimeData->frameInfo[block->frameId].codeLenWV = block->codeWV.length();
+ runtimeData->lel_info[i].frame_id = block->frameId;
+ runtimeData->frame_info[block->frameId].codeWV = block->codeWV.data;
+ runtimeData->frame_info[block->frameId].codeLenWV = block->codeWV.length();
- runtimeData->frameInfo[block->frameId].locals = makeLocalInfo( block->locals );
- runtimeData->frameInfo[block->frameId].localsLen = block->locals.locals.length();
+ runtimeData->frame_info[block->frameId].locals = makeLocalInfo( block->locals );
+ runtimeData->frame_info[block->frameId].locals_len = block->locals.locals.length();
- runtimeData->frameInfo[block->frameId].frameSize = block->localFrame->size();
- runtimeData->frameInfo[block->frameId].argSize = 0;
- runtimeData->frameInfo[block->frameId].retTree = false;
+ runtimeData->frame_info[block->frameId].frame_size = block->localFrame->size();
+ runtimeData->frame_info[block->frameId].arg_size = 0;
+ runtimeData->frame_info[block->frameId].ret_tree = false;
}
- runtimeData->lelInfo[i].objectTypeId =
+ runtimeData->lel_info[i].object_type_id =
lel->objectDef == 0 ? 0 : lel->objectDef->id;
- runtimeData->lelInfo[i].ofiOffset = lel->ofiOffset;
- runtimeData->lelInfo[i].objectLength =
+ runtimeData->lel_info[i].ofi_offset = lel->ofiOffset;
+ runtimeData->lel_info[i].object_length =
lel->objectDef != 0 ? lel->objectDef->size() : 0;
// runtimeData->lelInfo[i].contextTypeId = 0;
@@ -1480,21 +1480,21 @@ void Compiler::makeRuntimeData()
// runtimeData->lelInfo[i].contextLength << endl;
// }
- runtimeData->lelInfo[i].termDupId = lel->termDup == 0 ? 0 : lel->termDup->id;
+ runtimeData->lel_info[i].term_dup_id = lel->termDup == 0 ? 0 : lel->termDup->id;
if ( lel->tokenDef != 0 && lel->tokenDef->join != 0 &&
lel->tokenDef->join->context != 0 )
- runtimeData->lelInfo[i].markId = lel->tokenDef->join->mark->markId;
+ runtimeData->lel_info[i].mark_id = lel->tokenDef->join->mark->markId;
else
- runtimeData->lelInfo[i].markId = -1;
+ runtimeData->lel_info[i].mark_id = -1;
- runtimeData->lelInfo[i].numCaptureAttr = 0;
+ runtimeData->lel_info[i].num_capture_attr = 0;
}
else {
- memset(&runtimeData->lelInfo[i], 0, sizeof(struct lang_el_info) );
- runtimeData->lelInfo[i].name = "__UNUSED";
- runtimeData->lelInfo[i].xmlTag = "__UNUSED";
- runtimeData->lelInfo[i].frameId = -1;
+ memset(&runtimeData->lel_info[i], 0, sizeof(struct lang_el_info) );
+ runtimeData->lel_info[i].name = "__UNUSED";
+ runtimeData->lel_info[i].xml_tag = "__UNUSED";
+ runtimeData->lel_info[i].frame_id = -1;
}
}
@@ -1503,15 +1503,15 @@ void Compiler::makeRuntimeData()
*/
count = structEls.length();
- runtimeData->selInfo = new struct_el_info[count];
- runtimeData->numStructEls = count;
- memset( runtimeData->selInfo, 0, sizeof(struct struct_el_info)*count );
+ runtimeData->sel_info = new struct_el_info[count];
+ runtimeData->num_struct_els = count;
+ memset( runtimeData->sel_info, 0, sizeof(struct struct_el_info)*count );
StructElList::Iter sel = structEls;
for ( int i = 0; i < count; i++, sel++ ) {
int treesLen;
- runtimeData->selInfo[i].size = sel->structDef->objectDef->size();
- runtimeData->selInfo[i].trees = makeTrees( sel->structDef->objectDef, treesLen );
- runtimeData->selInfo[i].treesLen = treesLen;
+ runtimeData->sel_info[i].size = sel->structDef->objectDef->size();
+ runtimeData->sel_info[i].trees = makeTrees( sel->structDef->objectDef, treesLen );
+ runtimeData->sel_info[i].trees_len = treesLen;
}
/*
@@ -1519,44 +1519,44 @@ void Compiler::makeRuntimeData()
*/
count = functionList.length();
- runtimeData->functionInfo = new function_info[count];
- runtimeData->numFunctions = count;
- memset( runtimeData->functionInfo, 0, sizeof(struct function_info)*count );
+ runtimeData->function_info = new function_info[count];
+ runtimeData->num_functions = count;
+ memset( runtimeData->function_info, 0, sizeof(struct function_info)*count );
for ( FunctionList::Iter func = functionList; func.lte(); func++ ) {
- runtimeData->functionInfo[func->funcId].frameId = -1;
+ runtimeData->function_info[func->funcId].frame_id = -1;
CodeBlock *block = func->codeBlock;
if ( block != 0 ) {
- runtimeData->functionInfo[func->funcId].frameId = block->frameId;
+ runtimeData->function_info[func->funcId].frame_id = block->frameId;
/* Name. */
- runtimeData->frameInfo[block->frameId].name = func->name;
+ runtimeData->frame_info[block->frameId].name = func->name;
/* Code. */
- runtimeData->frameInfo[block->frameId].codeWV = block->codeWV.data;
- runtimeData->frameInfo[block->frameId].codeLenWV = block->codeWV.length();
- runtimeData->frameInfo[block->frameId].codeWC = block->codeWC.data;
- runtimeData->frameInfo[block->frameId].codeLenWC = block->codeWC.length();
+ runtimeData->frame_info[block->frameId].codeWV = block->codeWV.data;
+ runtimeData->frame_info[block->frameId].codeLenWV = block->codeWV.length();
+ runtimeData->frame_info[block->frameId].codeWC = block->codeWC.data;
+ runtimeData->frame_info[block->frameId].codeLenWC = block->codeWC.length();
/* Locals. */
- runtimeData->frameInfo[block->frameId].locals = makeLocalInfo( block->locals );
- runtimeData->frameInfo[block->frameId].localsLen = block->locals.locals.length();
+ runtimeData->frame_info[block->frameId].locals = makeLocalInfo( block->locals );
+ runtimeData->frame_info[block->frameId].locals_len = block->locals.locals.length();
/* Meta. */
- runtimeData->frameInfo[block->frameId].frameSize = func->localFrame->size();
- runtimeData->frameInfo[block->frameId].argSize = func->paramListSize;
+ runtimeData->frame_info[block->frameId].frame_size = func->localFrame->size();
+ runtimeData->frame_info[block->frameId].arg_size = func->paramListSize;
bool retTree = false;
if ( func->typeRef ) {
UniqueType *ut = func->typeRef->resolveType( this );
retTree = ut->tree();
}
- runtimeData->frameInfo[block->frameId].retTree = retTree;
+ runtimeData->frame_info[block->frameId].ret_tree = retTree;
}
- runtimeData->functionInfo[func->funcId].frameSize = func->localFrame->size();
- runtimeData->functionInfo[func->funcId].argSize = func->paramListSize;
+ runtimeData->function_info[func->funcId].frame_size = func->localFrame->size();
+ runtimeData->function_info[func->funcId].arg_size = func->paramListSize;
}
/*
@@ -1564,11 +1564,11 @@ void Compiler::makeRuntimeData()
*/
/* Filled in later after patterns are parsed. */
- runtimeData->patReplInfo = new pat_cons_info[nextPatConsId];
- memset( runtimeData->patReplInfo, 0, sizeof(struct pat_cons_info) * nextPatConsId );
- runtimeData->numPatterns = nextPatConsId;
- runtimeData->patReplNodes = 0;
- runtimeData->numPatternNodes = 0;
+ runtimeData->pat_repl_info = new pat_cons_info[nextPatConsId];
+ memset( runtimeData->pat_repl_info, 0, sizeof(struct pat_cons_info) * nextPatConsId );
+ runtimeData->num_patterns = nextPatConsId;
+ runtimeData->pat_repl_nodes = 0;
+ runtimeData->num_pattern_nodes = 0;
/*
@@ -1579,40 +1579,40 @@ void Compiler::makeRuntimeData()
count += nspace->genericList.length();
assert( count == nextGenericId );
- runtimeData->genericInfo = new generic_info[count];
- runtimeData->numGenerics = count;
- memset( &runtimeData->genericInfo[0], 0, sizeof(struct generic_info) );
+ runtimeData->generic_info = new generic_info[count];
+ runtimeData->num_generics = count;
+ memset( &runtimeData->generic_info[0], 0, sizeof(struct generic_info) );
for ( NamespaceList::Iter nspace = namespaceList; nspace.lte(); nspace++ ) {
for ( GenericList::Iter gen = nspace->genericList; gen.lte(); gen++ ) {
- runtimeData->genericInfo[gen->id].type = gen->typeId;
+ runtimeData->generic_info[gen->id].type = gen->typeId;
- runtimeData->genericInfo[gen->id].elType =
+ runtimeData->generic_info[gen->id].el_type =
gen->elUt->typeId;
- runtimeData->genericInfo[gen->id].elStructId =
+ runtimeData->generic_info[gen->id].el_struct_id =
( gen->typeId == GEN_VMAP || gen->typeId == GEN_VLIST ) ?
gen->elUt->structEl->id : -1;
- runtimeData->genericInfo[gen->id].elOffset =
+ runtimeData->generic_info[gen->id].el_offset =
gen->el != 0 ? gen->el->offset : -1;
- runtimeData->genericInfo[gen->id].keyType =
+ runtimeData->generic_info[gen->id].key_type =
gen->keyUt != 0 ? gen->keyUt->typeId : TYPE_NOTYPE;
- runtimeData->genericInfo[gen->id].keyOffset = 0;
+ runtimeData->generic_info[gen->id].key_offset = 0;
- runtimeData->genericInfo[gen->id].valueType =
+ runtimeData->generic_info[gen->id].value_type =
gen->valueUt != 0 ? gen->valueUt->typeId : TYPE_NOTYPE;
- runtimeData->genericInfo[gen->id].valueOffset = 0;
+ runtimeData->generic_info[gen->id].value_offset = 0;
- runtimeData->genericInfo[gen->id].parserId =
+ runtimeData->generic_info[gen->id].parser_id =
gen->typeId == GEN_PARSER ? gen->elUt->langEl->parserId : -1;
}
}
- runtimeData->argvGenericId = argvTypeRef->generic->id;
+ runtimeData->argv_generic_id = argvTypeRef->generic->id;
/*
* Literals
*/
- runtimeData->numLiterals = literalStrings.length();
+ runtimeData->num_literals = literalStrings.length();
runtimeData->litdata = new const char *[literalStrings.length()];
runtimeData->litlen = new long [literalStrings.length()];
runtimeData->literals = 0;
@@ -1633,9 +1633,9 @@ void Compiler::makeRuntimeData()
// for ( TokenInstanceListReg::Iter td = reg->tokenInstanceList; td.lte(); td++ )
// numCapturedAttr += td->reCaptureVect.length();
// }
- runtimeData->captureAttr = new CaptureAttr[numCapturedAttr];
- runtimeData->numCapturedAttr = numCapturedAttr;
- memset( runtimeData->captureAttr, 0, sizeof( CaptureAttr ) * numCapturedAttr );
+ runtimeData->capture_attr = new CaptureAttr[numCapturedAttr];
+ runtimeData->num_captured_attr = numCapturedAttr;
+ memset( runtimeData->capture_attr, 0, sizeof( CaptureAttr ) * numCapturedAttr );
count = 0;
// for ( RegionList::Iter reg = regionList; reg.lte(); reg++ ) {
@@ -1652,42 +1652,42 @@ void Compiler::makeRuntimeData()
// }
// }
- runtimeData->fsmTables = fsmTables;
- runtimeData->pdaTables = pdaTables;
+ runtimeData->fsm_tables = fsmTables;
+ runtimeData->pda_tables = pdaTables;
/* FIXME: need a parser descriptor. */
- runtimeData->startStates = new int[nextParserId];
- runtimeData->eofLelIds = new int[nextParserId];
- runtimeData->parserLelIds = new int[nextParserId];
- runtimeData->numParsers = nextParserId;
+ runtimeData->start_states = new int[nextParserId];
+ runtimeData->eof_lel_ids = new int[nextParserId];
+ runtimeData->parser_lel_ids = new int[nextParserId];
+ runtimeData->num_parsers = nextParserId;
for ( LelList::Iter lel = langEls; lel.lte(); lel++ ) {
if ( lel->parserId >= 0 ) {
- runtimeData->startStates[lel->parserId] = lel->startState->stateNum;
- runtimeData->eofLelIds[lel->parserId] = lel->eofLel->id;
- runtimeData->parserLelIds[lel->parserId] = lel->id;
+ runtimeData->start_states[lel->parserId] = lel->startState->stateNum;
+ runtimeData->eof_lel_ids[lel->parserId] = lel->eofLel->id;
+ runtimeData->parser_lel_ids[lel->parserId] = lel->id;
}
}
- runtimeData->globalSize = globalObjectDef->size();
+ runtimeData->global_size = globalObjectDef->size();
/*
* firstNonTermId
*/
- runtimeData->firstNonTermId = firstNonTermId;
+ runtimeData->first_non_term_id = firstNonTermId;
/* Special trees. */
- runtimeData->integerId = -1; //intLangEl->id;
- runtimeData->stringId = strLangEl->id;
- runtimeData->anyId = anyLangEl->id;
- runtimeData->eofId = 0; //eofLangEl->id;
- runtimeData->noTokenId = noTokenLangEl->id;
- runtimeData->globalId = globalSel->id;
- runtimeData->argvElId = argvElSel->id;
+ runtimeData->integer_id = -1; //intLangEl->id;
+ runtimeData->string_id = strLangEl->id;
+ runtimeData->any_id = anyLangEl->id;
+ runtimeData->eof_id = 0; //eofLangEl->id;
+ runtimeData->no_token_id = noTokenLangEl->id;
+ runtimeData->global_id = globalSel->id;
+ runtimeData->argv_el_id = argvElSel->id;
runtimeData->fsm_execute = &internalFsmExecute;
- runtimeData->sendNamedLangEl = &internalSendNamedLangEl;
- runtimeData->initBindings = &internalInitBindings;
- runtimeData->popBinding = &internalPopBinding;
+ runtimeData->send_named_lang_el = &internalSendNamedLangEl;
+ runtimeData->init_bindings = &internalInitBindings;
+ runtimeData->pop_binding = &internalPopBinding;
}
@@ -1698,7 +1698,7 @@ void countNodes( program_t *prg, int &count, parse_tree_t *parseTree, kid_t *kid
count += 1;
/* Should't have to recurse here. */
- tree_t *ignoreList = treeLeftIgnore( prg, kid->tree );
+ tree_t *ignoreList = tree_left_ignore( prg, kid->tree );
if ( ignoreList != 0 ) {
kid_t *ignore = ignoreList->child;
while ( ignore != 0 ) {
@@ -1707,7 +1707,7 @@ void countNodes( program_t *prg, int &count, parse_tree_t *parseTree, kid_t *kid
}
}
- ignoreList = treeRightIgnore( prg, kid->tree );
+ ignoreList = tree_right_ignore( prg, kid->tree );
if ( ignoreList != 0 ) {
kid_t *ignore = ignoreList->child;
while ( ignore != 0 ) {
@@ -1720,9 +1720,9 @@ void countNodes( program_t *prg, int &count, parse_tree_t *parseTree, kid_t *kid
if ( !( parseTree->flags & PF_NAMED ) &&
!( parseTree->flags & PF_ARTIFICIAL ) &&
- treeChild( prg, kid->tree ) != 0 )
+ tree_child( prg, kid->tree ) != 0 )
{
- countNodes( prg, count, parseTree->child, treeChild( prg, kid->tree ) );
+ countNodes( prg, count, parseTree->child, tree_child( prg, kid->tree ) );
}
countNodes( prg, count, parseTree->next, kid->next );
}
@@ -1737,57 +1737,57 @@ void fillNodes( program_t *prg, int &nextAvail, struct bindings *bindings, long
kid_t *child =
!( parseTree->flags & PF_NAMED ) &&
!( parseTree->flags & PF_ARTIFICIAL ) &&
- treeChild( prg, kid->tree ) != 0
+ tree_child( prg, kid->tree ) != 0
?
- treeChild( prg, kid->tree ) : 0;
+ tree_child( prg, kid->tree ) : 0;
parse_tree_t *ptChild =
!( parseTree->flags & PF_NAMED ) &&
!( parseTree->flags & PF_ARTIFICIAL ) &&
- treeChild( prg, kid->tree ) != 0
+ tree_child( prg, kid->tree ) != 0
?
parseTree->child : 0;
/* Set up the fields. */
node.id = kid->tree->id;
- node.prodNum = kid->tree->prod_num;
- node.length = stringLength( kid->tree->tokdata );
- node.data = stringData( kid->tree->tokdata );
+ node.prod_num = kid->tree->prod_num;
+ node.length = string_length( kid->tree->tokdata );
+ node.data = string_data( kid->tree->tokdata );
/* Ignore items. */
- tree_t *ignoreList = treeLeftIgnore( prg, kid->tree );
+ tree_t *ignoreList = tree_left_ignore( prg, kid->tree );
kid_t *ignore = ignoreList == 0 ? 0 : ignoreList->child;
- node.leftIgnore = ignore == 0 ? -1 : nextAvail;
+ node.left_ignore = ignore == 0 ? -1 : nextAvail;
while ( ignore != 0 ) {
struct pat_cons_node &node = nodes[nextAvail++];
memset( &node, 0, sizeof(struct pat_cons_node) );
node.id = ignore->tree->id;
- node.prodNum = ignore->tree->prod_num;
+ node.prod_num = ignore->tree->prod_num;
node.next = ignore->next == 0 ? -1 : nextAvail;
- node.length = stringLength( ignore->tree->tokdata );
- node.data = stringData( ignore->tree->tokdata );
+ node.length = string_length( ignore->tree->tokdata );
+ node.data = string_data( ignore->tree->tokdata );
ignore = ignore->next;
}
/* Ignore items. */
- ignoreList = treeRightIgnore( prg, kid->tree );
+ ignoreList = tree_right_ignore( prg, kid->tree );
ignore = ignoreList == 0 ? 0 : ignoreList->child;
- node.rightIgnore = ignore == 0 ? -1 : nextAvail;
+ node.right_ignore = ignore == 0 ? -1 : nextAvail;
while ( ignore != 0 ) {
struct pat_cons_node &node = nodes[nextAvail++];
memset( &node, 0, sizeof(struct pat_cons_node) );
node.id = ignore->tree->id;
- node.prodNum = ignore->tree->prod_num;
+ node.prod_num = ignore->tree->prod_num;
node.next = ignore->next == 0 ? -1 : nextAvail;
- node.length = stringLength( ignore->tree->tokdata );
- node.data = stringData( ignore->tree->tokdata );
+ node.length = string_length( ignore->tree->tokdata );
+ node.data = string_data( ignore->tree->tokdata );
ignore = ignore->next;
}
@@ -1817,10 +1817,10 @@ void fillNodes( program_t *prg, int &nextAvail, struct bindings *bindings, long
/* Since the parser is bottom up the bindings are in a bottom up
* traversal order. Check after recursing. */
- node.bindId = 0;
+ node.bind_id = 0;
if ( bindId < bindings->length() && bindings->data[bindId] == parseTree ) {
/* Remember that binding ids are indexed from one. */
- node.bindId = bindId++;
+ node.bind_id = bindId++;
//cout << "binding match in " << __PRETTY_FUNCTION__ << endl;
//cout << "bindId: " << node.bindId << endl;
@@ -1843,51 +1843,51 @@ void Compiler::fillInPatterns( program_t *prg )
int count = 0;
for ( PatList::Iter pat = patternList; pat.lte(); pat++ ) {
countNodes( prg, count,
- pat->pdaRun->stackTop->next,
- pat->pdaRun->stackTop->next->shadow );
+ pat->pdaRun->stack_top->next,
+ pat->pdaRun->stack_top->next->shadow );
}
for ( ConsList::Iter repl = replList; repl.lte(); repl++ ) {
countNodes( prg, count,
- repl->pdaRun->stackTop->next,
- repl->pdaRun->stackTop->next->shadow );
+ repl->pdaRun->stack_top->next,
+ repl->pdaRun->stack_top->next->shadow );
}
- runtimeData->patReplNodes = new pat_cons_node[count];
- runtimeData->numPatternNodes = count;
+ runtimeData->pat_repl_nodes = new pat_cons_node[count];
+ runtimeData->num_pattern_nodes = count;
int nextAvail = 0;
for ( PatList::Iter pat = patternList; pat.lte(); pat++ ) {
int ind = nextAvail++;
- runtimeData->patReplInfo[pat->patRepId].offset = ind;
+ runtimeData->pat_repl_info[pat->patRepId].offset = ind;
/* BindIds are indexed base one. */
- runtimeData->patReplInfo[pat->patRepId].numBindings =
+ runtimeData->pat_repl_info[pat->patRepId].num_bindings =
pat->pdaRun->bindings->length() - 1;
/* Init the bind */
long bindId = 1;
fillNodes( prg, nextAvail, pat->pdaRun->bindings, bindId,
- runtimeData->patReplNodes,
- pat->pdaRun->stackTop->next,
- pat->pdaRun->stackTop->next->shadow,
+ runtimeData->pat_repl_nodes,
+ pat->pdaRun->stack_top->next,
+ pat->pdaRun->stack_top->next->shadow,
ind );
}
for ( ConsList::Iter repl = replList; repl.lte(); repl++ ) {
int ind = nextAvail++;
- runtimeData->patReplInfo[repl->patRepId].offset = ind;
+ runtimeData->pat_repl_info[repl->patRepId].offset = ind;
/* BindIds are indexed base one. */
- runtimeData->patReplInfo[repl->patRepId].numBindings =
+ runtimeData->pat_repl_info[repl->patRepId].num_bindings =
repl->pdaRun->bindings->length() - 1;
long bindId = 1;
fillNodes( prg, nextAvail, repl->pdaRun->bindings, bindId,
- runtimeData->patReplNodes,
- repl->pdaRun->stackTop->next,
- repl->pdaRun->stackTop->next->shadow,
+ runtimeData->pat_repl_nodes,
+ repl->pdaRun->stack_top->next,
+ repl->pdaRun->stack_top->next->shadow,
ind );
}
@@ -1982,7 +1982,7 @@ struct pda_tables *Compiler::makePdaTables( PdaGraph *pdaGraph )
/* Allocate indicies and owners. */
- pdaTables->numIndicies = count;
+ pdaTables->num_indicies = count;
pdaTables->indicies = new int[count];
pdaTables->owners = new int[count];
for ( long i = 0; i < count; i++ ) {
@@ -1993,7 +1993,7 @@ struct pda_tables *Compiler::makePdaTables( PdaGraph *pdaGraph )
/* Allocate offsets. */
int numStates = pdaGraph->stateList.length();
pdaTables->offsets = new unsigned int[numStates];
- pdaTables->numStates = numStates;
+ pdaTables->num_states = numStates;
/* Place transitions into indicies/owners */
PdaState **states = new PdaState*[numStates];
@@ -2029,7 +2029,7 @@ struct pda_tables *Compiler::makePdaTables( PdaGraph *pdaGraph )
}
/* We allocated the max, but cmpression gives us less. */
- pdaTables->numIndicies = indLen;
+ pdaTables->num_indicies = indLen;
delete[] states;
@@ -2038,7 +2038,7 @@ struct pda_tables *Compiler::makePdaTables( PdaGraph *pdaGraph )
*/
count = pdaGraph->stateList.length() * 2;;
pdaTables->keys = new int[count];
- pdaTables->numKeys = count;
+ pdaTables->num_keys = count;
count = 0;
for ( PdaStateList::Iter state = pdaGraph->stateList; state.lte(); state++ ) {
@@ -2060,7 +2060,7 @@ struct pda_tables *Compiler::makePdaTables( PdaGraph *pdaGraph )
*/
count = pdaGraph->actionSet.length();
pdaTables->targs = new unsigned int[count];
- pdaTables->numTargs = count;
+ pdaTables->num_targs = count;
count = 0;
for ( PdaActionSet::Iter asi = pdaGraph->actionSet; asi.lte(); asi++ )
@@ -2070,12 +2070,12 @@ struct pda_tables *Compiler::makePdaTables( PdaGraph *pdaGraph )
* ActInds
*/
count = pdaGraph->actionSet.length();
- pdaTables->actInds = new unsigned int[count];
- pdaTables->numActInds = count;
+ pdaTables->act_inds = new unsigned int[count];
+ pdaTables->num_act_inds = count;
count = pos = 0;
for ( PdaActionSet::Iter asi = pdaGraph->actionSet; asi.lte(); asi++ ) {
- pdaTables->actInds[count++] = pos;
+ pdaTables->act_inds[count++] = pos;
pos += asi->key.actions.length() + 1;
}
@@ -2087,7 +2087,7 @@ struct pda_tables *Compiler::makePdaTables( PdaGraph *pdaGraph )
count += asi->key.actions.length() + 1;
pdaTables->actions = new unsigned int[count];
- pdaTables->numActions = count;
+ pdaTables->num_actions = count;
count = 0;
for ( PdaActionSet::Iter asi = pdaGraph->actionSet; asi.lte(); asi++ ) {
@@ -2101,21 +2101,21 @@ struct pda_tables *Compiler::makePdaTables( PdaGraph *pdaGraph )
* CommitLen
*/
count = pdaGraph->actionSet.length();
- pdaTables->commitLen = new int[count];
- pdaTables->numCommitLen = count;
+ pdaTables->commit_len = new int[count];
+ pdaTables->num_commit_len = count;
count = 0;
for ( PdaActionSet::Iter asi = pdaGraph->actionSet; asi.lte(); asi++ )
- pdaTables->commitLen[count++] = asi->key.commitLen;
+ pdaTables->commit_len[count++] = asi->key.commitLen;
/*
* tokenRegionInds. Start at one so region index 0 is null (unset).
*/
count = 0;
pos = 1;
- pdaTables->tokenRegionInds = new int[pdaTables->numStates];
+ pdaTables->token_region_inds = new int[pdaTables->num_states];
for ( PdaStateList::Iter state = pdaGraph->stateList; state.lte(); state++ ) {
- pdaTables->tokenRegionInds[count++] = pos;
+ pdaTables->token_region_inds[count++] = pos;
pos += state->regions.length() + 1;
}
@@ -2128,18 +2128,18 @@ struct pda_tables *Compiler::makePdaTables( PdaGraph *pdaGraph )
for ( PdaStateList::Iter state = pdaGraph->stateList; state.lte(); state++ )
count += state->regions.length() + 1;
- pdaTables->numRegionItems = count;
- pdaTables->tokenRegions = new int[pdaTables->numRegionItems];
+ pdaTables->num_region_items = count;
+ pdaTables->token_regions = new int[pdaTables->num_region_items];
count = 0;
- pdaTables->tokenRegions[count++] = 0;
+ pdaTables->token_regions[count++] = 0;
for ( PdaStateList::Iter state = pdaGraph->stateList; state.lte(); state++ ) {
for ( RegionVect::Iter reg = state->regions; reg.lte(); reg++ ) {
int id = ( *reg == EOF_REGION ) ? 0 : (*reg)->id + 1;
- pdaTables->tokenRegions[count++] = id;
+ pdaTables->token_regions[count++] = id;
}
- pdaTables->tokenRegions[count++] = 0;
+ pdaTables->token_regions[count++] = 0;
}
/*
@@ -2150,21 +2150,21 @@ struct pda_tables *Compiler::makePdaTables( PdaGraph *pdaGraph )
for ( PdaStateList::Iter state = pdaGraph->stateList; state.lte(); state++ )
count += state->regions.length() + 1;
- pdaTables->numPreRegionItems = count;
- pdaTables->tokenPreRegions = new int[pdaTables->numPreRegionItems];
+ pdaTables->num_pre_region_items = count;
+ pdaTables->token_pre_regions = new int[pdaTables->num_pre_region_items];
count = 0;
- pdaTables->tokenPreRegions[count++] = 0;
+ pdaTables->token_pre_regions[count++] = 0;
for ( PdaStateList::Iter state = pdaGraph->stateList; state.lte(); state++ ) {
for ( RegionVect::Iter reg = state->regions; reg.lte(); reg++ ) {
assert( state->preRegions.length() <= 1 );
if ( state->preRegions.length() == 0 || state->preRegions[0]->impl->wasEmpty )
- pdaTables->tokenPreRegions[count++] = -1;
+ pdaTables->token_pre_regions[count++] = -1;
else
- pdaTables->tokenPreRegions[count++] = state->preRegions[0]->id + 1;
+ pdaTables->token_pre_regions[count++] = state->preRegions[0]->id + 1;
}
- pdaTables->tokenPreRegions[count++] = 0;
+ pdaTables->token_pre_regions[count++] = 0;
}
diff --git a/src/pdacodegen.cc b/src/pdacodegen.cc
index 8d032db8..2361c347 100644
--- a/src/pdacodegen.cc
+++ b/src/pdacodegen.cc
@@ -75,16 +75,16 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
/*
* Blocks of code in frames.
*/
- for ( int i = 0; i < runtimeData->numFrames; i++ ) {
+ for ( int i = 0; i < runtimeData->num_frames; i++ ) {
/* FIXME: horrible code cloning going on here. */
- if ( runtimeData->frameInfo[i].codeLenWV > 0 ) {
+ if ( runtimeData->frame_info[i].codeLenWV > 0 ) {
out << "static code_t code_" << i << "_wv[] = {\n\t";
- code_t *block = runtimeData->frameInfo[i].codeWV;
- for ( int j = 0; j < runtimeData->frameInfo[i].codeLenWV; j++ ) {
+ code_t *block = runtimeData->frame_info[i].codeWV;
+ for ( int j = 0; j < runtimeData->frame_info[i].codeLenWV; j++ ) {
out << (unsigned long) block[j];
- if ( j < runtimeData->frameInfo[i].codeLenWV-1 ) {
+ if ( j < runtimeData->frame_info[i].codeLenWV-1 ) {
out << ", ";
if ( (j+1) % 8 == 0 )
out << "\n\t";
@@ -93,14 +93,14 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
out << "\n};\n\n";
}
- if ( runtimeData->frameInfo[i].codeLenWC > 0 ) {
+ if ( runtimeData->frame_info[i].codeLenWC > 0 ) {
out << "static code_t code_" << i << "_wc[] = {\n\t";
- code_t *block = runtimeData->frameInfo[i].codeWC;
- for ( int j = 0; j < runtimeData->frameInfo[i].codeLenWC; j++ ) {
+ code_t *block = runtimeData->frame_info[i].codeWC;
+ for ( int j = 0; j < runtimeData->frame_info[i].codeLenWC; j++ ) {
out << (unsigned long) block[j];
- if ( j < runtimeData->frameInfo[i].codeLenWC-1 ) {
+ if ( j < runtimeData->frame_info[i].codeLenWC-1 ) {
out << ", ";
if ( (j+1) % 8 == 0 )
out << "\n\t";
@@ -109,14 +109,14 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
out << "\n};\n\n";
}
- if ( runtimeData->frameInfo[i].localsLen > 0 ) {
+ if ( runtimeData->frame_info[i].locals_len > 0 ) {
out << "static struct local_info locals_" << i << "[] = {\n\t";
- struct local_info *li = runtimeData->frameInfo[i].locals;
- for ( int j = 0; j < runtimeData->frameInfo[i].localsLen; j++ ) {
+ struct local_info *li = runtimeData->frame_info[i].locals;
+ for ( int j = 0; j < runtimeData->frame_info[i].locals_len; j++ ) {
out << "{ " << (int)li[j].type << ", " << li[j].offset << " }";
- if ( j < runtimeData->frameInfo[i].localsLen-1 ) {
+ if ( j < runtimeData->frame_info[i].locals_len-1 ) {
out << ", ";
if ( (j+1) % 8 == 0 )
out << "\n\t";
@@ -129,15 +129,15 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
/*
* Blocks in production info.
*/
- for ( int i = 0; i < runtimeData->numProds; i++ ) {
- if ( runtimeData->prodInfo[i].copyLen > 0 ) {
+ for ( int i = 0; i < runtimeData->num_prods; i++ ) {
+ if ( runtimeData->prod_info[i].copy_len > 0 ) {
out << "static unsigned char copy_" << i << "[] = {\n\t";
- unsigned char *block = runtimeData->prodInfo[i].copy;
- for ( int j = 0; j < runtimeData->prodInfo[i].copyLen; j++ ) {
+ unsigned char *block = runtimeData->prod_info[i].copy;
+ for ( int j = 0; j < runtimeData->prod_info[i].copy_len; j++ ) {
out << (long) block[j*2] << ", " << (long) block[j*2+1];
- if ( j < runtimeData->prodInfo[i].copyLen-1 ) {
+ if ( j < runtimeData->prod_info[i].copy_len-1 ) {
out << ", ";
if ( (j+1) % 8 == 0 )
out << "\n\t";
@@ -151,11 +151,11 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
* Init code.
*/
out << "static code_t " << rootCode() << "[] = {\n\t";
- code_t *block = runtimeData->rootCode ;
- for ( int j = 0; j < runtimeData->rootCodeLen; j++ ) {
+ code_t *block = runtimeData->root_code ;
+ for ( int j = 0; j < runtimeData->root_code_len; j++ ) {
out << (unsigned int) block[j];
- if ( j < runtimeData->rootCodeLen-1 ) {
+ if ( j < runtimeData->root_code_len-1 ) {
out << ", ";
if ( (j+1) % 8 == 0 )
out << "\n\t";
@@ -167,8 +167,8 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
* lelInfo
*/
out << "static struct lang_el_info " << lelInfo() << "[] = {\n";
- for ( int i = 0; i < runtimeData->numLangEls; i++ ) {
- struct lang_el_info *el = &runtimeData->lelInfo[i];
+ for ( int i = 0; i < runtimeData->num_lang_els; i++ ) {
+ struct lang_el_info *el = &runtimeData->lel_info[i];
out << "\t{";
/* Name. */
@@ -178,7 +178,7 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
/* Name. */
out << " \"";
- escapeLiteralString( out, el->xmlTag );
+ escapeLiteralString( out, el->xml_tag );
out << "\", ";
/* Repeat, literal, ignore flags. */
@@ -186,30 +186,30 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
out << (int)el->list << ", ";
out << (int)el->literal << ", ";
out << (int)el->ignore << ", ";
- out << el->frameId << ", ";
- out << el->objectTypeId << ", ";
- out << el->ofiOffset << ", ";
- out << el->objectLength << ", ";
- out << el->termDupId << ", ";
- out << el->markId << ", ";
- out << el->captureAttr << ", ";
- out << el->numCaptureAttr;
+ out << el->frame_id << ", ";
+ out << el->object_type_id << ", ";
+ out << el->ofi_offset << ", ";
+ out << el->object_length << ", ";
+ out << el->term_dup_id << ", ";
+ out << el->mark_id << ", ";
+ out << el->capture_attr << ", ";
+ out << el->num_capture_attr;
out << " }";
- if ( i < runtimeData->numLangEls-1 )
+ if ( i < runtimeData->num_lang_els-1 )
out << ",\n";
}
out << "\n};\n\n";
- for ( int i = 0; i < runtimeData->numStructEls; i++ ) {
- struct struct_el_info *el = &runtimeData->selInfo[i];
- if ( el->treesLen > 0 ) {
+ for ( int i = 0; i < runtimeData->num_struct_els; i++ ) {
+ struct struct_el_info *el = &runtimeData->sel_info[i];
+ if ( el->trees_len > 0 ) {
out << "static short struct_trees_" << i << "[] = {\n\t";
short *ti = el->trees;
- for ( int j = 0; j < el->treesLen; j++ )
+ for ( int j = 0; j < el->trees_len; j++ )
out << ti[j] << ", ";
out << "\n};\n\n";
}
@@ -219,17 +219,17 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
* selInfo
*/
out << "static struct struct_el_info " << selInfo() << "[] = {\n";
- for ( int i = 0; i < runtimeData->numStructEls; i++ ) {
- struct struct_el_info *el = &runtimeData->selInfo[i];
+ for ( int i = 0; i < runtimeData->num_struct_els; i++ ) {
+ struct struct_el_info *el = &runtimeData->sel_info[i];
out << "\t{ ";
out << el->size << ", ";
/* trees. */
- if ( el->treesLen > 0 )
+ if ( el->trees_len > 0 )
out << "struct_trees_" << i << ", ";
else
out << "0, ";
- out << el->treesLen << ", ";
+ out << el->trees_len << ", ";
out << " },\n";
}
@@ -239,42 +239,42 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
* frameInfo
*/
out << "static struct frame_info " << frameInfo() << "[] = {\n";
- for ( int i = 0; i < runtimeData->numFrames; i++ ) {
+ for ( int i = 0; i < runtimeData->num_frames; i++ ) {
out << "\t{ ";
/* The Name. */
- if ( runtimeData->frameInfo[i].name )
- out << "\"" << runtimeData->frameInfo[i].name << "\", ";
+ if ( runtimeData->frame_info[i].name )
+ out << "\"" << runtimeData->frame_info[i].name << "\", ";
else
out << "\"\", ";
- if ( runtimeData->frameInfo[i].codeLenWV > 0 )
+ if ( runtimeData->frame_info[i].codeLenWV > 0 )
out << "code_" << i << "_wv, ";
else
out << "0, ";
- out << runtimeData->frameInfo[i].codeLenWV << ", ";
+ out << runtimeData->frame_info[i].codeLenWV << ", ";
- if ( runtimeData->frameInfo[i].codeLenWC > 0 )
+ if ( runtimeData->frame_info[i].codeLenWC > 0 )
out << "code_" << i << "_wc, ";
else
out << "0, ";
- out << runtimeData->frameInfo[i].codeLenWC << ", ";
+ out << runtimeData->frame_info[i].codeLenWC << ", ";
/* locals. */
- if ( runtimeData->frameInfo[i].localsLen > 0 )
+ if ( runtimeData->frame_info[i].locals_len > 0 )
out << "locals_" << i << ", ";
else
out << "0, ";
- out << runtimeData->frameInfo[i].localsLen << ", ";
+ out << runtimeData->frame_info[i].locals_len << ", ";
out <<
- runtimeData->frameInfo[i].argSize << ", " <<
- runtimeData->frameInfo[i].frameSize;
+ runtimeData->frame_info[i].arg_size << ", " <<
+ runtimeData->frame_info[i].frame_size;
out << " }";
- if ( i < runtimeData->numFrames-1 )
+ if ( i < runtimeData->num_frames-1 )
out << ",\n";
}
out << "\n};\n\n";
@@ -284,29 +284,29 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
* prodInfo
*/
out << "static struct prod_info " << prodInfo() << "[] = {\n";
- for ( int i = 0; i < runtimeData->numProds; i++ ) {
+ for ( int i = 0; i < runtimeData->num_prods; i++ ) {
out << "\t{ ";
- out << runtimeData->prodInfo[i].lhsId << ", ";
- out << runtimeData->prodInfo[i].prodNum << ", ";
- out << runtimeData->prodInfo[i].length << ", ";
+ out << runtimeData->prod_info[i].lhs_id << ", ";
+ out << runtimeData->prod_info[i].prod_num << ", ";
+ out << runtimeData->prod_info[i].length << ", ";
out <<
- '"' << runtimeData->prodInfo[i].name << "\", " <<
- runtimeData->prodInfo[i].frameId << ", " <<
- (int)runtimeData->prodInfo[i].lhsUpref << ", ";
+ '"' << runtimeData->prod_info[i].name << "\", " <<
+ runtimeData->prod_info[i].frame_id << ", " <<
+ (int)runtimeData->prod_info[i].lhs_upref << ", ";
- if ( runtimeData->prodInfo[i].copyLen > 0 )
+ if ( runtimeData->prod_info[i].copy_len > 0 )
out << "copy_" << i << ", ";
else
out << "0, ";
- out << runtimeData->prodInfo[i].copyLen << ", ";
+ out << runtimeData->prod_info[i].copy_len << ", ";
out << " }";
- if ( i < runtimeData->numProds-1 )
+ if ( i < runtimeData->num_prods-1 )
out << ",\n";
}
out << "\n};\n\n";
@@ -315,9 +315,9 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
* patReplInfo
*/
out << "static struct pat_cons_info " << patReplInfo() << "[] = {\n";
- for ( int i = 0; i < runtimeData->numPatterns; i++ ) {
- out << " { " << runtimeData->patReplInfo[i].offset << ", " <<
- runtimeData->patReplInfo[i].numBindings << " },\n";
+ for ( int i = 0; i < runtimeData->num_patterns; i++ ) {
+ out << " { " << runtimeData->pat_repl_info[i].offset << ", " <<
+ runtimeData->pat_repl_info[i].num_bindings << " },\n";
}
out << "};\n\n";
@@ -325,11 +325,11 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
* patReplNodes
*/
out << "static struct pat_cons_node " << patReplNodes() << "[] = {\n";
- for ( int i = 0; i < runtimeData->numPatternNodes; i++ ) {
- struct pat_cons_node &node = runtimeData->patReplNodes[i];
+ for ( int i = 0; i < runtimeData->num_pattern_nodes; i++ ) {
+ struct pat_cons_node &node = runtimeData->pat_repl_nodes[i];
out << " { " << node.id << ", " <<
- node.prodNum << ", " << node.next << ", " <<
- node.child << ", " << node.bindId << ", ";
+ node.prod_num << ", " << node.next << ", " <<
+ node.child << ", " << node.bind_id << ", ";
if ( node.data == 0 )
out << "0";
else {
@@ -339,8 +339,8 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
}
out << ", " << node.length << ", ";
- out << node.leftIgnore << ", ";
- out << node.rightIgnore << ", ";
+ out << node.left_ignore << ", ";
+ out << node.right_ignore << ", ";
out << (int)node.stop << " },\n";
}
@@ -350,14 +350,14 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
* functionInfo
*/
out << "static struct function_info " << functionInfo() << "[] = {\n";
- for ( int i = 0; i < runtimeData->numFunctions; i++ ) {
+ for ( int i = 0; i < runtimeData->num_functions; i++ ) {
out << "\t{ " <<
- runtimeData->functionInfo[i].frameId << ", " <<
- runtimeData->functionInfo[i].argSize << ", " <<
- runtimeData->functionInfo[i].frameSize;
+ runtimeData->function_info[i].frame_id << ", " <<
+ runtimeData->function_info[i].arg_size << ", " <<
+ runtimeData->function_info[i].frame_size;
out << " }";
- if ( i < runtimeData->numFunctions-1 )
+ if ( i < runtimeData->num_functions-1 )
out << ",\n";
}
out << "\n};\n\n";
@@ -366,13 +366,13 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
* regionInfo
*/
out << "static struct region_info " << regionInfo() << "[] = {\n";
- for ( int i = 0; i < runtimeData->numRegions; i++ ) {
- out << "\t{ " << runtimeData->regionInfo[i].defaultToken <<
- ", " << runtimeData->regionInfo[i].eofFrameId <<
- ", " << runtimeData->regionInfo[i].ciLelId <<
+ for ( int i = 0; i < runtimeData->num_regions; i++ ) {
+ out << "\t{ " << runtimeData->region_info[i].default_token <<
+ ", " << runtimeData->region_info[i].eof_frame_id <<
+ ", " << runtimeData->region_info[i].ci_lel_id <<
" }";
- if ( i < runtimeData->numRegions-1 )
+ if ( i < runtimeData->num_regions-1 )
out << ",\n";
}
out << "\n};\n\n";
@@ -381,17 +381,17 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
* genericInfo
*/
out << "static struct generic_info " << genericInfo() << "[] = {\n";
- for ( int i = 0; i < runtimeData->numGenerics; i++ ) {
+ for ( int i = 0; i < runtimeData->num_generics; i++ ) {
out << "\t{ " <<
- runtimeData->genericInfo[i].type << ", " <<
- runtimeData->genericInfo[i].elType << ", " <<
- runtimeData->genericInfo[i].elStructId << ", " <<
- runtimeData->genericInfo[i].elOffset << ", " <<
- runtimeData->genericInfo[i].keyType << ", " <<
- runtimeData->genericInfo[i].keyOffset << ", " <<
- runtimeData->genericInfo[i].valueType << ", " <<
- runtimeData->genericInfo[i].valueOffset << ", " <<
- runtimeData->genericInfo[i].parserId;
+ runtimeData->generic_info[i].type << ", " <<
+ runtimeData->generic_info[i].el_type << ", " <<
+ runtimeData->generic_info[i].el_struct_id << ", " <<
+ runtimeData->generic_info[i].el_offset << ", " <<
+ runtimeData->generic_info[i].key_type << ", " <<
+ runtimeData->generic_info[i].key_offset << ", " <<
+ runtimeData->generic_info[i].value_type << ", " <<
+ runtimeData->generic_info[i].value_offset << ", " <<
+ runtimeData->generic_info[i].parser_id;
out << " },\n";
}
out << "};\n\n";
@@ -400,7 +400,7 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
* literals
*/
out << "static const char *" << litdata() << "[] = {\n";
- for ( int i = 0; i < runtimeData->numLiterals; i++ ) {
+ for ( int i = 0; i < runtimeData->num_literals; i++ ) {
out << "\t\"";
escapeLiteralString( out, runtimeData->litdata[i] );
out << "\",\n";
@@ -408,39 +408,39 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
out << "};\n\n";
out << "static long " << litlen() << "[] = {\n\t";
- for ( int i = 0; i < runtimeData->numLiterals; i++ )
+ for ( int i = 0; i < runtimeData->num_literals; i++ )
out << runtimeData->litlen[i] << ", ";
out << "};\n\n";
out << "static head_t *" << literals() << "[] = {\n\t";
- for ( int i = 0; i < runtimeData->numLiterals; i++ )
+ for ( int i = 0; i < runtimeData->num_literals; i++ )
out << "0, ";
out << "};\n\n";
out << "static int startStates[] = {\n\t";
- for ( long i = 0; i < runtimeData->numParsers; i++ ) {
- out << runtimeData->startStates[i] << ", ";
+ for ( long i = 0; i < runtimeData->num_parsers; i++ ) {
+ out << runtimeData->start_states[i] << ", ";
}
out << "};\n\n";
out << "static int eofLelIds[] = {\n\t";
- for ( long i = 0; i < runtimeData->numParsers; i++ ) {
- out << runtimeData->eofLelIds[i] << ", ";
+ for ( long i = 0; i < runtimeData->num_parsers; i++ ) {
+ out << runtimeData->eof_lel_ids[i] << ", ";
}
out << "};\n\n";
out << "static int parserLelIds[] = {\n\t";
- for ( long i = 0; i < runtimeData->numParsers; i++ ) {
- out << runtimeData->parserLelIds[i] << ", ";
+ for ( long i = 0; i < runtimeData->num_parsers; i++ ) {
+ out << runtimeData->parser_lel_ids[i] << ", ";
}
out << "};\n\n";
out << "static CaptureAttr captureAttr[] = {\n";
- for ( long i = 0; i < runtimeData->numCapturedAttr; i++ ) {
+ for ( long i = 0; i < runtimeData->num_captured_attr; i++ ) {
out << "\t{ " <<
- runtimeData->captureAttr[i].mark_enter << ", " <<
- runtimeData->captureAttr[i].mark_leave << ", " <<
- runtimeData->captureAttr[i].offset << " },\n";
+ runtimeData->capture_attr[i].mark_enter << ", " <<
+ runtimeData->capture_attr[i].mark_leave << ", " <<
+ runtimeData->capture_attr[i].offset << " },\n";
}
out << "};\n\n";
@@ -449,59 +449,59 @@ void PdaCodeGen::writeRuntimeData( colm_sections *runtimeData, struct pda_tables
"struct colm_sections colm_object = \n"
"{\n"
" " << lelInfo() << ",\n"
- " " << runtimeData->numLangEls << ",\n"
+ " " << runtimeData->num_lang_els << ",\n"
"\n"
" " << selInfo() << ",\n"
- " " << runtimeData->numStructEls << ",\n"
+ " " << runtimeData->num_struct_els << ",\n"
"\n"
" " << prodInfo() << ",\n"
- " " << runtimeData->numProds << ",\n"
+ " " << runtimeData->num_prods << ",\n"
"\n"
" " << regionInfo() << ",\n"
- " " << runtimeData->numRegions << ",\n"
+ " " << runtimeData->num_regions << ",\n"
"\n"
" " << rootCode() << ",\n"
- " " << runtimeData->rootCodeLen << ",\n"
- " " << runtimeData->rootFrameId << ",\n"
+ " " << runtimeData->root_code_len << ",\n"
+ " " << runtimeData->root_frame_id << ",\n"
"\n"
" " << frameInfo() << ",\n"
- " " << runtimeData->numFrames << ",\n"
+ " " << runtimeData->num_frames << ",\n"
"\n"
" " << functionInfo() << ",\n"
- " " << runtimeData->numFunctions << ",\n"
+ " " << runtimeData->num_functions << ",\n"
"\n"
" " << patReplInfo() << ",\n"
- " " << runtimeData->numPatterns << ",\n"
+ " " << runtimeData->num_patterns << ",\n"
"\n"
" " << patReplNodes() << ",\n"
- " " << runtimeData->numPatternNodes << ",\n"
+ " " << runtimeData->num_pattern_nodes << ",\n"
"\n"
" " << genericInfo() << ",\n"
- " " << runtimeData->numGenerics << ",\n"
- " " << runtimeData->argvGenericId << ",\n"
+ " " << runtimeData->num_generics << ",\n"
+ " " << runtimeData->argv_generic_id << ",\n"
"\n"
" " << litdata() << ",\n"
" " << litlen() << ",\n"
" " << literals() << ",\n"
- " " << runtimeData->numLiterals << ",\n"
+ " " << runtimeData->num_literals << ",\n"
"\n"
" captureAttr,\n"
- " " << runtimeData->numCapturedAttr << ",\n"
+ " " << runtimeData->num_captured_attr << ",\n"
"\n"
" &fsmTables_start,\n"
" &pid_0_pdaTables,\n"
- " startStates, eofLelIds, parserLelIds, " << runtimeData->numParsers << ",\n"
+ " startStates, eofLelIds, parserLelIds, " << runtimeData->num_parsers << ",\n"
"\n"
- " " << runtimeData->globalSize << ",\n"
+ " " << runtimeData->global_size << ",\n"
"\n"
- " " << runtimeData->firstNonTermId << ",\n"
- " " << runtimeData->integerId << ",\n"
- " " << runtimeData->stringId << ",\n"
- " " << runtimeData->anyId << ",\n"
- " " << runtimeData->eofId << ",\n"
- " " << runtimeData->noTokenId << ",\n"
- " " << runtimeData->globalId << ",\n"
- " " << runtimeData->argvElId << ",\n"
+ " " << runtimeData->first_non_term_id << ",\n"
+ " " << runtimeData->integer_id << ",\n"
+ " " << runtimeData->string_id << ",\n"
+ " " << runtimeData->any_id << ",\n"
+ " " << runtimeData->eof_id << ",\n"
+ " " << runtimeData->no_token_id << ",\n"
+ " " << runtimeData->global_id << ",\n"
+ " " << runtimeData->argv_el_id << ",\n"
" &fsm_execute,\n"
" &sendNamedLangEl,\n"
" &initBindings,\n"
@@ -515,10 +515,10 @@ void PdaCodeGen::writeParserData( long id, struct pda_tables *tables )
String prefix = "pid_" + String(0, "%ld", id) + "_";
out << "static int " << prefix << indicies() << "[] = {\n\t";
- for ( int i = 0; i < tables->numIndicies; i++ ) {
+ for ( int i = 0; i < tables->num_indicies; i++ ) {
out << tables->indicies[i];
- if ( i < tables->numIndicies-1 ) {
+ if ( i < tables->num_indicies-1 ) {
out << ", ";
if ( (i+1) % 8 == 0 )
out << "\n\t";
@@ -527,10 +527,10 @@ void PdaCodeGen::writeParserData( long id, struct pda_tables *tables )
out << "\n};\n\n";
out << "static int " << prefix << owners() << "[] = {\n\t";
- for ( int i = 0; i < tables->numIndicies; i++ ) {
+ for ( int i = 0; i < tables->num_indicies; i++ ) {
out << tables->owners[i];
- if ( i < tables->numIndicies-1 ) {
+ if ( i < tables->num_indicies-1 ) {
out << ", ";
if ( (i+1) % 8 == 0 )
out << "\n\t";
@@ -539,10 +539,10 @@ void PdaCodeGen::writeParserData( long id, struct pda_tables *tables )
out << "\n};\n\n";
out << "static int " << prefix << keys() << "[] = {\n\t";
- for ( int i = 0; i < tables->numKeys; i++ ) {
+ for ( int i = 0; i < tables->num_keys; i++ ) {
out << tables->keys[i];
- if ( i < tables->numKeys-1 ) {
+ if ( i < tables->num_keys-1 ) {
out << ", ";
if ( (i+1) % 8 == 0 )
out << "\n\t";
@@ -551,10 +551,10 @@ void PdaCodeGen::writeParserData( long id, struct pda_tables *tables )
out << "\n};\n\n";
out << "static unsigned int " << prefix << offsets() << "[] = {\n\t";
- for ( int i = 0; i < tables->numStates; i++ ) {
+ for ( int i = 0; i < tables->num_states; i++ ) {
out << tables->offsets[i];
- if ( i < tables->numStates-1 ) {
+ if ( i < tables->num_states-1 ) {
out << ", ";
if ( (i+1) % 8 == 0 )
out << "\n\t";
@@ -563,10 +563,10 @@ void PdaCodeGen::writeParserData( long id, struct pda_tables *tables )
out << "\n};\n\n";
out << "static unsigned int " << prefix << targs() << "[] = {\n\t";
- for ( int i = 0; i < tables->numTargs; i++ ) {
+ for ( int i = 0; i < tables->num_targs; i++ ) {
out << tables->targs[i];
- if ( i < tables->numTargs-1 ) {
+ if ( i < tables->num_targs-1 ) {
out << ", ";
if ( (i+1) % 8 == 0 )
out << "\n\t";
@@ -575,10 +575,10 @@ void PdaCodeGen::writeParserData( long id, struct pda_tables *tables )
out << "\n};\n\n";
out << "static unsigned int " << prefix << actInds() << "[] = {\n\t";
- for ( int i = 0; i < tables->numActInds; i++ ) {
- out << tables->actInds[i];
+ for ( int i = 0; i < tables->num_act_inds; i++ ) {
+ out << tables->act_inds[i];
- if ( i < tables->numActInds-1 ) {
+ if ( i < tables->num_act_inds-1 ) {
out << ", ";
if ( (i+1) % 8 == 0 )
out << "\n\t";
@@ -587,10 +587,10 @@ void PdaCodeGen::writeParserData( long id, struct pda_tables *tables )
out << "\n};\n\n";
out << "static unsigned int " << prefix << actions() << "[] = {\n\t";
- for ( int i = 0; i < tables->numActions; i++ ) {
+ for ( int i = 0; i < tables->num_actions; i++ ) {
out << tables->actions[i];
- if ( i < tables->numActions-1 ) {
+ if ( i < tables->num_actions-1 ) {
out << ", ";
if ( (i+1) % 8 == 0 )
out << "\n\t";
@@ -599,10 +599,10 @@ void PdaCodeGen::writeParserData( long id, struct pda_tables *tables )
out << "\n};\n\n";
out << "static int " << prefix << commitLen() << "[] = {\n\t";
- for ( int i = 0; i < tables->numCommitLen; i++ ) {
- out << tables->commitLen[i];
+ for ( int i = 0; i < tables->num_commit_len; i++ ) {
+ out << tables->commit_len[i];
- if ( i < tables->numCommitLen-1 ) {
+ if ( i < tables->num_commit_len-1 ) {
out << ", ";
if ( (i+1) % 8 == 0 )
out << "\n\t";
@@ -611,10 +611,10 @@ void PdaCodeGen::writeParserData( long id, struct pda_tables *tables )
out << "\n};\n\n";
out << "static int " << prefix << tokenRegionInds() << "[] = {\n\t";
- for ( int i = 0; i < tables->numStates; i++ ) {
- out << tables->tokenRegionInds[i];
+ for ( int i = 0; i < tables->num_states; i++ ) {
+ out << tables->token_region_inds[i];
- if ( i < tables->numStates-1 ) {
+ if ( i < tables->num_states-1 ) {
out << ", ";
if ( (i+1) % 8 == 0 )
out << "\n\t";
@@ -623,10 +623,10 @@ void PdaCodeGen::writeParserData( long id, struct pda_tables *tables )
out << "\n};\n\n";
out << "static int " << prefix << tokenRegions() << "[] = {\n\t";
- for ( int i = 0; i < tables->numRegionItems; i++ ) {
- out << tables->tokenRegions[i];
+ for ( int i = 0; i < tables->num_region_items; i++ ) {
+ out << tables->token_regions[i];
- if ( i < tables->numRegionItems-1 ) {
+ if ( i < tables->num_region_items-1 ) {
out << ", ";
if ( (i+1) % 8 == 0 )
out << "\n\t";
@@ -635,10 +635,10 @@ void PdaCodeGen::writeParserData( long id, struct pda_tables *tables )
out << "\n};\n\n";
out << "static int " << prefix << tokenPreRegions() << "[] = {\n\t";
- for ( int i = 0; i < tables->numPreRegionItems; i++ ) {
- out << tables->tokenPreRegions[i];
+ for ( int i = 0; i < tables->num_pre_region_items; i++ ) {
+ out << tables->token_pre_regions[i];
- if ( i < tables->numPreRegionItems-1 ) {
+ if ( i < tables->num_pre_region_items-1 ) {
out << ", ";
if ( (i+1) % 8 == 0 )
out << "\n\t";
@@ -662,15 +662,15 @@ void PdaCodeGen::writeParserData( long id, struct pda_tables *tables )
" " << prefix << tokenRegions() << ",\n"
" " << prefix << tokenPreRegions() << ",\n"
"\n"
- " " << tables->numIndicies << ",\n"
- " " << tables->numKeys << ",\n"
- " " << tables->numStates << ",\n"
- " " << tables->numTargs << ",\n"
- " " << tables->numActInds << ",\n"
- " " << tables->numActions << ",\n"
- " " << tables->numCommitLen << ",\n"
- " " << tables->numRegionItems << ",\n"
- " " << tables->numPreRegionItems << "\n"
+ " " << tables->num_indicies << ",\n"
+ " " << tables->num_keys << ",\n"
+ " " << tables->num_states << ",\n"
+ " " << tables->num_targs << ",\n"
+ " " << tables->num_act_inds << ",\n"
+ " " << tables->num_actions << ",\n"
+ " " << tables->num_commit_len << ",\n"
+ " " << tables->num_region_items << ",\n"
+ " " << tables->num_pre_region_items << "\n"
"};\n"
"\n";
}
diff --git a/src/pdarun.c b/src/pdarun.c
index 5a0e180e..eeb5ddcb 100644
--- a/src/pdarun.c
+++ b/src/pdarun.c
@@ -56,65 +56,65 @@
i = (tree_t*)w; \
} while(0)
-static void init_fsm_run( program_t *prg, struct pda_run *pdaRun )
+static void init_fsm_run( program_t *prg, struct pda_run *pda_run )
{
- pdaRun->fsm_tables = prg->rtd->fsmTables;
+ pda_run->fsm_tables = prg->rtd->fsm_tables;
- pdaRun->consumeBuf = 0;
+ pda_run->consume_buf = 0;
- pdaRun->p = pdaRun->pe = 0;
- pdaRun->toklen = 0;
- pdaRun->eof = 0;
+ pda_run->p = pda_run->pe = 0;
+ pda_run->toklen = 0;
+ pda_run->eof = 0;
- pdaRun->preRegion = -1;
+ pda_run->pre_region = -1;
}
-static void clear_fsm_run( program_t *prg, struct pda_run *pdaRun )
+static void clear_fsm_run( program_t *prg, struct pda_run *pda_run )
{
- if ( pdaRun->consumeBuf != 0 ) {
+ if ( pda_run->consume_buf != 0 ) {
/* Transfer the run buf list to the program */
- RunBuf *head = pdaRun->consumeBuf;
+ RunBuf *head = pda_run->consume_buf;
RunBuf *tail = head;
while ( tail->next != 0 )
tail = tail->next;
- tail->next = prg->allocRunBuf;
- prg->allocRunBuf = head;
+ tail->next = prg->alloc_run_buf;
+ prg->alloc_run_buf = head;
}
}
-void colm_increment_steps( struct pda_run *pdaRun )
+void colm_increment_steps( struct pda_run *pda_run )
{
- pdaRun->steps += 1;
+ pda_run->steps += 1;
//debug( prg, REALM_PARSE, "steps up to %ld\n", pdaRun->steps );
}
-void colm_decrement_steps( struct pda_run *pdaRun )
+void colm_decrement_steps( struct pda_run *pda_run )
{
- pdaRun->steps -= 1;
+ pda_run->steps -= 1;
//debug( prg, REALM_PARSE, "steps down to %ld\n", pdaRun->steps );
}
-head_t *colm_stream_pull( program_t *prg, tree_t **sp, struct pda_run *pdaRun, struct stream_impl *is, long length )
+head_t *colm_stream_pull( program_t *prg, tree_t **sp, struct pda_run *pda_run, struct stream_impl *is, long length )
{
- if ( pdaRun != 0 ) {
- RunBuf *runBuf = pdaRun->consumeBuf;
- if ( length > ( FSM_BUFSIZE - runBuf->length ) ) {
- runBuf = newRunBuf();
- runBuf->next = pdaRun->consumeBuf;
- pdaRun->consumeBuf = runBuf;
+ if ( pda_run != 0 ) {
+ RunBuf *run_buf = pda_run->consume_buf;
+ if ( length > ( FSM_BUFSIZE - run_buf->length ) ) {
+ run_buf = new_run_buf();
+ run_buf->next = pda_run->consume_buf;
+ pda_run->consume_buf = run_buf;
}
- char *dest = runBuf->data + runBuf->length;
+ char *dest = run_buf->data + run_buf->length;
- is->funcs->getData( is, dest, length );
+ is->funcs->get_data( is, dest, length );
location_t *loc = location_allocate( prg );
- is->funcs->consumeData( prg, sp, is, length, loc );
+ is->funcs->consume_data( prg, sp, is, length, loc );
- runBuf->length += length;
+ run_buf->length += length;
- pdaRun->p = pdaRun->pe = 0;
- pdaRun->toklen = 0;
+ pda_run->p = pda_run->pe = 0;
+ pda_run->toklen = 0;
head_t *tokdata = colm_string_alloc_pointer( prg, dest, length );
tokdata->location = loc;
@@ -122,48 +122,48 @@ head_t *colm_stream_pull( program_t *prg, tree_t **sp, struct pda_run *pdaRun, s
return tokdata;
}
else {
- head_t *head = initStrSpace( length );
+ head_t *head = init_str_space( length );
char *dest = (char*)head->data;
- is->funcs->getData( is, dest, length );
+ is->funcs->get_data( is, dest, length );
location_t *loc = location_allocate( prg );
- is->funcs->consumeData( prg, sp, is, length, loc );
+ is->funcs->consume_data( prg, sp, is, length, loc );
head->location = loc;
return head;
}
}
-void undoStreamPull( struct stream_impl *is, const char *data, long length )
+void undo_stream_pull( struct stream_impl *is, const char *data, long length )
{
//debug( REALM_PARSE, "undoing stream pull\n" );
- is->funcs->prependData( is, data, length );
+ is->funcs->prepend_data( is, data, length );
}
void colm_stream_push_text( struct stream_impl *is, const char *data, long length )
{
- is->funcs->prependData( is, data, length );
+ is->funcs->prepend_data( is, data, length );
}
void colm_stream_push_tree( struct stream_impl *is, tree_t *tree, int ignore )
{
- is->funcs->prependTree( is, tree, ignore );
+ is->funcs->prepend_tree( is, tree, ignore );
}
void colm_stream_push_stream( struct stream_impl *is, tree_t *tree )
{
- is->funcs->prependStream( is, tree );
+ is->funcs->prepend_stream( is, tree );
}
void colm_undo_stream_push( program_t *prg, tree_t **sp, struct stream_impl *is, long length )
{
if ( length < 0 ) {
- tree_t *tree = is->funcs->undoPrependTree( is );
+ tree_t *tree = is->funcs->undo_prepend_tree( is );
colm_tree_downref( prg, sp, tree );
}
else {
- is->funcs->undoPrependData( is, length );
+ is->funcs->undo_prepend_data( is, length );
}
}
@@ -180,12 +180,12 @@ static void send_back_text( struct stream_impl *is, const char *data, long lengt
//debug( REALM_PARSE, "sending back text: %.*s\n",
// (int)length, data );
- is->funcs->undoConsumeData( is, data, length );
+ is->funcs->undo_consume_data( is, data, length );
}
static void send_back_tree( struct stream_impl *is, tree_t *tree )
{
- is->funcs->undoConsumeTree( is, tree, false );
+ is->funcs->undo_consume_tree( is, tree, false );
}
/*
@@ -193,44 +193,44 @@ static void send_back_tree( struct stream_impl *is, tree_t *tree )
* PCR_REVERSE
*/
static void send_back_ignore( program_t *prg, tree_t **sp,
- struct pda_run *pdaRun, struct stream_impl *is, parse_tree_t *parseTree )
+ struct pda_run *pda_run, struct stream_impl *is, parse_tree_t *parse_tree )
{
#ifdef DEBUG
- struct lang_el_info *lelInfo = prg->rtd->lelInfo;
+ struct lang_el_info *lel_info = prg->rtd->lel_info;
debug( prg, REALM_PARSE, "sending back: %s%s\n",
- lelInfo[parseTree->shadow->tree->id].name,
- parseTree->flags & PF_ARTIFICIAL ? " (artificial)" : "" );
+ lel_info[parse_tree->shadow->tree->id].name,
+ parse_tree->flags & PF_ARTIFICIAL ? " (artificial)" : "" );
#endif
- head_t *head = parseTree->shadow->tree->tokdata;
- int artificial = parseTree->flags & PF_ARTIFICIAL;
+ head_t *head = parse_tree->shadow->tree->tokdata;
+ int artificial = parse_tree->flags & PF_ARTIFICIAL;
if ( head != 0 && !artificial )
- send_back_text( is, stringData( head ), head->length );
+ send_back_text( is, string_data( head ), head->length );
- colm_decrement_steps( pdaRun );
+ colm_decrement_steps( pda_run );
/* Check for reverse code. */
- if ( parseTree->flags & PF_HAS_RCODE ) {
- pdaRun->onDeck = true;
- parseTree->flags &= ~PF_HAS_RCODE;
+ if ( parse_tree->flags & PF_HAS_RCODE ) {
+ pda_run->on_deck = true;
+ parse_tree->flags &= ~PF_HAS_RCODE;
}
- if ( pdaRun->steps == pdaRun->targetSteps ) {
+ if ( pda_run->steps == pda_run->target_steps ) {
debug( prg, REALM_PARSE, "trigger parse stop, steps = "
- "target = %d\n", pdaRun->targetSteps );
- pdaRun->stop = true;
+ "target = %d\n", pda_run->target_steps );
+ pda_run->stop = true;
}
}
-static void reset_token( struct pda_run *pdaRun )
+static void reset_token( struct pda_run *pda_run )
{
/* If there is a token started, but never finished for a lack of data, we
* must first backup over it. */
- if ( pdaRun->tokstart != 0 ) {
- pdaRun->p = pdaRun->pe = 0;
- pdaRun->toklen = 0;
- pdaRun->eof = 0;
+ if ( pda_run->tokstart != 0 ) {
+ pda_run->p = pda_run->pe = 0;
+ pda_run->toklen = 0;
+ pda_run->eof = 0;
}
}
@@ -238,121 +238,121 @@ static void reset_token( struct pda_run *pdaRun )
* PCR_REVERSE
*/
-static void send_back( program_t *prg, tree_t **sp, struct pda_run *pdaRun,
- struct stream_impl *is, parse_tree_t *parseTree )
+static void send_back( program_t *prg, tree_t **sp, struct pda_run *pda_run,
+ struct stream_impl *is, parse_tree_t *parse_tree )
{
debug( prg, REALM_PARSE, "sending back: %s\n",
- prg->rtd->lelInfo[parseTree->id].name );
+ prg->rtd->lel_info[parse_tree->id].name );
- if ( parseTree->flags & PF_NAMED ) {
+ if ( parse_tree->flags & PF_NAMED ) {
/* Send the named lang el back first, then send back any leading
* whitespace. */
- is->funcs->undoConsumeLangEl( is );
+ is->funcs->undo_consume_lang_el( is );
}
- colm_decrement_steps( pdaRun );
+ colm_decrement_steps( pda_run );
/* Artifical were not parsed, instead sent in as items. */
- if ( parseTree->flags & PF_ARTIFICIAL ) {
+ if ( parse_tree->flags & PF_ARTIFICIAL ) {
/* Check for reverse code. */
- if ( parseTree->flags & PF_HAS_RCODE ) {
+ if ( parse_tree->flags & PF_HAS_RCODE ) {
debug( prg, REALM_PARSE, "tree has rcode, setting on deck\n" );
- pdaRun->onDeck = true;
- parseTree->flags &= ~PF_HAS_RCODE;
+ pda_run->on_deck = true;
+ parse_tree->flags &= ~PF_HAS_RCODE;
}
- colm_tree_upref( parseTree->shadow->tree );
+ colm_tree_upref( parse_tree->shadow->tree );
- send_back_tree( is, parseTree->shadow->tree );
+ send_back_tree( is, parse_tree->shadow->tree );
}
else {
/* Check for reverse code. */
- if ( parseTree->flags & PF_HAS_RCODE ) {
+ if ( parse_tree->flags & PF_HAS_RCODE ) {
debug( prg, REALM_PARSE, "tree has rcode, setting on deck\n" );
- pdaRun->onDeck = true;
- parseTree->flags &= ~PF_HAS_RCODE;
+ pda_run->on_deck = true;
+ parse_tree->flags &= ~PF_HAS_RCODE;
}
/* Push back the token data. */
- send_back_text( is, stringData( parseTree->shadow->tree->tokdata ),
- stringLength( parseTree->shadow->tree->tokdata ) );
+ send_back_text( is, string_data( parse_tree->shadow->tree->tokdata ),
+ string_length( parse_tree->shadow->tree->tokdata ) );
/* If eof was just sent back remember that it needs to be sent again. */
- if ( parseTree->id == prg->rtd->eofLelIds[pdaRun->parserId] )
- is->eofSent = false;
+ if ( parse_tree->id == prg->rtd->eof_lel_ids[pda_run->parser_id] )
+ is->eof_sent = false;
/* If the item is bound then store remove it from the bindings array. */
- prg->rtd->popBinding( pdaRun, parseTree );
+ prg->rtd->pop_binding( pda_run, parse_tree );
}
- if ( pdaRun->steps == pdaRun->targetSteps ) {
+ if ( pda_run->steps == pda_run->target_steps ) {
debug( prg, REALM_PARSE, "trigger parse stop, "
- "steps = target = %d\n", pdaRun->targetSteps );
- pdaRun->stop = true;
+ "steps = target = %d\n", pda_run->target_steps );
+ pda_run->stop = true;
}
/* Downref the tree that was sent back and free the kid. */
- colm_tree_downref( prg, sp, parseTree->shadow->tree );
- kid_free( prg, parseTree->shadow );
- parse_tree_free( prg, parseTree );
+ colm_tree_downref( prg, sp, parse_tree->shadow->tree );
+ kid_free( prg, parse_tree->shadow );
+ parse_tree_free( prg, parse_tree );
}
-static void set_region( struct pda_run *pdaRun, int emptyIgnore, parse_tree_t *tree )
+static void set_region( struct pda_run *pda_run, int empty_ignore, parse_tree_t *tree )
{
- if ( emptyIgnore ) {
+ if ( empty_ignore ) {
/* Recording the next region. */
- tree->retryRegion = pdaRun->nextRegionInd;
- if ( pdaRun->pda_tables->tokenRegions[tree->retryRegion+1] != 0 )
- pdaRun->numRetry += 1;
+ tree->retry_region = pda_run->next_region_ind;
+ if ( pda_run->pda_tables->token_regions[tree->retry_region+1] != 0 )
+ pda_run->num_retry += 1;
}
}
-static void ignore_tree( program_t *prg, struct pda_run *pdaRun, tree_t *tree )
+static void ignore_tree( program_t *prg, struct pda_run *pda_run, tree_t *tree )
{
- int emptyIgnore = pdaRun->accumIgnore == 0;
+ int empty_ignore = pda_run->accum_ignore == 0;
- colm_increment_steps( pdaRun );
+ colm_increment_steps( pda_run );
- parse_tree_t *parseTree = parse_tree_allocate( prg );
- parseTree->shadow = kid_allocate( prg );
- parseTree->shadow->tree = tree;
+ parse_tree_t *parse_tree = parse_tree_allocate( prg );
+ parse_tree->shadow = kid_allocate( prg );
+ parse_tree->shadow->tree = tree;
- parseTree->next = pdaRun->accumIgnore;
- pdaRun->accumIgnore = parseTree;
+ parse_tree->next = pda_run->accum_ignore;
+ pda_run->accum_ignore = parse_tree;
- colm_transfer_reverse_code( pdaRun, parseTree );
+ colm_transfer_reverse_code( pda_run, parse_tree );
- if ( pdaRun->preRegion >= 0 )
- parseTree->flags |= PF_RIGHT_IGNORE;
+ if ( pda_run->pre_region >= 0 )
+ parse_tree->flags |= PF_RIGHT_IGNORE;
- set_region( pdaRun, emptyIgnore, pdaRun->accumIgnore );
+ set_region( pda_run, empty_ignore, pda_run->accum_ignore );
}
-static void ignore_tree_art( program_t *prg, struct pda_run *pdaRun, tree_t *tree )
+static void ignore_tree_art( program_t *prg, struct pda_run *pda_run, tree_t *tree )
{
- int emptyIgnore = pdaRun->accumIgnore == 0;
+ int empty_ignore = pda_run->accum_ignore == 0;
- colm_increment_steps( pdaRun );
+ colm_increment_steps( pda_run );
- parse_tree_t *parseTree = parse_tree_allocate( prg );
- parseTree->flags |= PF_ARTIFICIAL;
- parseTree->shadow = kid_allocate( prg );
- parseTree->shadow->tree = tree;
+ parse_tree_t *parse_tree = parse_tree_allocate( prg );
+ parse_tree->flags |= PF_ARTIFICIAL;
+ parse_tree->shadow = kid_allocate( prg );
+ parse_tree->shadow->tree = tree;
- parseTree->next = pdaRun->accumIgnore;
- pdaRun->accumIgnore = parseTree;
+ parse_tree->next = pda_run->accum_ignore;
+ pda_run->accum_ignore = parse_tree;
- colm_transfer_reverse_code( pdaRun, parseTree );
+ colm_transfer_reverse_code( pda_run, parse_tree );
- set_region( pdaRun, emptyIgnore, pdaRun->accumIgnore );
+ set_region( pda_run, empty_ignore, pda_run->accum_ignore );
}
-kid_t *make_token_with_data( program_t *prg, struct pda_run *pdaRun,
+kid_t *make_token_with_data( program_t *prg, struct pda_run *pda_run,
struct stream_impl *is, int id, head_t *tokdata )
{
/* Make the token object. */
- long objectLength = prg->rtd->lelInfo[id].objectLength;
- kid_t *attrs = allocAttrs( prg, objectLength );
+ long object_length = prg->rtd->lel_info[id].object_length;
+ kid_t *attrs = alloc_attrs( prg, object_length );
kid_t *input = 0;
input = kid_allocate( prg );
@@ -367,16 +367,16 @@ kid_t *make_token_with_data( program_t *prg, struct pda_run *pdaRun,
/* No children and ignores get added later. */
input->tree->child = attrs;
- struct lang_el_info *lelInfo = prg->rtd->lelInfo;
- if ( lelInfo[id].numCaptureAttr > 0 ) {
+ struct lang_el_info *lel_info = prg->rtd->lel_info;
+ if ( lel_info[id].num_capture_attr > 0 ) {
int i;
- for ( i = 0; i < lelInfo[id].numCaptureAttr; i++ ) {
- CaptureAttr *ca = &prg->rtd->captureAttr[lelInfo[id].captureAttr + i];
- head_t *data = stringAllocFull( prg,
- pdaRun->mark[ca->mark_enter],
- pdaRun->mark[ca->mark_leave] -
- pdaRun->mark[ca->mark_enter] );
- tree_t *string = constructString( prg, data );
+ for ( i = 0; i < lel_info[id].num_capture_attr; i++ ) {
+ CaptureAttr *ca = &prg->rtd->capture_attr[lel_info[id].capture_attr + i];
+ head_t *data = string_alloc_full( prg,
+ pda_run->mark[ca->mark_enter],
+ pda_run->mark[ca->mark_leave] -
+ pda_run->mark[ca->mark_enter] );
+ tree_t *string = construct_string( prg, data );
colm_tree_upref( string );
colm_tree_set_field( prg, input->tree, ca->offset, string );
}
@@ -385,9 +385,9 @@ kid_t *make_token_with_data( program_t *prg, struct pda_run *pdaRun,
return input;
}
-static void report_parse_error( program_t *prg, tree_t **sp, struct pda_run *pdaRun )
+static void report_parse_error( program_t *prg, tree_t **sp, struct pda_run *pda_run )
{
- kid_t *kid = pdaRun->btPoint;
+ kid_t *kid = pda_run->bt_point;
head_t *deepest = 0;
while ( kid != 0 ) {
head_t *head = kid->tree->tokdata;
@@ -398,15 +398,15 @@ static void report_parse_error( program_t *prg, tree_t **sp, struct pda_run *pda
kid = kid->next;
}
- head_t *errorHead = 0;
+ head_t *error_head = 0;
/* If there are no error points on record assume the error occurred at the
* beginning of the stream. */
if ( deepest == 0 ) {
- errorHead = stringAllocFull( prg, "<input>:1:1: parse error", 32 );
- errorHead->location = location_allocate( prg );
- errorHead->location->line = 1;
- errorHead->location->column = 1;
+ error_head = string_alloc_full( prg, "<input>:1:1: parse error", 32 );
+ error_head->location = location_allocate( prg );
+ error_head->location->line = 1;
+ error_head->location->column = 1;
}
else {
debug( prg, REALM_PARSE, "deepest location byte: %d\n",
@@ -431,317 +431,317 @@ static void report_parse_error( program_t *prg, tree_t **sp, struct pda_run *pda
name = "<input>";
char *formatted = malloc( strlen( name ) + 128 );
sprintf( formatted, "%s:%ld:%ld: parse error", name, line, column );
- errorHead = stringAllocFull( prg, formatted, strlen(formatted) );
+ error_head = string_alloc_full( prg, formatted, strlen(formatted) );
free( formatted );
- errorHead->location = location_allocate( prg );
+ error_head->location = location_allocate( prg );
- errorHead->location->name = deepest->location->name;
- errorHead->location->line = line;
- errorHead->location->column = column;
- errorHead->location->byte = byte;
+ error_head->location->name = deepest->location->name;
+ error_head->location->line = line;
+ error_head->location->column = column;
+ error_head->location->byte = byte;
}
- tree_t *tree = constructString( prg, errorHead );
- colm_tree_downref( prg, sp, pdaRun->parseErrorText );
- pdaRun->parseErrorText = tree;
- colm_tree_upref( pdaRun->parseErrorText );
+ tree_t *tree = construct_string( prg, error_head );
+ colm_tree_downref( prg, sp, pda_run->parse_error_text );
+ pda_run->parse_error_text = tree;
+ colm_tree_upref( pda_run->parse_error_text );
}
static void attach_right_ignore( program_t *prg, tree_t **sp,
- struct pda_run *pdaRun, parse_tree_t *parseTree )
+ struct pda_run *pda_run, parse_tree_t *parse_tree )
{
- if ( pdaRun->accumIgnore == 0 )
+ if ( pda_run->accum_ignore == 0 )
return;
- if ( pdaRun->stackTop->id > 0 &&
- pdaRun->stackTop->id < prg->rtd->firstNonTermId )
+ if ( pda_run->stack_top->id > 0 &&
+ pda_run->stack_top->id < prg->rtd->first_non_term_id )
{
/* OK, do it */
debug( prg, REALM_PARSE, "attaching right ignore\n" );
/* Reset. */
- assert( ! ( parseTree->flags & PF_RIGHT_IL_ATTACHED ) );
+ assert( ! ( parse_tree->flags & PF_RIGHT_IL_ATTACHED ) );
- parse_tree_t *accum = pdaRun->accumIgnore;
+ parse_tree_t *accum = pda_run->accum_ignore;
- parse_tree_t *stopAt = 0, *use = accum;
+ parse_tree_t *stop_at = 0, *use = accum;
while ( use != 0 ) {
if ( ! (use->flags & PF_RIGHT_IGNORE) )
- stopAt = use;
+ stop_at = use;
use = use->next;
}
- if ( stopAt != 0 ) {
+ if ( stop_at != 0 ) {
/* Stop at was set. Make it the last item in the igore list. Take
* the rest. */
- accum = stopAt->next;
- stopAt->next = 0;
+ accum = stop_at->next;
+ stop_at->next = 0;
}
else {
/* Stop at was never set. All right ignore. Use it all. */
- pdaRun->accumIgnore = 0;
+ pda_run->accum_ignore = 0;
}
/* The data list needs to be extracted and reversed. The parse tree list
* can remain in stack order. */
parse_tree_t *child = accum, *last = 0;
- kid_t *dataChild = 0, *dataLast = 0;
+ kid_t *data_child = 0, *data_last = 0;
while ( child ) {
- dataChild = child->shadow;
+ data_child = child->shadow;
parse_tree_t *next = child->next;
/* Reverse the lists. */
- dataChild->next = dataLast;
+ data_child->next = data_last;
child->next = last;
/* Detach the parse tree from the data tree. */
child->shadow = 0;
/* Keep the last for reversal. */
- dataLast = dataChild;
+ data_last = data_child;
last = child;
child = next;
}
/* Last is now the first. */
- parseTree->rightIgnore = last;
+ parse_tree->right_ignore = last;
- if ( dataChild != 0 ) {
+ if ( data_child != 0 ) {
debug( prg, REALM_PARSE, "attaching ignore right\n" );
- kid_t *ignoreKid = dataLast;
+ kid_t *ignore_kid = data_last;
/* Copy the ignore list first if we need to attach it as a right
* ignore. */
- tree_t *rightIgnore = 0;
+ tree_t *right_ignore = 0;
- rightIgnore = tree_allocate( prg );
- rightIgnore->id = LEL_ID_IGNORE;
- rightIgnore->child = ignoreKid;
+ right_ignore = tree_allocate( prg );
+ right_ignore->id = LEL_ID_IGNORE;
+ right_ignore->child = ignore_kid;
- tree_t *pushTo = parseTree->shadow->tree;
+ tree_t *push_to = parse_tree->shadow->tree;
- pushTo = push_right_ignore( prg, pushTo, rightIgnore );
+ push_to = push_right_ignore( prg, push_to, right_ignore );
- parseTree->shadow->tree = pushTo;
+ parse_tree->shadow->tree = push_to;
- parseTree->flags |= PF_RIGHT_IL_ATTACHED;
+ parse_tree->flags |= PF_RIGHT_IL_ATTACHED;
}
}
}
static void attach_left_ignore( program_t *prg, tree_t **sp,
- struct pda_run *pdaRun, parse_tree_t *parseTree )
+ struct pda_run *pda_run, parse_tree_t *parse_tree )
{
/* Reset. */
- assert( ! ( parseTree->flags & PF_LEFT_IL_ATTACHED ) );
+ assert( ! ( parse_tree->flags & PF_LEFT_IL_ATTACHED ) );
- parse_tree_t *accum = pdaRun->accumIgnore;
- pdaRun->accumIgnore = 0;
+ parse_tree_t *accum = pda_run->accum_ignore;
+ pda_run->accum_ignore = 0;
/* The data list needs to be extracted and reversed. The parse tree list
* can remain in stack order. */
parse_tree_t *child = accum, *last = 0;
- kid_t *dataChild = 0, *dataLast = 0;
+ kid_t *data_child = 0, *data_last = 0;
while ( child ) {
- dataChild = child->shadow;
+ data_child = child->shadow;
parse_tree_t *next = child->next;
/* Reverse the lists. */
- dataChild->next = dataLast;
+ data_child->next = data_last;
child->next = last;
/* Detach the parse tree from the data tree. */
child->shadow = 0;
/* Keep the last for reversal. */
- dataLast = dataChild;
+ data_last = data_child;
last = child;
child = next;
}
/* Last is now the first. */
- parseTree->leftIgnore = last;
+ parse_tree->left_ignore = last;
- if ( dataChild != 0 ) {
+ if ( data_child != 0 ) {
debug( prg, REALM_PARSE, "attaching left ignore\n" );
- kid_t *ignoreKid = dataChild;
+ kid_t *ignore_kid = data_child;
/* Make the ignore list for the left-ignore. */
- tree_t *leftIgnore = tree_allocate( prg );
- leftIgnore->id = LEL_ID_IGNORE;
- leftIgnore->child = ignoreKid;
+ tree_t *left_ignore = tree_allocate( prg );
+ left_ignore->id = LEL_ID_IGNORE;
+ left_ignore->child = ignore_kid;
- tree_t *pushTo = parseTree->shadow->tree;
+ tree_t *push_to = parse_tree->shadow->tree;
- pushTo = push_left_ignore( prg, pushTo, leftIgnore );
+ push_to = push_left_ignore( prg, push_to, left_ignore );
- parseTree->shadow->tree = pushTo;
+ parse_tree->shadow->tree = push_to;
- parseTree->flags |= PF_LEFT_IL_ATTACHED;
+ parse_tree->flags |= PF_LEFT_IL_ATTACHED;
}
}
/* Not currently used. Need to revive this. WARNING: untested changes here */
static void detach_right_ignore( program_t *prg, tree_t **sp,
- struct pda_run *pdaRun, parse_tree_t *parseTree )
+ struct pda_run *pda_run, parse_tree_t *parse_tree )
{
/* Right ignore are immediately discarded since they are copies of
* left-ignores. */
- tree_t *rightIgnore = 0;
- if ( parseTree->flags & PF_RIGHT_IL_ATTACHED ) {
- tree_t *popFrom = parseTree->shadow->tree;
+ tree_t *right_ignore = 0;
+ if ( parse_tree->flags & PF_RIGHT_IL_ATTACHED ) {
+ tree_t *pop_from = parse_tree->shadow->tree;
- popFrom = popRightIgnore( prg, sp, popFrom, &rightIgnore );
+ pop_from = pop_right_ignore( prg, sp, pop_from, &right_ignore );
- parseTree->shadow->tree = popFrom;
+ parse_tree->shadow->tree = pop_from;
- parseTree->flags &= ~PF_RIGHT_IL_ATTACHED;
+ parse_tree->flags &= ~PF_RIGHT_IL_ATTACHED;
}
- if ( parseTree->rightIgnore != 0 ) {
- assert( rightIgnore != 0 );
+ if ( parse_tree->right_ignore != 0 ) {
+ assert( right_ignore != 0 );
/* Transfer the trees to accumIgnore. */
- parse_tree_t *ignore = parseTree->rightIgnore;
- parseTree->rightIgnore = 0;
+ parse_tree_t *ignore = parse_tree->right_ignore;
+ parse_tree->right_ignore = 0;
- kid_t *dataIgnore = rightIgnore->child;
- rightIgnore->child = 0;
+ kid_t *data_ignore = right_ignore->child;
+ right_ignore->child = 0;
parse_tree_t *last = 0;
- kid_t *dataLast = 0;
+ kid_t *data_last = 0;
while ( ignore != 0 ) {
parse_tree_t *next = ignore->next;
- kid_t *dataNext = dataIgnore->next;
+ kid_t *data_next = data_ignore->next;
/* Put the data trees underneath the parse trees. */
- ignore->shadow = dataIgnore;
+ ignore->shadow = data_ignore;
/* Reverse. */
ignore->next = last;
- dataIgnore->next = dataLast;
+ data_ignore->next = data_last;
/* Keep last for reversal. */
last = ignore;
- dataLast = dataIgnore;
+ data_last = data_ignore;
ignore = next;
- dataIgnore = dataNext;
+ data_ignore = data_next;
}
- pdaRun->accumIgnore = last;
+ pda_run->accum_ignore = last;
- colm_tree_downref( prg, sp, rightIgnore );
+ colm_tree_downref( prg, sp, right_ignore );
}
}
static void detach_left_ignore( program_t *prg, tree_t **sp,
- struct pda_run *pdaRun, parse_tree_t *parseTree )
+ struct pda_run *pda_run, parse_tree_t *parse_tree )
{
/* Detach left. */
- tree_t *leftIgnore = 0;
- if ( parseTree->flags & PF_LEFT_IL_ATTACHED ) {
- tree_t *popFrom = parseTree->shadow->tree;
+ tree_t *left_ignore = 0;
+ if ( parse_tree->flags & PF_LEFT_IL_ATTACHED ) {
+ tree_t *pop_from = parse_tree->shadow->tree;
- popFrom = popLeftIgnore( prg, sp, popFrom, &leftIgnore );
+ pop_from = pop_left_ignore( prg, sp, pop_from, &left_ignore );
- parseTree->shadow->tree = popFrom;
+ parse_tree->shadow->tree = pop_from;
- parseTree->flags &= ~PF_LEFT_IL_ATTACHED;
+ parse_tree->flags &= ~PF_LEFT_IL_ATTACHED;
}
- if ( parseTree->leftIgnore != 0 ) {
- assert( leftIgnore != 0 );
+ if ( parse_tree->left_ignore != 0 ) {
+ assert( left_ignore != 0 );
/* Transfer the trees to accumIgnore. */
- parse_tree_t *ignore = parseTree->leftIgnore;
- parseTree->leftIgnore = 0;
+ parse_tree_t *ignore = parse_tree->left_ignore;
+ parse_tree->left_ignore = 0;
- kid_t *dataIgnore = leftIgnore->child;
- leftIgnore->child = 0;
+ kid_t *data_ignore = left_ignore->child;
+ left_ignore->child = 0;
parse_tree_t *last = 0;
- kid_t *dataLast = 0;
+ kid_t *data_last = 0;
while ( ignore != 0 ) {
parse_tree_t *next = ignore->next;
- kid_t *dataNext = dataIgnore->next;
+ kid_t *data_next = data_ignore->next;
/* Put the data trees underneath the parse trees. */
- ignore->shadow = dataIgnore;
+ ignore->shadow = data_ignore;
/* Reverse. */
ignore->next = last;
- dataIgnore->next = dataLast;
+ data_ignore->next = data_last;
/* Keep last for reversal. */
last = ignore;
- dataLast = dataIgnore;
+ data_last = data_ignore;
ignore = next;
- dataIgnore = dataNext;
+ data_ignore = data_next;
}
- pdaRun->accumIgnore = last;
+ pda_run->accum_ignore = last;
}
- colm_tree_downref( prg, sp, leftIgnore );
+ colm_tree_downref( prg, sp, left_ignore );
}
-static int is_parser_stop_finished( struct pda_run *pdaRun )
+static int is_parser_stop_finished( struct pda_run *pda_run )
{
int done =
- pdaRun->stackTop->next != 0 &&
- pdaRun->stackTop->next->next == 0 &&
- pdaRun->stackTop->id == pdaRun->stopTarget;
+ pda_run->stack_top->next != 0 &&
+ pda_run->stack_top->next->next == 0 &&
+ pda_run->stack_top->id == pda_run->stop_target;
return done;
}
-static void handle_error( program_t *prg, tree_t **sp, struct pda_run *pdaRun )
+static void handle_error( program_t *prg, tree_t **sp, struct pda_run *pda_run )
{
/* Check the result. */
- if ( pdaRun->parseError ) {
+ if ( pda_run->parse_error ) {
/* Error occured in the top-level parser. */
- report_parse_error( prg, sp, pdaRun );
+ report_parse_error( prg, sp, pda_run );
}
else {
- if ( is_parser_stop_finished( pdaRun ) ) {
+ if ( is_parser_stop_finished( pda_run ) ) {
debug( prg, REALM_PARSE, "stopping the parse\n" );
- pdaRun->stopParsing = true;
+ pda_run->stop_parsing = true;
}
}
}
-static head_t *extract_match( program_t *prg, tree_t **sp, struct pda_run *pdaRun, struct stream_impl *is )
+static head_t *extract_match( program_t *prg, tree_t **sp, struct pda_run *pda_run, struct stream_impl *is )
{
- long length = pdaRun->toklen;
+ long length = pda_run->toklen;
//debug( prg, REALM_PARSE, "extracting token of length: %ld\n", length );
- RunBuf *runBuf = pdaRun->consumeBuf;
- if ( runBuf == 0 || length > ( FSM_BUFSIZE - runBuf->length ) ) {
- runBuf = newRunBuf();
- runBuf->next = pdaRun->consumeBuf;
- pdaRun->consumeBuf = runBuf;
+ RunBuf *run_buf = pda_run->consume_buf;
+ if ( run_buf == 0 || length > ( FSM_BUFSIZE - run_buf->length ) ) {
+ run_buf = new_run_buf();
+ run_buf->next = pda_run->consume_buf;
+ pda_run->consume_buf = run_buf;
}
- char *dest = runBuf->data + runBuf->length;
+ char *dest = run_buf->data + run_buf->length;
- is->funcs->getData( is, dest, length );
+ is->funcs->get_data( is, dest, length );
location_t *location = location_allocate( prg );
- is->funcs->consumeData( prg, sp, is, length, location );
+ is->funcs->consume_data( prg, sp, is, length, location );
- runBuf->length += length;
+ run_buf->length += length;
- pdaRun->p = pdaRun->pe = 0;
- pdaRun->toklen = 0;
- pdaRun->tokstart = 0;
+ pda_run->p = pda_run->pe = 0;
+ pda_run->toklen = 0;
+ pda_run->tokstart = 0;
head_t *head = colm_string_alloc_pointer( prg, dest, length );
@@ -752,23 +752,23 @@ static head_t *extract_match( program_t *prg, tree_t **sp, struct pda_run *pdaRu
return head;
}
-static head_t *peekMatch( program_t *prg, struct pda_run *pdaRun, struct stream_impl *is )
+static head_t *peek_match( program_t *prg, struct pda_run *pda_run, struct stream_impl *is )
{
- long length = pdaRun->toklen;
+ long length = pda_run->toklen;
- RunBuf *runBuf = pdaRun->consumeBuf;
- if ( runBuf == 0 || length > ( FSM_BUFSIZE - runBuf->length ) ) {
- runBuf = newRunBuf();
- runBuf->next = pdaRun->consumeBuf;
- pdaRun->consumeBuf = runBuf;
+ RunBuf *run_buf = pda_run->consume_buf;
+ if ( run_buf == 0 || length > ( FSM_BUFSIZE - run_buf->length ) ) {
+ run_buf = new_run_buf();
+ run_buf->next = pda_run->consume_buf;
+ pda_run->consume_buf = run_buf;
}
- char *dest = runBuf->data + runBuf->length;
+ char *dest = run_buf->data + run_buf->length;
- is->funcs->getData( is, dest, length );
+ is->funcs->get_data( is, dest, length );
- pdaRun->p = pdaRun->pe = 0;
- pdaRun->toklen = 0;
+ pda_run->p = pda_run->pe = 0;
+ pda_run->toklen = 0;
head_t *head = colm_string_alloc_pointer( prg, dest, length );
@@ -784,78 +784,78 @@ static head_t *peekMatch( program_t *prg, struct pda_run *pdaRun, struct stream_
static void send_ignore( program_t *prg, tree_t **sp,
- struct pda_run *pdaRun, struct stream_impl *is, long id )
+ struct pda_run *pda_run, struct stream_impl *is, long id )
{
- debug( prg, REALM_PARSE, "ignoring: %s\n", prg->rtd->lelInfo[id].name );
+ debug( prg, REALM_PARSE, "ignoring: %s\n", prg->rtd->lel_info[id].name );
/* Make the ignore string. */
- head_t *ignoreStr = extract_match( prg, sp, pdaRun, is );
+ head_t *ignore_str = extract_match( prg, sp, pda_run, is );
- debug( prg, REALM_PARSE, "ignoring: %.*s\n", ignoreStr->length, ignoreStr->data );
+ debug( prg, REALM_PARSE, "ignoring: %.*s\n", ignore_str->length, ignore_str->data );
tree_t *tree = tree_allocate( prg );
tree->refs = 1;
tree->id = id;
- tree->tokdata = ignoreStr;
+ tree->tokdata = ignore_str;
/* Send it to the pdaRun. */
- ignore_tree( prg, pdaRun, tree );
+ ignore_tree( prg, pda_run, tree );
}
static void send_token( program_t *prg, tree_t **sp,
- struct pda_run *pdaRun, struct stream_impl *is, long id )
+ struct pda_run *pda_run, struct stream_impl *is, long id )
{
- int emptyIgnore = pdaRun->accumIgnore == 0;
+ int empty_ignore = pda_run->accum_ignore == 0;
/* Make the token data. */
- head_t *tokdata = extract_match( prg, sp, pdaRun, is );
+ head_t *tokdata = extract_match( prg, sp, pda_run, is );
debug( prg, REALM_PARSE, "token: %s text: %.*s\n",
- prg->rtd->lelInfo[id].name,
- stringLength(tokdata), stringData(tokdata) );
+ prg->rtd->lel_info[id].name,
+ string_length(tokdata), string_data(tokdata) );
- kid_t *input = make_token_with_data( prg, pdaRun, is, id, tokdata );
+ kid_t *input = make_token_with_data( prg, pda_run, is, id, tokdata );
- colm_increment_steps( pdaRun );
+ colm_increment_steps( pda_run );
- parse_tree_t *parseTree = parse_tree_allocate( prg );
- parseTree->id = input->tree->id;
- parseTree->shadow = input;
+ parse_tree_t *parse_tree = parse_tree_allocate( prg );
+ parse_tree->id = input->tree->id;
+ parse_tree->shadow = input;
- pdaRun->parseInput = parseTree;
+ pda_run->parse_input = parse_tree;
/* Store any alternate scanning region. */
- if ( input != 0 && pdaRun->pda_cs >= 0 )
- set_region( pdaRun, emptyIgnore, parseTree );
+ if ( input != 0 && pda_run->pda_cs >= 0 )
+ set_region( pda_run, empty_ignore, parse_tree );
}
-static void send_tree( program_t *prg, tree_t **sp, struct pda_run *pdaRun, struct stream_impl *is )
+static void send_tree( program_t *prg, tree_t **sp, struct pda_run *pda_run, struct stream_impl *is )
{
kid_t *input = kid_allocate( prg );
- input->tree = is->funcs->consumeTree( is );
+ input->tree = is->funcs->consume_tree( is );
- colm_increment_steps( pdaRun );
+ colm_increment_steps( pda_run );
- parse_tree_t *parseTree = parse_tree_allocate( prg );
- parseTree->id = input->tree->id;
- parseTree->flags |= PF_ARTIFICIAL;
- parseTree->shadow = input;
+ parse_tree_t *parse_tree = parse_tree_allocate( prg );
+ parse_tree->id = input->tree->id;
+ parse_tree->flags |= PF_ARTIFICIAL;
+ parse_tree->shadow = input;
- pdaRun->parseInput = parseTree;
+ pda_run->parse_input = parse_tree;
}
-static void send_ignore_tree( program_t *prg, tree_t **sp, struct pda_run *pdaRun, struct stream_impl *is )
+static void send_ignore_tree( program_t *prg, tree_t **sp, struct pda_run *pda_run, struct stream_impl *is )
{
- tree_t *tree = is->funcs->consumeTree( is );
- ignore_tree_art( prg, pdaRun, tree );
+ tree_t *tree = is->funcs->consume_tree( is );
+ ignore_tree_art( prg, pda_run, tree );
}
static void send_collect_ignore( program_t *prg, tree_t **sp,
- struct pda_run *pdaRun, struct stream_impl *is, int id )
+ struct pda_run *pda_run, struct stream_impl *is, int id )
{
debug( prg, REALM_PARSE, "token: CI\n" );
- int emptyIgnore = pdaRun->accumIgnore == 0;
+ int empty_ignore = pda_run->accum_ignore == 0;
/* Make the token data. */
head_t *tokdata = head_allocate( prg );
@@ -865,40 +865,40 @@ static void send_collect_ignore( program_t *prg, tree_t **sp,
tokdata->location->byte = is->byte;
debug( prg, REALM_PARSE, "token: %s text: %.*s\n",
- prg->rtd->lelInfo[id].name,
- stringLength(tokdata), stringData(tokdata) );
+ prg->rtd->lel_info[id].name,
+ string_length(tokdata), string_data(tokdata) );
- kid_t *input = make_token_with_data( prg, pdaRun, is, id, tokdata );
+ kid_t *input = make_token_with_data( prg, pda_run, is, id, tokdata );
- colm_increment_steps( pdaRun );
+ colm_increment_steps( pda_run );
- parse_tree_t *parseTree = parse_tree_allocate( prg );
- parseTree->id = input->tree->id;
- parseTree->shadow = input;
+ parse_tree_t *parse_tree = parse_tree_allocate( prg );
+ parse_tree->id = input->tree->id;
+ parse_tree->shadow = input;
- pdaRun->parseInput = parseTree;
+ pda_run->parse_input = parse_tree;
/* Store any alternate scanning region. */
- if ( input != 0 && pdaRun->pda_cs >= 0 )
- set_region( pdaRun, emptyIgnore, parseTree );
+ if ( input != 0 && pda_run->pda_cs >= 0 )
+ set_region( pda_run, empty_ignore, parse_tree );
}
/* Offset can be used to look at the next nextRegionInd. */
-static int get_next_region( struct pda_run *pdaRun, int offset )
+static int get_next_region( struct pda_run *pda_run, int offset )
{
- return pdaRun->pda_tables->tokenRegions[pdaRun->nextRegionInd+offset];
+ return pda_run->pda_tables->token_regions[pda_run->next_region_ind+offset];
}
-static int get_next_pre_region( struct pda_run *pdaRun )
+static int get_next_pre_region( struct pda_run *pda_run )
{
- return pdaRun->pda_tables->tokenPreRegions[pdaRun->nextRegionInd];
+ return pda_run->pda_tables->token_pre_regions[pda_run->next_region_ind];
}
-static void send_eof( program_t *prg, tree_t **sp, struct pda_run *pdaRun, struct stream_impl *is )
+static void send_eof( program_t *prg, tree_t **sp, struct pda_run *pda_run, struct stream_impl *is )
{
debug( prg, REALM_PARSE, "token: _EOF\n" );
- colm_increment_steps( pdaRun );
+ colm_increment_steps( pda_run );
head_t *head = head_allocate( prg );
head->location = location_allocate( prg );
@@ -910,56 +910,56 @@ static void send_eof( program_t *prg, tree_t **sp, struct pda_run *pdaRun, struc
input->tree = tree_allocate( prg );
input->tree->refs = 1;
- input->tree->id = prg->rtd->eofLelIds[pdaRun->parserId];
+ input->tree->id = prg->rtd->eof_lel_ids[pda_run->parser_id];
input->tree->tokdata = head;
/* Set the state using the state of the parser. */
- pdaRun->region = get_next_region( pdaRun, 0 );
- pdaRun->preRegion = get_next_pre_region( pdaRun );
- pdaRun->fsm_cs = pdaRun->fsm_tables->entryByRegion[pdaRun->region];
+ pda_run->region = get_next_region( pda_run, 0 );
+ pda_run->pre_region = get_next_pre_region( pda_run );
+ pda_run->fsm_cs = pda_run->fsm_tables->entry_by_region[pda_run->region];
- parse_tree_t *parseTree = parse_tree_allocate( prg );
- parseTree->id = input->tree->id;
- parseTree->shadow = input;
+ parse_tree_t *parse_tree = parse_tree_allocate( prg );
+ parse_tree->id = input->tree->id;
+ parse_tree->shadow = input;
- pdaRun->parseInput = parseTree;
+ pda_run->parse_input = parse_tree;
}
-static void new_token( program_t *prg, struct pda_run *pdaRun )
+static void new_token( program_t *prg, struct pda_run *pda_run )
{
- pdaRun->p = pdaRun->pe = 0;
- pdaRun->toklen = 0;
- pdaRun->eof = 0;
+ pda_run->p = pda_run->pe = 0;
+ pda_run->toklen = 0;
+ pda_run->eof = 0;
/* Init the scanner vars. */
- pdaRun->act = 0;
- pdaRun->tokstart = 0;
- pdaRun->tokend = 0;
- pdaRun->matchedToken = 0;
+ pda_run->act = 0;
+ pda_run->tokstart = 0;
+ pda_run->tokend = 0;
+ pda_run->matched_token = 0;
/* Set the state using the state of the parser. */
- pdaRun->region = get_next_region( pdaRun, 0 );
- pdaRun->preRegion = get_next_pre_region( pdaRun );
- if ( pdaRun->preRegion > 0 ) {
- pdaRun->fsm_cs = pdaRun->fsm_tables->entryByRegion[pdaRun->preRegion];
- pdaRun->next_cs = pdaRun->fsm_tables->entryByRegion[pdaRun->region];
+ pda_run->region = get_next_region( pda_run, 0 );
+ pda_run->pre_region = get_next_pre_region( pda_run );
+ if ( pda_run->pre_region > 0 ) {
+ pda_run->fsm_cs = pda_run->fsm_tables->entry_by_region[pda_run->pre_region];
+ pda_run->next_cs = pda_run->fsm_tables->entry_by_region[pda_run->region];
}
else {
- pdaRun->fsm_cs = pdaRun->fsm_tables->entryByRegion[pdaRun->region];
+ pda_run->fsm_cs = pda_run->fsm_tables->entry_by_region[pda_run->region];
}
/* Clear the mark array. */
- memset( pdaRun->mark, 0, sizeof(pdaRun->mark) );
+ memset( pda_run->mark, 0, sizeof(pda_run->mark) );
}
-static void push_bt_point( program_t *prg, struct pda_run *pdaRun )
+static void push_bt_point( program_t *prg, struct pda_run *pda_run )
{
tree_t *tree = 0;
- if ( pdaRun->accumIgnore != 0 )
- tree = pdaRun->accumIgnore->shadow->tree;
- else if ( pdaRun->tokenList != 0 )
- tree = pdaRun->tokenList->kid->tree;
+ if ( pda_run->accum_ignore != 0 )
+ tree = pda_run->accum_ignore->shadow->tree;
+ else if ( pda_run->token_list != 0 )
+ tree = pda_run->token_list->kid->tree;
if ( tree != 0 ) {
debug( prg, REALM_PARSE, "pushing bt point with location byte %d\n",
@@ -969,8 +969,8 @@ static void push_bt_point( program_t *prg, struct pda_run *pdaRun )
kid_t *kid = kid_allocate( prg );
kid->tree = tree;
colm_tree_upref( tree );
- kid->next = pdaRun->btPoint;
- pdaRun->btPoint = kid;
+ kid->next = pda_run->bt_point;
+ pda_run->bt_point = kid;
}
}
@@ -983,116 +983,116 @@ static void push_bt_point( program_t *prg, struct pda_run *pdaRun )
#define SCAN_LANG_EL -2
#define SCAN_EOF -1
-static long scan_token( program_t *prg, struct pda_run *pdaRun, struct stream_impl *is )
+static long scan_token( program_t *prg, struct pda_run *pda_run, struct stream_impl *is )
{
- if ( pdaRun->triggerUndo )
+ if ( pda_run->trigger_undo )
return SCAN_UNDO;
while ( true ) {
char *pd = 0;
int len = 0;
- int type = is->funcs->getParseBlock( is, pdaRun->toklen, &pd, &len );
+ int type = is->funcs->get_parse_block( is, pda_run->toklen, &pd, &len );
switch ( type ) {
case INPUT_DATA:
- pdaRun->p = pd;
- pdaRun->pe = pd + len;
+ pda_run->p = pd;
+ pda_run->pe = pd + len;
break;
case INPUT_EOS:
- pdaRun->p = pdaRun->pe = 0;
- if ( pdaRun->tokstart != 0 )
- pdaRun->eof = 1;
+ pda_run->p = pda_run->pe = 0;
+ if ( pda_run->tokstart != 0 )
+ pda_run->eof = 1;
debug( prg, REALM_SCAN, "EOS *******************\n" );
break;
case INPUT_EOF:
- pdaRun->p = pdaRun->pe = 0;
- if ( pdaRun->tokstart != 0 )
- pdaRun->eof = 1;
+ pda_run->p = pda_run->pe = 0;
+ if ( pda_run->tokstart != 0 )
+ pda_run->eof = 1;
else
return SCAN_EOF;
break;
case INPUT_EOD:
- pdaRun->p = pdaRun->pe = 0;
+ pda_run->p = pda_run->pe = 0;
return SCAN_TRY_AGAIN_LATER;
case INPUT_LANG_EL:
- if ( pdaRun->tokstart != 0 )
- pdaRun->eof = 1;
+ if ( pda_run->tokstart != 0 )
+ pda_run->eof = 1;
else
return SCAN_LANG_EL;
break;
case INPUT_TREE:
- if ( pdaRun->tokstart != 0 )
- pdaRun->eof = 1;
+ if ( pda_run->tokstart != 0 )
+ pda_run->eof = 1;
else
return SCAN_TREE;
break;
case INPUT_IGNORE:
- if ( pdaRun->tokstart != 0 )
- pdaRun->eof = 1;
+ if ( pda_run->tokstart != 0 )
+ pda_run->eof = 1;
else
return SCAN_IGNORE;
break;
}
- prg->rtd->fsm_execute( pdaRun, is );
+ prg->rtd->fsm_execute( pda_run, is );
/* First check if scanning stopped because we have a token. */
- if ( pdaRun->matchedToken > 0 ) {
+ if ( pda_run->matched_token > 0 ) {
/* If the token has a marker indicating the end (due to trailing
* context) then adjust data now. */
- struct lang_el_info *lelInfo = prg->rtd->lelInfo;
- if ( lelInfo[pdaRun->matchedToken].markId >= 0 )
- pdaRun->p = pdaRun->mark[lelInfo[pdaRun->matchedToken].markId];
+ struct lang_el_info *lel_info = prg->rtd->lel_info;
+ if ( lel_info[pda_run->matched_token].mark_id >= 0 )
+ pda_run->p = pda_run->mark[lel_info[pda_run->matched_token].mark_id];
- return pdaRun->matchedToken;
+ return pda_run->matched_token;
}
/* Check for error. */
- if ( pdaRun->fsm_cs == pdaRun->fsm_tables->errorState ) {
+ if ( pda_run->fsm_cs == pda_run->fsm_tables->error_state ) {
/* If a token was started, but not finished (tokstart != 0) then
* restore data to the beginning of that token. */
- if ( pdaRun->tokstart != 0 )
- pdaRun->p = pdaRun->tokstart;
+ if ( pda_run->tokstart != 0 )
+ pda_run->p = pda_run->tokstart;
/* Check for a default token in the region. If one is there
* then send it and continue with the processing loop. */
- if ( prg->rtd->regionInfo[pdaRun->region].defaultToken >= 0 ) {
- pdaRun->toklen = 0;
- return prg->rtd->regionInfo[pdaRun->region].defaultToken;
+ if ( prg->rtd->region_info[pda_run->region].default_token >= 0 ) {
+ pda_run->toklen = 0;
+ return prg->rtd->region_info[pda_run->region].default_token;
}
return SCAN_ERROR;
}
/* Check for no match on eof (trailing data that partially matches a token). */
- if ( pdaRun->eof )
+ if ( pda_run->eof )
return SCAN_ERROR;
/* Got here because the state machine didn't match a token or encounter
* an error. Must be because we got to the end of the buffer data. */
- assert( pdaRun->p == pdaRun->pe );
+ assert( pda_run->p == pda_run->pe );
}
/* Should not be reached. */
return SCAN_ERROR;
}
-static tree_t *get_parsed_root( struct pda_run *pdaRun, int stop )
+static tree_t *get_parsed_root( struct pda_run *pda_run, int stop )
{
- if ( pdaRun->parseError )
+ if ( pda_run->parse_error )
return 0;
else if ( stop ) {
- if ( pdaRun->stackTop->shadow != 0 )
- return pdaRun->stackTop->shadow->tree;
+ if ( pda_run->stack_top->shadow != 0 )
+ return pda_run->stack_top->shadow->tree;
}
else {
- if ( pdaRun->stackTop->next->shadow != 0 )
- return pdaRun->stackTop->next->shadow->tree;
+ if ( pda_run->stack_top->next->shadow != 0 )
+ return pda_run->stack_top->next->shadow->tree;
}
return 0;
}
@@ -1109,16 +1109,16 @@ free_tree:
vm_push_ptree( pt->next );
}
- if ( pt->leftIgnore != 0 ) {
- vm_push_ptree( pt->leftIgnore );
+ if ( pt->left_ignore != 0 ) {
+ vm_push_ptree( pt->left_ignore );
}
if ( pt->child != 0 ) {
vm_push_ptree( pt->child );
}
- if ( pt->rightIgnore != 0 ) {
- vm_push_ptree( pt->rightIgnore );
+ if ( pt->right_ignore != 0 ) {
+ vm_push_ptree( pt->right_ignore );
}
if ( pt->shadow != 0 ) {
@@ -1135,114 +1135,114 @@ free_tree:
}
}
-void colm_pda_clear( program_t *prg, tree_t **sp, struct pda_run *pdaRun )
+void colm_pda_clear( program_t *prg, tree_t **sp, struct pda_run *pda_run )
{
- clear_fsm_run( prg, pdaRun );
+ clear_fsm_run( prg, pda_run );
/* Remaining stack and parse trees underneath. */
- clear_parse_tree( prg, sp, pdaRun->stackTop );
- pdaRun->stackTop = 0;
+ clear_parse_tree( prg, sp, pda_run->stack_top );
+ pda_run->stack_top = 0;
/* Traverse the token list downreffing. */
- ref_t *ref = pdaRun->tokenList;
+ ref_t *ref = pda_run->token_list;
while ( ref != 0 ) {
ref_t *next = ref->next;
kid_free( prg, (kid_t*)ref );
ref = next;
}
- pdaRun->tokenList = 0;
+ pda_run->token_list = 0;
/* Traverse the btPoint list downreffing */
- kid_t *btp = pdaRun->btPoint;
+ kid_t *btp = pda_run->bt_point;
while ( btp != 0 ) {
kid_t *next = btp->next;
colm_tree_downref( prg, sp, btp->tree );
kid_free( prg, (kid_t*)btp );
btp = next;
}
- pdaRun->btPoint = 0;
+ pda_run->bt_point = 0;
/* Clear out any remaining ignores. */
- clear_parse_tree( prg, sp, pdaRun->accumIgnore );
- pdaRun->accumIgnore = 0;
+ clear_parse_tree( prg, sp, pda_run->accum_ignore );
+ pda_run->accum_ignore = 0;
/* Clear the input list (scanned tokes, sent trees). */
- clear_parse_tree( prg, sp, pdaRun->parseInput );
- pdaRun->parseInput = 0;
+ clear_parse_tree( prg, sp, pda_run->parse_input );
+ pda_run->parse_input = 0;
- colm_rcode_downref_all( prg, sp, &pdaRun->reverseCode );
- colm_rt_code_vect_empty( &pdaRun->reverseCode );
- colm_rt_code_vect_empty( &pdaRun->rcodeCollect );
+ colm_rcode_downref_all( prg, sp, &pda_run->reverse_code );
+ colm_rt_code_vect_empty( &pda_run->reverse_code );
+ colm_rt_code_vect_empty( &pda_run->rcode_collect );
- colm_tree_downref( prg, sp, pdaRun->parseErrorText );
+ colm_tree_downref( prg, sp, pda_run->parse_error_text );
}
-void colm_pda_init( program_t *prg, struct pda_run *pdaRun, struct pda_tables *tables,
- int parserId, long stopTarget, int revertOn, struct_t *context )
+void colm_pda_init( program_t *prg, struct pda_run *pda_run, struct pda_tables *tables,
+ int parser_id, long stop_target, int revert_on, struct_t *context )
{
- memset( pdaRun, 0, sizeof(struct pda_run) );
+ memset( pda_run, 0, sizeof(struct pda_run) );
- pdaRun->pda_tables = tables;
- pdaRun->parserId = parserId;
- pdaRun->stopTarget = stopTarget;
- pdaRun->revertOn = revertOn;
- pdaRun->targetSteps = -1;
+ pda_run->pda_tables = tables;
+ pda_run->parser_id = parser_id;
+ pda_run->stop_target = stop_target;
+ pda_run->revert_on = revert_on;
+ pda_run->target_steps = -1;
debug( prg, REALM_PARSE, "initializing struct pda_run\n" );
/* FIXME: need the right one here. */
- pdaRun->pda_cs = prg->rtd->startStates[pdaRun->parserId];
+ pda_run->pda_cs = prg->rtd->start_states[pda_run->parser_id];
kid_t *sentinal = kid_allocate( prg );
sentinal->tree = tree_allocate( prg );
sentinal->tree->refs = 1;
/* Init the element allocation variables. */
- pdaRun->stackTop = parse_tree_allocate( prg );
- pdaRun->stackTop->state = -1;
- pdaRun->stackTop->shadow = sentinal;
+ pda_run->stack_top = parse_tree_allocate( prg );
+ pda_run->stack_top->state = -1;
+ pda_run->stack_top->shadow = sentinal;
- pdaRun->numRetry = 0;
- pdaRun->nextRegionInd = pdaRun->pda_tables->tokenRegionInds[pdaRun->pda_cs];
- pdaRun->stopParsing = false;
- pdaRun->accumIgnore = 0;
- pdaRun->btPoint = 0;
- pdaRun->checkNext = false;
- pdaRun->checkStop = false;
+ pda_run->num_retry = 0;
+ pda_run->next_region_ind = pda_run->pda_tables->token_region_inds[pda_run->pda_cs];
+ pda_run->stop_parsing = false;
+ pda_run->accum_ignore = 0;
+ pda_run->bt_point = 0;
+ pda_run->check_next = false;
+ pda_run->check_stop = false;
- prg->rtd->initBindings( pdaRun );
+ prg->rtd->init_bindings( pda_run );
- initRtCodeVect( &pdaRun->reverseCode );
- initRtCodeVect( &pdaRun->rcodeCollect );
+ init_rt_code_vect( &pda_run->reverse_code );
+ init_rt_code_vect( &pda_run->rcode_collect );
- pdaRun->context = context;
- pdaRun->parseError = 0;
- pdaRun->parseInput = 0;
- pdaRun->triggerUndo = 0;
+ pda_run->context = context;
+ pda_run->parse_error = 0;
+ pda_run->parse_input = 0;
+ pda_run->trigger_undo = 0;
- pdaRun->tokenId = 0;
+ pda_run->token_id = 0;
- pdaRun->onDeck = false;
- pdaRun->parsed = 0;
- pdaRun->reject = false;
+ pda_run->on_deck = false;
+ pda_run->parsed = 0;
+ pda_run->reject = false;
- pdaRun->rcBlockCount = 0;
+ pda_run->rc_block_count = 0;
- init_fsm_run( prg, pdaRun );
- new_token( prg, pdaRun );
+ init_fsm_run( prg, pda_run );
+ new_token( prg, pda_run );
}
-static long stack_top_target( program_t *prg, struct pda_run *pdaRun )
+static long stack_top_target( program_t *prg, struct pda_run *pda_run )
{
long state;
- if ( pdaRun->stackTop->state < 0 )
- state = prg->rtd->startStates[pdaRun->parserId];
+ if ( pda_run->stack_top->state < 0 )
+ state = prg->rtd->start_states[pda_run->parser_id];
else {
- unsigned shift = pdaRun->stackTop->id -
- pdaRun->pda_tables->keys[pdaRun->stackTop->state<<1];
- unsigned offset = pdaRun->pda_tables->offsets[pdaRun->stackTop->state] + shift;
- int index = pdaRun->pda_tables->indicies[offset];
- state = pdaRun->pda_tables->targs[index];
+ unsigned shift = pda_run->stack_top->id -
+ pda_run->pda_tables->keys[pda_run->stack_top->state<<1];
+ unsigned offset = pda_run->pda_tables->offsets[pda_run->stack_top->state] + shift;
+ int index = pda_run->pda_tables->indicies[offset];
+ state = pda_run->pda_tables->targs[index];
}
return state;
}
@@ -1261,9 +1261,9 @@ static long stack_top_target( program_t *prg, struct pda_run *pdaRun )
* -clears all alg structures
*/
-static int been_committed( parse_tree_t *parseTree )
+static int been_committed( parse_tree_t *parse_tree )
{
- return parseTree->flags & PF_COMMITTED;
+ return parse_tree->flags & PF_COMMITTED;
}
static code_t *backup_over_rcode( code_t *rcode )
@@ -1277,8 +1277,8 @@ static code_t *backup_over_rcode( code_t *rcode )
/* The top level of the stack is linked right-to-left. Trees underneath are
* linked left-to-right. */
-static void commit_kid( program_t *prg, struct pda_run *pdaRun, tree_t **root,
- parse_tree_t *lel, code_t **rcode, long *causeReduce )
+static void commit_kid( program_t *prg, struct pda_run *pda_run, tree_t **root,
+ parse_tree_t *lel, code_t **rcode, long *cause_reduce )
{
parse_tree_t *tree = 0;
tree_t **sp = root;
@@ -1287,7 +1287,7 @@ static void commit_kid( program_t *prg, struct pda_run *pdaRun, tree_t **root,
head:
/* Commit */
debug( prg, REALM_PARSE, "commit: visiting %s\n",
- prg->rtd->lelInfo[lel->id].name );
+ prg->rtd->lel_info[lel->id].name );
/* Load up the parsed tree. */
tree = lel;
@@ -1298,11 +1298,11 @@ head:
/* If tree caused some reductions, now is not the right time to backup
* over the reverse code. We need to backup over the reductions first. Store
* the count of the reductions and do it when the count drops to zero. */
- if ( tree->causeReduce > 0 ) {
+ if ( tree->cause_reduce > 0 ) {
/* The top reduce block does not correspond to this alg. */
debug( prg, REALM_PARSE, "commit: causeReduce found, delaying backup: %ld\n",
- (long)tree->causeReduce );
- *causeReduce = tree->causeReduce;
+ (long)tree->cause_reduce );
+ *cause_reduce = tree->cause_reduce;
}
else {
*rcode = backup_over_rcode( *rcode );
@@ -1324,13 +1324,13 @@ head:
/* Check causeReduce, might be time to backup over the reverse code
* belonging to a nonterminal that caused previous reductions. */
- if ( *causeReduce > 0 &&
- tree->id >= prg->rtd->firstNonTermId &&
+ if ( *cause_reduce > 0 &&
+ tree->id >= prg->rtd->first_non_term_id &&
!(tree->flags & PF_TERM_DUP) )
{
- *causeReduce -= 1;
+ *cause_reduce -= 1;
- if ( *causeReduce == 0 ) {
+ if ( *cause_reduce == 0 ) {
debug( prg, REALM_PARSE, "commit: causeReduce dropped to zero, "
"backing up over rcode\n" );
@@ -1389,28 +1389,28 @@ backup:
goto backup;
}
- pdaRun->numRetry = 0;
+ pda_run->num_retry = 0;
assert( sp == root );
}
-static void commit_full( program_t *prg, tree_t **sp, struct pda_run *pdaRun, long causeReduce )
+static void commit_full( program_t *prg, tree_t **sp, struct pda_run *pda_run, long cause_reduce )
{
debug( prg, REALM_PARSE, "running full commit\n" );
- parse_tree_t *parseTree = pdaRun->stackTop;
- code_t *rcode = pdaRun->reverseCode.data + pdaRun->reverseCode.tabLen;
+ parse_tree_t *parse_tree = pda_run->stack_top;
+ code_t *rcode = pda_run->reverse_code.data + pda_run->reverse_code.tab_len;
/* The top level of the stack is linked right to left. This is the
* traversal order we need for committing. */
- while ( parseTree != 0 && !been_committed( parseTree ) ) {
- commit_kid( prg, pdaRun, sp, parseTree, &rcode, &causeReduce );
- parseTree = parseTree->next;
+ while ( parse_tree != 0 && !been_committed( parse_tree ) ) {
+ commit_kid( prg, pda_run, sp, parse_tree, &rcode, &cause_reduce );
+ parse_tree = parse_tree->next;
}
/* We cannot always clear all the rcode here. We may need to backup over
* the parse statement. We depend on the context flag. */
- if ( !pdaRun->revertOn )
- colm_rcode_downref_all( prg, sp, &pdaRun->reverseCode );
+ if ( !pda_run->revert_on )
+ colm_rcode_downref_all( prg, sp, &pda_run->reverse_code );
}
/*
@@ -1424,70 +1424,70 @@ static void commit_full( program_t *prg, tree_t **sp, struct pda_run *pdaRun, lo
* PCR_REVERSE
*/
static long parse_token( program_t *prg, tree_t **sp,
- struct pda_run *pdaRun, struct stream_impl *is, long entry )
+ struct pda_run *pda_run, struct stream_impl *is, long entry )
{
int pos;
unsigned int *action;
- int rhsLen;
+ int rhs_len;
int owner;
- int induceReject;
- int indPos;
+ int induce_reject;
+ int ind_pos;
/* COROUTINE */
switch ( entry ) {
case PCR_START:
/* The scanner will send a null token if it can't find a token. */
- if ( pdaRun->parseInput == 0 )
- goto parseError;
+ if ( pda_run->parse_input == 0 )
+ goto parse_error;
/* This will cause parseInput to be lost. This
* path should be traced. */
- if ( pdaRun->pda_cs < 0 )
+ if ( pda_run->pda_cs < 0 )
return PCR_DONE;
/* Record the state in the parse tree. */
- pdaRun->parseInput->state = pdaRun->pda_cs;
+ pda_run->parse_input->state = pda_run->pda_cs;
again:
- if ( pdaRun->parseInput == 0 )
+ if ( pda_run->parse_input == 0 )
goto _out;
- pdaRun->lel = pdaRun->parseInput;
- pdaRun->curState = pdaRun->pda_cs;
+ pda_run->lel = pda_run->parse_input;
+ pda_run->cur_state = pda_run->pda_cs;
- if ( pdaRun->lel->id < pdaRun->pda_tables->keys[pdaRun->curState<<1] ||
- pdaRun->lel->id > pdaRun->pda_tables->keys[(pdaRun->curState<<1)+1] )
+ if ( pda_run->lel->id < pda_run->pda_tables->keys[pda_run->cur_state<<1] ||
+ pda_run->lel->id > pda_run->pda_tables->keys[(pda_run->cur_state<<1)+1] )
{
debug( prg, REALM_PARSE, "parse error, no transition 1\n" );
- push_bt_point( prg, pdaRun );
- goto parseError;
+ push_bt_point( prg, pda_run );
+ goto parse_error;
}
- indPos = pdaRun->pda_tables->offsets[pdaRun->curState] +
- (pdaRun->lel->id - pdaRun->pda_tables->keys[pdaRun->curState<<1]);
+ ind_pos = pda_run->pda_tables->offsets[pda_run->cur_state] +
+ (pda_run->lel->id - pda_run->pda_tables->keys[pda_run->cur_state<<1]);
- owner = pdaRun->pda_tables->owners[indPos];
- if ( owner != pdaRun->curState ) {
+ owner = pda_run->pda_tables->owners[ind_pos];
+ if ( owner != pda_run->cur_state ) {
debug( prg, REALM_PARSE, "parse error, no transition 2\n" );
- push_bt_point( prg, pdaRun );
- goto parseError;
+ push_bt_point( prg, pda_run );
+ goto parse_error;
}
- pos = pdaRun->pda_tables->indicies[indPos];
+ pos = pda_run->pda_tables->indicies[ind_pos];
if ( pos < 0 ) {
debug( prg, REALM_PARSE, "parse error, no transition 3\n" );
- push_bt_point( prg, pdaRun );
- goto parseError;
+ push_bt_point( prg, pda_run );
+ goto parse_error;
}
/* Checking complete. */
- induceReject = false;
- pdaRun->pda_cs = pdaRun->pda_tables->targs[pos];
- action = pdaRun->pda_tables->actions + pdaRun->pda_tables->actInds[pos];
- if ( pdaRun->lel->retryLower )
- action += pdaRun->lel->retryLower;
+ induce_reject = false;
+ pda_run->pda_cs = pda_run->pda_tables->targs[pos];
+ action = pda_run->pda_tables->actions + pda_run->pda_tables->act_inds[pos];
+ if ( pda_run->lel->retry_lower )
+ action += pda_run->lel->retry_lower;
/*
* Shift
@@ -1495,61 +1495,61 @@ again:
if ( *action & act_sb ) {
debug( prg, REALM_PARSE, "shifted: %s\n",
- prg->rtd->lelInfo[pdaRun->lel->id].name );
+ prg->rtd->lel_info[pda_run->lel->id].name );
/* Consume. */
- pdaRun->parseInput = pdaRun->parseInput->next;
+ pda_run->parse_input = pda_run->parse_input->next;
- pdaRun->lel->state = pdaRun->curState;
+ pda_run->lel->state = pda_run->cur_state;
/* If its a token then attach ignores and record it in the token list
* of the next ignore attachment to use. */
- if ( pdaRun->lel->id < prg->rtd->firstNonTermId ) {
- if ( pdaRun->lel->causeReduce == 0 )
- attach_right_ignore( prg, sp, pdaRun, pdaRun->stackTop );
+ if ( pda_run->lel->id < prg->rtd->first_non_term_id ) {
+ if ( pda_run->lel->cause_reduce == 0 )
+ attach_right_ignore( prg, sp, pda_run, pda_run->stack_top );
}
- pdaRun->lel->next = pdaRun->stackTop;
- pdaRun->stackTop = pdaRun->lel;
+ pda_run->lel->next = pda_run->stack_top;
+ pda_run->stack_top = pda_run->lel;
/* If its a token then attach ignores and record it in the token list
* of the next ignore attachment to use. */
- if ( pdaRun->lel->id < prg->rtd->firstNonTermId ) {
- attach_left_ignore( prg, sp, pdaRun, pdaRun->lel );
+ if ( pda_run->lel->id < prg->rtd->first_non_term_id ) {
+ attach_left_ignore( prg, sp, pda_run, pda_run->lel );
ref_t *ref = (ref_t*)kid_allocate( prg );
- ref->kid = pdaRun->lel->shadow;
+ ref->kid = pda_run->lel->shadow;
//colm_tree_upref( pdaRun->tree );
- ref->next = pdaRun->tokenList;
- pdaRun->tokenList = ref;
+ ref->next = pda_run->token_list;
+ pda_run->token_list = ref;
}
if ( action[1] == 0 )
- pdaRun->lel->retryLower = 0;
+ pda_run->lel->retry_lower = 0;
else {
- debug( prg, REALM_PARSE, "retry: %p\n", pdaRun->stackTop );
- pdaRun->lel->retryLower += 1;
- assert( pdaRun->lel->retryUpper == 0 );
+ debug( prg, REALM_PARSE, "retry: %p\n", pda_run->stack_top );
+ pda_run->lel->retry_lower += 1;
+ assert( pda_run->lel->retry_upper == 0 );
/* FIXME: Has the retry already been counted? */
- pdaRun->numRetry += 1;
+ pda_run->num_retry += 1;
}
- pdaRun->shiftCount += 1;
+ pda_run->shift_count += 1;
}
/*
* Commit
*/
- if ( pdaRun->pda_tables->commitLen[pos] != 0 ) {
+ if ( pda_run->pda_tables->commit_len[pos] != 0 ) {
#if 0
- long causeReduce = 0;
- if ( pdaRun->parseInput != 0 ) {
- if ( pdaRun->parseInput->flags & PF_HAS_RCODE )
- causeReduce = pdaRun->parseInput->causeReduce;
+ long cause_reduce = 0;
+ if ( pda_run->parse_input != 0 ) {
+ if ( pda_run->parse_input->flags & PF_HAS_RCODE )
+ cause_reduce = pda_run->parse_input->cause_reduce;
}
- commit_full( prg, sp, pdaRun, causeReduce );
+ commit_full( prg, sp, pda_run, cause_reduce );
#endif
- pdaRun->commitShiftCount = pdaRun->shiftCount;
+ pda_run->commit_shift_count = pda_run->shift_count;
}
/*
@@ -1557,107 +1557,107 @@ again:
*/
if ( *action & act_rb ) {
- int r, objectLength;
+ int r, object_length;
parse_tree_t *last, *child;
kid_t *attrs;
- kid_t *dataLast, *dataChild;
+ kid_t *data_last, *data_child;
/* If there was shift don't attach again. */
- if ( !( *action & act_sb ) && pdaRun->lel->id < prg->rtd->firstNonTermId )
- attach_right_ignore( prg, sp, pdaRun, pdaRun->stackTop );
+ if ( !( *action & act_sb ) && pda_run->lel->id < prg->rtd->first_non_term_id )
+ attach_right_ignore( prg, sp, pda_run, pda_run->stack_top );
- pdaRun->reduction = *action >> 2;
+ pda_run->reduction = *action >> 2;
- if ( pdaRun->parseInput != 0 )
- pdaRun->parseInput->causeReduce += 1;
+ if ( pda_run->parse_input != 0 )
+ pda_run->parse_input->cause_reduce += 1;
kid_t *value = kid_allocate( prg );
value->tree = tree_allocate( prg );
value->tree->refs = 1;
- value->tree->id = prg->rtd->prodInfo[pdaRun->reduction].lhsId;
- value->tree->prod_num = prg->rtd->prodInfo[pdaRun->reduction].prodNum;
+ value->tree->id = prg->rtd->prod_info[pda_run->reduction].lhs_id;
+ value->tree->prod_num = prg->rtd->prod_info[pda_run->reduction].prod_num;
- pdaRun->redLel = parse_tree_allocate( prg );
- pdaRun->redLel->id = prg->rtd->prodInfo[pdaRun->reduction].lhsId;
- pdaRun->redLel->next = 0;
- pdaRun->redLel->causeReduce = 0;
- pdaRun->redLel->retryLower = 0;
- pdaRun->redLel->shadow = value;
+ pda_run->red_lel = parse_tree_allocate( prg );
+ pda_run->red_lel->id = prg->rtd->prod_info[pda_run->reduction].lhs_id;
+ pda_run->red_lel->next = 0;
+ pda_run->red_lel->cause_reduce = 0;
+ pda_run->red_lel->retry_lower = 0;
+ pda_run->red_lel->shadow = value;
/* Transfer. */
- pdaRun->redLel->retryUpper = pdaRun->lel->retryLower;
- pdaRun->lel->retryLower = 0;
+ pda_run->red_lel->retry_upper = pda_run->lel->retry_lower;
+ pda_run->lel->retry_lower = 0;
/* Allocate the attributes. */
- objectLength = prg->rtd->lelInfo[pdaRun->redLel->id].objectLength;
- attrs = allocAttrs( prg, objectLength );
+ object_length = prg->rtd->lel_info[pda_run->red_lel->id].object_length;
+ attrs = alloc_attrs( prg, object_length );
/* Build the list of children. We will be giving up a reference when we
* detach parse tree and data tree, but gaining the reference when we
* put the children under the new data tree. No need to alter refcounts
* here. */
- rhsLen = prg->rtd->prodInfo[pdaRun->reduction].length;
+ rhs_len = prg->rtd->prod_info[pda_run->reduction].length;
child = last = 0;
- dataChild = dataLast = 0;
- for ( r = 0; r < rhsLen; r++ ) {
+ data_child = data_last = 0;
+ for ( r = 0; r < rhs_len; r++ ) {
/* The child. */
- child = pdaRun->stackTop;
- dataChild = child->shadow;
+ child = pda_run->stack_top;
+ data_child = child->shadow;
/* Pop. */
- pdaRun->stackTop = pdaRun->stackTop->next;
+ pda_run->stack_top = pda_run->stack_top->next;
/* Detach the parse tree from the data. */
child->shadow = 0;
/* Reverse list. */
child->next = last;
- dataChild->next = dataLast;
+ data_child->next = data_last;
/* Track last for reversal. */
last = child;
- dataLast = dataChild;
+ data_last = data_child;
}
- pdaRun->redLel->child = child;
- pdaRun->redLel->shadow->tree->child = kidListConcat( attrs, dataChild );
+ pda_run->red_lel->child = child;
+ pda_run->red_lel->shadow->tree->child = kid_list_concat( attrs, data_child );
debug( prg, REALM_PARSE, "reduced: %s rhsLen %d\n",
- prg->rtd->prodInfo[pdaRun->reduction].name, rhsLen );
+ prg->rtd->prod_info[pda_run->reduction].name, rhs_len );
if ( action[1] == 0 )
- pdaRun->redLel->retryUpper = 0;
+ pda_run->red_lel->retry_upper = 0;
else {
- pdaRun->redLel->retryUpper += 1;
- assert( pdaRun->lel->retryLower == 0 );
- pdaRun->numRetry += 1;
- debug( prg, REALM_PARSE, "retry: %p\n", pdaRun->redLel );
+ pda_run->red_lel->retry_upper += 1;
+ assert( pda_run->lel->retry_lower == 0 );
+ pda_run->num_retry += 1;
+ debug( prg, REALM_PARSE, "retry: %p\n", pda_run->red_lel );
}
/* When the production is of zero length we stay in the same state.
* Otherwise we use the state stored in the first child. */
- pdaRun->pda_cs = rhsLen == 0 ? pdaRun->curState : child->state;
+ pda_run->pda_cs = rhs_len == 0 ? pda_run->cur_state : child->state;
- if ( prg->ctxDepParsing && prg->rtd->prodInfo[pdaRun->reduction].frameId >= 0 ) {
+ if ( prg->ctx_dep_parsing && prg->rtd->prod_info[pda_run->reduction].frame_id >= 0 ) {
/* Frame info for reduction. */
- pdaRun->fi = &prg->rtd->frameInfo[prg->rtd->prodInfo[pdaRun->reduction].frameId];
- pdaRun->frameId = prg->rtd->prodInfo[pdaRun->reduction].frameId;
- pdaRun->reject = false;
- pdaRun->parsed = 0;
- pdaRun->code = pdaRun->fi->codeWV;
+ pda_run->fi = &prg->rtd->frame_info[prg->rtd->prod_info[pda_run->reduction].frame_id];
+ pda_run->frame_id = prg->rtd->prod_info[pda_run->reduction].frame_id;
+ pda_run->reject = false;
+ pda_run->parsed = 0;
+ pda_run->code = pda_run->fi->codeWV;
/* COROUTINE */
return PCR_REDUCTION;
case PCR_REDUCTION:
- if ( prg->induceExit )
+ if ( prg->induce_exit )
goto fail;
/* If the lhs was stored and it changed then we need to restore the
* original upon backtracking, otherwise downref since we took a
* copy above. */
- if ( pdaRun->parsed != 0 ) {
- if ( pdaRun->parsed != pdaRun->redLel->shadow->tree ) {
+ if ( pda_run->parsed != 0 ) {
+ if ( pda_run->parsed != pda_run->red_lel->shadow->tree ) {
debug( prg, REALM_PARSE, "lhs tree was modified, "
"adding a restore instruction\n" );
//
@@ -1670,24 +1670,24 @@ again:
// colm_tree_upref( pdaRun->redLel->tree );
/* Add the restore instruct. */
- append_code_val( &pdaRun->rcodeCollect, IN_RESTORE_LHS );
- append_word( &pdaRun->rcodeCollect, (word_t)pdaRun->parsed );
- append_code_val( &pdaRun->rcodeCollect, SIZEOF_CODE + SIZEOF_WORD );
+ append_code_val( &pda_run->rcode_collect, IN_RESTORE_LHS );
+ append_word( &pda_run->rcode_collect, (word_t)pda_run->parsed );
+ append_code_val( &pda_run->rcode_collect, SIZEOF_CODE + SIZEOF_WORD );
}
else {
/* Not changed. Done with parsed. */
- colm_tree_downref( prg, sp, pdaRun->parsed );
+ colm_tree_downref( prg, sp, pda_run->parsed );
}
- pdaRun->parsed = 0;
+ pda_run->parsed = 0;
}
/* Pull out the reverse code, if any. */
- colm_make_reverse_code( pdaRun );
- colm_transfer_reverse_code( pdaRun, pdaRun->redLel );
+ colm_make_reverse_code( pda_run );
+ colm_transfer_reverse_code( pda_run, pda_run->red_lel );
/* Perhaps the execution environment is telling us we need to
* reject the reduction. */
- induceReject = pdaRun->reject;
+ induce_reject = pda_run->reject;
}
/* If the left hand side was replaced then the only parse algorithm
@@ -1695,277 +1695,277 @@ again:
* else will be in the original. This requires that we restore first
* when going backwards and when doing a commit. */
- if ( induceReject ) {
+ if ( induce_reject ) {
debug( prg, REALM_PARSE, "error induced during reduction of %s\n",
- prg->rtd->lelInfo[pdaRun->redLel->id].name );
- pdaRun->redLel->state = pdaRun->curState;
- pdaRun->redLel->next = pdaRun->stackTop;
- pdaRun->stackTop = pdaRun->redLel;
+ prg->rtd->lel_info[pda_run->red_lel->id].name );
+ pda_run->red_lel->state = pda_run->cur_state;
+ pda_run->red_lel->next = pda_run->stack_top;
+ pda_run->stack_top = pda_run->red_lel;
/* FIXME: What is the right argument here? */
- push_bt_point( prg, pdaRun );
- goto parseError;
+ push_bt_point( prg, pda_run );
+ goto parse_error;
}
- pdaRun->redLel->next = pdaRun->parseInput;
- pdaRun->parseInput = pdaRun->redLel;
+ pda_run->red_lel->next = pda_run->parse_input;
+ pda_run->parse_input = pda_run->red_lel;
}
goto again;
-parseError:
+parse_error:
debug( prg, REALM_PARSE, "hit error, backtracking\n" );
#if 0
- if ( pdaRun->numRetry == 0 ) {
+ if ( pda_run->num_retry == 0 ) {
debug( prg, REALM_PARSE, "out of retries failing parse\n" );
goto fail;
}
#endif
while ( 1 ) {
- if ( pdaRun->onDeck ) {
+ if ( pda_run->on_deck ) {
debug( prg, REALM_BYTECODE, "dropping out for reverse code call\n" );
- pdaRun->frameId = -1;
- pdaRun->code = colm_pop_reverse_code( &pdaRun->reverseCode );
+ pda_run->frame_id = -1;
+ pda_run->code = colm_pop_reverse_code( &pda_run->reverse_code );
/* COROUTINE */
return PCR_REVERSE;
case PCR_REVERSE:
- colm_decrement_steps( pdaRun );
+ colm_decrement_steps( pda_run );
}
- else if ( pdaRun->checkNext ) {
- pdaRun->checkNext = false;
+ else if ( pda_run->check_next ) {
+ pda_run->check_next = false;
- if ( pdaRun->next > 0 && pdaRun->pda_tables->tokenRegions[pdaRun->next] != 0 ) {
+ if ( pda_run->next > 0 && pda_run->pda_tables->token_regions[pda_run->next] != 0 ) {
debug( prg, REALM_PARSE, "found a new region\n" );
- pdaRun->numRetry -= 1;
- pdaRun->pda_cs = stack_top_target( prg, pdaRun );
- pdaRun->nextRegionInd = pdaRun->next;
+ pda_run->num_retry -= 1;
+ pda_run->pda_cs = stack_top_target( prg, pda_run );
+ pda_run->next_region_ind = pda_run->next;
return PCR_DONE;
}
}
- else if ( pdaRun->checkStop ) {
- pdaRun->checkStop = false;
+ else if ( pda_run->check_stop ) {
+ pda_run->check_stop = false;
- if ( pdaRun->stop ) {
+ if ( pda_run->stop ) {
debug( prg, REALM_PARSE, "stopping the backtracking, "
- "steps is %d\n", pdaRun->steps );
+ "steps is %d\n", pda_run->steps );
- pdaRun->pda_cs = stack_top_target( prg, pdaRun );
+ pda_run->pda_cs = stack_top_target( prg, pda_run );
goto _out;
}
}
- else if ( pdaRun->parseInput != 0 ) {
+ else if ( pda_run->parse_input != 0 ) {
/* Either we are dealing with a terminal that was shifted or a
* nonterminal that was reduced. */
- if ( pdaRun->parseInput->id < prg->rtd->firstNonTermId ) {
+ if ( pda_run->parse_input->id < prg->rtd->first_non_term_id ) {
/* This is a terminal. */
- assert( pdaRun->parseInput->retryUpper == 0 );
+ assert( pda_run->parse_input->retry_upper == 0 );
- if ( pdaRun->parseInput->retryLower != 0 ) {
- debug( prg, REALM_PARSE, "found retry targ: %p\n", pdaRun->parseInput );
+ if ( pda_run->parse_input->retry_lower != 0 ) {
+ debug( prg, REALM_PARSE, "found retry targ: %p\n", pda_run->parse_input );
- pdaRun->numRetry -= 1;
- pdaRun->pda_cs = pdaRun->parseInput->state;
+ pda_run->num_retry -= 1;
+ pda_run->pda_cs = pda_run->parse_input->state;
goto again;
}
- if ( pdaRun->parseInput->causeReduce != 0 ) {
+ if ( pda_run->parse_input->cause_reduce != 0 ) {
/* The terminal caused a reduce. Unshift the reduced thing
* (will unreduce in the next step. */
- if ( pdaRun->shiftCount == pdaRun->commitShiftCount ) {
+ if ( pda_run->shift_count == pda_run->commit_shift_count ) {
debug( prg, REALM_PARSE, "backed up to commit point, "
"failing parse\n" );
goto fail;
}
- pdaRun->shiftCount -= 1;
+ pda_run->shift_count -= 1;
- pdaRun->undoLel = pdaRun->stackTop;
+ pda_run->undo_lel = pda_run->stack_top;
/* Check if we've arrived at the stack sentinal. This guard
* is here to allow us to initially set numRetry to one to
* cause the parser to backup all the way to the beginning
* when an error occurs. */
- if ( pdaRun->undoLel->next == 0 )
+ if ( pda_run->undo_lel->next == 0 )
break;
/* Either we are dealing with a terminal that was
* shifted or a nonterminal that was reduced. */
- assert( !(pdaRun->stackTop->id < prg->rtd->firstNonTermId) );
+ assert( !(pda_run->stack_top->id < prg->rtd->first_non_term_id) );
debug( prg, REALM_PARSE, "backing up over non-terminal: %s\n",
- prg->rtd->lelInfo[pdaRun->stackTop->id].name );
+ prg->rtd->lel_info[pda_run->stack_top->id].name );
/* Pop the item from the stack. */
- pdaRun->stackTop = pdaRun->stackTop->next;
+ pda_run->stack_top = pda_run->stack_top->next;
/* Queue it as next parseInput item. */
- pdaRun->undoLel->next = pdaRun->parseInput;
- pdaRun->parseInput = pdaRun->undoLel;
+ pda_run->undo_lel->next = pda_run->parse_input;
+ pda_run->parse_input = pda_run->undo_lel;
}
else {
- long region = pdaRun->parseInput->retryRegion;
- pdaRun->next = region > 0 ? region + 1 : 0;
- pdaRun->checkNext = true;
- pdaRun->checkStop = true;
+ long region = pda_run->parse_input->retry_region;
+ pda_run->next = region > 0 ? region + 1 : 0;
+ pda_run->check_next = true;
+ pda_run->check_stop = true;
- send_back( prg, sp, pdaRun, is, pdaRun->parseInput );
+ send_back( prg, sp, pda_run, is, pda_run->parse_input );
- pdaRun->parseInput = 0;
+ pda_run->parse_input = 0;
}
}
- else if ( pdaRun->parseInput->flags & PF_HAS_RCODE ) {
+ else if ( pda_run->parse_input->flags & PF_HAS_RCODE ) {
debug( prg, REALM_PARSE, "tree has rcode, setting on deck\n" );
- pdaRun->onDeck = true;
- pdaRun->parsed = 0;
+ pda_run->on_deck = true;
+ pda_run->parsed = 0;
/* Only the RCODE flag was in the replaced lhs. All the rest is in
* the the original. We read it after restoring. */
- pdaRun->parseInput->flags &= ~PF_HAS_RCODE;
+ pda_run->parse_input->flags &= ~PF_HAS_RCODE;
}
else {
/* Remove it from the input queue. */
- pdaRun->undoLel = pdaRun->parseInput;
- pdaRun->parseInput = pdaRun->parseInput->next;
+ pda_run->undo_lel = pda_run->parse_input;
+ pda_run->parse_input = pda_run->parse_input->next;
/* Extract children from the child list. */
- parse_tree_t *first = pdaRun->undoLel->child;
- pdaRun->undoLel->child = 0;
+ parse_tree_t *first = pda_run->undo_lel->child;
+ pda_run->undo_lel->child = 0;
/* This will skip the ignores/attributes, etc. */
- kid_t *dataFirst = treeExtractChild( prg, pdaRun->undoLel->shadow->tree );
+ kid_t *data_first = tree_extract_child( prg, pda_run->undo_lel->shadow->tree );
/* Walk the child list and and push the items onto the parsing
* stack one at a time. */
while ( first != 0 ) {
/* Get the next item ahead of time. */
parse_tree_t *next = first->next;
- kid_t *dataNext = dataFirst->next;
+ kid_t *data_next = data_first->next;
/* Push onto the stack. */
- first->next = pdaRun->stackTop;
- pdaRun->stackTop = first;
+ first->next = pda_run->stack_top;
+ pda_run->stack_top = first;
/* Reattach the data and the parse tree. */
- first->shadow = dataFirst;
+ first->shadow = data_first;
first = next;
- dataFirst = dataNext;
+ data_first = data_next;
}
/* If there is an parseInput queued, this is one less reduction it has
* caused. */
- if ( pdaRun->parseInput != 0 )
- pdaRun->parseInput->causeReduce -= 1;
+ if ( pda_run->parse_input != 0 )
+ pda_run->parse_input->cause_reduce -= 1;
- if ( pdaRun->undoLel->retryUpper != 0 ) {
+ if ( pda_run->undo_lel->retry_upper != 0 ) {
/* There is always an parseInput item here because reduce
* conflicts only happen on a lookahead character. */
- assert( pdaRun->parseInput != pdaRun->undoLel );
- assert( pdaRun->parseInput != 0 );
- assert( pdaRun->undoLel->retryLower == 0 );
- assert( pdaRun->parseInput->retryUpper == 0 );
+ assert( pda_run->parse_input != pda_run->undo_lel );
+ assert( pda_run->parse_input != 0 );
+ assert( pda_run->undo_lel->retry_lower == 0 );
+ assert( pda_run->parse_input->retry_upper == 0 );
/* Transfer the retry from undoLel to parseInput. */
- pdaRun->parseInput->retryLower = pdaRun->undoLel->retryUpper;
- pdaRun->parseInput->retryUpper = 0;
- pdaRun->parseInput->state = stack_top_target( prg, pdaRun );
+ pda_run->parse_input->retry_lower = pda_run->undo_lel->retry_upper;
+ pda_run->parse_input->retry_upper = 0;
+ pda_run->parse_input->state = stack_top_target( prg, pda_run );
}
/* Free the reduced item. */
- colm_tree_downref( prg, sp, pdaRun->undoLel->shadow->tree );
- kid_free( prg, pdaRun->undoLel->shadow );
- parse_tree_free( prg, pdaRun->undoLel );
+ colm_tree_downref( prg, sp, pda_run->undo_lel->shadow->tree );
+ kid_free( prg, pda_run->undo_lel->shadow );
+ parse_tree_free( prg, pda_run->undo_lel );
/* If the stacktop had right ignore attached, detach now. */
- if ( pdaRun->stackTop->flags & PF_RIGHT_IL_ATTACHED )
- detach_right_ignore( prg, sp, pdaRun, pdaRun->stackTop );
+ if ( pda_run->stack_top->flags & PF_RIGHT_IL_ATTACHED )
+ detach_right_ignore( prg, sp, pda_run, pda_run->stack_top );
}
}
- else if ( pdaRun->accumIgnore != 0 ) {
+ else if ( pda_run->accum_ignore != 0 ) {
debug( prg, REALM_PARSE, "have accumulated ignore to undo\n" );
/* Send back any accumulated ignore tokens, then trigger error
* in the the parser. */
- parse_tree_t *ignore = pdaRun->accumIgnore;
- pdaRun->accumIgnore = pdaRun->accumIgnore->next;
+ parse_tree_t *ignore = pda_run->accum_ignore;
+ pda_run->accum_ignore = pda_run->accum_ignore->next;
ignore->next = 0;
- long region = ignore->retryRegion;
- pdaRun->next = region > 0 ? region + 1 : 0;
- pdaRun->checkNext = true;
- pdaRun->checkStop = true;
+ long region = ignore->retry_region;
+ pda_run->next = region > 0 ? region + 1 : 0;
+ pda_run->check_next = true;
+ pda_run->check_stop = true;
- send_back_ignore( prg, sp, pdaRun, is, ignore );
+ send_back_ignore( prg, sp, pda_run, is, ignore );
colm_tree_downref( prg, sp, ignore->shadow->tree );
kid_free( prg, ignore->shadow );
parse_tree_free( prg, ignore );
}
else {
- if ( pdaRun->shiftCount == pdaRun->commitShiftCount ) {
+ if ( pda_run->shift_count == pda_run->commit_shift_count ) {
debug( prg, REALM_PARSE, "backed up to commit point, failing parse\n" );
goto fail;
}
- pdaRun->shiftCount -= 1;
+ pda_run->shift_count -= 1;
/* Now it is time to undo something. Pick an element from the top of
* the stack. */
- pdaRun->undoLel = pdaRun->stackTop;
+ pda_run->undo_lel = pda_run->stack_top;
/* Check if we've arrived at the stack sentinal. This guard is
* here to allow us to initially set numRetry to one to cause the
* parser to backup all the way to the beginning when an error
* occurs. */
- if ( pdaRun->undoLel->next == 0 )
+ if ( pda_run->undo_lel->next == 0 )
break;
/* Either we are dealing with a terminal that was
* shifted or a nonterminal that was reduced. */
- if ( pdaRun->stackTop->id < prg->rtd->firstNonTermId ) {
+ if ( pda_run->stack_top->id < prg->rtd->first_non_term_id ) {
debug( prg, REALM_PARSE, "backing up over effective terminal: %s\n",
- prg->rtd->lelInfo[pdaRun->stackTop->id].name );
+ prg->rtd->lel_info[pda_run->stack_top->id].name );
/* Pop the item from the stack. */
- pdaRun->stackTop = pdaRun->stackTop->next;
+ pda_run->stack_top = pda_run->stack_top->next;
/* Queue it as next parseInput item. */
- pdaRun->undoLel->next = pdaRun->parseInput;
- pdaRun->parseInput = pdaRun->undoLel;
+ pda_run->undo_lel->next = pda_run->parse_input;
+ pda_run->parse_input = pda_run->undo_lel;
/* Pop from the token list. */
- ref_t *ref = pdaRun->tokenList;
- pdaRun->tokenList = ref->next;
+ ref_t *ref = pda_run->token_list;
+ pda_run->token_list = ref->next;
kid_free( prg, (kid_t*)ref );
- assert( pdaRun->accumIgnore == 0 );
- detach_left_ignore( prg, sp, pdaRun, pdaRun->parseInput );
+ assert( pda_run->accum_ignore == 0 );
+ detach_left_ignore( prg, sp, pda_run, pda_run->parse_input );
}
else {
debug( prg, REALM_PARSE, "backing up over non-terminal: %s\n",
- prg->rtd->lelInfo[pdaRun->stackTop->id].name );
+ prg->rtd->lel_info[pda_run->stack_top->id].name );
/* Pop the item from the stack. */
- pdaRun->stackTop = pdaRun->stackTop->next;
+ pda_run->stack_top = pda_run->stack_top->next;
/* Queue it as next parseInput item. */
- pdaRun->undoLel->next = pdaRun->parseInput;
- pdaRun->parseInput = pdaRun->undoLel;
+ pda_run->undo_lel->next = pda_run->parse_input;
+ pda_run->parse_input = pda_run->undo_lel;
}
/* Undo attach of right ignore. */
- if ( pdaRun->stackTop->flags & PF_RIGHT_IL_ATTACHED )
- detach_right_ignore( prg, sp, pdaRun, pdaRun->stackTop );
+ if ( pda_run->stack_top->flags & PF_RIGHT_IL_ATTACHED )
+ detach_right_ignore( prg, sp, pda_run, pda_run->stack_top );
}
}
fail:
- pdaRun->pda_cs = -1;
- pdaRun->parseError = 1;
+ pda_run->pda_cs = -1;
+ pda_run->parse_error = 1;
/* FIXME: do we still need to fall through here? A fail is permanent now,
* no longer called into again. */
@@ -1973,7 +1973,7 @@ fail:
return PCR_DONE;
_out:
- pdaRun->nextRegionInd = pdaRun->pda_tables->tokenRegionInds[pdaRun->pda_cs];
+ pda_run->next_region_ind = pda_run->pda_tables->token_region_inds[pda_run->pda_cs];
/* COROUTINE */
case PCR_DONE:
@@ -1992,16 +1992,16 @@ _out:
* PCR_REVERSE
*/
-long colm_parse_loop( program_t *prg, tree_t **sp, struct pda_run *pdaRun,
+long colm_parse_loop( program_t *prg, tree_t **sp, struct pda_run *pda_run,
struct stream_impl *is, long entry )
{
- struct lang_el_info *lelInfo = prg->rtd->lelInfo;
+ struct lang_el_info *lel_info = prg->rtd->lel_info;
/* COROUTINE */
switch ( entry ) {
case PCR_START:
- pdaRun->stop = false;
+ pda_run->stop = false;
while ( true ) {
debug( prg, REALM_PARSE, "parse loop start %d:%d\n", is->line, is->column );
@@ -2009,70 +2009,70 @@ long colm_parse_loop( program_t *prg, tree_t **sp, struct pda_run *pdaRun,
/* Pull the current scanner from the parser. This can change during
* parsing due to inputStream pushes, usually for the purpose of includes.
* */
- pdaRun->tokenId = scan_token( prg, pdaRun, is );
+ pda_run->token_id = scan_token( prg, pda_run, is );
- if ( pdaRun->tokenId == SCAN_ERROR ) {
- if ( pdaRun->preRegion >= 0 ) {
- pdaRun->preRegion = -1;
- pdaRun->fsm_cs = pdaRun->next_cs;
+ if ( pda_run->token_id == SCAN_ERROR ) {
+ if ( pda_run->pre_region >= 0 ) {
+ pda_run->pre_region = -1;
+ pda_run->fsm_cs = pda_run->next_cs;
continue;
}
}
- if ( pdaRun->tokenId == SCAN_ERROR &&
- ( prg->rtd->regionInfo[pdaRun->region].ciLelId > 0 ) )
+ if ( pda_run->token_id == SCAN_ERROR &&
+ ( prg->rtd->region_info[pda_run->region].ci_lel_id > 0 ) )
{
debug( prg, REALM_PARSE, "sending a collect ignore\n" );
- send_collect_ignore( prg, sp, pdaRun, is,
- prg->rtd->regionInfo[pdaRun->region].ciLelId );
+ send_collect_ignore( prg, sp, pda_run, is,
+ prg->rtd->region_info[pda_run->region].ci_lel_id );
goto yes;
}
- if ( pdaRun->tokenId == SCAN_TRY_AGAIN_LATER ) {
+ if ( pda_run->token_id == SCAN_TRY_AGAIN_LATER ) {
debug( prg, REALM_PARSE, "scanner says try again later\n" );
break;
}
- assert( pdaRun->parseInput == 0 );
- pdaRun->parseInput = 0;
+ assert( pda_run->parse_input == 0 );
+ pda_run->parse_input = 0;
/* Check for EOF. */
- if ( pdaRun->tokenId == SCAN_EOF ) {
- is->eofSent = true;
- send_eof( prg, sp, pdaRun, is );
+ if ( pda_run->token_id == SCAN_EOF ) {
+ is->eof_sent = true;
+ send_eof( prg, sp, pda_run, is );
- pdaRun->frameId = prg->rtd->regionInfo[pdaRun->region].eofFrameId;
+ pda_run->frame_id = prg->rtd->region_info[pda_run->region].eof_frame_id;
- if ( prg->ctxDepParsing && pdaRun->frameId >= 0 ) {
+ if ( prg->ctx_dep_parsing && pda_run->frame_id >= 0 ) {
debug( prg, REALM_PARSE, "HAVE PRE_EOF BLOCK\n" );
- pdaRun->fi = &prg->rtd->frameInfo[pdaRun->frameId];
- pdaRun->code = pdaRun->fi->codeWV;
+ pda_run->fi = &prg->rtd->frame_info[pda_run->frame_id];
+ pda_run->code = pda_run->fi->codeWV;
/* COROUTINE */
return PCR_PRE_EOF;
case PCR_PRE_EOF:
- colm_make_reverse_code( pdaRun );
+ colm_make_reverse_code( pda_run );
}
}
- else if ( pdaRun->tokenId == SCAN_UNDO ) {
+ else if ( pda_run->token_id == SCAN_UNDO ) {
/* Fall through with parseInput = 0. FIXME: Do we need to send back ignore? */
debug( prg, REALM_PARSE, "invoking undo from the scanner\n" );
}
- else if ( pdaRun->tokenId == SCAN_ERROR ) {
+ else if ( pda_run->token_id == SCAN_ERROR ) {
/* Scanner error, maybe retry. */
- if ( pdaRun->accumIgnore == 0 && get_next_region( pdaRun, 1 ) != 0 ) {
+ if ( pda_run->accum_ignore == 0 && get_next_region( pda_run, 1 ) != 0 ) {
debug( prg, REALM_PARSE, "scanner failed, trying next region\n" );
- pdaRun->nextRegionInd += 1;
- goto skipSend;
+ pda_run->next_region_ind += 1;
+ goto skip_send;
}
else { // if ( pdaRun->numRetry > 0 ) {
debug( prg, REALM_PARSE, "invoking parse error from the scanner\n" );
/* Fall through to send null (error). */
- push_bt_point( prg, pdaRun );
+ push_bt_point( prg, pda_run );
}
#if 0
else {
@@ -2081,94 +2081,94 @@ long colm_parse_loop( program_t *prg, tree_t **sp, struct pda_run *pdaRun,
/* There are no alternative scanning regions to try, nor are
* there any alternatives stored in the current parse tree. No
* choice but to end the parse. */
- push_bt_point( prg, pdaRun );
+ push_bt_point( prg, pda_run );
- report_parse_error( prg, sp, pdaRun );
- pdaRun->parseError = 1;
- goto skipSend;
+ report_parse_error( prg, sp, pda_run );
+ pda_run->parse_error = 1;
+ goto skip_send;
}
#endif
}
- else if ( pdaRun->tokenId == SCAN_LANG_EL ) {
+ else if ( pda_run->token_id == SCAN_LANG_EL ) {
debug( prg, REALM_PARSE, "sending an named lang el\n" );
/* A named language element (parsing colm program). */
- prg->rtd->sendNamedLangEl( prg, sp, pdaRun, is );
+ prg->rtd->send_named_lang_el( prg, sp, pda_run, is );
}
- else if ( pdaRun->tokenId == SCAN_TREE ) {
+ else if ( pda_run->token_id == SCAN_TREE ) {
debug( prg, REALM_PARSE, "sending a tree\n" );
/* A tree already built. */
- send_tree( prg, sp, pdaRun, is );
+ send_tree( prg, sp, pda_run, is );
}
- else if ( pdaRun->tokenId == SCAN_IGNORE ) {
+ else if ( pda_run->token_id == SCAN_IGNORE ) {
debug( prg, REALM_PARSE, "sending an ignore token\n" );
/* A tree to ignore. */
- send_ignore_tree( prg, sp, pdaRun, is );
- goto skipSend;
+ send_ignore_tree( prg, sp, pda_run, is );
+ goto skip_send;
}
- else if ( prg->ctxDepParsing && lelInfo[pdaRun->tokenId].frameId >= 0 ) {
+ else if ( prg->ctx_dep_parsing && lel_info[pda_run->token_id].frame_id >= 0 ) {
/* Has a generation action. */
debug( prg, REALM_PARSE, "token gen action: %s\n",
- prg->rtd->lelInfo[pdaRun->tokenId].name );
+ prg->rtd->lel_info[pda_run->token_id].name );
/* Make the token data. */
- pdaRun->tokdata = peekMatch( prg, pdaRun, is );
+ pda_run->tokdata = peek_match( prg, pda_run, is );
/* Note that we don't update the position now. It is done when the token
* data is pulled from the inputStream. */
- pdaRun->p = pdaRun->pe = 0;
- pdaRun->toklen = 0;
- pdaRun->eof = 0;
+ pda_run->p = pda_run->pe = 0;
+ pda_run->toklen = 0;
+ pda_run->eof = 0;
- pdaRun->fi = &prg->rtd->frameInfo[prg->rtd->lelInfo[pdaRun->tokenId].frameId];
- pdaRun->frameId = prg->rtd->lelInfo[pdaRun->tokenId].frameId;
- pdaRun->code = pdaRun->fi->codeWV;
+ pda_run->fi = &prg->rtd->frame_info[prg->rtd->lel_info[pda_run->token_id].frame_id];
+ pda_run->frame_id = prg->rtd->lel_info[pda_run->token_id].frame_id;
+ pda_run->code = pda_run->fi->codeWV;
/* COROUTINE */
return PCR_GENERATION;
case PCR_GENERATION:
- colm_make_reverse_code( pdaRun );
+ colm_make_reverse_code( pda_run );
/* Finished with the match text. */
- stringFree( prg, pdaRun->tokdata );
+ string_free( prg, pda_run->tokdata );
- goto skipSend;
+ goto skip_send;
}
- else if ( lelInfo[pdaRun->tokenId].ignore ) {
+ else if ( lel_info[pda_run->token_id].ignore ) {
debug( prg, REALM_PARSE, "sending an ignore token: %s\n",
- prg->rtd->lelInfo[pdaRun->tokenId].name );
+ prg->rtd->lel_info[pda_run->token_id].name );
/* Is an ignore token. */
- send_ignore( prg, sp, pdaRun, is, pdaRun->tokenId );
- goto skipSend;
+ send_ignore( prg, sp, pda_run, is, pda_run->token_id );
+ goto skip_send;
}
else {
debug( prg, REALM_PARSE, "sending an a plain old token: %s\n",
- prg->rtd->lelInfo[pdaRun->tokenId].name );
+ prg->rtd->lel_info[pda_run->token_id].name );
/* Is a plain token. */
- send_token( prg, sp, pdaRun, is, pdaRun->tokenId );
+ send_token( prg, sp, pda_run, is, pda_run->token_id );
}
yes:
- if ( pdaRun->parseInput != 0 )
- colm_transfer_reverse_code( pdaRun, pdaRun->parseInput );
+ if ( pda_run->parse_input != 0 )
+ colm_transfer_reverse_code( pda_run, pda_run->parse_input );
- if ( pdaRun->parseInput != 0 ) {
+ if ( pda_run->parse_input != 0 ) {
/* If it's a nonterminal with a termdup then flip the parse tree to
* the terminal. */
- if ( pdaRun->parseInput->id >= prg->rtd->firstNonTermId ) {
- pdaRun->parseInput->id =
- prg->rtd->lelInfo[pdaRun->parseInput->id].termDupId;
- pdaRun->parseInput->flags |= PF_TERM_DUP;
+ if ( pda_run->parse_input->id >= prg->rtd->first_non_term_id ) {
+ pda_run->parse_input->id =
+ prg->rtd->lel_info[pda_run->parse_input->id].term_dup_id;
+ pda_run->parse_input->flags |= PF_TERM_DUP;
}
}
- long pcr = parse_token( prg, sp, pdaRun, is, PCR_START );
+ long pcr = parse_token( prg, sp, pda_run, is, PCR_START );
while ( pcr != PCR_DONE ) {
@@ -2177,45 +2177,45 @@ yes:
case PCR_REDUCTION:
case PCR_REVERSE:
- pcr = parse_token( prg, sp, pdaRun, is, entry );
+ pcr = parse_token( prg, sp, pda_run, is, entry );
}
assert( pcr == PCR_DONE );
- handle_error( prg, sp, pdaRun );
+ handle_error( prg, sp, pda_run );
-skipSend:
- new_token( prg, pdaRun );
+skip_send:
+ new_token( prg, pda_run );
/* Various stop conditions. This should all be coverned by one test
* eventually. */
- if ( pdaRun->triggerUndo ) {
+ if ( pda_run->trigger_undo ) {
debug( prg, REALM_PARSE, "parsing stopped by triggerUndo\n" );
break;
}
- if ( is->eofSent ) {
+ if ( is->eof_sent ) {
debug( prg, REALM_PARSE, "parsing stopped by EOF\n" );
break;
}
- if ( pdaRun->stopParsing ) {
+ if ( pda_run->stop_parsing ) {
debug( prg, REALM_PARSE, "scanner has been stopped\n" );
break;
}
- if ( pdaRun->stop ) {
+ if ( pda_run->stop ) {
debug( prg, REALM_PARSE, "parsing has been stopped by consumedCount\n" );
break;
}
- if ( prg->induceExit ) {
+ if ( prg->induce_exit ) {
debug( prg, REALM_PARSE, "parsing has been stopped by a call to exit\n" );
break;
}
- if ( pdaRun->parseError ) {
+ if ( pda_run->parse_error ) {
debug( prg, REALM_PARSE, "parsing stopped by a parse error\n" );
break;
}
@@ -2229,18 +2229,18 @@ skipSend:
}
-long colm_parse_frag( program_t *prg, tree_t **sp, struct pda_run *pdaRun,
- stream_t *input, long stopId, long entry )
+long colm_parse_frag( program_t *prg, tree_t **sp, struct pda_run *pda_run,
+ stream_t *input, long stop_id, long entry )
{
/* COROUTINE */
switch ( entry ) {
case PCR_START:
- if ( ! pdaRun->parseError ) {
- pdaRun->stopTarget = stopId;
+ if ( ! pda_run->parse_error ) {
+ pda_run->stop_target = stop_id;
- long pcr = colm_parse_loop( prg, sp, pdaRun,
- streamToImpl( input ), entry );
+ long pcr = colm_parse_loop( prg, sp, pda_run,
+ stream_to_impl( input ), entry );
while ( pcr != PCR_DONE ) {
@@ -2251,8 +2251,8 @@ long colm_parse_frag( program_t *prg, tree_t **sp, struct pda_run *pdaRun,
case PCR_PRE_EOF:
case PCR_REVERSE:
- pcr = colm_parse_loop( prg, sp, pdaRun,
- streamToImpl( input ), entry );
+ pcr = colm_parse_loop( prg, sp, pda_run,
+ stream_to_impl( input ), entry );
}
}
@@ -2264,7 +2264,7 @@ long colm_parse_frag( program_t *prg, tree_t **sp, struct pda_run *pdaRun,
}
long colm_parse_finish( tree_t **result, program_t *prg, tree_t **sp,
- struct pda_run *pdaRun, stream_t *input , int revertOn, long entry )
+ struct pda_run *pda_run, stream_t *input , int revert_on, long entry )
{
struct stream_impl *si;
@@ -2272,13 +2272,13 @@ long colm_parse_finish( tree_t **result, program_t *prg, tree_t **sp,
switch ( entry ) {
case PCR_START:
- if ( pdaRun->stopTarget <= 0 ) {
- si = streamToImpl( input );
- si->funcs->setEof( si );
+ if ( pda_run->stop_target <= 0 ) {
+ si = stream_to_impl( input );
+ si->funcs->set_eof( si );
- if ( ! pdaRun->parseError ) {
- si = streamToImpl( input );
- long pcr = colm_parse_loop( prg, sp, pdaRun, si, entry );
+ if ( ! pda_run->parse_error ) {
+ si = stream_to_impl( input );
+ long pcr = colm_parse_loop( prg, sp, pda_run, si, entry );
while ( pcr != PCR_DONE ) {
@@ -2289,8 +2289,8 @@ long colm_parse_finish( tree_t **result, program_t *prg, tree_t **sp,
case PCR_PRE_EOF:
case PCR_REVERSE:
- si = streamToImpl( input );
- pcr = colm_parse_loop( prg, sp, pdaRun, si, entry );
+ si = stream_to_impl( input );
+ pcr = colm_parse_loop( prg, sp, pda_run, si, entry );
}
}
}
@@ -2300,10 +2300,10 @@ long colm_parse_finish( tree_t **result, program_t *prg, tree_t **sp,
* work (at time of writing). */
//assert( (pdaRun->stopTarget > 0 && pdaRun->stopParsing) || streamToImpl( input )->eofSent );
- if ( !revertOn )
- commit_full( prg, sp, pdaRun, 0 );
+ if ( !revert_on )
+ commit_full( prg, sp, pda_run, 0 );
- tree_t *tree = get_parsed_root( pdaRun, pdaRun->stopTarget > 0 );
+ tree_t *tree = get_parsed_root( pda_run, pda_run->stop_target > 0 );
colm_tree_upref( tree );
*result = tree;
@@ -2315,28 +2315,28 @@ long colm_parse_finish( tree_t **result, program_t *prg, tree_t **sp,
return PCR_DONE;
}
-long colm_parse_undo_frag( program_t *prg, tree_t **sp, struct pda_run *pdaRun,
+long colm_parse_undo_frag( program_t *prg, tree_t **sp, struct pda_run *pda_run,
stream_t *input, long steps, long entry )
{
debug( prg, REALM_PARSE,
"undo parse frag, target steps: %ld, pdarun steps: %ld\n",
- steps, pdaRun->steps );
+ steps, pda_run->steps );
- reset_token( pdaRun );
+ reset_token( pda_run );
/* COROUTINE */
switch ( entry ) {
case PCR_START:
- if ( steps < pdaRun->steps ) {
+ if ( steps < pda_run->steps ) {
/* Setup environment for going backwards until we reduced steps to
* what we want. */
- pdaRun->numRetry += 1;
- pdaRun->targetSteps = steps;
- pdaRun->triggerUndo = 1;
+ pda_run->num_retry += 1;
+ pda_run->target_steps = steps;
+ pda_run->trigger_undo = 1;
/* The parse loop will recognise the situation. */
- long pcr = colm_parse_loop( prg, sp, pdaRun, streamToImpl(input), entry );
+ long pcr = colm_parse_loop( prg, sp, pda_run, stream_to_impl(input), entry );
while ( pcr != PCR_DONE ) {
/* COROUTINE */
@@ -2346,13 +2346,13 @@ long colm_parse_undo_frag( program_t *prg, tree_t **sp, struct pda_run *pdaRun,
case PCR_PRE_EOF:
case PCR_REVERSE:
- pcr = colm_parse_loop( prg, sp, pdaRun, streamToImpl(input), entry );
+ pcr = colm_parse_loop( prg, sp, pda_run, stream_to_impl(input), entry );
}
/* Reset environment. */
- pdaRun->triggerUndo = 0;
- pdaRun->targetSteps = -1;
- pdaRun->numRetry -= 1;
+ pda_run->trigger_undo = 0;
+ pda_run->target_steps = -1;
+ pda_run->num_retry -= 1;
}
/* COROUTINE */
diff --git a/src/pdarun.h b/src/pdarun.h
index a0b6ae80..5708f7fc 100644
--- a/src/pdarun.h
+++ b/src/pdarun.h
@@ -38,38 +38,38 @@ struct colm_program;
struct fsm_tables
{
long *actions;
- long *keyOffsets;
- char *transKeys;
- long *singleLengths;
- long *rangeLengths;
- long *indexOffsets;
+ long *key_offsets;
+ char *trans_keys;
+ long *single_lengths;
+ long *range_lengths;
+ long *index_offsets;
long *transTargsWI;
long *transActionsWI;
- long *toStateActions;
- long *fromStateActions;
- long *eofActions;
- long *eofTargs;
- long *entryByRegion;
-
- long numStates;
- long numActions;
- long numTransKeys;
- long numSingleLengths;
- long numRangeLengths;
- long numIndexOffsets;
+ long *to_state_actions;
+ long *from_state_actions;
+ long *eof_actions;
+ long *eof_targs;
+ long *entry_by_region;
+
+ long num_states;
+ long num_actions;
+ long num_trans_keys;
+ long num_single_lengths;
+ long num_range_lengths;
+ long num_index_offsets;
long numTransTargsWI;
long numTransActionsWI;
- long numRegions;
+ long num_regions;
- long startState;
- long firstFinal;
- long errorState;
+ long start_state;
+ long first_final;
+ long error_state;
- struct GenAction **actionSwitch;
- long numActionSwitch;
+ struct GenAction **action_switch;
+ long num_action_switch;
};
-void undoStreamPull( struct stream_impl *inputStream, const char *data, long length );
+void undo_stream_pull( struct stream_impl *input_stream, const char *data, long length );
#if SIZEOF_LONG != 4 && SIZEOF_LONG != 8
#error "SIZEOF_LONG contained an unexpected value"
@@ -80,29 +80,29 @@ struct colm_execution;
struct rt_code_vect
{
code_t *data;
- long tabLen;
- long allocLen;
+ long tab_len;
+ long alloc_len;
/* FIXME: leak when freed. */
};
-void listAddAfter( list_t *list, list_el_t *prev_el, list_el_t *new_el );
-void listAddBefore( list_t *list, list_el_t *next_el, list_el_t *new_el );
+void list_add_after( list_t *list, list_el_t *prev_el, list_el_t *new_el );
+void list_add_before( list_t *list, list_el_t *next_el, list_el_t *new_el );
-void listPrepend( list_t *list, list_el_t *new_el );
-void listAppend( list_t *list, list_el_t *new_el );
+void list_prepend( list_t *list, list_el_t *new_el );
+void list_append( list_t *list, list_el_t *new_el );
-list_el_t *listDetach( list_t *list, list_el_t *el );
-list_el_t *listDetachFirst(list_t *list );
-list_el_t *listDetachLast(list_t *list );
+list_el_t *list_detach( list_t *list, list_el_t *el );
+list_el_t *list_detach_first(list_t *list );
+list_el_t *list_detach_last(list_t *list );
-long listLength(list_t *list);
+long list_length(list_t *list);
struct function_info
{
- long frameId;
- long argSize;
- long frameSize;
+ long frame_id;
+ long arg_size;
+ long frame_size;
};
/*
@@ -112,20 +112,20 @@ struct function_info
struct pat_cons_info
{
long offset;
- long numBindings;
+ long num_bindings;
};
struct pat_cons_node
{
long id;
- long prodNum;
+ long prod_num;
long next;
long child;
- long bindId;
+ long bind_id;
const char *data;
long length;
- long leftIgnore;
- long rightIgnore;
+ long left_ignore;
+ long right_ignore;
/* Just match nonterminal, don't go inside. */
unsigned char stop;
@@ -136,41 +136,41 @@ struct pat_cons_node
struct lang_el_info
{
const char *name;
- const char *xmlTag;
+ const char *xml_tag;
unsigned char repeat;
unsigned char list;
unsigned char literal;
unsigned char ignore;
- long frameId;
+ long frame_id;
- long objectTypeId;
- long ofiOffset;
- long objectLength;
+ long object_type_id;
+ long ofi_offset;
+ long object_length;
- long termDupId;
- long markId;
- long captureAttr;
- long numCaptureAttr;
+ long term_dup_id;
+ long mark_id;
+ long capture_attr;
+ long num_capture_attr;
};
struct struct_el_info
{
long size;
short *trees;
- long treesLen;
+ long trees_len;
};
struct prod_info
{
- unsigned long lhsId;
- short prodNum;
+ unsigned long lhs_id;
+ short prod_num;
long length;
const char *name;
- long frameId;
- unsigned char lhsUpref;
+ long frame_id;
+ unsigned char lhs_upref;
unsigned char *copy;
- long copyLen;
+ long copy_len;
};
/* Must match the LocalType enum. */
@@ -193,17 +193,17 @@ struct frame_info
code_t *codeWC;
long codeLenWC;
struct local_info *locals;
- long localsLen;
- long argSize;
- long frameSize;
- char retTree;
+ long locals_len;
+ long arg_size;
+ long frame_size;
+ char ret_tree;
};
struct region_info
{
- long defaultToken;
- long eofFrameId;
- int ciLelId;
+ long default_token;
+ long eof_frame_id;
+ int ci_lel_id;
};
typedef struct _CaptureAttr
@@ -221,22 +221,22 @@ struct pda_tables
int *keys;
unsigned int *offsets;
unsigned int *targs;
- unsigned int *actInds;
+ unsigned int *act_inds;
unsigned int *actions;
- int *commitLen;
- int *tokenRegionInds;
- int *tokenRegions;
- int *tokenPreRegions;
-
- int numIndicies;
- int numKeys;
- int numStates;
- int numTargs;
- int numActInds;
- int numActions;
- int numCommitLen;
- int numRegionItems;
- int numPreRegionItems;
+ int *commit_len;
+ int *token_region_inds;
+ int *token_regions;
+ int *token_pre_regions;
+
+ int num_indicies;
+ int num_keys;
+ int num_states;
+ int num_targs;
+ int num_act_inds;
+ int num_actions;
+ int num_commit_len;
+ int num_region_items;
+ int num_pre_region_items;
};
struct pool_block
@@ -265,9 +265,9 @@ struct pda_run
*/
struct fsm_tables *fsm_tables;
- RunBuf *consumeBuf;
+ RunBuf *consume_buf;
- long region, preRegion;
+ long region, pre_region;
long fsm_cs, next_cs, act;
char *start;
char *tokstart;
@@ -277,71 +277,71 @@ struct pda_run
/* Bits. */
char eof;
- char returnResult;
- char skipToklen;
+ char return_result;
+ char skip_toklen;
char *mark[MARK_SLOTS];
- long matchedToken;
+ long matched_token;
/*
* Parsing
*/
- int numRetry;
- parse_tree_t *stackTop;
- ref_t *tokenList;
+ int num_retry;
+ parse_tree_t *stack_top;
+ ref_t *token_list;
int pda_cs;
- int nextRegionInd;
+ int next_region_ind;
struct pda_tables *pda_tables;
- int parserId;
+ int parser_id;
/* Reused. */
- struct rt_code_vect rcodeCollect;
- struct rt_code_vect reverseCode;
+ struct rt_code_vect rcode_collect;
+ struct rt_code_vect reverse_code;
- int stopParsing;
- long stopTarget;
+ int stop_parsing;
+ long stop_target;
- parse_tree_t *accumIgnore;
+ parse_tree_t *accum_ignore;
- kid_t *btPoint;
+ kid_t *bt_point;
struct bindings *bindings;
- int revertOn;
+ int revert_on;
struct colm_struct *context;
int stop;
- int parseError;
+ int parse_error;
long steps;
- long targetSteps;
- long shiftCount;
- long commitShiftCount;
+ long target_steps;
+ long shift_count;
+ long commit_shift_count;
- int onDeck;
+ int on_deck;
/*
* Data we added when refactoring the parsing engine into a coroutine.
*/
- parse_tree_t *parseInput;
+ parse_tree_t *parse_input;
struct frame_info *fi;
int reduction;
- parse_tree_t *redLel;
- int curState;
+ parse_tree_t *red_lel;
+ int cur_state;
parse_tree_t *lel;
- int triggerUndo;
+ int trigger_undo;
- int tokenId;
+ int token_id;
head_t *tokdata;
- int frameId;
+ int frame_id;
int next;
- parse_tree_t *undoLel;
+ parse_tree_t *undo_lel;
- int checkNext;
- int checkStop;
+ int check_next;
+ int check_stop;
/* The lhs is sometimes saved before reduction actions in case it is
* replaced and we need to restore it on backtracking */
@@ -352,24 +352,24 @@ struct pda_run
/* Instruction pointer to use when we stop parsing and execute code. */
code_t *code;
- int rcBlockCount;
+ int rc_block_count;
- tree_t *parseErrorText;
+ tree_t *parse_error_text;
};
-void colm_pda_init( struct colm_program *prg, struct pda_run *pdaRun,
- struct pda_tables *tables, int parserId, long stopTarget,
- int revertOn, struct colm_struct *context );
+void colm_pda_init( struct colm_program *prg, struct pda_run *pda_run,
+ struct pda_tables *tables, int parser_id, long stop_target,
+ int revert_on, struct colm_struct *context );
void colm_pda_clear( struct colm_program *prg, struct colm_tree **sp,
- struct pda_run *pdaRun );
+ struct pda_run *pda_run );
void colm_rt_code_vect_replace( struct rt_code_vect *vect, long pos,
const code_t *val, long len );
void colm_rt_code_vect_empty( struct rt_code_vect *vect );
void colm_rt_code_vect_remove( struct rt_code_vect *vect, long pos, long len );
-void initRtCodeVect( struct rt_code_vect *codeVect );
+void init_rt_code_vect( struct rt_code_vect *code_vect );
inline static void append_code_val( struct rt_code_vect *vect, const code_t val );
inline static void append_code_vect( struct rt_code_vect *vect, const code_t *val, long len );
@@ -378,12 +378,12 @@ inline static void append_word( struct rt_code_vect *vect, word_t word );
inline static void append_code_vect( struct rt_code_vect *vect, const code_t *val, long len )
{
- colm_rt_code_vect_replace( vect, vect->tabLen, val, len );
+ colm_rt_code_vect_replace( vect, vect->tab_len, val, len );
}
inline static void append_code_val( struct rt_code_vect *vect, const code_t val )
{
- colm_rt_code_vect_replace( vect, vect->tabLen, &val, 1 );
+ colm_rt_code_vect_replace( vect, vect->tab_len, &val, 1 );
}
inline static void append_half( struct rt_code_vect *vect, half_t half )
@@ -408,11 +408,11 @@ inline static void append_word( struct rt_code_vect *vect, word_t word )
#endif
}
-void colm_increment_steps( struct pda_run *pdaRun );
-void colm_decrement_steps( struct pda_run *pdaRun );
+void colm_increment_steps( struct pda_run *pda_run );
+void colm_decrement_steps( struct pda_run *pda_run );
-void colm_clear_stream_impl( struct colm_program *prg, tree_t **sp, struct stream_impl *inputStream );
-void colm_clear_source_stream( struct colm_program *prg, tree_t **sp, struct stream_impl *sourceStream );
+void colm_clear_stream_impl( struct colm_program *prg, tree_t **sp, struct stream_impl *input_stream );
+void colm_clear_source_stream( struct colm_program *prg, tree_t **sp, struct stream_impl *source_stream );
#define PCR_START 1
#define PCR_DONE 2
@@ -422,26 +422,26 @@ void colm_clear_source_stream( struct colm_program *prg, tree_t **sp, struct str
#define PCR_REVERSE 6
head_t *colm_stream_pull( struct colm_program *prg, struct colm_tree **sp,
- struct pda_run *pdaRun, struct stream_impl *is, long length );
+ struct pda_run *pda_run, struct stream_impl *is, long length );
head_t *colm_string_alloc_pointer( struct colm_program *prg, const char *data, long length );
-void colm_stream_push_text( struct stream_impl *inputStream, const char *data, long length );
-void colm_stream_push_tree( struct stream_impl *inputStream, tree_t *tree, int ignore );
-void colm_stream_push_stream( struct stream_impl *inputStream, tree_t *tree );
+void colm_stream_push_text( struct stream_impl *input_stream, const char *data, long length );
+void colm_stream_push_tree( struct stream_impl *input_stream, tree_t *tree, int ignore );
+void colm_stream_push_stream( struct stream_impl *input_stream, tree_t *tree );
void colm_undo_stream_push( struct colm_program *prg, tree_t **sp,
- struct stream_impl *inputStream, long length );
+ struct stream_impl *input_stream, long length );
-kid_t *make_token_with_data( struct colm_program *prg, struct pda_run *pdaRun,
- struct stream_impl *inputStream, int id, head_t *tokdata );
+kid_t *make_token_with_data( struct colm_program *prg, struct pda_run *pda_run,
+ struct stream_impl *input_stream, int id, head_t *tokdata );
-long colm_parse_loop( struct colm_program *prg, tree_t **sp, struct pda_run *pdaRun,
- struct stream_impl *inputStream, long entry );
+long colm_parse_loop( struct colm_program *prg, tree_t **sp, struct pda_run *pda_run,
+ struct stream_impl *input_stream, long entry );
-long colm_parse_frag( struct colm_program *prg, tree_t **sp, struct pda_run *pdaRun,
- stream_t *input, long stopId, long entry );
+long colm_parse_frag( struct colm_program *prg, tree_t **sp, struct pda_run *pda_run,
+ stream_t *input, long stop_id, long entry );
long colm_parse_finish( tree_t **result, struct colm_program *prg, tree_t **sp,
- struct pda_run *pdaRun, stream_t *input , int revertOn, long entry );
-long colm_parse_undo_frag( struct colm_program *prg, tree_t **sp, struct pda_run *pdaRun,
+ struct pda_run *pda_run, stream_t *input , int revert_on, long entry );
+long colm_parse_undo_frag( struct colm_program *prg, tree_t **sp, struct pda_run *pda_run,
stream_t *input, long steps, long entry );
#ifdef __cplusplus
diff --git a/src/pool.c b/src/pool.c
index 1d84c516..d5da6ab5 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -26,46 +26,46 @@
#include <colm/pool.h>
#include <colm/debug.h>
-void init_pool_alloc( struct pool_alloc *poolAlloc, int sizeofT )
+void init_pool_alloc( struct pool_alloc *pool_alloc, int sizeofT )
{
- poolAlloc->head = 0;
- poolAlloc->nextel = FRESH_BLOCK;
- poolAlloc->pool = 0;
- poolAlloc->sizeofT = sizeofT;
+ pool_alloc->head = 0;
+ pool_alloc->nextel = FRESH_BLOCK;
+ pool_alloc->pool = 0;
+ pool_alloc->sizeofT = sizeofT;
}
-static void *pool_alloc_allocate( struct pool_alloc *poolAlloc )
+static void *pool_alloc_allocate( struct pool_alloc *pool_alloc )
{
//debug( REALM_POOL, "pool allocation\n" );
#ifdef POOL_MALLOC
- void *res = malloc( poolAlloc->sizeofT );
- memset( res, 0, poolAlloc->sizeofT );
+ void *res = malloc( pool_alloc->sizeofT );
+ memset( res, 0, pool_alloc->sizeofT );
return res;
#else
- void *newEl = 0;
- if ( poolAlloc->pool == 0 ) {
- if ( poolAlloc->nextel == FRESH_BLOCK ) {
- struct pool_block *newBlock = (struct pool_block*)malloc( sizeof(struct pool_block) );
- newBlock->data = malloc( poolAlloc->sizeofT * FRESH_BLOCK );
- newBlock->next = poolAlloc->head;
- poolAlloc->head = newBlock;
- poolAlloc->nextel = 0;
+ void *new_el = 0;
+ if ( pool_alloc->pool == 0 ) {
+ if ( pool_alloc->nextel == FRESH_BLOCK ) {
+ struct pool_block *new_block = (struct pool_block*)malloc( sizeof(struct pool_block) );
+ new_block->data = malloc( pool_alloc->sizeofT * FRESH_BLOCK );
+ new_block->next = pool_alloc->head;
+ pool_alloc->head = new_block;
+ pool_alloc->nextel = 0;
}
- newEl = (char*)poolAlloc->head->data + poolAlloc->sizeofT * poolAlloc->nextel++;
+ new_el = (char*)pool_alloc->head->data + pool_alloc->sizeofT * pool_alloc->nextel++;
}
else {
- newEl = poolAlloc->pool;
- poolAlloc->pool = poolAlloc->pool->next;
+ new_el = pool_alloc->pool;
+ pool_alloc->pool = pool_alloc->pool->next;
}
- memset( newEl, 0, poolAlloc->sizeofT );
- return newEl;
+ memset( new_el, 0, pool_alloc->sizeofT );
+ return new_el;
#endif
}
-void pool_alloc_free( struct pool_alloc *poolAlloc, void *el )
+void pool_alloc_free( struct pool_alloc *pool_alloc, void *el )
{
#if 0
/* Some sanity checking. Best not to normally run with this on. */
@@ -80,14 +80,14 @@ void pool_alloc_free( struct pool_alloc *poolAlloc, void *el )
free( el );
#else
struct pool_item *pi = (struct pool_item*) el;
- pi->next = poolAlloc->pool;
- poolAlloc->pool = pi;
+ pi->next = pool_alloc->pool;
+ pool_alloc->pool = pi;
#endif
}
-void pool_alloc_clear( struct pool_alloc *poolAlloc )
+void pool_alloc_clear( struct pool_alloc *pool_alloc )
{
- struct pool_block *block = poolAlloc->head;
+ struct pool_block *block = pool_alloc->head;
while ( block != 0 ) {
struct pool_block *next = block->next;
free( block->data );
@@ -95,18 +95,18 @@ void pool_alloc_clear( struct pool_alloc *poolAlloc )
block = next;
}
- poolAlloc->head = 0;
- poolAlloc->nextel = 0;
- poolAlloc->pool = 0;
+ pool_alloc->head = 0;
+ pool_alloc->nextel = 0;
+ pool_alloc->pool = 0;
}
-long pool_alloc_num_lost( struct pool_alloc *poolAlloc )
+long pool_alloc_num_lost( struct pool_alloc *pool_alloc )
{
/* Count the number of items allocated. */
long lost = 0;
- struct pool_block *block = poolAlloc->head;
+ struct pool_block *block = pool_alloc->head;
if ( block != 0 ) {
- lost = poolAlloc->nextel;
+ lost = pool_alloc->nextel;
block = block->next;
while ( block != 0 ) {
lost += FRESH_BLOCK;
@@ -115,7 +115,7 @@ long pool_alloc_num_lost( struct pool_alloc *poolAlloc )
}
/* Subtract. Items that are on the free list. */
- struct pool_item *pi = poolAlloc->pool;
+ struct pool_item *pi = pool_alloc->pool;
while ( pi != 0 ) {
lost -= 1;
pi = pi->next;
@@ -130,22 +130,22 @@ long pool_alloc_num_lost( struct pool_alloc *poolAlloc )
kid_t *kid_allocate( program_t *prg )
{
- return (kid_t*) pool_alloc_allocate( &prg->kidPool );
+ return (kid_t*) pool_alloc_allocate( &prg->kid_pool );
}
void kid_free( program_t *prg, kid_t *el )
{
- pool_alloc_free( &prg->kidPool, el );
+ pool_alloc_free( &prg->kid_pool, el );
}
void kid_clear( program_t *prg )
{
- pool_alloc_clear( &prg->kidPool );
+ pool_alloc_clear( &prg->kid_pool );
}
long kid_num_lost( program_t *prg )
{
- return pool_alloc_num_lost( &prg->kidPool );
+ return pool_alloc_num_lost( &prg->kid_pool );
}
/*
@@ -154,22 +154,22 @@ long kid_num_lost( program_t *prg )
tree_t *tree_allocate( program_t *prg )
{
- return (tree_t*) pool_alloc_allocate( &prg->treePool );
+ return (tree_t*) pool_alloc_allocate( &prg->tree_pool );
}
void tree_free( program_t *prg, tree_t *el )
{
- pool_alloc_free( &prg->treePool, el );
+ pool_alloc_free( &prg->tree_pool, el );
}
void tree_clear( program_t *prg )
{
- pool_alloc_clear( &prg->treePool );
+ pool_alloc_clear( &prg->tree_pool );
}
long tree_num_lost( program_t *prg )
{
- return pool_alloc_num_lost( &prg->treePool );
+ return pool_alloc_num_lost( &prg->tree_pool );
}
/*
@@ -178,22 +178,22 @@ long tree_num_lost( program_t *prg )
parse_tree_t *parse_tree_allocate( program_t *prg )
{
- return (parse_tree_t*) pool_alloc_allocate( &prg->parseTreePool );
+ return (parse_tree_t*) pool_alloc_allocate( &prg->parse_tree_pool );
}
void parse_tree_free( program_t *prg, parse_tree_t *el )
{
- pool_alloc_free( &prg->parseTreePool, el );
+ pool_alloc_free( &prg->parse_tree_pool, el );
}
void parse_tree_clear( program_t *prg )
{
- pool_alloc_clear( &prg->parseTreePool );
+ pool_alloc_clear( &prg->parse_tree_pool );
}
long parse_tree_num_lost( program_t *prg )
{
- return pool_alloc_num_lost( &prg->parseTreePool );
+ return pool_alloc_num_lost( &prg->parse_tree_pool );
}
/*
@@ -202,22 +202,22 @@ long parse_tree_num_lost( program_t *prg )
head_t *head_allocate( program_t *prg )
{
- return (head_t*) pool_alloc_allocate( &prg->headPool );
+ return (head_t*) pool_alloc_allocate( &prg->head_pool );
}
void head_free( program_t *prg, head_t *el )
{
- pool_alloc_free( &prg->headPool, el );
+ pool_alloc_free( &prg->head_pool, el );
}
void head_clear( program_t *prg )
{
- pool_alloc_clear( &prg->headPool );
+ pool_alloc_clear( &prg->head_pool );
}
long head_num_lost( program_t *prg )
{
- return pool_alloc_num_lost( &prg->headPool );
+ return pool_alloc_num_lost( &prg->head_pool );
}
/*
@@ -226,20 +226,20 @@ long head_num_lost( program_t *prg )
location_t *location_allocate( program_t *prg )
{
- return (location_t*) pool_alloc_allocate( &prg->locationPool );
+ return (location_t*) pool_alloc_allocate( &prg->location_pool );
}
void location_free( program_t *prg, location_t *el )
{
- pool_alloc_free( &prg->locationPool, el );
+ pool_alloc_free( &prg->location_pool, el );
}
void location_clear( program_t *prg )
{
- pool_alloc_clear( &prg->locationPool );
+ pool_alloc_clear( &prg->location_pool );
}
long location_num_lost( program_t *prg )
{
- return pool_alloc_num_lost( &prg->locationPool );
+ return pool_alloc_num_lost( &prg->location_pool );
}
diff --git a/src/pool.h b/src/pool.h
index dec72df9..1879e39e 100644
--- a/src/pool.h
+++ b/src/pool.h
@@ -33,7 +33,7 @@
extern "C" {
#endif
-void init_pool_alloc( struct pool_alloc *poolAlloc, int sizeofT );
+void init_pool_alloc( struct pool_alloc *pool_alloc, int sizeofT );
kid_t *kid_allocate( program_t *prg );
void kid_free( program_t *prg, kid_t *el );
@@ -46,7 +46,7 @@ void tree_clear( program_t *prg );
long tree_num_lost( program_t *prg );
parse_tree_t *parse_tree_allocate( program_t *prg );
-void parseTreeFree( program_t *prg, parse_tree_t *el );
+void parse_tree_free( program_t *prg, parse_tree_t *el );
void parse_tree_clear( program_t *prg );
long parse_tree_num_lost( program_t *prg );
diff --git a/src/program.c b/src/program.c
index 18064548..2f8e889a 100644
--- a/src/program.c
+++ b/src/program.c
@@ -38,7 +38,7 @@
static void colm_alloc_global( program_t *prg )
{
/* Alloc the global. */
- prg->global = colm_struct_new( prg, prg->rtd->globalId ) ;
+ prg->global = colm_struct_new( prg, prg->rtd->global_id ) ;
}
void vm_init( program_t *prg )
@@ -49,33 +49,33 @@ void vm_init( program_t *prg )
b->offset = 0;
b->next = 0;
- prg->stackBlock = b;
+ prg->stack_block = b;
- prg->sb_beg = prg->stackBlock->data;
- prg->sb_end = prg->stackBlock->data + prg->stackBlock->len;
+ prg->sb_beg = prg->stack_block->data;
+ prg->sb_end = prg->stack_block->data + prg->stack_block->len;
- prg->stackRoot = prg->sb_end;
+ prg->stack_root = prg->sb_end;
}
tree_t **colm_vm_root( program_t *prg )
{
- return prg->stackRoot;
+ return prg->stack_root;
}
tree_t **vm_bs_add( program_t *prg, tree_t **sp, int n )
{
/* Close off the current block. */
- if ( prg->stackBlock != 0 ) {
- prg->stackBlock->offset = sp - prg->stackBlock->data;
- prg->sb_total += prg->stackBlock->len - prg->stackBlock->offset;
+ if ( prg->stack_block != 0 ) {
+ prg->stack_block->offset = sp - prg->stack_block->data;
+ prg->sb_total += prg->stack_block->len - prg->stack_block->offset;
}
if ( prg->reserve != 0 && prg->reserve->len >= n) {
struct stack_block *b = prg->reserve;
- b->next = prg->stackBlock;
+ b->next = prg->stack_block;
b->offset = 0;
- prg->stackBlock = b;
+ prg->stack_block = b;
prg->reserve = 0;
}
else {
@@ -83,16 +83,16 @@ tree_t **vm_bs_add( program_t *prg, tree_t **sp, int n )
int size = VM_STACK_SIZE;
if ( n > size )
size = n;
- b->next = prg->stackBlock;
+ b->next = prg->stack_block;
b->data = malloc( sizeof(tree_t*) * size );
b->len = size;
b->offset = 0;
- prg->stackBlock = b;
+ prg->stack_block = b;
}
- prg->sb_beg = prg->stackBlock->data;
- prg->sb_end = prg->stackBlock->data + prg->stackBlock->len;
+ prg->sb_beg = prg->stack_block->data;
+ prg->sb_end = prg->stack_block->data + prg->stack_block->len;
return prg->sb_end;
}
@@ -100,7 +100,7 @@ tree_t **vm_bs_add( program_t *prg, tree_t **sp, int n )
tree_t **vm_bs_pop( program_t *prg, tree_t **sp, int n )
{
while ( 1 ) {
- tree_t **end = prg->stackBlock->data + prg->stackBlock->len;
+ tree_t **end = prg->stack_block->data + prg->stack_block->len;
int remaining = end - sp;
/* Don't have to free this block. Remaining values to pop leave us
@@ -110,7 +110,7 @@ tree_t **vm_bs_pop( program_t *prg, tree_t **sp, int n )
return sp;
}
- if ( prg->stackBlock->next == 0 ) {
+ if ( prg->stack_block->next == 0 ) {
/* Don't delete the sentinal stack block. Returns the end as in the
* creation of the first stack block. */
return prg->sb_end;
@@ -124,29 +124,29 @@ tree_t **vm_bs_pop( program_t *prg, tree_t **sp, int n )
}
/* Pop the stack block. */
- struct stack_block *b = prg->stackBlock;
- prg->stackBlock = prg->stackBlock->next;
+ struct stack_block *b = prg->stack_block;
+ prg->stack_block = prg->stack_block->next;
prg->reserve = b;
/* Setup the bounds. Note that we restore the full block, which is
* necessary to honour any CONTIGUOUS statements that counted on it
* before a subsequent CONTIGUOUS triggered a new block. */
- prg->sb_beg = prg->stackBlock->data;
- prg->sb_end = prg->stackBlock->data + prg->stackBlock->len;
+ prg->sb_beg = prg->stack_block->data;
+ prg->sb_end = prg->stack_block->data + prg->stack_block->len;
/* Update the total stack usage. */
- prg->sb_total -= prg->stackBlock->len - prg->stackBlock->offset;
+ prg->sb_total -= prg->stack_block->len - prg->stack_block->offset;
n -= remaining;
- sp = prg->stackBlock->data + prg->stackBlock->offset;
+ sp = prg->stack_block->data + prg->stack_block->offset;
}
}
void vm_clear( program_t *prg )
{
- while ( prg->stackBlock != 0 ) {
- struct stack_block *b = prg->stackBlock;
- prg->stackBlock = prg->stackBlock->next;
+ while ( prg->stack_block != 0 ) {
+ struct stack_block *b = prg->stack_block;
+ prg->stack_block = prg->stack_block->next;
free( b->data );
free( b );
@@ -160,12 +160,12 @@ void vm_clear( program_t *prg )
tree_t *colm_return_val( struct colm_program *prg )
{
- return prg->returnVal;
+ return prg->return_val;
}
-void colm_set_debug( program_t *prg, long activeRealm )
+void colm_set_debug( program_t *prg, long active_realm )
{
- prg->activeRealm = activeRealm;
+ prg->active_realm = active_realm;
}
program_t *colm_new_program( struct colm_sections *rtd )
@@ -177,16 +177,16 @@ program_t *colm_new_program( struct colm_sections *rtd )
assert( sizeof(pointer_t) <= sizeof(tree_t) );
prg->rtd = rtd;
- prg->ctxDepParsing = 1;
+ prg->ctx_dep_parsing = 1;
- init_pool_alloc( &prg->kidPool, sizeof(kid_t) );
- init_pool_alloc( &prg->treePool, sizeof(tree_t) );
- init_pool_alloc( &prg->parseTreePool, sizeof(parse_tree_t) );
- init_pool_alloc( &prg->headPool, sizeof(head_t) );
- init_pool_alloc( &prg->locationPool, sizeof(location_t) );
+ init_pool_alloc( &prg->kid_pool, sizeof(kid_t) );
+ init_pool_alloc( &prg->tree_pool, sizeof(tree_t) );
+ init_pool_alloc( &prg->parse_tree_pool, sizeof(parse_tree_t) );
+ init_pool_alloc( &prg->head_pool, sizeof(head_t) );
+ init_pool_alloc( &prg->location_pool, sizeof(location_t) );
- prg->trueVal = (tree_t*) 1;
- prg->falseVal = (tree_t*) 0;
+ prg->true_val = (tree_t*) 1;
+ prg->false_val = (tree_t*) 0;
/* Allocate the global variable. */
colm_alloc_global( prg );
@@ -198,7 +198,7 @@ program_t *colm_new_program( struct colm_sections *rtd )
void colm_run_program( program_t *prg, int argc, const char **argv )
{
- if ( prg->rtd->rootCodeLen == 0 )
+ if ( prg->rtd->root_code_len == 0 )
return;
/* Make the arguments available to the program. */
@@ -207,9 +207,9 @@ void colm_run_program( program_t *prg, int argc, const char **argv )
Execution execution;
memset( &execution, 0, sizeof(execution) );
- execution.frameId = prg->rtd->rootFrameId;
+ execution.frame_id = prg->rtd->root_frame_id;
- colm_execute( prg, &execution, prg->rtd->rootCode );
+ colm_execute( prg, &execution, prg->rtd->root_code );
/* Clear the arg and stack. */
prg->argc = 0;
@@ -228,35 +228,35 @@ static void colm_clear_heap( program_t *prg, tree_t **sp )
int colm_delete_program( program_t *prg )
{
- tree_t **sp = prg->stackRoot;
- int exitStatus = prg->exitStatus;
+ tree_t **sp = prg->stack_root;
+ int exit_status = prg->exit_status;
- colm_tree_downref( prg, sp, prg->returnVal );
+ colm_tree_downref( prg, sp, prg->return_val );
colm_clear_heap( prg, sp );
colm_tree_downref( prg, sp, prg->error );
#if DEBUG
- long kidLost = kid_num_lost( prg );
- long treeLost = tree_num_lost( prg );
- long parseTreeLost = parse_tree_num_lost( prg );
- long headLost = head_num_lost( prg );
- long locationLost = location_num_lost( prg );
+ long kid_lost = kid_num_lost( prg );
+ long tree_lost = tree_num_lost( prg );
+ long parse_tree_lost = parse_tree_num_lost( prg );
+ long head_lost = head_num_lost( prg );
+ long location_lost = location_num_lost( prg );
- if ( kidLost )
- message( "warning: lost kids: %ld\n", kidLost );
+ if ( kid_lost )
+ message( "warning: lost kids: %ld\n", kid_lost );
- if ( treeLost )
- message( "warning: lost trees: %ld\n", treeLost );
+ if ( tree_lost )
+ message( "warning: lost trees: %ld\n", tree_lost );
- if ( parseTreeLost )
- message( "warning: lost parse trees: %ld\n", parseTreeLost );
+ if ( parse_tree_lost )
+ message( "warning: lost parse trees: %ld\n", parse_tree_lost );
- if ( headLost )
- message( "warning: lost heads: %ld\n", headLost );
+ if ( head_lost )
+ message( "warning: lost heads: %ld\n", head_lost );
- if ( locationLost )
- message( "warning: lost locations: %ld\n", locationLost );
+ if ( location_lost )
+ message( "warning: lost locations: %ld\n", location_lost );
#endif
kid_clear( prg );
@@ -265,7 +265,7 @@ int colm_delete_program( program_t *prg )
parse_tree_clear( prg );
location_clear( prg );
- RunBuf *rb = prg->allocRunBuf;
+ RunBuf *rb = prg->alloc_run_buf;
while ( rb != 0 ) {
RunBuf *next = rb->next;
free( rb );
@@ -276,5 +276,5 @@ int colm_delete_program( program_t *prg )
free( prg );
- return exitStatus;
+ return exit_status;
}
diff --git a/src/program.h b/src/program.h
index d74d4480..9949b386 100644
--- a/src/program.h
+++ b/src/program.h
@@ -34,71 +34,71 @@ struct stack_block
struct colm_sections
{
- struct lang_el_info *lelInfo;
- long numLangEls;
+ struct lang_el_info *lel_info;
+ long num_lang_els;
- struct struct_el_info *selInfo;
- long numStructEls;
+ struct struct_el_info *sel_info;
+ long num_struct_els;
- struct prod_info *prodInfo;
- long numProds;
+ struct prod_info *prod_info;
+ long num_prods;
- struct region_info *regionInfo;
- long numRegions;
+ struct region_info *region_info;
+ long num_regions;
- code_t *rootCode;
- long rootCodeLen;
- long rootFrameId;
+ code_t *root_code;
+ long root_code_len;
+ long root_frame_id;
- struct frame_info *frameInfo;
- long numFrames;
+ struct frame_info *frame_info;
+ long num_frames;
- struct function_info *functionInfo;
- long numFunctions;
+ struct function_info *function_info;
+ long num_functions;
- struct pat_cons_info *patReplInfo;
- long numPatterns;
+ struct pat_cons_info *pat_repl_info;
+ long num_patterns;
- struct pat_cons_node *patReplNodes;
- long numPatternNodes;
+ struct pat_cons_node *pat_repl_nodes;
+ long num_pattern_nodes;
- struct generic_info *genericInfo;
- long numGenerics;
+ struct generic_info *generic_info;
+ long num_generics;
- long argvGenericId;
+ long argv_generic_id;
const char **litdata;
long *litlen;
head_t **literals;
- long numLiterals;
+ long num_literals;
- CaptureAttr *captureAttr;
- long numCapturedAttr;
+ CaptureAttr *capture_attr;
+ long num_captured_attr;
- struct fsm_tables *fsmTables;
- struct pda_tables *pdaTables;
- int *startStates;
- int *eofLelIds;
- int *parserLelIds;
- long numParsers;
+ struct fsm_tables *fsm_tables;
+ struct pda_tables *pda_tables;
+ int *start_states;
+ int *eof_lel_ids;
+ int *parser_lel_ids;
+ long num_parsers;
- long globalSize;
+ long global_size;
- long firstNonTermId;
+ long first_non_term_id;
- long integerId;
- long stringId;
- long anyId;
- long eofId;
- long noTokenId;
- long globalId;
- long argvElId;
+ long integer_id;
+ long string_id;
+ long any_id;
+ long eof_id;
+ long no_token_id;
+ long global_id;
+ long argv_el_id;
- void (*fsm_execute)( struct pda_run *pdaRun, struct stream_impl *inputStream );
- void (*sendNamedLangEl)( struct colm_program *prg, tree_t **tree,
- struct pda_run *pdaRun, struct stream_impl *inputStream );
- void (*initBindings)( struct pda_run *pdaRun );
- void (*popBinding)( struct pda_run *pdaRun, parse_tree_t *tree );
+ void (*fsm_execute)( struct pda_run *pda_run, struct stream_impl *input_stream );
+ void (*send_named_lang_el)( struct colm_program *prg, tree_t **tree,
+ struct pda_run *pda_run, struct stream_impl *input_stream );
+ void (*init_bindings)( struct pda_run *pda_run );
+ void (*pop_binding)( struct pda_run *pda_run, parse_tree_t *tree );
};
@@ -110,46 +110,46 @@ struct heap_list
struct colm_program
{
- long activeRealm;
+ long active_realm;
int argc;
const char **argv;
- unsigned char ctxDepParsing;
+ unsigned char ctx_dep_parsing;
struct colm_sections *rtd;
struct colm_struct *global;
- int induceExit;
- int exitStatus;
+ int induce_exit;
+ int exit_status;
- struct pool_alloc kidPool;
- struct pool_alloc treePool;
- struct pool_alloc parseTreePool;
- struct pool_alloc headPool;
- struct pool_alloc locationPool;
+ struct pool_alloc kid_pool;
+ struct pool_alloc tree_pool;
+ struct pool_alloc parse_tree_pool;
+ struct pool_alloc head_pool;
+ struct pool_alloc location_pool;
- tree_t *trueVal;
- tree_t *falseVal;
+ tree_t *true_val;
+ tree_t *false_val;
struct heap_list heap;
- stream_t *stdinVal;
- stream_t *stdoutVal;
- stream_t *stderrVal;
+ stream_t *stdin_val;
+ stream_t *stdout_val;
+ stream_t *stderr_val;
tree_t *error;
- RunBuf *allocRunBuf;
+ RunBuf *alloc_run_buf;
/* Current stack block limits. Changed when crossing block boundaries. */
tree_t **sb_beg;
tree_t **sb_end;
long sb_total;
struct stack_block *reserve;
- struct stack_block *stackBlock;
- tree_t **stackRoot;
+ struct stack_block *stack_block;
+ tree_t **stack_root;
/* Returned value for main program and any exported functions. */
- tree_t *returnVal;
+ tree_t *return_val;
};
#endif
diff --git a/src/redfsm.cc b/src/redfsm.cc
index 39d750cd..17ca9ac3 100644
--- a/src/redfsm.cc
+++ b/src/redfsm.cc
@@ -836,18 +836,18 @@ fsm_tables *RedFsm::makeFsmTables()
int pos, curKeyOffset, curIndOffset;
fsm_tables *fsmTables = new fsm_tables;
- fsmTables->numStates = stateList.length();
+ fsmTables->num_states = stateList.length();
/*
* actions
*/
- fsmTables->numActions = 1;
+ fsmTables->num_actions = 1;
for ( GenActionTableMap::Iter act = actionMap; act.lte(); act++ )
- fsmTables->numActions += 1 + act->key.length();
+ fsmTables->num_actions += 1 + act->key.length();
pos = 0;
- fsmTables->actions = new long[fsmTables->numActions];
+ fsmTables->actions = new long[fsmTables->num_actions];
fsmTables->actions[pos++] = 0;
for ( GenActionTableMap::Iter act = actionMap; act.lte(); act++ ) {
fsmTables->actions[pos++] = act->key.length();
@@ -859,10 +859,10 @@ fsm_tables *RedFsm::makeFsmTables()
* keyOffset
*/
pos = 0, curKeyOffset = 0;
- fsmTables->keyOffsets = new long[fsmTables->numStates];
+ fsmTables->key_offsets = new long[fsmTables->num_states];
for ( RedStateList::Iter st = stateList; st.lte(); st++ ) {
/* Store the current offset. */
- fsmTables->keyOffsets[pos++] = curKeyOffset;
+ fsmTables->key_offsets[pos++] = curKeyOffset;
/* Move the key offset ahead. */
curKeyOffset += st->outSingle.length() + st->outRange.length()*2;
@@ -871,20 +871,20 @@ fsm_tables *RedFsm::makeFsmTables()
/*
* transKeys
*/
- fsmTables->numTransKeys = 0;
+ fsmTables->num_trans_keys = 0;
for ( RedStateList::Iter st = stateList; st.lte(); st++ ) {
- fsmTables->numTransKeys += st->outSingle.length();
- fsmTables->numTransKeys += 2 * st->outRange.length();
+ fsmTables->num_trans_keys += st->outSingle.length();
+ fsmTables->num_trans_keys += 2 * st->outRange.length();
}
pos = 0;
- fsmTables->transKeys = new char[fsmTables->numTransKeys];
+ fsmTables->trans_keys = new char[fsmTables->num_trans_keys];
for ( RedStateList::Iter st = stateList; st.lte(); st++ ) {
for ( RedTransList::Iter stel = st->outSingle; stel.lte(); stel++ )
- fsmTables->transKeys[pos++] = stel->lowKey.getVal();
+ fsmTables->trans_keys[pos++] = stel->lowKey.getVal();
for ( RedTransList::Iter rtel = st->outRange; rtel.lte(); rtel++ ) {
- fsmTables->transKeys[pos++] = rtel->lowKey.getVal();
- fsmTables->transKeys[pos++] = rtel->highKey.getVal();
+ fsmTables->trans_keys[pos++] = rtel->lowKey.getVal();
+ fsmTables->trans_keys[pos++] = rtel->highKey.getVal();
}
}
@@ -892,25 +892,25 @@ fsm_tables *RedFsm::makeFsmTables()
* singleLengths
*/
pos = 0;
- fsmTables->singleLengths = new long[fsmTables->numStates];
+ fsmTables->single_lengths = new long[fsmTables->num_states];
for ( RedStateList::Iter st = stateList; st.lte(); st++ )
- fsmTables->singleLengths[pos++] = st->outSingle.length();
+ fsmTables->single_lengths[pos++] = st->outSingle.length();
/*
* rangeLengths
*/
pos = 0;
- fsmTables->rangeLengths = new long[fsmTables->numStates];
+ fsmTables->range_lengths = new long[fsmTables->num_states];
for ( RedStateList::Iter st = stateList; st.lte(); st++ )
- fsmTables->rangeLengths[pos++] = st->outRange.length();
+ fsmTables->range_lengths[pos++] = st->outRange.length();
/*
* indexOffsets
*/
pos = 0, curIndOffset = 0;
- fsmTables->indexOffsets = new long[fsmTables->numStates];
+ fsmTables->index_offsets = new long[fsmTables->num_states];
for ( RedStateList::Iter st = stateList; st.lte(); st++ ) {
- fsmTables->indexOffsets[pos++] = curIndOffset;
+ fsmTables->index_offsets[pos++] = curIndOffset;
curIndOffset += st->outSingle.length() + st->outRange.length();
if ( st->defTrans != 0 )
@@ -969,63 +969,63 @@ fsm_tables *RedFsm::makeFsmTables()
* toStateActions
*/
pos = 0;
- fsmTables->toStateActions = new long[fsmTables->numStates];
+ fsmTables->to_state_actions = new long[fsmTables->num_states];
for ( RedStateList::Iter st = stateList; st.lte(); st++ )
- fsmTables->toStateActions[pos++] = toStateAction( st );
+ fsmTables->to_state_actions[pos++] = toStateAction( st );
/*
* fromStateActions
*/
pos = 0;
- fsmTables->fromStateActions = new long[fsmTables->numStates];
+ fsmTables->from_state_actions = new long[fsmTables->num_states];
for ( RedStateList::Iter st = stateList; st.lte(); st++ )
- fsmTables->fromStateActions[pos++] = fromStateAction( st );
+ fsmTables->from_state_actions[pos++] = fromStateAction( st );
/*
* eofActions
*/
pos = 0;
- fsmTables->eofActions = new long[fsmTables->numStates];
+ fsmTables->eof_actions = new long[fsmTables->num_states];
for ( RedStateList::Iter st = stateList; st.lte(); st++ )
- fsmTables->eofActions[pos++] = eofAction( st );
+ fsmTables->eof_actions[pos++] = eofAction( st );
/*
* eofTargs
*/
pos = 0;
- fsmTables->eofTargs = new long[fsmTables->numStates];
+ fsmTables->eof_targs = new long[fsmTables->num_states];
for ( RedStateList::Iter st = stateList; st.lte(); st++ ) {
int targ = -1;
if ( st->eofTrans != 0 )
targ = st->eofTrans->targ->id;
- fsmTables->eofTargs[pos++] = targ;
+ fsmTables->eof_targs[pos++] = targ;
}
/* Start state. */
- fsmTables->startState = startState->id;
+ fsmTables->start_state = startState->id;
/* First final state. */
- fsmTables->firstFinal = ( firstFinState != 0 ) ?
+ fsmTables->first_final = ( firstFinState != 0 ) ?
firstFinState->id : nextStateId;
/* The error state. */
- fsmTables->errorState = ( errState != 0 ) ?
+ fsmTables->error_state = ( errState != 0 ) ?
errState->id : -1;
/* The array pointing to actions. */
pos = 0;
- fsmTables->numActionSwitch = genActionList.length();
- fsmTables->actionSwitch = new GenAction*[fsmTables->numActionSwitch];
+ fsmTables->num_action_switch = genActionList.length();
+ fsmTables->action_switch = new GenAction*[fsmTables->num_action_switch];
for ( GenActionList::Iter act = genActionList; act.lte(); act++ )
- fsmTables->actionSwitch[pos++] = act;
+ fsmTables->action_switch[pos++] = act;
/*
* entryByRegion
*/
- fsmTables->numRegions = regionToEntry.length()+1;
- fsmTables->entryByRegion = new long[fsmTables->numRegions];
- fsmTables->entryByRegion[0] = fsmTables->errorState;
+ fsmTables->num_regions = regionToEntry.length()+1;
+ fsmTables->entry_by_region = new long[fsmTables->num_regions];
+ fsmTables->entry_by_region[0] = fsmTables->error_state;
pos = 1;
for ( RegionToEntry::Iter en = regionToEntry; en.lte(); en++ ) {
@@ -1033,8 +1033,8 @@ fsm_tables *RedFsm::makeFsmTables()
RedEntryMapEl *entryMapEl = redEntryMap.find( *en );
/* Save it off. */
- fsmTables->entryByRegion[pos++] = entryMapEl != 0 ? entryMapEl->value
- : fsmTables->errorState;
+ fsmTables->entry_by_region[pos++] = entryMapEl != 0 ? entryMapEl->value
+ : fsmTables->error_state;
}
return fsmTables;
diff --git a/src/string.c b/src/string.c
index 9003eb1e..2a1c5674 100644
--- a/src/string.c
+++ b/src/string.c
@@ -31,18 +31,18 @@
str_t *string_prefix( program_t *prg, str_t *str, long len )
{
- head_t *head = stringAllocFull( prg, str->value->data, len );
- return (str_t*)constructString( prg, head );
+ head_t *head = string_alloc_full( prg, str->value->data, len );
+ return (str_t*)construct_string( prg, head );
}
str_t *string_suffix( program_t *prg, str_t *str, long pos )
{
long len = str->value->length - pos;
- head_t *head = stringAllocFull( prg, str->value->data + pos, len );
- return (str_t*)constructString( prg, head );
+ head_t *head = string_alloc_full( prg, str->value->data + pos, len );
+ return (str_t*)construct_string( prg, head );
}
-tree_t *constructString( program_t *prg, head_t *s )
+tree_t *construct_string( program_t *prg, head_t *s )
{
str_t *str = (str_t*) tree_allocate( prg );
str->id = LEL_ID_STR;
@@ -59,12 +59,12 @@ tree_t *constructString( program_t *prg, head_t *s )
* nulls.
*/
-head_t *stringCopy( program_t *prg, head_t *head )
+head_t *string_copy( program_t *prg, head_t *head )
{
head_t *result = 0;
if ( head != 0 ) {
if ( (char*)(head+1) == head->data )
- result = stringAllocFull( prg, head->data, head->length );
+ result = string_alloc_full( prg, head->data, head->length );
else
result = colm_string_alloc_pointer( prg, head->data, head->length );
@@ -79,7 +79,7 @@ head_t *stringCopy( program_t *prg, head_t *head )
return result;
}
-void stringFree( program_t *prg, head_t *head )
+void string_free( program_t *prg, head_t *head )
{
if ( head != 0 ) {
if ( head->location != 0 )
@@ -96,27 +96,27 @@ void stringFree( program_t *prg, head_t *head )
}
}
-const char *stringData( head_t *head )
+const char *string_data( head_t *head )
{
if ( head == 0 )
return 0;
return head->data;
}
-long stringLength( head_t *head )
+long string_length( head_t *head )
{
if ( head == 0 )
return 0;
return head->length;
}
-void stringShorten( head_t *head, long newlen )
+void string_shorten( head_t *head, long newlen )
{
assert( newlen <= head->length );
head->length = newlen;
}
-head_t *initStrSpace( long length )
+head_t *init_str_space( long length )
{
/* Find the length and allocate the space for the shared string. */
head_t *head = (head_t*) malloc( sizeof(head_t) + length );
@@ -131,10 +131,10 @@ head_t *initStrSpace( long length )
}
/* Create from a c-style string. */
-head_t *stringAllocFull( program_t *prg, const char *data, long length )
+head_t *string_alloc_full( program_t *prg, const char *data, long length )
{
/* Init space for the data. */
- head_t *head = initStrSpace( length );
+ head_t *head = init_str_space( length );
/* Copy in the data. */
memcpy( (head+1), data, length );
@@ -155,13 +155,13 @@ head_t *colm_string_alloc_pointer( program_t *prg, const char *data, long length
return head;
}
-head_t *concatStr( head_t *s1, head_t *s2 )
+head_t *concat_str( head_t *s1, head_t *s2 )
{
long s1Len = s1->length;
long s2Len = s2->length;
/* Init space for the data. */
- head_t *head = initStrSpace( s1Len + s2Len );
+ head_t *head = init_str_space( s1Len + s2Len );
/* Copy in the data. */
memcpy( (head+1), s1->data, s1Len );
@@ -170,11 +170,11 @@ head_t *concatStr( head_t *s1, head_t *s2 )
return head;
}
-head_t *stringToUpper( head_t *s )
+head_t *string_to_upper( head_t *s )
{
/* Init space for the data. */
long len = s->length;
- head_t *head = initStrSpace( len );
+ head_t *head = init_str_space( len );
/* Copy in the data. */
const char *src = s->data;
@@ -186,11 +186,11 @@ head_t *stringToUpper( head_t *s )
return head;
}
-head_t *stringToLower( head_t *s )
+head_t *string_to_lower( head_t *s )
{
/* Init space for the data. */
long len = s->length;
- head_t *head = initStrSpace( len );
+ head_t *head = init_str_space( len );
/* Copy in the data. */
const char *src = s->data;
@@ -204,7 +204,7 @@ head_t *stringToLower( head_t *s )
/* Compare two strings. If identical returns 1, otherwise 0. */
-word_t cmpString( head_t *s1, head_t *s2 )
+word_t cmp_string( head_t *s1, head_t *s2 )
{
if ( s1->length < s2->length )
return -1;
@@ -217,7 +217,7 @@ word_t cmpString( head_t *s1, head_t *s2 )
}
}
-word_t strAtoi( head_t *str )
+word_t str_atoi( head_t *str )
{
/* FIXME: need to implement this by hand. There is no null terminator. */
char *nulled = (char*)malloc( str->length + 1 );
@@ -228,7 +228,7 @@ word_t strAtoi( head_t *str )
return res;
}
-word_t strAtoo( head_t *str )
+word_t str_atoo( head_t *str )
{
/* FIXME: need to implement this by hand. There is no null terminator. */
char *nulled = (char*)malloc( str->length + 1 );
@@ -239,14 +239,14 @@ word_t strAtoo( head_t *str )
return res;
}
-head_t *intToStr( program_t *prg, word_t i )
+head_t *int_to_str( program_t *prg, word_t i )
{
char data[20];
sprintf( data, "%ld", i );
- return stringAllocFull( prg, data, strlen(data) );
+ return string_alloc_full( prg, data, strlen(data) );
}
-word_t strUord16( head_t *head )
+word_t str_uord16( head_t *head )
{
uchar *data = (uchar*)(head->data);
ulong res;
@@ -255,26 +255,26 @@ word_t strUord16( head_t *head )
return res;
}
-word_t strUord8( head_t *head )
+word_t str_uord8( head_t *head )
{
uchar *data = (uchar*)(head->data);
ulong res = (ulong)data[0];
return res;
}
-head_t *makeLiteral( program_t *prg, long offset )
+head_t *make_literal( program_t *prg, long offset )
{
return colm_string_alloc_pointer( prg,
prg->rtd->litdata[offset],
prg->rtd->litlen[offset] );
}
-head_t *stringSprintf( program_t *prg, str_t *format, long integer )
+head_t *string_sprintf( program_t *prg, str_t *format, long integer )
{
- head_t *formatHead = format->value;
- long written = snprintf( 0, 0, stringData(formatHead), integer );
- head_t *head = initStrSpace( written+1 );
- written = snprintf( (char*)head->data, written+1, stringData(formatHead), integer );
+ head_t *format_head = format->value;
+ long written = snprintf( 0, 0, string_data(format_head), integer );
+ head_t *head = init_str_space( written+1 );
+ written = snprintf( (char*)head->data, written+1, string_data(format_head), integer );
head->length -= 1;
return head;
}
diff --git a/src/struct.c b/src/struct.c
index 8beb9e2d..80ae37bf 100644
--- a/src/struct.c
+++ b/src/struct.c
@@ -40,7 +40,7 @@ struct colm_struct *colm_struct_new_size( program_t *prg, int size )
struct colm_struct *colm_struct_new( program_t *prg, int id )
{
- struct colm_struct *s = colm_struct_new_size( prg, prg->rtd->selInfo[id].size );
+ struct colm_struct *s = colm_struct_new_size( prg, prg->rtd->sel_info[id].size );
s->id = id;
return s;
}
@@ -54,8 +54,8 @@ void colm_struct_delete( program_t *prg, tree_t **sp, struct colm_struct *el )
}
if ( el->id >= 0 ) {
- short *t = prg->rtd->selInfo[el->id].trees;
- int i, len = prg->rtd->selInfo[el->id].treesLen;
+ short *t = prg->rtd->sel_info[el->id].trees;
+ int i, len = prg->rtd->sel_info[el->id].trees_len;
for ( i = 0; i < len; i++ ) {
tree_t *tree = colm_struct_get_field( el, tree_t*, t[i] );
colm_tree_downref( prg, sp, tree );
@@ -69,8 +69,8 @@ void colm_parser_destroy( program_t *prg, tree_t **sp, struct colm_struct *s )
struct colm_parser *parser = (struct colm_parser*) s;
/* Free the PDA run. */
- colm_pda_clear( prg, sp, parser->pdaRun );
- free( parser->pdaRun );
+ colm_pda_clear( prg, sp, parser->pda_run );
+ free( parser->pda_run );
/* Free the result. */
colm_tree_downref( prg, sp, parser->result );
@@ -78,11 +78,11 @@ void colm_parser_destroy( program_t *prg, tree_t **sp, struct colm_struct *s )
parser_t *colm_parser_new( program_t *prg, struct generic_info *gi )
{
- struct pda_run *pdaRun = malloc( sizeof(struct pda_run) );
+ struct pda_run *pda_run = malloc( sizeof(struct pda_run) );
/* Start off the parsing process. */
- colm_pda_init( prg, pdaRun, prg->rtd->pdaTables,
- gi->parserId, 0, 0, 0 );
+ colm_pda_init( prg, pda_run, prg->rtd->pda_tables,
+ gi->parser_id, 0, 0, 0 );
size_t memsize = sizeof(struct colm_parser);
struct colm_parser *parser = (struct colm_parser*) malloc( memsize );
@@ -91,7 +91,7 @@ parser_t *colm_parser_new( program_t *prg, struct generic_info *gi )
parser->id = STRUCT_INBUILT_ID;
parser->destructor = &colm_parser_destroy;
- parser->pdaRun = pdaRun;
+ parser->pda_run = pda_run;
return parser;
}
@@ -119,11 +119,11 @@ map_t *colm_map_new( struct colm_program *prg )
return map;
}
-struct_t *colm_construct_generic( program_t *prg, long genericId )
+struct_t *colm_construct_generic( program_t *prg, long generic_id )
{
- struct generic_info *genericInfo = &prg->rtd->genericInfo[genericId];
- struct_t *newGeneric = 0;
- switch ( genericInfo->type ) {
+ struct generic_info *generic_info = &prg->rtd->generic_info[generic_id];
+ struct_t *new_generic = 0;
+ switch ( generic_info->type ) {
case GEN_MAP_EL:
case GEN_LIST_EL:
break;
@@ -132,25 +132,25 @@ struct_t *colm_construct_generic( program_t *prg, long genericId )
case GEN_VMAP:
{
map_t *map = colm_map_new( prg );
- map->genericInfo = genericInfo;
- newGeneric = (struct_t*) map;
+ map->generic_info = generic_info;
+ new_generic = (struct_t*) map;
break;
}
case GEN_LIST:
case GEN_VLIST:
{
list_t *list = colm_list_new( prg );
- list->genericInfo = genericInfo;
- newGeneric = (struct_t*) list;
+ list->generic_info = generic_info;
+ new_generic = (struct_t*) list;
break;
}
case GEN_PARSER: {
- parser_t *parser = colm_parser_new( prg, genericInfo );
+ parser_t *parser = colm_parser_new( prg, generic_info );
parser->input = colm_stream_new( prg );
- newGeneric = (struct_t*) parser;
+ new_generic = (struct_t*) parser;
break;
}
}
- return newGeneric;
+ return new_generic;
}
diff --git a/src/struct.h b/src/struct.h
index 1ffb9af7..e70d7502 100644
--- a/src/struct.h
+++ b/src/struct.h
@@ -31,7 +31,7 @@ typedef struct colm_parser
void *buffer[10];
- struct pda_run *pdaRun;
+ struct pda_run *pda_run;
struct colm_stream *input;
tree_t *result;
} parser_t;
@@ -66,8 +66,8 @@ typedef struct colm_list
void *buffer[8];
list_el_t *head, *tail;
- long listLen;
- struct generic_info *genericInfo;
+ long list_len;
+ struct generic_info *generic_info;
} list_t;
typedef struct colm_map_el
@@ -91,8 +91,8 @@ typedef struct colm_map
void *buffer[8];
struct colm_map_el *head, *tail, *root;
- long treeSize;
- struct generic_info *genericInfo;
+ long tree_size;
+ struct generic_info *generic_info;
} map_t;
struct colm_struct *colm_struct_new_size( struct colm_program *prg, int size );
@@ -117,13 +117,13 @@ struct colm_struct *colm_struct_inbuilt( struct colm_program *prg, int size,
((void*)el) - (field * sizeof(void*)) - sizeof(struct colm_struct)
#define colm_generic_el_container( prg, el, genId ) \
- colm_struct_container( el, prg->rtd->genericInfo[genId].elOffset )
+ colm_struct_container( el, prg->rtd->generic_info[genId].el_offset )
#define colm_struct_to_list_el( prg, obj, genId ) \
- colm_struct_get_addr( obj, list_el_t*, prg->rtd->genericInfo[genId].elOffset )
+ colm_struct_get_addr( obj, list_el_t*, prg->rtd->generic_info[genId].el_offset )
#define colm_struct_to_map_el( prg, obj, genId ) \
- colm_struct_get_addr( obj, map_el_t*, prg->rtd->genericInfo[genId].elOffset )
+ colm_struct_get_addr( obj, map_el_t*, prg->rtd->generic_info[genId].el_offset )
parser_t *colm_parser_new( struct colm_program *prg, struct generic_info *gi );
stream_t *colm_stream_new( struct colm_program *prg );
@@ -131,20 +131,20 @@ stream_t *colm_stream_new_struct( struct colm_program *prg );
list_t *colm_list_new( struct colm_program *prg );
struct colm_struct *colm_list_get( struct colm_program *prg, list_t *list,
- word_t genId, word_t field );
+ word_t gen_id, word_t field );
struct colm_struct *colm_list_el_get( struct colm_program *prg,
- list_el_t *listEl, word_t genId, word_t field );
+ list_el_t *list_el, word_t gen_id, word_t field );
list_el_t *colm_list_detach_head( list_t *list );
list_el_t *colm_list_detach_tail( list_t *list );
long colm_list_length( list_t *list );
map_t *colm_map_new( struct colm_program *prg );
struct colm_struct *colm_map_el_get( struct colm_program *prg,
- map_el_t *mapEl, word_t genId, word_t field );
+ map_el_t *map_el, word_t gen_id, word_t field );
struct colm_struct *colm_map_get( struct colm_program *prg, map_t *map,
- word_t genId, word_t field );
+ word_t gen_id, word_t field );
-struct colm_struct *colm_construct_generic( struct colm_program *prg, long genericId );
+struct colm_struct *colm_construct_generic( struct colm_program *prg, long generic_id );
#define STRUCT_INBUILT_ID -1
diff --git a/src/tree.c b/src/tree.c
index 33f693f0..3370a793 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -39,7 +39,7 @@
#define BUFFER_INITIAL_SIZE 4096
-kid_t *allocAttrs( program_t *prg, long length )
+kid_t *alloc_attrs( program_t *prg, long length )
{
kid_t *cur = 0;
long i;
@@ -51,7 +51,7 @@ kid_t *allocAttrs( program_t *prg, long length )
return cur;
}
-void freeAttrs( program_t *prg, kid_t *attrs )
+void free_attrs( program_t *prg, kid_t *attrs )
{
kid_t *cur = attrs;
while ( cur != 0 ) {
@@ -61,7 +61,7 @@ void freeAttrs( program_t *prg, kid_t *attrs )
}
}
-void freeKidList( program_t *prg, kid_t *kid )
+void free_kid_list( program_t *prg, kid_t *kid )
{
while ( kid != 0 ) {
kid_t *next = kid->next;
@@ -149,7 +149,7 @@ int colm_list_last( tree_t *tree )
return kid->next == 0;
}
-kid_t *getAttrKid( tree_t *tree, long pos )
+kid_t *get_attr_kid( tree_t *tree, long pos )
{
long i;
kid_t *kid = tree->child;
@@ -164,7 +164,7 @@ kid_t *getAttrKid( tree_t *tree, long pos )
return kid;
}
-kid_t *kidListConcat( kid_t *list1, kid_t *list2 )
+kid_t *kid_list_concat( kid_t *list1, kid_t *list2 )
{
if ( list1 == 0 )
return list2;
@@ -195,72 +195,72 @@ value_t colm_get_pointer_val( tree_t *ptr )
tree_t *colm_construct_term( program_t *prg, word_t id, head_t *tokdata )
{
- struct lang_el_info *lelInfo = prg->rtd->lelInfo;
+ struct lang_el_info *lel_info = prg->rtd->lel_info;
tree_t *tree = tree_allocate( prg );
tree->id = id;
tree->refs = 0;
tree->tokdata = tokdata;
- int objectLength = lelInfo[tree->id].objectLength;
- tree->child = allocAttrs( prg, objectLength );
+ int object_length = lel_info[tree->id].object_length;
+ tree->child = alloc_attrs( prg, object_length );
return tree;
}
-kid_t *constructKid( program_t *prg, tree_t **bindings, kid_t *prev, long pat );
+kid_t *construct_kid( program_t *prg, tree_t **bindings, kid_t *prev, long pat );
-static kid_t *constructIgnoreList( program_t *prg, long ignoreInd )
+static kid_t *construct_ignore_list( program_t *prg, long ignore_ind )
{
- struct pat_cons_node *nodes = prg->rtd->patReplNodes;
+ struct pat_cons_node *nodes = prg->rtd->pat_repl_nodes;
kid_t *first = 0, *last = 0;
- while ( ignoreInd >= 0 ) {
- head_t *ignoreData = colm_string_alloc_pointer( prg, nodes[ignoreInd].data,
- nodes[ignoreInd].length );
+ while ( ignore_ind >= 0 ) {
+ head_t *ignore_data = colm_string_alloc_pointer( prg, nodes[ignore_ind].data,
+ nodes[ignore_ind].length );
- tree_t *ignTree = tree_allocate( prg );
- ignTree->refs = 1;
- ignTree->id = nodes[ignoreInd].id;
- ignTree->tokdata = ignoreData;
+ tree_t *ign_tree = tree_allocate( prg );
+ ign_tree->refs = 1;
+ ign_tree->id = nodes[ignore_ind].id;
+ ign_tree->tokdata = ignore_data;
- kid_t *ignKid = kid_allocate( prg );
- ignKid->tree = ignTree;
- ignKid->next = 0;
+ kid_t *ign_kid = kid_allocate( prg );
+ ign_kid->tree = ign_tree;
+ ign_kid->next = 0;
if ( last == 0 )
- first = ignKid;
+ first = ign_kid;
else
- last->next = ignKid;
+ last->next = ign_kid;
- ignoreInd = nodes[ignoreInd].next;
- last = ignKid;
+ ignore_ind = nodes[ignore_ind].next;
+ last = ign_kid;
}
return first;
}
-static kid_t *constructLeftIgnoreList( program_t *prg, long pat )
+static kid_t *construct_left_ignore_list( program_t *prg, long pat )
{
- struct pat_cons_node *nodes = prg->rtd->patReplNodes;
- return constructIgnoreList( prg, nodes[pat].leftIgnore );
+ struct pat_cons_node *nodes = prg->rtd->pat_repl_nodes;
+ return construct_ignore_list( prg, nodes[pat].left_ignore );
}
-static kid_t *constructRightIgnoreList( program_t *prg, long pat )
+static kid_t *construct_right_ignore_list( program_t *prg, long pat )
{
- struct pat_cons_node *nodes = prg->rtd->patReplNodes;
- return constructIgnoreList( prg, nodes[pat].rightIgnore );
+ struct pat_cons_node *nodes = prg->rtd->pat_repl_nodes;
+ return construct_ignore_list( prg, nodes[pat].right_ignore );
}
-static void insLeftIgnore( program_t *prg, tree_t *tree, tree_t *ignoreList )
+static void ins_left_ignore( program_t *prg, tree_t *tree, tree_t *ignore_list )
{
assert( ! (tree->flags & AF_LEFT_IGNORE) );
/* Allocate. */
kid_t *kid = kid_allocate( prg );
- kid->tree = ignoreList;
- colm_tree_upref( ignoreList );
+ kid->tree = ignore_list;
+ colm_tree_upref( ignore_list );
/* Attach it. */
kid->next = tree->child;
@@ -269,14 +269,14 @@ static void insLeftIgnore( program_t *prg, tree_t *tree, tree_t *ignoreList )
tree->flags |= AF_LEFT_IGNORE;
}
-static void insRightIgnore( program_t *prg, tree_t *tree, tree_t *ignoreList )
+static void ins_right_ignore( program_t *prg, tree_t *tree, tree_t *ignore_list )
{
assert( ! (tree->flags & AF_RIGHT_IGNORE) );
/* Insert an ignore head in the child list. */
kid_t *kid = kid_allocate( prg );
- kid->tree = ignoreList;
- colm_tree_upref( ignoreList );
+ kid->tree = ignore_list;
+ colm_tree_upref( ignore_list );
/* Attach it. */
if ( tree->flags & AF_LEFT_IGNORE ) {
@@ -291,57 +291,57 @@ static void insRightIgnore( program_t *prg, tree_t *tree, tree_t *ignoreList )
tree->flags |= AF_RIGHT_IGNORE;
}
-tree_t *push_right_ignore( program_t *prg, tree_t *pushTo, tree_t *rightIgnore )
+tree_t *push_right_ignore( program_t *prg, tree_t *push_to, tree_t *right_ignore )
{
/* About to alter the data tree. Split first. */
- pushTo = splitTree( prg, pushTo );
+ push_to = split_tree( prg, push_to );
- if ( pushTo->flags & AF_RIGHT_IGNORE ) {
+ if ( push_to->flags & AF_RIGHT_IGNORE ) {
/* The previous token already has a right ignore. Merge by
* attaching it as a left ignore of the new list. */
- kid_t *curIgnore = treeRightIgnoreKid( prg, pushTo );
- insLeftIgnore( prg, rightIgnore, curIgnore->tree );
+ kid_t *cur_ignore = tree_right_ignore_kid( prg, push_to );
+ ins_left_ignore( prg, right_ignore, cur_ignore->tree );
/* Replace the current ignore. Safe to access refs here because we just
* upreffed it in insLeftIgnore. */
- curIgnore->tree->refs -= 1;
- curIgnore->tree = rightIgnore;
- colm_tree_upref( rightIgnore );
+ cur_ignore->tree->refs -= 1;
+ cur_ignore->tree = right_ignore;
+ colm_tree_upref( right_ignore );
}
else {
/* Attach The ignore list. */
- insRightIgnore( prg, pushTo, rightIgnore );
+ ins_right_ignore( prg, push_to, right_ignore );
}
- return pushTo;
+ return push_to;
}
-tree_t *push_left_ignore( program_t *prg, tree_t *pushTo, tree_t *leftIgnore )
+tree_t *push_left_ignore( program_t *prg, tree_t *push_to, tree_t *left_ignore )
{
- pushTo = splitTree( prg, pushTo );
+ push_to = split_tree( prg, push_to );
/* Attach as left ignore to the token we are sending. */
- if ( pushTo->flags & AF_LEFT_IGNORE ) {
+ if ( push_to->flags & AF_LEFT_IGNORE ) {
/* The token already has a left-ignore. Merge by attaching it as a
* right ignore of the new list. */
- kid_t *curIgnore = treeLeftIgnoreKid( prg, pushTo );
- insRightIgnore( prg, leftIgnore, curIgnore->tree );
+ kid_t *cur_ignore = tree_left_ignore_kid( prg, push_to );
+ ins_right_ignore( prg, left_ignore, cur_ignore->tree );
/* Replace the current ignore. Safe to upref here because we just
* upreffed it in insRightIgnore. */
- curIgnore->tree->refs -= 1;
- curIgnore->tree = leftIgnore;
- colm_tree_upref( leftIgnore );
+ cur_ignore->tree->refs -= 1;
+ cur_ignore->tree = left_ignore;
+ colm_tree_upref( left_ignore );
}
else {
/* Attach the ignore list. */
- insLeftIgnore( prg, pushTo, leftIgnore );
+ ins_left_ignore( prg, push_to, left_ignore );
}
- return pushTo;
+ return push_to;
}
-static void remLeftIgnore( program_t *prg, tree_t **sp, tree_t *tree )
+static void rem_left_ignore( program_t *prg, tree_t **sp, tree_t *tree )
{
assert( tree->flags & AF_LEFT_IGNORE );
@@ -353,7 +353,7 @@ static void remLeftIgnore( program_t *prg, tree_t **sp, tree_t *tree )
tree->flags &= ~AF_LEFT_IGNORE;
}
-static void remRightIgnore( program_t *prg, tree_t **sp, tree_t *tree )
+static void rem_right_ignore( program_t *prg, tree_t **sp, tree_t *tree )
{
assert( tree->flags & AF_RIGHT_IGNORE );
@@ -373,75 +373,75 @@ static void remRightIgnore( program_t *prg, tree_t **sp, tree_t *tree )
tree->flags &= ~AF_RIGHT_IGNORE;
}
-tree_t *popRightIgnore( program_t *prg, tree_t **sp, tree_t *popFrom, tree_t **rightIgnore )
+tree_t *pop_right_ignore( program_t *prg, tree_t **sp, tree_t *pop_from, tree_t **right_ignore )
{
/* Modifying the tree we are detaching from. */
- popFrom = splitTree( prg, popFrom );
+ pop_from = split_tree( prg, pop_from );
- kid_t *riKid = treeRightIgnoreKid( prg, popFrom );
+ kid_t *ri_kid = tree_right_ignore_kid( prg, pop_from );
/* If the right ignore has a left ignore, then that was the original
* right ignore. */
- kid_t *li = treeLeftIgnoreKid( prg, riKid->tree );
+ kid_t *li = tree_left_ignore_kid( prg, ri_kid->tree );
if ( li != 0 ) {
colm_tree_upref( li->tree );
- remLeftIgnore( prg, sp, riKid->tree );
- *rightIgnore = riKid->tree;
- colm_tree_upref( *rightIgnore );
- riKid->tree = li->tree;
+ rem_left_ignore( prg, sp, ri_kid->tree );
+ *right_ignore = ri_kid->tree;
+ colm_tree_upref( *right_ignore );
+ ri_kid->tree = li->tree;
}
else {
- *rightIgnore = riKid->tree;
- colm_tree_upref( *rightIgnore );
- remRightIgnore( prg, sp, popFrom );
+ *right_ignore = ri_kid->tree;
+ colm_tree_upref( *right_ignore );
+ rem_right_ignore( prg, sp, pop_from );
}
- return popFrom;
+ return pop_from;
}
-tree_t *popLeftIgnore( program_t *prg, tree_t **sp, tree_t *popFrom, tree_t **leftIgnore )
+tree_t *pop_left_ignore( program_t *prg, tree_t **sp, tree_t *pop_from, tree_t **left_ignore )
{
/* Modifying, make the write safe. */
- popFrom = splitTree( prg, popFrom );
+ pop_from = split_tree( prg, pop_from );
- kid_t *liKid = treeLeftIgnoreKid( prg, popFrom );
+ kid_t *li_kid = tree_left_ignore_kid( prg, pop_from );
/* If the left ignore has a right ignore, then that was the original
* left ignore. */
- kid_t *ri = treeRightIgnoreKid( prg, liKid->tree );
+ kid_t *ri = tree_right_ignore_kid( prg, li_kid->tree );
if ( ri != 0 ) {
colm_tree_upref( ri->tree );
- remRightIgnore( prg, sp, liKid->tree );
- *leftIgnore = liKid->tree;
- colm_tree_upref( *leftIgnore );
- liKid->tree = ri->tree;
+ rem_right_ignore( prg, sp, li_kid->tree );
+ *left_ignore = li_kid->tree;
+ colm_tree_upref( *left_ignore );
+ li_kid->tree = ri->tree;
}
else {
- *leftIgnore = liKid->tree;
- colm_tree_upref( *leftIgnore );
- remLeftIgnore( prg, sp, popFrom );
+ *left_ignore = li_kid->tree;
+ colm_tree_upref( *left_ignore );
+ rem_left_ignore( prg, sp, pop_from );
}
- return popFrom;
+ return pop_from;
}
-tree_t *colm_construct_object( program_t *prg, kid_t *kid, tree_t **bindings, long langElId )
+tree_t *colm_construct_object( program_t *prg, kid_t *kid, tree_t **bindings, long lang_el_id )
{
- struct lang_el_info *lelInfo = prg->rtd->lelInfo;
+ struct lang_el_info *lel_info = prg->rtd->lel_info;
tree_t *tree = 0;
tree = tree_allocate( prg );
- tree->id = langElId;
+ tree->id = lang_el_id;
tree->refs = 1;
tree->tokdata = 0;
tree->prod_num = 0;
- int objectLength = lelInfo[tree->id].objectLength;
+ int object_length = lel_info[tree->id].object_length;
- kid_t *attrs = allocAttrs( prg, objectLength );
+ kid_t *attrs = alloc_attrs( prg, object_length );
kid_t *child = 0;
- tree->child = kidListConcat( attrs, child );
+ tree->child = kid_list_concat( attrs, child );
return tree;
}
@@ -450,36 +450,36 @@ tree_t *colm_construct_object( program_t *prg, kid_t *kid, tree_t **bindings, lo
* return a zero-ref tree. */
tree_t *colm_construct_tree( program_t *prg, kid_t *kid, tree_t **bindings, long pat )
{
- struct pat_cons_node *nodes = prg->rtd->patReplNodes;
- struct lang_el_info *lelInfo = prg->rtd->lelInfo;
+ struct pat_cons_node *nodes = prg->rtd->pat_repl_nodes;
+ struct lang_el_info *lel_info = prg->rtd->lel_info;
tree_t *tree = 0;
- if ( nodes[pat].bindId > 0 ) {
+ if ( nodes[pat].bind_id > 0 ) {
/* All bindings have been uprefed. */
- tree = bindings[nodes[pat].bindId];
+ tree = bindings[nodes[pat].bind_id];
- long ignore = nodes[pat].leftIgnore;
- tree_t *leftIgnore = 0;
+ long ignore = nodes[pat].left_ignore;
+ tree_t *left_ignore = 0;
if ( ignore >= 0 ) {
- kid_t *ignore = constructLeftIgnoreList( prg, pat );
+ kid_t *ignore = construct_left_ignore_list( prg, pat );
- leftIgnore = tree_allocate( prg );
- leftIgnore->id = LEL_ID_IGNORE;
- leftIgnore->child = ignore;
+ left_ignore = tree_allocate( prg );
+ left_ignore->id = LEL_ID_IGNORE;
+ left_ignore->child = ignore;
- tree = push_left_ignore( prg, tree, leftIgnore );
+ tree = push_left_ignore( prg, tree, left_ignore );
}
- ignore = nodes[pat].rightIgnore;
- tree_t *rightIgnore = 0;
+ ignore = nodes[pat].right_ignore;
+ tree_t *right_ignore = 0;
if ( ignore >= 0 ) {
- kid_t *ignore = constructRightIgnoreList( prg, pat );
+ kid_t *ignore = construct_right_ignore_list( prg, pat );
- rightIgnore = tree_allocate( prg );
- rightIgnore->id = LEL_ID_IGNORE;
- rightIgnore->child = ignore;
+ right_ignore = tree_allocate( prg );
+ right_ignore->id = LEL_ID_IGNORE;
+ right_ignore->child = ignore;
- tree = push_right_ignore( prg, tree, rightIgnore );
+ tree = push_right_ignore( prg, tree, right_ignore );
}
}
else {
@@ -489,51 +489,51 @@ tree_t *colm_construct_tree( program_t *prg, kid_t *kid, tree_t **bindings, long
tree->tokdata = nodes[pat].length == 0 ? 0 :
colm_string_alloc_pointer( prg,
nodes[pat].data, nodes[pat].length );
- tree->prod_num = nodes[pat].prodNum;
+ tree->prod_num = nodes[pat].prod_num;
- int objectLength = lelInfo[tree->id].objectLength;
+ int object_length = lel_info[tree->id].object_length;
- kid_t *attrs = allocAttrs( prg, objectLength );
- kid_t *child = constructKid( prg, bindings,
+ kid_t *attrs = alloc_attrs( prg, object_length );
+ kid_t *child = construct_kid( prg, bindings,
0, nodes[pat].child );
- tree->child = kidListConcat( attrs, child );
+ tree->child = kid_list_concat( attrs, child );
/* Right first, then left. */
- kid_t *ignore = constructRightIgnoreList( prg, pat );
+ kid_t *ignore = construct_right_ignore_list( prg, pat );
if ( ignore != 0 ) {
- tree_t *ignoreList = tree_allocate( prg );
- ignoreList->id = LEL_ID_IGNORE;
- ignoreList->refs = 1;
- ignoreList->child = ignore;
+ tree_t *ignore_list = tree_allocate( prg );
+ ignore_list->id = LEL_ID_IGNORE;
+ ignore_list->refs = 1;
+ ignore_list->child = ignore;
- kid_t *ignoreHead = kid_allocate( prg );
- ignoreHead->tree = ignoreList;
- ignoreHead->next = tree->child;
- tree->child = ignoreHead;
+ kid_t *ignore_head = kid_allocate( prg );
+ ignore_head->tree = ignore_list;
+ ignore_head->next = tree->child;
+ tree->child = ignore_head;
tree->flags |= AF_RIGHT_IGNORE;
}
- ignore = constructLeftIgnoreList( prg, pat );
+ ignore = construct_left_ignore_list( prg, pat );
if ( ignore != 0 ) {
- tree_t *ignoreList = tree_allocate( prg );
- ignoreList->id = LEL_ID_IGNORE;
- ignoreList->refs = 1;
- ignoreList->child = ignore;
+ tree_t *ignore_list = tree_allocate( prg );
+ ignore_list->id = LEL_ID_IGNORE;
+ ignore_list->refs = 1;
+ ignore_list->child = ignore;
- kid_t *ignoreHead = kid_allocate( prg );
- ignoreHead->tree = ignoreList;
- ignoreHead->next = tree->child;
- tree->child = ignoreHead;
+ kid_t *ignore_head = kid_allocate( prg );
+ ignore_head->tree = ignore_list;
+ ignore_head->next = tree->child;
+ tree->child = ignore_head;
tree->flags |= AF_LEFT_IGNORE;
}
int i;
- for ( i = 0; i < lelInfo[tree->id].numCaptureAttr; i++ ) {
+ for ( i = 0; i < lel_info[tree->id].num_capture_attr; i++ ) {
long ci = pat+1+i;
- CaptureAttr *ca = prg->rtd->captureAttr + lelInfo[tree->id].captureAttr + i;
+ CaptureAttr *ca = prg->rtd->capture_attr + lel_info[tree->id].capture_attr + i;
tree_t *attr = tree_allocate( prg );
attr->id = nodes[ci].id;
attr->refs = 1;
@@ -548,9 +548,9 @@ tree_t *colm_construct_tree( program_t *prg, kid_t *kid, tree_t **bindings, long
return tree;
}
-kid_t *constructKid( program_t *prg, tree_t **bindings, kid_t *prev, long pat )
+kid_t *construct_kid( program_t *prg, tree_t **bindings, kid_t *prev, long pat )
{
- struct pat_cons_node *nodes = prg->rtd->patReplNodes;
+ struct pat_cons_node *nodes = prg->rtd->pat_repl_nodes;
kid_t *kid = 0;
if ( pat != -1 ) {
@@ -558,7 +558,7 @@ kid_t *constructKid( program_t *prg, tree_t **bindings, kid_t *prev, long pat )
kid->tree = colm_construct_tree( prg, kid, bindings, pat );
/* Recurse down next. */
- kid_t *next = constructKid( prg, bindings,
+ kid_t *next = construct_kid( prg, bindings,
kid, nodes[pat].next );
kid->next = next;
@@ -569,26 +569,26 @@ kid_t *constructKid( program_t *prg, tree_t **bindings, kid_t *prev, long pat )
tree_t *colm_construct_token( program_t *prg, tree_t **args, long nargs )
{
- value_t idInt = (value_t)args[0];
- str_t *textStr = (str_t*)args[1];
+ value_t id_int = (value_t)args[0];
+ str_t *text_str = (str_t*)args[1];
- long id = (long)idInt;
- head_t *tokdata = stringCopy( prg, textStr->value );
+ long id = (long)id_int;
+ head_t *tokdata = string_copy( prg, text_str->value );
- struct lang_el_info *lelInfo = prg->rtd->lelInfo;
+ struct lang_el_info *lel_info = prg->rtd->lel_info;
tree_t *tree;
- if ( lelInfo[id].ignore ) {
+ if ( lel_info[id].ignore ) {
tree = tree_allocate( prg );
tree->refs = 1;
tree->id = id;
tree->tokdata = tokdata;
}
else {
- long objectLength = lelInfo[id].objectLength;
- assert( nargs-2 <= objectLength );
+ long object_length = lel_info[id].object_length;
+ assert( nargs-2 <= object_length );
- kid_t *attrs = allocAttrs( prg, objectLength );
+ kid_t *attrs = alloc_attrs( prg, object_length );
tree = tree_allocate( prg );
tree->id = id;
@@ -606,25 +606,25 @@ tree_t *colm_construct_token( program_t *prg, tree_t **args, long nargs )
return tree;
}
-tree_t *castTree( program_t *prg, int langElId, tree_t *tree )
+tree_t *cast_tree( program_t *prg, int lang_el_id, tree_t *tree )
{
- struct lang_el_info *lelInfo = prg->rtd->lelInfo;
+ struct lang_el_info *lel_info = prg->rtd->lel_info;
/* Need to keep a lookout for next down. If
* copying it, return the copy. */
- tree_t *newTree = tree_allocate( prg );
+ tree_t *new_tree = tree_allocate( prg );
- newTree->id = langElId;
- newTree->tokdata = stringCopy( prg, tree->tokdata );
+ new_tree->id = lang_el_id;
+ new_tree->tokdata = string_copy( prg, tree->tokdata );
/* Invalidate the production number. */
- newTree->prod_num = -1;
+ new_tree->prod_num = -1;
/* Copy the child list. Start with ignores, then the list. */
kid_t *child = tree->child, *last = 0;
/* Flags we are interested in. */
- newTree->flags |= tree->flags & ( AF_LEFT_IGNORE | AF_RIGHT_IGNORE );
+ new_tree->flags |= tree->flags & ( AF_LEFT_IGNORE | AF_RIGHT_IGNORE );
int ignores = 0;
if ( tree->flags & AF_LEFT_IGNORE )
@@ -634,78 +634,78 @@ tree_t *castTree( program_t *prg, int langElId, tree_t *tree )
/* Igores. */
while ( ignores-- > 0 ) {
- kid_t *newKid = kid_allocate( prg );
+ kid_t *new_kid = kid_allocate( prg );
- newKid->tree = child->tree;
- newKid->next = 0;
- newKid->tree->refs += 1;
+ new_kid->tree = child->tree;
+ new_kid->next = 0;
+ new_kid->tree->refs += 1;
/* Store the first child. */
if ( last == 0 )
- newTree->child = newKid;
+ new_tree->child = new_kid;
else
- last->next = newKid;
+ last->next = new_kid;
child = child->next;
- last = newKid;
+ last = new_kid;
}
/* Skip over the source's attributes. */
- int objectLength = lelInfo[tree->id].objectLength;
- while ( objectLength-- > 0 )
+ int object_length = lel_info[tree->id].object_length;
+ while ( object_length-- > 0 )
child = child->next;
/* Allocate the target type's kids. */
- objectLength = lelInfo[langElId].objectLength;
- while ( objectLength-- > 0 ) {
- kid_t *newKid = kid_allocate( prg );
+ object_length = lel_info[lang_el_id].object_length;
+ while ( object_length-- > 0 ) {
+ kid_t *new_kid = kid_allocate( prg );
- newKid->tree = 0;
- newKid->next = 0;
+ new_kid->tree = 0;
+ new_kid->next = 0;
/* Store the first child. */
if ( last == 0 )
- newTree->child = newKid;
+ new_tree->child = new_kid;
else
- last->next = newKid;
+ last->next = new_kid;
- last = newKid;
+ last = new_kid;
}
/* Copy the source's children. */
while ( child != 0 ) {
- kid_t *newKid = kid_allocate( prg );
+ kid_t *new_kid = kid_allocate( prg );
- newKid->tree = child->tree;
- newKid->next = 0;
- newKid->tree->refs += 1;
+ new_kid->tree = child->tree;
+ new_kid->next = 0;
+ new_kid->tree->refs += 1;
/* Store the first child. */
if ( last == 0 )
- newTree->child = newKid;
+ new_tree->child = new_kid;
else
- last->next = newKid;
+ last->next = new_kid;
child = child->next;
- last = newKid;
+ last = new_kid;
}
- return newTree;
+ return new_tree;
}
-tree_t *makeTree( program_t *prg, tree_t **args, long nargs )
+tree_t *make_tree( program_t *prg, tree_t **args, long nargs )
{
- value_t idInt = (value_t)args[0];
+ value_t id_int = (value_t)args[0];
- long id = (long)idInt;
- struct lang_el_info *lelInfo = prg->rtd->lelInfo;
+ long id = (long)id_int;
+ struct lang_el_info *lel_info = prg->rtd->lel_info;
tree_t *tree = tree_allocate( prg );
tree->id = id;
tree->refs = 1;
- long objectLength = lelInfo[id].objectLength;
- kid_t *attrs = allocAttrs( prg, objectLength );
+ long object_length = lel_info[id].object_length;
+ kid_t *attrs = alloc_attrs( prg, object_length );
kid_t *last = 0, *child = 0;
for ( id = 1; id < nargs; id++ ) {
@@ -721,81 +721,81 @@ tree_t *makeTree( program_t *prg, tree_t **args, long nargs )
last = kid;
}
- tree->child = kidListConcat( attrs, child );
+ tree->child = kid_list_concat( attrs, child );
return tree;
}
-int testFalse( program_t *prg, tree_t *tree )
+int test_false( program_t *prg, tree_t *tree )
{
int flse = (
tree == 0 ||
- tree == prg->falseVal
+ tree == prg->false_val
);
return flse;
}
-kid_t *copyIgnoreList( program_t *prg, kid_t *ignoreHeader )
+kid_t *copy_ignore_list( program_t *prg, kid_t *ignore_header )
{
- kid_t *newHeader = kid_allocate( prg );
- kid_t *last = 0, *ic = (kid_t*)ignoreHeader->tree;
+ kid_t *new_header = kid_allocate( prg );
+ kid_t *last = 0, *ic = (kid_t*)ignore_header->tree;
while ( ic != 0 ) {
- kid_t *newIc = kid_allocate( prg );
+ kid_t *new_ic = kid_allocate( prg );
- newIc->tree = ic->tree;
- newIc->tree->refs += 1;
+ new_ic->tree = ic->tree;
+ new_ic->tree->refs += 1;
/* List pointers. */
if ( last == 0 )
- newHeader->tree = (tree_t*)newIc;
+ new_header->tree = (tree_t*)new_ic;
else
- last->next = newIc;
+ last->next = new_ic;
ic = ic->next;
- last = newIc;
+ last = new_ic;
}
- return newHeader;
+ return new_header;
}
-kid_t *copyKidList( program_t *prg, kid_t *kidList )
+kid_t *copy_kid_list( program_t *prg, kid_t *kid_list )
{
- kid_t *newList = 0, *last = 0, *ic = kidList;
+ kid_t *new_list = 0, *last = 0, *ic = kid_list;
while ( ic != 0 ) {
- kid_t *newIc = kid_allocate( prg );
+ kid_t *new_ic = kid_allocate( prg );
- newIc->tree = ic->tree;
- colm_tree_upref( newIc->tree );
+ new_ic->tree = ic->tree;
+ colm_tree_upref( new_ic->tree );
/* List pointers. */
if ( last == 0 )
- newList = newIc;
+ new_list = new_ic;
else
- last->next = newIc;
+ last->next = new_ic;
ic = ic->next;
- last = newIc;
+ last = new_ic;
}
- return newList;
+ return new_list;
}
/* New tree has zero ref. */
-tree_t *copyRealTree( program_t *prg, tree_t *tree, kid_t *oldNextDown, kid_t **newNextDown )
+tree_t *copy_real_tree( program_t *prg, tree_t *tree, kid_t *old_next_down, kid_t **new_next_down )
{
/* Need to keep a lookout for next down. If
* copying it, return the copy. */
- tree_t *newTree = tree_allocate( prg );
+ tree_t *new_tree = tree_allocate( prg );
- newTree->id = tree->id;
- newTree->tokdata = stringCopy( prg, tree->tokdata );
- newTree->prod_num = tree->prod_num;
+ new_tree->id = tree->id;
+ new_tree->tokdata = string_copy( prg, tree->tokdata );
+ new_tree->prod_num = tree->prod_num;
/* Copy the child list. Start with ignores, then the list. */
kid_t *child = tree->child, *last = 0;
/* Left ignores. */
if ( tree->flags & AF_LEFT_IGNORE ) {
- newTree->flags |= AF_LEFT_IGNORE;
+ new_tree->flags |= AF_LEFT_IGNORE;
// kid_t *newHeader = copyIgnoreList( prg, child );
//
// /* Always the head. */
@@ -807,7 +807,7 @@ tree_t *copyRealTree( program_t *prg, tree_t *tree, kid_t *oldNextDown, kid_t **
/* Right ignores. */
if ( tree->flags & AF_RIGHT_IGNORE ) {
- newTree->flags |= AF_RIGHT_IGNORE;
+ new_tree->flags |= AF_RIGHT_IGNORE;
// kid_t *newHeader = copyIgnoreList( prg, child );
// if ( last == 0 )
// newTree->child = newHeader;
@@ -819,34 +819,34 @@ tree_t *copyRealTree( program_t *prg, tree_t *tree, kid_t *oldNextDown, kid_t **
/* Attributes and children. */
while ( child != 0 ) {
- kid_t *newKid = kid_allocate( prg );
+ kid_t *new_kid = kid_allocate( prg );
/* Watch out for next down. */
- if ( child == oldNextDown )
- *newNextDown = newKid;
+ if ( child == old_next_down )
+ *new_next_down = new_kid;
- newKid->tree = child->tree;
- newKid->next = 0;
+ new_kid->tree = child->tree;
+ new_kid->next = 0;
/* May be an attribute. */
- if ( newKid->tree != 0 )
- newKid->tree->refs += 1;
+ if ( new_kid->tree != 0 )
+ new_kid->tree->refs += 1;
/* Store the first child. */
if ( last == 0 )
- newTree->child = newKid;
+ new_tree->child = new_kid;
else
- last->next = newKid;
+ last->next = new_kid;
child = child->next;
- last = newKid;
+ last = new_kid;
}
- return newTree;
+ return new_tree;
}
-tree_t *colm_copy_tree( program_t *prg, tree_t *tree, kid_t *oldNextDown, kid_t **newNextDown )
+tree_t *colm_copy_tree( program_t *prg, tree_t *tree, kid_t *old_next_down, kid_t **new_next_down )
{
// struct lang_el_info *lelInfo = prg->rtd->lelInfo;
// long genericId = lelInfo[tree->id].genericId;
@@ -863,28 +863,28 @@ tree_t *colm_copy_tree( program_t *prg, tree_t *tree, kid_t *oldNextDown, kid_t
// else if ( tree->id == LEL_ID_STREAM )
// assert(false);
else {
- tree = copyRealTree( prg, tree, oldNextDown, newNextDown );
+ tree = copy_real_tree( prg, tree, old_next_down, new_next_down );
}
assert( tree->refs == 0 );
return tree;
}
-tree_t *splitTree( program_t *prg, tree_t *tree )
+tree_t *split_tree( program_t *prg, tree_t *tree )
{
if ( tree != 0 ) {
assert( tree->refs >= 1 );
if ( tree->refs > 1 ) {
- kid_t *oldNextDown = 0, *newNextDown = 0;
- tree_t *newTree = colm_copy_tree( prg, tree, oldNextDown, &newNextDown );
- colm_tree_upref( newTree );
+ kid_t *old_next_down = 0, *new_next_down = 0;
+ tree_t *new_tree = colm_copy_tree( prg, tree, old_next_down, &new_next_down );
+ colm_tree_upref( new_tree );
/* Downref the original. Don't need to consider freeing because
* refs were > 1. */
tree->refs -= 1;
- tree = newTree;
+ tree = new_tree;
}
assert( tree->refs == 1 );
@@ -894,7 +894,7 @@ tree_t *splitTree( program_t *prg, tree_t *tree )
/* We can't make recursive calls here since the tree we are freeing may be
* very large. Need the VM stack. */
-void treeFreeRec( program_t *prg, tree_t **sp, tree_t *tree )
+void tree_free_rec( program_t *prg, tree_t **sp, tree_t *tree )
{
tree_t **top = vm_ptop();
// struct lang_el_info *lelInfo;
@@ -913,13 +913,13 @@ free_tree:
break;
case LEL_ID_STR: {
str_t *str = (str_t*) tree;
- stringFree( prg, str->value );
+ string_free( prg, str->value );
tree_free( prg, tree );
break;
}
default: {
if ( tree->id != LEL_ID_IGNORE )
- stringFree( prg, tree->tokdata );
+ string_free( prg, tree->tokdata );
/* Attributes and grammar-based children. */
kid_t *child = tree->child;
@@ -958,13 +958,13 @@ void colm_tree_downref( program_t *prg, tree_t **sp, tree_t *tree )
assert( tree->refs > 0 );
tree->refs -= 1;
if ( tree->refs == 0 )
- treeFreeRec( prg, sp, tree );
+ tree_free_rec( prg, sp, tree );
}
}
/* We can't make recursive calls here since the tree we are freeing may be
* very large. Need the VM stack. */
-void objectFreeRec( program_t *prg, tree_t **sp, tree_t *tree )
+void object_free_rec( program_t *prg, tree_t **sp, tree_t *tree )
{
tree_t **top = vm_ptop();
// struct lang_el_info *lelInfo;
@@ -976,7 +976,7 @@ free_tree:
switch ( tree->id ) {
case LEL_ID_STR: {
str_t *str = (str_t*) tree;
- stringFree( prg, str->value );
+ string_free( prg, str->value );
tree_free( prg, tree );
break;
}
@@ -993,7 +993,7 @@ free_tree:
// }
default: {
if ( tree->id != LEL_ID_IGNORE )
- stringFree( prg, tree->tokdata );
+ string_free( prg, tree->tokdata );
/* Attributes and grammar-based children. */
kid_t *child = tree->child;
@@ -1020,20 +1020,20 @@ free_tree:
}
}
-void objectDownref( program_t *prg, tree_t **sp, tree_t *tree )
+void object_downref( program_t *prg, tree_t **sp, tree_t *tree )
{
if ( tree != 0 ) {
assert( tree->refs > 0 );
tree->refs -= 1;
if ( tree->refs == 0 )
- objectFreeRec( prg, sp, tree );
+ object_free_rec( prg, sp, tree );
}
}
/* Find the first child of a tree. */
-kid_t *treeChild( program_t *prg, const tree_t *tree )
+kid_t *tree_child( program_t *prg, const tree_t *tree )
{
- struct lang_el_info *lelInfo = prg->rtd->lelInfo;
+ struct lang_el_info *lel_info = prg->rtd->lel_info;
kid_t *kid = tree->child;
if ( tree->flags & AF_LEFT_IGNORE )
@@ -1042,18 +1042,18 @@ kid_t *treeChild( program_t *prg, const tree_t *tree )
kid = kid->next;
/* Skip over attributes. */
- long objectLength = lelInfo[tree->id].objectLength;
+ long object_length = lel_info[tree->id].object_length;
long a;
- for ( a = 0; a < objectLength; a++ )
+ for ( a = 0; a < object_length; a++ )
kid = kid->next;
return kid;
}
/* Detach at the first real child of a tree. */
-kid_t *treeExtractChild( program_t *prg, tree_t *tree )
+kid_t *tree_extract_child( program_t *prg, tree_t *tree )
{
- struct lang_el_info *lelInfo = prg->rtd->lelInfo;
+ struct lang_el_info *lel_info = prg->rtd->lel_info;
kid_t *kid = tree->child, *last = 0;
if ( tree->flags & AF_LEFT_IGNORE )
@@ -1062,8 +1062,8 @@ kid_t *treeExtractChild( program_t *prg, tree_t *tree )
kid = kid->next;
/* Skip over attributes. */
- long a, objectLength = lelInfo[tree->id].objectLength;
- for ( a = 0; a < objectLength; a++ ) {
+ long a, object_length = lel_info[tree->id].object_length;
+ for ( a = 0; a < object_length; a++ ) {
last = kid;
kid = kid->next;
}
@@ -1078,7 +1078,7 @@ kid_t *treeExtractChild( program_t *prg, tree_t *tree )
/* Find the first child of a tree. */
-kid_t *treeAttr( program_t *prg, const tree_t *tree )
+kid_t *tree_attr( program_t *prg, const tree_t *tree )
{
kid_t *kid = tree->child;
@@ -1090,14 +1090,14 @@ kid_t *treeAttr( program_t *prg, const tree_t *tree )
return kid;
}
-tree_t *treeLeftIgnore( program_t *prg, tree_t *tree )
+tree_t *tree_left_ignore( program_t *prg, tree_t *tree )
{
if ( tree->flags & AF_LEFT_IGNORE )
return tree->child->tree;
return 0;
}
-tree_t *treeRightIgnore( program_t *prg, tree_t *tree )
+tree_t *tree_right_ignore( program_t *prg, tree_t *tree )
{
if ( tree->flags & AF_RIGHT_IGNORE ) {
if ( tree->flags & AF_LEFT_IGNORE )
@@ -1108,14 +1108,14 @@ tree_t *treeRightIgnore( program_t *prg, tree_t *tree )
return 0;
}
-kid_t *treeLeftIgnoreKid( program_t *prg, tree_t *tree )
+kid_t *tree_left_ignore_kid( program_t *prg, tree_t *tree )
{
if ( tree->flags & AF_LEFT_IGNORE )
return tree->child;
return 0;
}
-kid_t *treeRightIgnoreKid( program_t *prg, tree_t *tree )
+kid_t *tree_right_ignore_kid( program_t *prg, tree_t *tree )
{
if ( tree->flags & AF_RIGHT_IGNORE ) {
if ( tree->flags & AF_LEFT_IGNORE )
@@ -1126,15 +1126,15 @@ kid_t *treeRightIgnoreKid( program_t *prg, tree_t *tree )
return 0;
}
-void refSetValue( program_t *prg, tree_t **sp, ref_t *ref, tree_t *v )
+void ref_set_value( program_t *prg, tree_t **sp, ref_t *ref, tree_t *v )
{
colm_tree_downref( prg, sp, ref->kid->tree );
ref->kid->tree = v;
}
-tree_t *getRhsEl( program_t *prg, tree_t *lhs, long position )
+tree_t *get_rhs_el( program_t *prg, tree_t *lhs, long position )
{
- kid_t *pos = treeChild( prg, lhs );
+ kid_t *pos = tree_child( prg, lhs );
while ( position > 0 ) {
pos = pos->next;
position -= 1;
@@ -1142,9 +1142,9 @@ tree_t *getRhsEl( program_t *prg, tree_t *lhs, long position )
return pos->tree;
}
-kid_t *getRhsElKid( program_t *prg, tree_t *lhs, long position )
+kid_t *get_rhs_el_kid( program_t *prg, tree_t *lhs, long position )
{
- kid_t *pos = treeChild( prg, lhs );
+ kid_t *pos = tree_child( prg, lhs );
while ( position > 0 ) {
pos = pos->next;
position -= 1;
@@ -1158,9 +1158,9 @@ tree_t *colm_get_rhs_val( program_t *prg, tree_t *tree, int *a )
int i, len = a[0];
for ( i = 0; i < len; i++ ) {
int prod_num = a[1 + i * 2];
- int childNum = a[1 + i * 2 + 1];
+ int child_num = a[1 + i * 2 + 1];
if ( tree->prod_num == prod_num )
- return getRhsEl( prg, tree, childNum );
+ return get_rhs_el( prg, tree, child_num );
}
return 0;
}
@@ -1178,24 +1178,24 @@ tree_t *colm_tree_get_field( tree_t *tree, word_t field )
return colm_get_attr( tree, field );
}
-kid_t *getFieldKid( tree_t *tree, word_t field )
+kid_t *get_field_kid( tree_t *tree, word_t field )
{
- return getAttrKid( tree, field );
+ return get_attr_kid( tree, field );
}
-tree_t *getFieldSplit( program_t *prg, tree_t *tree, word_t field )
+tree_t *get_field_split( program_t *prg, tree_t *tree, word_t field )
{
tree_t *val = colm_get_attr( tree, field );
- tree_t *split = splitTree( prg, val );
+ tree_t *split = split_tree( prg, val );
colm_tree_set_attr( tree, field, split );
return split;
}
/* This must traverse in the same order that the bindId assignments are done
* in. */
-int matchPattern( tree_t **bindings, program_t *prg, long pat, kid_t *kid, int checkNext )
+int match_pattern( tree_t **bindings, program_t *prg, long pat, kid_t *kid, int check_next )
{
- struct pat_cons_node *nodes = prg->rtd->patReplNodes;
+ struct pat_cons_node *nodes = prg->rtd->pat_repl_nodes;
/* match node, recurse on children. */
if ( pat != -1 && kid != 0 ) {
@@ -1204,35 +1204,35 @@ int matchPattern( tree_t **bindings, program_t *prg, long pat, kid_t *kid, int c
* the data against the token data. */
if ( nodes[pat].data != 0 ) {
/* Check the length of token text. */
- if ( nodes[pat].length != stringLength( kid->tree->tokdata ) )
+ if ( nodes[pat].length != string_length( kid->tree->tokdata ) )
return false;
/* Check the token text data. */
if ( nodes[pat].length > 0 && memcmp( nodes[pat].data,
- stringData( kid->tree->tokdata ), nodes[pat].length ) != 0 )
+ string_data( kid->tree->tokdata ), nodes[pat].length ) != 0 )
return false;
}
/* No failure, all okay. */
- if ( nodes[pat].bindId > 0 ) {
- bindings[nodes[pat].bindId] = kid->tree;
+ if ( nodes[pat].bind_id > 0 ) {
+ bindings[nodes[pat].bind_id] = kid->tree;
}
/* If we didn't match a terminal duplicate of a nonterm then check
* down the children. */
if ( !nodes[pat].stop ) {
/* Check for failure down child branch. */
- int childCheck = matchPattern( bindings, prg,
- nodes[pat].child, treeChild( prg, kid->tree ), true );
- if ( ! childCheck )
+ int child_check = match_pattern( bindings, prg,
+ nodes[pat].child, tree_child( prg, kid->tree ), true );
+ if ( ! child_check )
return false;
}
/* If checking next, then look for failure there. */
- if ( checkNext ) {
- int nextCheck = matchPattern( bindings, prg,
+ if ( check_next ) {
+ int next_check = match_pattern( bindings, prg,
nodes[pat].next, kid->next, true );
- if ( ! nextCheck )
+ if ( ! next_check )
return false;
}
@@ -1270,7 +1270,7 @@ long colm_cmp_tree( program_t *prg, const tree_t *tree1, const tree_t *tree2 )
return 1;
}
else if ( tree1->id == LEL_ID_STR ) {
- cmpres = cmpString( ((str_t*)tree1)->value, ((str_t*)tree2)->value );
+ cmpres = cmp_string( ((str_t*)tree1)->value, ((str_t*)tree2)->value );
if ( cmpres != 0 )
return cmpres;
}
@@ -1280,14 +1280,14 @@ long colm_cmp_tree( program_t *prg, const tree_t *tree1, const tree_t *tree2 )
else if ( tree1->tokdata != 0 && tree2->tokdata == 0 )
return 1;
else if ( tree1->tokdata != 0 && tree2->tokdata != 0 ) {
- cmpres = cmpString( tree1->tokdata, tree2->tokdata );
+ cmpres = cmp_string( tree1->tokdata, tree2->tokdata );
if ( cmpres != 0 )
return cmpres;
}
}
- kid_t *kid1 = treeChild( prg, tree1 );
- kid_t *kid2 = treeChild( prg, tree2 );
+ kid_t *kid1 = tree_child( prg, tree1 );
+ kid_t *kid2 = tree_child( prg, tree2 );
while ( true ) {
if ( kid1 == 0 && kid2 == 0 )
@@ -1307,10 +1307,10 @@ long colm_cmp_tree( program_t *prg, const tree_t *tree1, const tree_t *tree2 )
}
-void splitRef( program_t *prg, tree_t ***psp, ref_t *fromRef )
+void split_ref( program_t *prg, tree_t ***psp, ref_t *from_ref )
{
/* Go up the chain of kids, turing the pointers down. */
- ref_t *last = 0, *ref = fromRef, *next = 0;
+ ref_t *last = 0, *ref = from_ref, *next = 0;
while ( ref->next != 0 ) {
next = ref->next;
ref->next = last;
@@ -1322,33 +1322,33 @@ void splitRef( program_t *prg, tree_t ***psp, ref_t *fromRef )
/* Now traverse the list, which goes down. */
while ( ref != 0 ) {
if ( ref->kid->tree->refs > 1 ) {
- ref_t *nextDown = ref->next;
- while ( nextDown != 0 && nextDown->kid == ref->kid )
- nextDown = nextDown->next;
+ ref_t *next_down = ref->next;
+ while ( next_down != 0 && next_down->kid == ref->kid )
+ next_down = next_down->next;
- kid_t *oldNextKidDown = nextDown != 0 ? nextDown->kid : 0;
- kid_t *newNextKidDown = 0;
+ kid_t *old_next_kid_down = next_down != 0 ? next_down->kid : 0;
+ kid_t *new_next_kid_down = 0;
- tree_t *newTree = colm_copy_tree( prg, ref->kid->tree,
- oldNextKidDown, &newNextKidDown );
- colm_tree_upref( newTree );
+ tree_t *new_tree = colm_copy_tree( prg, ref->kid->tree,
+ old_next_kid_down, &new_next_kid_down );
+ colm_tree_upref( new_tree );
/* Downref the original. Don't need to consider freeing because
* refs were > 1. */
ref->kid->tree->refs -= 1;
- while ( ref != 0 && ref != nextDown ) {
+ while ( ref != 0 && ref != next_down ) {
next = ref->next;
ref->next = 0;
- ref->kid->tree = newTree;
+ ref->kid->tree = new_tree;
ref = next;
}
/* Correct kid pointers down from ref. */
- while ( nextDown != 0 && nextDown->kid == oldNextKidDown ) {
- nextDown->kid = newNextKidDown;
- nextDown = nextDown->next;
+ while ( next_down != 0 && next_down->kid == old_next_kid_down ) {
+ next_down->kid = new_next_kid_down;
+ next_down = next_down->next;
}
}
else {
@@ -1360,7 +1360,7 @@ void splitRef( program_t *prg, tree_t ***psp, ref_t *fromRef )
}
}
-tree_t *setListMem( list_t *list, half_t field, tree_t *value )
+tree_t *set_list_mem( list_t *list, half_t field, tree_t *value )
{
if ( value != 0 )
assert( value->refs >= 1 );
@@ -1382,13 +1382,13 @@ tree_t *setListMem( list_t *list, half_t field, tree_t *value )
return existing;
}
-struct tree_pair mapRemove( program_t *prg, map_t *map, tree_t *key )
+struct tree_pair map_remove( program_t *prg, map_t *map, tree_t *key )
{
- map_el_t *mapEl = mapImplFind( prg, map, key );
+ map_el_t *map_el = map_impl_find( prg, map, key );
struct tree_pair result = { 0, 0 };
- if ( mapEl != 0 ) {
- mapDetach( prg, map, mapEl );
- result.key = mapEl->key;
+ if ( map_el != 0 ) {
+ map_detach( prg, map, map_el );
+ result.key = map_el->key;
//mapElFree( prg, mapEl );
}
@@ -1396,16 +1396,16 @@ struct tree_pair mapRemove( program_t *prg, map_t *map, tree_t *key )
}
#if 0
-tree_t *mapUnstore( program_t *prg, map_t *map, tree_t *key, tree_t *existing )
+tree_t *map_unstore( program_t *prg, map_t *map, tree_t *key, tree_t *existing )
{
tree_t *stored = 0;
if ( existing == 0 ) {
- map_el_t *mapEl = mapDetachByKey( prg, map, key );
+ map_el_t *map_el = map_detach_by_key( prg, map, key );
// stored = mapEl->tree;
- mapElFree( prg, mapEl );
+ map_el_free( prg, map_el );
}
else {
- map_el_t *mapEl = mapImplFind( prg, map, key );
+ map_el_t *map_el = map_impl_find( prg, map, key );
// stored = mapEl->tree;
//mapEl->tree = existing;
}
@@ -1413,19 +1413,19 @@ tree_t *mapUnstore( program_t *prg, map_t *map, tree_t *key, tree_t *existing )
}
#endif
-tree_t *mapFind( program_t *prg, map_t *map, tree_t *key )
+tree_t *map_find( program_t *prg, map_t *map, tree_t *key )
{
// map_el_t *mapEl = mapImplFind( prg, map, key );
// return mapEl == 0 ? 0 : mapEl->tree;
return 0;
}
-long mapLength( map_t *map )
+long map_length( map_t *map )
{
- return map->treeSize;
+ return map->tree_size;
}
-void listPushTail( program_t *prg, list_t *list, tree_t *val )
+void list_push_tail( program_t *prg, list_t *list, tree_t *val )
{
// if ( val != 0 )
// assert( val->refs >= 1 );
@@ -1434,7 +1434,7 @@ void listPushTail( program_t *prg, list_t *list, tree_t *val )
// listAppend( list, listEl );
}
-void listPushHead( program_t *prg, list_t *list, tree_t *val )
+void list_push_head( program_t *prg, list_t *list, tree_t *val )
{
// if ( val != 0 )
// assert( val->refs >= 1 );
@@ -1443,7 +1443,7 @@ void listPushHead( program_t *prg, list_t *list, tree_t *val )
// listPrepend( list, listEl );
}
-tree_t *listRemoveEnd( program_t *prg, list_t *list )
+tree_t *list_remove_end( program_t *prg, list_t *list )
{
// tree_t *tree = list->tail->value;
// listElFree( prg, listDetachLast( list ) );
@@ -1451,7 +1451,7 @@ tree_t *listRemoveEnd( program_t *prg, list_t *list )
return 0;
}
-tree_t *listRemoveHead( program_t *prg, list_t *list )
+tree_t *list_remove_head( program_t *prg, list_t *list )
{
// tree_t *tree = list->head;
// listDetachFirst( list );
@@ -1459,7 +1459,7 @@ tree_t *listRemoveHead( program_t *prg, list_t *list )
return 0;
}
-tree_t *getParserMem( parser_t *parser, word_t field )
+tree_t *get_parser_mem( parser_t *parser, word_t field )
{
tree_t *result = 0;
switch ( field ) {
@@ -1468,8 +1468,8 @@ tree_t *getParserMem( parser_t *parser, word_t field )
break;
}
case 1: {
- struct pda_run *pdaRun = parser->pdaRun;
- result = pdaRun->parseErrorText;
+ struct pda_run *pda_run = parser->pda_run;
+ result = pda_run->parse_error_text;
break;
}
default: {
@@ -1480,7 +1480,7 @@ tree_t *getParserMem( parser_t *parser, word_t field )
return result;
}
-tree_t *getListMemSplit( program_t *prg, list_t *list, word_t field )
+tree_t *get_list_mem_split( program_t *prg, list_t *list, word_t field )
{
tree_t *sv = 0;
switch ( field ) {
@@ -1501,11 +1501,11 @@ tree_t *getListMemSplit( program_t *prg, list_t *list, word_t field )
#if 0
-int mapInsert( program_t *prg, map_t *map, tree_t *key, tree_t *element )
+int map_insert( program_t *prg, map_t *map, tree_t *key, tree_t *element )
{
- map_el_t *mapEl = mapInsertKey( prg, map, key, 0 );
+ map_el_t *map_el = map_insert_key( prg, map, key, 0 );
- if ( mapEl != 0 ) {
+ if ( map_el != 0 ) {
//mapEl->tree = element;
return true;
}
@@ -1515,31 +1515,31 @@ int mapInsert( program_t *prg, map_t *map, tree_t *key, tree_t *element )
#endif
#if 0
-void mapUnremove( program_t *prg, map_t *map, tree_t *key, tree_t *element )
+void map_unremove( program_t *prg, map_t *map, tree_t *key, tree_t *element )
{
- map_el_t *mapEl = mapInsertKey( prg, map, key, 0 );
- assert( mapEl != 0 );
+ map_el_t *map_el = map_insert_key( prg, map, key, 0 );
+ assert( map_el != 0 );
//mapEl->tree = element;
}
#endif
#if 0
-tree_t *mapUninsert( program_t *prg, map_t *map, tree_t *key )
+tree_t *map_uninsert( program_t *prg, map_t *map, tree_t *key )
{
- map_el_t *el = mapDetachByKey( prg, map, key );
+ map_el_t *el = map_detach_by_key( prg, map, key );
// tree_t *val = el->tree;
- mapElFree( prg, el );
+ map_el_free( prg, el );
// return val;
return 0;
}
#endif
#if 0
-tree_t *mapStore( program_t *prg, map_t *map, tree_t *key, tree_t *element )
+tree_t *map_store( program_t *prg, map_t *map, tree_t *key, tree_t *element )
{
- tree_t *oldTree = 0;
- map_el_t *elInTree = 0;
- map_el_t *mapEl = mapInsertKey( prg, map, key, &elInTree );
+ tree_t *old_tree = 0;
+ map_el_t *el_in_tree = 0;
+ map_el_t *map_el = map_insert_key( prg, map, key, &el_in_tree );
// if ( mapEl != 0 )
// mapEl->tree = element;
@@ -1549,11 +1549,11 @@ tree_t *mapStore( program_t *prg, map_t *map, tree_t *key, tree_t *element )
// elInTree->tree = element;
// }
- return oldTree;
+ return old_tree;
}
#endif
-static tree_t *treeSearchKid( program_t *prg, kid_t *kid, long id )
+static tree_t *tree_search_kid( program_t *prg, kid_t *kid, long id )
{
/* This node the one? */
if ( kid->tree->id == id )
@@ -1562,31 +1562,31 @@ static tree_t *treeSearchKid( program_t *prg, kid_t *kid, long id )
tree_t *res = 0;
/* Search children. */
- kid_t *child = treeChild( prg, kid->tree );
+ kid_t *child = tree_child( prg, kid->tree );
if ( child != 0 )
- res = treeSearchKid( prg, child, id );
+ res = tree_search_kid( prg, child, id );
/* Search siblings. */
if ( res == 0 && kid->next != 0 )
- res = treeSearchKid( prg, kid->next, id );
+ res = tree_search_kid( prg, kid->next, id );
return res;
}
-tree_t *treeSearch( program_t *prg, tree_t *tree, long id )
+tree_t *tree_search( program_t *prg, tree_t *tree, long id )
{
tree_t *res = 0;
if ( tree->id == id )
res = tree;
else {
- kid_t *child = treeChild( prg, tree );
+ kid_t *child = tree_child( prg, tree );
if ( child != 0 )
- res = treeSearchKid( prg, child, id );
+ res = tree_search_kid( prg, child, id );
}
return res;
}
-static location_t *locSearchKid( program_t *prg, kid_t *kid )
+static location_t *loc_search_kid( program_t *prg, kid_t *kid )
{
/* This node the one? */
if ( kid->tree->tokdata != 0 && kid->tree->tokdata->location != 0 )
@@ -1595,108 +1595,108 @@ static location_t *locSearchKid( program_t *prg, kid_t *kid )
location_t *res = 0;
/* Search children. */
- kid_t *child = treeChild( prg, kid->tree );
+ kid_t *child = tree_child( prg, kid->tree );
if ( child != 0 )
- res = locSearchKid( prg, child );
+ res = loc_search_kid( prg, child );
/* Search siblings. */
if ( res == 0 && kid->next != 0 )
- res = locSearchKid( prg, kid->next );
+ res = loc_search_kid( prg, kid->next );
return res;
}
-location_t *locSearch( program_t *prg, tree_t *tree )
+location_t *loc_search( program_t *prg, tree_t *tree )
{
location_t *res = 0;
if ( tree->tokdata != 0 && tree->tokdata->location != 0 )
return tree->tokdata->location;
- kid_t *child = treeChild( prg, tree );
+ kid_t *child = tree_child( prg, tree );
if ( child != 0 )
- res = locSearchKid( prg, child );
+ res = loc_search_kid( prg, child );
return res;
}
struct colm_location *colm_find_location( program_t *prg, tree_t *tree )
{
- return locSearch( prg, tree );
+ return loc_search( prg, tree );
}
/*
* tree_t Printing
*/
-void xmlEscapeData( struct colm_print_args *printArgs, const char *data, long len )
+void xml_escape_data( struct colm_print_args *print_args, const char *data, long len )
{
int i;
for ( i = 0; i < len; i++ ) {
if ( data[i] == '<' )
- printArgs->out( printArgs, "&lt;", 4 );
+ print_args->out( print_args, "&lt;", 4 );
else if ( data[i] == '>' )
- printArgs->out( printArgs, "&gt;", 4 );
+ print_args->out( print_args, "&gt;", 4 );
else if ( data[i] == '&' )
- printArgs->out( printArgs, "&amp;", 5 );
+ print_args->out( print_args, "&amp;", 5 );
else if ( (32 <= data[i] && data[i] <= 126) ||
data[i] == '\t' || data[i] == '\n' || data[i] == '\r' )
{
- printArgs->out( printArgs, &data[i], 1 );
+ print_args->out( print_args, &data[i], 1 );
}
else {
char out[64];
sprintf( out, "&#%u;", ((unsigned)data[i]) );
- printArgs->out( printArgs, out, strlen(out) );
+ print_args->out( print_args, out, strlen(out) );
}
}
}
-void initStrCollect( StrCollect *collect )
+void init_str_collect( StrCollect *collect )
{
collect->data = (char*) malloc( BUFFER_INITIAL_SIZE );
collect->allocated = BUFFER_INITIAL_SIZE;
collect->length = 0;
}
-void strCollectDestroy( StrCollect *collect )
+void str_collect_destroy( StrCollect *collect )
{
free( collect->data );
}
-void strCollectAppend( StrCollect *collect, const char *data, long len )
+void str_collect_append( StrCollect *collect, const char *data, long len )
{
- long newLen = collect->length + len;
- if ( newLen > collect->allocated ) {
- collect->allocated = newLen * 2;
+ long new_len = collect->length + len;
+ if ( new_len > collect->allocated ) {
+ collect->allocated = new_len * 2;
collect->data = (char*) realloc( collect->data, collect->allocated );
}
memcpy( collect->data + collect->length, data, len );
collect->length += len;
}
-void strCollectClear( StrCollect *collect )
+void str_collect_clear( StrCollect *collect )
{
collect->length = 0;
}
#define INT_SZ 32
-void printStr( struct colm_print_args *printArgs, head_t *str )
+void print_str( struct colm_print_args *print_args, head_t *str )
{
- printArgs->out( printArgs, (char*)(str->data), str->length );
+ print_args->out( print_args, (char*)(str->data), str->length );
}
-void appendCollect( struct colm_print_args *args, const char *data, int length )
+void append_collect( struct colm_print_args *args, const char *data, int length )
{
- strCollectAppend( (StrCollect*) args->arg, data, length );
+ str_collect_append( (StrCollect*) args->arg, data, length );
}
-void appendFile( struct colm_print_args *args, const char *data, int length )
+void append_file( struct colm_print_args *args, const char *data, int length )
{
fwrite( data, 1, length, (FILE*)args->arg );
}
-void appendFd( struct colm_print_args *args, const char *data, int length )
+void append_fd( struct colm_print_args *args, const char *data, int length )
{
int fd = (long)args->arg;
int res = write( fd, data, length );
@@ -1704,27 +1704,27 @@ void appendFd( struct colm_print_args *args, const char *data, int length )
message( "write error on fd: %d: %s\n", fd, strerror(errno) );
}
-tree_t *treeTrim( struct colm_program *prg, tree_t **sp, tree_t *tree )
+tree_t *tree_trim( struct colm_program *prg, tree_t **sp, tree_t *tree )
{
debug( prg, REALM_PARSE, "attaching left ignore\n" );
/* Make the ignore list for the left-ignore. */
- tree_t *leftIgnore = tree_allocate( prg );
- leftIgnore->id = LEL_ID_IGNORE;
- leftIgnore->flags |= AF_SUPPRESS_RIGHT;
+ tree_t *left_ignore = tree_allocate( prg );
+ left_ignore->id = LEL_ID_IGNORE;
+ left_ignore->flags |= AF_SUPPRESS_RIGHT;
- tree = push_left_ignore( prg, tree, leftIgnore );
+ tree = push_left_ignore( prg, tree, left_ignore );
debug( prg, REALM_PARSE, "attaching ignore right\n" );
/* Copy the ignore list first if we need to attach it as a right
* ignore. */
- tree_t *rightIgnore = 0;
- rightIgnore = tree_allocate( prg );
- rightIgnore->id = LEL_ID_IGNORE;
- rightIgnore->flags |= AF_SUPPRESS_LEFT;
+ tree_t *right_ignore = 0;
+ right_ignore = tree_allocate( prg );
+ right_ignore->id = LEL_ID_IGNORE;
+ right_ignore->flags |= AF_SUPPRESS_LEFT;
- tree = push_right_ignore( prg, tree, rightIgnore );
+ tree = push_right_ignore( prg, tree, right_ignore );
return tree;
}
@@ -1748,12 +1748,12 @@ enum VisitType
#define TF_TERM_SEEN 0x1
-void printKid( program_t *prg, tree_t **sp, struct colm_print_args *printArgs, kid_t *kid )
+void print_kid( program_t *prg, tree_t **sp, struct colm_print_args *print_args, kid_t *kid )
{
enum ReturnType rt;
kid_t *parent = 0;
- kid_t *leadingIgnore = 0;
- enum VisitType visitType;
+ kid_t *leading_ignore = 0;
+ enum VisitType visit_type;
int flags = 0;
/* Iterate the kids passed in. We are expecting a next, which will allow us
@@ -1777,7 +1777,7 @@ rec_call:
vm_push_kid( parent );
vm_push_kid( kid );
parent = kid;
- kid = treeLeftIgnoreKid( prg, kid->tree );
+ kid = tree_left_ignore_kid( prg, kid->tree );
vm_push_type( enum ReturnType, CollectIgnoreLeft );
goto rec_call;
rec_return_ign_left:
@@ -1786,75 +1786,75 @@ rec_call:
}
if ( kid->tree->id == LEL_ID_IGNORE )
- visitType = IgnoreWrapper;
+ visit_type = IgnoreWrapper;
else if ( parent != 0 && parent->tree->id == LEL_ID_IGNORE )
- visitType = IgnoreData;
- else if ( kid->tree->id < prg->rtd->firstNonTermId )
- visitType = Term;
+ visit_type = IgnoreData;
+ else if ( kid->tree->id < prg->rtd->first_non_term_id )
+ visit_type = Term;
else
- visitType = NonTerm;
+ visit_type = NonTerm;
- debug( prg, REALM_PRINT, "visit type: %d\n", visitType );
+ debug( prg, REALM_PRINT, "visit type: %d\n", visit_type );
- if ( visitType == IgnoreData ) {
+ if ( visit_type == IgnoreData ) {
debug( prg, REALM_PRINT, "putting %p on ignore list\n", kid->tree );
- kid_t *newIgnore = kid_allocate( prg );
- newIgnore->next = leadingIgnore;
- leadingIgnore = newIgnore;
- leadingIgnore->tree = kid->tree;
+ kid_t *new_ignore = kid_allocate( prg );
+ new_ignore->next = leading_ignore;
+ leading_ignore = new_ignore;
+ leading_ignore->tree = kid->tree;
goto skip_node;
}
- if ( visitType == IgnoreWrapper ) {
- kid_t *newIgnore = kid_allocate( prg );
- newIgnore->next = leadingIgnore;
- leadingIgnore = newIgnore;
- leadingIgnore->tree = kid->tree;
+ if ( visit_type == IgnoreWrapper ) {
+ kid_t *new_ignore = kid_allocate( prg );
+ new_ignore->next = leading_ignore;
+ leading_ignore = new_ignore;
+ leading_ignore->tree = kid->tree;
/* Don't skip. */
}
/* print leading ignore? Triggered by terminals. */
- if ( visitType == Term ) {
+ if ( visit_type == Term ) {
/* Reverse the leading ignore list. */
- if ( leadingIgnore != 0 ) {
+ if ( leading_ignore != 0 ) {
kid_t *ignore = 0, *last = 0;
/* Reverse the list and take the opportunity to implement the
* suppress left. */
while ( true ) {
- kid_t *next = leadingIgnore->next;
- leadingIgnore->next = last;
+ kid_t *next = leading_ignore->next;
+ leading_ignore->next = last;
- if ( leadingIgnore->tree->flags & AF_SUPPRESS_LEFT ) {
+ if ( leading_ignore->tree->flags & AF_SUPPRESS_LEFT ) {
/* We are moving left. Chop off the tail. */
debug( prg, REALM_PRINT, "suppressing left\n" );
- freeKidList( prg, next );
+ free_kid_list( prg, next );
break;
}
if ( next == 0 )
break;
- last = leadingIgnore;
- leadingIgnore = next;
+ last = leading_ignore;
+ leading_ignore = next;
}
/* Print the leading ignore list. Also implement the suppress right
* in the process. */
- if ( printArgs->comm && (!printArgs->trim || (flags & TF_TERM_SEEN && kid->tree->id > 0)) ) {
- ignore = leadingIgnore;
+ if ( print_args->comm && (!print_args->trim || (flags & TF_TERM_SEEN && kid->tree->id > 0)) ) {
+ ignore = leading_ignore;
while ( ignore != 0 ) {
if ( ignore->tree->flags & AF_SUPPRESS_RIGHT )
break;
if ( ignore->tree->id != LEL_ID_IGNORE ) {
- vm_push_type( enum VisitType, visitType );
- vm_push_kid( leadingIgnore );
+ vm_push_type( enum VisitType, visit_type );
+ vm_push_kid( leading_ignore );
vm_push_kid( ignore );
vm_push_kid( parent );
vm_push_kid( kid );
- leadingIgnore = 0;
+ leading_ignore = 0;
kid = ignore;
parent = 0;
@@ -1866,8 +1866,8 @@ rec_call:
kid = vm_pop_kid();
parent = vm_pop_kid();
ignore = vm_pop_kid();
- leadingIgnore = vm_pop_kid();
- visitType = vm_pop_type(enum VisitType);
+ leading_ignore = vm_pop_kid();
+ visit_type = vm_pop_type(enum VisitType);
}
ignore = ignore->next;
@@ -1875,35 +1875,35 @@ rec_call:
}
/* Free the leading ignore list. */
- freeKidList( prg, leadingIgnore );
- leadingIgnore = 0;
+ free_kid_list( prg, leading_ignore );
+ leading_ignore = 0;
}
}
- if ( visitType == Term || visitType == NonTerm ) {
+ if ( visit_type == Term || visit_type == NonTerm ) {
/* Open the tree. */
- printArgs->open_tree( prg, sp, printArgs, parent, kid );
+ print_args->open_tree( prg, sp, print_args, parent, kid );
}
- if ( visitType == Term )
+ if ( visit_type == Term )
flags |= TF_TERM_SEEN;
- if ( visitType == Term || visitType == IgnoreData ) {
+ if ( visit_type == Term || visit_type == IgnoreData ) {
/* Print contents. */
- if ( kid->tree->id < prg->rtd->firstNonTermId ) {
+ if ( kid->tree->id < prg->rtd->first_non_term_id ) {
debug( prg, REALM_PRINT, "printing terminal %p\n", kid->tree );
if ( kid->tree->id != 0 )
- printArgs->print_term( prg, sp, printArgs, kid );
+ print_args->print_term( prg, sp, print_args, kid );
}
}
/* Print children. */
- kid_t *child = printArgs->attr ?
- treeAttr( prg, kid->tree ) :
- treeChild( prg, kid->tree );
+ kid_t *child = print_args->attr ?
+ tree_attr( prg, kid->tree ) :
+ tree_child( prg, kid->tree );
if ( child != 0 ) {
- vm_push_type( enum VisitType, visitType );
+ vm_push_type( enum VisitType, visit_type );
vm_push_kid( parent );
vm_push_kid( kid );
parent = kid;
@@ -1916,12 +1916,12 @@ rec_call:
}
kid = vm_pop_kid();
parent = vm_pop_kid();
- visitType = vm_pop_type(enum VisitType);
+ visit_type = vm_pop_type(enum VisitType);
}
- if ( visitType == Term || visitType == NonTerm ) {
+ if ( visit_type == Term || visit_type == NonTerm ) {
/* close the tree. */
- printArgs->close_tree( prg, sp, printArgs, parent, kid );
+ print_args->close_tree( prg, sp, print_args, parent, kid );
}
skip_node:
@@ -1933,7 +1933,7 @@ skip_node:
vm_push_kid( parent );
vm_push_kid( kid );
parent = kid;
- kid = treeRightIgnoreKid( prg, kid->tree );
+ kid = tree_right_ignore_kid( prg, kid->tree );
vm_push_type( enum ReturnType, CollectIgnoreRight );
goto rec_call;
rec_return_ign_right:
@@ -1965,17 +1965,17 @@ skip_null:
}
}
-void colm_print_tree_args( program_t *prg, tree_t **sp, struct colm_print_args *printArgs, tree_t *tree )
+void colm_print_tree_args( program_t *prg, tree_t **sp, struct colm_print_args *print_args, tree_t *tree )
{
if ( tree == 0 )
- printArgs->out( printArgs, "NIL", 3 );
+ print_args->out( print_args, "NIL", 3 );
else {
/* This term tree allows us to print trailing ignores. */
- tree_t termTree;
- memset( &termTree, 0, sizeof(termTree) );
+ tree_t term_tree;
+ memset( &term_tree, 0, sizeof(term_tree) );
kid_t kid, term;
- term.tree = &termTree;
+ term.tree = &term_tree;
term.next = 0;
term.flags = 0;
@@ -1983,22 +1983,22 @@ void colm_print_tree_args( program_t *prg, tree_t **sp, struct colm_print_args *
kid.next = &term;
kid.flags = 0;
- printKid( prg, sp, printArgs, &kid );
+ print_kid( prg, sp, print_args, &kid );
}
}
-void colm_print_term_tree( program_t *prg, tree_t **sp, struct colm_print_args *printArgs, kid_t *kid )
+void colm_print_term_tree( program_t *prg, tree_t **sp, struct colm_print_args *print_args, kid_t *kid )
{
debug( prg, REALM_PRINT, "printing term %p\n", kid->tree );
if ( kid->tree->id == LEL_ID_PTR ) {
char buf[INT_SZ];
- printArgs->out( printArgs, "#", 1 );
+ print_args->out( print_args, "#", 1 );
sprintf( buf, "%p", (void*) ((pointer_t*)kid->tree)->value );
- printArgs->out( printArgs, buf, strlen(buf) );
+ print_args->out( print_args, buf, strlen(buf) );
}
else if ( kid->tree->id == LEL_ID_STR ) {
- printStr( printArgs, ((str_t*)kid->tree)->value );
+ print_str( print_args, ((str_t*)kid->tree)->value );
}
// else if ( kid->tree->id == LEL_ID_STREAM ) {
// char buf[INT_SZ];
@@ -2007,10 +2007,10 @@ void colm_print_term_tree( program_t *prg, tree_t **sp, struct colm_print_args *
// printArgs->out( printArgs, buf, strlen(buf) );
// }
else if ( kid->tree->tokdata != 0 &&
- stringLength( kid->tree->tokdata ) > 0 )
+ string_length( kid->tree->tokdata ) > 0 )
{
- printArgs->out( printArgs, stringData( kid->tree->tokdata ),
- stringLength( kid->tree->tokdata ) );
+ print_args->out( print_args, string_data( kid->tree->tokdata ),
+ string_length( kid->tree->tokdata ) );
}
}
@@ -2020,103 +2020,103 @@ void colm_print_null( program_t *prg, tree_t **sp,
{
}
-void openTreeXml( program_t *prg, tree_t **sp, struct colm_print_args *args,
+void open_tree_xml( program_t *prg, tree_t **sp, struct colm_print_args *args,
kid_t *parent, kid_t *kid )
{
/* Skip the terminal that is for forcing trailing ignores out. */
if ( kid->tree->id == 0 )
return;
- struct lang_el_info *lelInfo = prg->rtd->lelInfo;
+ struct lang_el_info *lel_info = prg->rtd->lel_info;
/* List flattening: skip the repeats and lists that are a continuation of
* the list. */
if ( parent != 0 && parent->tree->id == kid->tree->id && kid->next == 0 &&
- ( lelInfo[parent->tree->id].repeat || lelInfo[parent->tree->id].list ) )
+ ( lel_info[parent->tree->id].repeat || lel_info[parent->tree->id].list ) )
{
return;
}
- const char *name = lelInfo[kid->tree->id].xmlTag;
+ const char *name = lel_info[kid->tree->id].xml_tag;
args->out( args, "<", 1 );
args->out( args, name, strlen( name ) );
args->out( args, ">", 1 );
}
-void printTermXml( program_t *prg, tree_t **sp, struct colm_print_args *printArgs, kid_t *kid )
+void print_term_xml( program_t *prg, tree_t **sp, struct colm_print_args *print_args, kid_t *kid )
{
//kid_t *child;
- /*child = */ treeChild( prg, kid->tree );
+ /*child = */ tree_child( prg, kid->tree );
if ( kid->tree->id == LEL_ID_PTR ) {
char ptr[32];
sprintf( ptr, "%p\n", (void*)((pointer_t*)kid->tree)->value );
- printArgs->out( printArgs, ptr, strlen(ptr) );
+ print_args->out( print_args, ptr, strlen(ptr) );
}
else if ( kid->tree->id == LEL_ID_STR ) {
head_t *head = (head_t*) ((str_t*)kid->tree)->value;
- xmlEscapeData( printArgs, (char*)(head->data), head->length );
+ xml_escape_data( print_args, (char*)(head->data), head->length );
}
- else if ( 0 < kid->tree->id && kid->tree->id < prg->rtd->firstNonTermId &&
+ else if ( 0 < kid->tree->id && kid->tree->id < prg->rtd->first_non_term_id &&
kid->tree->id != LEL_ID_IGNORE &&
kid->tree->tokdata != 0 &&
- stringLength( kid->tree->tokdata ) > 0 )
+ string_length( kid->tree->tokdata ) > 0 )
{
- xmlEscapeData( printArgs, stringData( kid->tree->tokdata ),
- stringLength( kid->tree->tokdata ) );
+ xml_escape_data( print_args, string_data( kid->tree->tokdata ),
+ string_length( kid->tree->tokdata ) );
}
}
-void closeTreeXml( program_t *prg, tree_t **sp, struct colm_print_args *args, kid_t *parent, kid_t *kid )
+void close_tree_xml( program_t *prg, tree_t **sp, struct colm_print_args *args, kid_t *parent, kid_t *kid )
{
/* Skip the terminal that is for forcing trailing ignores out. */
if ( kid->tree->id == 0 )
return;
- struct lang_el_info *lelInfo = prg->rtd->lelInfo;
+ struct lang_el_info *lel_info = prg->rtd->lel_info;
/* List flattening: skip the repeats and lists that are a continuation of
* the list. */
if ( parent != 0 && parent->tree->id == kid->tree->id && kid->next == 0 &&
- ( lelInfo[parent->tree->id].repeat || lelInfo[parent->tree->id].list ) )
+ ( lel_info[parent->tree->id].repeat || lel_info[parent->tree->id].list ) )
{
return;
}
- const char *name = lelInfo[kid->tree->id].xmlTag;
+ const char *name = lel_info[kid->tree->id].xml_tag;
args->out( args, "</", 2 );
args->out( args, name, strlen( name ) );
args->out( args, ">", 1 );
}
-void printTreeCollect( program_t *prg, tree_t **sp, StrCollect *collect, tree_t *tree, int trim )
+void print_tree_collect( program_t *prg, tree_t **sp, StrCollect *collect, tree_t *tree, int trim )
{
- struct colm_print_args printArgs = { collect, true, false, trim, &appendCollect,
+ struct colm_print_args print_args = { collect, true, false, trim, &append_collect,
&colm_print_null, &colm_print_term_tree, &colm_print_null };
- colm_print_tree_args( prg, sp, &printArgs, tree );
+ colm_print_tree_args( prg, sp, &print_args, tree );
}
-void printTreeFile( program_t *prg, tree_t **sp, FILE *out, tree_t *tree, int trim )
+void print_tree_file( program_t *prg, tree_t **sp, FILE *out, tree_t *tree, int trim )
{
- struct colm_print_args printArgs = { out, true, false, trim, &appendFile,
+ struct colm_print_args print_args = { out, true, false, trim, &append_file,
&colm_print_null, &colm_print_term_tree, &colm_print_null };
- colm_print_tree_args( prg, sp, &printArgs, tree );
+ colm_print_tree_args( prg, sp, &print_args, tree );
}
-void printTreeFd( program_t *prg, tree_t **sp, int fd, tree_t *tree, int trim )
+void print_tree_fd( program_t *prg, tree_t **sp, int fd, tree_t *tree, int trim )
{
- struct colm_print_args printArgs = { (void*)((long)fd), true, false, trim, &appendFd,
+ struct colm_print_args print_args = { (void*)((long)fd), true, false, trim, &append_fd,
&colm_print_null, &colm_print_term_tree, &colm_print_null };
- colm_print_tree_args( prg, sp, &printArgs, tree );
+ colm_print_tree_args( prg, sp, &print_args, tree );
}
-void printXmlStdout( program_t *prg, tree_t **sp, tree_t *tree, int commAttr, int trim )
+void print_xml_stdout( program_t *prg, tree_t **sp, tree_t *tree, int comm_attr, int trim )
{
- struct colm_print_args printArgs = { stdout, commAttr, commAttr, trim, &appendFile,
- &openTreeXml, &printTermXml, &closeTreeXml };
- colm_print_tree_args( prg, sp, &printArgs, tree );
+ struct colm_print_args print_args = { stdout, comm_attr, comm_attr, trim, &append_file,
+ &open_tree_xml, &print_term_xml, &close_tree_xml };
+ colm_print_tree_args( prg, sp, &print_args, tree );
}
diff --git a/src/tree.h b/src/tree.h
index b11c33d9..d5858b6f 100644
--- a/src/tree.h
+++ b/src/tree.h
@@ -92,18 +92,18 @@ typedef struct colm_parse_tree
struct colm_parse_tree *child;
struct colm_parse_tree *next;
- struct colm_parse_tree *leftIgnore;
- struct colm_parse_tree *rightIgnore;
+ struct colm_parse_tree *left_ignore;
+ struct colm_parse_tree *right_ignore;
kid_t *shadow;
/* Parsing algorithm. */
long state;
- short causeReduce;
+ short cause_reduce;
/* Retry vars. Might be able to unify lower and upper. */
- long retryRegion;
- char retryLower;
- char retryUpper;
+ long retry_region;
+ char retry_lower;
+ char retry_upper;
} parse_tree_t;
typedef struct colm_pointer
@@ -135,17 +135,17 @@ struct generic_info
{
long type;
- long elType;
- long elStructId;
- long elOffset;
+ long el_type;
+ long el_struct_id;
+ long el_offset;
- enum TYPE keyType;
- long keyOffset;
+ enum TYPE key_type;
+ long key_offset;
- enum TYPE valueType;
- long valueOffset;
+ enum TYPE value_type;
+ long value_offset;
- long parserId;
+ long parser_id;
};
enum IterType
@@ -158,41 +158,41 @@ enum IterType
typedef struct _TreeIter
{
enum IterType type;
- ref_t rootRef;
+ ref_t root_ref;
ref_t ref;
- long searchId;
- tree_t **stackRoot;
- long argSize;
- long yieldSize;
- long rootSize;
+ long search_id;
+ tree_t **stack_root;
+ long arg_size;
+ long yield_size;
+ long root_size;
} tree_iter_t;
typedef struct colm_generic_iter
{
enum IterType type;
- ref_t rootRef;
+ ref_t root_ref;
ref_t ref;
- tree_t **stackRoot;
- long argSize;
- long yieldSize;
- long rootSize;
- long genericId;
+ tree_t **stack_root;
+ long arg_size;
+ long yield_size;
+ long root_size;
+ long generic_id;
} generic_iter_t;
/* This must overlay tree iter because some of the same bytecodes are used. */
typedef struct _RevTreeIter
{
enum IterType type;
- ref_t rootRef;
+ ref_t root_ref;
ref_t ref;
- long searchId;
- tree_t **stackRoot;
- long argSize;
- long yieldSize;
- long rootSize;
+ long search_id;
+ tree_t **stack_root;
+ long arg_size;
+ long yield_size;
+ long root_size;
/* For detecting a split at the leaf. */
- kid_t *kidAtYield;
+ kid_t *kid_at_yield;
long children;
} rev_tree_iter_t;
@@ -201,92 +201,92 @@ typedef struct colm_user_iter
enum IterType type;
/* The current item. */
ref_t ref;
- tree_t **stackRoot;
- long argSize;
- long yieldSize;
- long rootSize;
+ tree_t **stack_root;
+ long arg_size;
+ long yield_size;
+ long root_size;
code_t *resume;
tree_t **frame;
- long searchId;
+ long search_id;
} user_iter_t;
void colm_tree_upref( tree_t *tree );
void colm_tree_downref( struct colm_program *prg, tree_t **sp, tree_t *tree );
long colm_cmp_tree( struct colm_program *prg, const tree_t *tree1, const tree_t *tree2 );
-tree_t *push_right_ignore( struct colm_program *prg, tree_t *pushTo, tree_t *rightIgnore );
-tree_t *push_left_ignore( struct colm_program *prg, tree_t *pushTo, tree_t *leftIgnore );
-tree_t *popRightIgnore( struct colm_program *prg, tree_t **sp,
- tree_t *popFrom, tree_t **rightIgnore );
-tree_t *popLeftIgnore( struct colm_program *prg, tree_t **sp,
- tree_t *popFrom, tree_t **leftIgnore );
-tree_t *treeLeftIgnore( struct colm_program *prg, tree_t *tree );
-tree_t *treeRightIgnore( struct colm_program *prg, tree_t *tree );
-kid_t *treeLeftIgnoreKid( struct colm_program *prg, tree_t *tree );
-kid_t *treeRightIgnoreKid( struct colm_program *prg, tree_t *tree );
-kid_t *treeChild( struct colm_program *prg, const tree_t *tree );
-kid_t *treeAttr( struct colm_program *prg, const tree_t *tree );
-kid_t *kidListConcat( kid_t *list1, kid_t *list2 );
-kid_t *treeExtractChild( struct colm_program *prg, tree_t *tree );
-kid_t *reverseKidList( kid_t *kid );
+tree_t *push_right_ignore( struct colm_program *prg, tree_t *push_to, tree_t *right_ignore );
+tree_t *push_left_ignore( struct colm_program *prg, tree_t *push_to, tree_t *left_ignore );
+tree_t *pop_right_ignore( struct colm_program *prg, tree_t **sp,
+ tree_t *pop_from, tree_t **right_ignore );
+tree_t *pop_left_ignore( struct colm_program *prg, tree_t **sp,
+ tree_t *pop_from, tree_t **left_ignore );
+tree_t *tree_left_ignore( struct colm_program *prg, tree_t *tree );
+tree_t *tree_right_ignore( struct colm_program *prg, tree_t *tree );
+kid_t *tree_left_ignore_kid( struct colm_program *prg, tree_t *tree );
+kid_t *tree_right_ignore_kid( struct colm_program *prg, tree_t *tree );
+kid_t *tree_child( struct colm_program *prg, const tree_t *tree );
+kid_t *tree_attr( struct colm_program *prg, const tree_t *tree );
+kid_t *kid_list_concat( kid_t *list1, kid_t *list2 );
+kid_t *tree_extract_child( struct colm_program *prg, tree_t *tree );
+kid_t *reverse_kid_list( kid_t *kid );
tree_t *colm_construct_pointer( struct colm_program *prg, colm_value_t value );
tree_t *colm_construct_term( struct colm_program *prg, word_t id, head_t *tokdata );
tree_t *colm_construct_tree( struct colm_program *prg, kid_t *kid,
tree_t **bindings, long pat );
tree_t *colm_construct_object( struct colm_program *prg, kid_t *kid,
- tree_t **bindings, long langElId );
+ tree_t **bindings, long lang_el_id );
tree_t *colm_construct_token( struct colm_program *prg, tree_t **args, long nargs );
-int testFalse( struct colm_program *prg, tree_t *tree );
-tree_t *makeTree( struct colm_program *prg, tree_t **args, long nargs );
-stream_t *openFile( struct colm_program *prg, tree_t *name, tree_t *mode );
+int test_false( struct colm_program *prg, tree_t *tree );
+tree_t *make_tree( struct colm_program *prg, tree_t **args, long nargs );
+stream_t *open_file( struct colm_program *prg, tree_t *name, tree_t *mode );
stream_t *colm_stream_open_file( struct colm_program *prg, tree_t *name, tree_t *mode );
stream_t *colm_stream_open_fd( struct colm_program *prg, char *name, long fd );
-kid_t *copyIgnoreList( struct colm_program *prg, kid_t *ignoreHeader );
-kid_t *copyKidList( struct colm_program *prg, kid_t *kidList );
+kid_t *copy_ignore_list( struct colm_program *prg, kid_t *ignore_header );
+kid_t *copy_kid_list( struct colm_program *prg, kid_t *kid_list );
void colm_stream_free( struct colm_program *prg, stream_t *s );
tree_t *colm_copy_tree( struct colm_program *prg, tree_t *tree,
- kid_t *oldNextDown, kid_t **newNextDown );
+ kid_t *old_next_down, kid_t **new_next_down );
colm_value_t colm_get_pointer_val( tree_t *pointer );
tree_t *colm_tree_get_field( tree_t *tree, word_t field );
-tree_t *getFieldSplit( struct colm_program *prg, tree_t *tree, word_t field );
-tree_t *getRhsEl( struct colm_program *prg, tree_t *lhs, long position );
-kid_t *getRhsElKid( struct colm_program *prg, tree_t *lhs, long position );
+tree_t *get_field_split( struct colm_program *prg, tree_t *tree, word_t field );
+tree_t *get_rhs_el( struct colm_program *prg, tree_t *lhs, long position );
+kid_t *get_rhs_el_kid( struct colm_program *prg, tree_t *lhs, long position );
void colm_tree_set_field( struct colm_program *prg, tree_t *tree, long field, tree_t *value );
-void setTriterCur( struct colm_program *prg, tree_iter_t *iter, tree_t *tree );
-void setUiterCur( struct colm_program *prg, user_iter_t *uiter, tree_t *tree );
-void refSetValue( struct colm_program *prg, tree_t **sp, ref_t *ref, tree_t *v );
-tree_t *treeSearch( struct colm_program *prg, tree_t *tree, long id );
-location_t *locSearch( struct colm_program *prg, tree_t *tree );
+void set_triter_cur( struct colm_program *prg, tree_iter_t *iter, tree_t *tree );
+void set_uiter_cur( struct colm_program *prg, user_iter_t *uiter, tree_t *tree );
+void ref_set_value( struct colm_program *prg, tree_t **sp, ref_t *ref, tree_t *v );
+tree_t *tree_search( struct colm_program *prg, tree_t *tree, long id );
+location_t *loc_search( struct colm_program *prg, tree_t *tree );
-int matchPattern( tree_t **bindings, struct colm_program *prg,
- long pat, kid_t *kid, int checkNext );
-tree_t *treeIterDerefCur( tree_iter_t *iter );
+int match_pattern( tree_t **bindings, struct colm_program *prg,
+ long pat, kid_t *kid, int check_next );
+tree_t *tree_iter_deref_cur( tree_iter_t *iter );
/* For making references of attributes. */
-kid_t *getFieldKid( tree_t *tree, word_t field );
-
-tree_t *copyRealTree( struct colm_program *prg, tree_t *tree,
- kid_t *oldNextDown, kid_t **newNextDown );
-void splitIterCur( struct colm_program *prg, tree_t ***psp, tree_iter_t *iter );
-tree_t *setListMem( list_t *list, half_t field, tree_t *value );
-
-void listPushTail( struct colm_program *prg, list_t *list, tree_t *val );
-void listPushHead( struct colm_program *prg, list_t *list, tree_t *val );
-tree_t *listRemoveEnd( struct colm_program *prg, list_t *list );
-tree_t *listRemoveHead( struct colm_program *prg, list_t *list );
-tree_t *getListMemSplit( struct colm_program *prg, list_t *list, word_t field );
-tree_t *getParserMem( parser_t *parser, word_t field );
-
-tree_t *treeIterAdvance( struct colm_program *prg, tree_t ***psp, tree_iter_t *iter );
-tree_t *treeIterNextChild( struct colm_program *prg, tree_t ***psp, tree_iter_t *iter );
-tree_t *treeRevIterPrevChild( struct colm_program *prg, tree_t ***psp, rev_tree_iter_t *iter );
-tree_t *treeIterNextRepeat( struct colm_program *prg, tree_t ***psp, tree_iter_t *iter );
-tree_t *treeIterPrevRepeat( struct colm_program *prg, tree_t ***psp, tree_iter_t *iter );
+kid_t *get_field_kid( tree_t *tree, word_t field );
+
+tree_t *copy_real_tree( struct colm_program *prg, tree_t *tree,
+ kid_t *old_next_down, kid_t **new_next_down );
+void split_iter_cur( struct colm_program *prg, tree_t ***psp, tree_iter_t *iter );
+tree_t *set_list_mem( list_t *list, half_t field, tree_t *value );
+
+void list_push_tail( struct colm_program *prg, list_t *list, tree_t *val );
+void list_push_head( struct colm_program *prg, list_t *list, tree_t *val );
+tree_t *list_remove_end( struct colm_program *prg, list_t *list );
+tree_t *list_remove_head( struct colm_program *prg, list_t *list );
+tree_t *get_list_mem_split( struct colm_program *prg, list_t *list, word_t field );
+tree_t *get_parser_mem( parser_t *parser, word_t field );
+
+tree_t *tree_iter_advance( struct colm_program *prg, tree_t ***psp, tree_iter_t *iter );
+tree_t *tree_iter_next_child( struct colm_program *prg, tree_t ***psp, tree_iter_t *iter );
+tree_t *tree_rev_iter_prev_child( struct colm_program *prg, tree_t ***psp, rev_tree_iter_t *iter );
+tree_t *tree_iter_next_repeat( struct colm_program *prg, tree_t ***psp, tree_iter_t *iter );
+tree_t *tree_iter_prev_repeat( struct colm_program *prg, tree_t ***psp, tree_iter_t *iter );
/* An automatically grown buffer for collecting tokens. Always reuses space;
* never down resizes. */
@@ -297,50 +297,50 @@ typedef struct _StrCollect
int length;
} StrCollect;
-void initStrCollect( StrCollect *collect );
-void strCollectDestroy( StrCollect *collect );
-void strCollectAppend( StrCollect *collect, const char *data, long len );
-void strCollectClear( StrCollect *collect );
-tree_t *treeTrim( struct colm_program *prg, tree_t **sp, tree_t *tree );
+void init_str_collect( StrCollect *collect );
+void str_collect_destroy( StrCollect *collect );
+void str_collect_append( StrCollect *collect, const char *data, long len );
+void str_collect_clear( StrCollect *collect );
+tree_t *tree_trim( struct colm_program *prg, tree_t **sp, tree_t *tree );
-void printTreeCollect( struct colm_program *prg, tree_t **sp,
+void print_tree_collect( struct colm_program *prg, tree_t **sp,
StrCollect *collect, tree_t *tree, int trim );
-void printTreeFile( struct colm_program *prg, tree_t **sp, FILE *out, tree_t *tree, int trim );
-void printTreeFd( struct colm_program *prg, tree_t **sp, int fd, tree_t *tree, int trim );
-void printXmlStdout( struct colm_program *prg, tree_t **sp,
- tree_t *tree, int commAttr, int trim );
+void print_tree_file( struct colm_program *prg, tree_t **sp, FILE *out, tree_t *tree, int trim );
+void print_tree_fd( struct colm_program *prg, tree_t **sp, int fd, tree_t *tree, int trim );
+void print_xml_stdout( struct colm_program *prg, tree_t **sp,
+ tree_t *tree, int comm_attr, int trim );
/*
* Iterators.
*/
user_iter_t *colm_uiter_create( struct colm_program *prg, tree_t ***psp,
- struct function_info *fi, long searchId );
-void uiterInit( struct colm_program *prg, tree_t **sp, user_iter_t *uiter,
- struct function_info *fi, int revertOn );
+ struct function_info *fi, long search_id );
+void uiter_init( struct colm_program *prg, tree_t **sp, user_iter_t *uiter,
+ struct function_info *fi, int revert_on );
-void colm_init_tree_iter( tree_iter_t *treeIter, tree_t **stackRoot,
- long argSize, long rootSize, const ref_t *rootRef, int searchId );
-void colm_init_rev_tree_iter( rev_tree_iter_t *revTriter, tree_t **stackRoot,
- long argSize, long rootSize, const ref_t *rootRef, int searchId, int children );
-void colm_init_user_iter( user_iter_t *userIter, tree_t **stackRoot, long rootSize,
- long argSize, long searchId );
+void colm_init_tree_iter( tree_iter_t *tree_iter, tree_t **stack_root,
+ long arg_size, long root_size, const ref_t *root_ref, int search_id );
+void colm_init_rev_tree_iter( rev_tree_iter_t *rev_triter, tree_t **stack_root,
+ long arg_size, long root_size, const ref_t *root_ref, int search_id, int children );
+void colm_init_user_iter( user_iter_t *user_iter, tree_t **stack_root, long root_size,
+ long arg_size, long search_id );
void colm_tree_iter_destroy( struct colm_program *prg, tree_t ***psp, tree_iter_t *iter );
void colm_rev_tree_iter_destroy( struct colm_program *prg, tree_t ***psp, rev_tree_iter_t *iter );
void colm_uiter_destroy( struct colm_program *prg, tree_t ***psp, user_iter_t *uiter );
void colm_uiter_unwind( struct colm_program *prg, tree_t ***psp, user_iter_t *uiter );
-tree_t *castTree( struct colm_program *prg, int langElId, tree_t *tree );
-struct stream_impl *streamToImpl( stream_t *ptr );
+tree_t *cast_tree( struct colm_program *prg, int lang_el_id, tree_t *tree );
+struct stream_impl *stream_to_impl( stream_t *ptr );
-void colm_init_list_iter( generic_iter_t *listIter, tree_t **stackRoot,
- long argSize, long rootSize, const ref_t *rootRef, int genericId );
+void colm_init_list_iter( generic_iter_t *list_iter, tree_t **stack_root,
+ long arg_size, long root_size, const ref_t *root_ref, int generic_id );
void colm_list_iter_destroy( struct colm_program *prg, tree_t ***psp, generic_iter_t *iter );
tree_t *colm_list_iter_advance( struct colm_program *prg, tree_t ***psp, generic_iter_t *iter );
tree_t *colm_list_iter_deref_cur( struct colm_program *prg, generic_iter_t *iter );
-void colm_list_append( struct colm_list *list, struct colm_list_el *newEl );
-void colm_list_prepend( struct colm_list *list, struct colm_list_el *newEl );
+void colm_list_append( struct colm_list *list, struct colm_list_el *new_el );
+void colm_list_prepend( struct colm_list *list, struct colm_list_el *new_el );
void colm_vlist_append( struct colm_program *prg, list_t *list, value_t value );
void colm_vlist_prepend( struct colm_program *prg, list_t *list, value_t value );
@@ -351,8 +351,8 @@ value_t colm_viter_deref_cur( struct colm_program *prg, generic_iter_t *iter );
str_t *string_prefix( program_t *prg, str_t *str, long len );
str_t *string_suffix( program_t *prg, str_t *str, long pos );
-head_t *stringAllocFull( struct colm_program *prg, const char *data, long length );
-tree_t *constructString( struct colm_program *prg, head_t *s );
+head_t *string_alloc_full( struct colm_program *prg, const char *data, long length );
+tree_t *construct_string( struct colm_program *prg, head_t *s );
#if defined(__cplusplus)
}
diff --git a/test/ext1.lm b/test/ext1.lm
index edafc611..a06f7ea2 100644
--- a/test/ext1.lm
+++ b/test/ext1.lm
@@ -21,8 +21,8 @@ str_t *c_alphcount( program_t *prg, tree_t **sp, str_t *a1 )
char strc[64];
sprintf( strc, "%d", count );
- head_t *h = stringAllocFull( prg, strc, strlen( strc ) );
- tree_t *s = constructString( prg, h );
+ head_t *h = string_alloc_full( prg, strc, strlen( strc ) );
+ tree_t *s = construct_string( prg, h );
colm_tree_upref( s );
colm_tree_downref( prg, sp, a1 );
return (str_t*)s;