Changes in / [1f81d61:533540a]
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r1f81d61 r533540a 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu May 24 18:11:59201813 // Update Count : 33 6912 // Last Modified On : Mon May 28 17:01:36 2018 13 // Update Count : 3383 14 14 // 15 15 … … 324 324 %type<decl> cfa_identifier_parameter_declarator_tuple cfa_identifier_parameter_ptr 325 325 326 %type<decl> cfa_parameter_declaration cfa_parameter_list cfa_parameter_ type_list_opt326 %type<decl> cfa_parameter_declaration cfa_parameter_list cfa_parameter_ellipsis_list_opt 327 327 328 328 %type<decl> cfa_typedef_declaration cfa_variable_declaration cfa_variable_specifier … … 835 835 // '[' ']' 836 836 // { $$ = new ExpressionNode( build_tuple() ); } 837 // '[' push assignment_expression pop ']'837 // | '[' push assignment_expression pop ']' 838 838 // { $$ = new ExpressionNode( build_tuple( $3 ) ); } 839 839 '[' push ',' tuple_expression_list pop ']' … … 1364 1364 | declaration_qualifier_list type_qualifier_list cfa_function_specifier 1365 1365 { $$ = $3->addQualifiers( $1 )->addQualifiers( $2 ); } 1366 | cfa_function_declaration ',' identifier_or_type_name '(' cfa_parameter_type_list_opt')'1366 | cfa_function_declaration ',' identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' 1367 1367 { 1368 1368 // Append the return type at the start (left-hand-side) to each identifier in the list. 1369 1369 DeclarationNode * ret = new DeclarationNode; 1370 1370 ret->type = maybeClone( $1->type->base ); 1371 $$ = $1->appendList( DeclarationNode::newFunction( $3, ret, $ 5, nullptr ) );1371 $$ = $1->appendList( DeclarationNode::newFunction( $3, ret, $6, nullptr ) ); 1372 1372 } 1373 1373 ; 1374 1374 1375 1375 cfa_function_specifier: // CFA 1376 // '[' ']' identifier_or_type_name '(' push cfa_parameter_ type_list_opt pop ')' // S/R conflict1376 // '[' ']' identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' // S/R conflict 1377 1377 // { 1378 1378 // $$ = DeclarationNode::newFunction( $3, DeclarationNode::newTuple( 0 ), $6, 0, true ); 1379 1379 // } 1380 // '[' ']' identifier '(' push cfa_parameter_ type_list_opt pop ')'1380 // '[' ']' identifier '(' push cfa_parameter_ellipsis_list_opt pop ')' 1381 1381 // { 1382 1382 // typedefTable.setNextIdentifier( *$5 ); 1383 1383 // $$ = DeclarationNode::newFunction( $5, DeclarationNode::newTuple( 0 ), $8, 0, true ); 1384 1384 // } 1385 // | '[' ']' TYPEDEFname '(' push cfa_parameter_ type_list_opt pop ')'1385 // | '[' ']' TYPEDEFname '(' push cfa_parameter_ellipsis_list_opt pop ')' 1386 1386 // { 1387 1387 // typedefTable.setNextIdentifier( *$5 ); … … 1391 1391 // identifier_or_type_name must be broken apart because of the sequence: 1392 1392 // 1393 // '[' ']' identifier_or_type_name '(' cfa_parameter_ type_list_opt ')'1393 // '[' ']' identifier_or_type_name '(' cfa_parameter_ellipsis_list_opt ')' 1394 1394 // '[' ']' type_specifier 1395 1395 // 1396 1396 // type_specifier can resolve to just TYPEDEFname (e.g., typedef int T; int f( T );). Therefore this must be 1397 1397 // flattened to allow lookahead to the '(' without having to reduce identifier_or_type_name. 1398 cfa_abstract_tuple identifier_or_type_name '(' push cfa_parameter_ type_list_opt pop ')'1398 cfa_abstract_tuple identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' 1399 1399 // To obtain LR(1 ), this rule must be factored out from function return type (see cfa_abstract_declarator). 1400 1400 { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 ); } 1401 | cfa_function_return identifier_or_type_name '(' push cfa_parameter_ type_list_opt pop ')'1401 | cfa_function_return identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' 1402 1402 { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 ); } 1403 1403 ; … … 1951 1951 ; 1952 1952 1953 cfa_parameter_ type_list_opt: // CFA, abstract + real1953 cfa_parameter_ellipsis_list_opt: // CFA, abstract + real 1954 1954 // empty 1955 1955 { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); } … … 2209 2209 '|' no_attr_identifier_or_type_name '(' type_list ')' 2210 2210 { $$ = DeclarationNode::newTraitUse( $2, $4 ); } 2211 | '|' '{' push trait_declaration_list '}'2211 | '|' '{' push trait_declaration_list pop '}' 2212 2212 { $$ = $4; } 2213 | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list '}' '(' type_list ')'2213 | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list pop '}' '(' type_list ')' 2214 2214 { SemanticError( yylloc, "Generic data-type assertion is currently unimplemented." ); $$ = nullptr; } 2215 2215 ; … … 2257 2257 TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' '}' 2258 2258 { $$ = DeclarationNode::newTrait( $2, $5, 0 ); } 2259 | TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' push trait_declaration_list '}'2259 | TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' push trait_declaration_list pop '}' 2260 2260 { $$ = DeclarationNode::newTrait( $2, $5, $10 ); } 2261 2261 ; … … 2263 2263 trait_declaration_list: // CFA 2264 2264 trait_declaration 2265 | trait_declaration_list p ush trait_declaration2266 { $$ = $1->appendList( $ 3); }2265 | trait_declaration_list pop push trait_declaration 2266 { $$ = $1->appendList( $4 ); } 2267 2267 ; 2268 2268 2269 2269 trait_declaration: // CFA 2270 cfa_trait_declaring_list pop';'2271 | trait_declaring_list pop';'2270 cfa_trait_declaring_list ';' 2271 | trait_declaring_list ';' 2272 2272 ; 2273 2273 … … 2974 2974 '[' ']' 2975 2975 { $$ = DeclarationNode::newArray( 0, 0, false ); } 2976 // multi_array_dimension handles the '[' '*' ']' case2976 // multi_array_dimension handles the '[' '*' ']' case 2977 2977 | '[' push type_qualifier_list '*' pop ']' // remaining C99 2978 2978 { $$ = DeclarationNode::newVarArray( $3 ); } 2979 2979 | '[' push type_qualifier_list pop ']' 2980 2980 { $$ = DeclarationNode::newArray( 0, $3, false ); } 2981 // multi_array_dimension handles the '[' assignment_expression ']' case2981 // multi_array_dimension handles the '[' assignment_expression ']' case 2982 2982 | '[' push type_qualifier_list assignment_expression pop ']' 2983 2983 { $$ = DeclarationNode::newArray( $4, $3, false ); } … … 3115 3115 // 3116 3116 // cfa_abstract_tuple identifier_or_type_name 3117 // '[' cfa_parameter_list ']' identifier_or_type_name '(' cfa_parameter_ type_list_opt ')'3117 // '[' cfa_parameter_list ']' identifier_or_type_name '(' cfa_parameter_ellipsis_list_opt ')' 3118 3118 // 3119 3119 // since a function return type can be syntactically identical to a tuple type: … … 3174 3174 '[' push cfa_abstract_parameter_list pop ']' 3175 3175 { $$ = DeclarationNode::newTuple( $3 ); } 3176 | '[' push type_specifier_nobody ELLIPSIS ']' 3177 { SemanticError( yylloc, "Tuple array currently unimplemented." ); $$ = nullptr; } 3178 | '[' push type_specifier_nobody ELLIPSIS constant_expression ']' 3179 { SemanticError( yylloc, "Tuple array currently unimplemented." ); $$ = nullptr; } 3176 3180 ; 3177 3181 3178 3182 cfa_abstract_function: // CFA 3179 // '[' ']' '(' cfa_parameter_ type_list_opt ')'3183 // '[' ']' '(' cfa_parameter_ellipsis_list_opt ')' 3180 3184 // { $$ = DeclarationNode::newFunction( nullptr, DeclarationNode::newTuple( nullptr ), $4, nullptr ); } 3181 cfa_abstract_tuple '(' push cfa_parameter_ type_list_opt pop ')'3185 cfa_abstract_tuple '(' push cfa_parameter_ellipsis_list_opt pop ')' 3182 3186 { $$ = DeclarationNode::newFunction( nullptr, $1, $4, nullptr ); } 3183 | cfa_function_return '(' push cfa_parameter_ type_list_opt pop ')'3187 | cfa_function_return '(' push cfa_parameter_ellipsis_list_opt pop ')' 3184 3188 { $$ = DeclarationNode::newFunction( nullptr, $1, $4, nullptr ); } 3185 3189 ; -
src/tests/concurrent/examples/datingService.c
r1f81d61 r533540a 8 8 // Created On : Mon Oct 30 12:56:20 2017 9 9 // Last Modified By : Peter A. Buhr 10 // Last Modified On : Wed Mar 14 22:48:40201811 // Update Count : 2 310 // Last Modified On : Sun May 27 09:05:18 2018 11 // Update Count : 26 12 12 // 13 13 … … 18 18 #include <unistd.h> // getpid 19 19 20 enum { NoOfPairs = 20 };20 enum { CompCodes = 20 }; // number of compatibility codes 21 21 22 22 monitor DatingService { 23 condition Girls[ NoOfPairs], Boys[NoOfPairs];23 condition Girls[CompCodes], Boys[CompCodes]; 24 24 unsigned int GirlPhoneNo, BoyPhoneNo; 25 25 }; // DatingService … … 47 47 } // DatingService boy 48 48 49 unsigned int girlck[ NoOfPairs];50 unsigned int boyck[ NoOfPairs];49 unsigned int girlck[CompCodes]; 50 unsigned int boyck[CompCodes]; 51 51 52 52 thread Girl { … … 88 88 int main() { 89 89 DatingService TheExchange; 90 Girl * girls[ NoOfPairs];91 Boy * boys[ NoOfPairs];90 Girl * girls[CompCodes]; 91 Boy * boys[CompCodes]; 92 92 93 93 srandom( /*getpid()*/ 103 ); 94 94 95 for ( unsigned int i = 0; i < NoOfPairs; i += 1 ) {95 for ( unsigned int i = 0; i < CompCodes; i += 1 ) { 96 96 girls[i] = new( &TheExchange, i, i ); 97 boys[i] = new( &TheExchange, i, NoOfPairs - ( i + 1 ) );97 boys[i] = new( &TheExchange, i, CompCodes - ( i + 1 ) ); 98 98 } // for 99 99 100 for ( unsigned int i = 0; i < NoOfPairs; i += 1 ) {100 for ( unsigned int i = 0; i < CompCodes; i += 1 ) { 101 101 delete( boys[i] ); 102 102 delete( girls[i] ); 103 103 } // for 104 104 105 for ( unsigned int i = 0; i < NoOfPairs; i += 1 ) {105 for ( unsigned int i = 0; i < CompCodes; i += 1 ) { 106 106 if ( girlck[ boyck[i] ] != boyck[ girlck[i] ] ) abort(); 107 107 } // for
Note:
See TracChangeset
for help on using the changeset viewer.