Changeset 1768


Ignore:
Timestamp:
May 20, 2005, 2:23:03 AM (16 years ago)
Author:
orlov
Message:
  • Fixes for compilation with Visual C++.
Location:
to-imperative/trunk/runtime
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/runtime/rf_core.cc

    r1763 r1768  
    203203ObjectRegister rftype::Table::reg(type_table) ;
    204204ObjectRegister rftype::Func::reg(type_func) ;
    205 #ifdef WINDOWS
    206 ObjectRegister rftype::Dir::reg(type_dir) ;
    207 #endif
    208205
    209206int main (int _argc, char* _argv[])
  • to-imperative/trunk/runtime/rf_expr.hh

    r1763 r1768  
    237237  template <class ObjClass, class CppType1, class CppType2>
    238238  static inline Expr create_sym (const CppType1& _arg1, const CppType2& _arg2) ;
     239
     240private:
     241
     242  template <class T>
     243  inline void set_flat_bit () ;
    239244
    240245private:
  • to-imperative/trunk/runtime/rf_expr.ih

    r1763 r1768  
    497497{
    498498  Expr e(1);
    499   if (SymbolType<ObjClass>::type == unsigned(flat_term)) e.flags |= FLAT_BIT;
    500   new (e.first) Symbol< ObjClass, SymbolType<ObjClass>::type >();
     499  new (e.first) Symbol<ObjClass, typename SymbolType<ObjClass>::type>();
     500  e.set_flat_bit<typename SymbolType<ObjClass>::type>();
    501501  return e;
    502502}
     
    506506{
    507507  Expr e(1);
    508   if (SymbolType<ObjClass>::type == unsigned(flat_term)) e.flags |= FLAT_BIT;
    509   new (e.first) Symbol< ObjClass, SymbolType<ObjClass>::type >(_arg1);
     508  new (e.first) Symbol<ObjClass, typename SymbolType<ObjClass>::type>(_arg1);
     509  e.set_flat_bit<typename SymbolType<ObjClass>::type>();
    510510  return e;
    511511}
     
    515515{
    516516  Expr e(1);
    517   if (SymbolType<ObjClass>::type == unsigned(flat_term)) e.flags |= FLAT_BIT;
    518   new (e.first) Symbol< ObjClass, SymbolType<ObjClass>::type >(_arg1, _arg2);
     517  new (e.first)
     518    Symbol<ObjClass, typename SymbolType<ObjClass>::type>(_arg1, _arg2);
     519  e.set_flat_bit<typename SymbolType<ObjClass>::type>();
    519520  return e;
     521}
     522
     523template <class T>
     524inline void Expr::set_flat_bit ()
     525{}
     526
     527template <>
     528inline void Expr::set_flat_bit<FlatTerm> ()
     529{
     530  flags |= FLAT_BIT;
    520531}
    521532
  • to-imperative/trunk/runtime/rf_macros.hh

    r1763 r1768  
    276276
    277277#define RF_NEW_SYMBOL(t, c) \
     278  template<> \
    278279  struct SymbolType<t> \
    279280  { \
    280     enum { type = c }; \
     281    /*enum { type = c };*/ \
     282    typedef c type; \
    281283  };
    282284
    283 #define RF_SYMBOL(t) Symbol< t, SymbolType<t>::type >
     285#define RF_SYMBOL(t) Symbol<t, SymbolType<t>::type>
    284286
    285287}
  • to-imperative/trunk/runtime/rf_symbol.hh

    r1763 r1768  
    1818class CheckShortObjectSize ;
    1919
     20template<>
    2021class CheckShortObjectSize<sizeof(intptr_t)>
    2122{};
     
    2324//template<class C, term_class_t tc = object_term>
    2425//class Symbol;
    25 template<class C, unsigned tc>
     26template<class C, class Type>
    2627class Symbol;
    2728
    2829template<class C>
    29 class Symbol<C, flat_term> :
     30class Symbol<C, FlatTerm> :
    3031  CheckShortObjectSize<sizeof(C)>,
    3132  public Term
     
    5152
    5253template<class C>
    53 class Symbol<C, object_term> :
     54class Symbol<C, ObjectTerm> :
    5455  public Term
    5556{
  • to-imperative/trunk/runtime/rf_symbol.ih

    r1763 r1768  
    1515
    1616template <class C>
    17 inline Symbol<C, flat_term>::Symbol (C _obj) :
     17inline Symbol<C, FlatTerm>::Symbol (C _obj) :
    1818  Term (reg.get_type())
    1919{
     
    3131
    3232template <class C>
    33 inline Symbol<C, object_term>::Symbol () :
     33inline Symbol<C, ObjectTerm>::Symbol () :
    3434  Term (reg.get_type())
    3535{
    3636  Wrapper* w = static_cast<Wrapper*>(allocator->allocate(sizeof(Wrapper)));
    37   new (&w->object) C();
     37  new (&(w->object)) C();
    3838  w->ref_count = 1;
    3939  ptr_data2 = w;
     
    4242template <class C>
    4343template <typename CppType1>
    44 inline Symbol<C, object_term>::Symbol (CppType1 _arg1) :
     44inline Symbol<C, ObjectTerm>::Symbol (CppType1 _arg1) :
    4545  Term (reg.get_type())
    4646{
    4747  Wrapper* w = static_cast<Wrapper*>(allocator->allocate(sizeof(Wrapper)));
    48   new (&w->object) C(_arg1);
     48  new (&(w->object)) C(_arg1);
    4949  w->ref_count = 1;
    5050  ptr_data2 = w;
     
    5353template <class C>
    5454template <typename CppType1, typename CppType2>
    55 inline Symbol<C, object_term>::Symbol (CppType1 _arg1, CppType2 _arg2) :
     55inline Symbol<C, ObjectTerm>::Symbol (CppType1 _arg1, CppType2 _arg2) :
    5656  Term (reg.get_type())
    5757{
    5858  Wrapper* w = static_cast<Wrapper*>(allocator->allocate(sizeof(Wrapper)));
    59   new (&w->object) C(_arg1, _arg2);
     59  new (&(w->object)) C(_arg1, _arg2);
    6060  w->ref_count = 1;
    6161  ptr_data2 = w;
     
    6363
    6464template <class C>
    65 inline C* Symbol<C, object_term>::get_obj_ptr () const
     65inline C* Symbol<C, ObjectTerm>::get_obj_ptr () const
    6666{
    6767  return &static_cast<Wrapper*>(ptr_data2)->object;
     
    6969
    7070template <class C>
    71 void Symbol<C, object_term>::ctor (
    72     Symbol<C, object_term>* _to, Symbol<C, object_term> const* _from
     71void Symbol<C, ObjectTerm>::ctor (
     72    Symbol<C, ObjectTerm>* _to, Symbol<C, ObjectTerm> const* _from
    7373)
    7474{
     
    7979
    8080template <class C>
    81 void Symbol<C, object_term>::dtor (Symbol<C, object_term>* _s)
     81void Symbol<C, ObjectTerm>::dtor (Symbol<C, ObjectTerm>* _s)
    8282{
    8383  Wrapper* w = static_cast<Wrapper*>(_s->ptr_data2);
     
    8989
    9090template <class C>
    91 pxx::WString Symbol<C, object_term>::to_string (
    92     Symbol<C, object_term> const* _s
     91pxx::WString Symbol<C, ObjectTerm>::to_string (
     92    Symbol<C, ObjectTerm> const* _s
    9393)
    9494{
     
    103103
    104104template <class C>
    105 short_type_funcs_t Symbol<C, object_term>::funcs = {
    106   (void (*)(Term*, Term const*))   (Symbol<C, object_term>::ctor),
    107   (void (*)(Term*))                (Symbol<C, object_term>::dtor),
    108   null, // (bool (*)(Term const*, Term const*))   (Symbol<C, object_term>::eq),
    109   null, // (int  (*)(Term const*, Term const*))   (Symbol<C, object_term>::compare),
    110   null, // (uint32_t (*)(Term const*))            (Symbol<C, object_term>::hash),
    111   (pxx::WString (*)(Term const*))  (Symbol<C, object_term>::to_string)
     105short_type_funcs_t Symbol<C, ObjectTerm>::funcs = {
     106  (void (*)(Term*, Term const*))   (Symbol<C, ObjectTerm>::ctor),
     107  (void (*)(Term*))                (Symbol<C, ObjectTerm>::dtor),
     108  null, // (bool (*)(Term const*, Term const*))   (Symbol<C, ObjectTerm>::eq),
     109  null, // (int  (*)(Term const*, Term const*))   (Symbol<C, ObjectTerm>::compare),
     110  null, // (uint32_t (*)(Term const*))            (Symbol<C, ObjectTerm>::hash),
     111  (pxx::WString (*)(Term const*))  (Symbol<C, ObjectTerm>::to_string)
    112112};
    113113
    114114template <class C>
    115 const TypeRegister Symbol<C, object_term>::reg(&Symbol<C, object_term>::funcs);
     115const TypeRegister Symbol<C, ObjectTerm>::reg(&Symbol<C, ObjectTerm>::funcs);
    116116
    117117template <class C>
    118 inline unsigned Symbol<C, object_term>::get_type ()
     118inline unsigned Symbol<C, ObjectTerm>::get_type ()
    119119{
    120120  return reg.get_type();
  • to-imperative/trunk/runtime/rf_term.ih

    r1763 r1768  
    184184inline C* Term::get_obj_ptr () const
    185185{
    186   return static_cast<Symbol< C, SymbolType<C>::type > const*>(this)->get_obj_ptr();
     186  return
     187    static_cast<Symbol<C, typename SymbolType<C>::type> const*>(this)->
     188      get_obj_ptr();
    187189}
    188190
     
    190192inline bool Term::is_instance_of () const
    191193{
    192   return get_short_type() == Symbol< C, SymbolType<C>::type >::get_type();
     194  return
     195    get_short_type() == Symbol<C, typename SymbolType<C>::type>::get_type();
    193196}
    194197
  • to-imperative/trunk/runtime/rf_types.hh

    r1763 r1768  
    8484} term_class_t ;
    8585
     86struct FlatTerm ;
     87struct ShortTerm ;
     88struct ObjectTerm ;
     89
    8690}
    8791
Note: See TracChangeset for help on using the changeset viewer.