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.

379 lines
9.3 KiB

27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP version 4.0 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997, 1998, 1999 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 2.0 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_0.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. #define CGI_BINARY (!APACHE && !USE_SAPI && !FHTTPD)
  28. #include "php_version.h"
  29. #include "zend.h"
  30. /* automake defines PACKAGE and VERSION for Zend too */
  31. #ifdef PACKAGE
  32. # undef PACKAGE
  33. #endif
  34. #ifdef VERSION
  35. # undef VERSION
  36. #endif
  37. #include "zend_API.h"
  38. extern unsigned char first_arg_force_ref[];
  39. extern unsigned char first_arg_allow_ref[];
  40. extern unsigned char second_arg_force_ref[];
  41. extern unsigned char second_arg_allow_ref[];
  42. /* somebody stealing BOOL from windows. pick something else!
  43. #ifndef BOOL
  44. #define BOOL MYBOOL
  45. #endif
  46. */
  47. #if WIN32
  48. #include "config.w32.h"
  49. #include "win95nt.h"
  50. # ifdef PHP_EXPORTS
  51. # define PHPAPI __declspec(dllexport)
  52. # else
  53. # define PHPAPI __declspec(dllimport)
  54. # endif
  55. #else
  56. #include "php_config.h"
  57. #define PHPAPI
  58. #define THREAD_LS
  59. #endif
  60. /* PHP's DEBUG value must match Zend's ZEND_DEBUG value */
  61. #undef DEBUG
  62. #define DEBUG ZEND_DEBUG
  63. #if DEBUG || !(defined(__GNUC__)||defined(WIN32))
  64. #ifdef inline
  65. #undef inline
  66. #endif
  67. #define inline
  68. #endif
  69. #if HAVE_UNIX_H
  70. #include <unix.h>
  71. #endif
  72. #if HAVE_ALLOCA_H
  73. #include <alloca.h>
  74. #endif
  75. #ifndef HAVE_STRLCPY
  76. size_t strlcpy(char *dst, const char *src, size_t siz);
  77. #endif
  78. #ifndef HAVE_STRLCAT
  79. size_t strlcat(char *dst, const char *src, size_t siz);
  80. #endif
  81. #include "request_info.h"
  82. #if HAVE_LIBDL
  83. # if MSVC5
  84. # include <windows.h>
  85. # define dlclose FreeLibrary
  86. # define dlopen(a,b) LoadLibrary(a)
  87. # define dlsym GetProcAddress
  88. # else
  89. #if HAVE_DLFCN_H && !((defined(_AIX) || defined(AIX)) && APACHE)
  90. # include <dlfcn.h>
  91. #endif
  92. # endif
  93. #endif
  94. #define CREATE_MUTEX(a,b)
  95. #define SET_MUTEX(a)
  96. #define FREE_MUTEX(a)
  97. /*
  98. * Then the ODBC support can use both iodbc and Solid,
  99. * uncomment this.
  100. * #define HAVE_ODBC (HAVE_IODBC|HAVE_SOLID)
  101. */
  102. #include <stdlib.h>
  103. #include <ctype.h>
  104. #if HAVE_UNISTD_H
  105. #include <unistd.h>
  106. #endif
  107. #if HAVE_STDARG_H
  108. #include <stdarg.h>
  109. #else
  110. # if HAVE_SYS_VARARGS_H
  111. # include <sys/varargs.h>
  112. # endif
  113. #endif
  114. #include "zend_hash.h"
  115. #include "php3_compat.h"
  116. #include "zend_alloc.h"
  117. #include "zend_stack.h"
  118. typedef zval pval;
  119. #define pval_copy_constructor zval_copy_ctor
  120. #define pval_destructor zval_dtor
  121. #if STDC_HEADERS
  122. # include <string.h>
  123. #else
  124. # ifndef HAVE_MEMCPY
  125. # define memcpy(d, s, n) bcopy((s), (d), (n))
  126. # define memmove(d, s, n) bcopy ((s), (d), (n))
  127. # endif
  128. #endif
  129. #include "safe_mode.h"
  130. #ifndef HAVE_STRERROR
  131. extern char *strerror(int);
  132. #endif
  133. #include "fopen-wrappers.h"
  134. #if APACHE /* apache httpd */
  135. # if HAVE_AP_CONFIG_H
  136. #include "ap_config_auto.h"
  137. #ifdef RHAPSODY
  138. #undef HAVE_SNPRINTF
  139. #endif
  140. #include "ap_config.h"
  141. #ifdef RHAPSODY
  142. #undef HAVE_SNPRINTF
  143. #define HAVE_SNPRINTF 1
  144. #endif
  145. # endif
  146. # if HAVE_OLD_COMPAT_H
  147. #include "compat.h"
  148. # endif
  149. # if HAVE_AP_COMPAT_H
  150. #include "ap_compat.h"
  151. # endif
  152. #include "httpd.h"
  153. #include "http_main.h"
  154. #include "http_core.h"
  155. #include "http_request.h"
  156. #include "http_protocol.h"
  157. #include "http_config.h"
  158. #include "http_log.h"
  159. #define BLOCK_INTERRUPTIONS block_alarms
  160. #define UNBLOCK_INTERRUPTIONS unblock_alarms
  161. #endif
  162. #if HAVE_PWD_H
  163. # if WIN32||WINNT
  164. #include "win32/pwd.h"
  165. #include "win32/param.h"
  166. # else
  167. #include <pwd.h>
  168. #include <sys/param.h>
  169. # endif
  170. #endif
  171. #if CGI_BINARY /* CGI version */
  172. #define BLOCK_INTERRUPTIONS NULL
  173. #define UNBLOCK_INTERRUPTIONS NULL
  174. #endif
  175. #if HAVE_LIMITS_H
  176. #include <limits.h>
  177. #endif
  178. #ifndef LONG_MAX
  179. #define LONG_MAX 2147483647L
  180. #endif
  181. #ifndef LONG_MIN
  182. #define LONG_MIN (- LONG_MAX - 1)
  183. #endif
  184. #if (!HAVE_SNPRINTF)
  185. #define snprintf ap_snprintf
  186. #define vsnprintf ap_vsnprintf
  187. extern int ap_snprintf(char *, size_t, const char *, ...);
  188. extern int ap_vsnprintf(char *, size_t, const char *, va_list);
  189. #endif
  190. #define EXEC_INPUT_BUF 4096
  191. #define DONT_FREE 0
  192. #define DO_FREE 1
  193. #define PHP3_MIME_TYPE "application/x-httpd-php3"
  194. /* macros */
  195. #undef MIN
  196. #undef MAX
  197. #undef COPY_STRING
  198. #define DO_OR_DIE(retvalue) if (retvalue==FAILURE) { return FAILURE; }
  199. #define MAX(a,b) (((a)>(b))?(a):(b))
  200. #define MIN(a,b) (((a)<(b))?(a):(b))
  201. #define STR_FREE(ptr) if (ptr && ptr!=empty_string && ptr!=undefined_variable_string) { efree(ptr); }
  202. #define COPY_STRING(yy) (yy).value.str.val = (char *) estrndup((yy).value.str.val,(yy).value.str.len)
  203. #define STR_PRINT(str) ((str)?(str):"")
  204. #ifndef MAXPATHLEN
  205. #define MAXPATHLEN 256 /* Should be safe for any weird systems that do not define it */
  206. #endif
  207. #define PHP_FN(name) php3_##name
  208. #define PHP_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
  209. #define PHP_FUNCTION(name) PHP_NAMED_FUNCTION(php3_##name)
  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, php3_##name, arg_types)
  212. #define PHP_FALIAS(name, alias, arg_types) PHP_NAMED_FE(name, php3_##alias, arg_types)
  213. #define PHP_MINIT(module) php3_minit_##module
  214. #define PHP_MSHUTDOWN(module) php3_mshutdown_##module
  215. #define PHP_RINIT(module) php3_rinit_##module
  216. #define PHP_RSHUTDOWN(module) php3_rshutdown_##module
  217. #define PHP_MINFO(module) php3_info_##module
  218. #define PHP_GINIT(module) php3_ginit_##module
  219. #define PHP_GSHUTDOWN(module) php3_gshutdown_##module
  220. #define PHP_MINIT_FUNCTION(module) int PHP_MINIT(module)(INIT_FUNC_ARGS)
  221. #define PHP_MSHUTDOWN_FUNCTION(module) int PHP_MSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS)
  222. #define PHP_RINIT_FUNCTION(module) int PHP_RINIT(module)(INIT_FUNC_ARGS)
  223. #define PHP_RSHUTDOWN_FUNCTION(module) int PHP_RSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS)
  224. #define PHP_MINFO_FUNCTION(module) void PHP_MINFO(module)(ZEND_MODULE_INFO_FUNC_ARGS)
  225. #define PHP_GINIT_FUNCTION(module) static int PHP_GINIT(module)(void)
  226. #define PHP_GSHUTDOWN_FUNCTION(module) static int PHP_GSHUTDOWN(module)(void)
  227. /* global variables */
  228. extern pval *data;
  229. #if !(WIN32||WINNT)
  230. extern char **environ;
  231. #endif
  232. extern void phperror(char *error);
  233. extern PHPAPI void php_error(int type, const char *format,...);
  234. extern PHPAPI int php3_write(void *buf, int size);
  235. extern PHPAPI int php_printf(const char *format,...);
  236. extern void php3_log_err(char *log_message);
  237. extern int Debug(char *format,...);
  238. extern int cfgparse(void);
  239. extern void html_putc(char c);
  240. #define zenderror phperror
  241. #define zendlex phplex
  242. #define phpparse zendparse
  243. #define phprestart zendrestart
  244. #define phpin zendin
  245. /* functions */
  246. int module_startup_modules(void);
  247. int module_global_startup_modules(void);
  248. int module_global_shutdown_modules(void);
  249. /* needed for modules only */
  250. extern PHPAPI int php3i_get_le_fp(void);
  251. /*from basic functions*/
  252. extern PHPAPI int _php_error_log(int opt_err,char *message,char *opt,char *headers);
  253. PHPAPI int cfg_get_long(char *varname, long *result);
  254. PHPAPI int cfg_get_double(char *varname, double *result);
  255. PHPAPI int cfg_get_string(char *varname, char **result);
  256. /* Output support */
  257. #include "output.h"
  258. #define PHPWRITE(str, str_len) php_body_write((str), (str_len))
  259. #define PUTS(str) php_body_write((str), strlen((str)))
  260. #define PUTC(c) (php_body_write(&(c), 1), (c))
  261. #define PHPWRITE_H(str, str_len) php_header_write((str), (str_len))
  262. #define PUTS_H(str) php_header_write((str), strlen((str)))
  263. #define PUTC_H(c) (php_header_write(&(c), 1), (c))
  264. #include "zend_operators.h"
  265. #include "zend_variables.h"
  266. #include "zend_constants.h"
  267. /* connection status states */
  268. #define PHP_CONNECTION_NORMAL 0
  269. #define PHP_CONNECTION_ABORTED 1
  270. #define PHP_CONNECTION_TIMEOUT 2
  271. /* Finding offsets of elements within structures.
  272. * Taken from the Apache code, which in turn, was taken from X code...
  273. */
  274. #if defined(CRAY) || (defined(__arm) && !defined(LINUX))
  275. #ifdef __STDC__
  276. #define XtOffset(p_type,field) _Offsetof(p_type,field)
  277. #else
  278. #ifdef CRAY2
  279. #define XtOffset(p_type,field) \
  280. (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
  281. #else /* !CRAY2 */
  282. #define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
  283. #endif /* !CRAY2 */
  284. #endif /* __STDC__ */
  285. #else /* ! (CRAY || __arm) */
  286. #define XtOffset(p_type,field) \
  287. ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
  288. #endif /* !CRAY */
  289. #ifdef offsetof
  290. #define XtOffsetOf(s_type,field) offsetof(s_type,field)
  291. #else
  292. #define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
  293. #endif
  294. #endif
  295. /*
  296. * Local variables:
  297. * tab-width: 4
  298. * c-basic-offset: 4
  299. * End:
  300. */