ss_type2lstring_base.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 /*!
00029         \file
00030         \brief Visitors returning lstring for ss_type.
00031         \author jaz
00032 */
00033 
00034 #include <lestes/lang/cplus/sem/ss_decl_name2lstring_base.g.hh>
00035 #include <lestes/lang/cplus/sem/ss_type.g.hh>
00036 #include <lestes/lang/cplus/sem/ss_type_builtin.g.hh>
00037 #include <lestes/lang/cplus/sem/ss_misc.g.hh>
00038 #include <lestes/lang/cplus/sem/ss_declaration.g.hh>
00039 #include <lestes/lang/cplus/sem/ss_decl_name.g.hh>
00040 #include <lestes/lang/cplus/sem/ss_type2lstring_base.g.hh>
00041 #include <sstream>
00042 
00043 package(lestes);
00044 package(lang);
00045 package(cplus);
00046 package(sem);
00047 
00048 
00049 ptr< ss_type2mangled_id > ss_type2mangled_id::instance()
00050 {
00051         if ( !singleton_instance_get()) {
00052                 singleton_instance_set(ss_type2mangled_id::create());
00053         }       
00054         
00055         return singleton_instance_get();
00056 }
00057 
00058 
00059 void ss_type2mangled_id::visit_ss_const(ptr< ::lestes::lang::cplus::sem::ss_const > type) {
00060         lassert(type);
00061         ::std::ostringstream oss;
00062         oss << "K" << process(type->what_get());
00063         result_set(oss.str());
00064 }
00065 
00066 void ss_type2mangled_id::visit_ss_volatile(ptr< ::lestes::lang::cplus::sem::ss_volatile > type){
00067         lassert(type);
00068         ::std::ostringstream oss;
00069         oss << "V" << process(type->what_get());
00070         result_set(oss.str());
00071 }
00072 
00073 void ss_type2mangled_id::visit_ss_const_volatile(ptr< ::lestes::lang::cplus::sem::ss_const_volatile > type){
00074         lassert(type);
00075         ::std::ostringstream oss;
00076         oss << "VK" << process(type->what_get());
00077         result_set(oss.str());
00078 }
00079 
00080 void ss_type2mangled_id::visit_ss_reference(ptr< ::lestes::lang::cplus::sem::ss_reference > type){
00081         lassert(type);
00082         ::std::ostringstream oss;
00083         oss << "R" << process(type->what_get());
00084         result_set(oss.str());
00085 }
00086 
00087 void ss_type2mangled_id::visit_ss_pseudoreference(ptr< ::lestes::lang::cplus::sem::ss_pseudoreference > type){
00088         lassert(type);
00089         ::std::ostringstream oss;
00090         oss << "R" << process(type->what_get());
00091         result_set(oss.str());
00092 }
00093 
00094 void ss_type2mangled_id::visit_ss_pointer(ptr< ::lestes::lang::cplus::sem::ss_pointer > type){
00095         lassert(type);
00096         ::std::ostringstream oss;
00097         oss << "P" << process(type->what_get());
00098         result_set(oss.str());
00099 }
00100 
00101 void ss_type2mangled_id::visit_ss_enum(ptr< ::lestes::lang::cplus::sem::ss_enum > type){
00102         lassert(type);
00103         ptr<ss_object_declaration> decl = (type.dncast<ss_class>())->decl_get().dncast<ss_object_declaration>();
00104         lstring name  = decl->name_get()->accept_ss_decl_name2lstring_base(ss_decl_name2mangled_name::instance());
00105         result_set(name);
00106 }
00107 
00108 void ss_type2mangled_id::visit_ss_array(ptr< ::lestes::lang::cplus::sem::ss_array > type){
00109         lassert(type);
00110         //TODO
00111         lassert2(false,"Not implemented yet.");
00112         result_set("FIXME");
00113 }
00114 
00115 void ss_type2mangled_id::visit_ss_member_pointer(ptr< ::lestes::lang::cplus::sem::ss_member_pointer > type){
00116         lassert(type);
00117         //TODO
00118         lassert2(false,"Not implemented yet.");
00119         result_set("FIXME");
00120 }
00121 
00122 void ss_type2mangled_id::visit_ss_function(ptr< ::lestes::lang::cplus::sem::ss_function > type){
00123         lassert(type);
00124         //TODO
00125         lassert2(false,"Not implemented yet.");
00126         result_set("FIXME");
00127 }
00128 
00129 void ss_type2mangled_id::visit_ss_member_function(ptr< ::lestes::lang::cplus::sem::ss_member_function > type){
00130         lassert(type);
00131         //TODO
00132         lassert2(false,"Not implemented yet.");
00133         result_set("FIXME");
00134 }
00135 
00136 
00137 
00138 void ss_type2mangled_id::visit_ss_class(ptr< ::lestes::lang::cplus::sem::ss_class > type){
00139         lassert(type);
00140         ptr<ss_object_declaration> decl = (type.dncast<ss_class>())->decl_get().dncast<ss_object_declaration>();
00141         lstring name  = decl->name_get()->accept_ss_decl_name2lstring_base(ss_decl_name2mangled_name::instance());
00142         result_set(name);
00143 }
00144 
00145 void ss_type2mangled_id::visit_ss_union(ptr< ::lestes::lang::cplus::sem::ss_union > type){
00146         lassert(type);
00147         //TODO:   uint?
00148         result_set(lstring("j"));
00149 }
00150 
00151 void ss_type2mangled_id::visit_ss_bool(ptr< ::lestes::lang::cplus::sem::ss_bool > type){
00152         lassert(type);
00153         result_set(lstring("b"));
00154 }
00155 
00156 void ss_type2mangled_id::visit_ss_void(ptr< ::lestes::lang::cplus::sem::ss_void > type){
00157         lassert(type);
00158         result_set(lstring("v"));
00159 }
00160 
00161 void ss_type2mangled_id::visit_ss_type_sint(ptr< ::lestes::lang::cplus::sem::ss_type_sint > type){
00162         lassert(type);
00163         result_set(lstring("i"));
00164 }
00165 
00166 void ss_type2mangled_id::visit_ss_type_uint(ptr< ::lestes::lang::cplus::sem::ss_type_uint > type) {
00167         lassert(type);
00168         result_set(lstring("j"));
00169 }
00170 
00171 void ss_type2mangled_id::visit_ss_type_slong(ptr< ::lestes::lang::cplus::sem::ss_type_slong > type) {
00172         lassert(type);
00173         result_set(lstring("l"));
00174 }
00175 
00176 void ss_type2mangled_id::visit_ss_type_ulong(ptr< ::lestes::lang::cplus::sem::ss_type_ulong > type){
00177         lassert(type);
00178         result_set(lstring("m"));
00179 }
00180 
00181 void ss_type2mangled_id::visit_ss_type_sshort(ptr< ::lestes::lang::cplus::sem::ss_type_sshort > type){
00182         lassert(type);
00183         result_set(lstring("s"));
00184 }
00185 
00186 void ss_type2mangled_id::visit_ss_type_ushort(ptr< ::lestes::lang::cplus::sem::ss_type_ushort > type){
00187         lassert(type);
00188         result_set(lstring("t"));
00189 }
00190 
00191 void ss_type2mangled_id::visit_ss_type_wchar_t(ptr< ::lestes::lang::cplus::sem::ss_type_wchar_t > type){
00192         lassert(type);
00193         result_set(lstring("w"));
00194 }
00195 
00196 void ss_type2mangled_id::visit_ss_type_schar(ptr< ::lestes::lang::cplus::sem::ss_type_schar > type){
00197         lassert(type);
00198         result_set(lstring("a"));
00199 }
00200 
00201 void ss_type2mangled_id::visit_ss_type_uchar(ptr< ::lestes::lang::cplus::sem::ss_type_uchar > type){
00202         lassert(type);
00203         result_set(lstring("h"));
00204 }
00205 
00206 void ss_type2mangled_id::visit_ss_type_pchar(ptr< ::lestes::lang::cplus::sem::ss_type_pchar > type){
00207         lassert(type);
00208         result_set(lstring("c"));
00209 }
00210 
00211 void ss_type2mangled_id::visit_ss_type_float(ptr< ::lestes::lang::cplus::sem::ss_type_float > type){
00212         lassert(type);
00213         result_set(lstring("f"));
00214 }
00215 
00216 void ss_type2mangled_id::visit_ss_type_double(ptr< ::lestes::lang::cplus::sem::ss_type_double > type){
00217         lassert(type);
00218         result_set(lstring("d"));
00219 }
00220 
00221 void ss_type2mangled_id::visit_ss_type_ldouble(ptr< ::lestes::lang::cplus::sem::ss_type_ldouble > type){
00222         lassert(type);
00223         result_set(lstring("e"));
00224 }
00225 
00226 
00227 
00228 end_package(sem);
00229 end_package(cplus);
00230 end_package(lang);
00231 end_package(lestes);
00232 

Generated on Mon Feb 12 18:23:33 2007 for lestes by doxygen 1.5.1-20070107