Example #1
0
// ---
void CCodeGen::m_reg_call( COutputSect& old, COutputSect& anew ) {
  int i;
  int beg  = old.find_by( 0, "RegisterIFace", cmp_by_substr ); // find reistration call range (CALL_Root_RegisterIFace)
  int begN = anew.find_by( 0, "RegisterIFace", cmp_by_substr ); // find reistration call range (CALL_Root_RegisterIFace)
	
  if ( beg >= 0 ) { // if call range found
    
    bool the_same;
    int  end;
		int  len;
		int  endN = anew.find_by( begN, BRACKET_C_SEMICOLON, cmp_ignore_spaces_no_comment );
		int  lenN = endN - begN + 1;
		
    if ( ::strrchr(old[beg],BRACKET_C) ) {
      end = beg;
      the_same = false;
    }
    else {
      end = old.find_by( beg, BRACKET_C_SEMICOLON, cmp_ignore_spaces_no_comment );
      the_same = true;
    }
    
		len = end - beg + 1;
		the_same = cmp_range( old, beg, anew, begN, lenN );

    if ( the_same ) { 
      // if the same -- remove new one to save comments
      for( i=endN; i>=begN; i-- )
        anew.RemoveInd( i );
    }
    else { // if not the same -- comment out previous one
			old.comment_out( beg, len );
			for( i=0; i<lenN; i++ )
				old.AddAfter( anew.RemoveInd(begN,noDelete), end++ );
		}
	}
	anew.RemoveAll();

  // find all PR_TRACE... or PR_K_TRACE calls and comment it out if they not found in new section
	// i = -1;
	// while( -1 != (i=find_by(old,i+1,g_trace_def,cmp_by_prefix)) ) {
	//   char*& s = old[i];
	//   if ( -1 == find_by(anew,0,s,cmp_ignore_spaces_and_comment_no_case) )
	//     comment_out( s );
	// }
	//
	// m_merge( old, anew );
}
Example #2
0
static int64_t CC cmp_range_wrapper( const void *item, const void *n )
{   return cmp_range( item, n ); }