+ rewrote C interface for SWIG/Python
[qpalma.git] / QPalmaDP / common.h
1 #ifndef __COMMON_H__
2 #define __COMMON_H__
3
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include "config.h"
7
8 #ifdef SUNOS
9 #define bool int
10 #define false 0
11 #define true 1
12 #endif
13
14 #ifndef LINUX
15 #define RANDOM_MAX 2147483647
16 #else
17 #define RANDOM_MAX RAND_MAX
18 #endif
19
20 /**@name Standard Types
21 * Definition of Platform independent Types
22 */
23 //@{
24
25 /// Type CHAR
26 typedef char CHAR;
27 typedef CHAR* P_CHAR;
28
29 /// Type BYTE
30 typedef unsigned char BYTE;
31 typedef BYTE* P_BYTE;
32
33 /// Type SHORT is 2 bytes in size
34 typedef short int SHORT;
35 typedef SHORT* P_SHORT;
36
37 /// Type WORD is 2 bytes in size
38 typedef unsigned short int WORD;
39 typedef WORD* P_WORD;
40
41 /// Type INT is 4 bytes in size
42 typedef int INT;
43 typedef INT* P_INT;
44
45 /// Type INT is 4 bytes in size
46 typedef unsigned int UINT;
47 typedef UINT* P_UINT;
48
49 /// Type LONG is 8 bytes in size
50 typedef long LONG;
51 typedef LONG* P_LONG;
52
53 /// Type SHORTREAL is 4 bytes in size
54 typedef float SHORTREAL;
55 typedef SHORTREAL* P_SHORTREAL;
56
57 /// Type REAL is 8 bytes in size
58 typedef double REAL;
59 typedef REAL* P_REAL;
60
61 /// Type LONGREAL is 16 bytes in size
62 //typedef long double LONGREAL;
63 //typedef LONGREAL* P_LONGREAL;
64
65 #ifdef USE_SHORTREAL_KERNELCACHE
66 typedef SHORTREAL KERNELCACHE_ELEM;
67 #else
68 typedef REAL KERNELCACHE_ELEM;
69 #endif
70
71 typedef KERNELCACHE_ELEM P_KERNELCACHE_ELEM;
72
73 typedef LONG KERNELCACHE_IDX;
74
75 /// The io libs output [DEBUG] etc in front of every CIO::message
76 /// 'higher' messages filter output depending on the loglevel, i.e. CRITICAL messages
77 /// will print all M_CRITICAL TO M_EMERGENCY messages to
78 enum EMessageType
79 {
80 M_DEBUG,
81 M_INFO,
82 M_NOTICE,
83 M_WARN,
84 M_ERROR,
85 M_CRITICAL,
86 M_ALERT,
87 M_EMERGENCY,
88 M_MESSAGEONLY,
89 M_PROGRESS
90 };
91
92 enum EKernelType
93 {
94 K_UNKNOWN = 0,
95 K_OPTIMIZABLE = 4096,
96 K_LINEAR = 10 | K_OPTIMIZABLE,
97 K_POLY = 20,
98 K_GAUSSIAN = 30,
99 K_HISTOGRAM = 40,
100 K_SALZBERG = 41,
101 K_LOCALITYIMPROVED = 50,
102 K_SIMPLELOCALITYIMPROVED = 60,
103 K_FIXEDDEGREE = 70,
104 K_WEIGHTEDDEGREE = 80 | K_OPTIMIZABLE,
105 K_WEIGHTEDDEGREEPOS = 81 | K_OPTIMIZABLE,
106 K_WEIGHTEDDEGREEPOLYA = 82,
107 K_WD = 83,
108 K_COMMWORD = 90 | K_OPTIMIZABLE ,
109 K_POLYMATCH = 100,
110 K_ALIGNMENT = 110,
111 K_COMMWORDSTRING = 120 | K_OPTIMIZABLE,
112 K_SPARSENORMSQUARED = 130,
113 K_COMBINED = 140 | K_OPTIMIZABLE
114 };
115
116 enum EFeatureType
117 {
118 F_UNKNOWN = 0,
119 F_REAL = 10,
120 F_SHORT = 20,
121 F_CHAR = 30,
122 F_INT = 40,
123 F_BYTE = 50,
124 F_WORD = 60
125 };
126
127 enum EFeatureClass
128 {
129 C_UNKNOWN = 0,
130 C_SIMPLE = 10,
131 C_SPARSE = 20,
132 C_STRING = 30,
133 C_COMBINED = 40
134 };
135
136 /// Alphabet of charfeatures/observations
137 enum E_ALPHABET
138 {
139 /// DNA - letters A,C,G,T,*,N,n
140 DNA=0,
141
142 /// PROTEIN - letters a-z
143 PROTEIN=1,
144
145 /// ALPHANUM - [0-9a-z]
146 ALPHANUM=2,
147
148 /// CUBE - [1-6]
149 CUBE=3,
150
151 /// NONE - type has no alphabet
152 NONE=4
153 };
154
155 //@}
156
157 #define TMP_DIR "/tmp/"
158 //#define TMP_DIR "/short/x46/tmp/"
159
160 #endif