libsent/include/sent/stddefs.h

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

Generated on Tue Dec 26 12:53:22 2006 for Julian by  doxygen 1.5.0