Changeset 888
- Timestamp:
- Jun 29, 2003, 8:50:45 PM (18 years ago)
- Location:
- to-imperative/trunk/library/String
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
to-imperative/trunk/library/String/create_string.hh
r360 r888 5 5 6 6 #include <rf_core.hh> 7 #include <rf_string.hh>8 #include <rf_char.hh>9 #include <rf_word.hh>7 //#include <rf_string.hh> 8 //#include <rf_char.hh> 9 //#include <rf_word.hh> 10 10 11 11 namespace refal 12 12 { 13 14 13 using namespace rfrt; 15 14 using namespace rftype; … … 18 17 { 19 18 19 20 20 inline static 21 rf_string::String create_string(const Expr &e_Sourse, const char *fname)21 WString::String create_string(const Expr &e_Sourse)//, const char *fname) 22 22 { 23 23 uintptr_t len = 0; … … 26 26 for (; p < e_Sourse.get_last(); p++) 27 27 { 28 if (p->get_type() == RF_TYPE(Char))28 if (p->get_type() == type_char) 29 29 len++; 30 30 else 31 if (p->get_type() == RF_TYPE(Word))32 len += Word(*p).get_len();31 if (p->get_type() == type_word) 32 len += ((Word*)p)->get_len(); 33 33 else 34 if (p->get_type() == RF_TYPE(WString))35 len += WString(*p).get_len();34 if (p->get_type() == type_string) 35 len += ((WString*)p)->get_length(); 36 36 else 37 RF_LIB_ERROR _IN_FUNC(fname,"Invalid argument");37 RF_LIB_ERROR("Invalid argument"); 38 38 } 39 39 … … 42 42 WString string(len); 43 43 44 WString::Iterator i = string;45 46 44 for (p = e_Sourse.get_first(); p < e_Sourse.get_last(); p++) 47 45 { 48 if (p->get_type() == RF_TYPE(Char)) 46 string = string + WString(*p); 47 #if 0 48 if (p->get_type() == type_char) 49 49 { 50 *i++ = Char(*p);51 50 } 52 51 else 53 if (p->get_type() == RF_TYPE(Word))52 if (p->get_type() == type_word) 54 53 { 55 Word::Iterator wi = Word(*p); 56 while (wi.in_bounds()) 57 *i++ = *wi++; 54 string = string + WString(*p); 58 55 } 59 56 else // p points to String 60 57 { 61 WString s = *p;62 i.fill_with_string(s);58 String s = *p; 59 string = string + s; 63 60 i += s.get_len(); 64 61 } 62 #endif 63 65 64 } 66 67 65 return string; 68 69 66 } 70 67 catch (const pxx::SysError &err) 71 68 { 72 69 if (err.get_code() == ENOMEM) 73 RF_LIB_ERROR _IN_FUNC(fname,"Size limit excedeed");70 RF_LIB_ERROR("Size limit excedeed"); 74 71 throw; 75 72 } … … 80 77 81 78 } 79 82 80 -
to-imperative/trunk/library/String/string.cc
r362 r888 5 5 6 6 #include <rf_core.hh> 7 #include <rf_string.hh>8 7 9 8 #include "create_string.hh" … … 19 18 20 19 RF_FUNC (String, (RF_ARG e_Sourse), (RF_RES s_String)) 20 21 WString string = create_string(e_Sourse);//, __func__); 22 //for (size_t i = 0; i < string.get_length(); i++) 23 // printf ("string[i] = %c\n", string[i]); 21 24 22 s_String = create_string(e_Sourse, __func__).to_symbol(); 23 25 rftype::String& _str = static_cast<rftype::String&>(string); 26 rftype::String* str_ptr = &_str; 27 s_String = rftype::String::create_expr(str_ptr); 28 // printf ("string end\n"); 24 29 RF_END 25 30 26 31 } 32 33 } 27 34 28 } 35
Note: See TracChangeset
for help on using the changeset viewer.