root/main/php.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. BEGIN_EXTERN_C
  2. php_std_error_handling

   1 /*
   2    +----------------------------------------------------------------------+
   3    | PHP Version 5                                                        |
   4    +----------------------------------------------------------------------+
   5    | Copyright (c) 1997-2016 The PHP Group                                |
   6    +----------------------------------------------------------------------+
   7    | This source file is subject to version 3.01 of the PHP license,      |
   8    | that is bundled with this package in the file LICENSE, and is        |
   9    | available through the world-wide-web at the following url:           |
  10    | http://www.php.net/license/3_01.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$ */
  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 20131106
  30 #define PHP_HAVE_STREAMS
  31 #define YYDEBUG 0
  32 #define PHP_DEFAULT_CHARSET "UTF-8"
  33 
  34 #include "php_version.h"
  35 #include "zend.h"
  36 #include "zend_qsort.h"
  37 #include "php_compat.h"
  38 
  39 #include "zend_API.h"
  40 
  41 #undef sprintf
  42 #define sprintf php_sprintf
  43 
  44 /* PHP's DEBUG value must match Zend's ZEND_DEBUG value */
  45 #undef PHP_DEBUG
  46 #define PHP_DEBUG ZEND_DEBUG
  47 
  48 #ifdef PHP_WIN32
  49 #       include "tsrm_win32.h"
  50 #       include "win95nt.h"
  51 #       ifdef PHP_EXPORTS
  52 #               define PHPAPI __declspec(dllexport)
  53 #       else
  54 #               define PHPAPI __declspec(dllimport)
  55 #       endif
  56 #       define PHP_DIR_SEPARATOR '\\'
  57 #       define PHP_EOL "\r\n"
  58 #else
  59 #       if defined(__GNUC__) && __GNUC__ >= 4
  60 #               define PHPAPI __attribute__ ((visibility("default")))
  61 #       else
  62 #               define PHPAPI
  63 #       endif
  64 #       define THREAD_LS
  65 #       define PHP_DIR_SEPARATOR '/'
  66 #       define PHP_EOL "\n"
  67 #endif
  68 
  69 #ifdef NETWARE
  70 /* For php_get_uname() function */
  71 #define PHP_UNAME  "NetWare"
  72 #define PHP_OS      PHP_UNAME
  73 #endif
  74 
  75 #if HAVE_ASSERT_H
  76 #if PHP_DEBUG
  77 #undef NDEBUG
  78 #else
  79 #ifndef NDEBUG
  80 #define NDEBUG
  81 #endif
  82 #endif
  83 #include <assert.h>
  84 #else /* HAVE_ASSERT_H */
  85 #define assert(expr) ((void) (0))
  86 #endif /* HAVE_ASSERT_H */
  87 
  88 #define APACHE 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 #if HAVE_BUILD_DEFS_H
  99 #include <build-defs.h>
 100 #endif
 101 
 102 /*
 103  * This is a fast version of strlcpy which should be used, if you
 104  * know the size of the destination buffer and if you know
 105  * the length of the source string.
 106  *
 107  * size is the allocated number of bytes of dst
 108  * src_size is the number of bytes excluding the NUL of src
 109  */
 110 
 111 #define PHP_STRLCPY(dst, src, size, src_size)   \
 112         {                                                                                       \
 113                 size_t php_str_len;                                             \
 114                                                                                                 \
 115                 if (src_size >= size)                                   \
 116                         php_str_len = size - 1;                         \
 117                 else                                                                    \
 118                         php_str_len = src_size;                         \
 119                 memcpy(dst, src, php_str_len);                  \
 120                 dst[php_str_len] = '\0';                                \
 121         }
 122 
 123 #ifndef HAVE_STRLCPY
 124 BEGIN_EXTERN_C()
 125 PHPAPI size_t php_strlcpy(char *dst, const char *src, size_t siz);
 126 END_EXTERN_C()
 127 #undef strlcpy
 128 #define strlcpy php_strlcpy
 129 #endif
 130 
 131 #ifndef HAVE_STRLCAT
 132 BEGIN_EXTERN_C()
 133 PHPAPI size_t php_strlcat(char *dst, const char *src, size_t siz);
 134 END_EXTERN_C()
 135 #undef strlcat
 136 #define strlcat php_strlcat
 137 #endif
 138 
 139 #ifndef HAVE_STRTOK_R
 140 BEGIN_EXTERN_C()
 141 char *strtok_r(char *s, const char *delim, char **last);
 142 END_EXTERN_C()
 143 #endif
 144 
 145 #ifndef HAVE_SOCKLEN_T
 146 # if PHP_WIN32
 147 typedef int socklen_t;
 148 # else
 149 typedef unsigned int socklen_t;
 150 # endif
 151 #endif
 152 
 153 #define CREATE_MUTEX(a, b)
 154 #define SET_MUTEX(a)
 155 #define FREE_MUTEX(a)
 156 
 157 /*
 158  * Then the ODBC support can use both iodbc and Solid,
 159  * uncomment this.
 160  * #define HAVE_ODBC (HAVE_IODBC|HAVE_SOLID)
 161  */
 162 
 163 #include <stdlib.h>
 164 #include <ctype.h>
 165 #if HAVE_UNISTD_H
 166 #include <unistd.h>
 167 #endif
 168 #if HAVE_STDARG_H
 169 #include <stdarg.h>
 170 #else
 171 # if HAVE_SYS_VARARGS_H
 172 # include <sys/varargs.h>
 173 # endif
 174 #endif
 175 
 176 #ifndef va_copy
 177 # ifdef __va_copy
 178 #  define va_copy(ap1, ap2)         __va_copy((ap1), (ap2))
 179 # else
 180 #  define va_copy(ap1, ap2)         memcpy((&ap1), (&ap2), sizeof(va_list))
 181 # endif
 182 #endif
 183 
 184 #include "php_stdint.h"
 185 
 186 #include "zend_hash.h"
 187 #include "zend_alloc.h"
 188 #include "zend_stack.h"
 189 
 190 #if STDC_HEADERS
 191 # include <string.h>
 192 #else
 193 # ifndef HAVE_MEMCPY
 194 #  define memcpy(d, s, n)       bcopy((s), (d), (n))
 195 # endif
 196 # ifndef HAVE_MEMMOVE
 197 #  define memmove(d, s, n)      bcopy ((s), (d), (n))
 198 # endif
 199 #endif
 200 
 201 #ifndef HAVE_STRERROR
 202 char *strerror(int);
 203 #endif
 204 
 205 #if HAVE_PWD_H
 206 # ifdef PHP_WIN32
 207 #include "win32/param.h"
 208 # else
 209 #include <pwd.h>
 210 #include <sys/param.h>
 211 # endif
 212 #endif
 213 
 214 #if HAVE_LIMITS_H
 215 #include <limits.h>
 216 #endif
 217 
 218 #ifndef LONG_MAX
 219 #define LONG_MAX 2147483647L
 220 #endif
 221 
 222 #ifndef LONG_MIN
 223 #define LONG_MIN (- LONG_MAX - 1)
 224 #endif
 225 
 226 #ifndef INT_MAX
 227 #define INT_MAX 2147483647
 228 #endif
 229 
 230 #ifndef INT_MIN
 231 #define INT_MIN (- INT_MAX - 1)
 232 #endif
 233 
 234 #define PHP_GCC_VERSION ZEND_GCC_VERSION
 235 #define PHP_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_MALLOC
 236 #define PHP_ATTRIBUTE_FORMAT ZEND_ATTRIBUTE_FORMAT
 237 
 238 BEGIN_EXTERN_C()
 239 #include "snprintf.h"
 240 END_EXTERN_C()
 241 #include "spprintf.h"
 242 
 243 #define EXEC_INPUT_BUF 4096
 244 
 245 #define PHP_MIME_TYPE "application/x-httpd-php"
 246 
 247 /* macros */
 248 #define STR_PRINT(str)  ((str)?(str):"")
 249 
 250 #ifndef MAXPATHLEN
 251 # ifdef PATH_MAX
 252 #  define MAXPATHLEN PATH_MAX
 253 # elif defined(MAX_PATH)
 254 #  define MAXPATHLEN MAX_PATH
 255 # else
 256 #  define MAXPATHLEN 256    /* Should be safe for any weird systems that do not define it */
 257 # endif
 258 #endif
 259 
 260 #if defined(__GNUC__) && __GNUC__ >= 4
 261 # define php_ignore_value(x) (({ __typeof__ (x) __x = (x); (void) __x; }))
 262 #else
 263 # define php_ignore_value(x) ((void) (x))
 264 #endif
 265 
 266 /* global variables */
 267 #if !defined(PHP_WIN32)
 268 #define PHP_SLEEP_NON_VOID
 269 #define php_sleep sleep
 270 extern char **environ;
 271 #endif  /* !defined(PHP_WIN32) */
 272 
 273 #ifdef PHP_PWRITE_64
 274 ssize_t pwrite(int, void *, size_t, off64_t);
 275 #endif
 276 
 277 #ifdef PHP_PREAD_64
 278 ssize_t pread(int, void *, size_t, off64_t);
 279 #endif
 280 
 281 BEGIN_EXTERN_C()
 282 void phperror(char *error);
 283 PHPAPI int php_write(void *buf, uint size TSRMLS_DC);
 284 PHPAPI int php_printf(const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1,
 285                 2);
 286 PHPAPI int php_get_module_initialized(void);
 287 PHPAPI void php_log_err(char *log_message TSRMLS_DC);
 288 int Debug(char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, 2);
 289 int cfgparse(void);
 290 END_EXTERN_C()
 291 
 292 #define php_error zend_error
 293 #define error_handling_t zend_error_handling_t
 294 
 295 BEGIN_EXTERN_C()
 296 static inline ZEND_ATTRIBUTE_DEPRECATED void php_set_error_handling(error_handling_t error_handling, zend_class_entry *exception_class TSRMLS_DC)
 297 {
 298         zend_replace_error_handling(error_handling, exception_class, NULL TSRMLS_CC);
 299 }
 300 static inline ZEND_ATTRIBUTE_DEPRECATED void php_std_error_handling() {}
 301 
 302 PHPAPI void php_verror(const char *docref, const char *params, int type, const char *format, va_list args TSRMLS_DC) PHP_ATTRIBUTE_FORMAT(printf, 4, 0);
 303 
 304 #ifdef ZTS
 305 #define PHP_ATTR_FMT_OFFSET 1
 306 #else
 307 #define PHP_ATTR_FMT_OFFSET 0
 308 #endif
 309 
 310 /* PHPAPI void php_error(int type, const char *format, ...); */
 311 PHPAPI void php_error_docref0(const char *docref TSRMLS_DC, int type, const char *format, ...)
 312         PHP_ATTRIBUTE_FORMAT(printf, PHP_ATTR_FMT_OFFSET + 3, PHP_ATTR_FMT_OFFSET + 4);
 313 PHPAPI void php_error_docref1(const char *docref TSRMLS_DC, const char *param1, int type, const char *format, ...)
 314         PHP_ATTRIBUTE_FORMAT(printf, PHP_ATTR_FMT_OFFSET + 4, PHP_ATTR_FMT_OFFSET + 5);
 315 PHPAPI void php_error_docref2(const char *docref TSRMLS_DC, const char *param1, const char *param2, int type, const char *format, ...)
 316         PHP_ATTRIBUTE_FORMAT(printf, PHP_ATTR_FMT_OFFSET + 5, PHP_ATTR_FMT_OFFSET + 6);
 317 #ifdef PHP_WIN32
 318 PHPAPI void php_win32_docref2_from_error(DWORD error, const char *param1, const char *param2 TSRMLS_DC);
 319 #endif
 320 END_EXTERN_C()
 321 
 322 #define php_error_docref php_error_docref0
 323 
 324 #define zenderror phperror
 325 #define zendlex phplex
 326 
 327 #define phpparse zendparse
 328 #define phprestart zendrestart
 329 #define phpin zendin
 330 
 331 #define php_memnstr zend_memnstr
 332 
 333 /* functions */
 334 BEGIN_EXTERN_C()
 335 PHPAPI extern int (*php_register_internal_extensions_func)(TSRMLS_D);
 336 PHPAPI int php_register_internal_extensions(TSRMLS_D);
 337 PHPAPI int php_mergesort(void *base, size_t nmemb, register size_t size, int (*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC);
 338 PHPAPI void php_register_pre_request_shutdown(void (*func)(void *), void *userdata);
 339 PHPAPI void php_com_initialize(TSRMLS_D);
 340 PHPAPI char *php_get_current_user(TSRMLS_D);
 341 END_EXTERN_C()
 342 
 343 /* PHP-named Zend macro wrappers */
 344 #define PHP_FN                                  ZEND_FN
 345 #define PHP_MN                                  ZEND_MN
 346 #define PHP_NAMED_FUNCTION              ZEND_NAMED_FUNCTION
 347 #define PHP_FUNCTION                    ZEND_FUNCTION
 348 #define PHP_METHOD                      ZEND_METHOD
 349 
 350 #define PHP_RAW_NAMED_FE ZEND_RAW_NAMED_FE
 351 #define PHP_NAMED_FE    ZEND_NAMED_FE
 352 #define PHP_FE                  ZEND_FE
 353 #define PHP_DEP_FE      ZEND_DEP_FE
 354 #define PHP_FALIAS              ZEND_FALIAS
 355 #define PHP_DEP_FALIAS  ZEND_DEP_FALIAS
 356 #define PHP_ME          ZEND_ME
 357 #define PHP_MALIAS      ZEND_MALIAS
 358 #define PHP_ABSTRACT_ME ZEND_ABSTRACT_ME
 359 #define PHP_ME_MAPPING  ZEND_ME_MAPPING
 360 #define PHP_FE_END      ZEND_FE_END
 361 
 362 #define PHP_MODULE_STARTUP_N    ZEND_MODULE_STARTUP_N
 363 #define PHP_MODULE_SHUTDOWN_N   ZEND_MODULE_SHUTDOWN_N
 364 #define PHP_MODULE_ACTIVATE_N   ZEND_MODULE_ACTIVATE_N
 365 #define PHP_MODULE_DEACTIVATE_N ZEND_MODULE_DEACTIVATE_N
 366 #define PHP_MODULE_INFO_N               ZEND_MODULE_INFO_N
 367 
 368 #define PHP_MODULE_STARTUP_D    ZEND_MODULE_STARTUP_D
 369 #define PHP_MODULE_SHUTDOWN_D   ZEND_MODULE_SHUTDOWN_D
 370 #define PHP_MODULE_ACTIVATE_D   ZEND_MODULE_ACTIVATE_D
 371 #define PHP_MODULE_DEACTIVATE_D ZEND_MODULE_DEACTIVATE_D
 372 #define PHP_MODULE_INFO_D               ZEND_MODULE_INFO_D
 373 
 374 /* Compatibility macros */
 375 #define PHP_MINIT               ZEND_MODULE_STARTUP_N
 376 #define PHP_MSHUTDOWN   ZEND_MODULE_SHUTDOWN_N
 377 #define PHP_RINIT               ZEND_MODULE_ACTIVATE_N
 378 #define PHP_RSHUTDOWN   ZEND_MODULE_DEACTIVATE_N
 379 #define PHP_MINFO               ZEND_MODULE_INFO_N
 380 #define PHP_GINIT               ZEND_GINIT
 381 #define PHP_GSHUTDOWN   ZEND_GSHUTDOWN
 382 
 383 #define PHP_MINIT_FUNCTION              ZEND_MODULE_STARTUP_D
 384 #define PHP_MSHUTDOWN_FUNCTION  ZEND_MODULE_SHUTDOWN_D
 385 #define PHP_RINIT_FUNCTION              ZEND_MODULE_ACTIVATE_D
 386 #define PHP_RSHUTDOWN_FUNCTION  ZEND_MODULE_DEACTIVATE_D
 387 #define PHP_MINFO_FUNCTION              ZEND_MODULE_INFO_D
 388 #define PHP_GINIT_FUNCTION              ZEND_GINIT_FUNCTION
 389 #define PHP_GSHUTDOWN_FUNCTION  ZEND_GSHUTDOWN_FUNCTION
 390  
 391 #define PHP_MODULE_GLOBALS              ZEND_MODULE_GLOBALS
 392 
 393 
 394 /* Output support */
 395 #include "main/php_output.h"
 396 
 397 
 398 #include "php_streams.h"
 399 #include "php_memory_streams.h"
 400 #include "fopen_wrappers.h"
 401 
 402 
 403 /* Virtual current working directory support */
 404 #include "zend_virtual_cwd.h"
 405 
 406 #include "zend_constants.h"
 407 
 408 /* connection status states */
 409 #define PHP_CONNECTION_NORMAL  0
 410 #define PHP_CONNECTION_ABORTED 1
 411 #define PHP_CONNECTION_TIMEOUT 2
 412 
 413 #include "php_reentrancy.h"
 414 
 415 /* Finding offsets of elements within structures.
 416  * Taken from the Apache code, which in turn, was taken from X code...
 417  */
 418 
 419 #ifndef XtOffset
 420 #if defined(CRAY) || (defined(__arm) && !(defined(LINUX) || defined(__riscos__)))
 421 #ifdef __STDC__
 422 #define XtOffset(p_type, field) _Offsetof(p_type, field)
 423 #else
 424 #ifdef CRAY2
 425 #define XtOffset(p_type, field) \
 426     (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
 427 
 428 #else /* !CRAY2 */
 429 
 430 #define XtOffset(p_type, field) ((unsigned int)&(((p_type)NULL)->field))
 431 
 432 #endif /* !CRAY2 */
 433 #endif /* __STDC__ */
 434 #else /* ! (CRAY || __arm) */
 435 
 436 #define XtOffset(p_type, field) \
 437     ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
 438 
 439 #endif /* !CRAY */
 440 #endif /* ! XtOffset */
 441 
 442 #ifndef XtOffsetOf
 443 #ifdef offsetof
 444 #define XtOffsetOf(s_type, field) offsetof(s_type, field)
 445 #else
 446 #define XtOffsetOf(s_type, field) XtOffset(s_type*, field)
 447 #endif
 448 #endif /* !XtOffsetOf */
 449 
 450 #endif
 451 
 452 /*
 453  * Local variables:
 454  * tab-width: 4
 455  * c-basic-offset: 4
 456  * End:
 457  * vim600: sw=4 ts=4 fdm=marker
 458  * vim<600: sw=4 ts=4
 459  */

/* [<][>][^][v][top][bottom][index][help] */