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

/Zend/zend_string.h

http://github.com/php/php-src
C Header | 534 lines | 413 code | 63 blank | 58 comment | 63 complexity | 5ec33a05e132e7f5dcc3e6797a0b37a6 MD5 | raw file
Possible License(s): BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, LGPL-2.1
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Zend Engine |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 2.00 of the Zend 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.zend.com/license/2_00.txt. |
  11. | If you did not receive a copy of the Zend license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@zend.com so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Authors: Dmitry Stogov <dmitry@php.net> |
  16. +----------------------------------------------------------------------+
  17. */
  18. #ifndef ZEND_STRING_H
  19. #define ZEND_STRING_H
  20. #include "zend.h"
  21. BEGIN_EXTERN_C()
  22. typedef void (*zend_string_copy_storage_func_t)(void);
  23. typedef zend_string *(ZEND_FASTCALL *zend_new_interned_string_func_t)(zend_string *str);
  24. typedef zend_string *(ZEND_FASTCALL *zend_string_init_interned_func_t)(const char *str, size_t size, int permanent);
  25. ZEND_API extern zend_new_interned_string_func_t zend_new_interned_string;
  26. ZEND_API extern zend_string_init_interned_func_t zend_string_init_interned;
  27. ZEND_API zend_ulong ZEND_FASTCALL zend_string_hash_func(zend_string *str);
  28. ZEND_API zend_ulong ZEND_FASTCALL zend_hash_func(const char *str, size_t len);
  29. ZEND_API zend_string* ZEND_FASTCALL zend_interned_string_find_permanent(zend_string *str);
  30. ZEND_API zend_string *zend_string_concat2(
  31. const char *str1, size_t str1_len,
  32. const char *str2, size_t str2_len);
  33. ZEND_API zend_string *zend_string_concat3(
  34. const char *str1, size_t str1_len,
  35. const char *str2, size_t str2_len,
  36. const char *str3, size_t str3_len);
  37. ZEND_API void zend_interned_strings_init(void);
  38. ZEND_API void zend_interned_strings_dtor(void);
  39. ZEND_API void zend_interned_strings_activate(void);
  40. ZEND_API void zend_interned_strings_deactivate(void);
  41. ZEND_API void zend_interned_strings_set_request_storage_handlers(zend_new_interned_string_func_t handler, zend_string_init_interned_func_t init_handler);
  42. ZEND_API void zend_interned_strings_switch_storage(zend_bool request);
  43. ZEND_API extern zend_string *zend_empty_string;
  44. ZEND_API extern zend_string *zend_one_char_string[256];
  45. ZEND_API extern zend_string **zend_known_strings;
  46. END_EXTERN_C()
  47. /* Shortcuts */
  48. #define ZSTR_VAL(zstr) (zstr)->val
  49. #define ZSTR_LEN(zstr) (zstr)->len
  50. #define ZSTR_H(zstr) (zstr)->h
  51. #define ZSTR_HASH(zstr) zend_string_hash_val(zstr)
  52. /* Compatibility macros */
  53. #define IS_INTERNED(s) ZSTR_IS_INTERNED(s)
  54. #define STR_EMPTY_ALLOC() ZSTR_EMPTY_ALLOC()
  55. #define _STR_HEADER_SIZE _ZSTR_HEADER_SIZE
  56. #define STR_ALLOCA_ALLOC(str, _len, use_heap) ZSTR_ALLOCA_ALLOC(str, _len, use_heap)
  57. #define STR_ALLOCA_INIT(str, s, len, use_heap) ZSTR_ALLOCA_INIT(str, s, len, use_heap)
  58. #define STR_ALLOCA_FREE(str, use_heap) ZSTR_ALLOCA_FREE(str, use_heap)
  59. /*---*/
  60. #define ZSTR_IS_INTERNED(s) (GC_FLAGS(s) & IS_STR_INTERNED)
  61. #define ZSTR_EMPTY_ALLOC() zend_empty_string
  62. #define ZSTR_CHAR(c) zend_one_char_string[c]
  63. #define ZSTR_KNOWN(idx) zend_known_strings[idx]
  64. #define _ZSTR_HEADER_SIZE XtOffsetOf(zend_string, val)
  65. #define _ZSTR_STRUCT_SIZE(len) (_ZSTR_HEADER_SIZE + len + 1)
  66. #define ZSTR_ALLOCA_ALLOC(str, _len, use_heap) do { \
  67. (str) = (zend_string *)do_alloca(ZEND_MM_ALIGNED_SIZE_EX(_ZSTR_STRUCT_SIZE(_len), 8), (use_heap)); \
  68. GC_SET_REFCOUNT(str, 1); \
  69. GC_TYPE_INFO(str) = IS_STRING; \
  70. ZSTR_H(str) = 0; \
  71. ZSTR_LEN(str) = _len; \
  72. } while (0)
  73. #define ZSTR_ALLOCA_INIT(str, s, len, use_heap) do { \
  74. ZSTR_ALLOCA_ALLOC(str, len, use_heap); \
  75. memcpy(ZSTR_VAL(str), (s), (len)); \
  76. ZSTR_VAL(str)[(len)] = '\0'; \
  77. } while (0)
  78. #define ZSTR_ALLOCA_FREE(str, use_heap) free_alloca(str, use_heap)
  79. /*---*/
  80. static zend_always_inline zend_ulong zend_string_hash_val(zend_string *s)
  81. {
  82. return ZSTR_H(s) ? ZSTR_H(s) : zend_string_hash_func(s);
  83. }
  84. static zend_always_inline void zend_string_forget_hash_val(zend_string *s)
  85. {
  86. ZSTR_H(s) = 0;
  87. GC_DEL_FLAGS(s, IS_STR_VALID_UTF8);
  88. }
  89. static zend_always_inline uint32_t zend_string_refcount(const zend_string *s)
  90. {
  91. if (!ZSTR_IS_INTERNED(s)) {
  92. return GC_REFCOUNT(s);
  93. }
  94. return 1;
  95. }
  96. static zend_always_inline uint32_t zend_string_addref(zend_string *s)
  97. {
  98. if (!ZSTR_IS_INTERNED(s)) {
  99. return GC_ADDREF(s);
  100. }
  101. return 1;
  102. }
  103. static zend_always_inline uint32_t zend_string_delref(zend_string *s)
  104. {
  105. if (!ZSTR_IS_INTERNED(s)) {
  106. return GC_DELREF(s);
  107. }
  108. return 1;
  109. }
  110. static zend_always_inline zend_string *zend_string_alloc(size_t len, int persistent)
  111. {
  112. zend_string *ret = (zend_string *)pemalloc(ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent);
  113. GC_SET_REFCOUNT(ret, 1);
  114. GC_TYPE_INFO(ret) = IS_STRING | ((persistent ? IS_STR_PERSISTENT : 0) << GC_FLAGS_SHIFT);
  115. ZSTR_H(ret) = 0;
  116. ZSTR_LEN(ret) = len;
  117. return ret;
  118. }
  119. static zend_always_inline zend_string *zend_string_safe_alloc(size_t n, size_t m, size_t l, int persistent)
  120. {
  121. zend_string *ret = (zend_string *)safe_pemalloc(n, m, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(l)), persistent);
  122. GC_SET_REFCOUNT(ret, 1);
  123. GC_TYPE_INFO(ret) = IS_STRING | ((persistent ? IS_STR_PERSISTENT : 0) << GC_FLAGS_SHIFT);
  124. ZSTR_H(ret) = 0;
  125. ZSTR_LEN(ret) = (n * m) + l;
  126. return ret;
  127. }
  128. static zend_always_inline zend_string *zend_string_init(const char *str, size_t len, int persistent)
  129. {
  130. zend_string *ret = zend_string_alloc(len, persistent);
  131. memcpy(ZSTR_VAL(ret), str, len);
  132. ZSTR_VAL(ret)[len] = '\0';
  133. return ret;
  134. }
  135. static zend_always_inline zend_string *zend_string_copy(zend_string *s)
  136. {
  137. if (!ZSTR_IS_INTERNED(s)) {
  138. GC_ADDREF(s);
  139. }
  140. return s;
  141. }
  142. static zend_always_inline zend_string *zend_string_dup(zend_string *s, int persistent)
  143. {
  144. if (ZSTR_IS_INTERNED(s)) {
  145. return s;
  146. } else {
  147. return zend_string_init(ZSTR_VAL(s), ZSTR_LEN(s), persistent);
  148. }
  149. }
  150. static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_t len, int persistent)
  151. {
  152. zend_string *ret;
  153. if (!ZSTR_IS_INTERNED(s)) {
  154. if (EXPECTED(GC_REFCOUNT(s) == 1)) {
  155. ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent);
  156. ZSTR_LEN(ret) = len;
  157. zend_string_forget_hash_val(ret);
  158. return ret;
  159. } else {
  160. GC_DELREF(s);
  161. }
  162. }
  163. ret = zend_string_alloc(len, persistent);
  164. memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), MIN(len, ZSTR_LEN(s)) + 1);
  165. return ret;
  166. }
  167. static zend_always_inline zend_string *zend_string_extend(zend_string *s, size_t len, int persistent)
  168. {
  169. zend_string *ret;
  170. ZEND_ASSERT(len >= ZSTR_LEN(s));
  171. if (!ZSTR_IS_INTERNED(s)) {
  172. if (EXPECTED(GC_REFCOUNT(s) == 1)) {
  173. ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent);
  174. ZSTR_LEN(ret) = len;
  175. zend_string_forget_hash_val(ret);
  176. return ret;
  177. } else {
  178. GC_DELREF(s);
  179. }
  180. }
  181. ret = zend_string_alloc(len, persistent);
  182. memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), ZSTR_LEN(s) + 1);
  183. return ret;
  184. }
  185. static zend_always_inline zend_string *zend_string_truncate(zend_string *s, size_t len, int persistent)
  186. {
  187. zend_string *ret;
  188. ZEND_ASSERT(len <= ZSTR_LEN(s));
  189. if (!ZSTR_IS_INTERNED(s)) {
  190. if (EXPECTED(GC_REFCOUNT(s) == 1)) {
  191. ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent);
  192. ZSTR_LEN(ret) = len;
  193. zend_string_forget_hash_val(ret);
  194. return ret;
  195. } else {
  196. GC_DELREF(s);
  197. }
  198. }
  199. ret = zend_string_alloc(len, persistent);
  200. memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), len + 1);
  201. return ret;
  202. }
  203. static zend_always_inline zend_string *zend_string_safe_realloc(zend_string *s, size_t n, size_t m, size_t l, int persistent)
  204. {
  205. zend_string *ret;
  206. if (!ZSTR_IS_INTERNED(s)) {
  207. if (GC_REFCOUNT(s) == 1) {
  208. ret = (zend_string *)safe_perealloc(s, n, m, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(l)), persistent);
  209. ZSTR_LEN(ret) = (n * m) + l;
  210. zend_string_forget_hash_val(ret);
  211. return ret;
  212. } else {
  213. GC_DELREF(s);
  214. }
  215. }
  216. ret = zend_string_safe_alloc(n, m, l, persistent);
  217. memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), MIN((n * m) + l, ZSTR_LEN(s)) + 1);
  218. return ret;
  219. }
  220. static zend_always_inline void zend_string_free(zend_string *s)
  221. {
  222. if (!ZSTR_IS_INTERNED(s)) {
  223. ZEND_ASSERT(GC_REFCOUNT(s) <= 1);
  224. pefree(s, GC_FLAGS(s) & IS_STR_PERSISTENT);
  225. }
  226. }
  227. static zend_always_inline void zend_string_efree(zend_string *s)
  228. {
  229. ZEND_ASSERT(!ZSTR_IS_INTERNED(s));
  230. ZEND_ASSERT(GC_REFCOUNT(s) <= 1);
  231. ZEND_ASSERT(!(GC_FLAGS(s) & IS_STR_PERSISTENT));
  232. efree(s);
  233. }
  234. static zend_always_inline void zend_string_release(zend_string *s)
  235. {
  236. if (!ZSTR_IS_INTERNED(s)) {
  237. if (GC_DELREF(s) == 0) {
  238. pefree(s, GC_FLAGS(s) & IS_STR_PERSISTENT);
  239. }
  240. }
  241. }
  242. static zend_always_inline void zend_string_release_ex(zend_string *s, int persistent)
  243. {
  244. if (!ZSTR_IS_INTERNED(s)) {
  245. if (GC_DELREF(s) == 0) {
  246. if (persistent) {
  247. ZEND_ASSERT(GC_FLAGS(s) & IS_STR_PERSISTENT);
  248. free(s);
  249. } else {
  250. ZEND_ASSERT(!(GC_FLAGS(s) & IS_STR_PERSISTENT));
  251. efree(s);
  252. }
  253. }
  254. }
  255. }
  256. #if defined(__GNUC__) && (defined(__i386__) || (defined(__x86_64__) && !defined(__ILP32__)))
  257. BEGIN_EXTERN_C()
  258. ZEND_API zend_bool ZEND_FASTCALL zend_string_equal_val(zend_string *s1, zend_string *s2);
  259. END_EXTERN_C()
  260. #else
  261. static zend_always_inline zend_bool zend_string_equal_val(zend_string *s1, zend_string *s2)
  262. {
  263. return !memcmp(ZSTR_VAL(s1), ZSTR_VAL(s2), ZSTR_LEN(s1));
  264. }
  265. #endif
  266. static zend_always_inline zend_bool zend_string_equal_content(zend_string *s1, zend_string *s2)
  267. {
  268. return ZSTR_LEN(s1) == ZSTR_LEN(s2) && zend_string_equal_val(s1, s2);
  269. }
  270. static zend_always_inline zend_bool zend_string_equals(zend_string *s1, zend_string *s2)
  271. {
  272. return s1 == s2 || zend_string_equal_content(s1, s2);
  273. }
  274. #define zend_string_equals_ci(s1, s2) \
  275. (ZSTR_LEN(s1) == ZSTR_LEN(s2) && !zend_binary_strcasecmp(ZSTR_VAL(s1), ZSTR_LEN(s1), ZSTR_VAL(s2), ZSTR_LEN(s2)))
  276. #define zend_string_equals_literal_ci(str, c) \
  277. (ZSTR_LEN(str) == sizeof(c) - 1 && !zend_binary_strcasecmp(ZSTR_VAL(str), ZSTR_LEN(str), (c), sizeof(c) - 1))
  278. #define zend_string_equals_literal(str, literal) \
  279. (ZSTR_LEN(str) == sizeof(literal)-1 && !memcmp(ZSTR_VAL(str), literal, sizeof(literal) - 1))
  280. /*
  281. * DJBX33A (Daniel J. Bernstein, Times 33 with Addition)
  282. *
  283. * This is Daniel J. Bernstein's popular `times 33' hash function as
  284. * posted by him years ago on comp.lang.c. It basically uses a function
  285. * like ``hash(i) = hash(i-1) * 33 + str[i]''. This is one of the best
  286. * known hash functions for strings. Because it is both computed very
  287. * fast and distributes very well.
  288. *
  289. * The magic of number 33, i.e. why it works better than many other
  290. * constants, prime or not, has never been adequately explained by
  291. * anyone. So I try an explanation: if one experimentally tests all
  292. * multipliers between 1 and 256 (as RSE did now) one detects that even
  293. * numbers are not usable at all. The remaining 128 odd numbers
  294. * (except for the number 1) work more or less all equally well. They
  295. * all distribute in an acceptable way and this way fill a hash table
  296. * with an average percent of approx. 86%.
  297. *
  298. * If one compares the Chi^2 values of the variants, the number 33 not
  299. * even has the best value. But the number 33 and a few other equally
  300. * good numbers like 17, 31, 63, 127 and 129 have nevertheless a great
  301. * advantage to the remaining numbers in the large set of possible
  302. * multipliers: their multiply operation can be replaced by a faster
  303. * operation based on just one shift plus either a single addition
  304. * or subtraction operation. And because a hash function has to both
  305. * distribute good _and_ has to be very fast to compute, those few
  306. * numbers should be preferred and seems to be the reason why Daniel J.
  307. * Bernstein also preferred it.
  308. *
  309. *
  310. * -- Ralf S. Engelschall <rse@engelschall.com>
  311. */
  312. static zend_always_inline zend_ulong zend_inline_hash_func(const char *str, size_t len)
  313. {
  314. zend_ulong hash = Z_UL(5381);
  315. #if defined(_WIN32) || defined(__i386__) || defined(__x86_64__) || defined(__aarch64__)
  316. /* Version with multiplication works better on modern CPU */
  317. for (; len >= 8; len -= 8, str += 8) {
  318. # if defined(__aarch64__) && !defined(WORDS_BIGENDIAN)
  319. /* On some architectures it is beneficial to load 8 bytes at a
  320. time and extract each byte with a bit field extract instr. */
  321. uint64_t chunk;
  322. memcpy(&chunk, str, sizeof(chunk));
  323. hash =
  324. hash * 33 * 33 * 33 * 33 +
  325. ((chunk >> (8 * 0)) & 0xff) * 33 * 33 * 33 +
  326. ((chunk >> (8 * 1)) & 0xff) * 33 * 33 +
  327. ((chunk >> (8 * 2)) & 0xff) * 33 +
  328. ((chunk >> (8 * 3)) & 0xff);
  329. hash =
  330. hash * 33 * 33 * 33 * 33 +
  331. ((chunk >> (8 * 4)) & 0xff) * 33 * 33 * 33 +
  332. ((chunk >> (8 * 5)) & 0xff) * 33 * 33 +
  333. ((chunk >> (8 * 6)) & 0xff) * 33 +
  334. ((chunk >> (8 * 7)) & 0xff);
  335. # else
  336. hash =
  337. hash * 33 * 33 * 33 * 33 +
  338. str[0] * 33 * 33 * 33 +
  339. str[1] * 33 * 33 +
  340. str[2] * 33 +
  341. str[3];
  342. hash =
  343. hash * 33 * 33 * 33 * 33 +
  344. str[4] * 33 * 33 * 33 +
  345. str[5] * 33 * 33 +
  346. str[6] * 33 +
  347. str[7];
  348. # endif
  349. }
  350. if (len >= 4) {
  351. hash =
  352. hash * 33 * 33 * 33 * 33 +
  353. str[0] * 33 * 33 * 33 +
  354. str[1] * 33 * 33 +
  355. str[2] * 33 +
  356. str[3];
  357. len -= 4;
  358. str += 4;
  359. }
  360. if (len >= 2) {
  361. if (len > 2) {
  362. hash =
  363. hash * 33 * 33 * 33 +
  364. str[0] * 33 * 33 +
  365. str[1] * 33 +
  366. str[2];
  367. } else {
  368. hash =
  369. hash * 33 * 33 +
  370. str[0] * 33 +
  371. str[1];
  372. }
  373. } else if (len != 0) {
  374. hash = hash * 33 + *str;
  375. }
  376. #else
  377. /* variant with the hash unrolled eight times */
  378. for (; len >= 8; len -= 8) {
  379. hash = ((hash << 5) + hash) + *str++;
  380. hash = ((hash << 5) + hash) + *str++;
  381. hash = ((hash << 5) + hash) + *str++;
  382. hash = ((hash << 5) + hash) + *str++;
  383. hash = ((hash << 5) + hash) + *str++;
  384. hash = ((hash << 5) + hash) + *str++;
  385. hash = ((hash << 5) + hash) + *str++;
  386. hash = ((hash << 5) + hash) + *str++;
  387. }
  388. switch (len) {
  389. case 7: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
  390. case 6: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
  391. case 5: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
  392. case 4: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
  393. case 3: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
  394. case 2: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
  395. case 1: hash = ((hash << 5) + hash) + *str++; break;
  396. case 0: break;
  397. EMPTY_SWITCH_DEFAULT_CASE()
  398. }
  399. #endif
  400. /* Hash value can't be zero, so we always set the high bit */
  401. #if SIZEOF_ZEND_LONG == 8
  402. return hash | Z_UL(0x8000000000000000);
  403. #elif SIZEOF_ZEND_LONG == 4
  404. return hash | Z_UL(0x80000000);
  405. #else
  406. # error "Unknown SIZEOF_ZEND_LONG"
  407. #endif
  408. }
  409. #define ZEND_KNOWN_STRINGS(_) \
  410. _(ZEND_STR_FILE, "file") \
  411. _(ZEND_STR_LINE, "line") \
  412. _(ZEND_STR_FUNCTION, "function") \
  413. _(ZEND_STR_CLASS, "class") \
  414. _(ZEND_STR_OBJECT, "object") \
  415. _(ZEND_STR_TYPE, "type") \
  416. _(ZEND_STR_OBJECT_OPERATOR, "->") \
  417. _(ZEND_STR_PAAMAYIM_NEKUDOTAYIM, "::") \
  418. _(ZEND_STR_ARGS, "args") \
  419. _(ZEND_STR_UNKNOWN, "unknown") \
  420. _(ZEND_STR_EVAL, "eval") \
  421. _(ZEND_STR_INCLUDE, "include") \
  422. _(ZEND_STR_REQUIRE, "require") \
  423. _(ZEND_STR_INCLUDE_ONCE, "include_once") \
  424. _(ZEND_STR_REQUIRE_ONCE, "require_once") \
  425. _(ZEND_STR_SCALAR, "scalar") \
  426. _(ZEND_STR_ERROR_REPORTING, "error_reporting") \
  427. _(ZEND_STR_STATIC, "static") \
  428. _(ZEND_STR_THIS, "this") \
  429. _(ZEND_STR_VALUE, "value") \
  430. _(ZEND_STR_KEY, "key") \
  431. _(ZEND_STR_MAGIC_INVOKE, "__invoke") \
  432. _(ZEND_STR_PREVIOUS, "previous") \
  433. _(ZEND_STR_CODE, "code") \
  434. _(ZEND_STR_MESSAGE, "message") \
  435. _(ZEND_STR_SEVERITY, "severity") \
  436. _(ZEND_STR_STRING, "string") \
  437. _(ZEND_STR_TRACE, "trace") \
  438. _(ZEND_STR_SCHEME, "scheme") \
  439. _(ZEND_STR_HOST, "host") \
  440. _(ZEND_STR_PORT, "port") \
  441. _(ZEND_STR_USER, "user") \
  442. _(ZEND_STR_PASS, "pass") \
  443. _(ZEND_STR_PATH, "path") \
  444. _(ZEND_STR_QUERY, "query") \
  445. _(ZEND_STR_FRAGMENT, "fragment") \
  446. _(ZEND_STR_NULL, "NULL") \
  447. _(ZEND_STR_BOOLEAN, "boolean") \
  448. _(ZEND_STR_INTEGER, "integer") \
  449. _(ZEND_STR_DOUBLE, "double") \
  450. _(ZEND_STR_ARRAY, "array") \
  451. _(ZEND_STR_RESOURCE, "resource") \
  452. _(ZEND_STR_CLOSED_RESOURCE, "resource (closed)") \
  453. _(ZEND_STR_NAME, "name") \
  454. _(ZEND_STR_ARGV, "argv") \
  455. _(ZEND_STR_ARGC, "argc") \
  456. _(ZEND_STR_ARRAY_CAPITALIZED, "Array") \
  457. _(ZEND_STR_BOOL, "bool") \
  458. _(ZEND_STR_INT, "int") \
  459. _(ZEND_STR_FLOAT, "float") \
  460. _(ZEND_STR_CALLABLE, "callable") \
  461. _(ZEND_STR_ITERABLE, "iterable") \
  462. _(ZEND_STR_VOID, "void") \
  463. _(ZEND_STR_FALSE, "false") \
  464. _(ZEND_STR_NULL_LOWERCASE, "null") \
  465. typedef enum _zend_known_string_id {
  466. #define _ZEND_STR_ID(id, str) id,
  467. ZEND_KNOWN_STRINGS(_ZEND_STR_ID)
  468. #undef _ZEND_STR_ID
  469. ZEND_STR_LAST_KNOWN
  470. } zend_known_string_id;
  471. #endif /* ZEND_STRING_H */