initial
[prop.git] / configure-dir / generic.h.nobool
blob57346a9c5d41f142ba151a5f734477a80c5cd20d
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 typedef unsigned long Cardinal;
37 typedef long Integer;
38 typedef int Bool;
39 #define false (Bool)0
40 #define true  (Bool)1
41 typedef unsigned char Byte;
43 ////////////////////////////////////////////////////////////////////////////
44 //  Bit operations.
45 ////////////////////////////////////////////////////////////////////////////
46 #define bitSet(A,bit) \
47    ((A)[((unsigned int)(bit))>>3] |= (1 << ((unsigned int)(bit)&7)))
48 #define bitClear(A,bit) \
49    ((A)[((unsigned int)(bit))>>3] &= ~(1 << ((unsigned int)(bit)&7)))
50 #define bitOf(A,bit) \
51    ((A)[((unsigned int)(bit))>>3] & (1 << ((unsigned int)(bit)&7)))
53 typedef unsigned short ShortWord;
54 typedef unsigned long LongWord;
56 ////////////////////////////////////////////////////////////////////////////
57 //  Type Ix is a generic index used by all the container and collection
58 //  classes.
59 ////////////////////////////////////////////////////////////////////////////
60 typedef void * Ix;
62 ////////////////////////////////////////////////////////////////////////////
63 //  Iterator macros.  These are provided for those who like more meaningful
64 //  iterator construct.   For example, 
66 //  void print(Set<Person>& employees) 
67 //  {  foreach(e,employees) {
68 //        cout << employees(e) << '\n';
69 //     }
70 //  }
71 ////////////////////////////////////////////////////////////////////////////
72 #define foreach(i,C)             for(Ix i = (C).first(); i; i = (C).next(i))
73 #define foreach_in_reverse(i,C)  for(Ix i = (C).last(); i; i = (C).prev(i))
75 extern void raise_exn(const char *);
76 #define __STR(x) __VAL(x)
77 #define __VAL(x) #x
78 #define throw(exception) raise_exn("%s" #exception)
80 #endif