home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Online / PHP / include / php / main / php.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-26  |  8.5 KB  |  335 lines

  1. /* 
  2.    +----------------------------------------------------------------------+
  3.    | PHP version 4.0                                                      |
  4.    +----------------------------------------------------------------------+
  5.    | Copyright (c) 1997-2001 The PHP Group                                |
  6.    +----------------------------------------------------------------------+
  7.    | This source file is subject to version 2.02 of the PHP license,      |
  8.    | that is bundled with this package in the file LICENSE, and is        |
  9.    | available at through the world-wide-web at                           |
  10.    | http://www.php.net/license/2_02.txt.                                 |
  11.    | If you did not receive a copy of the PHP license and are unable to   |
  12.    | obtain it through the world-wide-web, please send a note to          |
  13.    | license@php.net so we can mail you a copy immediately.               |
  14.    +----------------------------------------------------------------------+
  15.    | Authors: Andi Gutmans <andi@zend.com>                                |
  16.    |          Zeev Suraski <zeev@zend.com>                                |
  17.    +----------------------------------------------------------------------+
  18.  */
  19.  
  20. /* $Id: php.h,v 1.134 2001/02/26 18:14:30 andi Exp $ */
  21.  
  22. #ifndef PHP_H
  23. #define PHP_H
  24.  
  25. #ifdef HAVE_DMALLOC
  26. #include <dmalloc.h>
  27. #endif
  28.  
  29. #define PHP_API_VERSION 20010119
  30.  
  31. #define YYDEBUG 0
  32.  
  33. #include "php_version.h"
  34. #include "zend.h"
  35. #include "php_compat.h"
  36.  
  37. #include "zend_API.h"
  38.  
  39. #if PHP_BROKEN_SPRINTF
  40. #undef sprintf
  41. #define sprintf php_sprintf
  42. #endif
  43.  
  44. #ifdef PHP_WIN32
  45. #include "win95nt.h"
  46. #    ifdef PHP_EXPORTS
  47. #    define PHPAPI __declspec(dllexport) 
  48. #    else
  49. #    define PHPAPI __declspec(dllimport) 
  50. #    endif
  51. #define PHP_DIR_SEPARATOR '\\'
  52. #else
  53. #define PHPAPI
  54. #define THREAD_LS
  55. #define PHP_DIR_SEPARATOR '/'
  56. #endif
  57.  
  58. #include "php_regex.h"
  59.  
  60. /* PHP's DEBUG value must match Zend's ZEND_DEBUG value */
  61. #undef PHP_DEBUG
  62. #define PHP_DEBUG ZEND_DEBUG
  63.  
  64.  
  65. #define APACHE 0
  66. #define CGI_BINARY 0
  67.  
  68. #if HAVE_UNIX_H
  69. #include <unix.h>
  70. #endif
  71.  
  72. #if HAVE_ALLOCA_H
  73. #include <alloca.h>
  74. #endif
  75.  
  76. /*
  77.  * This is a fast version of strlcpy which should be used, if you
  78.  * know the size of the destination buffer and if you know
  79.  * the length of the source string.
  80.  *
  81.  * size is the allocated number of bytes of dst
  82.  * src_size is the number of bytes excluding the NUL of src
  83.  */
  84.  
  85. #define PHP_STRLCPY(dst, src, size, src_size)    \
  86.     {                                            \
  87.         size_t php_str_len;                        \
  88.                                                 \
  89.         if (src_size >= size)                    \
  90.             php_str_len = size - 1;                \
  91.         else                                    \
  92.             php_str_len = src_size;                \
  93.         memcpy(dst, src, php_str_len);            \
  94.         dst[php_str_len] = '\0';                \
  95.     }
  96.  
  97. #ifndef HAVE_STRLCPY
  98. PHPAPI size_t strlcpy(char *dst, const char *src, size_t siz);
  99. #endif
  100.  
  101. #ifndef HAVE_STRLCAT
  102. PHPAPI size_t strlcat(char *dst, const char *src, size_t siz);
  103. #endif
  104.  
  105. #ifndef HAVE_STRTOK_R
  106. char *strtok_r(char *s, const char *delim, char **last);
  107. #endif
  108.  
  109. #ifndef HAVE_SOCKLEN_T
  110. typedef unsigned int socklen_t;
  111. #endif
  112.  
  113. #define CREATE_MUTEX(a,b)
  114. #define SET_MUTEX(a)
  115. #define FREE_MUTEX(a)
  116.  
  117. /*
  118.  * Then the ODBC support can use both iodbc and Solid,
  119.  * uncomment this.
  120.  * #define HAVE_ODBC (HAVE_IODBC|HAVE_SOLID)
  121.  */
  122.  
  123. #include <stdlib.h>
  124. #include <ctype.h>
  125. #if HAVE_UNISTD_H
  126. #include <unistd.h>
  127. #endif
  128. #if HAVE_STDARG_H
  129. #include <stdarg.h>
  130. #else   
  131. # if HAVE_SYS_VARARGS_H
  132. # include <sys/varargs.h>
  133. # endif 
  134. #endif 
  135.  
  136.  
  137. #include "zend_hash.h"
  138. #include "php3_compat.h"
  139. #include "zend_alloc.h"
  140. #include "zend_stack.h"
  141.  
  142. #if STDC_HEADERS
  143. # include <string.h>
  144. #else
  145. # ifndef HAVE_MEMCPY
  146. #  define memcpy(d, s, n)    bcopy((s), (d), (n))
  147. # endif
  148. # ifndef HAVE_MEMMOVE
  149. #  define memmove(d, s, n)    bcopy ((s), (d), (n))
  150. # endif
  151. #endif
  152.  
  153. #include "safe_mode.h"
  154.  
  155. #ifndef HAVE_STRERROR
  156. char *strerror(int);
  157. #endif
  158.  
  159. #include "fopen_wrappers.h"
  160.  
  161. #if (REGEX == 1 || REGEX == 0) && !defined(NO_REGEX_EXTRA_H)
  162. #include "regex/regex_extra.h"
  163. #endif
  164.  
  165. #if HAVE_PWD_H
  166. # ifdef PHP_WIN32
  167. #include "win32/pwd.h"
  168. #include "win32/param.h"
  169. # else
  170. #include <pwd.h>
  171. #include <sys/param.h>
  172. # endif
  173. #endif
  174.  
  175. #if HAVE_LIMITS_H
  176. #include <limits.h>
  177. #endif
  178.  
  179. #ifndef LONG_MAX
  180. #define LONG_MAX 2147483647L
  181. #endif
  182.  
  183. #ifndef LONG_MIN
  184. #define LONG_MIN (- LONG_MAX - 1)
  185. #endif
  186.  
  187. #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) || defined(BROKEN_SPRINTF)
  188. #include "snprintf.h"
  189. #endif
  190.  
  191. #define EXEC_INPUT_BUF 4096
  192.  
  193. #define PHP_MIME_TYPE "application/x-httpd-php"
  194.  
  195. /* macros */
  196. #define STR_PRINT(str)    ((str)?(str):"")
  197.  
  198. #ifndef MAXPATHLEN
  199. # ifdef PATH_MAX
  200. #  define MAXPATHLEN PATH_MAX
  201. # else
  202. #  define MAXPATHLEN 256    /* Should be safe for any weird systems that do not define it */
  203. # endif
  204. #endif
  205.  
  206. #define PHP_FN(name) php_if_##name
  207. #define PHP_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
  208. #define PHP_FUNCTION(name) PHP_NAMED_FUNCTION(PHP_FN(name))
  209.  
  210. #define PHP_NAMED_FE(php_name, name, arg_types) { #php_name, name, arg_types },
  211. #define PHP_FE(name, arg_types) PHP_NAMED_FE(name, PHP_FN(name), arg_types)
  212. #define PHP_FALIAS(name, alias, arg_types) PHP_NAMED_FE(name, PHP_FN(alias), arg_types)
  213. #define PHP_STATIC_FE(php_name, func_name, arg_types) { php_name, func_name, arg_types },
  214.  
  215. #define PHP_MINIT(module)    php_minit_##module
  216. #define PHP_MSHUTDOWN(module)    php_mshutdown_##module
  217. #define PHP_RINIT(module)    php_rinit_##module
  218. #define PHP_RSHUTDOWN(module)    php_rshutdown_##module
  219. #define PHP_MINFO(module)    php_info_##module
  220. #define PHP_GINIT(module)    php_ginit_##module
  221. #define PHP_GSHUTDOWN(module)    php_gshutdown_##module
  222.  
  223. #define PHP_MINIT_FUNCTION(module)    int PHP_MINIT(module)(INIT_FUNC_ARGS)
  224. #define PHP_MSHUTDOWN_FUNCTION(module)    int PHP_MSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS)
  225. #define PHP_RINIT_FUNCTION(module)    int PHP_RINIT(module)(INIT_FUNC_ARGS)
  226. #define PHP_RSHUTDOWN_FUNCTION(module)    int PHP_RSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS)
  227. #define PHP_MINFO_FUNCTION(module)    void PHP_MINFO(module)(ZEND_MODULE_INFO_FUNC_ARGS)
  228. #define PHP_GINIT_FUNCTION(module)    int PHP_GINIT(module)(GINIT_FUNC_ARGS)
  229. #define PHP_GSHUTDOWN_FUNCTION(module)    int PHP_GSHUTDOWN(module)(void)
  230.  
  231.  
  232. /* global variables */
  233. extern pval *data;
  234. #if !defined(PHP_WIN32)
  235. extern char **environ;
  236. #define php_sleep sleep
  237. #endif
  238.  
  239. void phperror(char *error);
  240. PHPAPI int php_write(void *buf, uint size);
  241. PHPAPI int php_printf(const char *format, ...);
  242. void php_log_err(char *log_message);
  243. int Debug(char *format, ...);
  244. int cfgparse(void);
  245.  
  246. #define php_error zend_error
  247.  
  248. #define zenderror phperror
  249. #define zendlex phplex
  250.  
  251. #define phpparse zendparse
  252. #define phprestart zendrestart
  253. #define phpin zendin
  254.  
  255. /* functions */
  256. int php_startup_internal_extensions(void);
  257. int php_global_startup_internal_extensions(void);
  258. int php_global_shutdown_internal_extensions(void);
  259.  
  260. int php_mergesort(void *base, size_t nmemb, register size_t size, int (*cmp) (const void *, const void *));
  261.  
  262. PHPAPI void php_register_pre_request_shutdown(void (*func)(void *), void *userdata);
  263.  
  264. PHPAPI int cfg_get_long(char *varname, long *result);
  265. PHPAPI int cfg_get_double(char *varname, double *result);
  266. PHPAPI int cfg_get_string(char *varname, char **result);
  267.  
  268.  
  269. /* Output support */
  270. #include "ext/standard/php_output.h"
  271. #define PHPWRITE(str, str_len)        php_body_write((str), (str_len))
  272. #define PUTS(str)                    php_body_write((str), strlen((str)))
  273. #define PUTC(c)                        (php_body_write(&(c), 1), (c))
  274. #define PHPWRITE_H(str, str_len)    php_header_write((str), (str_len))
  275. #define PUTS_H(str)                    php_header_write((str), strlen((str)))
  276. #define PUTC_H(c)                    (php_header_write(&(c), 1), (c))
  277.  
  278. #ifdef ZTS
  279. #define VIRTUAL_DIR
  280. #endif
  281.  
  282. /* Virtual current working directory support */
  283. #include "tsrm_virtual_cwd.h"
  284.  
  285. #include "zend_constants.h"
  286.  
  287. /* connection status states */
  288. #define PHP_CONNECTION_NORMAL  0
  289. #define PHP_CONNECTION_ABORTED 1
  290. #define PHP_CONNECTION_TIMEOUT 2
  291.  
  292. #include "php_reentrancy.h"
  293.  
  294. /* Finding offsets of elements within structures.
  295.  * Taken from the Apache code, which in turn, was taken from X code...
  296.  */
  297.  
  298. #if defined(CRAY) || (defined(__arm) && !defined(LINUX))
  299. #ifdef __STDC__
  300. #define XtOffset(p_type,field) _Offsetof(p_type,field)
  301. #else
  302. #ifdef CRAY2
  303. #define XtOffset(p_type,field) \
  304.     (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
  305.  
  306. #else /* !CRAY2 */
  307.  
  308. #define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
  309.  
  310. #endif /* !CRAY2 */  
  311. #endif /* __STDC__ */
  312. #else /* ! (CRAY || __arm) */
  313.  
  314. #define XtOffset(p_type,field) \
  315.     ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
  316.  
  317. #endif /* !CRAY */
  318.  
  319. #ifdef offsetof
  320. #define XtOffsetOf(s_type,field) offsetof(s_type,field)
  321. #else
  322. #define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
  323. #endif
  324.  
  325. PHPAPI PHP_FUNCTION(warn_not_available);
  326.  
  327. #endif
  328.  
  329. /*
  330.  * Local variables:
  331.  * tab-width: 4
  332.  * c-basic-offset: 4
  333.  * End:
  334.  */
  335.