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

Function var_defines

src/engine/variable.cpp:74–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72 */
73
74void var_defines( struct module_t * module, const char * const * e, int preprocess )
75{
76 string buf[ 1 ];
77
78 string_new( buf );
79
80 for ( ; *e; ++e )
81 {
82 const char * val;
83
84 if ( ( val = strchr( *e, '=' ) )
85#if defined( OS_MAC )
86 /* On the mac (MPW), the var=val is actually var\0val */
87 /* Think different. */
88 || ( val = *e + strlen( *e ) )
89#endif
90 )
91 {
92 LIST * l = L0;
93 int32_t const len = int32_t(strlen( val + 1 ));
94 int const quoted = ( val[ 1 ] == '"' ) && ( val[ len ] == '"' ) &&
95 ( len > 1 );
96
97 if ( quoted && preprocess )
98 {
99 string_append_range( buf, val + 2, val + len );
100 l = list_push_back( l, object_new( buf->value ) );
101 string_truncate( buf, 0 );
102 }
103 else
104 {
105 const char * p;
106 const char * pp;
107 char split =
108#if defined( OPT_NO_EXTERNAL_VARIABLE_SPLIT )
109 '\0'
110#elif defined( OS_MAC )
111 ','
112#else
113 ' '
114#endif
115 ;
116
117 /* Split *PATH at :'s, not spaces. */
118 if ( val - 4 >= *e )
119 {
120 if ( !strncmp( val - 4, "PATH", 4 ) ||
121 !strncmp( val - 4, "Path", 4 ) ||
122 !strncmp( val - 4, "path", 4 ) )
123 split = SPLITPATH;
124 }
125
126 /* Do the split. */
127 for
128 (
129 pp = val + 1;
130 preprocess && ( ( p = strchr( pp, split ) ) != 0 );
131 pp = p + 1

Callers 2

var_getFunction · 0.85
mainFunction · 0.85

Calls 8

string_newFunction · 0.85
string_append_rangeFunction · 0.85
list_push_backFunction · 0.85
object_newFunction · 0.85
string_truncateFunction · 0.85
var_setFunction · 0.85
object_freeFunction · 0.85
string_freeFunction · 0.85

Tested by

no test coverage detected