Changeset 786


Ignore:
Timestamp:
May 29, 2003, 1:24:02 AM (18 years ago)
Author:
pooh
Message:
  • More fixes to make Word working.
Location:
to-imperative/trunk/runtime
Files:
4 edited

Legend:

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

    r561 r786  
    558558    // In a case of not flat expression advance reference counters for child
    559559    // memory blocks
    560     if (!_expr.is_flat()) _expr.ref_childs();
     560//    if (!_expr.is_flat()) _expr.ref_childs();
    561561    //
    562562    // Initialize expression by a copy of a first argument
    563563    Expr e(*this);
    564     memcpy(e.last, _expr.first, len2 * sizeof(Term));
     564//    memcpy(e.last, _expr.first, len2 * sizeof(Term));
     565    if (_expr.is_flat())
     566      memcpy(e.last, _expr.first, len2 * sizeof(Term));
     567    else {
     568      Term* to = e.last;
     569      Term const* from = _expr.first;
     570      while (from != _expr.last) {
     571        new(to) Term(*from);
     572        from++; to++;
     573      }
     574    }
    565575    //
    566576    // Adjust flags
     
    580590    lt_copy++;
    581591    #endif
    582     if (!is_flat()) ref_childs();
     592//    if (!is_flat()) ref_childs();
    583593    Expr e(_expr);
    584594    e.first -= len1;
    585     memcpy(e.first, first, len1 * sizeof(Term));
     595//    memcpy(e.first, first, len1 * sizeof(Term));
     596    if (is_flat()) memcpy(e.first, first, len1 * sizeof(Term));
     597    else {
     598      Term* to = e.first;
     599      Term const* from = first;
     600      while (from != last) {
     601        new(to) Term(*from);
     602        from++; to++;
     603      }
     604    }
    586605    e.flags &= flags;
    587606    return e;
     
    600619    // then for the resulting expression. This advances our chances to avoid
    601620    // some work in a case if at least one of two expressions is flat.
    602     if (!is_flat()) ref_childs();
    603     if (!_expr.is_flat()) _expr.ref_childs();
    604     memcpy(e.first, first, len1 * sizeof(Term));
    605     memcpy(e.first + len1, _expr.first, len2 * sizeof(Term));
     621    if (is_flat()) memcpy(e.first, first, len1 * sizeof(Term));
     622    else {
     623      Term* to = e.first;
     624      Term const* from = first;
     625      while (from != last) {
     626        new(to) Term(*from);
     627        from++; to++;
     628      }
     629    }
     630    if (_expr.is_flat())
     631      memcpy(e.first + len1, _expr.first, len2 * sizeof(Term));
     632    else {
     633      Term* to = e.first + len1;
     634      Term const* from = _expr.first;
     635      while (from != _expr.last) {
     636        new(to) Term(*from);
     637        from++; to++;
     638      }
     639    }
    606640    //
    607641    // Adjust flags
  • to-imperative/trunk/runtime/rf_term.ih

    r781 r786  
    7070inline Term::Term (Term const& _t)
    7171{
    72   (this->*ctor_funcs[get_class()])(_t);
     72  (this->*ctor_funcs[_t.get_class()])(_t);
    7373}
    7474
  • to-imperative/trunk/runtime/rf_word.cc

    r731 r786  
    3333  }
    3434}
    35  
     35
     36pxx::WString Word::to_string (uintptr_t _data)
     37{
     38  Header* h = reinterpret_cast<Header*>(_data);
     39  return pxx::WString(h->content, h->length);
     40}
     41
    3642Expr Word::create_expr (wchar_t const* _wstr)
    3743 {
     
    8187  Word::compare,
    8288  Word::hash,
    83   null // Word::to_string
     89  Word::to_string
    8490};
    8591
  • to-imperative/trunk/runtime/rf_word.ih

    r773 r786  
    232232}
    233233#endif
     234
    234235}
    235236
Note: See TracChangeset for help on using the changeset viewer.