PageRenderTime 49ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/xdebug_compat.h

http://github.com/derickr/xdebug
C Header | 111 lines | 76 code | 18 blank | 17 comment | 2 complexity | 32e8a5b9815c58d7b49c3631333f08fa MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Xdebug |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 2002-2016 Derick Rethans |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 1.0 of the Xdebug 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://xdebug.derickrethans.nl/license.php |
  11. | If you did not receive a copy of the Xdebug license and are unable |
  12. | to obtain it through the world-wide-web, please send a note to |
  13. | xdebug@derickrethans.nl so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Authors: Derick Rethans <derick@xdebug.org> |
  16. +----------------------------------------------------------------------+
  17. */
  18. #ifndef __HAVE_XDEBUG_COMPAT_H__
  19. #define __HAVE_XDEBUG_COMPAT_H__
  20. #include "php.h"
  21. #include "ext/standard/head.h"
  22. #include "ext/standard/php_var.h"
  23. #define xdebug_php_var_dump php_var_dump
  24. zval *xdebug_zval_ptr(int op_type, const znode_op *node, zend_execute_data *zdata TSRMLS_DC);
  25. #if PHP_VERSION_ID >= 70000
  26. char *xdebug_str_to_str(char *haystack, size_t length, char *needle, size_t needle_len, char *str, size_t str_len, size_t *new_len);
  27. char *xdebug_base64_encode(unsigned char *data, int data_len, int *new_len);
  28. unsigned char *xdebug_base64_decode(unsigned char *data, int data_len, int *new_len);
  29. void xdebug_stripcslashes(char *string, int *new_len);
  30. zend_class_entry *xdebug_fetch_class(char *classname, int classname_len, int flags TSRMLS_DC);
  31. int xdebug_get_constant(char *val, int len, zval *const_val TSRMLS_DC);
  32. void xdebug_setcookie(char *name, int name_len, char *value, int value_len, time_t expires, char *path, int path_len, char *domain, int domain_len, int secure, int url_encode, int httponly TSRMLS_CC);
  33. char *xdebug_get_compiled_variable_name(zend_op_array *op_array, uint32_t var, int *cv_len);
  34. zval *xdebug_read_property(zend_class_entry *ce, zval *exception, char *name, int length, int flags TSRMLS_DC);
  35. # define ADD_STRING_COPY
  36. # define XDEBUG_ENFORCE_SAFE_MODE 0x00
  37. # define SIZETorINT size_t
  38. # define SIZETorUINT size_t
  39. # define SIZETorZUINT size_t
  40. # define zppLONG zend_long
  41. # define iniLONG zend_long
  42. # define hashULONG zend_ulong
  43. # define XDEBUG_MAKE_STD_ZVAL(zv) \
  44. zv = ecalloc(sizeof(zval), 1);
  45. # define XDEBUG_APPLY_COUNT(ht) ZEND_HASH_GET_APPLY_COUNT(ht)
  46. # define HASH_KEY_VAL(k) (k)->key->val
  47. # define HASH_KEY_LEN(k) (k)->key->len
  48. # define HASH_KEY_SIZEOF(k) (sizeof(k) - 1)
  49. # define HASH_KEY_STRLEN(k) (strlen(k))
  50. # define HASH_KEY_IS_NUMERIC(k) ((k) == NULL)
  51. # define HASH_APPLY_KEY_VAL(k) (k)->val
  52. # define HASH_APPLY_KEY_LEN(k) (k)->len + 1
  53. # define HASH_APPLY_NUMERIC(k) index
  54. # define ZEND_USER_OPCODE_HANDLER_ARGS zend_execute_data *execute_data
  55. # define ZEND_USER_OPCODE_HANDLER_ARGS_PASSTHRU execute_data
  56. # define STR_NAME_VAL(k) (k)->val
  57. # define STR_NAME_LEN(k) (k)->len
  58. #else
  59. # include "ext/standard/base64.h"
  60. # define xdebug_str_to_str php_str_to_str
  61. # define xdebug_base64_encode php_base64_encode
  62. # define xdebug_base64_decode php_base64_decode
  63. # define xdebug_stripcslashes php_stripcslashes
  64. # define xdebug_fetch_class zend_fetch_class
  65. # define xdebug_get_constant zend_get_constant
  66. # define xdebug_setcookie php_setcookie
  67. # define xdebug_get_compiled_variable_name zend_get_compiled_variable_name
  68. # define xdebug_read_property zend_read_property
  69. # define ADD_STRING_COPY , 1
  70. # define XDEBUG_ENFORCE_SAFE_MODE ENFORCE_SAFE_MODE
  71. # define SIZETorINT int
  72. # define SIZETorUINT unsigned int
  73. # define SIZETorZUINT zend_uint
  74. # define zppLONG long
  75. # define iniLONG long
  76. # define hashULONG ulong
  77. # define XDEBUG_MAKE_STD_ZVAL(zv) \
  78. MAKE_STD_ZVAL(zv)
  79. # define XDEBUG_APPLY_COUNT(ht) (ht->nApplyCount)
  80. # define HASH_KEY_VAL(k) (k)->arKey
  81. # define HASH_KEY_LEN(k) (k)->nKeyLength
  82. # define HASH_KEY_SIZEOF(k) (sizeof(k))
  83. # define HASH_KEY_STRLEN(k) (strlen(k) + 1)
  84. # define HASH_KEY_IS_NUMERIC(k) ((k)->nKeyLength == 0)
  85. # define HASH_APPLY_KEY_VAL(k) (k)->arKey
  86. # define HASH_APPLY_KEY_LEN(k) (k)->nKeyLength
  87. # define HASH_APPLY_NUMERIC(k) (k)->h
  88. # define ZEND_USER_OPCODE_HANDLER_ARGS ZEND_OPCODE_HANDLER_ARGS
  89. # define ZEND_USER_OPCODE_HANDLER_ARGS_PASSTHRU ZEND_OPCODE_HANDLER_ARGS_PASSTHRU
  90. # define STR_NAME_VAL(k) (k)
  91. # define STR_NAME_LEN(k) (k ## _length)
  92. #endif
  93. #endif