2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00

New module scoping rules

[SVN r13287]
This commit is contained in:
Dave Abrahams
2002-03-27 22:23:30 +00:00
parent 6804ee7373
commit 244f6d469f
43 changed files with 844 additions and 914 deletions

View File

@@ -63,6 +63,7 @@ COMMON_PROPERTIES ?=
# Borland link lines will need work to find the right libraries for unicode
# support - see borland-tools.jam
<borland><wide-character-support>off
"<cwpro8><cxxflags>-iso_templates on"
;
variant common :

View File

@@ -277,7 +277,10 @@ compile_foreach(
}
if ( parse->num )
{
popsettings( s );
freesettings( s );
}
list_free( nv );
@@ -751,7 +754,16 @@ evaluate_rule(
profile_frame prof[1];
module *prev_module = frame->module;
LIST* l = var_expand( L0, rulename, rulename+strlen(rulename), frame->args, 0 );
LIST *l;
{
LOL arg_context_, *arg_context = &arg_context_;
if ( !frame->prev )
lol_init(arg_context);
else
arg_context = frame->prev->args;
l = var_expand( L0, rulename, rulename+strlen(rulename), arg_context, 0 );
}
if ( !l )
{
@@ -895,7 +907,7 @@ compile_set(
LIST *nt = parse_evaluate( parse->left, frame );
LIST *ns = parse_evaluate( parse->right, frame );
LIST *l;
int setflag;
int setflag;
char *trace;
switch( parse->num )
@@ -909,6 +921,7 @@ compile_set(
if( DEBUG_COMPILE )
{
debug_compile( 0, "set", frame);
printf( frame->module->name );
list_print( nt );
printf( " %s ", trace );
list_print( ns );
@@ -926,54 +939,6 @@ compile_set(
return ns;
}
/*
* compile_set_module() - compile the "module local set variable" statement
*
* parse->left variable names
* parse->right variable values
*/
LIST *
compile_set_module(
PARSE *parse,
FRAME *frame )
{
LIST *nt = parse_evaluate( parse->left, frame );
LIST *ns = parse_evaluate( parse->right, frame );
LIST *l;
int setflag;
char *trace;
switch( parse->num )
{
case ASSIGN_SET: setflag = VAR_SET; trace = "="; break;
default: setflag = VAR_APPEND; trace = ""; break;
}
if( DEBUG_COMPILE )
{
debug_compile( 0, "set module", frame);
printf( "(%s)", frame->module->name );
list_print( nt );
printf( " %s ", trace );
list_print( ns );
printf( "\n" );
}
/* Call var_set to set variable */
/* var_set keeps ns, so need to copy it */
for( l = nt; l; l = list_next( l ) )
{
bind_module_var( frame->module, l->string );
var_set( l->string, list_copy( L0, ns ), setflag );
}
list_free( nt );
return ns;
}
/*
* compile_setcomp() - support for `rule` - save parse tree
*

View File

@@ -38,7 +38,6 @@ LIST *compile_on( PARSE *parse, FRAME *frame );
LIST *compile_rule( PARSE *parse, FRAME *frame );
LIST *compile_rules( PARSE *parse, FRAME *frame );
LIST *compile_set( PARSE *parse, FRAME *frame );
LIST *compile_set_module( PARSE *parse, FRAME *frame );
LIST *compile_setcomp( PARSE *parse, FRAME *frame );
LIST *compile_setexec( PARSE *parse, FRAME *frame );
LIST *compile_settings( PARSE *parse, FRAME *frame );

View File

@@ -41,7 +41,6 @@ static int yygrowstack();
# define prule( s,p ) parse_make( compile_rule,p,P0,P0,s,S0,0 )
# define prules( l,r ) parse_make( compile_rules,l,r,P0,S0,S0,0 )
# define pset( l,r,a ) parse_make( compile_set,l,r,P0,S0,S0,a )
# define psetmodule( l,r,a ) parse_make( compile_set_module,l,r,P0,S0,S0,a )
# define pset1( l,r,t,a ) parse_make( compile_settings,l,r,t,S0,S0,a )
# define psetc( s,p,a,l ) parse_make( compile_setcomp,p,a,P0,s,S0,l )
# define psete( s,l,s1,f ) parse_make( compile_setexec,l,P0,P0,s,s1,f )
@@ -50,7 +49,7 @@ static int yygrowstack();
# define pnode( l,r ) parse_make( F0,l,r,P0,S0,S0,0 )
# define psnode( s,l ) parse_make( F0,l,P0,P0,s,S0,0 )
#line 54 "y.tab.c"
#line 53 "y.tab.c"
#define YYERRCODE 256
#define _BANG 257
#define _BANG_EQUALS 258
@@ -100,150 +99,150 @@ static int yygrowstack();
const short yylhs[] = { -1,
0, 0, 2, 2, 1, 1, 1, 3, 6, 6,
7, 7, 9, 9, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 16,
17, 4, 11, 11, 11, 11, 13, 13, 13, 13,
13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
12, 12, 18, 8, 8, 5, 19, 19, 10, 21,
10, 20, 20, 20, 14, 14, 22, 22, 22, 22,
22, 22, 15, 15,
4, 4, 4, 4, 4, 4, 4, 4, 16, 17,
4, 11, 11, 11, 11, 13, 13, 13, 13, 13,
13, 13, 13, 13, 13, 13, 13, 13, 13, 12,
12, 18, 8, 8, 5, 19, 19, 10, 21, 10,
20, 20, 20, 14, 14, 22, 22, 22, 22, 22,
22, 15, 15,
};
const short yylen[] = { 2,
0, 1, 1, 1, 1, 2, 5, 0, 2, 1,
3, 0, 1, 0, 3, 3, 3, 4, 5, 6,
3, 8, 5, 5, 5, 5, 7, 5, 3, 0,
0, 9, 1, 1, 1, 2, 1, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 2, 3,
0, 2, 4, 1, 3, 1, 0, 2, 1, 0,
4, 2, 4, 4, 0, 2, 1, 1, 1, 1,
1, 1, 0, 2,
3, 0, 1, 0, 3, 3, 3, 4, 6, 3,
8, 5, 5, 5, 5, 7, 5, 3, 0, 0,
9, 1, 1, 1, 2, 1, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 2, 3, 0,
2, 4, 1, 3, 1, 0, 2, 1, 0, 4,
2, 4, 4, 0, 2, 1, 1, 1, 1, 1,
1, 0, 2,
};
const short yydefred[] = { 0,
60, 65, 0, 0, 57, 0, 0, 0, 57, 57,
59, 64, 0, 0, 56, 0, 56, 0, 56, 56,
0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
13, 0, 0, 0, 59, 0, 0, 0, 0, 0,
57, 0, 0, 0, 0, 0, 4, 0, 3, 0,
0, 6, 0, 34, 33, 35, 0, 57, 57, 0,
57, 0, 72, 69, 71, 70, 68, 67, 0, 66,
0, 49, 0, 0, 0, 0, 0, 0, 0, 57,
0, 0, 0, 0, 0, 16, 58, 57, 10, 0,
0, 0, 29, 21, 0, 0, 15, 57, 17, 0,
36, 0, 0, 0, 62, 61, 57, 0, 57, 50,
39, 40, 41, 38, 42, 43, 48, 44, 45, 0,
0, 0, 9, 0, 0, 0, 0, 0, 0, 0,
55, 57, 0, 57, 18, 57, 57, 74, 30, 0,
0, 7, 19, 25, 0, 23, 52, 26, 0, 28,
0, 64, 63, 0, 0, 0, 0, 11, 20, 31,
0, 27, 53, 0, 22, 32,
13, 0, 0, 0, 58, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 4, 0, 3, 0, 0,
6, 0, 33, 32, 34, 0, 56, 56, 0, 56,
0, 71, 68, 70, 69, 67, 66, 0, 65, 0,
48, 0, 0, 0, 0, 0, 0, 0, 56, 0,
0, 0, 0, 0, 16, 57, 56, 10, 0, 0,
28, 20, 0, 0, 15, 56, 17, 0, 35, 0,
0, 0, 61, 60, 56, 0, 56, 49, 38, 39,
40, 37, 41, 42, 47, 43, 44, 0, 0, 0,
9, 0, 0, 0, 0, 0, 0, 54, 56, 0,
56, 18, 56, 56, 73, 29, 0, 0, 7, 24,
0, 22, 51, 25, 0, 27, 0, 63, 62, 0,
0, 0, 0, 11, 19, 30, 0, 26, 52, 0,
21, 31,
};
const short yydgoto[] = { 14,
37, 38, 39, 16, 40, 80, 123, 41, 17, 18,
49, 118, 27, 20, 98, 144, 154, 119, 29, 52,
19, 60,
36, 37, 38, 16, 39, 79, 120, 40, 17, 18,
48, 115, 27, 20, 96, 140, 150, 116, 29, 51,
19, 59,
};
const short yysindex[] = { -88,
0, 0, -269, -248, 0, 0, -257, -229, 0, 0,
-248, -88, 0, 0, 0, -88, -254, -160, -267, -44,
0, -258, -248, -248, 0, -36, -212, -219, -229, -200,
0, -222, -71, -188, -215, -209, 0, -203, 0, -166,
-155, 0, -201, 0, 0, 0, -168, 0, 0, -229,
0, -152, 0, 0, 0, 0, 0, 0, -170, 0,
-159, 0, -153, -229, -229, -229, -229, -229, -229, 0,
-248, -248, -88, -248, -248, 0, 0, 0, 0, -140,
-200, -88, 0, 0, -146, -88, 0, 0, 0, -135,
0, -20, -124, -245, 0, 0, 0, -147, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, -141,
-165, -165, 0, -88, -105, -137, -148, -136, -146, -133,
0, 0, -71, 0, 0, 0, 0, 0, 0, -132,
-109, 0, 0, 0, -94, 0, 0, 0, -87, 0,
-84, 0, 0, -112, -88, -71, -88, 0, 0, 0,
-108, 0, 0, -104, 0, 0,
const short yysindex[] = { -50,
0, 0, -254, -238, 0, 0, 0, -250, 0, 0,
-238, -50, 0, 0, 0, -50, -258, -144, -261, -24,
0, -270, -238, -238, 0, -129, -202, -214, -250, -212,
-242, -33, -210, -237, -199, 0, -236, 0, -198, -196,
0, -230, 0, 0, 0, -193, 0, 0, -250, 0,
-201, 0, 0, 0, 0, 0, 0, -188, 0, -194,
0, -217, -250, -250, -250, -250, -250, -250, 0, -238,
-238, -50, -238, -238, 0, 0, 0, 0, -174, -50,
0, 0, -175, -50, 0, 0, 0, -169, 0, -104,
-162, -265, 0, 0, 0, -192, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, -183, -232, -232,
0, -50, -182, -185, -181, -175, -179, 0, 0, -33,
0, 0, 0, 0, 0, 0, -173, -157, 0, 0,
-142, 0, 0, 0, -137, 0, -135, 0, 0, -167,
-50, -33, -50, 0, 0, 0, -164, 0, 0, -163,
0, 0,
};
const short yyrindex[] = { 7,
0, 0, -110, 0, 0, -115, -238, 0, 0, 0,
0, -198, -149, 0, 0, 3, 0, 0, 0, 0,
0, 0, 0, 0, 0, -237, 0, 0, -233, -60,
0, 0, -97, 0, 0, 0, 0, 0, 0, -45,
0, 0, -168, 0, 0, -259, 0, 0, 0, 0,
0, -262, -87, 0, 0, 3, 0, 0, 0, 0,
0, 0, 0, 0, 0, -213, 0, 0, -102, -123,
0, -147, 0, 0, 0, 0, 0, 0, -82, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, -96, 0,
0, 0, 0, 0, 0, 0, 0, -145, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, -198, 0, 0, 0, 0, 0, 0, 0,
-60, -198, 0, 0, -93, -198, 0, 0, 0, -113,
0, -262, 0, 0, 0, 0, 0, 0, 0, -262,
0, 0, -134, -262, 0, 0, 0, -75, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, -189, -184,
0, 4, 0, 0, 0, -134, 0, 0, 0, -147,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-150, -142, 0, 4, 0, 0, 0, 0, -93, 0,
0, 0, -97, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, -198, -97, -111, 0, 0, 0,
0, 0, 0, 0, 0, 0,
-262, -147, -255, 0, 0, 0, 0, 0, 0, 0,
0, 0,
};
const short yygindex[] = { 0,
41, -65, -25, -33, 5, 130, 0, -49, 215, 68,
131, 107, -5, 0, 0, 0, 0, 0, 0, 0,
24, -64, 138, -32, 5, 0, 0, -48, 167, 82,
84, 56, -6, 0, 0, 0, 0, 0, 0, 0,
0, 0,
};
#define YYTABLESIZE 303
const short yytable[] = { 83,
24, 95, 5, 8, 79, 36, 1, 110, 23, 28,
30, 32, 24, 34, 35, 21, 116, 62, 63, 50,
120, 37, 37, 1, 37, 56, 56, 31, 56, 56,
56, 56, 51, 57, 56, 81, 43, 56, 121, 56,
15, 61, 1, 56, 126, 76, 71, 72, 132, 71,
72, 25, 92, 93, 127, 79, 42, 57, 37, 37,
37, 57, 56, 56, 56, 108, 109, 78, 111, 112,
25, 26, 139, 82, 107, 33, 84, 143, 26, 151,
85, 153, 113, 73, 74, 75, 86, 74, 75, 140,
26, 26, 14, 71, 72, 87, 77, 88, 90, 91,
8, 128, 44, 130, 97, 71, 72, 45, 100, 89,
46, 46, 152, 59, 57, 57, 47, 94, 59, 47,
96, 59, 57, 99, 114, 122, 48, 59, 141, 117,
142, 101, 102, 103, 104, 105, 106, 59, 26, 26,
125, 26, 26, 74, 75, 46, 46, 46, 129, 57,
57, 135, 57, 47, 47, 47, 57, 131, 12, 133,
12, 134, 136, 145, 8, 138, 12, 12, 146, 147,
12, 12, 12, 12, 148, 13, 12, 12, 12, 14,
149, 12, 12, 1, 57, 2, 12, 8, 150, 14,
155, 3, 4, 14, 156, 5, 6, 7, 8, 73,
1, 9, 2, 10, 8, 51, 11, 12, 3, 4,
115, 13, 5, 21, 7, 8, 54, 22, 9, 54,
10, 64, 124, 11, 12, 137, 0, 54, 13, 65,
66, 67, 68, 69, 53, 0, 0, 54, 0, 0,
0, 0, 44, 55, 56, 0, 70, 45, 57, 58,
46, 0, 0, 0, 0, 59, 47, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 24, 0, 24, 0, 24, 0, 5, 8,
24, 24, 0, 0, 24, 24, 24, 24, 0, 0,
24, 24, 24, 14, 14, 24, 24, 14, 0, 24,
24, 5, 8,
const short yytable[] = { 81,
23, 93, 5, 8, 35, 56, 1, 108, 56, 28,
30, 31, 56, 33, 34, 113, 61, 62, 23, 117,
8, 1, 24, 15, 123, 49, 70, 71, 14, 60,
21, 13, 42, 1, 124, 14, 8, 118, 50, 41,
56, 70, 71, 8, 98, 36, 36, 129, 36, 25,
75, 90, 91, 80, 82, 77, 70, 71, 83, 70,
71, 25, 85, 106, 107, 86, 109, 110, 87, 88,
135, 94, 45, 105, 89, 139, 147, 46, 149, 73,
74, 111, 36, 36, 36, 26, 95, 136, 97, 32,
112, 119, 26, 72, 73, 74, 84, 73, 74, 125,
114, 127, 122, 126, 26, 26, 45, 45, 45, 148,
76, 46, 46, 46, 131, 128, 130, 132, 43, 134,
142, 143, 141, 44, 144, 137, 45, 138, 63, 145,
92, 14, 46, 146, 151, 152, 64, 65, 66, 67,
68, 8, 47, 14, 99, 100, 101, 102, 103, 104,
72, 26, 26, 69, 26, 26, 55, 55, 43, 55,
55, 55, 55, 44, 50, 55, 45, 78, 55, 22,
55, 133, 46, 121, 55, 58, 56, 56, 0, 53,
58, 0, 53, 58, 56, 0, 0, 0, 0, 58,
53, 0, 0, 55, 55, 55, 12, 0, 12, 58,
0, 0, 0, 0, 12, 12, 0, 0, 12, 12,
12, 12, 56, 0, 12, 12, 12, 0, 0, 12,
12, 1, 0, 2, 12, 0, 0, 0, 0, 3,
4, 0, 0, 5, 6, 7, 8, 0, 1, 9,
2, 10, 0, 0, 11, 12, 3, 4, 0, 13,
5, 21, 7, 8, 52, 0, 9, 53, 10, 0,
0, 11, 12, 54, 55, 0, 13, 0, 56, 57,
0, 0, 23, 0, 23, 58, 23, 0, 5, 8,
23, 23, 0, 0, 23, 23, 23, 23, 0, 0,
23, 23, 23, 14, 14, 23, 23, 14, 0, 23,
23, 5, 8,
};
const short yycheck[] = { 33,
0, 51, 0, 0, 30, 11, 0, 73, 257, 5,
6, 7, 261, 9, 10, 285, 82, 23, 24, 287,
86, 259, 260, 272, 262, 259, 260, 285, 262, 263,
264, 265, 300, 272, 268, 31, 291, 271, 88, 273,
0, 300, 272, 277, 290, 265, 259, 260, 114, 259,
260, 300, 48, 49, 300, 81, 16, 296, 296, 297,
298, 300, 296, 297, 298, 71, 72, 268, 74, 75,
300, 4, 122, 296, 70, 8, 265, 127, 11, 145,
296, 147, 78, 296, 297, 298, 296, 297, 298, 123,
23, 24, 291, 259, 260, 299, 29, 264, 300, 268,
299, 97, 263, 99, 275, 259, 260, 268, 262, 265,
271, 262, 146, 263, 264, 265, 277, 50, 268, 262,
273, 271, 272, 283, 265, 261, 287, 277, 124, 276,
126, 64, 65, 66, 67, 68, 69, 287, 71, 72,
265, 74, 75, 297, 298, 296, 297, 298, 296, 265,
300, 300, 268, 296, 297, 298, 272, 299, 272, 265,
274, 299, 299, 296, 276, 299, 280, 281, 278, 264,
284, 285, 286, 287, 262, 291, 290, 291, 292, 291,
265, 295, 296, 272, 300, 274, 300, 299, 301, 300,
299, 280, 281, 291, 299, 284, 285, 286, 287, 296,
272, 290, 274, 292, 265, 299, 295, 296, 280, 281,
81, 300, 284, 285, 286, 287, 262, 3, 290, 265,
292, 258, 92, 295, 296, 119, -1, 273, 300, 266,
267, 268, 269, 270, 279, -1, -1, 282, -1, -1,
-1, -1, 263, 288, 289, -1, 283, 268, 293, 294,
271, -1, -1, -1, -1, 300, 277, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 272, -1, 274, -1, 276, -1, 276, 276,
const short yycheck[] = { 32,
0, 50, 0, 0, 11, 265, 0, 72, 268, 5,
6, 7, 272, 9, 10, 80, 23, 24, 257, 84,
276, 272, 261, 0, 290, 287, 259, 260, 291, 300,
285, 291, 291, 272, 300, 291, 299, 86, 300, 16,
300, 259, 260, 299, 262, 259, 260, 112, 262, 300,
265, 47, 48, 296, 265, 268, 259, 260, 296, 259,
260, 300, 299, 70, 71, 264, 73, 74, 265, 300,
119, 273, 262, 69, 268, 124, 141, 262, 143, 297,
298, 77, 296, 297, 298, 4, 275, 120, 283, 8,
265, 261, 11, 296, 297, 298, 296, 297, 298, 95,
276, 97, 265, 296, 23, 24, 296, 297, 298, 142,
29, 296, 297, 298, 300, 299, 299, 299, 263, 299,
278, 264, 296, 268, 262, 121, 271, 123, 258, 265,
49, 300, 277, 301, 299, 299, 266, 267, 268, 269,
270, 265, 287, 291, 63, 64, 65, 66, 67, 68,
296, 70, 71, 283, 73, 74, 259, 260, 263, 262,
263, 264, 265, 268, 299, 268, 271, 30, 271, 3,
273, 116, 277, 90, 277, 263, 264, 265, -1, 262,
268, -1, 265, 271, 272, -1, -1, -1, -1, 277,
273, -1, -1, 296, 297, 298, 272, -1, 274, 287,
-1, -1, -1, -1, 280, 281, -1, -1, 284, 285,
286, 287, 300, -1, 290, 291, 292, -1, -1, 295,
296, 272, -1, 274, 300, -1, -1, -1, -1, 280,
281, -1, -1, 284, 285, 286, 287, -1, 272, 290,
274, 292, -1, -1, 295, 296, 280, 281, -1, 300,
284, 285, 286, 287, 279, -1, 290, 282, 292, -1,
-1, 295, 296, 288, 289, -1, 300, -1, 293, 294,
-1, -1, 272, -1, 274, 300, 276, -1, 276, 276,
280, 281, -1, -1, 284, 285, 286, 287, -1, -1,
290, 291, 292, 291, 291, 295, 296, 291, -1, 299,
300, 299, 299,
@@ -289,7 +288,6 @@ const char * const yyrule[] = {
"rule : INCLUDE list _SEMIC",
"rule : ARG lol _SEMIC",
"rule : arg assign list _SEMIC",
"rule : MODULE LOCAL list assign_list_opt _SEMIC",
"rule : arg ON list assign list _SEMIC",
"rule : RETURN list _SEMIC",
"rule : FOR local_opt ARG IN list _LBRACE block _RBRACE",
@@ -572,298 +570,294 @@ yyreduce:
switch (yyn)
{
case 2:
#line 142 "jamgram.y"
#line 141 "jamgram.y"
{ parse_save( yyvsp[0].parse ); }
break;
case 3:
#line 153 "jamgram.y"
#line 152 "jamgram.y"
{ yyval.parse = yyvsp[0].parse; }
break;
case 4:
#line 155 "jamgram.y"
#line 154 "jamgram.y"
{ yyval.parse = yyvsp[0].parse; }
break;
case 5:
#line 159 "jamgram.y"
#line 158 "jamgram.y"
{ yyval.parse = yyvsp[0].parse; }
break;
case 6:
#line 161 "jamgram.y"
#line 160 "jamgram.y"
{ yyval.parse = prules( yyvsp[-1].parse, yyvsp[0].parse ); }
break;
case 7:
#line 163 "jamgram.y"
#line 162 "jamgram.y"
{ yyval.parse = plocal( yyvsp[-3].parse, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 8:
#line 167 "jamgram.y"
#line 166 "jamgram.y"
{ yyval.parse = pnull(); }
break;
case 9:
#line 171 "jamgram.y"
#line 170 "jamgram.y"
{ yyval.parse = yyvsp[0].parse; yyval.number = ASSIGN_SET; }
break;
case 10:
#line 173 "jamgram.y"
#line 172 "jamgram.y"
{ yyval.parse = yyvsp[0].parse; yyval.number = ASSIGN_APPEND; }
break;
case 11:
#line 177 "jamgram.y"
#line 176 "jamgram.y"
{ yyval.parse = yyvsp[-1].parse; }
break;
case 12:
#line 179 "jamgram.y"
#line 178 "jamgram.y"
{ yyval.parse = P0; }
break;
case 13:
#line 183 "jamgram.y"
#line 182 "jamgram.y"
{ yyval.number = 1; }
break;
case 14:
#line 185 "jamgram.y"
#line 184 "jamgram.y"
{ yyval.number = 0; }
break;
case 15:
#line 189 "jamgram.y"
#line 188 "jamgram.y"
{ yyval.parse = yyvsp[-1].parse; }
break;
case 16:
#line 191 "jamgram.y"
#line 190 "jamgram.y"
{ yyval.parse = pincl( yyvsp[-1].parse ); }
break;
case 17:
#line 193 "jamgram.y"
#line 192 "jamgram.y"
{ yyval.parse = prule( yyvsp[-2].string, yyvsp[-1].parse ); }
break;
case 18:
#line 195 "jamgram.y"
#line 194 "jamgram.y"
{ yyval.parse = pset( yyvsp[-3].parse, yyvsp[-1].parse, yyvsp[-2].number ); }
break;
case 19:
#line 197 "jamgram.y"
{ yyval.parse = psetmodule( yyvsp[-2].parse, yyvsp[-1].parse, yyvsp[-1].number ); }
break;
case 20:
#line 199 "jamgram.y"
#line 196 "jamgram.y"
{ yyval.parse = pset1( yyvsp[-5].parse, yyvsp[-3].parse, yyvsp[-1].parse, yyvsp[-2].number ); }
break;
case 21:
#line 201 "jamgram.y"
case 20:
#line 198 "jamgram.y"
{ yyval.parse = yyvsp[-1].parse; }
break;
case 22:
#line 203 "jamgram.y"
case 21:
#line 200 "jamgram.y"
{ yyval.parse = pfor( yyvsp[-5].string, yyvsp[-3].parse, yyvsp[-1].parse, yyvsp[-6].number ); }
break;
case 23:
#line 205 "jamgram.y"
case 22:
#line 202 "jamgram.y"
{ yyval.parse = pswitch( yyvsp[-3].parse, yyvsp[-1].parse ); }
break;
case 24:
#line 207 "jamgram.y"
case 23:
#line 204 "jamgram.y"
{ yyval.parse = pif( yyvsp[-3].parse, yyvsp[-1].parse, pnull() ); }
break;
case 25:
#line 209 "jamgram.y"
case 24:
#line 206 "jamgram.y"
{ yyval.parse = pmodule( yyvsp[-3].parse, yyvsp[-1].parse ); }
break;
case 26:
#line 211 "jamgram.y"
case 25:
#line 208 "jamgram.y"
{ yyval.parse = pwhile( yyvsp[-3].parse, yyvsp[-1].parse ); }
break;
case 27:
#line 213 "jamgram.y"
case 26:
#line 210 "jamgram.y"
{ yyval.parse = pif( yyvsp[-5].parse, yyvsp[-3].parse, yyvsp[0].parse ); }
break;
case 28:
#line 215 "jamgram.y"
case 27:
#line 212 "jamgram.y"
{ yyval.parse = psetc( yyvsp[-2].string, yyvsp[0].parse, yyvsp[-1].parse, yyvsp[-4].number ); }
break;
case 29:
#line 217 "jamgram.y"
case 28:
#line 214 "jamgram.y"
{ yyval.parse = pon( yyvsp[-1].parse, yyvsp[0].parse ); }
break;
case 30:
#line 219 "jamgram.y"
case 29:
#line 216 "jamgram.y"
{ yymode( SCAN_STRING ); }
break;
case 31:
#line 221 "jamgram.y"
case 30:
#line 218 "jamgram.y"
{ yymode( SCAN_NORMAL ); }
break;
case 32:
#line 223 "jamgram.y"
case 31:
#line 220 "jamgram.y"
{ yyval.parse = psete( yyvsp[-6].string,yyvsp[-5].parse,yyvsp[-2].string,yyvsp[-7].number ); }
break;
case 33:
#line 231 "jamgram.y"
case 32:
#line 228 "jamgram.y"
{ yyval.number = ASSIGN_SET; }
break;
case 34:
#line 233 "jamgram.y"
case 33:
#line 230 "jamgram.y"
{ yyval.number = ASSIGN_APPEND; }
break;
case 34:
#line 232 "jamgram.y"
{ yyval.number = ASSIGN_DEFAULT; }
break;
case 35:
#line 235 "jamgram.y"
#line 234 "jamgram.y"
{ yyval.number = ASSIGN_DEFAULT; }
break;
case 36:
#line 237 "jamgram.y"
{ yyval.number = ASSIGN_DEFAULT; }
break;
case 37:
#line 244 "jamgram.y"
#line 241 "jamgram.y"
{ yyval.parse = peval( EXPR_EXISTS, yyvsp[0].parse, pnull() ); }
break;
case 38:
#line 246 "jamgram.y"
case 37:
#line 243 "jamgram.y"
{ yyval.parse = peval( EXPR_EQUALS, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 39:
#line 248 "jamgram.y"
case 38:
#line 245 "jamgram.y"
{ yyval.parse = peval( EXPR_NOTEQ, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 40:
#line 250 "jamgram.y"
case 39:
#line 247 "jamgram.y"
{ yyval.parse = peval( EXPR_LESS, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 41:
#line 252 "jamgram.y"
case 40:
#line 249 "jamgram.y"
{ yyval.parse = peval( EXPR_LESSEQ, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 42:
#line 254 "jamgram.y"
case 41:
#line 251 "jamgram.y"
{ yyval.parse = peval( EXPR_MORE, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 43:
#line 256 "jamgram.y"
case 42:
#line 253 "jamgram.y"
{ yyval.parse = peval( EXPR_MOREEQ, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 44:
#line 258 "jamgram.y"
case 43:
#line 255 "jamgram.y"
{ yyval.parse = peval( EXPR_AND, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 45:
#line 260 "jamgram.y"
case 44:
#line 257 "jamgram.y"
{ yyval.parse = pshortcircuiteval( EXPR_AND, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 46:
#line 262 "jamgram.y"
case 45:
#line 259 "jamgram.y"
{ yyval.parse = peval( EXPR_OR, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 47:
#line 264 "jamgram.y"
case 46:
#line 261 "jamgram.y"
{ yyval.parse = pshortcircuiteval( EXPR_OR, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 48:
#line 266 "jamgram.y"
case 47:
#line 263 "jamgram.y"
{ yyval.parse = peval( EXPR_IN, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 49:
#line 268 "jamgram.y"
case 48:
#line 265 "jamgram.y"
{ yyval.parse = peval( EXPR_NOT, yyvsp[0].parse, pnull() ); }
break;
case 50:
#line 270 "jamgram.y"
case 49:
#line 267 "jamgram.y"
{ yyval.parse = yyvsp[-1].parse; }
break;
case 51:
#line 281 "jamgram.y"
case 50:
#line 278 "jamgram.y"
{ yyval.parse = P0; }
break;
case 52:
#line 283 "jamgram.y"
case 51:
#line 280 "jamgram.y"
{ yyval.parse = pnode( yyvsp[-1].parse, yyvsp[0].parse ); }
break;
case 53:
#line 287 "jamgram.y"
case 52:
#line 284 "jamgram.y"
{ yyval.parse = psnode( yyvsp[-2].string, yyvsp[0].parse ); }
break;
case 54:
#line 296 "jamgram.y"
case 53:
#line 293 "jamgram.y"
{ yyval.parse = pnode( P0, yyvsp[0].parse ); }
break;
case 55:
#line 298 "jamgram.y"
case 54:
#line 295 "jamgram.y"
{ yyval.parse = pnode( yyvsp[0].parse, yyvsp[-2].parse ); }
break;
case 56:
#line 308 "jamgram.y"
case 55:
#line 305 "jamgram.y"
{ yyval.parse = yyvsp[0].parse; yymode( SCAN_NORMAL ); }
break;
case 57:
#line 312 "jamgram.y"
case 56:
#line 309 "jamgram.y"
{ yyval.parse = pnull(); yymode( SCAN_PUNCT ); }
break;
case 58:
#line 314 "jamgram.y"
case 57:
#line 311 "jamgram.y"
{ yyval.parse = pappend( yyvsp[-1].parse, yyvsp[0].parse ); }
break;
case 59:
#line 318 "jamgram.y"
case 58:
#line 315 "jamgram.y"
{ yyval.parse = plist( yyvsp[0].string ); }
break;
case 60:
#line 319 "jamgram.y"
case 59:
#line 316 "jamgram.y"
{ yymode( SCAN_NORMAL ); }
break;
case 61:
#line 320 "jamgram.y"
case 60:
#line 317 "jamgram.y"
{ yyval.parse = yyvsp[-1].parse; }
break;
case 62:
#line 329 "jamgram.y"
case 61:
#line 326 "jamgram.y"
{ yyval.parse = prule( yyvsp[-1].string, yyvsp[0].parse ); }
break;
case 63:
#line 331 "jamgram.y"
case 62:
#line 328 "jamgram.y"
{ yyval.parse = pon( yyvsp[-2].parse, prule( yyvsp[-1].string, yyvsp[0].parse ) ); }
break;
case 64:
#line 333 "jamgram.y"
case 63:
#line 330 "jamgram.y"
{ yyval.parse = pon( yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 65:
#line 343 "jamgram.y"
case 64:
#line 340 "jamgram.y"
{ yyval.number = 0; }
break;
case 66:
#line 345 "jamgram.y"
case 65:
#line 342 "jamgram.y"
{ yyval.number = yyvsp[-1].number | yyvsp[0].number; }
break;
case 67:
#line 349 "jamgram.y"
case 66:
#line 346 "jamgram.y"
{ yyval.number = EXEC_UPDATED; }
break;
case 68:
#line 351 "jamgram.y"
case 67:
#line 348 "jamgram.y"
{ yyval.number = EXEC_TOGETHER; }
break;
case 69:
#line 353 "jamgram.y"
case 68:
#line 350 "jamgram.y"
{ yyval.number = EXEC_IGNORE; }
break;
case 70:
#line 355 "jamgram.y"
case 69:
#line 352 "jamgram.y"
{ yyval.number = EXEC_QUIETLY; }
break;
case 71:
#line 357 "jamgram.y"
case 70:
#line 354 "jamgram.y"
{ yyval.number = EXEC_PIECEMEAL; }
break;
case 72:
#line 359 "jamgram.y"
case 71:
#line 356 "jamgram.y"
{ yyval.number = EXEC_EXISTING; }
break;
case 73:
#line 368 "jamgram.y"
case 72:
#line 365 "jamgram.y"
{ yyval.parse = pnull(); }
break;
case 74:
#line 370 "jamgram.y"
case 73:
#line 367 "jamgram.y"
{ yyval.parse = yyvsp[0].parse; }
break;
#line 867 "y.tab.c"
#line 861 "y.tab.c"
}
yyssp -= yym;
yystate = *yyssp;

View File

@@ -123,7 +123,6 @@
# define prule( s,p ) parse_make( compile_rule,p,P0,P0,s,S0,0 )
# define prules( l,r ) parse_make( compile_rules,l,r,P0,S0,S0,0 )
# define pset( l,r,a ) parse_make( compile_set,l,r,P0,S0,S0,a )
# define psetmodule( l,r,a ) parse_make( compile_set_module,l,r,P0,S0,S0,a )
# define pset1( l,r,t,a ) parse_make( compile_settings,l,r,t,S0,S0,a )
# define psetc( s,p,a,l ) parse_make( compile_setcomp,p,a,P0,s,S0,l )
# define psete( s,l,s1,f ) parse_make( compile_setexec,l,P0,P0,s,s1,f )
@@ -193,8 +192,6 @@ rule : _LBRACE block _RBRACE
{ $$.parse = prule( $1.string, $2.parse ); }
| arg assign list _SEMIC
{ $$.parse = pset( $1.parse, $3.parse, $2.number ); }
| MODULE LOCAL list assign_list_opt _SEMIC
{ $$.parse = psetmodule( $3.parse, $4.parse, $4.number ); }
| arg ON list assign list _SEMIC
{ $$.parse = pset1( $1.parse, $3.parse, $5.parse, $4.number ); }
| RETURN list _SEMIC
@@ -311,7 +308,7 @@ list : listp
listp : /* empty */
{ $$.parse = pnull(); yymode( SCAN_PUNCT ); }
| listp arg
{ $$.parse = pappend( $1.parse, $2.parse ); }
{ $$.parse = pappend( $1.parse, $2.parse ); }
;
arg : ARG

View File

@@ -80,7 +80,6 @@
# define prule( s,p ) parse_make( compile_rule,p,P0,P0,s,S0,0 )
# define prules( l,r ) parse_make( compile_rules,l,r,P0,S0,S0,0 )
# define pset( l,r,a ) parse_make( compile_set,l,r,P0,S0,S0,a )
# define psetmodule( l,r,a ) parse_make( compile_set_module,l,r,P0,S0,S0,a )
# define pset1( l,r,t,a ) parse_make( compile_settings,l,r,t,S0,S0,a )
# define psetc( s,p,a,l ) parse_make( compile_setcomp,p,a,P0,s,S0,l )
# define psete( s,l,s1,f ) parse_make( compile_setexec,l,P0,P0,s,s1,f )
@@ -150,8 +149,6 @@ rule : `{` block `}`
{ $$.parse = prule( $1.string, $2.parse ); }
| arg assign list `;`
{ $$.parse = pset( $1.parse, $3.parse, $2.number ); }
| `module` `local` list assign_list_opt `;`
{ $$.parse = psetmodule( $3.parse, $4.parse, $4.number ); }
| arg `on` list assign list `;`
{ $$.parse = pset1( $1.parse, $3.parse, $5.parse, $4.number ); }
| `return` list `;`
@@ -268,7 +265,7 @@ list : listp
listp : /* empty */
{ $$.parse = pnull(); yymode( SCAN_PUNCT ); }
| listp arg
{ $$.parse = pappend( $1.parse, $2.parse ); }
{ $$.parse = pappend( $1.parse, $2.parse ); }
;
arg : ARG

View File

@@ -5,4 +5,4 @@ rm -rf bin.ntx86/jam.exe bin.ntx86/*.obj bin.ntx86/*.lib
set BOOST_ROOT=
set BOOST_BUILD_PATH=
set JAMBASE=
nmake -fbuilds/win32-visualc.mk JAMBASE= BOOST_ROOT= BOOST_BUILD_PATH= CFLAGS="/GZ /Zi /MLd -DNT" CCFLAGS="/GZ /Zi /MLd" LINKLIBS="c:\tools\msvc6\vc98\lib\advapi32.lib c:\tools\msvc6\vc98\lib\oldnames.lib c:\tools\msvc6\vc98\lib\gdi32.lib c:\tools\msvc6\vc98\lib\user32.lib c:\tools\msvc6\vc98\lib\kernel32.lib" LINKFLAGS="/DEBUG" YACC="byacc" YACCFILES="y.tab" YACCFLAGS=-vd %*
nmake -fbuilds/win32-visualc.mk JAMBASE= BOOST_ROOT= BOOST_BUILD_PATH= CFLAGS="/GZ /Zi /MLd -DNT -DYYDEBUG" CCFLAGS="/GZ /Zi /MLd -DYYDEBUG" LINKLIBS="c:\tools\msvc6\vc98\lib\advapi32.lib c:\tools\msvc6\vc98\lib\oldnames.lib c:\tools\msvc6\vc98\lib\gdi32.lib c:\tools\msvc6\vc98\lib\user32.lib c:\tools\msvc6\vc98\lib\kernel32.lib" LINKFLAGS="/DEBUG" YACC="byacc" YACCFILES="y.tab" YACCFLAGS=-vd %*

View File

@@ -47,8 +47,7 @@ module* bindmodule( char* name )
if ( hashenter( module_hash, (HASHDATA **)&m ) )
{
m->name = newstr( m->name );
m->local_names = 0;
m->locals = 0;
m->variables = 0;
m->rules = hashinit( sizeof( RULE ), new_module_str( m, "rules" ) );
}
string_free( &s );
@@ -63,33 +62,12 @@ module* root_module()
return root;
}
/*
* bind_module_var --
*
* Add the symbol to the module's list of symbols if it is not already in the
* module. m is assumed to be the current module and if the symbol is new, any
* current value is replaced by an empty list until the module is exited.
*
*/
void bind_module_var( module* m, char* symbol )
{
char** name = &symbol;
if ( !m->local_names )
m->local_names = hashinit( sizeof( char* ), new_module_str( m, "variables" ) );
if ( hashenter( m->local_names, (HASHDATA **)&name ) )
{
m->locals = addsettings( m->locals, 0, symbol, var_swap( symbol, 0 ) );
}
}
void enter_module( module* m )
{
pushsettings( m->locals );
var_hash_swap( &m->variables );
}
void exit_module( module* m )
{
popsettings( m->locals );
var_hash_swap( &m->variables );
}

View File

@@ -10,8 +10,7 @@ struct module
{
char* name;
struct hash* rules;
struct hash* local_names;
struct _settings* locals;
struct hash* variables;
};
typedef struct module module; /* MSVC debugger gets confused unless this is provided */

View File

@@ -21,6 +21,7 @@
# include "filesys.h"
# include "newstr.h"
# include "strings.h"
# include <stdlib.h>
/*
* variable.c - handle jam multi-element variables
@@ -64,6 +65,18 @@ static void var_dump( char *symbol, LIST *value, char *what );
/*
* var_hash_swap() - swap all variable settings with those passed
*
* Used to implement separate settings spaces for modules
*/
void var_hash_swap( struct hash** new_vars )
{
struct hash* old = varhash;
varhash = *new_vars;
*new_vars = old;
}
/*
* var_defines() - load a bunch of variable=value settings
*
@@ -269,7 +282,7 @@ var_set(
if( DEBUG_VARSET )
var_dump( symbol, value, "set" );
switch( flag )
{
case VAR_SET:

View File

@@ -14,6 +14,7 @@ LIST * var_get( char *symbol );
void var_set( char *symbol, LIST *value, int flag );
LIST * var_swap( char *symbol, LIST *value );
void var_done();
void var_hash_swap( struct hash** );
/*
* Defines for var_set().

View File

@@ -277,7 +277,10 @@ compile_foreach(
}
if ( parse->num )
{
popsettings( s );
freesettings( s );
}
list_free( nv );
@@ -751,7 +754,16 @@ evaluate_rule(
profile_frame prof[1];
module *prev_module = frame->module;
LIST* l = var_expand( L0, rulename, rulename+strlen(rulename), frame->args, 0 );
LIST *l;
{
LOL arg_context_, *arg_context = &arg_context_;
if ( !frame->prev )
lol_init(arg_context);
else
arg_context = frame->prev->args;
l = var_expand( L0, rulename, rulename+strlen(rulename), arg_context, 0 );
}
if ( !l )
{
@@ -895,7 +907,7 @@ compile_set(
LIST *nt = parse_evaluate( parse->left, frame );
LIST *ns = parse_evaluate( parse->right, frame );
LIST *l;
int setflag;
int setflag;
char *trace;
switch( parse->num )
@@ -909,6 +921,7 @@ compile_set(
if( DEBUG_COMPILE )
{
debug_compile( 0, "set", frame);
printf( frame->module->name );
list_print( nt );
printf( " %s ", trace );
list_print( ns );
@@ -926,54 +939,6 @@ compile_set(
return ns;
}
/*
* compile_set_module() - compile the "module local set variable" statement
*
* parse->left variable names
* parse->right variable values
*/
LIST *
compile_set_module(
PARSE *parse,
FRAME *frame )
{
LIST *nt = parse_evaluate( parse->left, frame );
LIST *ns = parse_evaluate( parse->right, frame );
LIST *l;
int setflag;
char *trace;
switch( parse->num )
{
case ASSIGN_SET: setflag = VAR_SET; trace = "="; break;
default: setflag = VAR_APPEND; trace = ""; break;
}
if( DEBUG_COMPILE )
{
debug_compile( 0, "set module", frame);
printf( "(%s)", frame->module->name );
list_print( nt );
printf( " %s ", trace );
list_print( ns );
printf( "\n" );
}
/* Call var_set to set variable */
/* var_set keeps ns, so need to copy it */
for( l = nt; l; l = list_next( l ) )
{
bind_module_var( frame->module, l->string );
var_set( l->string, list_copy( L0, ns ), setflag );
}
list_free( nt );
return ns;
}
/*
* compile_setcomp() - support for `rule` - save parse tree
*

View File

@@ -38,7 +38,6 @@ LIST *compile_on( PARSE *parse, FRAME *frame );
LIST *compile_rule( PARSE *parse, FRAME *frame );
LIST *compile_rules( PARSE *parse, FRAME *frame );
LIST *compile_set( PARSE *parse, FRAME *frame );
LIST *compile_set_module( PARSE *parse, FRAME *frame );
LIST *compile_setcomp( PARSE *parse, FRAME *frame );
LIST *compile_setexec( PARSE *parse, FRAME *frame );
LIST *compile_settings( PARSE *parse, FRAME *frame );

View File

@@ -41,7 +41,6 @@ static int yygrowstack();
# define prule( s,p ) parse_make( compile_rule,p,P0,P0,s,S0,0 )
# define prules( l,r ) parse_make( compile_rules,l,r,P0,S0,S0,0 )
# define pset( l,r,a ) parse_make( compile_set,l,r,P0,S0,S0,a )
# define psetmodule( l,r,a ) parse_make( compile_set_module,l,r,P0,S0,S0,a )
# define pset1( l,r,t,a ) parse_make( compile_settings,l,r,t,S0,S0,a )
# define psetc( s,p,a,l ) parse_make( compile_setcomp,p,a,P0,s,S0,l )
# define psete( s,l,s1,f ) parse_make( compile_setexec,l,P0,P0,s,s1,f )
@@ -50,7 +49,7 @@ static int yygrowstack();
# define pnode( l,r ) parse_make( F0,l,r,P0,S0,S0,0 )
# define psnode( s,l ) parse_make( F0,l,P0,P0,s,S0,0 )
#line 54 "y.tab.c"
#line 53 "y.tab.c"
#define YYERRCODE 256
#define _BANG 257
#define _BANG_EQUALS 258
@@ -100,150 +99,150 @@ static int yygrowstack();
const short yylhs[] = { -1,
0, 0, 2, 2, 1, 1, 1, 3, 6, 6,
7, 7, 9, 9, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 16,
17, 4, 11, 11, 11, 11, 13, 13, 13, 13,
13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
12, 12, 18, 8, 8, 5, 19, 19, 10, 21,
10, 20, 20, 20, 14, 14, 22, 22, 22, 22,
22, 22, 15, 15,
4, 4, 4, 4, 4, 4, 4, 4, 16, 17,
4, 11, 11, 11, 11, 13, 13, 13, 13, 13,
13, 13, 13, 13, 13, 13, 13, 13, 13, 12,
12, 18, 8, 8, 5, 19, 19, 10, 21, 10,
20, 20, 20, 14, 14, 22, 22, 22, 22, 22,
22, 15, 15,
};
const short yylen[] = { 2,
0, 1, 1, 1, 1, 2, 5, 0, 2, 1,
3, 0, 1, 0, 3, 3, 3, 4, 5, 6,
3, 8, 5, 5, 5, 5, 7, 5, 3, 0,
0, 9, 1, 1, 1, 2, 1, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 2, 3,
0, 2, 4, 1, 3, 1, 0, 2, 1, 0,
4, 2, 4, 4, 0, 2, 1, 1, 1, 1,
1, 1, 0, 2,
3, 0, 1, 0, 3, 3, 3, 4, 6, 3,
8, 5, 5, 5, 5, 7, 5, 3, 0, 0,
9, 1, 1, 1, 2, 1, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 2, 3, 0,
2, 4, 1, 3, 1, 0, 2, 1, 0, 4,
2, 4, 4, 0, 2, 1, 1, 1, 1, 1,
1, 0, 2,
};
const short yydefred[] = { 0,
60, 65, 0, 0, 57, 0, 0, 0, 57, 57,
59, 64, 0, 0, 56, 0, 56, 0, 56, 56,
0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
13, 0, 0, 0, 59, 0, 0, 0, 0, 0,
57, 0, 0, 0, 0, 0, 4, 0, 3, 0,
0, 6, 0, 34, 33, 35, 0, 57, 57, 0,
57, 0, 72, 69, 71, 70, 68, 67, 0, 66,
0, 49, 0, 0, 0, 0, 0, 0, 0, 57,
0, 0, 0, 0, 0, 16, 58, 57, 10, 0,
0, 0, 29, 21, 0, 0, 15, 57, 17, 0,
36, 0, 0, 0, 62, 61, 57, 0, 57, 50,
39, 40, 41, 38, 42, 43, 48, 44, 45, 0,
0, 0, 9, 0, 0, 0, 0, 0, 0, 0,
55, 57, 0, 57, 18, 57, 57, 74, 30, 0,
0, 7, 19, 25, 0, 23, 52, 26, 0, 28,
0, 64, 63, 0, 0, 0, 0, 11, 20, 31,
0, 27, 53, 0, 22, 32,
13, 0, 0, 0, 58, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 4, 0, 3, 0, 0,
6, 0, 33, 32, 34, 0, 56, 56, 0, 56,
0, 71, 68, 70, 69, 67, 66, 0, 65, 0,
48, 0, 0, 0, 0, 0, 0, 0, 56, 0,
0, 0, 0, 0, 16, 57, 56, 10, 0, 0,
28, 20, 0, 0, 15, 56, 17, 0, 35, 0,
0, 0, 61, 60, 56, 0, 56, 49, 38, 39,
40, 37, 41, 42, 47, 43, 44, 0, 0, 0,
9, 0, 0, 0, 0, 0, 0, 54, 56, 0,
56, 18, 56, 56, 73, 29, 0, 0, 7, 24,
0, 22, 51, 25, 0, 27, 0, 63, 62, 0,
0, 0, 0, 11, 19, 30, 0, 26, 52, 0,
21, 31,
};
const short yydgoto[] = { 14,
37, 38, 39, 16, 40, 80, 123, 41, 17, 18,
49, 118, 27, 20, 98, 144, 154, 119, 29, 52,
19, 60,
36, 37, 38, 16, 39, 79, 120, 40, 17, 18,
48, 115, 27, 20, 96, 140, 150, 116, 29, 51,
19, 59,
};
const short yysindex[] = { -88,
0, 0, -269, -248, 0, 0, -257, -229, 0, 0,
-248, -88, 0, 0, 0, -88, -254, -160, -267, -44,
0, -258, -248, -248, 0, -36, -212, -219, -229, -200,
0, -222, -71, -188, -215, -209, 0, -203, 0, -166,
-155, 0, -201, 0, 0, 0, -168, 0, 0, -229,
0, -152, 0, 0, 0, 0, 0, 0, -170, 0,
-159, 0, -153, -229, -229, -229, -229, -229, -229, 0,
-248, -248, -88, -248, -248, 0, 0, 0, 0, -140,
-200, -88, 0, 0, -146, -88, 0, 0, 0, -135,
0, -20, -124, -245, 0, 0, 0, -147, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, -141,
-165, -165, 0, -88, -105, -137, -148, -136, -146, -133,
0, 0, -71, 0, 0, 0, 0, 0, 0, -132,
-109, 0, 0, 0, -94, 0, 0, 0, -87, 0,
-84, 0, 0, -112, -88, -71, -88, 0, 0, 0,
-108, 0, 0, -104, 0, 0,
const short yysindex[] = { -50,
0, 0, -254, -238, 0, 0, 0, -250, 0, 0,
-238, -50, 0, 0, 0, -50, -258, -144, -261, -24,
0, -270, -238, -238, 0, -129, -202, -214, -250, -212,
-242, -33, -210, -237, -199, 0, -236, 0, -198, -196,
0, -230, 0, 0, 0, -193, 0, 0, -250, 0,
-201, 0, 0, 0, 0, 0, 0, -188, 0, -194,
0, -217, -250, -250, -250, -250, -250, -250, 0, -238,
-238, -50, -238, -238, 0, 0, 0, 0, -174, -50,
0, 0, -175, -50, 0, 0, 0, -169, 0, -104,
-162, -265, 0, 0, 0, -192, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, -183, -232, -232,
0, -50, -182, -185, -181, -175, -179, 0, 0, -33,
0, 0, 0, 0, 0, 0, -173, -157, 0, 0,
-142, 0, 0, 0, -137, 0, -135, 0, 0, -167,
-50, -33, -50, 0, 0, 0, -164, 0, 0, -163,
0, 0,
};
const short yyrindex[] = { 7,
0, 0, -110, 0, 0, -115, -238, 0, 0, 0,
0, -198, -149, 0, 0, 3, 0, 0, 0, 0,
0, 0, 0, 0, 0, -237, 0, 0, -233, -60,
0, 0, -97, 0, 0, 0, 0, 0, 0, -45,
0, 0, -168, 0, 0, -259, 0, 0, 0, 0,
0, -262, -87, 0, 0, 3, 0, 0, 0, 0,
0, 0, 0, 0, 0, -213, 0, 0, -102, -123,
0, -147, 0, 0, 0, 0, 0, 0, -82, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, -96, 0,
0, 0, 0, 0, 0, 0, 0, -145, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, -198, 0, 0, 0, 0, 0, 0, 0,
-60, -198, 0, 0, -93, -198, 0, 0, 0, -113,
0, -262, 0, 0, 0, 0, 0, 0, 0, -262,
0, 0, -134, -262, 0, 0, 0, -75, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, -189, -184,
0, 4, 0, 0, 0, -134, 0, 0, 0, -147,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-150, -142, 0, 4, 0, 0, 0, 0, -93, 0,
0, 0, -97, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, -198, -97, -111, 0, 0, 0,
0, 0, 0, 0, 0, 0,
-262, -147, -255, 0, 0, 0, 0, 0, 0, 0,
0, 0,
};
const short yygindex[] = { 0,
41, -65, -25, -33, 5, 130, 0, -49, 215, 68,
131, 107, -5, 0, 0, 0, 0, 0, 0, 0,
24, -64, 138, -32, 5, 0, 0, -48, 167, 82,
84, 56, -6, 0, 0, 0, 0, 0, 0, 0,
0, 0,
};
#define YYTABLESIZE 303
const short yytable[] = { 83,
24, 95, 5, 8, 79, 36, 1, 110, 23, 28,
30, 32, 24, 34, 35, 21, 116, 62, 63, 50,
120, 37, 37, 1, 37, 56, 56, 31, 56, 56,
56, 56, 51, 57, 56, 81, 43, 56, 121, 56,
15, 61, 1, 56, 126, 76, 71, 72, 132, 71,
72, 25, 92, 93, 127, 79, 42, 57, 37, 37,
37, 57, 56, 56, 56, 108, 109, 78, 111, 112,
25, 26, 139, 82, 107, 33, 84, 143, 26, 151,
85, 153, 113, 73, 74, 75, 86, 74, 75, 140,
26, 26, 14, 71, 72, 87, 77, 88, 90, 91,
8, 128, 44, 130, 97, 71, 72, 45, 100, 89,
46, 46, 152, 59, 57, 57, 47, 94, 59, 47,
96, 59, 57, 99, 114, 122, 48, 59, 141, 117,
142, 101, 102, 103, 104, 105, 106, 59, 26, 26,
125, 26, 26, 74, 75, 46, 46, 46, 129, 57,
57, 135, 57, 47, 47, 47, 57, 131, 12, 133,
12, 134, 136, 145, 8, 138, 12, 12, 146, 147,
12, 12, 12, 12, 148, 13, 12, 12, 12, 14,
149, 12, 12, 1, 57, 2, 12, 8, 150, 14,
155, 3, 4, 14, 156, 5, 6, 7, 8, 73,
1, 9, 2, 10, 8, 51, 11, 12, 3, 4,
115, 13, 5, 21, 7, 8, 54, 22, 9, 54,
10, 64, 124, 11, 12, 137, 0, 54, 13, 65,
66, 67, 68, 69, 53, 0, 0, 54, 0, 0,
0, 0, 44, 55, 56, 0, 70, 45, 57, 58,
46, 0, 0, 0, 0, 59, 47, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 24, 0, 24, 0, 24, 0, 5, 8,
24, 24, 0, 0, 24, 24, 24, 24, 0, 0,
24, 24, 24, 14, 14, 24, 24, 14, 0, 24,
24, 5, 8,
const short yytable[] = { 81,
23, 93, 5, 8, 35, 56, 1, 108, 56, 28,
30, 31, 56, 33, 34, 113, 61, 62, 23, 117,
8, 1, 24, 15, 123, 49, 70, 71, 14, 60,
21, 13, 42, 1, 124, 14, 8, 118, 50, 41,
56, 70, 71, 8, 98, 36, 36, 129, 36, 25,
75, 90, 91, 80, 82, 77, 70, 71, 83, 70,
71, 25, 85, 106, 107, 86, 109, 110, 87, 88,
135, 94, 45, 105, 89, 139, 147, 46, 149, 73,
74, 111, 36, 36, 36, 26, 95, 136, 97, 32,
112, 119, 26, 72, 73, 74, 84, 73, 74, 125,
114, 127, 122, 126, 26, 26, 45, 45, 45, 148,
76, 46, 46, 46, 131, 128, 130, 132, 43, 134,
142, 143, 141, 44, 144, 137, 45, 138, 63, 145,
92, 14, 46, 146, 151, 152, 64, 65, 66, 67,
68, 8, 47, 14, 99, 100, 101, 102, 103, 104,
72, 26, 26, 69, 26, 26, 55, 55, 43, 55,
55, 55, 55, 44, 50, 55, 45, 78, 55, 22,
55, 133, 46, 121, 55, 58, 56, 56, 0, 53,
58, 0, 53, 58, 56, 0, 0, 0, 0, 58,
53, 0, 0, 55, 55, 55, 12, 0, 12, 58,
0, 0, 0, 0, 12, 12, 0, 0, 12, 12,
12, 12, 56, 0, 12, 12, 12, 0, 0, 12,
12, 1, 0, 2, 12, 0, 0, 0, 0, 3,
4, 0, 0, 5, 6, 7, 8, 0, 1, 9,
2, 10, 0, 0, 11, 12, 3, 4, 0, 13,
5, 21, 7, 8, 52, 0, 9, 53, 10, 0,
0, 11, 12, 54, 55, 0, 13, 0, 56, 57,
0, 0, 23, 0, 23, 58, 23, 0, 5, 8,
23, 23, 0, 0, 23, 23, 23, 23, 0, 0,
23, 23, 23, 14, 14, 23, 23, 14, 0, 23,
23, 5, 8,
};
const short yycheck[] = { 33,
0, 51, 0, 0, 30, 11, 0, 73, 257, 5,
6, 7, 261, 9, 10, 285, 82, 23, 24, 287,
86, 259, 260, 272, 262, 259, 260, 285, 262, 263,
264, 265, 300, 272, 268, 31, 291, 271, 88, 273,
0, 300, 272, 277, 290, 265, 259, 260, 114, 259,
260, 300, 48, 49, 300, 81, 16, 296, 296, 297,
298, 300, 296, 297, 298, 71, 72, 268, 74, 75,
300, 4, 122, 296, 70, 8, 265, 127, 11, 145,
296, 147, 78, 296, 297, 298, 296, 297, 298, 123,
23, 24, 291, 259, 260, 299, 29, 264, 300, 268,
299, 97, 263, 99, 275, 259, 260, 268, 262, 265,
271, 262, 146, 263, 264, 265, 277, 50, 268, 262,
273, 271, 272, 283, 265, 261, 287, 277, 124, 276,
126, 64, 65, 66, 67, 68, 69, 287, 71, 72,
265, 74, 75, 297, 298, 296, 297, 298, 296, 265,
300, 300, 268, 296, 297, 298, 272, 299, 272, 265,
274, 299, 299, 296, 276, 299, 280, 281, 278, 264,
284, 285, 286, 287, 262, 291, 290, 291, 292, 291,
265, 295, 296, 272, 300, 274, 300, 299, 301, 300,
299, 280, 281, 291, 299, 284, 285, 286, 287, 296,
272, 290, 274, 292, 265, 299, 295, 296, 280, 281,
81, 300, 284, 285, 286, 287, 262, 3, 290, 265,
292, 258, 92, 295, 296, 119, -1, 273, 300, 266,
267, 268, 269, 270, 279, -1, -1, 282, -1, -1,
-1, -1, 263, 288, 289, -1, 283, 268, 293, 294,
271, -1, -1, -1, -1, 300, 277, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 272, -1, 274, -1, 276, -1, 276, 276,
const short yycheck[] = { 32,
0, 50, 0, 0, 11, 265, 0, 72, 268, 5,
6, 7, 272, 9, 10, 80, 23, 24, 257, 84,
276, 272, 261, 0, 290, 287, 259, 260, 291, 300,
285, 291, 291, 272, 300, 291, 299, 86, 300, 16,
300, 259, 260, 299, 262, 259, 260, 112, 262, 300,
265, 47, 48, 296, 265, 268, 259, 260, 296, 259,
260, 300, 299, 70, 71, 264, 73, 74, 265, 300,
119, 273, 262, 69, 268, 124, 141, 262, 143, 297,
298, 77, 296, 297, 298, 4, 275, 120, 283, 8,
265, 261, 11, 296, 297, 298, 296, 297, 298, 95,
276, 97, 265, 296, 23, 24, 296, 297, 298, 142,
29, 296, 297, 298, 300, 299, 299, 299, 263, 299,
278, 264, 296, 268, 262, 121, 271, 123, 258, 265,
49, 300, 277, 301, 299, 299, 266, 267, 268, 269,
270, 265, 287, 291, 63, 64, 65, 66, 67, 68,
296, 70, 71, 283, 73, 74, 259, 260, 263, 262,
263, 264, 265, 268, 299, 268, 271, 30, 271, 3,
273, 116, 277, 90, 277, 263, 264, 265, -1, 262,
268, -1, 265, 271, 272, -1, -1, -1, -1, 277,
273, -1, -1, 296, 297, 298, 272, -1, 274, 287,
-1, -1, -1, -1, 280, 281, -1, -1, 284, 285,
286, 287, 300, -1, 290, 291, 292, -1, -1, 295,
296, 272, -1, 274, 300, -1, -1, -1, -1, 280,
281, -1, -1, 284, 285, 286, 287, -1, 272, 290,
274, 292, -1, -1, 295, 296, 280, 281, -1, 300,
284, 285, 286, 287, 279, -1, 290, 282, 292, -1,
-1, 295, 296, 288, 289, -1, 300, -1, 293, 294,
-1, -1, 272, -1, 274, 300, 276, -1, 276, 276,
280, 281, -1, -1, 284, 285, 286, 287, -1, -1,
290, 291, 292, 291, 291, 295, 296, 291, -1, 299,
300, 299, 299,
@@ -289,7 +288,6 @@ const char * const yyrule[] = {
"rule : INCLUDE list _SEMIC",
"rule : ARG lol _SEMIC",
"rule : arg assign list _SEMIC",
"rule : MODULE LOCAL list assign_list_opt _SEMIC",
"rule : arg ON list assign list _SEMIC",
"rule : RETURN list _SEMIC",
"rule : FOR local_opt ARG IN list _LBRACE block _RBRACE",
@@ -572,298 +570,294 @@ yyreduce:
switch (yyn)
{
case 2:
#line 142 "jamgram.y"
#line 141 "jamgram.y"
{ parse_save( yyvsp[0].parse ); }
break;
case 3:
#line 153 "jamgram.y"
#line 152 "jamgram.y"
{ yyval.parse = yyvsp[0].parse; }
break;
case 4:
#line 155 "jamgram.y"
#line 154 "jamgram.y"
{ yyval.parse = yyvsp[0].parse; }
break;
case 5:
#line 159 "jamgram.y"
#line 158 "jamgram.y"
{ yyval.parse = yyvsp[0].parse; }
break;
case 6:
#line 161 "jamgram.y"
#line 160 "jamgram.y"
{ yyval.parse = prules( yyvsp[-1].parse, yyvsp[0].parse ); }
break;
case 7:
#line 163 "jamgram.y"
#line 162 "jamgram.y"
{ yyval.parse = plocal( yyvsp[-3].parse, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 8:
#line 167 "jamgram.y"
#line 166 "jamgram.y"
{ yyval.parse = pnull(); }
break;
case 9:
#line 171 "jamgram.y"
#line 170 "jamgram.y"
{ yyval.parse = yyvsp[0].parse; yyval.number = ASSIGN_SET; }
break;
case 10:
#line 173 "jamgram.y"
#line 172 "jamgram.y"
{ yyval.parse = yyvsp[0].parse; yyval.number = ASSIGN_APPEND; }
break;
case 11:
#line 177 "jamgram.y"
#line 176 "jamgram.y"
{ yyval.parse = yyvsp[-1].parse; }
break;
case 12:
#line 179 "jamgram.y"
#line 178 "jamgram.y"
{ yyval.parse = P0; }
break;
case 13:
#line 183 "jamgram.y"
#line 182 "jamgram.y"
{ yyval.number = 1; }
break;
case 14:
#line 185 "jamgram.y"
#line 184 "jamgram.y"
{ yyval.number = 0; }
break;
case 15:
#line 189 "jamgram.y"
#line 188 "jamgram.y"
{ yyval.parse = yyvsp[-1].parse; }
break;
case 16:
#line 191 "jamgram.y"
#line 190 "jamgram.y"
{ yyval.parse = pincl( yyvsp[-1].parse ); }
break;
case 17:
#line 193 "jamgram.y"
#line 192 "jamgram.y"
{ yyval.parse = prule( yyvsp[-2].string, yyvsp[-1].parse ); }
break;
case 18:
#line 195 "jamgram.y"
#line 194 "jamgram.y"
{ yyval.parse = pset( yyvsp[-3].parse, yyvsp[-1].parse, yyvsp[-2].number ); }
break;
case 19:
#line 197 "jamgram.y"
{ yyval.parse = psetmodule( yyvsp[-2].parse, yyvsp[-1].parse, yyvsp[-1].number ); }
break;
case 20:
#line 199 "jamgram.y"
#line 196 "jamgram.y"
{ yyval.parse = pset1( yyvsp[-5].parse, yyvsp[-3].parse, yyvsp[-1].parse, yyvsp[-2].number ); }
break;
case 21:
#line 201 "jamgram.y"
case 20:
#line 198 "jamgram.y"
{ yyval.parse = yyvsp[-1].parse; }
break;
case 22:
#line 203 "jamgram.y"
case 21:
#line 200 "jamgram.y"
{ yyval.parse = pfor( yyvsp[-5].string, yyvsp[-3].parse, yyvsp[-1].parse, yyvsp[-6].number ); }
break;
case 23:
#line 205 "jamgram.y"
case 22:
#line 202 "jamgram.y"
{ yyval.parse = pswitch( yyvsp[-3].parse, yyvsp[-1].parse ); }
break;
case 24:
#line 207 "jamgram.y"
case 23:
#line 204 "jamgram.y"
{ yyval.parse = pif( yyvsp[-3].parse, yyvsp[-1].parse, pnull() ); }
break;
case 25:
#line 209 "jamgram.y"
case 24:
#line 206 "jamgram.y"
{ yyval.parse = pmodule( yyvsp[-3].parse, yyvsp[-1].parse ); }
break;
case 26:
#line 211 "jamgram.y"
case 25:
#line 208 "jamgram.y"
{ yyval.parse = pwhile( yyvsp[-3].parse, yyvsp[-1].parse ); }
break;
case 27:
#line 213 "jamgram.y"
case 26:
#line 210 "jamgram.y"
{ yyval.parse = pif( yyvsp[-5].parse, yyvsp[-3].parse, yyvsp[0].parse ); }
break;
case 28:
#line 215 "jamgram.y"
case 27:
#line 212 "jamgram.y"
{ yyval.parse = psetc( yyvsp[-2].string, yyvsp[0].parse, yyvsp[-1].parse, yyvsp[-4].number ); }
break;
case 29:
#line 217 "jamgram.y"
case 28:
#line 214 "jamgram.y"
{ yyval.parse = pon( yyvsp[-1].parse, yyvsp[0].parse ); }
break;
case 30:
#line 219 "jamgram.y"
case 29:
#line 216 "jamgram.y"
{ yymode( SCAN_STRING ); }
break;
case 31:
#line 221 "jamgram.y"
case 30:
#line 218 "jamgram.y"
{ yymode( SCAN_NORMAL ); }
break;
case 32:
#line 223 "jamgram.y"
case 31:
#line 220 "jamgram.y"
{ yyval.parse = psete( yyvsp[-6].string,yyvsp[-5].parse,yyvsp[-2].string,yyvsp[-7].number ); }
break;
case 33:
#line 231 "jamgram.y"
case 32:
#line 228 "jamgram.y"
{ yyval.number = ASSIGN_SET; }
break;
case 34:
#line 233 "jamgram.y"
case 33:
#line 230 "jamgram.y"
{ yyval.number = ASSIGN_APPEND; }
break;
case 34:
#line 232 "jamgram.y"
{ yyval.number = ASSIGN_DEFAULT; }
break;
case 35:
#line 235 "jamgram.y"
#line 234 "jamgram.y"
{ yyval.number = ASSIGN_DEFAULT; }
break;
case 36:
#line 237 "jamgram.y"
{ yyval.number = ASSIGN_DEFAULT; }
break;
case 37:
#line 244 "jamgram.y"
#line 241 "jamgram.y"
{ yyval.parse = peval( EXPR_EXISTS, yyvsp[0].parse, pnull() ); }
break;
case 38:
#line 246 "jamgram.y"
case 37:
#line 243 "jamgram.y"
{ yyval.parse = peval( EXPR_EQUALS, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 39:
#line 248 "jamgram.y"
case 38:
#line 245 "jamgram.y"
{ yyval.parse = peval( EXPR_NOTEQ, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 40:
#line 250 "jamgram.y"
case 39:
#line 247 "jamgram.y"
{ yyval.parse = peval( EXPR_LESS, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 41:
#line 252 "jamgram.y"
case 40:
#line 249 "jamgram.y"
{ yyval.parse = peval( EXPR_LESSEQ, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 42:
#line 254 "jamgram.y"
case 41:
#line 251 "jamgram.y"
{ yyval.parse = peval( EXPR_MORE, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 43:
#line 256 "jamgram.y"
case 42:
#line 253 "jamgram.y"
{ yyval.parse = peval( EXPR_MOREEQ, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 44:
#line 258 "jamgram.y"
case 43:
#line 255 "jamgram.y"
{ yyval.parse = peval( EXPR_AND, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 45:
#line 260 "jamgram.y"
case 44:
#line 257 "jamgram.y"
{ yyval.parse = pshortcircuiteval( EXPR_AND, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 46:
#line 262 "jamgram.y"
case 45:
#line 259 "jamgram.y"
{ yyval.parse = peval( EXPR_OR, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 47:
#line 264 "jamgram.y"
case 46:
#line 261 "jamgram.y"
{ yyval.parse = pshortcircuiteval( EXPR_OR, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 48:
#line 266 "jamgram.y"
case 47:
#line 263 "jamgram.y"
{ yyval.parse = peval( EXPR_IN, yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 49:
#line 268 "jamgram.y"
case 48:
#line 265 "jamgram.y"
{ yyval.parse = peval( EXPR_NOT, yyvsp[0].parse, pnull() ); }
break;
case 50:
#line 270 "jamgram.y"
case 49:
#line 267 "jamgram.y"
{ yyval.parse = yyvsp[-1].parse; }
break;
case 51:
#line 281 "jamgram.y"
case 50:
#line 278 "jamgram.y"
{ yyval.parse = P0; }
break;
case 52:
#line 283 "jamgram.y"
case 51:
#line 280 "jamgram.y"
{ yyval.parse = pnode( yyvsp[-1].parse, yyvsp[0].parse ); }
break;
case 53:
#line 287 "jamgram.y"
case 52:
#line 284 "jamgram.y"
{ yyval.parse = psnode( yyvsp[-2].string, yyvsp[0].parse ); }
break;
case 54:
#line 296 "jamgram.y"
case 53:
#line 293 "jamgram.y"
{ yyval.parse = pnode( P0, yyvsp[0].parse ); }
break;
case 55:
#line 298 "jamgram.y"
case 54:
#line 295 "jamgram.y"
{ yyval.parse = pnode( yyvsp[0].parse, yyvsp[-2].parse ); }
break;
case 56:
#line 308 "jamgram.y"
case 55:
#line 305 "jamgram.y"
{ yyval.parse = yyvsp[0].parse; yymode( SCAN_NORMAL ); }
break;
case 57:
#line 312 "jamgram.y"
case 56:
#line 309 "jamgram.y"
{ yyval.parse = pnull(); yymode( SCAN_PUNCT ); }
break;
case 58:
#line 314 "jamgram.y"
case 57:
#line 311 "jamgram.y"
{ yyval.parse = pappend( yyvsp[-1].parse, yyvsp[0].parse ); }
break;
case 59:
#line 318 "jamgram.y"
case 58:
#line 315 "jamgram.y"
{ yyval.parse = plist( yyvsp[0].string ); }
break;
case 60:
#line 319 "jamgram.y"
case 59:
#line 316 "jamgram.y"
{ yymode( SCAN_NORMAL ); }
break;
case 61:
#line 320 "jamgram.y"
case 60:
#line 317 "jamgram.y"
{ yyval.parse = yyvsp[-1].parse; }
break;
case 62:
#line 329 "jamgram.y"
case 61:
#line 326 "jamgram.y"
{ yyval.parse = prule( yyvsp[-1].string, yyvsp[0].parse ); }
break;
case 63:
#line 331 "jamgram.y"
case 62:
#line 328 "jamgram.y"
{ yyval.parse = pon( yyvsp[-2].parse, prule( yyvsp[-1].string, yyvsp[0].parse ) ); }
break;
case 64:
#line 333 "jamgram.y"
case 63:
#line 330 "jamgram.y"
{ yyval.parse = pon( yyvsp[-2].parse, yyvsp[0].parse ); }
break;
case 65:
#line 343 "jamgram.y"
case 64:
#line 340 "jamgram.y"
{ yyval.number = 0; }
break;
case 66:
#line 345 "jamgram.y"
case 65:
#line 342 "jamgram.y"
{ yyval.number = yyvsp[-1].number | yyvsp[0].number; }
break;
case 67:
#line 349 "jamgram.y"
case 66:
#line 346 "jamgram.y"
{ yyval.number = EXEC_UPDATED; }
break;
case 68:
#line 351 "jamgram.y"
case 67:
#line 348 "jamgram.y"
{ yyval.number = EXEC_TOGETHER; }
break;
case 69:
#line 353 "jamgram.y"
case 68:
#line 350 "jamgram.y"
{ yyval.number = EXEC_IGNORE; }
break;
case 70:
#line 355 "jamgram.y"
case 69:
#line 352 "jamgram.y"
{ yyval.number = EXEC_QUIETLY; }
break;
case 71:
#line 357 "jamgram.y"
case 70:
#line 354 "jamgram.y"
{ yyval.number = EXEC_PIECEMEAL; }
break;
case 72:
#line 359 "jamgram.y"
case 71:
#line 356 "jamgram.y"
{ yyval.number = EXEC_EXISTING; }
break;
case 73:
#line 368 "jamgram.y"
case 72:
#line 365 "jamgram.y"
{ yyval.parse = pnull(); }
break;
case 74:
#line 370 "jamgram.y"
case 73:
#line 367 "jamgram.y"
{ yyval.parse = yyvsp[0].parse; }
break;
#line 867 "y.tab.c"
#line 861 "y.tab.c"
}
yyssp -= yym;
yystate = *yyssp;

View File

@@ -123,7 +123,6 @@
# define prule( s,p ) parse_make( compile_rule,p,P0,P0,s,S0,0 )
# define prules( l,r ) parse_make( compile_rules,l,r,P0,S0,S0,0 )
# define pset( l,r,a ) parse_make( compile_set,l,r,P0,S0,S0,a )
# define psetmodule( l,r,a ) parse_make( compile_set_module,l,r,P0,S0,S0,a )
# define pset1( l,r,t,a ) parse_make( compile_settings,l,r,t,S0,S0,a )
# define psetc( s,p,a,l ) parse_make( compile_setcomp,p,a,P0,s,S0,l )
# define psete( s,l,s1,f ) parse_make( compile_setexec,l,P0,P0,s,s1,f )
@@ -193,8 +192,6 @@ rule : _LBRACE block _RBRACE
{ $$.parse = prule( $1.string, $2.parse ); }
| arg assign list _SEMIC
{ $$.parse = pset( $1.parse, $3.parse, $2.number ); }
| MODULE LOCAL list assign_list_opt _SEMIC
{ $$.parse = psetmodule( $3.parse, $4.parse, $4.number ); }
| arg ON list assign list _SEMIC
{ $$.parse = pset1( $1.parse, $3.parse, $5.parse, $4.number ); }
| RETURN list _SEMIC
@@ -311,7 +308,7 @@ list : listp
listp : /* empty */
{ $$.parse = pnull(); yymode( SCAN_PUNCT ); }
| listp arg
{ $$.parse = pappend( $1.parse, $2.parse ); }
{ $$.parse = pappend( $1.parse, $2.parse ); }
;
arg : ARG

View File

@@ -80,7 +80,6 @@
# define prule( s,p ) parse_make( compile_rule,p,P0,P0,s,S0,0 )
# define prules( l,r ) parse_make( compile_rules,l,r,P0,S0,S0,0 )
# define pset( l,r,a ) parse_make( compile_set,l,r,P0,S0,S0,a )
# define psetmodule( l,r,a ) parse_make( compile_set_module,l,r,P0,S0,S0,a )
# define pset1( l,r,t,a ) parse_make( compile_settings,l,r,t,S0,S0,a )
# define psetc( s,p,a,l ) parse_make( compile_setcomp,p,a,P0,s,S0,l )
# define psete( s,l,s1,f ) parse_make( compile_setexec,l,P0,P0,s,s1,f )
@@ -150,8 +149,6 @@ rule : `{` block `}`
{ $$.parse = prule( $1.string, $2.parse ); }
| arg assign list `;`
{ $$.parse = pset( $1.parse, $3.parse, $2.number ); }
| `module` `local` list assign_list_opt `;`
{ $$.parse = psetmodule( $3.parse, $4.parse, $4.number ); }
| arg `on` list assign list `;`
{ $$.parse = pset1( $1.parse, $3.parse, $5.parse, $4.number ); }
| `return` list `;`
@@ -268,7 +265,7 @@ list : listp
listp : /* empty */
{ $$.parse = pnull(); yymode( SCAN_PUNCT ); }
| listp arg
{ $$.parse = pappend( $1.parse, $2.parse ); }
{ $$.parse = pappend( $1.parse, $2.parse ); }
;
arg : ARG

View File

@@ -5,4 +5,4 @@ rm -rf bin.ntx86/jam.exe bin.ntx86/*.obj bin.ntx86/*.lib
set BOOST_ROOT=
set BOOST_BUILD_PATH=
set JAMBASE=
nmake -fbuilds/win32-visualc.mk JAMBASE= BOOST_ROOT= BOOST_BUILD_PATH= CFLAGS="/GZ /Zi /MLd -DNT" CCFLAGS="/GZ /Zi /MLd" LINKLIBS="c:\tools\msvc6\vc98\lib\advapi32.lib c:\tools\msvc6\vc98\lib\oldnames.lib c:\tools\msvc6\vc98\lib\gdi32.lib c:\tools\msvc6\vc98\lib\user32.lib c:\tools\msvc6\vc98\lib\kernel32.lib" LINKFLAGS="/DEBUG" YACC="byacc" YACCFILES="y.tab" YACCFLAGS=-vd %*
nmake -fbuilds/win32-visualc.mk JAMBASE= BOOST_ROOT= BOOST_BUILD_PATH= CFLAGS="/GZ /Zi /MLd -DNT -DYYDEBUG" CCFLAGS="/GZ /Zi /MLd -DYYDEBUG" LINKLIBS="c:\tools\msvc6\vc98\lib\advapi32.lib c:\tools\msvc6\vc98\lib\oldnames.lib c:\tools\msvc6\vc98\lib\gdi32.lib c:\tools\msvc6\vc98\lib\user32.lib c:\tools\msvc6\vc98\lib\kernel32.lib" LINKFLAGS="/DEBUG" YACC="byacc" YACCFILES="y.tab" YACCFLAGS=-vd %*

View File

@@ -47,8 +47,7 @@ module* bindmodule( char* name )
if ( hashenter( module_hash, (HASHDATA **)&m ) )
{
m->name = newstr( m->name );
m->local_names = 0;
m->locals = 0;
m->variables = 0;
m->rules = hashinit( sizeof( RULE ), new_module_str( m, "rules" ) );
}
string_free( &s );
@@ -63,33 +62,12 @@ module* root_module()
return root;
}
/*
* bind_module_var --
*
* Add the symbol to the module's list of symbols if it is not already in the
* module. m is assumed to be the current module and if the symbol is new, any
* current value is replaced by an empty list until the module is exited.
*
*/
void bind_module_var( module* m, char* symbol )
{
char** name = &symbol;
if ( !m->local_names )
m->local_names = hashinit( sizeof( char* ), new_module_str( m, "variables" ) );
if ( hashenter( m->local_names, (HASHDATA **)&name ) )
{
m->locals = addsettings( m->locals, 0, symbol, var_swap( symbol, 0 ) );
}
}
void enter_module( module* m )
{
pushsettings( m->locals );
var_hash_swap( &m->variables );
}
void exit_module( module* m )
{
popsettings( m->locals );
var_hash_swap( &m->variables );
}

View File

@@ -10,8 +10,7 @@ struct module
{
char* name;
struct hash* rules;
struct hash* local_names;
struct _settings* locals;
struct hash* variables;
};
typedef struct module module; /* MSVC debugger gets confused unless this is provided */

View File

@@ -21,6 +21,7 @@
# include "filesys.h"
# include "newstr.h"
# include "strings.h"
# include <stdlib.h>
/*
* variable.c - handle jam multi-element variables
@@ -64,6 +65,18 @@ static void var_dump( char *symbol, LIST *value, char *what );
/*
* var_hash_swap() - swap all variable settings with those passed
*
* Used to implement separate settings spaces for modules
*/
void var_hash_swap( struct hash** new_vars )
{
struct hash* old = varhash;
varhash = *new_vars;
*new_vars = old;
}
/*
* var_defines() - load a bunch of variable=value settings
*
@@ -269,7 +282,7 @@ var_set(
if( DEBUG_VARSET )
var_dump( symbol, value, "set" );
switch( flag )
{
case VAR_SET:

View File

@@ -14,6 +14,7 @@ LIST * var_get( char *symbol );
void var_set( char *symbol, LIST *value, int flag );
LIST * var_swap( char *symbol, LIST *value );
void var_done();
void var_hash_swap( struct hash** );
/*
* Defines for var_set().

View File

@@ -15,6 +15,11 @@
# from the command-line is sufficiently complex to make using the borland
# approach impractical.
# Get these variable set on the targets so that we can re-use the
# build actions for other toolsets using this one as a base.
flags metrowerks METROWERKS_SETUP ;
flags metrowerks METROWERKS_LINK_SETUP ;
# if METROWERKS_ROOT is unset, this will "multiply away" to nothing.
METROWERKS_SETUP = "call "\"$(METROWERKS_ROOT)$(SLASH)"Other Metrowerks Tools"$(SLASH)"Command Line Tools"$(SLASH)cwenv.bat\"" -quiet" ;
METROWERKS_LINK_SETUP = "set MWWinx86LibraryFiles=" ;
@@ -75,8 +80,8 @@ flags metrowerks STDHDRS : $(METROWERKS_INCLUDE_ROOT)$(SLASH)$(gMETROWERKS_STD_I
rule Link-action
{
gRUN_PATH($(<)) += $(METROWERKS_ROOT)"\\Win32-X86 Support\\Libraries\\Runtime"
$(METROWERKS_ROOT)"\\Win32-X86 Support\\Libraries\\Runtime\\Libs\\MSL_ALL-DLLs" ;
gRUN_PATH($(<)) += $(METROWERKS_INCLUDE_ROOT)"\\Win32-X86 Support\\Libraries\\Runtime"
$(METROWERKS_INCLUDE_ROOT)"\\Win32-X86 Support\\Libraries\\Runtime\\Libs\\MSL_ALL-DLLs" ;
IMPLIB_COMMAND on $(<) = "-implib " ; # will be "multiplied away" if not
# needed.

View File

@@ -4,6 +4,7 @@
# warranty, and with no claim as to its suitability for any purpose.
import errors : error-skip-frames lol->list ;
import modules ;
# assert the equality of A and B
rule equal ( a * : b * )
@@ -21,8 +22,9 @@ rule result ( expected * : rule-name args * : * )
local result__ ;
module [ CALLER_MODULE ]
{
result__ = [
$(rule-name) $(args) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ] ;
ECHO "asserting" $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
modules.poke assert : result__
: [ $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ] ;
}
if $(result__) != $(expected)

View File

@@ -10,7 +10,9 @@ rule construct ( module-name )
{
}
JAMFILE ?= Jamfile ;
modules.load Jamfile : $(JAMFILE) : . ;
construct $(JAMFILE) ;
module
{
JAMFILE ?= Jamfile ;
modules.load Jamfile : $(JAMFILE) : . ;
build-system.construct $(JAMFILE) ;
}

View File

@@ -6,8 +6,9 @@
import numbers ;
import errors : * ;
import set ;
import modules ;
module local classes ;
classes = ;
# Declare a class with the given name. The caller should have defined
# a (local) rule called 'name' which acts as the new class'
@@ -25,35 +26,37 @@ rule class ( name : bases * )
# Each class is assigned a new module which acts as a namespace
# for its rules and normal instance variables.
# This is a record of the class' base classes
modules.poke class@$(name) : __bases__ : $(bases) ;
#modules.poke class@$(name) : __derived__ : ;
modules.poke class@$(name) : __name__ : $(name) ;
module class@$(name)
{
# This is a record of the class' base classes
module local __bases__ = $(bases) ;
module local __derived__ = ;
# always bring in the rules defined from this module, so that
# users can easily call "inherit", for example.
import class : * ;
# The constructor will be known as "__init__" in the class'
# namespace.
IMPORT [ CALLER_MODULE ] : $(name) : class@$(name) : __init__ ;
IMPORT [ CALLER_MODULE ] : $(__name__) : class@$(__name__) : __init__ ;
# Cause the __init__ function and all of the class modules
# rules to be visible to the builtin RULENAMES rule. We'll
# need them in order to implement subclasses and instances of
# the class.
EXPORT class@$(name) : __init__ # [ RULENAMES class ]
EXPORT class@$(__name__) : __init__ # [ RULENAMES class ]
;
# Bring the __init__ functions in from the base classes, using
# the optional localize parameter so that it will execute in
# the instance's module
for local base in $(bases)
for local base in $(__bases__)
{
# ECHO import __init__ from module class@$(base) into class@$(name) as $(base).__init__ ;
IMPORT class@$(base) : __init__ : class@$(name) : $(base).__init__ ;
EXPORT class@$(name) : $(base).__init__ ;
# ECHO import __init__ from module class@$(base) into class@$(__name__) as $(base).__init__ ;
IMPORT class@$(base) : __init__ : class@$(__name__) : $(base).__init__ ;
EXPORT class@$(__name__) : $(base).__init__ ;
module class@$(base)
{
# not using symbolic name "name" here because it might
@@ -74,26 +77,26 @@ rule instance ( name : class args * : * )
# import all of the rules from the class into the instance,
# using the optional localize parameter so that they execute
# in the instance's namespace.
local rules = [ RULENAMES class@$(class) ] ;
local rules = [ RULENAMES class@$(>[1]) ] ;
# ECHO instance $(name) inherits rules: $(rules) from class $(class) ;
IMPORT class@$(class) : $(rules) : $(name) : $(rules) : localize ;
IMPORT class@$(>[1]) : $(rules) : $(<) : $(rules) : localize ;
# Also import the instance's rules into the global module as
# <instance-name>.<rulename>
IMPORT $(name) : $(rules) : : $(name).$(rules) ;
IMPORT $(<) : $(rules) : : $(<).$(rules) ;
# Now initialize the instance
__init__ $(args) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
__init__ $(>[2]) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
# Make a record of the instance's class. We need to do this
# last because it will be set to each of the class' base
# classes as it is initialized.
module local __class__ = $(class) ;
__class__ = $(>[1]) ;
}
}
# Keeps track of the next unique object name to generate
module local next-instance = 1 ;
next-instance = 1 ;
# create a new uniquely-named instance of the given class, returning
# its name.
@@ -162,8 +165,8 @@ rule __test__ ( )
local rule myclass ( x_ * : y_ * )
{
# set some instance variables
module local x = $(x_) ;
module local y = $(y_) ;
x = $(x_) ;
y = $(y_) ;
rule set-x ( newx * )
{
@@ -212,7 +215,7 @@ rule __test__ ( )
local rule derived1 ( z_ )
{
myclass.__init__ $(z_) : X ;
module local z = $(z_) ;
z = $(z_) ;
# override g
rule g ( args * )

View File

@@ -44,8 +44,9 @@ rule backtrace ( skip-frames messages * : * )
}
}
module local args = messages 2 3 4 5 6 7 8 9 ;
module local disabled last-$(args) ;
args ?= messages 2 3 4 5 6 7 8 9 ;
disabled ?= ;
last-$(args) ?= ;
# try-catch --
#

View File

@@ -33,7 +33,7 @@ import sequence ;
import regex ;
import set ;
module local all-attributes =
all-attributes =
implicit # features whose values alone identify the
# feature. For example, a user is not required to
@@ -90,8 +90,8 @@ module local all-attributes =
# don't affect the built products at all.
;
module local all-features ;
module local all-implicit-values ;
all-features = ;
all-implicit-values = ;
# Transform features by bracketing any elements which aren't already
# bracketed by "<>"
@@ -101,7 +101,7 @@ local rule grist ( features * )
return $(empty:G=$(features)) ;
}
module local empty = "" ;
empty = "" ;
# declare a new feature with the given name, values, and attributes.
rule feature ( name : values * : attributes * )
@@ -135,10 +135,9 @@ rule feature ( name : values * : attributes * )
: feature [ errors.lol->list $(1) : $(2) : $(3) ] ;
}
module local $(name).values ;
module local $(name).attributes = $(attributes) ;
module local $(name).subfeatures = ;
module local $(attributes).features ;
$(name).values ?= ;
$(name).attributes = $(attributes) ;
$(name).subfeatures ?= ;
$(attributes).features += $(name) ;
all-features += $(name) ;
@@ -215,10 +214,6 @@ local rule find-implied-subfeature ( feature subvalue : value-string ? )
= subfeature($(feature),$(subvalue))
subfeature($(feature),$(value-string),$(subvalue)) ;
# declaring these module local here prevents us from picking up
# enclosing definitions.
module local $(v) ;
local subfeature = $($(v)) ;
return $(subfeature[1]) ;
}
@@ -304,7 +299,6 @@ local rule extend-feature ( feature : values * )
{
for local v in $(values)
{
module local $(v).implicit-feature ;
if $($(v).implicit-feature)
{
error $(v) is already associated with the \"$($(v).implicit-feature)\" feature ;
@@ -361,7 +355,7 @@ rule extend-subfeature ( feature value-string ? : subfeature : subvalues * )
local v
= subfeature($(feature),$(value-string),$(subvalue))
subfeature($(feature),$(subvalue)) ;
module local $(v[1]) = $(subfeature) ;
$(v[1]) = $(subfeature) ;
}
}
@@ -444,7 +438,7 @@ rule compose ( composite-property : component-properties * )
error "$(feature)" is not a composite feature ;
}
module local $(composite-property).components ;
$(composite-property).components ?= ;
if $($(composite-property).components)
{
error components of "$(composite-property)" already set:

View File

@@ -4,9 +4,9 @@
# warranty, and with no claim as to its suitability for any purpose.
# Keep a record so that no module is included multiple times
module local loaded-modules ;
module local loading-modules ;
module local untested ;
loaded-modules ?= ;
loading-modules ?= ;
untested ?= ;
# meant to be invoked from import when no __test__ rule is defined in a given
# module
@@ -21,6 +21,29 @@ rule binding ( module )
return $($(module).__binding__) ;
}
# Sets the module-local value of a variable. This is the most
# reliable way to set a module-local variable in a different module;
# it eliminates issues of name shadowing due to dynamic scoping.
rule poke ( module-name ? : variables + : value * )
{
module $(<)
{
$(>) = $(3) ;
}
}
# Returns the module-local value of a variable. This is the most
# reliable way to examine a module-local variable in a different
# module; it eliminates issues of name shadowing due to dynamic
# scoping.
rule peek ( module-name ? : variables + )
{
module $(<)
{
return $($(>)) ;
}
}
# load the indicated module if it is not already loaded.
rule load ( module-name : filename ? : search * )
{
@@ -32,29 +55,31 @@ rule load ( module-name : filename ? : search * )
local suppress-test = $(untested[1]) ; # suppress tests until all recursive loads are complete.
untested += $(module-name) ; # add the module to the stack of untested modules
poke $(module-name) : __name__ : $(module-name) ;
poke $(module-name) : __file__ : $(filename) ;
module $(module-name)
{
module local __name__ = $(module-name) ;
# Prepare a default behavior, in case no __test__ is defined.
IMPORT modules : no_test_defined : $(module-name) : __test__ ;
IMPORT modules : no_test_defined : $(__name__) : __test__ ;
# Add some grist so that the module will have a unique target name
local module-target = $(filename:G=module@) ;
local module-target = $(__file__:G=module@) ;
search ?= $(BOOST_BUILD_PATH) ;
SEARCH on $(module-target) = $(search) ;
search ?= [ modules.peek : BOOST_BUILD_PATH ] ;
SEARCH on $(module-target) = $(3) ;
BINDRULE on $(module-target) = modules.record-binding ;
include $(module-target) ;
}
loading-modules = $(loading-modules[1--2]) ;
if ! $(suppress-test) && $(BOOST_BUILD_TEST)-is-nonempty
local test = [ peek : BOOST_BUILD_TEST ] ;
if ! $(suppress-test) && $(test)-is-nonempty
{
# run any pending tests
for local m in $(untested)
{
if ( $(BOOST_BUILD_TEST) = 1 ) || ( $(m) in $(BOOST_BUILD_TEST) )
if ( $(test) = 1 ) || ( $(m) in $(test) )
{
ECHO testing module $(m)... ;
module $(m)
@@ -78,7 +103,7 @@ rule load ( module-name : filename ? : search * )
# each loaded module.
rule record-binding ( module-target : binding )
{
module local $(module-target:G=:S=).__binding__ = $(binding) ;
$(module-target:G=:S=).__binding__ = $(binding) ;
}
# load the indicated module and import rule names into the current
@@ -104,3 +129,18 @@ rule import ( module-name : rules-opt * : rename-opt * )
IMPORT $(module-name) : $(source-names) : [ CALLER_MODULE ] : $(target-names) ;
}
local rule __test__ ( )
{
import assert ;
module modules.__test__
{
foo = bar ;
}
assert.result bar : peek modules.__test__ : foo ;
poke modules.__test__ : foo : bar baz ;
assert.result bar baz : peek modules.__test__ : foo ;
}

View File

@@ -3,14 +3,14 @@
# all copies. This software is provided "as is" without express or implied
# warranty, and with no claim as to its suitability for any purpose.
module local digits = 0 1 2 3 4 5 6 7 8 9 ;
module local powers = 1 ;
module local zeros = "" ;
module local natural = $(digits) ;
module local positive = $(digits[2-]) ;
module local incr = $(positive[2-]) ;
module local znatural = $(digits) ;
module local zero-test = is zero ; # if $(zero-test[$(n)]) == "is" "zero", n == 0
digits = 0 1 2 3 4 5 6 7 8 9 ;
powers = 1 ;
zeros = "" ;
natural = $(digits) ;
positive = $(digits[2-]) ;
incr = $(positive[2-]) ;
znatural = $(digits) ;
zero-test = is zero ; # if $(zero-test[$(n)]) == "is" "zero", n == 0
import errors : * ;

View File

@@ -3,9 +3,9 @@
# all copies. This software is provided "as is" without express or implied
# warranty, and with no claim as to its suitability for any purpose.
module local name = $(OS) ;
module local platform = $(OSPLAT) ;
module local version = $(OSVER) ;
name = $(OS) ;
platform = $(OSPLAT) ;
version = $(OSVER) ;
rule name { return $(name) ; }
rule platform { return $(platform) ; }

View File

@@ -26,41 +26,9 @@ rule caller-file ( )
return $(bt[9]) ;
}
# Returns the module-local value of a variable. This is the most
# reliable way to examine a module-local variable in a different
# module; it eliminates issues of name shadowing due to dynamic
# scoping.
rule peek ( module-name variable )
{
module $(module-name)
{
module local $(<[2]) ;
return $($(<[2])) ;
}
}
# Sets the module-local value of a variable. This is the most
# reliable way to set a module-local variable in a different module;
# it eliminates issues of name shadowing due to dynamic scoping.
rule poke ( module-name variable : value * )
{
module $(module-name)
{
module local $($(<[2])) = $(2) ;
}
}
local rule __test__ ( )
{
import assert ;
assert.result foo bar : ungrist <foo> <bar> ;
module utility.__test__
{
module local foo = bar ;
}
assert.result bar : peek utility.__test__ foo ;
poke utility.__test__ foo : bar baz ;
assert.result bar baz : peek utility.__test__ foo ;
}

View File

@@ -121,11 +121,11 @@ assert-equal x y x-y
assert-index 2--2 : b c d ;
assert-index -3--2 : c d ;
assert-index 1--2 : a b c d ;
assert-index --2 : a b c d ;
assert-index 1--2 : a b c d ;
assert-index 1--10 : ;
x = a ;
assert-index 1--2 : ;
assert-index --2 : ;
assert-index 1--2 : ;
}
#
@@ -148,14 +148,16 @@ assert-equal x y x-y
local f = [ id x y z ] ;
assert-equal x y z : identity $(f) ;
module local w y ;
module local x2 x3 z = 1 2 3 ;
module local x3 ; # should not affect x3
assert-equal 1 2 3 : identity $(x3) ;
w = ;
y = ;
x2 = 1 2 3 ;
x3 = $(x2) ;
z = $(x2) ;
module local x3 = ; # should reset x3
x3 = ; # should reset x3
# drops one element from the head of x
# moves the first element of z from the head of z to the head of y
rule shift1 ( )
{
x = $(x[2-]) ;
@@ -200,9 +202,9 @@ assert-equal x y x-y
EXIT unexpectedly failed to find exported rule "not_really" in "my_module" ;
}
# show that my_module doesn't have access to our variables
my_module.shift1 ;
y = $(y[2-]) ;
assert-equal $(x) : identity $(y) ;
assert-equal $(x[3-]) : identity $(y) ;
# check module locals
assert-equal : my_module.get w ;
@@ -212,7 +214,7 @@ assert-equal x y x-y
assert-equal : my_module.get z ;
my_module.shift2 ;
y = $(y[2-]) ;
x = $(x[3-]) ;
assert-equal $(x) : identity $(y) ;
# Prove that the module's rule is not exposed to the world at large without
@@ -225,16 +227,21 @@ assert-equal x y x-y
IMPORT my_module : shift1 shift2 : : shifty shift2 ;
shifty ;
y = $(y[2-]) ;
assert-equal $(x) : identity $(y) ;
shift2 ;
y = $(y[2-]) ;
assert-equal $(x) : identity $(y) ;
# Now do the same with localization
IMPORT my_module : shift1 : : shifty : LOCALIZE ;
shifty ;
y = $(y[3-]) ;
assert-equal $(x) : identity $(y) ;
# import everything from my_module into the global module using
# the same names.
IMPORT my_module : [ RULENAMES my_module ] : : [ RULENAMES my_module ] ;
IMPORT my_module : [ RULENAMES my_module ] : : [ RULENAMES my_module ] : LOCALIZE ;
shift1 ;
y = $(y[2-]) ;

View File

@@ -63,6 +63,7 @@ COMMON_PROPERTIES ?=
# Borland link lines will need work to find the right libraries for unicode
# support - see borland-tools.jam
<borland><wide-character-support>off
"<cwpro8><cxxflags>-iso_templates on"
;
variant common :

View File

@@ -15,6 +15,11 @@
# from the command-line is sufficiently complex to make using the borland
# approach impractical.
# Get these variable set on the targets so that we can re-use the
# build actions for other toolsets using this one as a base.
flags metrowerks METROWERKS_SETUP ;
flags metrowerks METROWERKS_LINK_SETUP ;
# if METROWERKS_ROOT is unset, this will "multiply away" to nothing.
METROWERKS_SETUP = "call "\"$(METROWERKS_ROOT)$(SLASH)"Other Metrowerks Tools"$(SLASH)"Command Line Tools"$(SLASH)cwenv.bat\"" -quiet" ;
METROWERKS_LINK_SETUP = "set MWWinx86LibraryFiles=" ;
@@ -75,8 +80,8 @@ flags metrowerks STDHDRS : $(METROWERKS_INCLUDE_ROOT)$(SLASH)$(gMETROWERKS_STD_I
rule Link-action
{
gRUN_PATH($(<)) += $(METROWERKS_ROOT)"\\Win32-X86 Support\\Libraries\\Runtime"
$(METROWERKS_ROOT)"\\Win32-X86 Support\\Libraries\\Runtime\\Libs\\MSL_ALL-DLLs" ;
gRUN_PATH($(<)) += $(METROWERKS_INCLUDE_ROOT)"\\Win32-X86 Support\\Libraries\\Runtime"
$(METROWERKS_INCLUDE_ROOT)"\\Win32-X86 Support\\Libraries\\Runtime\\Libs\\MSL_ALL-DLLs" ;
IMPLIB_COMMAND on $(<) = "-implib " ; # will be "multiplied away" if not
# needed.

View File

@@ -33,7 +33,7 @@ import sequence ;
import regex ;
import set ;
module local all-attributes =
all-attributes =
implicit # features whose values alone identify the
# feature. For example, a user is not required to
@@ -90,8 +90,8 @@ module local all-attributes =
# don't affect the built products at all.
;
module local all-features ;
module local all-implicit-values ;
all-features = ;
all-implicit-values = ;
# Transform features by bracketing any elements which aren't already
# bracketed by "<>"
@@ -101,7 +101,7 @@ local rule grist ( features * )
return $(empty:G=$(features)) ;
}
module local empty = "" ;
empty = "" ;
# declare a new feature with the given name, values, and attributes.
rule feature ( name : values * : attributes * )
@@ -135,10 +135,9 @@ rule feature ( name : values * : attributes * )
: feature [ errors.lol->list $(1) : $(2) : $(3) ] ;
}
module local $(name).values ;
module local $(name).attributes = $(attributes) ;
module local $(name).subfeatures = ;
module local $(attributes).features ;
$(name).values ?= ;
$(name).attributes = $(attributes) ;
$(name).subfeatures ?= ;
$(attributes).features += $(name) ;
all-features += $(name) ;
@@ -215,10 +214,6 @@ local rule find-implied-subfeature ( feature subvalue : value-string ? )
= subfeature($(feature),$(subvalue))
subfeature($(feature),$(value-string),$(subvalue)) ;
# declaring these module local here prevents us from picking up
# enclosing definitions.
module local $(v) ;
local subfeature = $($(v)) ;
return $(subfeature[1]) ;
}
@@ -304,7 +299,6 @@ local rule extend-feature ( feature : values * )
{
for local v in $(values)
{
module local $(v).implicit-feature ;
if $($(v).implicit-feature)
{
error $(v) is already associated with the \"$($(v).implicit-feature)\" feature ;
@@ -361,7 +355,7 @@ rule extend-subfeature ( feature value-string ? : subfeature : subvalues * )
local v
= subfeature($(feature),$(value-string),$(subvalue))
subfeature($(feature),$(subvalue)) ;
module local $(v[1]) = $(subfeature) ;
$(v[1]) = $(subfeature) ;
}
}
@@ -444,7 +438,7 @@ rule compose ( composite-property : component-properties * )
error "$(feature)" is not a composite feature ;
}
module local $(composite-property).components ;
$(composite-property).components ?= ;
if $($(composite-property).components)
{
error components of "$(composite-property)" already set:

View File

@@ -44,8 +44,9 @@ rule backtrace ( skip-frames messages * : * )
}
}
module local args = messages 2 3 4 5 6 7 8 9 ;
module local disabled last-$(args) ;
args ?= messages 2 3 4 5 6 7 8 9 ;
disabled ?= ;
last-$(args) ?= ;
# try-catch --
#

View File

@@ -6,8 +6,9 @@
import numbers ;
import errors : * ;
import set ;
import modules ;
module local classes ;
classes = ;
# Declare a class with the given name. The caller should have defined
# a (local) rule called 'name' which acts as the new class'
@@ -25,35 +26,37 @@ rule class ( name : bases * )
# Each class is assigned a new module which acts as a namespace
# for its rules and normal instance variables.
# This is a record of the class' base classes
modules.poke class@$(name) : __bases__ : $(bases) ;
#modules.poke class@$(name) : __derived__ : ;
modules.poke class@$(name) : __name__ : $(name) ;
module class@$(name)
{
# This is a record of the class' base classes
module local __bases__ = $(bases) ;
module local __derived__ = ;
# always bring in the rules defined from this module, so that
# users can easily call "inherit", for example.
import class : * ;
# The constructor will be known as "__init__" in the class'
# namespace.
IMPORT [ CALLER_MODULE ] : $(name) : class@$(name) : __init__ ;
IMPORT [ CALLER_MODULE ] : $(__name__) : class@$(__name__) : __init__ ;
# Cause the __init__ function and all of the class modules
# rules to be visible to the builtin RULENAMES rule. We'll
# need them in order to implement subclasses and instances of
# the class.
EXPORT class@$(name) : __init__ # [ RULENAMES class ]
EXPORT class@$(__name__) : __init__ # [ RULENAMES class ]
;
# Bring the __init__ functions in from the base classes, using
# the optional localize parameter so that it will execute in
# the instance's module
for local base in $(bases)
for local base in $(__bases__)
{
# ECHO import __init__ from module class@$(base) into class@$(name) as $(base).__init__ ;
IMPORT class@$(base) : __init__ : class@$(name) : $(base).__init__ ;
EXPORT class@$(name) : $(base).__init__ ;
# ECHO import __init__ from module class@$(base) into class@$(__name__) as $(base).__init__ ;
IMPORT class@$(base) : __init__ : class@$(__name__) : $(base).__init__ ;
EXPORT class@$(__name__) : $(base).__init__ ;
module class@$(base)
{
# not using symbolic name "name" here because it might
@@ -74,26 +77,26 @@ rule instance ( name : class args * : * )
# import all of the rules from the class into the instance,
# using the optional localize parameter so that they execute
# in the instance's namespace.
local rules = [ RULENAMES class@$(class) ] ;
local rules = [ RULENAMES class@$(>[1]) ] ;
# ECHO instance $(name) inherits rules: $(rules) from class $(class) ;
IMPORT class@$(class) : $(rules) : $(name) : $(rules) : localize ;
IMPORT class@$(>[1]) : $(rules) : $(<) : $(rules) : localize ;
# Also import the instance's rules into the global module as
# <instance-name>.<rulename>
IMPORT $(name) : $(rules) : : $(name).$(rules) ;
IMPORT $(<) : $(rules) : : $(<).$(rules) ;
# Now initialize the instance
__init__ $(args) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
__init__ $(>[2]) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
# Make a record of the instance's class. We need to do this
# last because it will be set to each of the class' base
# classes as it is initialized.
module local __class__ = $(class) ;
__class__ = $(>[1]) ;
}
}
# Keeps track of the next unique object name to generate
module local next-instance = 1 ;
next-instance = 1 ;
# create a new uniquely-named instance of the given class, returning
# its name.
@@ -162,8 +165,8 @@ rule __test__ ( )
local rule myclass ( x_ * : y_ * )
{
# set some instance variables
module local x = $(x_) ;
module local y = $(y_) ;
x = $(x_) ;
y = $(y_) ;
rule set-x ( newx * )
{
@@ -212,7 +215,7 @@ rule __test__ ( )
local rule derived1 ( z_ )
{
myclass.__init__ $(z_) : X ;
module local z = $(z_) ;
z = $(z_) ;
# override g
rule g ( args * )

View File

@@ -4,9 +4,9 @@
# warranty, and with no claim as to its suitability for any purpose.
# Keep a record so that no module is included multiple times
module local loaded-modules ;
module local loading-modules ;
module local untested ;
loaded-modules ?= ;
loading-modules ?= ;
untested ?= ;
# meant to be invoked from import when no __test__ rule is defined in a given
# module
@@ -21,6 +21,29 @@ rule binding ( module )
return $($(module).__binding__) ;
}
# Sets the module-local value of a variable. This is the most
# reliable way to set a module-local variable in a different module;
# it eliminates issues of name shadowing due to dynamic scoping.
rule poke ( module-name ? : variables + : value * )
{
module $(<)
{
$(>) = $(3) ;
}
}
# Returns the module-local value of a variable. This is the most
# reliable way to examine a module-local variable in a different
# module; it eliminates issues of name shadowing due to dynamic
# scoping.
rule peek ( module-name ? : variables + )
{
module $(<)
{
return $($(>)) ;
}
}
# load the indicated module if it is not already loaded.
rule load ( module-name : filename ? : search * )
{
@@ -32,29 +55,31 @@ rule load ( module-name : filename ? : search * )
local suppress-test = $(untested[1]) ; # suppress tests until all recursive loads are complete.
untested += $(module-name) ; # add the module to the stack of untested modules
poke $(module-name) : __name__ : $(module-name) ;
poke $(module-name) : __file__ : $(filename) ;
module $(module-name)
{
module local __name__ = $(module-name) ;
# Prepare a default behavior, in case no __test__ is defined.
IMPORT modules : no_test_defined : $(module-name) : __test__ ;
IMPORT modules : no_test_defined : $(__name__) : __test__ ;
# Add some grist so that the module will have a unique target name
local module-target = $(filename:G=module@) ;
local module-target = $(__file__:G=module@) ;
search ?= $(BOOST_BUILD_PATH) ;
SEARCH on $(module-target) = $(search) ;
search ?= [ modules.peek : BOOST_BUILD_PATH ] ;
SEARCH on $(module-target) = $(3) ;
BINDRULE on $(module-target) = modules.record-binding ;
include $(module-target) ;
}
loading-modules = $(loading-modules[1--2]) ;
if ! $(suppress-test) && $(BOOST_BUILD_TEST)-is-nonempty
local test = [ peek : BOOST_BUILD_TEST ] ;
if ! $(suppress-test) && $(test)-is-nonempty
{
# run any pending tests
for local m in $(untested)
{
if ( $(BOOST_BUILD_TEST) = 1 ) || ( $(m) in $(BOOST_BUILD_TEST) )
if ( $(test) = 1 ) || ( $(m) in $(test) )
{
ECHO testing module $(m)... ;
module $(m)
@@ -78,7 +103,7 @@ rule load ( module-name : filename ? : search * )
# each loaded module.
rule record-binding ( module-target : binding )
{
module local $(module-target:G=:S=).__binding__ = $(binding) ;
$(module-target:G=:S=).__binding__ = $(binding) ;
}
# load the indicated module and import rule names into the current
@@ -104,3 +129,18 @@ rule import ( module-name : rules-opt * : rename-opt * )
IMPORT $(module-name) : $(source-names) : [ CALLER_MODULE ] : $(target-names) ;
}
local rule __test__ ( )
{
import assert ;
module modules.__test__
{
foo = bar ;
}
assert.result bar : peek modules.__test__ : foo ;
poke modules.__test__ : foo : bar baz ;
assert.result bar baz : peek modules.__test__ : foo ;
}

View File

@@ -121,11 +121,11 @@ assert-equal x y x-y
assert-index 2--2 : b c d ;
assert-index -3--2 : c d ;
assert-index 1--2 : a b c d ;
assert-index --2 : a b c d ;
assert-index 1--2 : a b c d ;
assert-index 1--10 : ;
x = a ;
assert-index 1--2 : ;
assert-index --2 : ;
assert-index 1--2 : ;
}
#
@@ -148,14 +148,16 @@ assert-equal x y x-y
local f = [ id x y z ] ;
assert-equal x y z : identity $(f) ;
module local w y ;
module local x2 x3 z = 1 2 3 ;
module local x3 ; # should not affect x3
assert-equal 1 2 3 : identity $(x3) ;
w = ;
y = ;
x2 = 1 2 3 ;
x3 = $(x2) ;
z = $(x2) ;
module local x3 = ; # should reset x3
x3 = ; # should reset x3
# drops one element from the head of x
# moves the first element of z from the head of z to the head of y
rule shift1 ( )
{
x = $(x[2-]) ;
@@ -200,9 +202,9 @@ assert-equal x y x-y
EXIT unexpectedly failed to find exported rule "not_really" in "my_module" ;
}
# show that my_module doesn't have access to our variables
my_module.shift1 ;
y = $(y[2-]) ;
assert-equal $(x) : identity $(y) ;
assert-equal $(x[3-]) : identity $(y) ;
# check module locals
assert-equal : my_module.get w ;
@@ -212,7 +214,7 @@ assert-equal x y x-y
assert-equal : my_module.get z ;
my_module.shift2 ;
y = $(y[2-]) ;
x = $(x[3-]) ;
assert-equal $(x) : identity $(y) ;
# Prove that the module's rule is not exposed to the world at large without
@@ -225,16 +227,21 @@ assert-equal x y x-y
IMPORT my_module : shift1 shift2 : : shifty shift2 ;
shifty ;
y = $(y[2-]) ;
assert-equal $(x) : identity $(y) ;
shift2 ;
y = $(y[2-]) ;
assert-equal $(x) : identity $(y) ;
# Now do the same with localization
IMPORT my_module : shift1 : : shifty : LOCALIZE ;
shifty ;
y = $(y[3-]) ;
assert-equal $(x) : identity $(y) ;
# import everything from my_module into the global module using
# the same names.
IMPORT my_module : [ RULENAMES my_module ] : : [ RULENAMES my_module ] ;
IMPORT my_module : [ RULENAMES my_module ] : : [ RULENAMES my_module ] : LOCALIZE ;
shift1 ;
y = $(y[2-]) ;

View File

@@ -4,6 +4,7 @@
# warranty, and with no claim as to its suitability for any purpose.
import errors : error-skip-frames lol->list ;
import modules ;
# assert the equality of A and B
rule equal ( a * : b * )
@@ -21,8 +22,9 @@ rule result ( expected * : rule-name args * : * )
local result__ ;
module [ CALLER_MODULE ]
{
result__ = [
$(rule-name) $(args) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ] ;
ECHO "asserting" $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
modules.poke assert : result__
: [ $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ] ;
}
if $(result__) != $(expected)

View File

@@ -3,14 +3,14 @@
# all copies. This software is provided "as is" without express or implied
# warranty, and with no claim as to its suitability for any purpose.
module local digits = 0 1 2 3 4 5 6 7 8 9 ;
module local powers = 1 ;
module local zeros = "" ;
module local natural = $(digits) ;
module local positive = $(digits[2-]) ;
module local incr = $(positive[2-]) ;
module local znatural = $(digits) ;
module local zero-test = is zero ; # if $(zero-test[$(n)]) == "is" "zero", n == 0
digits = 0 1 2 3 4 5 6 7 8 9 ;
powers = 1 ;
zeros = "" ;
natural = $(digits) ;
positive = $(digits[2-]) ;
incr = $(positive[2-]) ;
znatural = $(digits) ;
zero-test = is zero ; # if $(zero-test[$(n)]) == "is" "zero", n == 0
import errors : * ;

View File

@@ -3,9 +3,9 @@
# all copies. This software is provided "as is" without express or implied
# warranty, and with no claim as to its suitability for any purpose.
module local name = $(OS) ;
module local platform = $(OSPLAT) ;
module local version = $(OSVER) ;
name = $(OS) ;
platform = $(OSPLAT) ;
version = $(OSVER) ;
rule name { return $(name) ; }
rule platform { return $(platform) ; }

View File

@@ -26,41 +26,9 @@ rule caller-file ( )
return $(bt[9]) ;
}
# Returns the module-local value of a variable. This is the most
# reliable way to examine a module-local variable in a different
# module; it eliminates issues of name shadowing due to dynamic
# scoping.
rule peek ( module-name variable )
{
module $(module-name)
{
module local $(<[2]) ;
return $($(<[2])) ;
}
}
# Sets the module-local value of a variable. This is the most
# reliable way to set a module-local variable in a different module;
# it eliminates issues of name shadowing due to dynamic scoping.
rule poke ( module-name variable : value * )
{
module $(module-name)
{
module local $($(<[2])) = $(2) ;
}
}
local rule __test__ ( )
{
import assert ;
assert.result foo bar : ungrist <foo> <bar> ;
module utility.__test__
{
module local foo = bar ;
}
assert.result bar : peek utility.__test__ foo ;
poke utility.__test__ foo : bar baz ;
assert.result bar baz : peek utility.__test__ foo ;
}