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

Function var_defines

v2/engine/variable.c:73–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

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