ruby/parser_st.c

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

164 строки
4.8 KiB
C
Исходник Постоянная ссылка Обычный вид История

#include "parser_st.h"
#include "parser_bits.h"
#ifndef TRUE
# define TRUE 1
#endif
#ifndef FALSE
# define FALSE 0
#endif
2023-06-17 05:33:12 +03:00
#undef NOT_RUBY
#undef RUBY
2023-06-17 05:33:12 +03:00
#undef RUBY_EXPORT
2023-06-16 11:31:47 +03:00
#undef MEMCPY
#define MEMCPY(p1,p2,type,n) nonempty_memcpy((p1), (p2), (sizeof(type) * (n)))
/* The multiplication should not overflow since this macro is used
* only with the already allocated size. */
static inline void *
nonempty_memcpy(void *dest, const void *src, size_t n)
{
if (n) {
return memcpy(dest, src, n);
}
else {
return dest;
}
}
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <string.h>
#include <assert.h>
#ifdef __GNUC__
#define PREFETCH(addr, write_p) __builtin_prefetch(addr, write_p)
#define EXPECT(expr, val) __builtin_expect(expr, val)
#define ATTRIBUTE_UNUSED __attribute__((unused))
#else
#define PREFETCH(addr, write_p)
#define EXPECT(expr, val) (expr)
#define ATTRIBUTE_UNUSED
#endif
#define st_index_t parser_st_index_t
#define st_hash_t parser_st_hash_t
#define st_data_t parser_st_data_t
#define st_hash_type parser_st_hash_type
#define st_table parser_st_table
#define st_table_entry parser_st_table_entry
#define st_update_callback_func parser_st_update_callback_func
#define st_foreach_check_callback_func parser_st_foreach_check_callback_func
#define st_foreach_callback_func parser_st_foreach_callback_func
#define st_retval parser_st_retval
#define ST_CONTINUE ST2_CONTINUE
#define ST_STOP ST2_STOP
#define ST_DELETE ST2_DELETE
#define ST_CHECK ST2_CHECK
#define ST_REPLACE ST2_REPLACE
2023-06-16 11:31:47 +03:00
#undef st_numcmp
#define st_numcmp rb_parser_st_numcmp
2023-06-16 11:31:47 +03:00
#undef st_numhash
#define st_numhash rb_parser_st_numhash
2023-06-16 11:31:47 +03:00
#undef st_free_table
#define st_free_table rb_parser_st_free_table
#define rb_st_hash_start rb_parser_st_hash_start
2023-06-16 11:31:47 +03:00
#undef st_delete
#define st_delete rb_parser_st_delete
2023-06-16 11:31:47 +03:00
#undef st_foreach
#define st_foreach rb_parser_st_foreach
2023-06-16 11:31:47 +03:00
#undef st_init_numtable
#define st_init_numtable rb_parser_st_init_numtable
2023-06-16 11:31:47 +03:00
#undef st_init_table_with_size
#define st_init_table_with_size rb_parser_st_init_table_with_size
2023-06-17 05:33:12 +03:00
#undef st_init_existing_table_with_size
#define st_init_existing_table_with_size rb_parser_st_init_existing_table_with_size
2023-06-16 11:31:47 +03:00
#undef st_insert
#define st_insert rb_parser_st_insert
2023-06-16 11:31:47 +03:00
#undef st_lookup
#define st_lookup rb_parser_st_lookup
2023-06-16 11:31:47 +03:00
#undef st_table_size
#define st_table_size rb_parser_st_table_size
2023-06-16 11:31:47 +03:00
#undef st_clear
#define st_clear rb_parser_st_clear
2023-06-16 11:31:47 +03:00
#undef st_init_strtable
#define st_init_strtable rb_parser_st_init_strtable
2023-06-16 11:31:47 +03:00
#undef st_init_table
#define st_init_table rb_parser_st_init_table
2023-06-16 11:31:47 +03:00
#undef st_init_strcasetable
#define st_init_strcasetable rb_parser_st_init_strcasetable
2023-06-16 11:31:47 +03:00
#undef st_init_strtable_with_size
#define st_init_strtable_with_size rb_parser_st_init_strtable_with_size
2023-06-16 11:31:47 +03:00
#undef st_init_numtable_with_size
#define st_init_numtable_with_size rb_parser_st_init_numtable_with_size
2023-06-16 11:31:47 +03:00
#undef st_init_strcasetable_with_size
#define st_init_strcasetable_with_size rb_parser_st_init_strcasetable_with_size
2023-06-16 11:31:47 +03:00
#undef st_memsize
#define st_memsize rb_parser_st_memsize
2023-06-16 11:31:47 +03:00
#undef st_get_key
#define st_get_key rb_parser_st_get_key
2023-06-16 11:31:47 +03:00
#undef st_add_direct
#define st_add_direct rb_parser_st_add_direct
2023-06-16 11:31:47 +03:00
#undef st_insert2
#define st_insert2 rb_parser_st_insert2
#undef st_replace
#define st_replace rb_parser_st_replace
2023-06-16 11:31:47 +03:00
#undef st_copy
#define st_copy rb_parser_st_copy
2023-06-16 11:31:47 +03:00
#undef st_delete_safe
#define st_delete_safe rb_parser_st_delete_safe
2023-06-16 11:31:47 +03:00
#undef st_shift
#define st_shift rb_parser_st_shift
2023-06-16 11:31:47 +03:00
#undef st_cleanup_safe
#define st_cleanup_safe rb_parser_st_cleanup_safe
2023-06-16 11:31:47 +03:00
#undef st_update
#define st_update rb_parser_st_update
2023-06-16 11:31:47 +03:00
#undef st_foreach_with_replace
#define st_foreach_with_replace rb_parser_st_foreach_with_replace
2023-06-16 11:31:47 +03:00
#undef st_foreach_check
#define st_foreach_check rb_parser_st_foreach_check
2023-06-16 11:31:47 +03:00
#undef st_keys
#define st_keys rb_parser_st_keys
2023-06-16 11:31:47 +03:00
#undef st_keys_check
#define st_keys_check rb_parser_st_keys_check
2023-06-16 11:31:47 +03:00
#undef st_values
#define st_values rb_parser_st_values
2023-06-16 11:31:47 +03:00
#undef st_values_check
#define st_values_check rb_parser_st_values_check
2023-06-16 11:31:47 +03:00
#undef st_hash
#define st_hash rb_parser_st_hash
2023-06-16 11:31:47 +03:00
#undef st_hash_uint32
#define st_hash_uint32 rb_parser_st_hash_uint32
2023-06-16 11:31:47 +03:00
#undef st_hash_uint
#define st_hash_uint rb_parser_st_hash_uint
2023-06-16 11:31:47 +03:00
#undef st_hash_end
#define st_hash_end rb_parser_st_hash_end
2023-06-16 11:31:47 +03:00
#undef st_locale_insensitive_strcasecmp
#define st_locale_insensitive_strcasecmp rb_parser_st_locale_insensitive_strcasecmp
2023-06-16 11:31:47 +03:00
#undef st_locale_insensitive_strncasecmp
#define st_locale_insensitive_strncasecmp rb_parser_st_locale_insensitive_strncasecmp
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
/* GCC warns about unknown sanitizer, which is annoying. */
# undef NO_SANITIZE
# define NO_SANITIZE(x, y) \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wattributes\"") \
__attribute__((__no_sanitize__(x))) y; \
_Pragma("GCC diagnostic pop")
#endif
#ifndef NO_SANITIZE
# define NO_SANITIZE(x, y) y
#endif
2023-06-17 05:33:12 +03:00
#include "st.c"