or_ics.cc

Go to the documentation of this file.
00001 /*
00002    The lestes compiler suite
00003    Copyright (C) 2002, 2003, 2004, 2005 Miroslav Tichy
00004    Copyright (C) 2002, 2003, 2004, 2005 Petr Zika
00005    Copyright (C) 2002, 2003, 2004, 2005 Vojtech Hala
00006    Copyright (C) 2002, 2003, 2004, 2005 Jiri Kosina
00007    Copyright (C) 2002, 2003, 2004, 2005 Pavel Sanda
00008    Copyright (C) 2002, 2003, 2004, 2005 Jan Zouhar
00009    Copyright (C) 2002, 2003, 2004, 2005 Rudolf Thomas
00010 
00011    This program is free software; you can redistribute it and/or modify
00012    it under the terms of the GNU General Public License as published by
00013    the Free Software Foundation; version 2 of the License.
00014 
00015    This program is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018    GNU General Public License for more details.
00019 
00020    See the full text of the GNU General Public License version 2, and
00021    the limitations in the file doc/LICENSE.
00022 
00023    By accepting the license the licensee waives any and all claims
00024    against the copyright holder(s) related in whole or in part to the
00025    work, its use, and/or the inability to use it.
00026  
00027  */
00028 /*! \file
00029  * Implementation of overload resolution algorithm (see chapters 4,8,13)
00030  *
00031  * TODO create a map for purposes of caching of functionals, representing
00032  * conversions to the same type
00033  *
00034  * \author jikos
00035  */
00036 #include <lestes/lang/cplus/sem/or_ics.g.hh>
00037 #include <lestes/lang/cplus/sem/or_ics_actual_visitors.g.hh>
00038 #include <lestes/lang/cplus/sem/ss_declaration.g.hh>
00039 #include <lestes/lang/cplus/sem/ss_misc.g.hh>
00040 #include <lestes/lang/cplus/sem/or_or.g.hh>
00041 #include <lestes/std/source_location.hh>
00042 #include <lestes/msg/logger.hh>
00043 #include <lestes/lang/cplus/sem/or_ics_logger.hh>
00044 #include <lestes/lang/cplus/sem/or_actual_visitors.g.hh>
00045 
00046 package(lestes);
00047 package(lang);
00048 package(cplus);
00049 package(sem);
00050 
00051 declare_logger( or_ics_log );
00052 initialize_logger( or_ics_log, "or_ics_finder", or_ics_logger );
00053 
00054 #define IS_PTR_BOOL_CONV(t1,t2) ((t1) == OR_CV_PTR || (t1) == OR_CV_MEMBER_PTR) && ((t2) == OR_CV_BOOL)
00055 #define IS_PTR(t1) ((t1) == OR_CV_PTR)
00056 #define IS_MEMBER_PTR(t1) ((t1) == OR_CV_MEMBER_PTR)
00057 #define IS_CLASS(t1) t1 == OR_CV_CLASS
00058 #define IS_VOID(t1) t1 == OR_CV_VOID
00059 #define DEREF_PTR(t1) (t1.dncast<ss_pointer>()->what_get()->accept_or_ics_base_cv(v))
00060 #define DEREF_PTR_NOVIS(t1) ((t1).dncast<ss_pointer>()->what_get())
00061 #define MEMBER_PTR_BASE(t1) ((t1).dncast<ss_member_pointer>()->base_get()).dncast<ss_class>()
00062 #define IS_VOLATILE(x) (((x) == OR_CV_VOLATILE) || (x) == OR_CV_CONST_VOLATILE)
00063 #define IS_PSEUDOREFERENCE(x) (((x) == OR_CV_PSEUDOREFERENCE))
00064 #define IS_REFERENCE(x) (((x) == OR_CV_REFERENCE))
00065 #define IS_CONST(x) (((x) == OR_CV_CONST))
00066 
00067 /*!
00068  * This function gets two conversions c1 and c2, represented by
00069  * their "left" and "rights" SCS and uc (l1,u1,r1 and l2,u2,r2 
00070  * respectively).
00071  *
00072  * the passed expression is the source expression of the conversion
00073  * 
00074  * \return true if conversion c1 is better than c2, else returns false
00075  */
00076 bool is_better_conv_seq (/*ptr< or_ics_functional > l1, ptr< or_ics_functional > u1,*/ ptr< or_ics_functional > r1, ptr< or_or_functional > e1,
00077                          /*ptr< or_ics_functional > l2, ptr< or_ics_functional > u2,*/ ptr< or_ics_functional > r2, ptr< or_or_functional > e2)
00078 {
00079         typedef ::lestes::std::list< srp< ss_type > > typelist;
00080         ptr< typelist > conv_list = typelist::create();
00081         ptr< typelist > list1, list2;
00082         typelist::iterator it1, it2;
00083         ptr< or_ics_functional_visitor > v_t = or_ics_functional_visitor::create(conv_list);
00084 
00085          /* if u1 != u2 return false;
00086           * rationale: 13.3.3.2/3
00087 
00088           if (!(u1->equals(u2)))
00089                 return false;
00090 
00091           */    
00092 
00093         if (r1->rank_get() < r2->rank_get()) {
00094                 return true;
00095         }
00096         /* 
00097          * now linearize the functionals into list of target types, for easy comparsion. This is done
00098          * using visitor on or_ics_functional. 
00099          * 
00100          * in this list, lval->rval conversions are already excluded
00101          */      
00102         list1 = r1->accept_or_ics_functional_base(v_t);
00103         list2 = r2->accept_or_ics_functional_base(v_t);
00104         
00105         /* now check if r1 is proper subsequence of r2 */
00106         it1 = list1->begin();
00107         it2 = list2->end();
00108 
00109         while (it1 != list1->end() && it2 != list2->end() && (*it1)->equals(*it2)) {
00110                 it1++;
00111                 it2++;
00112         }
00113         
00114         if (it1 == list1->end() && it2 != list2->end()) {
00115                 return true;
00116         }
00117         
00118         return false;
00119         
00120         /* The following code is not reached now. Will be used when user types work */
00121         /* TODO qualification and reference binding conversions tests */
00122 
00123         /* a conversion of (member) ptr to bool is worse than conversion which is not such 
00124          * conversion 
00125          */
00126         /* source and destination types */
00127         ptr< ss_type > s1 = e1->type_get();
00128         ptr< ss_type > s2 = e2->type_get();
00129         ptr< ss_type > t1 = (*(list1->end()));
00130         ptr< ss_type > t2 = (*(list2->end()));
00131         
00132         ptr< or_ics_visitor_cv > v = or_ics_visitor_cv::create();
00133         or_cv_enum ts1 = t1->accept_or_ics_base_cv(v);
00134         or_cv_enum ts2 = t1->accept_or_ics_base_cv(v);
00135         or_cv_enum tt1 = t1->accept_or_ics_base_cv(v);
00136         or_cv_enum tt2 = t2->accept_or_ics_base_cv(v);
00137         if (IS_PTR_BOOL_CONV(ts2,tt2) && !IS_PTR_BOOL_CONV(ts1,tt1))
00138                 return true;
00139 
00140         /* if *ts1 derived from *tt1, then ts1 ->tt1 is better than ts1* -> void*  when ts1 == ts2 */
00141         if (IS_PTR(ts1) && IS_PTR(tt1) && 
00142                 IS_CLASS(DEREF_PTR(s1)) && IS_CLASS(DEREF_PTR(t1)) && DEREF_PTR_NOVIS(t1).dncast<ss_class>()->is_ancestor(DEREF_PTR_NOVIS(s1).dncast<ss_class>()) &&
00143                 s1->equals(s2) && IS_PTR(tt2) && IS_VOID(DEREF_PTR(t2)))
00144                 return true;
00145         
00146         /* if *ts2 derived from *ts1, then ts1 -> void* is better than ts2 -> void* */
00147         if (IS_PTR(ts1) && IS_PTR(ts2) && IS_PTR(tt1) && IS_PTR(tt2) &&
00148                 IS_CLASS(DEREF_PTR(s1)) && IS_CLASS(DEREF_PTR(s2)) && IS_VOID(DEREF_PTR(t1)) && IS_VOID(DEREF_PTR(t2)) && 
00149                 DEREF_PTR_NOVIS(s1).dncast<ss_class>()->is_ancestor(DEREF_PTR_NOVIS(s2).dncast<ss_class>()))
00150                 return true;
00151         
00152         /* if *ts1 derived from *tt1 and *tt1 derived from *tt2 and ts1 == ts2 then tt1->ts1 better than tt2->ts2 */
00153 
00154         if (IS_PTR(ts1) && IS_PTR(tt1) && IS_PTR(tt2) &&
00155                 IS_CLASS(DEREF_PTR(s1)) && IS_CLASS(DEREF_PTR(t1)) && IS_CLASS(DEREF_PTR(t2)) &&
00156                 DEREF_PTR_NOVIS(t2).dncast<ss_class>()->is_ancestor(DEREF_PTR_NOVIS(t1).dncast<ss_class>()) 
00157                 && DEREF_PTR_NOVIS(t1).dncast<ss_class>()->is_ancestor(DEREF_PTR_NOVIS(s1).dncast<ss_class>()) &&
00158                 s1->equals(s2))
00159                 return true;
00160 
00161         /* TODO binding C -> &B better than C->&A */
00162 
00163         /* if *tt1 derived from *ts1 and *tt2 derived from *tt1 and ts1 == ts2 then
00164          * ts1::* -> tt1::* is better than ts2::* -> tt2::x */ 
00165 
00166         if (IS_MEMBER_PTR(ts1) && IS_MEMBER_PTR(tt1) && IS_MEMBER_PTR(tt2) && 
00167                 MEMBER_PTR_BASE(s1)->is_ancestor(MEMBER_PTR_BASE(t1)) &&
00168                 MEMBER_PTR_BASE(t1)->is_ancestor(MEMBER_PTR_BASE(t2)) &&
00169                 s1->equals(s2))
00170                 return true;
00171         
00172         /* ts1 derived from tt1 and tt1 derived from tt2, then ts1->tt1 is better than ts2->tt2 (if ts1==ts2) */
00173         if (IS_CLASS(ts1) && IS_CLASS(tt1) && IS_CLASS(tt2) &&
00174                 s1->equals(s2) && 
00175                 t1.dncast<ss_class>()->is_ancestor(s1.dncast<ss_class>()) && t2.dncast<ss_class>()->is_ancestor(t1.dncast<ss_class>()))
00176                 return true;
00177                 
00178         /* if (*tt1 == *tt2) and *ts1 derived from *tt1 and *ts2 derived from *ts1 then ts1->tt1 is better than ts2->tt2 */
00179         if (IS_PTR(tt1) && IS_PTR(ts1) && IS_PTR(ts2) &&
00180                 IS_CLASS(DEREF_PTR(t1)) && IS_CLASS(DEREF_PTR(s1)) && IS_CLASS(DEREF_PTR(s2)) &&
00181                 DEREF_PTR_NOVIS(t1).dncast<ss_class>()->is_ancestor(DEREF_PTR_NOVIS(s2).dncast<ss_class>()) &&
00182                 DEREF_PTR_NOVIS(s1).dncast<ss_class>()->is_ancestor(DEREF_PTR_NOVIS(s2).dncast<ss_class>()) &&
00183                 t1->equals(t2))
00184                 return true;
00185         /* TODO binding B->A& is better than binding C->A& */
00186 
00187         /* if *ts1 is derived from *ts2 and *tt1 is derived from *ts1 and tt1 == tt2, then ts1::*->tt1::* is better than 
00188          * ts2::*->tt2::*
00189          */
00190         
00191         if (IS_MEMBER_PTR(ts2) && IS_MEMBER_PTR(ts1) && IS_MEMBER_PTR(tt1) &&
00192                 MEMBER_PTR_BASE(s2)->is_ancestor(MEMBER_PTR_BASE(s1)) &&
00193                 MEMBER_PTR_BASE(s1)->is_ancestor(MEMBER_PTR_BASE(t1)) &&
00194                 t1->equals(t2))
00195                 return true;
00196 
00197         /* this happens only when initialization of user-defined conversion happens (13.3.3). this is the only case when
00198          * source types are diferrent 
00199          */
00200 
00201         if (IS_CLASS(tt1) && IS_CLASS(ts1) && IS_CLASS(ts2) &&
00202                 t1.dncast<ss_class>()->is_ancestor(s1.dncast<ss_class>()) &&
00203                 s1.dncast<ss_class>()->is_ancestor(s2.dncast<ss_class>())
00204                 && t1->equals(t2))
00205                 return true;
00206 
00207         return false;   
00208 }
00209 
00210 bool is_not_worse_conv_seq(/*ptr< or_ics_functional > l1, ptr< or_ics_functional > u1,*/ ptr< or_ics_functional > r1, ptr< or_or_functional > e1,
00211                          /*ptr< or_ics_functional > l2, ptr< or_ics_functional > u2,*/ ptr< or_ics_functional > r2, ptr< or_or_functional > e2)
00212 {
00213         return (!(is_better_conv_seq(/*l2, u2, */r2, e2, /* l1, u1,*/ r1, e1)));
00214 }
00215 
00216  
00217 /*!
00218  * This function filters out those conversions not converting to the type
00219  * of the target
00220  *
00221  * \return the filtered list
00222  */
00223 
00224 ptr< ::lestes::std::list< srp< or_ics_functional > > > filter_type(ptr< ::lestes::std::list< srp< or_ics_functional > > > lst, ptr< ss_type > tgt)
00225 {
00226         ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_del;
00227         ptr< or_ics_visitor_cv > v = or_ics_visitor_cv::create();
00228         ptr< ::lestes::std::list< srp< or_ics_functional > > > ret = ::lestes::std::list< srp< or_ics_functional > >::create();
00229         
00230         /* this cycle erases all functionals from list, not having target_type of tgt
00231          *
00232          * this takes care of (pseudo)references automatically
00233          */
00234         llog(or_ics_log) << "Filtering ...\n";
00235         for(it = lst->begin(); it != lst->end();it++){
00236                 /* are the types not references && are the same? */
00237                 if ( (*it)->target_type_get()->equals(tgt) ) {
00238                         ret->push_back(*it);
00239                         llog(or_ics_log) << "Found identical type\n";
00240                 }
00241         }
00242         return ret;
00243 }
00244 
00245 ptr< or_ics_functional > get_best_conversion(ptr< ::lestes::std::list< srp< or_ics_functional > > > lst, ptr< or_or_functional > e)
00246 {
00247         ::lestes::std::list< srp< or_ics_functional > >::iterator it = lst->begin();
00248         ptr< or_ics_functional > best = *it;
00249 
00250         for(; it != lst->end(); it++) {
00251                 if (is_better_conv_seq(*it, e, best, e)) 
00252                         best = *it;
00253         }
00254 
00255         return best;
00256 }
00257 
00258 /*!
00259  * This is the main function called by outside world - used to find implicit 
00260  * conversion sequence between source and target. It fires up visitor, depending
00261  * on the source type, which then constructs the conversion sequence.
00262 TODO: if the source expression is funcall && to vraci rval (neni referencni)
00263       potom identita je get (rank IDENTITY)
00264  * \return expression representing the implicit conversion sequence
00265  */
00266 ptr< or_ics_functional > or_find_ics(ptr< or_or_functional > source, ptr< ss_type > target)
00267 {
00268         typedef ::lestes::std::list< srp< or_ics_functional > > funclist;
00269 
00270         llog(or_ics_log) << "Entering or_find_ics()\n";
00271 
00272         ptr< funclist > scs_tgts_seq = funclist::create();
00273         ptr< funclist > scs_srcs_seq = funclist::create();
00274         ptr< funclist > filtered_list;
00275         
00276         ptr< or_ics_visitor_tgts > v_t = or_ics_visitor_tgts::create(source, 1, scs_tgts_seq);
00277         ptr< or_ics_functional > best_conv;
00278         
00279         ptr< funclist > scs_imaginable_tgts, scs_imaginable_srcs;
00280         
00281         /* this finds all SCS-imaginable types for source type. It can remember the phase 
00282          * so calling it three times causes multiple phases to be called.
00283          */
00284 
00285         llog(or_ics_log) << "Executing first phase\n";
00286         scs_imaginable_tgts = source->type_get()->accept_or_ics_base(v_t);
00287 
00288         /* the pseudoreference performs the recursion itself, so we must not to run it here again */
00289         ptr< or_ics_visitor_cv > v = or_ics_visitor_cv::create(); 
00290         if(source->type_get()->accept_or_ics_base_cv(v) != OR_CV_PSEUDOREFERENCE) {
00291                 /* for non-pseudoreferences, the identity is handled here */
00292                 ptr< ss_type > type1 = source->type_get();
00293                 ptr< or_ics_functional_for_std_conversion > conversion1 = or_ics_functional_for_std_conversion::create(RANK_EXACT, type1);
00294                 scs_tgts_seq->push_back(conversion1);
00295                 
00296                 llog(or_ics_log) << "Source is not pseudoreference, executing second and third phases\n";
00297                 scs_imaginable_tgts = source->type_get()->accept_or_ics_base(v_t);
00298                 scs_imaginable_tgts = source->type_get()->accept_or_ics_base(v_t);
00299         }
00300                 
00301         llog(or_ics_log) << "Found " << scs_imaginable_tgts->size() << " imaginable target types\n";
00302         
00303         /* for each element of the target, 
00304          * - if the imaginable tgt is builtin type, lookup is performed and user-defined conversions (by constructor)
00305          * possible and create list of pairs {l1, u1}, where l1\elem scs_imaginable_tgts and
00306          * u1 \elem user_defined_conversions from type l1 
00307          *
00308          * - if the imaginable tgt is class (and therefore the source was also class and the conversion
00309          * was just derived-to-base standard conversion), it is now neccessary to search for user-defined
00310          * conversion functions, generate appropriate conversion by this conversion function, and continue
00311          * with generating 'left' part of the ICS
00312          * 
00313          * this is TODO
00314          */
00315         
00316         /* filter out those not having the type of target */
00317 
00318         filtered_list = filter_type(scs_imaginable_tgts, target);
00319         
00320         llog(or_ics_log) << "After filtering " << filtered_list->size() << " left\n";
00321         
00322         /* now get the best conversion from those remaining in the list.
00323          * this will be more useful as soon as user-def conversions come
00324          * on scene. 
00325          *
00326          * Just for now, not having user types and user conversions 
00327          * so far, return the first from filtered_list (if we are
00328          * in builtin type situation, there should be just one anyway).
00329          * 
00330          * this is TODO FIXME as long as we are going to handle user types and conversions
00331          */
00332 //      best_conv = get_best_conversion(filtered_list, source);
00333 //      return best_conv;       
00334         
00335         if (filtered_list->size() > 0) 
00336                 return filtered_list->front();
00337         else
00338                 return NULL;
00339 }
00340 
00341 /*!
00342  * Represents the functional for standard conversion (chap. 4)
00343  * \return ss_conversion structure representing the conversion
00344  */
00345 ptr< ss_expression > or_ics_functional_for_std_conversion::operator()(
00346                                                 ptr< ss_expression > arg, ptr< ss_sp > psp, ptr< ss_sp > nsp)
00347 {
00348         if (target_type_get()->equals(arg->type_get()))
00349                 return arg;
00350         else    
00351                 return ss_conversion::create    (arg->location_get(),
00352                                 target_type_get(), 
00353                                 psp,
00354                                 nsp,
00355                                 arg,
00356                                 arg->type_get()
00357                                 );
00358 }
00359 
00360 /*!
00361  * Represents the functional for array-to-pointer conversion (chap. 4)
00362  * \return ss_conversion structure representing the conversion
00363  */
00364 ptr< ss_expression > or_ics_functional_for_arr_ptr_conversion::operator()(
00365                                                 ptr< ss_expression > arg, ptr< ss_sp > psp, ptr< ss_sp > nsp)
00366 {
00367         return ss_array_to_pointer::create      (arg->location_get(),
00368                         target_type_get(), 
00369                         psp,
00370                         nsp,
00371                         arg,
00372                         arg->type_get()
00373                         );
00374 }
00375 
00376 /*!
00377  * Represents the functional for reference binding conversion.
00378  * \return ss_ structure representing the conversion
00379  */
00380 ptr< ss_expression > or_ics_functional_for_reference_bind_conversion::operator()(
00381                                                 ptr< ss_expression > arg, ptr< ss_sp > psp, ptr< ss_sp > nsp)
00382 {
00383         return ss_bind_reference::create        (arg->location_get(),
00384                                 target_type_get(), 
00385                                 psp,
00386                                 nsp,
00387                                 arg,
00388                                 arg->type_get()
00389                                 );
00390 }
00391 
00392 /*!
00393  * Represents the functional for rval to const reference binding (using temporary).
00394  * \return ss_ structure representing the conversion
00395  */
00396 ptr< ss_expression > or_ics_functional_for_bind_to_temporary_conversion::operator()(
00397                                                 ptr< ss_expression > arg, ptr< ss_sp > psp, ptr< ss_sp > nsp)
00398 {
00399         return ss_bind_to_temporary::create     (arg->location_get(),
00400                                 target_type_get(), 
00401                                 psp,
00402                                 nsp,
00403                                 arg,
00404                                 arg->type_get()
00405                                 );
00406 }
00407 
00408 
00409 /*!
00410  * Represents the functional for lvalue-rvalue (chap. 3)
00411 FIXME: should be singleton, as all lval->rval are reperented by the
00412        very same functional.
00413  * \return ss_conversion structure representing the conversion
00414  */
00415 ptr< ss_expression > or_ics_functional_for_lval_rval_conversion::operator()(
00416                                                 ptr< ss_expression > arg,ptr< ss_sp > psp, ptr< ss_sp > nsp)
00417 {
00418         ptr< or_ics_visitor_cv > v = or_ics_visitor_cv::create();
00419 
00420         if(IS_VOLATILE(arg->type_get()->accept_or_ics_base_cv(v))) 
00421                 return ss_vol_get::create(arg->location_get(), 
00422                         arg->type_get(), 
00423                         psp, 
00424                         nsp, 
00425                         arg);
00426         else if (IS_PSEUDOREFERENCE(arg->type_get()->accept_or_ics_base_cv(v))) 
00427                 if(IS_CONST(arg->type_get().dncast<ss_pseudoreference>()->what_get()->accept_or_ics_base_cv(v)))
00428                         return ss_get::create(arg->location_get(),
00429                                 arg->type_get().dncast<ss_pseudoreference>()->what_get().dncast<ss_const>()->what_get(),
00430                                 psp,
00431                                 nsp,
00432                                 arg);
00433                 else
00434                         return ss_get::create(arg->location_get(),
00435                                 arg->type_get().dncast<ss_pseudoreference>()->what_get(),
00436                                 psp,
00437                                 nsp,
00438                                 arg);
00439         else if (IS_REFERENCE(arg->type_get()->accept_or_ics_base_cv(v))) 
00440                 return ss_get::create(arg->location_get(),
00441                         arg->type_get().dncast<ss_reference>()->what_get(),
00442                         psp,
00443                         nsp,
00444                         arg);
00445         else
00446                 lassert2(false, "Don't know how to do lval->rval conversion for this type\n");
00447                 return NULL;
00448 }
00449 
00450 /*!
00451  * Represents the functional for user conversion by constructor (12.3.1)
00452  * \return funcall, representing the call of converting constructor
00453  */
00454 ptr< ss_expression > or_ics_functional_for_user_conversion_by_constructor::operator()(
00455                                                 ptr< ss_expression > arg, ptr< ss_sp > psp, ptr< ss_sp > nsp)
00456 {
00457         ptr< ::lestes::std::list< srp< ss_expression > > >      arg_list;
00458         /* there is only one argument to constructor */
00459         arg_list->push_back(arg);
00460 
00461         return ss_funcall::create(arg->location_get(),
00462                                 target_type_get(),
00463                                 psp,
00464                                 nsp,
00465                                 arg_list,
00466                                 used_constructor);      
00467 
00468 }
00469 
00470 /*!
00471  * Represents the functional for user conversion by conversion functions 
00472  * (12.3.2)
00473  * \return funcall, representing the call of conversion function
00474  */
00475 ptr< ss_expression > or_ics_functional_for_user_conversion_by_conversion_function::operator()(
00476                                                 ptr< ss_expression > arg, ptr< ss_sp > psp, ptr< ss_sp > nsp)
00477 {
00478         ptr< ::lestes::std::list< srp< ss_expression > > >      arg_list;
00479         /* there is only one argument to constructor */
00480         arg_list->push_back(arg);
00481 
00482         /* check whether the chosen conversion function is virtual */
00483         /* conversion funtion is a method, hence the dncast is correct */
00484         if (used_conversion_function_get().dncast<ss_method_declaration>()->virtuality_get())
00485                 return ss_vfuncall::create(arg->location_get(),
00486                                 target_type_get(),
00487                                 psp,
00488                                 nsp,
00489                                 arg_list,
00490                                 used_conversion_function,
00491                                 arg);   
00492         else
00493                 return ss_funcall::create(arg->location_get(),
00494                                 target_type_get(),
00495                                 psp,
00496                                 nsp,
00497                                 arg_list,
00498                                 used_conversion_function);      
00499 }
00500 
00501 /*!
00502  * Represents the functional for compound conversion
00503  * (12.3.2)
00504  * \return the result of calling the 'outter' functional on the
00505  *         inner functional
00506  */
00507 ptr< ss_expression > or_ics_functional_for_compound_conversion::operator() (
00508                                                         ptr< ss_expression > arg, ptr< ss_sp > psp, ptr< ss_sp> nsp)
00509 {
00510         return (*outter_conversion)((*inner_conversion)(arg, psp, nsp), psp, nsp);
00511 }
00512 
00513 /*!
00514  * Dummy. Never called. To make gcc happy.
00515  */ 
00516 ptr< ss_expression > or_ics_functional::operator() (ptr< ss_expression >, ptr< ss_sp >, ptr< ss_sp>)
00517 {
00518         return NULL;
00519 }
00520 
00521 /*!
00522  * This functions converts the expression, which has type of pointer to cv1 P, to
00523  * pointer to cv2 P, c2 being more cv-qualified than c1. See 4.4/1
00524  *
00525  * We rely on source being expression of ss_pointer type
00526  * 
00527  * Definition of relation "to be more qualified":
00528  * none < const
00529  * none < volatile
00530  * none < const volatile
00531  * const < const volatile
00532  * volatile < const volatile
00533  * \returns list of conversion expressions
00534  */
00535 ptr< ss_expression > convert_ptr_to_cv(ptr< or_or_functional > source)
00536 {
00537         /* this is to store the result passed to caller */
00538         typedef ::lestes::std::list< srp< ss_expression > > funclist;
00539         ptr< funclist > seq = funclist::create();
00540 
00541         ptr< ss_type > p = source->type_get();
00542         ptr< or_ics_visitor_cv > v = or_ics_visitor_cv::create();
00543         /* this gets the qualification of the type pointed to by the pointer */
00544         or_cv_enum q = p.dncast<ss_pointer>()->what_get()->accept_or_ics_base_cv(v);
00545 
00546         /* TODO this is unfinished */   
00547         switch (q){
00548                 case OR_CV_NONE:;       
00549                 case OR_CV_CONST:;
00550                 case OR_CV_VOLATILE:;
00551                 case OR_CV_CONST_VOLATILE:;
00552                 default:;
00553         }
00554                 
00555         /* FIXME */
00556         return NULL;
00557 }
00558 
00559 /* Following are the functions (implemented visitors), which perform the construction
00560  * of SCS from the source type.
00561  * Many of them could possibly be collapsed to one function (for example uint/sint etc), but 
00562  * for future extensibility it is kept as separate as possible.
00563  */
00564 
00565 /* ----- Here the implementations of visitors finding _targets_ for type begin ----- */
00566 
00567 #define CONVERT_TO(type,rank){  \
00568                 for(it = it_orig; it != seq_list_end; ++it){    \
00569                         ptr< ss_type > type1 = ss_type_##type::instance();      \
00570                         ptr< or_ics_functional_for_std_conversion > conversion1 = or_ics_functional_for_std_conversion::create(rank, type1);    \
00571                         ptr< or_ics_functional_for_compound_conversion > conversion2 = or_ics_functional_for_compound_conversion::create(       \
00572                                                                         MAX((*it)->rank_get(), rank),                                   \
00573                                                                         conversion1->target_type_get(),                                 \
00574                                                                         conversion1,                                                    \
00575                                                                         *it);                                                           \
00576                         new_list->push_back(conversion2);                                                                               \
00577                 }\
00578                 funclist::iterator it_f = new_list->begin();\
00579 }
00580 
00581 #define CONVERT_TO_POINTER(_type,rank)  \
00582                         ::lestes::std::list< srp< or_ics_functional > >::iterator it = seq_list->begin();                                       \
00583                         ptr< ss_type > type1 = ss_pointer::instance(_type);     \
00584                         ptr< or_ics_functional_for_std_conversion > conversion1 = or_ics_functional_for_std_conversion::create(rank, type1);    \
00585                         ptr< or_ics_functional_for_compound_conversion > conversion2 = or_ics_functional_for_compound_conversion::create(       \
00586                                                                         MAX((*it)->rank_get(), rank),                                   \
00587                                                                         conversion1->target_type_get(),                                 \
00588                                                                         conversion1,                                                    \
00589                                                                         *it);                                                           \
00590                         seq_list->push_back(conversion2);                                                                               \
00591 
00592 #define CONVERT_TO_NONTYPE(type,rank){  \
00593                 for(it = it_orig; it != seq_list_end; it++){    \
00594                         ptr< ss_type > type1 = ss_##type::instance();   \
00595                         ptr< or_ics_functional_for_std_conversion > conversion1 = or_ics_functional_for_std_conversion::create(rank, type1);    \
00596                         ptr< or_ics_functional_for_compound_conversion > conversion2 = or_ics_functional_for_compound_conversion::create(       \
00597                                                                         MAX((*it)->rank_get(), rank),                                   \
00598                                                                         conversion1->target_type_get(),                                 \
00599                                                                         conversion1,                                                    \
00600                                                                         *it);                                                           \
00601                         new_list->push_back(conversion2);                                                                               \
00602                 }\
00603 }
00604 
00605 
00606 #define CONVERT_LVAL_RVAL() \
00607                 ptr< or_ics_visitor_cv > v = or_ics_visitor_cv::create();       \
00608                 llog(or_ics_log) << "Performing lval->rval conversion\n"; \
00609                 if(source_get()->type_get()->accept_or_ics_base_cv(v) == OR_CV_REFERENCE ) {    \
00610                         llog(or_ics_log) << "We are holding reference type\n"; \
00611                 \
00612                         /* the first field is identity - the functional we can use for lval->rval composition */        \
00613                         ::lestes::std::list< srp< or_ics_functional > >::iterator it = seq_list->begin();                       \
00614                         ptr< or_ics_functional_for_lval_rval_conversion > conversion1 =                                         \
00615                                                 or_ics_functional_for_lval_rval_conversion::create(RANK_EXACT, source_get()->type_get());       \
00616                         ptr< or_ics_functional_for_compound_conversion > conversion2 = or_ics_functional_for_compound_conversion::create(       \
00617                                                                 RANK_EXACT,     \
00618                                                                 conversion1->target_type_get(),                                 \
00619                                                                 conversion1,    \
00620                                                                 *it);           \
00621                         seq_list->push_back(conversion2);       \
00622                         /* the lvalue will no more be needed - only in ss_function and ss_array cases, \
00623                          * and they are handled separately \
00624                          */     \
00625                         seq_list->pop_front();  \
00626                 } \
00627                 
00628 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_class(ptr< ss_class > type)
00629 {
00630         if (scs_phase_get() == 1) {
00631         }
00632 
00633         if (scs_phase_get() == 2) {
00634 
00635                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
00636                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
00637 
00638                 ::lestes::std::list< srp< ss_class > >::iterator it_cl, it_cl_orig, it_cl_end;
00639                 ::lestes::std::list< srp< ss_base_specifier > >::iterator it_b;
00640                 ptr< ::lestes::std::list< srp< or_ics_functional > > > new_list = ::lestes::std::list< srp< or_ics_functional > >::create();
00641                 
00642                 /* for all classes in seq_list, push all bases to the list - conversion-to-base, 13.3.3.1/6 */
00643                 for (it = it_orig; it != seq_list_end; it++) {
00644                         for (it_b = type->bases_get()->begin(); it_b != type->bases_get()->end(); it_b++) {
00645                                 ptr< or_ics_functional_for_std_conversion > conversion1 = or_ics_functional_for_std_conversion::create(RANK_CONVERSION,(*it_b)->base_class_get());
00646                                 ptr< or_ics_functional_for_compound_conversion > conversion2 = or_ics_functional_for_compound_conversion::create(
00647                                                                                                 MAX(RANK_CONVERSION, (*it)->rank_get()), 
00648                                                                                                 conversion1->target_type_get(),
00649                                                                                                 conversion1, 
00650                                                                                                 *it);
00651                                 new_list->push_back(conversion2);
00652                         }
00653                 }
00654                 for(it = new_list->begin(); it != new_list->end(); it++) 
00655                         seq_list->push_back(*it);
00656         }
00657 
00658         
00659         if (scs_phase_get() == 3) {
00660                 /* qualification conversion doesn't take place for non-ptr type */
00661         }
00662 
00663         /* phase++ */
00664         scs_phase_set(scs_phase_get()+1);
00665 
00666         return seq_list;
00667 
00668 }
00669 
00670 /*!
00671  * This performs just a very basic conversion for const type. TODO FIXME make it more
00672  * elaborate and according to the norm
00673  */
00674 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_const(ptr< ss_const > /*type*/)
00675 {
00676         if (scs_phase_get() == 1) {
00677         }
00678         if (scs_phase_get() == 2) {
00679                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
00680                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
00681                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist; 
00682                 ptr< funclist > new_list = funclist::create(); 
00683 
00684                 /* TODO FIXME the whole 4.10 and 4.11 thing */
00685 
00686                 /* 4.12 boolean conversion */
00687                 CONVERT_TO_NONTYPE(bool, RANK_CONVERSION);
00688 
00689                 funclist::iterator it_f = new_list->begin();
00690                 for(; it_f != new_list->end(); ++it_f) 
00691                         seq_list->push_back(*it_f);
00692 
00693                 /* The removal of const is handled in visit_ss_psedoref */
00694 /*
00695                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
00696                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
00697                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist;
00698                 ptr< funclist > new_list = funclist::create();
00699                 for(it = it_orig; it != seq_list_end; ++it){    
00700                         ptr< ss_type > type1 = type->what_get();
00701                         ptr< or_ics_functional_for_std_conversion > conversion1 = or_ics_functional_for_std_conversion::create(RANK_CONVERSION, type1); 
00702                         ptr< or_ics_functional_for_compound_conversion > conversion2 = or_ics_functional_for_compound_conversion::create(
00703                                                                         MAX((*it)->rank_get(), RANK_CONVERSION),
00704                                                                         conversion1->target_type_get(), 
00705                                                                         conversion1,    
00706                                                                         *it);   
00707                         new_list->push_back(conversion2);
00708                 }
00709                 funclist::iterator it_f = new_list->begin();
00710                 for(; it_f != new_list->end(); ++it_f)
00711                         seq_list->push_back(*it_f);
00712 */      
00713         }
00714 
00715         if (scs_phase_get() == 3) {
00716                 /* qualification conversion doesn't take place for non-ptr type */
00717         }
00718 
00719         /* phase++ */
00720         scs_phase_set(scs_phase_get()+1);
00721 
00722         return seq_list;
00723 
00724 
00725 }
00726 
00727 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_volatile(ptr< ss_volatile > /*type*/)
00728 {
00729         lassert2(false, "conversions for volatile types not implemented yet\n");
00730         if (scs_phase_get() == 1) {
00731         }
00732         if (scs_phase_get() == 2) {
00733 
00734                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist;
00735                 ptr< funclist > tgts_seq = funclist::create();
00736                 ptr< or_ics_visitor_tgts > v_t = or_ics_visitor_tgts::create(source, 1, tgts_seq);
00737                 ptr< funclist > tgts;
00738                 funclist::iterator it;
00739 
00740                 /* this finds all SCS-imaginable types for c-unqualified source type */
00741                 tgts = source->type_get()->accept_or_ics_base(v_t);
00742 
00743                 for (it = tgts->begin(); it != tgts->end(); it++)
00744                         seq_list->push_back(*it);
00745                 
00746                 
00747         }
00748 
00749         if (scs_phase_get() == 3) {
00750                 /* qualification conversion doesn't take place for non-ptr type */
00751         }
00752 
00753         /* phase++ */
00754         scs_phase_set(scs_phase_get()+1);
00755 
00756         return seq_list;
00757 }
00758 
00759 
00760 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_const_volatile(ptr< ss_const_volatile > /*type*/)
00761 {
00762         lassert2(false, "conversions for const volatile types not implemented yet\n");
00763         /* the identity conversion is always OK */
00764         if (scs_phase_get() == 1) {
00765                 /* nothing more (array->ptr, func->ptr) can be done in 1st phase for this type */
00766 
00767         }
00768         if (scs_phase_get() == 2) {
00769 
00770                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist;
00771                 ptr< funclist > tgts_seq = funclist::create();
00772                 ptr< or_ics_visitor_tgts > v_t = or_ics_visitor_tgts::create(source, 1, tgts_seq);
00773                 ptr< funclist > tgts;
00774                 funclist::iterator it;
00775 
00776                 /* this finds all SCS-imaginable types for c-unqualified source type */
00777                 tgts = source->type_get()->accept_or_ics_base(v_t);
00778 
00779                 for (it = tgts->begin(); it != tgts->end(); it++)
00780                         seq_list->push_back(*it);
00781                 
00782                 
00783         }
00784 
00785         if (scs_phase_get() == 3) {
00786                 /* qualification conversion doesn't take place for non-ptr type */
00787         }
00788 
00789         /* phase++ */
00790         scs_phase_set(scs_phase_get()+1);
00791 
00792         return seq_list;
00793 }
00794 
00795 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_bool(ptr< ss_bool > /*type*/)
00796 {
00797         /* the identity conversion is always OK */
00798         if (scs_phase_get() == 1) {
00799         }
00800         if (scs_phase_get() == 2) {
00801 
00802                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
00803                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
00804                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist; 
00805                 ptr< funclist > new_list = funclist::create(); 
00806 
00807                 /* floating point conversions */
00808                 CONVERT_TO(float,RANK_CONVERSION);
00809                 CONVERT_TO(ldouble,RANK_CONVERSION);
00810                 CONVERT_TO(ldouble,RANK_CONVERSION);
00811 
00812                 /* floating-integral conversions */
00813                 CONVERT_TO(sshort,RANK_CONVERSION);
00814                 CONVERT_TO(ushort,RANK_CONVERSION);
00815                 CONVERT_TO(uchar,RANK_CONVERSION);
00816                 CONVERT_TO(schar,RANK_CONVERSION);
00817                 CONVERT_TO(pchar,RANK_CONVERSION);
00818                 CONVERT_TO(uint,RANK_CONVERSION);
00819                 CONVERT_TO(sint,RANK_PROMOTION);
00820                 CONVERT_TO(slong,RANK_CONVERSION);
00821                 CONVERT_TO(ulong,RANK_CONVERSION);
00822                 funclist::iterator it_f = new_list->begin();
00823                 for(; it_f != new_list->end(); ++it_f) 
00824                         seq_list->push_back(*it_f);
00825 
00826         }
00827 
00828         if (scs_phase_get() == 3) {
00829                 /* qualification conversion doesn't take place for non-ptr type */
00830         }
00831 
00832         /* phase++ */
00833         scs_phase_set(scs_phase_get()+1);
00834 
00835         return seq_list;
00836 }
00837 
00838 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_array(ptr< ss_array > type)
00839 {
00840 
00841         if (scs_phase_get() == 1) {
00842                 /* pointer to the type of array element */
00843                 //CONVERT_TO_POINTER(type, RANK_EXACT);
00844                 
00845                 
00846                 /* nothing more (func->ptr, lval->rval) can be done in 1st phase for this type */
00847 
00848         }
00849         if (scs_phase_get() == 2) {
00850                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
00851                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
00852                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist;
00853                 ptr< funclist > new_list = funclist::create();
00854                 for(it = it_orig; it != seq_list_end; ++it){    
00855                         ptr< ss_type > type1 = ss_pointer::instance(type->type_get());
00856                         ptr< or_ics_functional_for_arr_ptr_conversion > conversion1 = or_ics_functional_for_arr_ptr_conversion::create(RANK_CONVERSION, type1); 
00857                         ptr< or_ics_functional_for_compound_conversion > conversion2 = or_ics_functional_for_compound_conversion::create(
00858                                                                         MAX((*it)->rank_get(), RANK_CONVERSION),
00859                                                                         conversion1->target_type_get(), 
00860                                                                         conversion1,    
00861                                                                         *it);   
00862                         new_list->push_back(conversion2);
00863                 }
00864                 funclist::iterator it_f = new_list->begin();
00865                 for(; it_f != new_list->end(); ++it_f)
00866                         seq_list->push_back(*it_f);
00867 
00868                 /* TODO FIXME the whole 4.10 and 4.11 thing */
00869         }
00870 
00871         if (scs_phase_get() == 3) {
00872                 /* FIXME FIXME qualification conversion */
00873                         
00874         }
00875 
00876         /* phase++ */
00877         scs_phase_set(scs_phase_get()+1);
00878 
00879         return seq_list;
00880         
00881 }
00882 
00883 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_function(ptr< ss_function > type)
00884 {
00885         lassert2(false, "conversions of function type are not implemented yet\n");
00886         if (scs_phase_get() == 1) {
00887 
00888                 /* pointer to the function type */
00889 
00890                 /* if lvalue (reference or pseudoreference) */
00891                 ptr< or_ics_visitor_cv > v = or_ics_visitor_cv::create();
00892                 if(! (source_get()->type_get()->accept_or_ics_base_cv(v) == OR_CV_REFERENCE || source_get()->type_get()->accept_or_ics_base_cv(v) == OR_CV_PSEUDOREFERENCE)) { 
00893                         CONVERT_TO_POINTER(type, RANK_EXACT);
00894                 }
00895                 /* nothing more (func->ptr, lval->rval) can be done in 1st phase for this type */
00896 
00897         }
00898         if (scs_phase_get() == 2) {
00899 
00900                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
00901                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
00902                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist; 
00903                 ptr< funclist > new_list = funclist::create(); 
00904 
00905                 /* TODO FIXME the whole 4.10 and 4.11 thing */
00906                 
00907         }
00908 
00909         if (scs_phase_get() == 3) {
00910                 /* FIXME FIXME qualification conversion */
00911         }
00912 
00913         /* phase++ */
00914         scs_phase_set(scs_phase_get()+1);
00915 
00916         return seq_list;
00917 
00918 }
00919 
00920 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_pointer(ptr< ss_pointer > type)
00921 {
00922         if (scs_phase_get() == 1) {
00923         }
00924         if (scs_phase_get() == 2) {
00925 
00926                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
00927                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
00928                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist; 
00929                 ptr< funclist > new_list = funclist::create(); 
00930 
00931                 /* TODO FIXME the whole 4.10 and 4.11 thing */
00932 
00933                 /* 4.12 boolean conversion */
00934                 CONVERT_TO_NONTYPE(bool, RANK_CONVERSION);
00935                 funclist::iterator it_f = new_list->begin();
00936 
00937                 for(it = it_orig; it != seq_list_end; ++it){    
00938                         ptr< ss_type > type1 = ss_pointer::instance(ss_const::instance(type->what_get()));
00939                         ptr< or_ics_functional_for_std_conversion > conversion1 = or_ics_functional_for_std_conversion::create(RANK_CONVERSION, type1); 
00940                         ptr< or_ics_functional_for_compound_conversion > conversion2 = or_ics_functional_for_compound_conversion::create(
00941                                         MAX((*it)->rank_get(), RANK_CONVERSION),
00942                                         conversion1->target_type_get(), 
00943                                         conversion1,    
00944                                         *it);   
00945                         new_list->push_back(conversion2);
00946                 }
00947 
00948                 
00949                 for(; it_f != new_list->end(); ++it_f) {
00950                         seq_list->push_back(*it_f);
00951                         
00952                 }
00953 
00954         }
00955 
00956         if (scs_phase_get() == 3) {
00957                 /* FIXME FIXME qualification conversion */
00958         }
00959 
00960         /* phase++ */
00961         scs_phase_set(scs_phase_get()+1);
00962 
00963         return seq_list;
00964 }
00965 
00966 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_member_pointer(ptr< ss_member_pointer > /*type*/)
00967 {
00968         /* in first phase, there can be lval->rval */
00969         if (scs_phase_get() == 1) {
00970         }
00971         if (scs_phase_get() == 2) {
00972 
00973                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
00974                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
00975                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist; 
00976                 ptr< funclist > new_list = funclist::create(); 
00977 
00978                 /* TODO FIXME 4.11 (member ptr) */
00979 
00980                 /* 4.12 boolean conversion */
00981                 CONVERT_TO_NONTYPE(bool, RANK_CONVERSION);
00982         
00983                 funclist::iterator it_f = new_list->begin();
00984                 for(; it_f != new_list->end(); ++it_f) 
00985                         seq_list->push_back(*it_f);
00986         }
00987 
00988         if (scs_phase_get() == 3) {
00989                 /* FIXME FIXME qualification conversion */
00990         }
00991 
00992         /* phase++ */
00993         scs_phase_set(scs_phase_get()+1);
00994 
00995         return seq_list;
00996 }
00997 
00998 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_union(ptr< ss_union > /*type*/)
00999 {
01000         if (scs_phase_get() == 1) {
01001         }
01002         if (scs_phase_get() == 2) {
01003 
01004                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
01005                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
01006 
01007                 /* TODO FIXME union conversions */
01008         }
01009 
01010         if (scs_phase_get() == 3) {
01011                 /* TODO FIXME qualification conversion? */
01012         }
01013 
01014         /* phase++ */
01015         scs_phase_set(scs_phase_get()+1);
01016 
01017         return seq_list;
01018 }
01019 
01020 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_void(ptr< ss_void > /*type*/)
01021 {
01022         if (scs_phase_get() == 1) {
01023         }
01024         if (scs_phase_get() == 2) {
01025         }
01026 
01027         if (scs_phase_get() == 3) {
01028         }
01029 
01030         /* phase++ */
01031         scs_phase_set(scs_phase_get()+1);
01032 
01033         return seq_list;
01034 }
01035 
01036 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_reference(ptr< ss_reference > type)
01037 {
01038 
01039         typedef ::lestes::std::list< srp< or_ics_functional > > funclist;
01040 
01041         /* identity conversion */
01042         ptr< or_ics_functional_for_std_conversion > conversion1 = or_ics_functional_for_std_conversion::create(RANK_EXACT, type);
01043         seq_list->push_back(conversion1);
01044 
01045         /* lvalue->rvalue conversion */
01046         funclist::iterator id_it = seq_list->begin();
01047         ptr< or_ics_functional_for_lval_rval_conversion > id_conversion1 =
01048                 or_ics_functional_for_lval_rval_conversion::create(RANK_EXACT, type->what_get());
01049         ptr< or_ics_functional_for_compound_conversion > id_conversion2 = or_ics_functional_for_compound_conversion::create(
01050                         RANK_EXACT,
01051                         type->what_get(),
01052                         id_conversion1,
01053                         *id_it);
01054         seq_list->push_back(id_conversion2);
01055 
01056         return seq_list;
01057 }
01058 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_type_sint(ptr< ss_type_sint > /*type*/)
01059 {
01060         if (scs_phase_get() == 1) {
01061         }
01062         if (scs_phase_get() == 2) {
01063                 /* we perform the conversion for every type in seq_list */
01064 
01065                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
01066                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
01067                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist; 
01068                 ptr< funclist > new_list = funclist::create(); 
01069                                         
01070                 CONVERT_TO(sshort,RANK_CONVERSION);
01071                 CONVERT_TO(ushort,RANK_CONVERSION);
01072                 CONVERT_TO(schar,RANK_CONVERSION);
01073                 CONVERT_TO(uchar,RANK_CONVERSION);
01074                 CONVERT_TO(pchar,RANK_CONVERSION);
01075                 CONVERT_TO(uint,RANK_CONVERSION);
01076                 CONVERT_TO(ulong,RANK_CONVERSION);
01077                 CONVERT_TO(slong,RANK_CONVERSION);
01078                 CONVERT_TO(double,RANK_CONVERSION);
01079                 CONVERT_TO(ldouble,RANK_CONVERSION);
01080                 CONVERT_TO(float,RANK_CONVERSION);
01081                 CONVERT_TO_NONTYPE(bool,RANK_CONVERSION);
01082 
01083                 funclist::iterator it_f = new_list->begin();
01084                 for(; it_f != new_list->end(); ++it_f) 
01085                         seq_list->push_back(*it_f);
01086                 
01087         }
01088 
01089         if (scs_phase_get() == 3) {
01090                 /* qualification conversion doesn't take place for non-ptr type */
01091         }
01092 
01093         /* phase++ */
01094         scs_phase_set(scs_phase_get()+1);
01095 
01096         return seq_list;
01097 
01098 }
01099 
01100 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_type_uint(ptr< ss_type_uint > /*type*/)
01101 {
01102         if (scs_phase_get() == 1) {
01103         }
01104         if (scs_phase_get() == 2) {
01105                 /* integral conversions */
01106 
01107                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
01108                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
01109                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist; 
01110                 ptr< funclist > new_list = funclist::create(); 
01111 
01112                 CONVERT_TO(sshort,RANK_CONVERSION);
01113                 CONVERT_TO(ushort,RANK_CONVERSION);
01114                 CONVERT_TO(schar,RANK_CONVERSION);
01115                 CONVERT_TO(uchar,RANK_CONVERSION);
01116                 CONVERT_TO(pchar,RANK_CONVERSION);
01117                 CONVERT_TO(sint,RANK_CONVERSION);
01118                 CONVERT_TO(ulong,RANK_CONVERSION);
01119                 CONVERT_TO(slong,RANK_CONVERSION);
01120                 CONVERT_TO(double,RANK_CONVERSION);
01121                 CONVERT_TO(ldouble,RANK_CONVERSION);
01122                 CONVERT_TO(float,RANK_CONVERSION);
01123                 CONVERT_TO_NONTYPE(bool,RANK_CONVERSION);
01124 
01125                 funclist::iterator it_f = new_list->begin();
01126                 for(; it_f != new_list->end(); ++it_f) 
01127                         seq_list->push_back(*it_f);
01128 
01129         }
01130 
01131         if (scs_phase_get() == 3) {
01132                 /* qualification conversion doesn't take place for non-ptr type */
01133         }
01134 
01135         /* phase++ */
01136         scs_phase_set(scs_phase_get()+1);
01137 
01138         return seq_list;
01139 }
01140 
01141 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_type_slong(ptr< ss_type_slong > /*type*/)
01142 {
01143         if (scs_phase_get() == 1) {
01144         }
01145         if (scs_phase_get() == 2) {
01146                 /* integral conversions */
01147                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
01148                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
01149                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist; 
01150                 ptr< funclist > new_list = funclist::create(); 
01151 
01152                 CONVERT_TO(sshort,RANK_CONVERSION);
01153                 CONVERT_TO(ushort,RANK_CONVERSION);
01154                 CONVERT_TO(schar,RANK_CONVERSION);
01155                 CONVERT_TO(uchar,RANK_CONVERSION);
01156                 CONVERT_TO(pchar,RANK_CONVERSION);
01157                 CONVERT_TO(sint,RANK_CONVERSION);
01158                 CONVERT_TO(uint,RANK_CONVERSION);
01159                 CONVERT_TO(ulong,RANK_CONVERSION);
01160                 CONVERT_TO(double,RANK_CONVERSION);
01161                 CONVERT_TO(ldouble,RANK_CONVERSION);
01162                 CONVERT_TO(float,RANK_CONVERSION);
01163                 CONVERT_TO_NONTYPE(bool,RANK_CONVERSION);
01164 
01165                 funclist::iterator it_f = new_list->begin();
01166                 for(; it_f != new_list->end(); ++it_f) 
01167                         seq_list->push_back(*it_f);
01168         }
01169 
01170         if (scs_phase_get() == 3) {
01171                 /* qualification conversion doesn't take place for non-ptr type */
01172         }
01173 
01174         /* phase++ */
01175         scs_phase_set(scs_phase_get()+1);
01176 
01177         return seq_list;
01178 
01179 }
01180 
01181 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_type_ulong(ptr< ss_type_ulong > /*type*/)
01182 {
01183         if (scs_phase_get() == 1) {
01184         }
01185         if (scs_phase_get() == 2) {
01186                 /* integral conversions */
01187 
01188                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
01189                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
01190                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist; 
01191                 ptr< funclist > new_list = funclist::create(); 
01192 
01193                 CONVERT_TO(sshort,RANK_CONVERSION);
01194                 CONVERT_TO(ushort,RANK_CONVERSION);
01195                 CONVERT_TO(schar,RANK_CONVERSION);
01196                 CONVERT_TO(uchar,RANK_CONVERSION);
01197                 CONVERT_TO(pchar,RANK_CONVERSION);
01198                 CONVERT_TO(sint,RANK_CONVERSION);
01199                 CONVERT_TO(uint,RANK_CONVERSION);
01200                 CONVERT_TO(slong,RANK_CONVERSION);
01201                 CONVERT_TO(double,RANK_CONVERSION);
01202                 CONVERT_TO(ldouble,RANK_CONVERSION);
01203                 CONVERT_TO(float,RANK_CONVERSION);
01204                 CONVERT_TO_NONTYPE(bool,RANK_CONVERSION);
01205                 funclist::iterator it_f = new_list->begin();
01206 
01207                 for(; it_f != new_list->end(); ++it_f) 
01208                         seq_list->push_back(*it_f);
01209         }
01210 
01211         if (scs_phase_get() == 3) {
01212                 /* qualification conversion doesn't take place for non-ptr type */
01213         }
01214 
01215         /* phase++ */
01216         scs_phase_set(scs_phase_get()+1);
01217 
01218         return seq_list;
01219 }
01220 
01221 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_type_sshort(ptr< ss_type_sshort > /*type*/)
01222 {
01223         if (scs_phase_get() == 1) {
01224         }
01225         if (scs_phase_get() == 2) {
01226 
01227                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
01228                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
01229                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist; 
01230                 ptr< funclist > new_list = funclist::create(); 
01231 
01232                 /* integral promotion */
01233                 CONVERT_TO(sint,RANK_PROMOTION);
01234                 
01235                 /* integral conversions */
01236                 CONVERT_TO(ushort,RANK_CONVERSION);
01237                 CONVERT_TO(schar,RANK_CONVERSION);
01238                 CONVERT_TO(uchar,RANK_CONVERSION);
01239                 CONVERT_TO(pchar,RANK_CONVERSION);
01240                 CONVERT_TO(uint,RANK_CONVERSION);
01241                 CONVERT_TO(slong,RANK_CONVERSION);
01242                 CONVERT_TO(ulong,RANK_CONVERSION);
01243                 CONVERT_TO(double,RANK_CONVERSION);
01244                 CONVERT_TO(ldouble,RANK_CONVERSION);
01245                 CONVERT_TO(float,RANK_CONVERSION);
01246                 CONVERT_TO_NONTYPE(bool,RANK_CONVERSION);
01247                 funclist::iterator it_f = new_list->begin();
01248                 for(; it_f != new_list->end(); ++it_f) 
01249                         seq_list->push_back(*it_f);
01250         }
01251 
01252         if (scs_phase_get() == 3) {
01253                 /* qualification conversion doesn't take place for non-ptr type */
01254         }
01255 
01256         /* phase++ */
01257         scs_phase_set(scs_phase_get()+1);
01258 
01259         return seq_list;
01260 
01261 }
01262 
01263 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_type_ushort(ptr< ss_type_ushort > /*type*/)
01264 {
01265         if (scs_phase_get() == 1) {
01266         }
01267         if (scs_phase_get() == 2) {
01268 
01269                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
01270                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
01271                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist; 
01272                 ptr< funclist > new_list = funclist::create(); 
01273 
01274                 /* integral promotion */
01275                 CONVERT_TO(sint,RANK_PROMOTION);
01276                 
01277                 /* integral conversions */
01278                 CONVERT_TO(sshort,RANK_CONVERSION);
01279                 CONVERT_TO(schar,RANK_CONVERSION);
01280                 CONVERT_TO(uchar,RANK_CONVERSION);
01281                 CONVERT_TO(pchar,RANK_CONVERSION);
01282                 CONVERT_TO(uint,RANK_CONVERSION);
01283                 CONVERT_TO(slong,RANK_CONVERSION);
01284                 CONVERT_TO(ulong,RANK_CONVERSION);
01285                 CONVERT_TO(double,RANK_CONVERSION);
01286                 CONVERT_TO(ldouble,RANK_CONVERSION);
01287                 CONVERT_TO(float,RANK_CONVERSION);
01288                 CONVERT_TO_NONTYPE(bool,RANK_CONVERSION);
01289                 
01290                 funclist::iterator it_f = new_list->begin();
01291                 for(; it_f != new_list->end(); ++it_f) 
01292                         seq_list->push_back(*it_f);
01293         }
01294 
01295         if (scs_phase_get() == 3) {
01296                 /* qualification conversion doesn't take place for non-ptr type */
01297         }
01298 
01299         /* phase++ */
01300         scs_phase_set(scs_phase_get()+1);
01301 
01302         return seq_list;
01303 }
01304 
01305 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_type_schar(ptr< ss_type_schar > /*type*/)
01306 {
01307         if (scs_phase_get() == 1) {
01308         }
01309         if (scs_phase_get() == 2) {
01310 
01311                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
01312                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
01313                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist; 
01314                 ptr< funclist > new_list = funclist::create(); 
01315 
01316                 /* integral promotion */
01317                 CONVERT_TO(sint,RANK_PROMOTION);
01318                 
01319                 /* integral conversions */
01320                 CONVERT_TO(sshort,RANK_CONVERSION);
01321                 CONVERT_TO(ushort,RANK_CONVERSION);
01322                 CONVERT_TO(uchar,RANK_CONVERSION);
01323                 CONVERT_TO(pchar,RANK_CONVERSION);
01324                 CONVERT_TO(uint,RANK_CONVERSION);
01325                 CONVERT_TO(slong,RANK_CONVERSION);
01326                 CONVERT_TO(ulong,RANK_CONVERSION);
01327                 CONVERT_TO(double,RANK_CONVERSION);
01328                 CONVERT_TO(ldouble,RANK_CONVERSION);
01329                 CONVERT_TO(float,RANK_CONVERSION);
01330                 CONVERT_TO_NONTYPE(bool,RANK_CONVERSION);
01331 
01332                 funclist::iterator it_f = new_list->begin();
01333                 for(; it_f != new_list->end(); ++it_f) 
01334                         seq_list->push_back(*it_f);
01335         }
01336 
01337         if (scs_phase_get() == 3) {
01338                 /* qualification conversion doesn't take place for non-ptr type */
01339         }
01340 
01341         /* phase++ */
01342         scs_phase_set(scs_phase_get()+1);
01343 
01344         return seq_list;
01345 }
01346 
01347 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_type_uchar(ptr< ss_type_uchar > /*type*/)
01348 {
01349         if (scs_phase_get() == 1) {
01350                 /* we can perform lval->rval conversion */
01351                 CONVERT_LVAL_RVAL();
01352                 /* nothing more (array->ptr, func->ptr) can be done in 1st phase for this type */
01353 
01354         }
01355         if (scs_phase_get() == 2) {
01356 
01357                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
01358                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
01359                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist; 
01360                 ptr< funclist > new_list = funclist::create(); 
01361 
01362                 /* integral promotion */
01363                 CONVERT_TO(sint,RANK_PROMOTION);
01364                 
01365                 /* integral conversions */
01366                 CONVERT_TO(sshort,RANK_CONVERSION);
01367                 CONVERT_TO(ushort,RANK_CONVERSION);
01368                 CONVERT_TO(schar,RANK_CONVERSION);
01369                 CONVERT_TO(pchar,RANK_CONVERSION);
01370                 CONVERT_TO(uint,RANK_CONVERSION);
01371                 CONVERT_TO(slong,RANK_CONVERSION);
01372                 CONVERT_TO(ulong,RANK_CONVERSION);
01373                 CONVERT_TO(double,RANK_CONVERSION);
01374                 CONVERT_TO(ldouble,RANK_CONVERSION);
01375                 CONVERT_TO(float,RANK_CONVERSION);
01376                 CONVERT_TO_NONTYPE(bool,RANK_CONVERSION);
01377 
01378                 funclist::iterator it_f = new_list->begin();
01379                 for(; it_f != new_list->end(); ++it_f) 
01380                         seq_list->push_back(*it_f);
01381         }
01382 
01383         if (scs_phase_get() == 3) {
01384                 /* qualification conversion doesn't take place for non-ptr type */
01385         }
01386 
01387         /* phase++ */
01388         scs_phase_set(scs_phase_get()+1);
01389 
01390         return seq_list;
01391 }
01392 
01393 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_type_pchar(ptr< ss_type_pchar > /*type*/)
01394 {
01395         if (scs_phase_get() == 1) {
01396                 /* we can perform lval->rval conversion */
01397                 CONVERT_LVAL_RVAL();
01398                 /* nothing more (array->ptr, func->ptr) can be done in 1st phase for this type */
01399 
01400         }
01401         if (scs_phase_get() == 2) {
01402 
01403                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
01404                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
01405                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist; 
01406                 ptr< funclist > new_list = funclist::create(); 
01407 
01408                 /* integral promotion */
01409                 CONVERT_TO(sint,RANK_PROMOTION);
01410                 
01411                 /* integral conversions */
01412                 CONVERT_TO(sshort,RANK_CONVERSION);
01413                 CONVERT_TO(ushort,RANK_CONVERSION);
01414                 CONVERT_TO(uchar,RANK_CONVERSION);
01415                 CONVERT_TO(schar,RANK_CONVERSION);
01416                 CONVERT_TO(uint,RANK_CONVERSION);
01417                 CONVERT_TO(slong,RANK_CONVERSION);
01418                 CONVERT_TO(ulong,RANK_CONVERSION);
01419                 CONVERT_TO(double,RANK_CONVERSION);
01420                 CONVERT_TO(ldouble,RANK_CONVERSION);
01421                 CONVERT_TO(float,RANK_CONVERSION);
01422                 CONVERT_TO_NONTYPE(bool,RANK_CONVERSION);
01423 
01424                 funclist::iterator it_f = new_list->begin();
01425                 for(; it_f != new_list->end(); ++it_f) 
01426                         seq_list->push_back(*it_f);
01427         }
01428 
01429         if (scs_phase_get() == 3) {
01430                 /* qualification conversion doesn't take place for non-ptr type */
01431         }
01432 
01433         /* phase++ */
01434         scs_phase_set(scs_phase_get()+1);
01435 
01436         return seq_list;
01437 }
01438 
01439 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_type_float(ptr< ss_type_float > /*type*/)
01440 {
01441         if (scs_phase_get() == 1) {
01442                 /* we can perform lval->rval conversion */
01443                 CONVERT_LVAL_RVAL();
01444                 /* nothing more (array->ptr, func->ptr) can be done in 1st phase for this type */
01445 
01446         }
01447         if (scs_phase_get() == 2) {
01448 
01449                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
01450                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
01451                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist; 
01452                 ptr< funclist > new_list = funclist::create(); 
01453 
01454                 /* floating point promotion */
01455                 CONVERT_TO(double,RANK_PROMOTION);
01456                 
01457                 /* floating point conversions */
01458                 CONVERT_TO(ldouble,RANK_CONVERSION);
01459 
01460                 /* floating-integral conversions */
01461                 CONVERT_TO(sshort,RANK_CONVERSION);
01462                 CONVERT_TO(ushort,RANK_CONVERSION);
01463                 CONVERT_TO(uchar,RANK_CONVERSION);
01464                 CONVERT_TO(schar,RANK_CONVERSION);
01465                 CONVERT_TO(pchar,RANK_CONVERSION);
01466                 CONVERT_TO(uint,RANK_CONVERSION);
01467                 CONVERT_TO(sint,RANK_CONVERSION);
01468                 CONVERT_TO(slong,RANK_CONVERSION);
01469                 CONVERT_TO(ulong,RANK_CONVERSION);
01470                 CONVERT_TO_NONTYPE(bool,RANK_CONVERSION);
01471 
01472                 funclist::iterator it_f = new_list->begin();
01473                 for(; it_f != new_list->end(); ++it_f) 
01474                         seq_list->push_back(*it_f);
01475         
01476         }
01477 
01478         if (scs_phase_get() == 3) {
01479                 /* qualification conversion doesn't take place for non-ptr type */
01480         }
01481 
01482         /* phase++ */
01483         scs_phase_set(scs_phase_get()+1);
01484 
01485         return seq_list;
01486 }
01487 
01488 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_type_double(ptr< ss_type_double > /*type*/)
01489 {
01490         if (scs_phase_get() == 1) {
01491                 /* we can perform lval->rval conversion */
01492                 CONVERT_LVAL_RVAL();
01493                 /* nothing more (array->ptr, func->ptr) can be done in 1st phase for this type */
01494 
01495         }
01496         if (scs_phase_get() == 2) {
01497 
01498                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
01499                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
01500                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist; 
01501                 ptr< funclist > new_list = funclist::create(); 
01502 
01503                 /* floating point conversions */
01504                 CONVERT_TO(float,RANK_CONVERSION);
01505                 CONVERT_TO(ldouble,RANK_CONVERSION);
01506 
01507                 /* floating-integral conversions */
01508                 CONVERT_TO(sshort,RANK_CONVERSION);
01509                 CONVERT_TO(ushort,RANK_CONVERSION);
01510                 CONVERT_TO(uchar,RANK_CONVERSION);
01511                 CONVERT_TO(schar,RANK_CONVERSION);
01512                 CONVERT_TO(pchar,RANK_CONVERSION);
01513                 CONVERT_TO(uint,RANK_CONVERSION);
01514                 CONVERT_TO(sint,RANK_CONVERSION);
01515                 CONVERT_TO(slong,RANK_CONVERSION);
01516                 CONVERT_TO(ulong,RANK_CONVERSION);
01517                 CONVERT_TO_NONTYPE(bool,RANK_CONVERSION);
01518 
01519                 funclist::iterator it_f = new_list->begin();
01520                 for(; it_f != new_list->end(); ++it_f) 
01521                         seq_list->push_back(*it_f);
01522 
01523         }
01524 
01525         if (scs_phase_get() == 3) {
01526                 /* qualification conversion doesn't take place for non-ptr type */
01527         }
01528 
01529         /* phase++ */
01530         scs_phase_set(scs_phase_get()+1);
01531 
01532         return seq_list;
01533 }
01534 
01535 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_type_ldouble(ptr< ss_type_ldouble > /*type*/)
01536 {
01537         if (scs_phase_get() == 1) {
01538         }
01539         if (scs_phase_get() == 2) {
01540 
01541                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
01542                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
01543                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist; 
01544                 ptr< funclist > new_list = funclist::create(); 
01545 
01546                 /* floating point conversions */
01547                 CONVERT_TO(float,RANK_CONVERSION);
01548                 CONVERT_TO(double,RANK_CONVERSION);
01549 
01550                 /* floating-integral conversions */
01551                 CONVERT_TO(sshort,RANK_CONVERSION);
01552                 CONVERT_TO(ushort,RANK_CONVERSION);
01553                 CONVERT_TO(uchar,RANK_CONVERSION);
01554                 CONVERT_TO(schar,RANK_CONVERSION);
01555                 CONVERT_TO(pchar,RANK_CONVERSION);
01556                 CONVERT_TO(uint,RANK_CONVERSION);
01557                 CONVERT_TO(sint,RANK_CONVERSION);
01558                 CONVERT_TO(slong,RANK_CONVERSION);
01559                 CONVERT_TO(ulong,RANK_CONVERSION);
01560                 CONVERT_TO_NONTYPE(bool,RANK_CONVERSION);
01561 
01562                 funclist::iterator it_f = new_list->begin();
01563                 for(; it_f != new_list->end(); ++it_f) 
01564                         seq_list->push_back(*it_f);
01565         }
01566 
01567         if (scs_phase_get() == 3) {
01568                 /* qualification conversion doesn't take place for non-ptr type */
01569         }
01570 
01571         /* phase++ */
01572         scs_phase_set(scs_phase_get()+1);
01573 
01574         return seq_list;
01575 }
01576  
01577 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_enum(ptr< ss_enum > /*type*/)
01578 {
01579         if (scs_phase_get() == 1) {
01580         }
01581         if (scs_phase_get() == 2) {
01582 
01583                 ::lestes::std::list< srp< or_ics_functional > >::iterator it, it_orig = seq_list->begin();
01584                 ::lestes::std::list< srp< or_ics_functional > >::iterator seq_list_end = seq_list->end();
01585                 typedef ::lestes::std::list< srp< or_ics_functional > > funclist; 
01586                 ptr< funclist > new_list = funclist::create(); 
01587 
01588                 /* FIXME - here should be considered, according to number of enumerator, the first
01589                    type which can be the target of the conversion - can be bigger than uint */
01590                 CONVERT_TO(uint,RANK_CONVERSION);
01591 
01592                 /* 4.12 - boolean conversion */
01593                 CONVERT_TO_NONTYPE(bool, RANK_CONVERSION);
01594 
01595                 funclist::iterator it_f = new_list->begin();
01596                 for(; it_f != new_list->end(); ++it_f) 
01597                         seq_list->push_back(*it_f);
01598 
01599         }
01600 
01601         if (scs_phase_get() == 3) {
01602                 /* qualification conversion doesn't take place for non-ptr type */
01603         }
01604 
01605         /* phase++ */
01606         scs_phase_set(scs_phase_get()+1);
01607 
01608         return seq_list;
01609 
01610 }
01611 /*!
01612  * This handles the case of pseudoreference. The pseudoreference type is representing those lvalues which are not 
01613  * references. The conversion between pseudoreference and reference is identity. So we process the type to which
01614  * we hold the pseudoreference as usual and then we add to the list of imaginable types those which are references,
01615  * because pseudoreference->reference conversion is for free.
01616  *
01617  * Let's have the following source for demonstration:
01618  *
01619         int f(int a);
01620         int f(int &a)
01621 
01622         int main()
01623         {
01624                 int z = 1;
01625                 f(z);
01626         }
01627 
01628  * In this case, we get pseudoreference for 'z' parameter (because z is lavalue but not reference). pseudoreference->reference
01629  * conversion is identity. It has the same rank as lval->rval (which would happen for calling of int f(int a)). So the example
01630  * above is ambiguous.
01631  * BUT if the call would be 
01632                 f(z-1);
01633  * then the ambiguity is gone, as z-1 is rvalue (and therefore we hold directly ss_int, not ss_(pseudo)reference) and rval->ref
01634  * doesn't exist, but rval->rval (int->int in this case) is identity, and int f(int a) is called
01635  *
01636  * See [4.1,2,3], [13.3] with special respect to [13.3.3.1.4].  
01637  */
01638 
01639 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_pseudoreference(ptr< ss_pseudoreference > type)
01640 {
01641         typedef ::lestes::std::list< srp< or_ics_functional > > funclist;
01642         ptr< funclist > tgts_seq = funclist::create();
01643         
01644         ptr< funclist > tgts;
01645         funclist::iterator it, it_sav_begin, it_sav_end;
01646         ptr< or_ics_functional > first;
01647         ptr< or_or_functional > fake_func;
01648 
01649         llog(or_ics_log) << "visit_ss_pseudoreference\n";
01650         
01651         /* we need 'fake' or_or_functional, which will be the same as 'source', but will be of
01652          * the type for which we hold pseudoreference. This is needed for proper generation
01653          * of scs-imaginables
01654          */
01655         
01656         /* We must create the fake functional according to the type of functional we currently hold */
01657         ptr< or_or_functional_to_enum > v_f = or_or_functional_to_enum::create();
01658         source->accept_or_or_functional_visitor(v_f);
01659         or_or_functional_enum e = v_f->result_get();
01660 
01661         if (e == OR_OR_FUNCTIONAL_DECL) 
01662                 fake_func = or_or_functional_decl::create(type->what_get(), source.dncast<or_or_functional_decl>()->declaration_get());
01663         else if (e == OR_OR_FUNCTIONAL_CONCRETE) 
01664                 fake_func = or_or_functional_decl::create(type->what_get(), source.dncast<or_or_functional_concrete>()->declaration_get());
01665         else if (e == OR_OR_FUNCTIONAL_COMMA) 
01666                 fake_func = or_or_functional_this::create(type->what_get());
01667         else
01668                 /* any functional holding just type will help here */
01669                 fake_func = or_or_functional_this::create(type->what_get());
01670 //      else
01671 //              lassert2(false, "Hit unsupported type of or_or_functional when handling ICS for pseudoreference\n");
01672         ptr< or_ics_visitor_tgts > v_t = or_ics_visitor_tgts::create(fake_func, 1, tgts_seq);
01673 
01674         /* identity conversion */
01675 //      ptr< or_ics_functional_for_std_conversion > i_conversion1 = or_ics_functional_for_std_conversion::create(RANK_EXACT, type->what_get());
01676 //      tgts_seq->push_back(i_conversion1);
01677         // this is from time when lval->rval was used as identity conversion
01678         // FIXME is this correct or the one above??
01679 
01680         /* For the const type, the lval->rval should remove the const */
01681         ptr< or_ics_visitor_cv > v = or_ics_visitor_cv::create();
01682         ptr< or_ics_functional_for_lval_rval_conversion > i_conversion1;
01683         if (type->what_get()->accept_or_ics_base_cv(v) == OR_CV_CONST) {
01684                 i_conversion1 = or_ics_functional_for_lval_rval_conversion::create(RANK_EXACT, type->what_get().dncast<ss_const>()->what_get());
01685         }
01686         else {
01687                 i_conversion1 = or_ics_functional_for_lval_rval_conversion::create(RANK_EXACT, type->what_get());
01688         }
01689         
01690         tgts_seq->push_back(i_conversion1);
01691         
01692         /* This performs all 3 phases of SCS-imagination (e.g finds all SCS-imaginable
01693          * target for the type we hold pseudoreference for
01694          */
01695         tgts = type->what_get()->accept_or_ics_base(v_t);
01696         tgts = type->what_get()->accept_or_ics_base(v_t);
01697         tgts = type->what_get()->accept_or_ics_base(v_t);
01698         llog(or_ics_log) << tgts->size() << " targets generated\n";
01699 
01700         /* identity conversion */
01701         ptr< or_ics_functional_for_std_conversion > conversion1 = or_ics_functional_for_std_conversion::create(RANK_EXACT, type);
01702         seq_list->push_back(conversion1);
01703 
01704         /* reference binding conversion */
01705         ptr< or_ics_functional_for_reference_bind_conversion > r_conversion1 = or_ics_functional_for_reference_bind_conversion::create(RANK_EXACT, 
01706                                                                                 ss_reference::instance(type->what_get()));
01707         seq_list->push_back(r_conversion1);
01708         
01709         /* lvalue->rvalue conversion */
01710         funclist::iterator id_it = seq_list->begin();
01711         ptr< or_ics_functional_for_lval_rval_conversion > id_conversion1 = 
01712                                 or_ics_functional_for_lval_rval_conversion::create(RANK_EXACT, type->what_get());
01713         ptr< or_ics_functional_for_compound_conversion > id_conversion2 = or_ics_functional_for_compound_conversion::create(
01714                         RANK_EXACT,
01715                         type->what_get(),
01716                         id_conversion1,
01717                         *id_it);
01718         seq_list->push_back(id_conversion2);
01719         
01720         /* now we have in tgts list all the types to which the type for which we hold the reference can be converted.
01721          * Now add for every type the reference type, as the pseudoreference->reference conversion is identity for our
01722          * purposes
01723          */
01724         it_sav_begin = tgts->begin(); 
01725         it_sav_end = tgts->end();
01726         for (it = it_sav_begin; it != it_sav_end; it++) {
01727                 /* now add the conversions making 'references' for types */
01728 /*
01729                 ptr< ss_type > type1 = ss_reference::instance((*it)->target_type_get());        
01730                 ptr< or_ics_functional_for_reference_bind_conversion > conversion1 = or_ics_functional_for_reference_bind_conversion::create(RANK_EXACT, type1);        
01731                 ptr< or_ics_functional_for_compound_conversion > conversion2 = or_ics_functional_for_compound_conversion::create(       
01732                                                                 (*it)->rank_get(),
01733                                                                 conversion1->target_type_get(),                                 
01734                                                                 conversion1,                                                    
01735                                                                 *it);                                                           
01736                 seq_list->push_back(conversion2);       
01737 */
01738                 seq_list->push_back(*it);
01739         }
01740 
01741         llog(or_ics_log) << "references for all these types added to imaginables. returning " << seq_list->size() << " seq_list elements\n";
01742 
01743         return seq_list;        
01744 }
01745 
01746 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_type_wchar_t(ptr< ss_type_wchar_t > /*type*/)
01747 {
01748         lassert2(false, "Conversions for wchar_t are not implemented yet\n");
01749 }
01750 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_member_function(ptr< ss_member_function > /*type*/)
01751 {
01752         lassert2(false, "Conversions for member functions are not implemented yet\n");
01753 }
01754 
01755 #if the_class_is_no_longer_abstract
01756 ptr< ::lestes::std::list< srp< or_ics_functional > > > or_ics_visitor_tgts::visit_ss_typename_type(ptr< ss_typename_type > /*type*/)
01757 {
01758         lassert2(false, "Conversions for typename_type are not implemented yet\n");
01759 }
01760 #endif
01761 
01762 /* ----- Here the implementation of visitors for returning qualification, begin ----- */
01763 
01764 or_cv_enum or_ics_visitor_cv::visit_ss_const(ptr< ss_const > )
01765 {
01766         return OR_CV_CONST;
01767 }
01768 
01769 or_cv_enum or_ics_visitor_cv::visit_ss_volatile(ptr< ss_volatile > )
01770 {
01771         return OR_CV_VOLATILE;
01772 }
01773 
01774 or_cv_enum or_ics_visitor_cv::visit_ss_const_volatile(ptr< ss_const_volatile > )
01775 {
01776         return OR_CV_CONST_VOLATILE;
01777 }
01778 
01779 or_cv_enum or_ics_visitor_cv::visit_ss_union(ptr< ss_union > )
01780 {
01781         return OR_CV_NONE;
01782 }
01783 
01784 or_cv_enum or_ics_visitor_cv::visit_ss_pointer(ptr< ss_pointer > )
01785 {
01786         return OR_CV_PTR;
01787 }
01788 
01789 or_cv_enum or_ics_visitor_cv::visit_ss_enum(ptr< ss_enum > )
01790 {
01791         return OR_CV_NONE;
01792 }
01793 
01794 or_cv_enum or_ics_visitor_cv::visit_ss_array(ptr< ss_array > )
01795 {
01796         return OR_CV_NONE;
01797 }
01798 
01799 or_cv_enum or_ics_visitor_cv::visit_ss_member_pointer(ptr< ss_member_pointer > )
01800 {
01801         return OR_CV_MEMBER_PTR;
01802 }
01803 
01804 or_cv_enum or_ics_visitor_cv::visit_ss_function(ptr< ss_function > )
01805 {
01806         return OR_CV_NONE;
01807 }
01808 
01809 or_cv_enum or_ics_visitor_cv::visit_ss_class(ptr< ss_class > )
01810 {
01811         return OR_CV_NONE;
01812 }
01813 
01814 or_cv_enum or_ics_visitor_cv::visit_ss_bool(ptr< ss_bool > )
01815 {
01816         return OR_CV_BOOL;
01817 }
01818 
01819 or_cv_enum or_ics_visitor_cv::visit_ss_void(ptr< ss_void > )
01820 {
01821         return OR_CV_VOID;
01822 }
01823 
01824 or_cv_enum or_ics_visitor_cv::visit_ss_type_sint(ptr< ss_type_sint > )
01825 {
01826         return OR_CV_SINT;
01827 }
01828 
01829 or_cv_enum or_ics_visitor_cv::visit_ss_type_uint(ptr< ss_type_uint > )
01830 {
01831         return OR_CV_NONE;
01832 }
01833 
01834 or_cv_enum or_ics_visitor_cv::visit_ss_type_slong(ptr< ss_type_slong > )
01835 {
01836         return OR_CV_NONE;
01837 }
01838 
01839 or_cv_enum or_ics_visitor_cv::visit_ss_type_ulong(ptr< ss_type_ulong > )
01840 {
01841         return OR_CV_NONE;
01842 }
01843 
01844 or_cv_enum or_ics_visitor_cv::visit_ss_type_sshort(ptr< ss_type_sshort > )
01845 {
01846         return OR_CV_NONE;
01847 }
01848 
01849 or_cv_enum or_ics_visitor_cv::visit_ss_type_ushort(ptr< ss_type_ushort > )
01850 {
01851         return OR_CV_NONE;
01852 }
01853 
01854 or_cv_enum or_ics_visitor_cv::visit_ss_type_schar(ptr< ss_type_schar > )
01855 {
01856         return OR_CV_NONE;
01857 }
01858 
01859 or_cv_enum or_ics_visitor_cv::visit_ss_type_uchar(ptr< ss_type_uchar > )
01860 {
01861         return OR_CV_NONE;
01862 }
01863 
01864 or_cv_enum or_ics_visitor_cv::visit_ss_type_pchar(ptr< ss_type_pchar > )
01865 {
01866         return OR_CV_NONE;
01867 }
01868 
01869 or_cv_enum or_ics_visitor_cv::visit_ss_type_float(ptr< ss_type_float > )
01870 {
01871         return OR_CV_NONE;
01872 }
01873 
01874 or_cv_enum or_ics_visitor_cv::visit_ss_type_double(ptr< ss_type_double > )
01875 {
01876         return OR_CV_NONE;
01877 }
01878 
01879 or_cv_enum or_ics_visitor_cv::visit_ss_type_ldouble(ptr< ss_type_ldouble > )
01880 {
01881         return OR_CV_NONE;
01882 }
01883 
01884 or_cv_enum or_ics_visitor_cv::visit_ss_reference(ptr< ss_reference > )
01885 {
01886         return OR_CV_REFERENCE;
01887 }
01888 or_cv_enum or_ics_visitor_cv::visit_ss_type_wchar_t(ptr< ss_type_wchar_t > )
01889 {
01890         return OR_CV_NONE;
01891 }
01892 or_cv_enum or_ics_visitor_cv::visit_ss_member_function(ptr< ss_member_function > )
01893 {
01894         return OR_CV_NONE;
01895 }
01896 or_cv_enum or_ics_visitor_cv::visit_ss_pseudoreference(ptr< ss_pseudoreference > )
01897 {
01898         return OR_CV_PSEUDOREFERENCE;
01899 }
01900 #if the_class_is_no_longer_abstract
01901 or_cv_enum or_ics_visitor_cv::visit_ss_typename_type(ptr< ss_typename_type > )
01902 {
01903         return OR_CV_NONE;
01904 }
01905 #endif
01906 
01907 /* ----- Here the implementation of visitors on or functionals begin (used to linearize the conversions) ----- */
01908 ptr< ::lestes::std::list< srp< ss_type > > > or_ics_functional_visitor::visit_or_ics_functional_for_std_conversion(ptr< or_ics_functional_for_std_conversion > func) 
01909 {
01910         conv_list->push_front(func->target_type_get());
01911         return conv_list;       
01912 }
01913 
01914 ptr< ::lestes::std::list< srp< ss_type > > > or_ics_functional_visitor::visit_or_ics_functional_for_arr_ptr_conversion(ptr< or_ics_functional_for_arr_ptr_conversion > func) 
01915 {
01916         conv_list->push_front(func->target_type_get());
01917         return conv_list;       
01918 }
01919 
01920 
01921 ptr< ::lestes::std::list< srp< ss_type > > > or_ics_functional_visitor::visit_or_ics_functional_for_reference_bind_conversion(ptr< or_ics_functional_for_reference_bind_conversion > func) 
01922 {
01923         conv_list->push_front(func->target_type_get());
01924         return conv_list;       
01925 }
01926 
01927 ptr< ::lestes::std::list< srp< ss_type > > > or_ics_functional_visitor::visit_or_ics_functional_for_bind_to_temporary_conversion(ptr< or_ics_functional_for_bind_to_temporary_conversion > func) 
01928 {
01929         conv_list->push_front(func->target_type_get());
01930         return conv_list;       
01931 }
01932 ptr< ::lestes::std::list< srp< ss_type > > > or_ics_functional_visitor::visit_or_ics_functional_for_lval_rval_conversion(ptr< or_ics_functional_for_lval_rval_conversion >)
01933 {
01934         return conv_list;
01935 }
01936 
01937 ptr< ::lestes::std::list< srp< ss_type > > > or_ics_functional_visitor::visit_or_ics_functional_for_user_conversion_by_conversion_function(ptr< or_ics_functional_for_user_conversion_by_conversion_function > func)
01938 {
01939         conv_list->push_front(func->target_type_get());
01940         return conv_list;       
01941 }
01942 
01943 ptr< ::lestes::std::list< srp< ss_type > > > or_ics_functional_visitor::visit_or_ics_functional_for_user_conversion_by_constructor(ptr< or_ics_functional_for_user_conversion_by_constructor > func)
01944 {
01945         conv_list->push_front(func->target_type_get());
01946         return conv_list;
01947 }
01948 
01949 ptr< ::lestes::std::list< srp< ss_type > > > or_ics_functional_visitor::visit_or_ics_functional_for_compound_conversion(ptr< or_ics_functional_for_compound_conversion > func)
01950 {
01951         ptr< or_ics_functional_visitor > v_t = or_ics_functional_visitor::create(conv_list);
01952         func->outter_conversion_get()->accept_or_ics_functional_base(v_t);
01953         func->inner_conversion_get()->accept_or_ics_functional_base(v_t);
01954         return conv_list;
01955         
01956 }
01957 
01958 end_package(sem);
01959 end_package(cplus);
01960 end_package(lang);
01961 end_package(lestes);
01962 

Generated on Mon Feb 12 18:22:42 2007 for lestes by doxygen 1.5.1-20070107