libsent/include/sent/stddefs.h

Go to the documentation of this file.
00001 
00035 /*
00036  * Copyright (c) 1991-2007 Kawahara Lab., Kyoto University
00037  * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology
00038  * Copyright (c) 2005-2007 Julius project team, Nagoya Institute of Technology
00039  * All rights reserved
00040  */
00041 
00042 #ifndef __SENT_STANDARD_DEFS__
00043 #define __SENT_STANDARD_DEFS__
00044 
00045 /* load site-dependent configuration by configure script */
00046 #if defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__MINGW32__)
00047 #include <sent/config-win.h>
00048 #else
00049 #include <sent/config.h>
00050 #endif
00051 
00052 #include <stdio.h>
00053 #include <stdlib.h>
00054 #include <strings.h>
00055 #include <string.h>
00056 #include <math.h>
00057 #if !defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__)
00058 /* unixen */
00059 #ifdef HAVE_UNISTD_H
00060 #include <unistd.h>
00061 #endif
00062 #include <strings.h>
00063 #include <sys/time.h>
00064 #else
00065 /* win32 */
00066 #include <io.h>
00067 #endif
00068 
00069 /* get around sleep() */
00070 #ifdef _WIN32
00071 # if !defined(__CYGWIN32__) && !defined(__MINGW32__)
00072 # define sleep(x) Sleep(x)
00073 # endif
00074 # ifndef HAVE_SLEEP
00075 # define sleep(x) Sleep(x)
00076 # endif
00077 #endif
00078 
00079 #include <errno.h>
00080 #include <fcntl.h>
00081 #include <sys/types.h>
00082 
00083 #include <sent/machines.h>
00084 
00086 #if !defined(PI)
00087 #define PI 3.14159265358979
00088 #endif
00090 #if !defined(TPI)
00091 #define TPI 6.28318530717959 
00092 #endif
00094 #if !defined(LOGTPI)
00095 #define LOGTPI 1.83787706640935
00096 #endif
00097 #if !defined(LOG_TEN)
00099 #define LOG_TEN 2.30258509
00101 #define INV_LOG_TEN .434294482
00102 #endif
00103 
00105 typedef unsigned char boolean;
00106 #define TRUE 1
00107 #define FALSE 0
00108 
00109 #if defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__MINGW32__)
00110 /* win32 functions */
00111 #define getpagesize() (4096)
00112 #define access _access        
00113 #define chmod _chmod
00114 #define close _close
00115 #define eof _eof
00116 #define filelength _filelength
00117 #define isatty _isatty
00118 #define lseek _lseek
00119 #define open _open
00120 #define read _read
00121 #define write _write
00122 #define mkdir _mkdir
00123 #define unlink _unlink
00124 #define getcwd _getcwd
00125 #define getpid _getpid
00126 #define vsnprintf _vsnprintf
00127 #define snprintf _snprintf
00128 #endif
00129 
00130 #ifndef R_OK
00131 #define R_OK 4
00132 #endif
00133 #ifndef W_OK
00134 #define W_OK 2
00135 #endif
00136 #ifndef X_OK
00137 # if defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__MINGW32__)
00138 # define X_OK 0
00139 # else
00140 # define X_OK 1
00141 # endif
00142 #endif
00143 #ifndef F_OK
00144 #define F_OK 0
00145 #endif
00146 
00147 /* some macros */
00148 #undef max
00149 #undef min
00150 #define max(A,B)        ((A)>=(B)?(A):(B))
00151 #define min(A,B)        ((A)<(B)?(A):(B))
00152 #define abs(X)          ((X)>0?(X):-(X))
00154 #define strmatch        !strcmp
00156 #define strnmatch       !strncmp
00158 #define DELM " \t\n"
00159 
00161 #define LOG_ZERO        -1000000
00162 
00166 #define LOG_ADDMIN      -13.815510558
00167 
00169 enum LogOutputLevel {
00170   LOG_NORMAL,                   
00171   LOG_VERBOSE,                  
00172   LOG_DEBUG                     
00173 };
00174 
00176 enum {
00177   DIR_LR,                       
00178   DIR_RL                        
00179 };
00180 
00182 /* you can't use double for typedefs below */
00183 /* also look at lib/util/mybmalloc.c */
00184 typedef float PROB;             
00185 typedef float LOGPROB;          
00186 typedef short SP16;             
00187 typedef float VECT;             
00188 
00189 
00190 #ifdef WORDS_INT
00191 /* maximum number of words = 2G = 2^31 (--enable-words-int) */
00192 typedef int WORD_ID;            
00193 #define MAX_WORD_NUM 2147483647 
00194 #define WORD_INVALID 2147483647 
00195 #else
00196 /* maximum number of words = 65535 */
00197 typedef unsigned short WORD_ID; 
00198 #define MAX_WORD_NUM 65535      
00199 #define WORD_INVALID 65535      
00200 #endif
00201 
00203 #define MAXLINELEN 1024
00204 
00206 #define MAXPATHLEN 1024
00207 
00208 #include <sent/util.h>
00209 
00210 #endif /* __SENT_STANDARD_DEFS__ */

Generated on Tue Dec 18 15:59:54 2007 for Julius by  doxygen 1.5.4