Ignore:
Timestamp:
May 16, 2003, 11:47:17 AM (18 years ago)
Author:
luba
Message:
  • type word is registered
File:
1 edited

Legend:

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

    r705 r731  
    4242  mbstate_t ps;
    4343  size_t len = mbsrtowcs(null, &s, 0, &ps);
    44   if (len == (size_t)(-1)) throw_sys_error(errno);
     44//  if (len == (size_t)(-1)) throw_sys_error(errno);
    4545  Header* h = static_cast<Header*>(
    4646    allocator.allocate(sizeof(Header) + len * sizeof(wchar_t)));
     
    5858  if (_locale != null) setlocale(LC_CTYPE, saved_locale);
    5959}
    60 
     60 
    6161inline Word::Word (Word const& _word) :
    6262  Term (term_sym, type_word)
     
    6666  h->ref_count++;
    6767}
    68 
     68 
    6969inline Word::~Word ()
    70 {
     70{ 
    7171  Header* h = static_cast<Header*>(ptr_data2);
    7272  if (--(h->ref_count) == 0) allocator.deallocate(h);
     
    8585}
    8686
     87inline size_t Word::get_len () {
     88  return static_cast<Header*>(ptr_data2)->length;
     89}
     90
     91inline int Word::is_number () {
     92  int res = 1;
     93  size_t i = 0;
     94  Header* h = static_cast<Header*>(ptr_data2);
     95
     96  if ((h->content[i]) == '-') res = -1; //если отрицательное число
     97  if ((h->content[i]) == '+') res = 1; //если положительное с "+" число
     98  if (res) i = 1;
     99  for (; i < h->length; i++)
     100    if (iswdigit(h->content[i]) == 0) {
     101      res = 0; break;
     102    }
     103  return res;
     104}
     105#if 0
    87106Expr Word::create_expr (wchar_t const* _wstr)
    88 {
     107 {
    89108  Expr e = Term::create_expr(1);
    90109  Term* p = e.get_first();
     
    100119  return e;
    101120}
    102 
     121#endif
    103122}
    104123
Note: See TracChangeset for help on using the changeset viewer.