Mercurial > ecos-v2_0-branch
comparison host/libcdl/expr.cxx @ 115:6ed91473a1cd ecos-sw-2000-08-21
Merge from eCos master repository on 2000-08-21-22:40:54-BST
| author | jlarmour |
|---|---|
| date | Fri, 25 Aug 2000 17:32:38 +0000 |
| parents | 6736c52df507 |
| children | 511f4dc167f6 |
comparison
equal
deleted
inserted
replaced
| 114:5ad2b71d525e | 115:6ed91473a1cd |
|---|---|
| 457 | 457 |
| 458 // The start of a string has been detected. Work out the entire string, | 458 // The start of a string has been detected. Work out the entire string, |
| 459 // allowing for backslash escapes. | 459 // allowing for backslash escapes. |
| 460 static void | 460 static void |
| 461 process_string() | 461 process_string() |
| 462 throw(CdlParseException, std::bad_alloc) | |
| 463 { | 462 { |
| 464 CYG_REPORT_FUNCNAME("process_string"); | 463 CYG_REPORT_FUNCNAME("process_string"); |
| 465 CYG_ASSERTC('"' == current_char); | 464 CYG_ASSERTC('"' == current_char); |
| 466 CYG_ASSERTC("" == current_string); | 465 CYG_ASSERTC("" == current_string); |
| 467 | 466 |
| 582 // parsing a list expression then the following _5 will actually | 581 // parsing a list expression then the following _5 will actually |
| 583 // be interpreted as a reference. To avoid this, here is a utility | 582 // be interpreted as a reference. To avoid this, here is a utility |
| 584 // which checks number completion and throws an exception if | 583 // which checks number completion and throws an exception if |
| 585 // necessary. | 584 // necessary. |
| 586 static void check_number_termination() | 585 static void check_number_termination() |
| 587 throw(CdlParseException, std::bad_alloc) | |
| 588 { | 586 { |
| 589 CYG_REPORT_FUNCNAME("check_number_termination"); | 587 CYG_REPORT_FUNCNAME("check_number_termination"); |
| 590 | 588 |
| 591 // End-of-data or any whitespace is ok. | 589 // End-of-data or any whitespace is ok. |
| 592 if ((EOF != current_char) && !isspace(current_char)) { | 590 if ((EOF != current_char) && !isspace(current_char)) { |
| 607 CYG_REPORT_RETURN(); | 605 CYG_REPORT_RETURN(); |
| 608 } | 606 } |
| 609 | 607 |
| 610 static void | 608 static void |
| 611 process_number() | 609 process_number() |
| 612 throw(CdlParseException, std::bad_alloc) | |
| 613 { | 610 { |
| 614 CYG_REPORT_FUNCNAME("process_number"); | 611 CYG_REPORT_FUNCNAME("process_number"); |
| 615 | 612 |
| 616 std::string tmp = ""; | 613 std::string tmp = ""; |
| 617 bool is_float = false; | 614 bool is_float = false; |
| 736 // Some care has to be taken with locale's, the C library may decide | 733 // Some care has to be taken with locale's, the C library may decide |
| 737 // that a character is a letter even though the same character is not | 734 // that a character is a letter even though the same character is not |
| 738 // valid as far as the preprocessor is concerned. | 735 // valid as far as the preprocessor is concerned. |
| 739 static void | 736 static void |
| 740 process_reference() | 737 process_reference() |
| 741 throw(CdlParseException, std::bad_alloc) | |
| 742 { | 738 { |
| 743 CYG_REPORT_FUNCNAME("process_reference"); | 739 CYG_REPORT_FUNCNAME("process_reference"); |
| 744 | 740 |
| 745 do { | 741 do { |
| 746 current_reference += (char) current_char; | 742 current_reference += (char) current_char; |
| 762 // ---------------------------------------------------------------------------- | 758 // ---------------------------------------------------------------------------- |
| 763 // Work out what the next token is. This includes the handling of | 759 // Work out what the next token is. This includes the handling of |
| 764 // strings, integers, doubles, and references. | 760 // strings, integers, doubles, and references. |
| 765 static void | 761 static void |
| 766 next_token() | 762 next_token() |
| 767 throw(CdlParseException, std::bad_alloc) | |
| 768 { | 763 { |
| 769 CYG_REPORT_FUNCNAMETYPE("next_token", "token %d"); | 764 CYG_REPORT_FUNCNAMETYPE("next_token", "token %d"); |
| 770 | 765 |
| 771 // Make sure there is no dross left lying around from the previous call. | 766 // Make sure there is no dross left lying around from the previous call. |
| 772 current_token = T_Invalid; | 767 current_token = T_Invalid; |
| 1023 // ( <expression> ) | 1018 // ( <expression> ) |
| 1024 // | 1019 // |
| 1025 // There are separate functions for each of these terms. | 1020 // There are separate functions for each of these terms. |
| 1026 | 1021 |
| 1027 // A forward declaration, needed for bracketed subexpressions. | 1022 // A forward declaration, needed for bracketed subexpressions. |
| 1028 static void parse_expression(CdlExpression) throw(CdlParseException, std::bad_alloc); | 1023 static void parse_expression(CdlExpression); |
| 1029 | 1024 |
| 1030 // A utility to add a reference to the current expression, returning | 1025 // A utility to add a reference to the current expression, returning |
| 1031 // the index. | 1026 // the index. |
| 1032 static int | 1027 static int |
| 1033 push_reference(CdlExpression expr, const std::string& reference) | 1028 push_reference(CdlExpression expr, const std::string& reference) |
| 1068 return result; | 1063 return result; |
| 1069 } | 1064 } |
| 1070 | 1065 |
| 1071 static void | 1066 static void |
| 1072 parse_unary(CdlExpression expr) | 1067 parse_unary(CdlExpression expr) |
| 1073 throw(CdlParseException, std::bad_alloc) | |
| 1074 { | 1068 { |
| 1075 CYG_REPORT_FUNCNAME("parse_operand"); | 1069 CYG_REPORT_FUNCNAME("parse_operand"); |
| 1076 CYG_REPORT_FUNCARG1XV(expr); | 1070 CYG_REPORT_FUNCARG1XV(expr); |
| 1077 CYG_PRECONDITION_CLASSC(expr); | 1071 CYG_PRECONDITION_CLASSC(expr); |
| 1078 | 1072 |
| 1223 CYG_REPORT_RETURN(); | 1217 CYG_REPORT_RETURN(); |
| 1224 } | 1218 } |
| 1225 | 1219 |
| 1226 static void | 1220 static void |
| 1227 parse_multiply(CdlExpression expr) | 1221 parse_multiply(CdlExpression expr) |
| 1228 throw(CdlParseException, std::bad_alloc) | |
| 1229 { | 1222 { |
| 1230 CYG_REPORT_FUNCNAME("parse_multiply"); | 1223 CYG_REPORT_FUNCNAME("parse_multiply"); |
| 1231 | 1224 |
| 1232 parse_unary(expr); | 1225 parse_unary(expr); |
| 1233 while ((T_Times == current_token) || (T_Divide == current_token) || (T_Remainder == current_token)) { | 1226 while ((T_Times == current_token) || (T_Divide == current_token) || (T_Remainder == current_token)) { |
| 1248 CYG_REPORT_RETURN(); | 1241 CYG_REPORT_RETURN(); |
| 1249 } | 1242 } |
| 1250 | 1243 |
| 1251 static void | 1244 static void |
| 1252 parse_add(CdlExpression expr) | 1245 parse_add(CdlExpression expr) |
| 1253 throw(CdlParseException, std::bad_alloc) | |
| 1254 { | 1246 { |
| 1255 CYG_REPORT_FUNCNAME("parse_add"); | 1247 CYG_REPORT_FUNCNAME("parse_add"); |
| 1256 | 1248 |
| 1257 parse_multiply(expr); | 1249 parse_multiply(expr); |
| 1258 while ((T_Plus == current_token) || (T_Minus == current_token)) { | 1250 while ((T_Plus == current_token) || (T_Minus == current_token)) { |
| 1271 CYG_REPORT_RETURN(); | 1263 CYG_REPORT_RETURN(); |
| 1272 } | 1264 } |
| 1273 | 1265 |
| 1274 static void | 1266 static void |
| 1275 parse_shift(CdlExpression expr) | 1267 parse_shift(CdlExpression expr) |
| 1276 throw(CdlParseException, std::bad_alloc) | |
| 1277 { | 1268 { |
| 1278 CYG_REPORT_FUNCNAME("parse_shift"); | 1269 CYG_REPORT_FUNCNAME("parse_shift"); |
| 1279 | 1270 |
| 1280 parse_add(expr); | 1271 parse_add(expr); |
| 1281 while ((T_LeftShift == current_token) || (T_RightShift == current_token)) { | 1272 while ((T_LeftShift == current_token) || (T_RightShift == current_token)) { |
| 1294 CYG_REPORT_RETURN(); | 1285 CYG_REPORT_RETURN(); |
| 1295 } | 1286 } |
| 1296 | 1287 |
| 1297 static void | 1288 static void |
| 1298 parse_comparison(CdlExpression expr) | 1289 parse_comparison(CdlExpression expr) |
| 1299 throw(CdlParseException, std::bad_alloc) | |
| 1300 { | 1290 { |
| 1301 CYG_REPORT_FUNCNAME("parse_comparison"); | 1291 CYG_REPORT_FUNCNAME("parse_comparison"); |
| 1302 | 1292 |
| 1303 parse_shift(expr); | 1293 parse_shift(expr); |
| 1304 while ((T_LessThan == current_token) || (T_LessEqual == current_token) || | 1294 while ((T_LessThan == current_token) || (T_LessEqual == current_token) || |
| 1321 CYG_REPORT_RETURN(); | 1311 CYG_REPORT_RETURN(); |
| 1322 } | 1312 } |
| 1323 | 1313 |
| 1324 static void | 1314 static void |
| 1325 parse_equals(CdlExpression expr) | 1315 parse_equals(CdlExpression expr) |
| 1326 throw(CdlParseException, std::bad_alloc) | |
| 1327 { | 1316 { |
| 1328 CYG_REPORT_FUNCNAME("parse_equals"); | 1317 CYG_REPORT_FUNCNAME("parse_equals"); |
| 1329 | 1318 |
| 1330 parse_comparison(expr); | 1319 parse_comparison(expr); |
| 1331 while ((T_Equal == current_token) || (T_NotEqual == current_token)) { | 1320 while ((T_Equal == current_token) || (T_NotEqual == current_token)) { |
| 1344 CYG_REPORT_RETURN(); | 1333 CYG_REPORT_RETURN(); |
| 1345 } | 1334 } |
| 1346 | 1335 |
| 1347 static void | 1336 static void |
| 1348 parse_bitand(CdlExpression expr) | 1337 parse_bitand(CdlExpression expr) |
| 1349 throw(CdlParseException, std::bad_alloc) | |
| 1350 { | 1338 { |
| 1351 CYG_REPORT_FUNCNAME("parse_bitand"); | 1339 CYG_REPORT_FUNCNAME("parse_bitand"); |
| 1352 | 1340 |
| 1353 parse_equals(expr); | 1341 parse_equals(expr); |
| 1354 while (T_BitAnd == current_token) { | 1342 while (T_BitAnd == current_token) { |
| 1367 CYG_REPORT_RETURN(); | 1355 CYG_REPORT_RETURN(); |
| 1368 } | 1356 } |
| 1369 | 1357 |
| 1370 static void | 1358 static void |
| 1371 parse_bitxor(CdlExpression expr) | 1359 parse_bitxor(CdlExpression expr) |
| 1372 throw(CdlParseException, std::bad_alloc) | |
| 1373 { | 1360 { |
| 1374 CYG_REPORT_FUNCNAME("parse_bitxor"); | 1361 CYG_REPORT_FUNCNAME("parse_bitxor"); |
| 1375 | 1362 |
| 1376 parse_bitand(expr); | 1363 parse_bitand(expr); |
| 1377 while (T_BitXor == current_token) { | 1364 while (T_BitXor == current_token) { |
| 1390 CYG_REPORT_RETURN(); | 1377 CYG_REPORT_RETURN(); |
| 1391 } | 1378 } |
| 1392 | 1379 |
| 1393 static void | 1380 static void |
| 1394 parse_bitor(CdlExpression expr) | 1381 parse_bitor(CdlExpression expr) |
| 1395 throw(CdlParseException, std::bad_alloc) | |
| 1396 { | 1382 { |
| 1397 CYG_REPORT_FUNCNAME("parse_bitor"); | 1383 CYG_REPORT_FUNCNAME("parse_bitor"); |
| 1398 | 1384 |
| 1399 parse_bitxor(expr); | 1385 parse_bitxor(expr); |
| 1400 while (T_BitOr == current_token) { | 1386 while (T_BitOr == current_token) { |
| 1413 CYG_REPORT_RETURN(); | 1399 CYG_REPORT_RETURN(); |
| 1414 } | 1400 } |
| 1415 | 1401 |
| 1416 static void | 1402 static void |
| 1417 parse_and(CdlExpression expr) | 1403 parse_and(CdlExpression expr) |
| 1418 throw(CdlParseException, std::bad_alloc) | |
| 1419 { | 1404 { |
| 1420 CYG_REPORT_FUNCNAME("parse_and"); | 1405 CYG_REPORT_FUNCNAME("parse_and"); |
| 1421 parse_bitor(expr); | 1406 parse_bitor(expr); |
| 1422 while (T_And == current_token) { | 1407 while (T_And == current_token) { |
| 1423 | 1408 |
| 1435 CYG_REPORT_RETURN(); | 1420 CYG_REPORT_RETURN(); |
| 1436 } | 1421 } |
| 1437 | 1422 |
| 1438 static void | 1423 static void |
| 1439 parse_or(CdlExpression expr) | 1424 parse_or(CdlExpression expr) |
| 1440 throw(CdlParseException, std::bad_alloc) | |
| 1441 { | 1425 { |
| 1442 CYG_REPORT_FUNCNAME("parse_or"); | 1426 CYG_REPORT_FUNCNAME("parse_or"); |
| 1443 | 1427 |
| 1444 parse_and(expr); | 1428 parse_and(expr); |
| 1445 while (T_Or == current_token) { | 1429 while (T_Or == current_token) { |
| 1458 CYG_REPORT_RETURN(); | 1442 CYG_REPORT_RETURN(); |
| 1459 } | 1443 } |
| 1460 | 1444 |
| 1461 static void | 1445 static void |
| 1462 parse_conditional(CdlExpression expr) | 1446 parse_conditional(CdlExpression expr) |
| 1463 throw(CdlParseException, std::bad_alloc) | |
| 1464 { | 1447 { |
| 1465 CYG_REPORT_FUNCNAME("parse_conditional"); | 1448 CYG_REPORT_FUNCNAME("parse_conditional"); |
| 1466 | 1449 |
| 1467 parse_or(expr); | 1450 parse_or(expr); |
| 1468 if (T_Questionmark == current_token) { | 1451 if (T_Questionmark == current_token) { |
| 1488 CYG_REPORT_RETURN(); | 1471 CYG_REPORT_RETURN(); |
| 1489 } | 1472 } |
| 1490 | 1473 |
| 1491 static void | 1474 static void |
| 1492 parse_expression(CdlExpression expr) | 1475 parse_expression(CdlExpression expr) |
| 1493 throw(CdlParseException, std::bad_alloc) | |
| 1494 { | 1476 { |
| 1495 CYG_REPORT_FUNCNAME("parse_expression"); | 1477 CYG_REPORT_FUNCNAME("parse_expression"); |
| 1496 | 1478 |
| 1497 parse_conditional(expr); | 1479 parse_conditional(expr); |
| 1498 | 1480 |
| 1501 | 1483 |
| 1502 // ---------------------------------------------------------------------------- | 1484 // ---------------------------------------------------------------------------- |
| 1503 // The entry point. | 1485 // The entry point. |
| 1504 void | 1486 void |
| 1505 CdlExpressionBody::continue_parse(CdlExpression expr, std::string data, int& index, CdlExprOp& token, int& token_end) | 1487 CdlExpressionBody::continue_parse(CdlExpression expr, std::string data, int& index, CdlExprOp& token, int& token_end) |
| 1506 throw(CdlParseException, std::bad_alloc) | |
| 1507 { | 1488 { |
| 1508 CYG_REPORT_FUNCNAME("CdlExpression::continue_parse"); | 1489 CYG_REPORT_FUNCNAME("CdlExpression::continue_parse"); |
| 1509 CYG_REPORT_FUNCARG1XV(expr); | 1490 CYG_REPORT_FUNCARG1XV(expr); |
| 1510 CYG_PRECONDITION_CLASSC(expr); | 1491 CYG_PRECONDITION_CLASSC(expr); |
| 1511 CYG_PRECONDITIONC((CdlExprOp_Invalid == token) || (CdlExprOp_And == token)); | 1492 CYG_PRECONDITIONC((CdlExprOp_Invalid == token) || (CdlExprOp_And == token)); |
| 1538 // to a simple tree, so evaluation involves some recursion and a big | 1519 // to a simple tree, so evaluation involves some recursion and a big |
| 1539 // switch statement. | 1520 // switch statement. |
| 1540 | 1521 |
| 1541 static void | 1522 static void |
| 1542 evaluate_subexpr(CdlEvalContext& context, CdlExpression expr, int subexpr_index, CdlSimpleValue& result) | 1523 evaluate_subexpr(CdlEvalContext& context, CdlExpression expr, int subexpr_index, CdlSimpleValue& result) |
| 1543 throw(CdlEvalException, std::bad_alloc) | |
| 1544 { | 1524 { |
| 1545 CYG_REPORT_FUNCNAME("evaluate_subexpr"); | 1525 CYG_REPORT_FUNCNAME("evaluate_subexpr"); |
| 1546 CYG_REPORT_FUNCARG2XV(expr, subexpr_index); | 1526 CYG_REPORT_FUNCARG2XV(expr, subexpr_index); |
| 1547 CYG_ASSERTC((subexpr_index >= 0) && ((unsigned int)subexpr_index < expr->sub_expressions.size())); | 1527 CYG_ASSERTC((subexpr_index >= 0) && ((unsigned int)subexpr_index < expr->sub_expressions.size())); |
| 1548 | 1528 |
| 2074 } | 2054 } |
| 2075 | 2055 |
| 2076 // ---------------------------------------------------------------------------- | 2056 // ---------------------------------------------------------------------------- |
| 2077 void | 2057 void |
| 2078 CdlExpressionBody::eval_internal(CdlEvalContext& context, CdlSimpleValue& result) | 2058 CdlExpressionBody::eval_internal(CdlEvalContext& context, CdlSimpleValue& result) |
| 2079 throw(CdlEvalException, std::bad_alloc) | |
| 2080 { | 2059 { |
| 2081 CYG_REPORT_FUNCNAME("CdlExpression::eval_internal)"); | 2060 CYG_REPORT_FUNCNAME("CdlExpression::eval_internal)"); |
| 2082 CYG_REPORT_FUNCARG3XV(this, &context, &result); | 2061 CYG_REPORT_FUNCARG3XV(this, &context, &result); |
| 2083 CYG_INVARIANT_THISC(CdlExpressionBody); | 2062 CYG_INVARIANT_THISC(CdlExpressionBody); |
| 2084 CYG_PRECONDITION_CLASSOC(context); | 2063 CYG_PRECONDITION_CLASSOC(context); |
| 2231 // | 2210 // |
| 2232 // continue_parse() is supposed to do all the hard work. | 2211 // continue_parse() is supposed to do all the hard work. |
| 2233 | 2212 |
| 2234 CdlExpression | 2213 CdlExpression |
| 2235 CdlExpressionBody::parse(std::string data) | 2214 CdlExpressionBody::parse(std::string data) |
| 2236 throw(CdlParseException, std::bad_alloc) | |
| 2237 { | 2215 { |
| 2238 CYG_REPORT_FUNCNAMETYPE("CdlExpression::parse", "result %p"); | 2216 CYG_REPORT_FUNCNAMETYPE("CdlExpression::parse", "result %p"); |
| 2239 | 2217 |
| 2240 CdlExpression result = 0; | 2218 CdlExpression result = 0; |
| 2241 int index = 0; | 2219 int index = 0; |
| 2258 return result; | 2236 return result; |
| 2259 } | 2237 } |
| 2260 | 2238 |
| 2261 CdlExpression | 2239 CdlExpression |
| 2262 CdlExpressionBody::parse(std::string data, int& index, CdlExprOp& next_token, int& token_end) | 2240 CdlExpressionBody::parse(std::string data, int& index, CdlExprOp& next_token, int& token_end) |
| 2263 throw(CdlParseException, std::bad_alloc) | |
| 2264 { | 2241 { |
| 2265 CYG_REPORT_FUNCNAMETYPE("CdlExpression::parse", "result %d"); | 2242 CYG_REPORT_FUNCNAMETYPE("CdlExpression::parse", "result %d"); |
| 2266 | 2243 |
| 2267 CdlExpression result = new CdlExpressionBody; | 2244 CdlExpression result = new CdlExpressionBody; |
| 2268 | 2245 |
| 2399 // eval_internal() member function does not, and is used for list | 2376 // eval_internal() member function does not, and is used for list |
| 2400 // and goal expressions as well. | 2377 // and goal expressions as well. |
| 2401 | 2378 |
| 2402 void | 2379 void |
| 2403 CdlExpressionBody::eval(CdlEvalContext& context, CdlSimpleValue& result) | 2380 CdlExpressionBody::eval(CdlEvalContext& context, CdlSimpleValue& result) |
| 2404 throw(CdlEvalException, std::bad_alloc) | |
| 2405 { | 2381 { |
| 2406 CYG_REPORT_FUNCNAME("CdlExpression::eval"); | 2382 CYG_REPORT_FUNCNAME("CdlExpression::eval"); |
| 2407 | 2383 |
| 2408 try { | 2384 try { |
| 2409 | 2385 |
| 2594 // Parsing a list expression involves repeated parsing of ordinary | 2570 // Parsing a list expression involves repeated parsing of ordinary |
| 2595 // expressions until an EOD token is reached. | 2571 // expressions until an EOD token is reached. |
| 2596 | 2572 |
| 2597 CdlListExpression | 2573 CdlListExpression |
| 2598 CdlListExpressionBody::parse(std::string data) | 2574 CdlListExpressionBody::parse(std::string data) |
| 2599 throw(CdlParseException, std::bad_alloc) | |
| 2600 { | 2575 { |
| 2601 CYG_REPORT_FUNCNAMETYPE("CdlListExpression::parse", "result %p"); | 2576 CYG_REPORT_FUNCNAMETYPE("CdlListExpression::parse", "result %p"); |
| 2602 | 2577 |
| 2603 // Allocate an expression object that can then be filled in. | 2578 // Allocate an expression object that can then be filled in. |
| 2604 CdlListExpression result = new CdlListExpressionBody; | 2579 CdlListExpression result = new CdlListExpressionBody; |
| 2727 // ---------------------------------------------------------------------------- | 2702 // ---------------------------------------------------------------------------- |
| 2728 // Evaluation. The hard work is actually done in eval_internal() | 2703 // Evaluation. The hard work is actually done in eval_internal() |
| 2729 | 2704 |
| 2730 void | 2705 void |
| 2731 CdlListExpressionBody::eval(CdlEvalContext& context, CdlListValue& result) | 2706 CdlListExpressionBody::eval(CdlEvalContext& context, CdlListValue& result) |
| 2732 throw(CdlEvalException, std::bad_alloc) | |
| 2733 { | 2707 { |
| 2734 CYG_REPORT_FUNCNAME("CdlListExpression::eval"); | 2708 CYG_REPORT_FUNCNAME("CdlListExpression::eval"); |
| 2735 CYG_REPORT_FUNCARG3XV(this, &context, &result); | 2709 CYG_REPORT_FUNCARG3XV(this, &context, &result); |
| 2736 CYG_PRECONDITION_THISC(); | 2710 CYG_PRECONDITION_THISC(); |
| 2737 CYG_PRECONDITION_CLASSOC(context); | 2711 CYG_PRECONDITION_CLASSOC(context); |
| 2746 // vectors and adding the result to the appropriate vector in result. | 2720 // vectors and adding the result to the appropriate vector in result. |
| 2747 // Various error conditions are possible. | 2721 // Various error conditions are possible. |
| 2748 | 2722 |
| 2749 void | 2723 void |
| 2750 CdlListExpressionBody::eval_internal(CdlEvalContext& context, CdlListValue& result) | 2724 CdlListExpressionBody::eval_internal(CdlEvalContext& context, CdlListValue& result) |
| 2751 throw(CdlEvalException, std::bad_alloc) | |
| 2752 { | 2725 { |
| 2753 CYG_REPORT_FUNCNAME("CdlListExpression::eval_internal"); | 2726 CYG_REPORT_FUNCNAME("CdlListExpression::eval_internal"); |
| 2754 CYG_REPORT_FUNCARG2XV(this, &context); | 2727 CYG_REPORT_FUNCARG2XV(this, &context); |
| 2755 | 2728 |
| 2756 result.table.clear(); | 2729 result.table.clear(); |
| 2832 | 2805 |
| 2833 // ---------------------------------------------------------------------------- | 2806 // ---------------------------------------------------------------------------- |
| 2834 | 2807 |
| 2835 bool | 2808 bool |
| 2836 CdlListExpressionBody::is_member(CdlEvalContext& context, CdlSimpleValue& val) | 2809 CdlListExpressionBody::is_member(CdlEvalContext& context, CdlSimpleValue& val) |
| 2837 throw(CdlEvalException, std::bad_alloc) | |
| 2838 { | 2810 { |
| 2839 CYG_REPORT_FUNCNAMETYPE("CdlListExpression::is_member (value)", "result %d"); | 2811 CYG_REPORT_FUNCNAMETYPE("CdlListExpression::is_member (value)", "result %d"); |
| 2840 CYG_REPORT_FUNCARG3XV(this, &context, &val); | 2812 CYG_REPORT_FUNCARG3XV(this, &context, &val); |
| 2841 CYG_PRECONDITION_THISC(); | 2813 CYG_PRECONDITION_THISC(); |
| 2842 CYG_PRECONDITION_CLASSOC(context); | 2814 CYG_PRECONDITION_CLASSOC(context); |
| 2850 return result; | 2822 return result; |
| 2851 } | 2823 } |
| 2852 | 2824 |
| 2853 bool | 2825 bool |
| 2854 CdlListExpressionBody::is_member(CdlEvalContext& context, std::string val) | 2826 CdlListExpressionBody::is_member(CdlEvalContext& context, std::string val) |
| 2855 throw(CdlEvalException, std::bad_alloc) | |
| 2856 { | 2827 { |
| 2857 CYG_REPORT_FUNCNAMETYPE("CdlListExpression::is_member (string)", "result %d"); | 2828 CYG_REPORT_FUNCNAMETYPE("CdlListExpression::is_member (string)", "result %d"); |
| 2858 CYG_REPORT_FUNCARG2XV(this, &context); | 2829 CYG_REPORT_FUNCARG2XV(this, &context); |
| 2859 CYG_PRECONDITION_THISC(); | 2830 CYG_PRECONDITION_THISC(); |
| 2860 CYG_PRECONDITION_CLASSOC(context); | 2831 CYG_PRECONDITION_CLASSOC(context); |
| 2868 return result; | 2839 return result; |
| 2869 } | 2840 } |
| 2870 | 2841 |
| 2871 bool | 2842 bool |
| 2872 CdlListExpressionBody::is_member(CdlEvalContext& context, cdl_int val) | 2843 CdlListExpressionBody::is_member(CdlEvalContext& context, cdl_int val) |
| 2873 throw(CdlEvalException, std::bad_alloc) | |
| 2874 { | 2844 { |
| 2875 CYG_REPORT_FUNCNAMETYPE("CdlListExpression::is_member (int)", "result %d"); | 2845 CYG_REPORT_FUNCNAMETYPE("CdlListExpression::is_member (int)", "result %d"); |
| 2876 CYG_REPORT_FUNCARG3XV(this, &context, (int) val); | 2846 CYG_REPORT_FUNCARG3XV(this, &context, (int) val); |
| 2877 CYG_PRECONDITION_THISC(); | 2847 CYG_PRECONDITION_THISC(); |
| 2878 CYG_PRECONDITION_CLASSOC(context); | 2848 CYG_PRECONDITION_CLASSOC(context); |
| 2886 return result; | 2856 return result; |
| 2887 } | 2857 } |
| 2888 | 2858 |
| 2889 bool | 2859 bool |
| 2890 CdlListExpressionBody::is_member(CdlEvalContext& context, double val) | 2860 CdlListExpressionBody::is_member(CdlEvalContext& context, double val) |
| 2891 throw(CdlEvalException, std::bad_alloc) | |
| 2892 { | 2861 { |
| 2893 CYG_REPORT_FUNCNAMETYPE("CdlListExpression::is_member (double)", "result %d"); | 2862 CYG_REPORT_FUNCNAMETYPE("CdlListExpression::is_member (double)", "result %d"); |
| 2894 CYG_REPORT_FUNCARG2XV(this, &context); | 2863 CYG_REPORT_FUNCARG2XV(this, &context); |
| 2895 CYG_PRECONDITION_THISC(); | 2864 CYG_PRECONDITION_THISC(); |
| 2896 CYG_PRECONDITION_CLASSOC(context); | 2865 CYG_PRECONDITION_CLASSOC(context); |
| 2978 // easier) but it is almost as easy to derive a goal expression from | 2947 // easier) but it is almost as easy to derive a goal expression from |
| 2979 // an ordinary one. | 2948 // an ordinary one. |
| 2980 | 2949 |
| 2981 CdlGoalExpression | 2950 CdlGoalExpression |
| 2982 CdlGoalExpressionBody::parse(std::string data) | 2951 CdlGoalExpressionBody::parse(std::string data) |
| 2983 throw(CdlParseException, std::bad_alloc) | |
| 2984 { | 2952 { |
| 2985 CYG_REPORT_FUNCNAMETYPE("CdlGoalExpression::parse", "result %p"); | 2953 CYG_REPORT_FUNCNAMETYPE("CdlGoalExpression::parse", "result %p"); |
| 2986 | 2954 |
| 2987 CdlGoalExpression result = new CdlGoalExpressionBody; | 2955 CdlGoalExpression result = new CdlGoalExpressionBody; |
| 2988 | 2956 |
| 3016 } | 2984 } |
| 3017 | 2985 |
| 3018 // ---------------------------------------------------------------------------- | 2986 // ---------------------------------------------------------------------------- |
| 3019 void | 2987 void |
| 3020 CdlGoalExpressionBody::eval(CdlEvalContext& context, bool& result) | 2988 CdlGoalExpressionBody::eval(CdlEvalContext& context, bool& result) |
| 3021 throw(CdlEvalException, std::bad_alloc) | |
| 3022 { | 2989 { |
| 3023 CYG_REPORT_FUNCNAME("CdlGoalExpression::eval"); | 2990 CYG_REPORT_FUNCNAME("CdlGoalExpression::eval"); |
| 3024 CYG_REPORT_FUNCARG2XV(this, &context); | 2991 CYG_REPORT_FUNCARG2XV(this, &context); |
| 3025 CYG_PRECONDITION_THISC(); | 2992 CYG_PRECONDITION_THISC(); |
| 3026 CYG_PRECONDITION_CLASSOC(context); | 2993 CYG_PRECONDITION_CLASSOC(context); |
| 3030 CYG_REPORT_RETURN(); | 2997 CYG_REPORT_RETURN(); |
| 3031 } | 2998 } |
| 3032 | 2999 |
| 3033 bool | 3000 bool |
| 3034 CdlGoalExpressionBody::eval(CdlEvalContext& context) | 3001 CdlGoalExpressionBody::eval(CdlEvalContext& context) |
| 3035 throw(CdlEvalException, std::bad_alloc) | |
| 3036 { | 3002 { |
| 3037 CYG_REPORT_FUNCNAMETYPE("CdlGoalExpression::eval", "result %d"); | 3003 CYG_REPORT_FUNCNAMETYPE("CdlGoalExpression::eval", "result %d"); |
| 3038 CYG_REPORT_FUNCARG2XV(this, &context); | 3004 CYG_REPORT_FUNCARG2XV(this, &context); |
| 3039 CYG_PRECONDITION_THISC(); | 3005 CYG_PRECONDITION_THISC(); |
| 3040 CYG_PRECONDITION_CLASSOC(context); | 3006 CYG_PRECONDITION_CLASSOC(context); |
| 3093 | 3059 |
| 3094 // ---------------------------------------------------------------------------- | 3060 // ---------------------------------------------------------------------------- |
| 3095 | 3061 |
| 3096 void | 3062 void |
| 3097 CdlGoalExpressionBody::eval_internal(CdlEvalContext& context, bool& result) | 3063 CdlGoalExpressionBody::eval_internal(CdlEvalContext& context, bool& result) |
| 3098 throw(CdlEvalException, std::bad_alloc) | |
| 3099 { | 3064 { |
| 3100 CYG_REPORT_FUNCNAME("CdlGoalExpression::eval_internal"); | 3065 CYG_REPORT_FUNCNAME("CdlGoalExpression::eval_internal"); |
| 3101 CYG_REPORT_FUNCARG2XV(this, &context); | 3066 CYG_REPORT_FUNCARG2XV(this, &context); |
| 3102 // The assertions are all done in the calling code | 3067 // The assertions are all done in the calling code |
| 3103 | 3068 |
