Julius 4.2
|
00001 00035 /* 00036 * Copyright (c) 1991-2011 Kawahara Lab., Kyoto University 00037 * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology 00038 * Copyright (c) 2005-2011 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 <config-msvc-libsent.h> 00048 #else 00049 #include <sent/config.h> 00050 #endif 00051 00052 #include <stdio.h> 00053 #include <stdlib.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 #endif 00067 00068 /* get around sleep() */ 00069 #ifdef _WIN32 00070 # if !defined(__CYGWIN32__) && !defined(__MINGW32__) 00071 # define sleep(x) Sleep(x) 00072 # endif 00073 # ifndef HAVE_SLEEP 00074 # define sleep(x) Sleep(x) 00075 # endif 00076 #endif 00077 00078 #include <errno.h> 00079 #include <fcntl.h> 00080 #include <sys/types.h> 00081 00082 #include <sent/machines.h> 00083 00085 #if !defined(PI) 00086 #define PI 3.14159265358979 00087 #endif 00088 00089 #if !defined(TPI) 00090 #define TPI 6.28318530717959 00091 #endif 00092 00093 #if !defined(LOGTPI) 00094 #define LOGTPI 1.83787706640935 00095 #endif 00096 #if !defined(LOG_TEN) 00097 00098 #define LOG_TEN 2.30258509 00099 00100 #define INV_LOG_TEN .434294482 00101 #endif 00102 00104 typedef unsigned char boolean; 00105 #define TRUE 1 00106 #define FALSE 0 00107 00108 #if defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__MINGW32__) 00109 /* win32 functions */ 00110 #define getpagesize() (4096) 00111 #define access _access 00112 #define chmod _chmod 00113 #define close _close 00114 #define eof _eof 00115 #define filelength _filelength 00116 #define lseek _lseek 00117 #define open _open 00118 #define read _read 00119 #define write _write 00120 #define mkdir _mkdir 00121 #define unlink _unlink 00122 #define getcwd _getcwd 00123 #define getpid _getpid 00124 #define vsnprintf _vsnprintf 00125 #define snprintf _snprintf 00126 #define strdup _strdup 00127 #endif 00128 00129 #ifndef R_OK 00130 #define R_OK 4 00131 #endif 00132 #ifndef W_OK 00133 #define W_OK 2 00134 #endif 00135 #ifndef X_OK 00136 # if defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__MINGW32__) 00137 # define X_OK 0 00138 # else 00139 # define X_OK 1 00140 # endif 00141 #endif 00142 #ifndef F_OK 00143 #define F_OK 0 00144 #endif 00145 00146 /* some macros */ 00147 #undef max 00148 #undef min 00149 #define max(A,B) ((A)>=(B)?(A):(B)) 00150 #define min(A,B) ((A)<(B)?(A):(B)) 00151 #define abs(X) ((X)>0?(X):-(X)) 00152 00153 #define strmatch !strcmp 00154 00155 #define strnmatch !strncmp 00156 00157 #define DELM " \t\n" 00158 00160 #define LOG_ZERO -1000000 00161 00165 #define LOG_ADDMIN -13.815510558 00166 00168 enum LogOutputLevel { 00169 LOG_NORMAL, 00170 LOG_VERBOSE, 00171 LOG_DEBUG 00172 }; 00173 00175 enum { 00176 DIR_LR, 00177 DIR_RL 00178 }; 00179 00181 /* you can't use double for typedefs below */ 00182 /* also look at lib/util/mybmalloc.c */ 00183 typedef float PROB; 00184 typedef float LOGPROB; 00185 typedef short SP16; 00186 typedef float VECT; 00187 00188 00189 #ifdef WORDS_INT 00190 /* maximum number of words = 2G = 2^31 (--enable-words-int) */ 00191 typedef int WORD_ID; 00192 #define MAX_WORD_NUM 2147483647 ///< Maximum size of vocabulary 00193 #define WORD_INVALID 2147483647 ///< Out of word ID to represent no-existence of word 00194 #else 00195 /* maximum number of words = 65535 */ 00196 typedef unsigned short WORD_ID; 00197 #define MAX_WORD_NUM 65535 ///< Maximum size of vocabulary 00198 #define WORD_INVALID 65535 ///< Out of word ID to represent no-existence of word 00199 #endif 00200 00202 #define MAXLINELEN 1024 00203 00205 #ifndef MAXPATHLEN 00206 #define MAXPATHLEN 2048 00207 #endif 00208 00209 #include <sent/util.h> 00210 00211 #endif /* __SENT_STANDARD_DEFS__ */