You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

339 lines
8.6 KiB

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