home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 15 / AACD15.ISO / AACD / Magazine / HomeAutomation / Apache / include / php / main / php.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-24  |  10.0 KB  |  385 lines

  1. /* 
  2.    +----------------------------------------------------------------------+
  3.    | PHP version 4.0                                                      |
  4.    +----------------------------------------------------------------------+
  5.    | Copyright (c) 1997, 1998, 1999, 2000 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.106 2000/06/24 16:10:18 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 19990421
  30.  
  31. #define YYDEBUG 0
  32.  
  33. #include "php_version.h"
  34. #include "zend.h"
  35. #include "php_compat.h"
  36.  
  37. /* automake defines PACKAGE and VERSION for Zend too */
  38. #undef PACKAGE
  39. #undef VERSION
  40.  
  41. #include "zend_API.h"
  42.  
  43. #if PHP_BROKEN_SPRINTF
  44. #undef sprintf
  45. #define sprintf php_sprintf
  46. #endif
  47.  
  48. extern unsigned char first_arg_force_ref[];   
  49. extern unsigned char first_arg_allow_ref[];
  50. extern unsigned char second_arg_force_ref[];
  51. extern unsigned char second_arg_allow_ref[];
  52.  
  53.  
  54. /* somebody stealing BOOL from windows.  pick something else!
  55. #ifndef BOOL
  56. #define BOOL MYBOOL
  57. #endif
  58. */
  59.  
  60.  
  61. #ifdef PHP_WIN32
  62. #include "win95nt.h"
  63. #    ifdef PHP_EXPORTS
  64. #    define PHPAPI __declspec(dllexport) 
  65. #    else
  66. #    define PHPAPI __declspec(dllimport) 
  67. #    endif
  68. #else
  69. #define PHPAPI
  70. #define THREAD_LS
  71. #endif
  72.  
  73. #include "php_regex.h"
  74.  
  75. /* PHP's DEBUG value must match Zend's ZEND_DEBUG value */
  76. #undef PHP_DEBUG
  77. #define PHP_DEBUG ZEND_DEBUG
  78.  
  79.  
  80. #if PHP_DEBUG || !(defined(__GNUC__)||defined(PHP_WIN32))
  81. #ifdef inline
  82. #undef inline
  83. #endif
  84. #define inline
  85. #endif
  86.  
  87. #define APACHE 0
  88. #define CGI_BINARY 0
  89.  
  90. #if HAVE_UNIX_H
  91. #include <unix.h>
  92. #endif
  93.  
  94. #if HAVE_ALLOCA_H
  95. #include <alloca.h>
  96. #endif
  97.  
  98. #ifndef HAVE_STRLCPY
  99. PHPAPI size_t strlcpy(char *dst, const char *src, size_t siz);
  100. #endif
  101.  
  102. #ifndef HAVE_STRLCAT
  103. PHPAPI size_t strlcat(char *dst, const char *src, size_t siz);
  104. #endif
  105.  
  106. #ifndef HAVE_STRTOK_R
  107. char *strtok_r(char *s, const char *delim, char **last);
  108. #endif
  109.  
  110. #ifndef HAVE_SOCKLEN_T
  111. typedef unsigned int socklen_t;
  112. #endif
  113.  
  114. #define CREATE_MUTEX(a,b)
  115. #define SET_MUTEX(a)
  116. #define FREE_MUTEX(a)
  117.  
  118. /*
  119.  * Then the ODBC support can use both iodbc and Solid,
  120.  * uncomment this.
  121.  * #define HAVE_ODBC (HAVE_IODBC|HAVE_SOLID)
  122.  */
  123.  
  124. #include <stdlib.h>
  125. #include <ctype.h>
  126. #if HAVE_UNISTD_H
  127. #include <unistd.h>
  128. #endif
  129. #if HAVE_STDARG_H
  130. #include <stdarg.h>
  131. #else   
  132. # if HAVE_SYS_VARARGS_H
  133. # include <sys/varargs.h>
  134. # endif 
  135. #endif 
  136.  
  137.  
  138. #include "zend_hash.h"
  139. #include "php3_compat.h"
  140. #include "zend_alloc.h"
  141. #include "zend_stack.h"
  142.  
  143. typedef zval pval;
  144.  
  145. #define pval_copy_constructor    zval_copy_ctor
  146. #define pval_destructor            zval_dtor
  147.  
  148. #if STDC_HEADERS
  149. # include <string.h>
  150. #else
  151. # ifndef HAVE_MEMCPY
  152. #  define memcpy(d, s, n)    bcopy((s), (d), (n))
  153. #  define memmove(d, s, n)    bcopy ((s), (d), (n))
  154. # endif
  155. #endif
  156.  
  157. #include "safe_mode.h"
  158.  
  159. #ifndef HAVE_STRERROR
  160. extern char *strerror(int);
  161. #endif
  162.  
  163. #include "fopen-wrappers.h"
  164.  
  165. #if (REGEX == 1 || REGEX == 0) && !defined(NO_REGEX_EXTRA_H)
  166. #include "regex/regex_extra.h"
  167. #endif
  168.  
  169. #if HAVE_PWD_H
  170. # ifdef PHP_WIN32
  171. #include "win32/pwd.h"
  172. #include "win32/param.h"
  173. # else
  174. #include <pwd.h>
  175. #include <sys/param.h>
  176. # endif
  177. #endif
  178.  
  179. #if HAVE_LIMITS_H
  180. #include <limits.h>
  181. #endif
  182.  
  183. #ifndef LONG_MAX
  184. #define LONG_MAX 2147483647L
  185. #endif
  186.  
  187. #ifndef LONG_MIN
  188. #define LONG_MIN (- LONG_MAX - 1)
  189. #endif
  190.  
  191. #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) || defined(BROKEN_SPRINTF)
  192. #include "snprintf.h"
  193. #endif
  194.  
  195. #define EXEC_INPUT_BUF 4096
  196.  
  197.  
  198. #define DONT_FREE 0
  199. #define DO_FREE 1
  200.  
  201. #define PHP_MIME_TYPE "application/x-httpd-php"
  202.  
  203. /* macros */
  204. #undef COPY_STRING
  205. #define COPY_STRING(yy)   (yy).value.str.val = (char *) estrndup((yy).value.str.val,(yy).value.str.len)
  206. #define STR_PRINT(str)    ((str)?(str):"")
  207.  
  208. #ifndef MAXPATHLEN
  209. #define MAXPATHLEN 256    /* Should be safe for any weird systems that do not define it */
  210. #endif
  211.  
  212. #define PHP_FN(name) php_if_##name
  213. #define PHP_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
  214. #define PHP_FUNCTION(name) PHP_NAMED_FUNCTION(PHP_FN(name))
  215.  
  216. #define PHP_NAMED_FE(php_name, name, arg_types) { #php_name, name, arg_types },
  217. #define PHP_FE(name, arg_types) PHP_NAMED_FE(name, PHP_FN(name), arg_types)
  218. #define PHP_FALIAS(name, alias, arg_types) PHP_NAMED_FE(name, PHP_FN(alias), arg_types)
  219.  
  220. #define PHP_MINIT(module)    php_minit_##module
  221. #define PHP_MSHUTDOWN(module)    php_mshutdown_##module
  222. #define PHP_RINIT(module)    php_rinit_##module
  223. #define PHP_RSHUTDOWN(module)    php_rshutdown_##module
  224. #define PHP_MINFO(module)    php_info_##module
  225. #define PHP_GINIT(module)    php_ginit_##module
  226. #define PHP_GSHUTDOWN(module)    php_gshutdown_##module
  227.  
  228. #define PHP_MINIT_FUNCTION(module)    int PHP_MINIT(module)(INIT_FUNC_ARGS)
  229. #define PHP_MSHUTDOWN_FUNCTION(module)    int PHP_MSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS)
  230. #define PHP_RINIT_FUNCTION(module)    int PHP_RINIT(module)(INIT_FUNC_ARGS)
  231. #define PHP_RSHUTDOWN_FUNCTION(module)    int PHP_RSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS)
  232. #define PHP_MINFO_FUNCTION(module)    void PHP_MINFO(module)(ZEND_MODULE_INFO_FUNC_ARGS)
  233. #define PHP_GINIT_FUNCTION(module)    int PHP_GINIT(module)(GINIT_FUNC_ARGS)
  234. #define PHP_GSHUTDOWN_FUNCTION(module)    int PHP_GSHUTDOWN(module)(void)
  235.  
  236.  
  237. /* global variables */
  238. extern pval *data;
  239. #if !defined(PHP_WIN32)
  240. extern char **environ;
  241. #define php_sleep sleep
  242. #endif
  243.  
  244. extern void phperror(char *error);
  245. extern PHPAPI int php_write(void *buf, int size);
  246. extern PHPAPI int php_printf(const char *format, ...);
  247. extern void php_log_err(char *log_message);
  248. extern int Debug(char *format, ...);
  249. extern int cfgparse(void);
  250.  
  251. #define php_error zend_error
  252.  
  253.  
  254. #define zenderror phperror
  255. #define zendlex phplex
  256.  
  257. #define phpparse zendparse
  258. #define phprestart zendrestart
  259. #define phpin zendin
  260.  
  261. /* functions */
  262. int php_startup_internal_extensions(void);
  263. int php_global_startup_internal_extensions(void);
  264. int php_global_shutdown_internal_extensions(void);
  265.  
  266. int mergesort(void *base, size_t nmemb, register size_t size, int (*cmp) (const void *, const void *));
  267.  
  268. /*from basic functions*/
  269. extern PHPAPI int _php_error_log(int opt_err,char *message,char *opt,char *headers);
  270.  
  271. PHPAPI void php_register_pre_request_shutdown(void (*func)(void *), void *userdata);
  272.  
  273. PHPAPI int cfg_get_long(char *varname, long *result);
  274. PHPAPI int cfg_get_double(char *varname, double *result);
  275. PHPAPI int cfg_get_string(char *varname, char **result);
  276.  
  277.  
  278. /* Output support */
  279. #include "ext/standard/php_output.h"
  280. #define PHPWRITE(str, str_len)        php_body_write((str), (str_len))
  281. #define PUTS(str)                    php_body_write((str), strlen((str)))
  282. #define PUTC(c)                        (php_body_write(&(c), 1), (c))
  283. #define PHPWRITE_H(str, str_len)    php_header_write((str), (str_len))
  284. #define PUTS_H(str)                    php_header_write((str), strlen((str)))
  285. #define PUTC_H(c)                    (php_header_write(&(c), 1), (c))
  286.  
  287. #ifdef ZTS
  288. #define VIRTUAL_DIR
  289. #endif
  290.  
  291. #include "php_virtual_cwd.h"
  292.  
  293. /* Virtual current directory support */
  294. #ifdef VIRTUAL_DIR
  295.  
  296. #define V_GETCWD(buff, size) virtual_getcwd(buff,size)
  297. #define V_FOPEN(path, mode) virtual_fopen(path, mode)
  298. /* The V_OPEN macro will need to be used as V_OPEN((path, flags, ...)) */
  299. #define V_OPEN(open_args) virtual_open open_args
  300. #define V_CREAT(path, mode) virtual_creat(path, mode)
  301. #define V_CHDIR(path) virtual_chdir(path)
  302. #define V_CHDIR_FILE(path) virtual_chdir_file(path)
  303. #define V_GETWD(buf)
  304. #define V_STAT(path, buff) virtual_stat(path, buff)
  305. #ifdef PHP_WIN32
  306. #define V_LSTAT(path, buff) virtual_stat(path, buff)
  307. #else
  308. #define V_LSTAT(path, buff) virtual_lstat(path, buff)
  309. #endif
  310. #define V_UNLINK(path) virtual_unlink(path)
  311. #define V_MKDIR(pathname, mode) virtual_mkdir(pathname, mode)
  312. #define V_RMDIR(pathname) virtual_rmdir(pathname)
  313. #define V_OPENDIR(pathname) virtual_opendir(pathname)
  314. #define V_POPEN(command, type) virtual_popen(command, type)
  315.  
  316. #else
  317.  
  318. #define V_GETCWD(buff, size) getcwd(buff,size)
  319. #define V_FOPEN(path, mode)  fopen(path, mode)
  320. #define V_OPEN(open_args) open open_args
  321. #define V_CREAT(path, mode) creat(path, mode)
  322. #define V_CHDIR(path) chdir(path)
  323. #define V_CHDIR_FILE(path) chdir_file(path)
  324. #define V_GETWD(buf) getwd(buf)
  325. #define V_STAT(path, buff) stat(path, buff)
  326. #define V_LSTAT(path, buff) lstat(path, buff)
  327. #define V_UNLINK(path) unlink(path)
  328. #define V_MKDIR(pathname, mode) mkdir(pathname, mode)
  329. #define V_RMDIR(pathname) rmdir(pathname)
  330. #define V_OPENDIR(pathname) opendir(pathname)
  331. #define V_POPEN(command, type) popen(command, type)
  332.  
  333. #endif
  334.  
  335. #include "zend_constants.h"
  336.  
  337. /* connection status states */
  338. #define PHP_CONNECTION_NORMAL  0
  339. #define PHP_CONNECTION_ABORTED 1
  340. #define PHP_CONNECTION_TIMEOUT 2
  341.  
  342. #include "php_reentrancy.h"
  343.  
  344. /* Finding offsets of elements within structures.
  345.  * Taken from the Apache code, which in turn, was taken from X code...
  346.  */
  347.  
  348. #if defined(CRAY) || (defined(__arm) && !defined(LINUX))
  349. #ifdef __STDC__
  350. #define XtOffset(p_type,field) _Offsetof(p_type,field)
  351. #else
  352. #ifdef CRAY2
  353. #define XtOffset(p_type,field) \
  354.     (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
  355.  
  356. #else /* !CRAY2 */
  357.  
  358. #define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
  359.  
  360. #endif /* !CRAY2 */  
  361. #endif /* __STDC__ */
  362. #else /* ! (CRAY || __arm) */
  363.  
  364. #define XtOffset(p_type,field) \
  365.     ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
  366.  
  367. #endif /* !CRAY */
  368.  
  369. #ifdef offsetof
  370. #define XtOffsetOf(s_type,field) offsetof(s_type,field)
  371. #else
  372. #define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
  373. #endif
  374.  
  375. PHP_FUNCTION(warn_not_available);
  376.  
  377. #endif
  378.  
  379. /*
  380.  * Local variables:
  381.  * tab-width: 4
  382.  * c-basic-offset: 4
  383.  * End:
  384.  */
  385.