simple.cc - generated code example
[prop.git] / configure-dir / generic.h.bool
bloba612f6fb4b233e2b1c12f56cd815119f4cda4489
1 //////////////////////////////////////////////////////////////////////////////
2 // NOTICE:
3 //
4 // ADLib, Prop and their related set of tools and documentation are in the 
5 // public domain.   The author(s) of this software reserve no copyrights on 
6 // the source code and any code generated using the tools.  You are encouraged
7 // to use ADLib and Prop to develop software, in both academic and commercial
8 // settings, and are free to incorporate any part of ADLib and Prop into
9 // your programs.
11 // Although you are under no obligation to do so, we strongly recommend that 
12 // you give away all software developed using our tools.
14 // We also ask that credit be given to us when ADLib and/or Prop are used in 
15 // your programs, and that this notice be preserved intact in all the source 
16 // code.
18 // This software is still under development and we welcome any suggestions 
19 // and help from the users.
21 // Allen Leung 
22 // 1994
23 //////////////////////////////////////////////////////////////////////////////
25 #ifndef generic_definitions_h
26 #define generic_definitions_h
28 ////////////////////////////////////////////////////////////////////////////
29 //  This file contains all the generic definitions that are used
30 //  in the rest of the library.
31 ////////////////////////////////////////////////////////////////////////////
33 ////////////////////////////////////////////////////////////////////////////
34 //  Integer and boolean types. 
35 ////////////////////////////////////////////////////////////////////////////
36 #define PROP_BOOL_IS_DEFINED
37 typedef unsigned long Cardinal;
38 typedef long Integer;
39 typedef bool Bool;
40 typedef unsigned char Byte;
42 ////////////////////////////////////////////////////////////////////////////
43 //  Bit operations.
44 ////////////////////////////////////////////////////////////////////////////
45 #define bitSet(A,bit) \
46    ((A)[((unsigned int)(bit))>>3] |= (1 << ((unsigned int)(bit)&7)))
47 #define bitClear(A,bit) \
48    ((A)[((unsigned int)(bit))>>3] &= ~(1 << ((unsigned int)(bit)&7)))
49 #define bitOf(A,bit) \
50    ((A)[((unsigned int)(bit))>>3] & (1 << ((unsigned int)(bit)&7)))
52 typedef unsigned short ShortWord;
53 typedef unsigned long LongWord;
55 ////////////////////////////////////////////////////////////////////////////
56 //  Type Ix is a generic index used by all the container and collection
57 //  classes.
58 ////////////////////////////////////////////////////////////////////////////
59 typedef void * Ix;
61 ////////////////////////////////////////////////////////////////////////////
62 //  Iterator macros.  These are provided for those who like more meaningful
63 //  iterator construct.   For example, 
65 //  void print(Set<Person>& employees) 
66 //  {  foreach(e,employees) {
67 //        cout << employees(e) << '\n';
68 //     }
69 //  }
70 ////////////////////////////////////////////////////////////////////////////
71 #define foreach(i,C)             for(Ix i = (C).first(); i; i = (C).next(i))
72 #define foreach_in_reverse(i,C)  for(Ix i = (C).last(); i; i = (C).prev(i))
74 extern void raise_exn(const char *);
75 #define __STR(x) __VAL(x)
76 #define __VAL(x) #x
77 #define throw(exception) raise_exn("%s" #exception)
79 #endif