00001
00002
00003 #ifdef POLARIS_GNU_PRAGMAS
00004
00005 #pragma implementation "AnyExpr.h"
00006 #pragma implementation "AnyExprSubset.h"
00007
00008 #pragma implementation "Wildcard.h"
00009 #pragma implementation "WildcardOr.h"
00010 #pragma implementation "WildcardAnd.h"
00011 #pragma implementation "WildcardNot.h"
00012
00013 #pragma implementation "WildcardContains.h"
00014
00015 #pragma implementation "AnySuchThat.h"
00016
00017 #pragma implementation "AnyOfSpecificType.h"
00018 #pragma implementation "AnyOfType.h"
00019
00020 #pragma implementation "AnyID.h"
00021 #pragma implementation "AnyArrayRef.h"
00022 #pragma implementation "AnyComma.h"
00023 #pragma implementation "AnyFunctionCall.h"
00024 #pragma implementation "AnyIntrinsicCall.h"
00025
00026 #pragma implementation "AnyIntConst.h"
00027 #pragma implementation "AnyHollerithConst.h"
00028 #pragma implementation "AnyLogicalConst.h"
00029 #pragma implementation "AnyRealConst.h"
00030 #pragma implementation "AnyStringConst.h"
00031 #pragma implementation "AnyComplexConst.h"
00032
00033 #pragma implementation "MultipleArgWildcard.h"
00034
00035 #endif
00036
00037 #include "AnyExpr.h"
00038 #include "AnyExprSubset.h"
00039
00040 #include "WildcardOr.h"
00041 #include "WildcardAnd.h"
00042 #include "WildcardNot.h"
00043
00044 #include "WildcardContains.h"
00045
00046 #include "AnySuchThat.h"
00047
00048 #include "AnyOfType.h"
00049
00050 #include "AnyID.h"
00051 #include "AnyArrayRef.h"
00052 #include "AnyComma.h"
00053 #include "AnyFunctionCall.h"
00054 #include "AnyIntrinsicCall.h"
00055
00056 #include "AnyIntConst.h"
00057 #include "AnyHollerithConst.h"
00058 #include "AnyLogicalConst.h"
00059 #include "AnyRealConst.h"
00060 #include "AnyStringConst.h"
00061 #include "AnyComplexConst.h"
00062
00063 #include "../Collection/Iterator.h"
00064 #include "../macros.h"
00065
00066 extern void
00067 print_prec_list(ostream & o, OP_TYPE ot, List<Expression> & l, const char *c);
00068
00069 #define unimplemented(func) { \
00070 cerr << "Error: " << func << " not implemented for Wildcards.\n"; \
00071 p_abort("(Error message above)"); \
00072 }
00073
00074 #define error_to_call(func) { \
00075 cerr << "Error: The function " << func << " may not be called for " \
00076 "Wildcards.\n"; \
00077 p_abort("(Error message above)"); \
00078 }
00079
00080 #define undecided(func) { \
00081 cerr << "Error: The function " << func << " may not be called for " \
00082 "Wildcards because " \
00083 "I don't yet know what on earth to do with it!"; \
00084 p_abort("(Error message above)"); \
00085 }
00086
00087
00088
00089
00090 Wildcard::Wildcard(OP_TYPE optype, const Type & type)
00091 : Expression(optype, type)
00092 {
00093 _matched = 0;
00094 _is_wildcard = True;
00095 }
00096
00097 void Wildcard::_backup_aux() {
00098 _clear();
00099 }
00100
00101 Boolean
00102 Wildcard::matched_exists() const
00103 {
00104 return _matched != 0;
00105 }
00106
00107 Expression &
00108 Wildcard::matched() const
00109 {
00110 p_assert(_matched != 0,
00111 "Wildcard::matched(): There is no match for this "
00112 "wildcard (try using the function matched_exists() to find out "
00113 "before calling Wildcard::matched()");
00114
00115 return *_matched;
00116 }
00117
00118 Boolean
00119 Wildcard::args_are_non_null() const
00120 {
00121 return True;
00122 }
00123
00124 RefList<Expression> *
00125 Wildcard::arg_refs() const
00126 {
00127 undecided("Wildcard::arg_refs()");
00128 return 0;
00129 }
00130
00131 void
00132 Wildcard::convert(BinRep & , Symtab & )
00133 {
00134 error_to_call("Wildcard::convert()");
00135 }
00136
00137 Expression *
00138 Wildcard::member_ref(const Symbol *)
00139 {
00140 error_to_call("Wildcard::member_ref()");
00141 return 0;
00142 }
00143
00144 Boolean
00145 Wildcard::is_side_effect_free(void) const
00146 {
00147 return True;
00148 }
00149
00150 Expression *
00151 Wildcard::_apply_rec(Expression * (* f)(Expression *))
00152 {
00153
00154 return f(this);
00155 }
00156
00157 Expression *
00158 Wildcard::_fold_top(void)
00159 {
00160 error_to_call("_fold_top(...)");
00161 return 0;
00162 }
00163
00164 Expression *
00165 Wildcard::_additive_inverse(void)
00166 {
00167 error_to_call("_additive_inverse(...)");
00168 return 0;
00169 }
00170
00171 Expression *
00172 Wildcard::_logical_complement(void)
00173 {
00174 error_to_call("_logical_complement(...)");
00175 return 0;
00176 }
00177
00178 Expression *
00179 Wildcard::_divides_evenly(const Symbol *)
00180 {
00181 error_to_call("_divides_evenly(...)");
00182 return 0;
00183 }
00184
00185 Expression *
00186 Wildcard::_divide_by_int(int &)
00187 {
00188 error_to_call("_divide_by_int(...)");
00189 return 0;
00190 }
00191
00192 int
00193 Wildcard::_gcd(void) const
00194 {
00195 error_to_call("_gcd(...)");
00196 return 0;
00197 }
00198
00199 Expression *
00200 Wildcard::_distribute_top(void)
00201 {
00202 error_to_call("_distribute_top(...)");
00203 return 0;
00204 }
00205
00206 Expression *
00207 Wildcard::_combine_rec()
00208 {
00209 undecided("_combine_rec()");
00210 return 0;
00211 }
00212
00213 Expression *
00214 Wildcard::_combine_top()
00215 {
00216 undecided("_combine_top()");
00217 return 0;
00218 }
00219
00220 Expression *
00221 Wildcard::_subst_var(const Symbol &, const Expression &)
00222 {
00223 undecided("_subst_var(...)");
00224 return 0;
00225 }
00226
00227
00228
00229
00230 MultipleArgWildcard::MultipleArgWildcard(OP_TYPE op,
00231 const Type &type,
00232 int num_args,
00233 Expression *expr1 GIV(0),
00234 Expression *expr2 GIV(0))
00235 : Wildcard(op, type)
00236 {
00237
00238
00239 if (expr1) _args.ins_last(expr1);
00240 if (expr2) _args.ins_last(expr2);
00241
00242 p_assert(num_args == _args.entries(),
00243 "MultipleArgWildcard: constructor: # args found != # args "
00244 "specified");
00245
00246 _args.fix_size();
00247 }
00248
00249 int
00250 MultipleArgWildcard::structures_OK() const
00251 {
00252 int num = 1;
00253
00254 for (Iterator<Expression> iter = _args; iter.valid(); ++iter, ++num) {
00255 if (!iter.current_valid()) {
00256 cerr << "MultipleArgWildcard::structures_OK(): "
00257 "Found an invalid argument (argument #"
00258 << num
00259 << ") in context of MultipleArgWildcard:\n" << endl << flush
00260 << *this << endl;
00261 return False;
00262 }
00263 if (!iter.current().structures_OK()) {
00264 cerr << "In context of MulitpleArgWildCard:\n" << endl << flush
00265 << *this << endl;
00266 return False;
00267 }
00268 }
00269
00270 return True;
00271 }
00272
00273 void
00274 MultipleArgWildcard::_backup_aux()
00275 {
00276
00277
00278 _clear();
00279
00280 for (Iterator<Expression> iter = _args; iter.valid(); ++iter) {
00281 iter.current()._backup();
00282 }
00283 }
00284
00285 List<Expression> &
00286 MultipleArgWildcard::arg_list() const {
00287 return CASTAWAY(List<Expression> &)_args;
00288 }
00289
00290
00291
00292
00293 WildcardOr::WildcardOr(Expression *expr1, Expression *expr2)
00294 : MultipleArgWildcard(OR_WC, make_type(UNKNOWN_TYPE), 2, expr1, expr2)
00295 {
00296 p_assert(expr1 != NULL && expr2 != NULL,
00297 "WildcardOr::WildcardOr(): Both arguments must be non-NULL");
00298 }
00299
00300 WildcardOr::WildcardOr(const WildcardOr &wc)
00301 : MultipleArgWildcard(wc.op(), wc.type(), 0)
00302 {
00303 _args.unfix_size();
00304 _args = wc._args;
00305 _args.fix_size();
00306 }
00307
00308 Expression *
00309 WildcardOr::clone() const
00310 {
00311 return new WildcardOr(*this);
00312 }
00313
00314 void
00315 WildcardOr::print_debug(ostream &o, Boolean debug) const
00316 {
00317 o << "<OR(";
00318 _args[0].print_debug(o, debug);
00319 o << ", ";
00320 _args[1].print_debug(o, debug);
00321 o << ")>";
00322 }
00323
00324 Boolean
00325 WildcardOr::_try_for_match(Expression &e, Boolean consider_side_effects)
00326 {
00327
00328
00329
00330
00331 if (e._wildcard_is_equal_to(_args[0], consider_side_effects) ||
00332 e._wildcard_is_equal_to(_args[1], consider_side_effects)) {
00333 _matched = &e;
00334 return True;
00335 }
00336 else {
00337 _matched = 0;
00338 return False;
00339 }
00340 }
00341
00342
00343
00344
00345 WildcardAnd::WildcardAnd(Expression *expr1, Expression *expr2)
00346 : MultipleArgWildcard(AND_WC, make_type(UNKNOWN_TYPE), 2, expr1, expr2)
00347 {
00348 p_assert(expr1 != NULL && expr2 != NULL,
00349 "WildcardAnd::WildcardAnd(): Both arguments must be non-NULL");
00350 }
00351
00352 WildcardAnd::WildcardAnd(const WildcardAnd &wc)
00353 : MultipleArgWildcard(wc.op(), wc.type(), 0)
00354 {
00355 _args.unfix_size();
00356 _args = wc._args;
00357 _args.fix_size();
00358 }
00359
00360 Expression *
00361 WildcardAnd::clone() const
00362 {
00363 return new WildcardAnd(*this);
00364 }
00365
00366 void
00367 WildcardAnd::print_debug(ostream &o, Boolean debug) const
00368 {
00369 o << "<AND(";
00370 _args[0].print_debug(o, debug);
00371 o << ", ";
00372 _args[1].print_debug(o, debug);
00373 o << ")>";
00374 }
00375
00376 Boolean
00377 WildcardAnd::_try_for_match(Expression &e, Boolean consider_side_effects)
00378 {
00379
00380
00381 if (e._wildcard_is_equal_to(_args[0], consider_side_effects)) {
00382
00383 if (e._wildcard_is_equal_to(_args[1], consider_side_effects)) {
00384
00385 _matched = &e;
00386 return True;
00387 }
00388
00389
00390
00391 _args[0]._backup();
00392 return False;
00393 }
00394 else {
00395 _matched = 0;
00396 return False;
00397 }
00398 }
00399
00400
00401
00402
00403 WildcardNot::WildcardNot(Expression *expr1)
00404 : MultipleArgWildcard(NOT_WC, make_type(UNKNOWN_TYPE), 1, expr1)
00405 {
00406 p_assert(expr1 != NULL,
00407 "WildcardNot::WildcardNot(): Argument must be non-NULL");
00408 }
00409
00410 WildcardNot::WildcardNot(const WildcardNot &wc)
00411 : MultipleArgWildcard(wc.op(), wc.type(), 0)
00412 {
00413 _args.unfix_size();
00414 _args = wc._args;
00415 _args.fix_size();
00416 }
00417
00418 Expression *
00419 WildcardNot::clone() const
00420 {
00421 return new WildcardNot(*this);
00422 }
00423
00424 void
00425 WildcardNot::print_debug(ostream &o, Boolean debug) const
00426 {
00427 o << "<NOT(";
00428 _args[0].print_debug(o, debug);
00429 o << ")>";
00430 }
00431
00432 Boolean
00433 WildcardNot::_try_for_match(Expression &e, Boolean consider_side_effects)
00434 {
00435 if ( ! e._wildcard_is_equal_to(_args[0], consider_side_effects) ) {
00436 _matched = &e;
00437 return True;
00438 }
00439 else {
00440 _matched = 0;
00441 return False;
00442 }
00443 }
00444
00445
00446
00447
00448 WildcardContains::WildcardContains(Expression *expr)
00449 : MultipleArgWildcard(CONTAINS_WC, make_type(UNKNOWN_TYPE), 1, expr)
00450 {
00451 p_assert(expr != NULL,
00452 "WildcardContains::WildcardContains(): Argument must be non-NULL");
00453 }
00454
00455 WildcardContains::WildcardContains(const WildcardContains &wc)
00456 : MultipleArgWildcard(wc.op(), wc.type(), 0)
00457 {
00458 _args.unfix_size();
00459 _args = wc._args;
00460 _args.fix_size();
00461 }
00462
00463 Expression *
00464 WildcardContains::clone() const
00465 {
00466 return new WildcardContains(*this);
00467 }
00468
00469 void
00470 WildcardContains::print_debug(ostream &o, Boolean debug) const
00471 {
00472 o << "<Contains(";
00473 _args[0].print_debug(o, debug);
00474 o << ")>";
00475 }
00476
00477 Boolean
00478 WildcardContains::_try_for_match(Expression &e, Boolean consider_side_effects)
00479 {
00480
00481
00482
00483
00484 if (e._wildcard_is_equal_to(_args[0], consider_side_effects)) {
00485
00486 _matched = &e;
00487 return True;
00488 }
00489
00490
00491 for (Iterator<Expression> iter = e.arg_list(); iter.valid(); ++iter) {
00492 if (_try_for_match(iter.current(), consider_side_effects)) {
00493
00494 return True;
00495 }
00496 }
00497
00498
00499 _matched = 0;
00500
00501 return False;
00502 }
00503
00504
00505
00506
00507 AnySuchThat::AnySuchThat(such_that_func condition_func,
00508 const ExtraInfo &extra_info,
00509 const char *printable_condition GIV(0))
00510 : Wildcard(SUCH_THAT_WC, make_type(UNKNOWN_TYPE))
00511 {
00512 p_assert(condition_func != 0,
00513 "AnySuchThat::AnySuchThat(): condition_func argument was NULL");
00514
00515 _func = condition_func;
00516 _info = extra_info.clone();
00517
00518 if (printable_condition)
00519 _printable_condition = printable_condition;
00520
00521
00522 }
00523
00524 AnySuchThat::AnySuchThat(const AnySuchThat &other)
00525 : Wildcard(SUCH_THAT_WC, other.type())
00526 {
00527 _func = other._func;
00528 _info = other._info->clone();
00529 _printable_condition = other._printable_condition;
00530 }
00531
00532 Expression *
00533 AnySuchThat::clone() const
00534 {
00535 return new AnySuchThat(*this);
00536 }
00537
00538 void
00539 AnySuchThat::print_debug(ostream &o, Boolean NOTUSED(debug)) const
00540 {
00541 o << "<AnySuchThat("
00542 << (_printable_condition.defined() ?
00543 (const char *)_printable_condition : "?")
00544 << ")>";
00545 }
00546
00547 Boolean
00548 AnySuchThat::_try_for_match(Expression &e,
00549 Boolean NOTUSED(consider_side_effects))
00550 {
00551 if ((*_func)(e, *_info)) {
00552 _matched = &e;
00553 return True;
00554 }
00555 else {
00556 _matched = 0;
00557 return False;
00558 }
00559 }
00560
00561 int
00562 AnySuchThat::structures_OK() const
00563 {
00564 return True;
00565 }
00566
00567
00568
00569
00570 AnyExpr::AnyExpr()
00571 : Wildcard(ANY_WC, make_type(UNKNOWN_TYPE))
00572 {
00573
00574 }
00575
00576 AnyExpr::AnyExpr(const AnyExpr &ae)
00577 : Wildcard(ANY_WC, ae.type())
00578 {
00579
00580 }
00581
00582 Boolean
00583 AnyExpr::_try_for_match(Expression &e,
00584 Boolean NOTUSED(consider_side_effects))
00585 {
00586 _matched = &e;
00587 return True;
00588 }
00589
00590 int
00591 AnyExpr::structures_OK() const
00592 {
00593 return True;
00594 }
00595
00596 Expression *
00597 AnyExpr::clone() const
00598 {
00599 return new AnyExpr(*this);
00600 }
00601
00602 void
00603 AnyExpr::print_debug(ostream &o, Boolean NOTUSED(debug)) const
00604 {
00605 o << "<AnyExpr>";
00606 }
00607
00608
00609
00610
00611 int
00612 AnyOfType::structures_OK() const
00613 {
00614 return True;
00615 }
00616
00617 Expression *
00618 AnyOfType::clone() const
00619 {
00620 return new AnyOfType(*this);
00621 }
00622
00623 void
00624 AnyOfType::print_debug(ostream &o, Boolean NOTUSED(debug)) const
00625 {
00626 o << "<AnyOfType(" << _op_type_to_match << ")>";
00627 }
00628
00629 Boolean
00630 AnyOfType::_try_for_match(Expression &e,
00631 Boolean NOTUSED(consider_side_effects))
00632 {
00633 if (e.op() == _op_type_to_match) {
00634 _matched = &e;
00635 return True;
00636 }
00637 else {
00638 _matched = 0;
00639 return False;
00640 }
00641 }
00642
00643 AnyOfType::AnyOfType(OP_TYPE op_type_to_match)
00644 : Wildcard(ANY_EXPR_OF_TYPE_WC, make_type(UNKNOWN_TYPE))
00645 {
00646 _matched = 0;
00647 _op_type_to_match = op_type_to_match;
00648 }
00649
00650 AnyOfType::AnyOfType(const AnyOfType &other)
00651 : Wildcard(ANY_EXPR_OF_TYPE_WC, other.type())
00652 {
00653 _matched = other._matched;
00654 _op_type_to_match = other._op_type_to_match;
00655 }
00656
00657
00658
00659
00660 AnyOfSpecificType::AnyOfSpecificType(OP_TYPE op_type_to_match,
00661 const char *name)
00662 : AnyOfType(op_type_to_match)
00663 {
00664 _name = name;
00665 }
00666
00667 AnyOfSpecificType::AnyOfSpecificType(const AnyOfSpecificType &other)
00668 : AnyOfType(other._op_type_to_match)
00669 {
00670 _name = other._name;
00671 _op = other._op;
00672 }
00673
00674 Expression *
00675 AnyOfSpecificType::clone() const
00676 {
00677
00678
00679
00680
00681
00682 return new AnyOfSpecificType(*this);
00683 }
00684
00685 void
00686 AnyOfSpecificType::print_debug(ostream &o, Boolean NOTUSED(debug)) const
00687 {
00688
00689
00690
00691 o << "<" << _name << ">";
00692 }
00693
00694
00695
00696
00697 AnyID::AnyID()
00698 : AnyOfSpecificType(ID_OP, "AnyID")
00699 {
00700
00701 }
00702
00703
00704
00705
00706 AnyIntConst::AnyIntConst()
00707 : AnyOfSpecificType(INTEGER_CONSTANT_OP, "AnyIntConst")
00708 {
00709
00710 }
00711
00712
00713
00714
00715 AnyHollerithConst::AnyHollerithConst()
00716 : AnyOfSpecificType(HOLLERITH_CONSTANT_OP, "AnyHollerithConst")
00717 {
00718
00719 }
00720
00721
00722
00723
00724 AnyLogicalConst::AnyLogicalConst()
00725 : AnyOfSpecificType(LOGICAL_CONSTANT_OP, "AnyLogicalConst")
00726 {
00727
00728 }
00729
00730
00731
00732
00733 AnyRealConst::AnyRealConst()
00734 : AnyOfSpecificType(REAL_CONSTANT_OP, "AnyRealConst")
00735 {
00736
00737 }
00738
00739
00740
00741
00742 AnyStringConst::AnyStringConst()
00743 : AnyOfSpecificType(STRING_CONSTANT_OP, "AnyStringConst")
00744 {
00745
00746 }
00747
00748
00749
00750
00751 AnyArrayRef::AnyArrayRef()
00752 : AnyOfSpecificType(ARRAY_REF_OP, "AnyArrayRef")
00753 {
00754
00755 }
00756
00757
00758
00759
00760 AnyComma::AnyComma()
00761 : AnyOfSpecificType(COMMA_OP, "AnyComma")
00762 {
00763
00764 }
00765
00766
00767
00768
00769 AnyComplexConst::AnyComplexConst()
00770 : AnyOfSpecificType(COMPLEX_OP, "AnyComplexConst")
00771 {
00772
00773 }
00774
00775
00776
00777
00778 AnyFunctionCall::AnyFunctionCall()
00779 : AnyOfSpecificType(FUNCTION_CALL_OP, "AnyFunctionCall")
00780 {
00781
00782 }
00783
00784
00785
00786
00787 AnyIntrinsicCall::AnyIntrinsicCall()
00788 : AnyOfSpecificType(INTRINSIC_CALL_OP, "AnyIntrinsicCall")
00789 {
00790
00791 }
00792
00793
00794
00795
00796 AnyExprSubset::AnyExprSubset()
00797 : Wildcard(ANY_EXPR_SUBSET_WC, make_type(UNKNOWN_TYPE))
00798 {
00799
00800 }
00801
00802 Expression *
00803 AnyExprSubset::clone() const
00804 {
00805 p_assert(0, "not implemented");
00806
00807
00808 return 0;
00809 }
00810
00811 void
00812 AnyExprSubset::print_debug(ostream &o, Boolean NOTUSED(debug)) const
00813 {
00814 o << "<.*>";
00815 }
00816
00817 Boolean
00818 AnyExprSubset::_try_for_match(Expression & NOTUSED(e),
00819 Boolean NOTUSED(consider_side_effects))
00820 {
00821 p_assert(False, "Internal Error: AnyExprSubset::_try_for_match(): "
00822 "This function should never get called directly");
00823 return False;
00824 }
00825
00826 int
00827 AnyExprSubset::structures_OK() const
00828 {
00829 return True;
00830 }
00831
00832
00833
00834 Wildcard *
00835 any_expr()
00836 {
00837 return new AnyExpr;
00838 }
00839
00840 Wildcard *
00841 any_expr_subset()
00842 {
00843 return new AnyExprSubset;
00844 }
00845
00846 Wildcard *
00847 wildcard_or(Expression *arg1, Expression *arg2)
00848 {
00849 return new WildcardOr(arg1, arg2);
00850 }
00851
00852 Wildcard *
00853 wildcard_and(Expression *arg1, Expression *arg2)
00854 {
00855 return new WildcardAnd(arg1, arg2);
00856 }
00857
00858 Wildcard *
00859 wildcard_not(Expression *arg1)
00860 {
00861 return new WildcardNot(arg1);
00862 }
00863
00864 Wildcard *
00865 wildcard_contains(Expression *arg1)
00866 {
00867 return new WildcardContains(arg1);
00868 }
00869
00870 Wildcard *
00871 any_such_that(such_that_func func,
00872 const ExtraInfo &extra_info,
00873 const char *printable_condition GIV(0))
00874 {
00875 return new AnySuchThat(func, extra_info, printable_condition);
00876 }
00877
00878 Wildcard *
00879 any_of_type(OP_TYPE op)
00880 {
00881 return new AnyOfType(op);
00882 }
00883
00884 Wildcard *
00885 any_id()
00886 {
00887 return new AnyID;
00888 }
00889
00890 Wildcard *
00891 any_array_ref()
00892 {
00893 return new AnyArrayRef;
00894 }
00895
00896 Wildcard *
00897 any_comma()
00898 {
00899 return new AnyComma;
00900 }
00901
00902 Wildcard *
00903 any_function_call()
00904 {
00905 return new AnyFunctionCall;
00906 }
00907
00908 Wildcard *
00909 any_intrinsic_call()
00910 {
00911 return new AnyIntrinsicCall;
00912 }
00913
00914 Wildcard *
00915 any_int_const()
00916 {
00917 return new AnyIntConst;
00918 }
00919
00920 Wildcard *
00921 any_hollerith_const()
00922 {
00923 return new AnyHollerithConst;
00924 }
00925
00926 Wildcard *
00927 any_logical_const()
00928 {
00929 return new AnyLogicalConst;
00930 }
00931
00932 Wildcard *
00933 any_real_const()
00934 {
00935 return new AnyRealConst;
00936 }
00937
00938 Wildcard *
00939 any_string_const()
00940 {
00941 return new AnyStringConst;
00942 }
00943
00944 Wildcard *
00945 any_complex_const()
00946 {
00947 return new AnyComplexConst;
00948 }
00949
00950
00951
00952
00953 const ExprSignature &
00954 Wildcard::_wildcard_update_signature()
00955 {
00956
00957 _clear();
00958
00959
00960 _signature_live().clear();
00961
00962 _signature_live().merge( (int) op() );
00963 _signature_live().merge( (int) type().data_type() );
00964 _signature_live().merge( type().size() );
00965
00966 _signature_live().has_wildcard(True);
00967
00968 return signature();
00969 }
00970
00971 const ExprSignature &
00972 AnyExpr::update_signature()
00973 {
00974 return _wildcard_update_signature();
00975 }
00976
00977 const ExprSignature &
00978 AnyExprSubset::update_signature()
00979 {
00980 return _wildcard_update_signature();
00981 }
00982
00983 const ExprSignature &
00984 AnySuchThat::update_signature()
00985 {
00986
00987
00988
00989 _wildcard_update_signature();
00990
00991 _signature_live().merge( (int) _func );
00992 _signature_live().merge( (int) _info );
00993
00994 return signature();
00995 }
00996
00997 const ExprSignature &
00998 AnyOfType::update_signature()
00999 {
01000 _wildcard_update_signature();
01001
01002 _signature_live().merge( (int) _op_type_to_match );
01003
01004 return signature();
01005 }
01006
01007 const ExprSignature &
01008 MultipleArgWildcard::update_signature()
01009 {
01010 Expression::update_signature();
01011
01012
01013 _signature_live().has_wildcard(True);
01014
01015 return signature();
01016 }
01017
01018
01019
01020 int
01021 AnyExpr::node_compare(const Expression &ex) const {
01022 p_assert(ex.op() == ANY_WC, "Mismatch");
01023 return 0;
01024 }
01025
01026 int
01027 AnyExprSubset::node_compare(const Expression &ex) const {
01028 p_assert(ex.op() == ANY_EXPR_SUBSET_WC, "Mismatch");
01029 return 0;
01030 }
01031
01032 int
01033 AnySuchThat::node_compare(const Expression &ex) const {
01034 p_assert(ex.op() == SUCH_THAT_WC, "Mismatch");
01035
01036
01037
01038
01039 AnySuchThat &other = (AnySuchThat &)ex;
01040
01041 if (_func != other._func) {
01042 return (int)_func - (int)other._func > 0 ? 1 : -1;
01043 }
01044
01045 if (_info != other._info) {
01046 return (int)_info > (int)other._info ? 1 : -1;
01047 }
01048
01049 return 0;
01050 }
01051
01052 int
01053 AnyOfType::node_compare(const Expression &ex) const {
01054 p_assert(ex.op() == ANY_EXPR_OF_TYPE_WC, "Mismatch");
01055
01056 AnyOfType & other = (AnyOfType &)ex;
01057
01058 if (_op_type_to_match < other._op_type_to_match)
01059 return -1;
01060 else if (_op_type_to_match > other._op_type_to_match)
01061 return 1;
01062 else
01063 return 0;
01064 }
01065
01066 int
01067 MultipleArgWildcard::node_compare(const Expression &ex) const {
01068 return Expression::node_compare(ex);
01069 }
01070