MCPcopy Create free account
hub / github.com/boostorg/build / var_parse_file_compile

Function var_parse_file_compile

src/engine/function.cpp:2033–2079  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2031 struct dynamic_array * out );
2032
2033static void var_parse_file_compile( VAR_PARSE_VAR const * parse, compiler * c )
2034{
2035 std::string var = var_parse_to_string( parse, true );
2036 int32_t empty_mod_index = var_parse_var_mod_index( parse, 'E' );
2037 int32_t grist_mod_index = var_parse_var_mod_index( parse, 'G' );
2038 int32_t modifier_count = 0;
2039 // Push the contents, aka the edit modifier value.
2040 {
2041 assert( empty_mod_index >= 0 );
2042 // We reparse the edit modifier as we do teh expansion differently than
2043 // regular var expansion.
2044 std::string contents_val = var_parse_to_string(
2045 dynamic_array_at(
2046 VAR_PARSE_GROUP *, parse->modifiers, empty_mod_index ), false );
2047 dynamic_array contents_dyn_array;
2048 dynamic_array_init( &contents_dyn_array );
2049 parse_var_string(
2050 contents_val.c_str() + 2, contents_val.c_str() + contents_val.size(),
2051 &contents_dyn_array );
2052 for ( int32_t i = contents_dyn_array.size - 1; i >= 0; --i )
2053 {
2054 auto group = dynamic_array_at(
2055 VAR_PARSE_GROUP *, ( &contents_dyn_array ), i );
2056 var_parse_group_compile( group, c );
2057 var_parse_group_free( group );
2058 }
2059 dynamic_array_free( &contents_dyn_array );
2060 compile_emit( c, INSTR_APPEND_STRINGS, contents_dyn_array.size );
2061 }
2062 // If there are modifiers, emit them in reverse order.
2063 if ( parse->modifiers->size > 0 )
2064 {
2065 for ( int32_t i = parse->modifiers->size - 1; i >= 0; --i )
2066 {
2067 // Skip special modifiers.
2068 if ( i == empty_mod_index || i == grist_mod_index ) continue;
2069 modifier_count += 1;
2070 var_parse_group_compile(
2071 dynamic_array_at( VAR_PARSE_GROUP *, parse->modifiers, i ), c );
2072 }
2073 }
2074 // Push the filename, aka var name.
2075 var_parse_group_compile( parse->name, c );
2076 // This instruction applies the modifiers and writes out the file and fills
2077 // in the file name.
2078 compile_emit( c, INSTR_WRITE_FILE, modifier_count );
2079}
2080
2081static void var_parse_compile( VAR_PARSE const * parse, compiler * c )
2082{

Callers 1

var_parse_compileFunction · 0.85

Calls 8

var_parse_to_stringFunction · 0.85
var_parse_var_mod_indexFunction · 0.85
dynamic_array_initFunction · 0.85
parse_var_stringFunction · 0.85
var_parse_group_compileFunction · 0.85
var_parse_group_freeFunction · 0.85
dynamic_array_freeFunction · 0.85
compile_emitFunction · 0.85

Tested by

no test coverage detected