Changeset 733


Ignore:
Timestamp:
May 17, 2003, 12:00:10 PM (18 years ago)
Author:
luba
Message:
Location:
to-imperative/trunk/runtime
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/runtime/rf_word.hh

    r731 r733  
    5757  static short_type_funcs_t funcs ;
    5858  static TypeRegister reg ;
     59 
     60  class NumIterator {
     61  private:
     62    const wchar_t* iter;
     63    const wchar_t* bound;
     64  public:
     65    inline NumIterator(Word const& _word) ;
     66    inline NumIterator& operator ++() ;
     67    inline NumIterator const& operator =(Word const& _word) ;
     68    inline bool in_bounds () ;
     69    inline const wchar_t operator*() ;
     70  };
     71 
     72
     73
    5974};
    6075
  • to-imperative/trunk/runtime/rf_word.ih

    r731 r733  
    9494  Header* h = static_cast<Header*>(ptr_data2);
    9595
    96   if ((h->content[i]) == '-') res = -1; //если отрицательное число
    97   if ((h->content[i]) == '+') res = 1; //если положительное с "+" число
     96  if ((h->content[i]) == '-') res = -1;
     97  if ((h->content[i]) == '+') res = 1;
    9898  if (res) i = 1;
    9999  for (; i < h->length; i++)
     
    103103  return res;
    104104}
     105
     106//the method is called only if is_number() function
     107//has returned non-zero value
     108//
     109
     110inline Word::NumIterator::NumIterator(Word const& _word) {
     111  Header* h = static_cast<Header*>(_word.ptr_data2);
     112  if (*(h->content) == '+' || *(h->content) == '-')
     113    iter = h->content + 1;
     114  else
     115    iter = h->content;
     116    bound = h->content + h->length;
     117  }
     118
     119inline Word::NumIterator& Word::NumIterator::operator ++() {
     120  iter++;     
     121  return *this;
     122  };
     123
     124inline Word::NumIterator const& Word::NumIterator::operator = (Word const& _word) {
     125  Header* h = static_cast<Header*>(_word.ptr_data2);
     126  if (*(h->content) == '+' || *(h->content) == '-')
     127    iter = h->content + 1;
     128    else
     129      iter = h->content;
     130    return *this;
     131  };
     132
     133inline bool Word::NumIterator::in_bounds () {
     134  if (iter > bound ) return false;
     135  else return true;
     136}
     137
     138inline const wchar_t Word::NumIterator::operator * () {
     139  return *iter;
     140}
     141
    105142#if 0
    106143Expr Word::create_expr (wchar_t const* _wstr)
Note: See TracChangeset for help on using the changeset viewer.