Changeset 739


Ignore:
Timestamp:
May 21, 2003, 12:40:47 PM (18 years ago)
Author:
luba
Message:
  • method is_number() is corrected
Location:
to-imperative/trunk/runtime
Files:
2 edited

Legend:

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

    r735 r739  
    4141  inline Word& operator = (Word const& _word) ;
    4242
    43   inline size_t get_len ();
     43  inline size_t get_len () const;
    4444
    45   inline int is_number ();
     45  inline int is_number () const;
     46
     47  inline wchar_t* get_content() const;
    4648
    4749  static Expr create_expr (wchar_t const* _wstr) ;
  • to-imperative/trunk/runtime/rf_word.ih

    r737 r739  
    8585}
    8686
    87 inline size_t Word::get_len ()
     87inline size_t Word::get_len () const
    8888{
    8989  return static_cast<Header*>(ptr_data2)->length;
    9090}
    9191
    92 inline int Word::is_number ()
     92inline wchar_t* Word::get_content() const {
     93  Header* h = static_cast<Header*>(ptr_data2);
     94  return h->content;
     95}
     96
     97
     98//first symbol in word is '-' res == -1; '+' res == 1,
     99//'digit' res == 2; othewise res == 0
     100//
     101
     102inline int Word::is_number () const
    93103{
    94   int res = 1;
     104  int res = 0;
    95105  size_t i = 0;
    96106  Header* h = static_cast<Header*>(ptr_data2);
     
    98108  if ((h->content[i]) == '-') res = -1;
    99109  if ((h->content[i]) == '+') res = 1;
     110  if (iswdigit(h->content[i])) res = 2;
    100111  if (res) i = 1;
    101112  for (; i < h->length; i++)
     
    146157inline const wchar_t Word::NumIterator::operator * () const
    147158{
    148   return *iter;
     159  return *iter - 48;
    149160}
    150161
Note: See TracChangeset for help on using the changeset viewer.