source: to-imperative/trunk/runtime/rf_types.hh @ 1010

Last change on this file since 1010 was 1010, checked in by pooh, 18 years ago
  • More work on long arithmetic.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.5 KB
Line 
1#ifndef __rf_types_hh__
2#define __rf_types_hh__
3
4#include "rf_common.hh"
5#include "pxx_string.hh"
6
7namespace rfrt
8{
9
10class Term ;
11
12static const unsigned short_types_count = 0x1000 ;
13static const unsigned max_type = 0xFFFF ;
14
15typedef enum
16{
17  SYM_BORDER = 0,
18  type_ref = 1,
19  type_object,
20  type_char,
21  type_word,
22  type_int,
23  type_short_int,
24  type_user,
25  type_object_begin = short_types_count,
26  type_box,
27  type_vector,
28  type_string,
29  type_table,
30  type_channel,
31  type_user_object,
32  type_expr = max_type
33} internal_type_t ;
34
35extern unsigned current_short_type ;
36extern unsigned current_object_type ;
37
38typedef struct
39{
40  ///
41  /// Copy constructor for short symbol
42  void (*ctor)(Term*, Term const*) ;
43  ///
44  /// Destructor for short symbol
45  void (*dtor)(Term*) ;
46  ///
47  /// Equality check for short symbol (may be faster than compare)
48  bool (*eq)(Term const*, Term const*) ;
49  ///
50  /// Compare function for short symbol
51  int (*compare)(Term const*, Term const*) ;
52  ///
53  /// Hash function for short symbol.
54  uint32_t (*hash)(Term const*) ;
55  ///
56  /// Conversion to string.
57  pxx::WString (*to_string)(Term const*) ;
58} short_type_funcs_t ;
59
60extern short_type_funcs_t* short_type_funcs[short_types_count] ;
61
62class TypeRegister
63{
64public:
65  inline TypeRegister (short_type_funcs_t* _funcs, unsigned _typenum = 0) ;
66};
67
68class ObjectRegister
69{
70  unsigned type ;
71public:
72  inline ObjectRegister (unsigned _typenum = 0) ;
73  inline unsigned get_type () const ;
74};
75
76}
77
78#endif // __rf_types_hh__
Note: See TracBrowser for help on using the repository browser.