1 /*
2 LuaHashMap
3 Copyright (C) 2011-2012 PlayControl Software.
4 Eric Wing <ewing . public @ playcontrol.net>
5
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 THE SOFTWARE.
23
24 */
620 #ifndef C_LUA_HASH_MAP_H
621 #define C_LUA_HASH_MAP_H
622
623 #ifdef __cplusplus
624 extern "C" {
625 #endif
626
627 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
628
630 /* Note: For Doxygen to produce clean output, you should set the
631 * PREDEFINED option to remove DECLSPEC, CALLCONVENTION, and
632 * the DOXYGEN_SHOULD_IGNORE_THIS blocks.
633 * PREDEFINED = DOXYGEN_SHOULD_IGNORE_THIS=1 LUAHASHMAP_EXPORT= LUAHASHMAP_BUILD_AS_DLL=
634 */
635
636 #if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
637 /* Not ISO/IEC 9899:1999-compliant. */
638 #if !defined(restrict)
639 #define restrict
640 #define __LUAHASHMAP_RESTRICT_KEYWORD_DEFINED__
641 #endif
642
643 #if !defined(bool)
644 #define bool char
645 #define __LUAHASHMAP_BOOL_KEYWORD_DEFINED__
646 #endif
647 #if !defined(false)
648 #define false (bool)0
649 #define __LUAHASHMAP_FALSE_KEYWORD_DEFINED__
650 #endif
651 #if !defined(true)
652 #define true (bool)1
653 #define __LUAHASHMAP_TRUE_KEYWORD_DEFINED__
654 #endif
655 #else
656 #include <stdbool.h>
657 #endif
658
659 #include <stddef.h>
660
661 /* This define should generally not be used.
662 It is here mostly for hacking/experimentation and dirty tricks to get going for non-production code.
663 Make sure these defines match what was actually used in your Lua library.
664 */
665 #if defined(LUAHASHMAP_DONT_EXPOSE_LUA_HEADER)
666 #if !defined(lua_Number)
667 #define lua_Number double
668 #define __LUAHASHMAP_LUA_NUMBER_DEFINED__
669 #endif
670 #if !defined(lua_Integer)
671 #define lua_Integer ptrdiff_t
672 #define __LUAHASHMAP_LUA_INTEGER_DEFINED__
673 #endif
674 #if !defined(lua_State)
675 #define lua_State void
676 #define __LUAHASHMAP_LUA_STATE_DEFINED__
677 #endif
678 /* Some of my inline functions use these Lua type (int) definitions */
679 #if !defined(LUA_TNONE)
680 #define LUA_TNONE (-1)
681 #define __LUAHASHMAP_LUA_TNONE_DEFINED__
682 #endif
683 #if !defined(LUA_TLIGHTUSERDATA)
684 #define LUA_TLIGHTUSERDATA 2
685 #define __LUAHASHMAP_LUA_TLIGHTUSERDATA_DEFINED__
686 #endif
687 #if !defined(LUA_TNUMBER)
688 #define LUA_TNUMBER 3
689 #define __LUAHASHMAP_LUA_TNUMBER_DEFINED__
690 #endif
691 #if !defined(LUA_TSTRING)
692 #define LUA_TSTRING 4
693 #define __LUAHASHMAP_LUA_TSTRING_DEFINED__
694 #endif
695 #if !defined(LUA_NOREF)
696 #define LUA_NOREF (-2)
697 #define __LUAHASHMAP_LUA_NOREF_DEFINED__
698 #endif
699
700 #if !defined(lua_h) /* You detect nor undo a typedef */
701 typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
702 #define __LUAHASHMAP_LUA_ALLOC_DEFINED__
703 #endif
704 #else
705 #include "lua.h"
706 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
707 /* I only need this for the define of LUA_NOREF which is only needed here for my inline function which requires C99. */
708 #include "lauxlib.h"
709 #endif
710 #endif
711
713 #ifdef LUAHASHMAP_BUILD_AS_DLL
714 #ifdef WIN32
715 #define LUAHASHMAP_EXPORT __declspec(dllexport)
716 #elif defined(__GNUC__) && __GNUC__ >= 4
717 #define LUAHASHMAP_EXPORT __attribute__ ((visibility("default")))
718 #else
719 #define LUAHASHMAP_EXPORT
720 #endif
721 #else
722 #define LUAHASHMAP_EXPORT
723 #endif /* LUAHASHMAP_BUILD_AS_DLL */
724
725
727 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
728
739 {
744
745 /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
746 */
747 #define LUAHASHMAP_MAJOR_VERSION 1
748 #define LUAHASHMAP_MINOR_VERSION 0
749 #define LUAHASHMAP_PATCHLEVEL 0
750
763 #define LUAHASHMAP_GET_COMPILED_VERSION(X) \
764 { \
765 (X)->major = LUAHASHMAP_MAJOR_VERSION; \
766 (X)->minor = LUAHASHMAP_MINOR_VERSION; \
767 (X)->patch = LUAHASHMAP_PATCHLEVEL; \
768 }
769
794
796
798
799 /* This exists because anonymous inline structs are not available until C11 */
801 {
804 };
805
807
808
809 /* This exists because anonymous inline unions are not available until C11 */
811 {
812 /* const char* theString; */
813 /* If the size of lua_Number is the same or greater than the StringContainer, we succeed in saving some space using a union.
814 * This can happen in 32-bit where double is 8-bytes and size_t + pointer is 4-bytes + 4-bytes == 8 bytes. */
817 /* lua_Integer theInteger; */
819 };
820
837 {
838 /* These are all implementation details.
839 * You should probably not directly touch.
840 */
849 };
850
865
880
917
951
952
964
965
983
1012
1013
1024
1037
1047
1048
1049
1050
1055 /* Key String family */
1174
1175
1176 /* Key Pointer family */
1234
1235
1236 /* Key Number family */
1294
1295
1296 /* Key Integer family */
1354
1361 /* GetValueForKey family functions */
1362
1363 /* Key String family */
1477
1478
1479 /* Key Pointer family */
1547
1548
1549 /* Key Number family */
1617
1618
1619 /* Key Integer family */
1687
1688
1696 /* Exists Functions*/
1764
1840
1848
1853 /* Iterator functions */
1854
1894
1895
1915
2069
2070 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
2071 /* Use the C99 inline if available to hint the compiler that this might benefit from inlining.
2072 * Since these functions are merely pulling data out of an already exposed struct, inlining seems reasonable.
2073 */
2083 {
2084 if(NULL == hash_iterator)
2085 {
2086 return true;
2087 }
2088 /* To make this distinct from a good iterator and an end iterator, whichTable==LUA_NOREF seems to be the only unique characteristic. */
2090 {
2091 return true;
2092 }
2093 else
2094 {
2095 return false;
2096 }
2097 }
2098 #else /* We are not using C99 inline so the standard declaration is here. */
2099
2108 #endif /* defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) */
2109
2120
2121
2122 /* SetValueAtIterator family */
2186
2187
2188
2189
2252
2253
2254
2255 /* LuaHashMapIterator struct accessor functions. */
2256
2272
2294
2295
2296 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
2297 /* Use the C99 inline if available to hint the compiler that this might benefit from inlining.
2298 * Since these functions are merely pulling data out of an already exposed struct, inlining seems reasonable.
2299 */
2300
2320 {
2321 if(NULL == hash_iterator)
2322 {
2323 return LUA_TNONE;
2324 }
2325 return hash_iterator->
keyType;
2326 }
2327
2340 {
2341 if(NULL == hash_iterator)
2342 {
2343 return NULL;
2344 }
2345 if(
true == hash_iterator->
atEnd)
2346 {
2347 return NULL;
2348 }
2349 if(
true == hash_iterator->
isNext)
2350 {
2351 return NULL;
2352 }
2353 if(LUA_TSTRING == hash_iterator->
keyType)
2354 {
2356 }
2357 else
2358 {
2359 /* shouldn't get here */
2360 /* LUAHASHMAP_ASSERT(false); */
2361 return NULL;
2362 }
2363 }
2377 {
2378 if(NULL == hash_iterator)
2379 {
2380 if(NULL != key_string_length_return)
2381 {
2382 *key_string_length_return = 0;
2383 }
2384 return NULL;
2385 }
2386 if(true == hash_iterator->atEnd)
2387 {
2388 if(NULL != key_string_length_return)
2389 {
2390 *key_string_length_return = 0;
2391 }
2392 return NULL;
2393 }
2394 if(true == hash_iterator->isNext)
2395 {
2396 if(NULL != key_string_length_return)
2397 {
2398 *key_string_length_return = 0;
2399 }
2400 return NULL;
2401 }
2402
2403 if(NULL != key_string_length_return)
2404 {
2405 *key_string_length_return = hash_iterator->currentKey.theString.stringLength;
2406 }
2407
2408 if(LUA_TSTRING == hash_iterator->keyType)
2409 {
2410 return hash_iterator->currentKey.theString.stringPointer;
2411 }
2412 else
2413 {
2414 /* shouldn't get here */
2415 /* LUAHASHMAP_ASSERT(false); */
2416 return NULL;
2417 }
2418 }
2429 {
2430 if(NULL == hash_iterator)
2431 {
2432 return 0;
2433 }
2434 if(
true == hash_iterator->
atEnd)
2435 {
2436 return 0;
2437 }
2438 if(
true == hash_iterator->
isNext)
2439 {
2440 return 0;
2441 }
2442
2443 if(LUA_TSTRING == hash_iterator->
keyType)
2444 {
2446 }
2447 else
2448 {
2449 /* shouldn't get here */
2450 /* LUAHASHMAP_ASSERT(false); */
2451 return 0;
2452 }
2453 }
2465 {
2466 if(NULL == hash_iterator)
2467 {
2468 return NULL;
2469 }
2470 if(
true == hash_iterator->
atEnd)
2471 {
2472 return NULL;
2473 }
2474 if(
true == hash_iterator->
isNext)
2475 {
2476 return NULL;
2477 }
2478
2479 if(LUA_TLIGHTUSERDATA == hash_iterator->
keyType)
2480 {
2482 }
2483 else
2484 {
2485 /* shouldn't get here */
2486 /* LUAHASHMAP_ASSERT(false); */
2487 return NULL;
2488 }
2489 }
2501 {
2502 if(NULL == hash_iterator)
2503 {
2504 return 0.0;
2505 }
2506 if(
true == hash_iterator->
atEnd)
2507 {
2508 return 0.0;
2509 }
2510 if(
true == hash_iterator->
isNext)
2511 {
2512 return 0.0;
2513 }
2514
2515 if(LUA_TNUMBER == hash_iterator->
keyType)
2516 {
2518 }
2519 else
2520 {
2521 /* shouldn't get here */
2522 /* LUAHASHMAP_ASSERT(false); */
2523 return 0.0;
2524 }
2525 }
2537 {
2538 if(NULL == hash_iterator)
2539 {
2540 return 0;
2541 }
2542 if(
true == hash_iterator->
atEnd)
2543 {
2544 return 0;
2545 }
2546 if(
true == hash_iterator->
isNext)
2547 {
2548 return 0;
2549 }
2550
2551 if(LUA_TNUMBER == hash_iterator->
keyType)
2552 {
2554 }
2555 else
2556 {
2557 /* shouldn't get here */
2558 /* LUAHASHMAP_ASSERT(false); */
2559 return 0;
2560 }
2561 }
2562
2563
2585 {
2586 if(NULL == hash_iterator)
2587 {
2588 return LUA_TNONE;
2589 }
2590 if(
true == hash_iterator->
atEnd)
2591 {
2592 return LUA_TNONE;
2593 }
2594 if(
true == hash_iterator->
isNext)
2595 {
2596 return LUA_TNONE;
2597 }
2598
2600 }
2614 {
2615 if(NULL == hash_iterator)
2616 {
2617 return NULL;
2618 }
2619 if(
true == hash_iterator->
atEnd)
2620 {
2621 return NULL;
2622 }
2623 if(
true == hash_iterator->
isNext)
2624 {
2625 return NULL;
2626 }
2627 if(LUA_TSTRING != hash_iterator->
valueType)
2628 {
2629 return NULL;
2630 }
2632 }
2648 {
2649 if(NULL == hash_iterator)
2650 {
2651 if(NULL != value_string_length_return)
2652 {
2653 *value_string_length_return = 0;
2654 }
2655 return NULL;
2656 }
2657 if(true == hash_iterator->atEnd)
2658 {
2659 if(NULL != value_string_length_return)
2660 {
2661 *value_string_length_return = 0;
2662 }
2663 return NULL;
2664 }
2665 if(true == hash_iterator->isNext)
2666 {
2667 if(NULL != value_string_length_return)
2668 {
2669 *value_string_length_return = 0;
2670 }
2671 return NULL;
2672 }
2673 if(LUA_TSTRING != hash_iterator->valueType)
2674 {
2675 if(NULL != value_string_length_return)
2676 {
2677 *value_string_length_return = 0;
2678 }
2679 return NULL;
2680 }
2681
2682 if(NULL != value_string_length_return)
2683 {
2684 *value_string_length_return = hash_iterator->currentKey.theString.stringLength;
2685 }
2686
2687 return hash_iterator->currentValue.theString.stringPointer;
2688 }
2699 {
2700 if(NULL == hash_iterator)
2701 {
2702 return 0;
2703 }
2704 if(
true == hash_iterator->
atEnd)
2705 {
2706 return 0;
2707 }
2708 if(
true == hash_iterator->
isNext)
2709 {
2710 return 0;
2711 }
2712 if(LUA_TSTRING != hash_iterator->
valueType)
2713 {
2714 return 0;
2715 }
2717 }
2732 {
2733 if(NULL == hash_iterator)
2734 {
2735 return NULL;
2736 }
2737 if(
true == hash_iterator->
atEnd)
2738 {
2739 return NULL;
2740 }
2741 if(
true == hash_iterator->
isNext)
2742 {
2743 return NULL;
2744 }
2745 if(LUA_TLIGHTUSERDATA != hash_iterator->
valueType)
2746 {
2747 return NULL;
2748 }
2750 }
2765 {
2766 if(NULL == hash_iterator)
2767 {
2768 return 0.0;
2769 }
2770 if(
true == hash_iterator->
atEnd)
2771 {
2772 return 0.0;
2773 }
2774 if(
true == hash_iterator->
isNext)
2775 {
2776 return 0.0;
2777 }
2778 if(LUA_TNUMBER != hash_iterator->
valueType)
2779 {
2780 return 0.0;
2781 }
2783 }
2798 {
2799 if(NULL == hash_iterator)
2800 {
2801 return 0;
2802 }
2803 if(
true == hash_iterator->
atEnd)
2804 {
2805 return 0;
2806 }
2807 if(
true == hash_iterator->
isNext)
2808 {
2809 return 0;
2810 }
2811 if(LUA_TNUMBER != hash_iterator->
valueType)
2812 {
2813 return 0;
2814 }
2816 }
2817
2818 #else /* We are not using C99 inline so the standard declaration is here. */
2819
2839
2908
2909
2931
3013 #endif /* defined(__STDC_VERSION__) && (__STDC_VERSION__ > 199901L) */
3014
3019 /* Experimental Functions: These might be removed, modified, or made permanent. */
3020
3029
3030
3031 /* C11 introduces _Generic which presents some interesting possibilities. */
3032 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
3033 #define LUAHASHMAP_SHOULD_USE_C_GENERICS 1
3034 #elif defined(__clang__)
3035 /* Needed to break up test into multiple lines because the Visual Studio preprocessor wasn't doing short-circuit evaluation and was trying to process __has_feature */
3036 #if __has_feature(c_generic_selections) || __has_extension(c_generic_selections)
3037 #define LUAHASHMAP_SHOULD_USE_C_GENERICS 1
3038 #endif
3039 #else
3040 #define LUAHASHMAP_SHOULD_USE_C_GENERICS 0
3041 #endif
3042
3043 #if LUAHASHMAP_SHOULD_USE_C_GENERICS
3044
3059 #define LuaHashMap_SetValueForKey(hash_map, value, key) \
3060 _Generic((hash_map), LuaHashMap*: _Generic((value), \
3061 const char*: _Generic((key), \
3062 const char*: LuaHashMap_SetValueStringForKeyString, \
3063 char*: LuaHashMap_SetValueStringForKeyString, \
3064 void*: LuaHashMap_SetValueStringForKeyPointer, \
3065 float: LuaHashMap_SetValueStringForKeyNumber, \
3066 double: LuaHashMap_SetValueStringForKeyNumber, \
3067 long double: LuaHashMap_SetValueStringForKeyNumber, \
3068 char: LuaHashMap_SetValueStringForKeyInteger, \
3069 unsigned char: LuaHashMap_SetValueStringForKeyInteger, \
3070 short: LuaHashMap_SetValueStringForKeyInteger, \
3071 unsigned short: LuaHashMap_SetValueStringForKeyInteger, \
3072 int: LuaHashMap_SetValueStringForKeyInteger, \
3073 unsigned int: LuaHashMap_SetValueStringForKeyInteger, \
3074 long: LuaHashMap_SetValueStringForKeyInteger, \
3075 unsigned long: LuaHashMap_SetValueStringForKeyInteger, \
3076 default: LuaHashMap_SetValueStringForKeyPointer),\
3077 char*: _Generic((key), \
3078 const char*: LuaHashMap_SetValueStringForKeyString, \
3079 char*: LuaHashMap_SetValueStringForKeyString, \
3080 void*: LuaHashMap_SetValueStringForKeyPointer, \
3081 float: LuaHashMap_SetValueStringForKeyNumber, \
3082 double: LuaHashMap_SetValueStringForKeyNumber, \
3083 long double: LuaHashMap_SetValueStringForKeyNumber, \
3084 char: LuaHashMap_SetValueStringForKeyInteger, \
3085 unsigned char: LuaHashMap_SetValueStringForKeyInteger, \
3086 short: LuaHashMap_SetValueStringForKeyInteger, \
3087 unsigned short: LuaHashMap_SetValueStringForKeyInteger, \
3088 int: LuaHashMap_SetValueStringForKeyInteger, \
3089 unsigned int: LuaHashMap_SetValueStringForKeyInteger, \
3090 long: LuaHashMap_SetValueStringForKeyInteger, \
3091 unsigned long: LuaHashMap_SetValueStringForKeyInteger, \
3092 default: LuaHashMap_SetValueStringForKeyPointer),\
3093 void*: _Generic((key), \
3094 const char*: LuaHashMap_SetValuePointerForKeyString, \
3095 char*: LuaHashMap_SetValuePointerForKeyString, \
3096 void*: LuaHashMap_SetValuePointerForKeyPointer, \
3097 float: LuaHashMap_SetValuePointerForKeyNumber, \
3098 double: LuaHashMap_SetValuePointerForKeyNumber, \
3099 long double: LuaHashMap_SetValuePointerForKeyNumber, \
3100 char: LuaHashMap_SetValuePointerForKeyInteger, \
3101 unsigned char: LuaHashMap_SetValuePointerForKeyInteger, \
3102 short: LuaHashMap_SetValuePointerForKeyInteger, \
3103 unsigned short: LuaHashMap_SetValuePointerForKeyInteger, \
3104 int: LuaHashMap_SetValuePointerForKeyInteger, \
3105 unsigned int: LuaHashMap_SetValuePointerForKeyInteger, \
3106 long: LuaHashMap_SetValuePointerForKeyInteger, \
3107 unsigned long: LuaHashMap_SetValuePointerForKeyInteger, \
3108 default: LuaHashMap_SetValuePointerForKeyPointer),\
3109 float: _Generic((key), \
3110 const char*: LuaHashMap_SetValueNumberForKeyString, \
3111 char*: LuaHashMap_SetValueNumberForKeyString, \
3112 void*: LuaHashMap_SetValueNumberForKeyPointer, \
3113 float: LuaHashMap_SetValueNumberForKeyNumber, \
3114 double: LuaHashMap_SetValueNumberForKeyNumber, \
3115 long double: LuaHashMap_SetValueNumberForKeyNumber, \
3116 char: LuaHashMap_SetValueNumberForKeyInteger, \
3117 unsigned char: LuaHashMap_SetValueNumberForKeyInteger, \
3118 short: LuaHashMap_SetValueNumberForKeyInteger, \
3119 unsigned short: LuaHashMap_SetValueNumberForKeyInteger, \
3120 int: LuaHashMap_SetValueNumberForKeyInteger, \
3121 unsigned int: LuaHashMap_SetValueNumberForKeyInteger, \
3122 long: LuaHashMap_SetValueNumberForKeyInteger, \
3123 unsigned long: LuaHashMap_SetValueNumberForKeyInteger, \
3124 default: LuaHashMap_SetValueNumberForKeyPointer),\
3125 double: _Generic((key), \
3126 const char*: LuaHashMap_SetValueNumberForKeyString, \
3127 char*: LuaHashMap_SetValueNumberForKeyString, \
3128 void*: LuaHashMap_SetValueNumberForKeyPointer, \
3129 float: LuaHashMap_SetValueNumberForKeyNumber, \
3130 double: LuaHashMap_SetValueNumberForKeyNumber, \
3131 long double: LuaHashMap_SetValueNumberForKeyNumber, \
3132 char: LuaHashMap_SetValueNumberForKeyInteger, \
3133 unsigned char: LuaHashMap_SetValueNumberForKeyInteger, \
3134 short: LuaHashMap_SetValueNumberForKeyInteger, \
3135 unsigned short: LuaHashMap_SetValueNumberForKeyInteger, \
3136 int: LuaHashMap_SetValueNumberForKeyInteger, \
3137 unsigned int: LuaHashMap_SetValueNumberForKeyInteger, \
3138 long: LuaHashMap_SetValueNumberForKeyInteger, \
3139 unsigned long: LuaHashMap_SetValueNumberForKeyInteger, \
3140 default: LuaHashMap_SetValueNumberForKeyPointer),\
3141 long double: _Generic((key), \
3142 const char*: LuaHashMap_SetValueNumberForKeyString, \
3143 char*: LuaHashMap_SetValueNumberForKeyString, \
3144 void*: LuaHashMap_SetValueNumberForKeyPointer, \
3145 float: LuaHashMap_SetValueNumberForKeyNumber, \
3146 double: LuaHashMap_SetValueNumberForKeyNumber, \
3147 long double: LuaHashMap_SetValueNumberForKeyNumber, \
3148 char: LuaHashMap_SetValueNumberForKeyInteger, \
3149 unsigned char: LuaHashMap_SetValueNumberForKeyInteger, \
3150 short: LuaHashMap_SetValueNumberForKeyInteger, \
3151 unsigned short: LuaHashMap_SetValueNumberForKeyInteger, \
3152 int: LuaHashMap_SetValueNumberForKeyInteger, \
3153 unsigned int: LuaHashMap_SetValueNumberForKeyInteger, \
3154 long: LuaHashMap_SetValueNumberForKeyInteger, \
3155 unsigned long: LuaHashMap_SetValueNumberForKeyInteger, \
3156 default: LuaHashMap_SetValueNumberForKeyPointer),\
3157 char: _Generic((key), \
3158 const char*: LuaHashMap_SetValueIntegerForKeyString, \
3159 char*: LuaHashMap_SetValueIntegerForKeyString, \
3160 void*: LuaHashMap_SetValueIntegerForKeyPointer, \
3161 float: LuaHashMap_SetValueIntegerForKeyNumber, \
3162 double: LuaHashMap_SetValueIntegerForKeyNumber, \
3163 long double: LuaHashMap_SetValueIntegerForKeyNumber, \
3164 char: LuaHashMap_SetValueIntegerForKeyInteger, \
3165 unsigned char: LuaHashMap_SetValueIntegerForKeyInteger, \
3166 short: LuaHashMap_SetValueIntegerForKeyInteger, \
3167 unsigned short: LuaHashMap_SetValueIntegerForKeyInteger, \
3168 int: LuaHashMap_SetValueIntegerForKeyInteger, \
3169 unsigned int: LuaHashMap_SetValueIntegerForKeyInteger, \
3170 long: LuaHashMap_SetValueIntegerForKeyInteger, \
3171 unsigned long: LuaHashMap_SetValueIntegerForKeyInteger, \
3172 default: LuaHashMap_SetValueIntegerForKeyPointer), \
3173 unsigned char: _Generic((key), \
3174 const char*: LuaHashMap_SetValueIntegerForKeyString, \
3175 char*: LuaHashMap_SetValueIntegerForKeyString, \
3176 void*: LuaHashMap_SetValueIntegerForKeyPointer, \
3177 float: LuaHashMap_SetValueIntegerForKeyNumber, \
3178 double: LuaHashMap_SetValueIntegerForKeyNumber, \
3179 long double: LuaHashMap_SetValueIntegerForKeyNumber, \
3180 char: LuaHashMap_SetValueIntegerForKeyInteger, \
3181 unsigned char: LuaHashMap_SetValueIntegerForKeyInteger, \
3182 short: LuaHashMap_SetValueIntegerForKeyInteger, \
3183 unsigned short: LuaHashMap_SetValueIntegerForKeyInteger, \
3184 int: LuaHashMap_SetValueIntegerForKeyInteger, \
3185 unsigned int: LuaHashMap_SetValueIntegerForKeyInteger, \
3186 long: LuaHashMap_SetValueIntegerForKeyInteger, \
3187 unsigned long: LuaHashMap_SetValueIntegerForKeyInteger, \
3188 default: LuaHashMap_SetValueIntegerForKeyPointer), \
3189 short: _Generic((key), \
3190 const char*: LuaHashMap_SetValueIntegerForKeyString, \
3191 char*: LuaHashMap_SetValueIntegerForKeyString, \
3192 void*: LuaHashMap_SetValueIntegerForKeyPointer, \
3193 float: LuaHashMap_SetValueIntegerForKeyNumber, \
3194 double: LuaHashMap_SetValueIntegerForKeyNumber, \
3195 long double: LuaHashMap_SetValueIntegerForKeyNumber, \
3196 char: LuaHashMap_SetValueIntegerForKeyInteger, \
3197 unsigned char: LuaHashMap_SetValueIntegerForKeyInteger, \
3198 short: LuaHashMap_SetValueIntegerForKeyInteger, \
3199 unsigned short: LuaHashMap_SetValueIntegerForKeyInteger, \
3200 int: LuaHashMap_SetValueIntegerForKeyInteger, \
3201 unsigned int: LuaHashMap_SetValueIntegerForKeyInteger, \
3202 long: LuaHashMap_SetValueIntegerForKeyInteger, \
3203 unsigned long: LuaHashMap_SetValueIntegerForKeyInteger, \
3204 default: LuaHashMap_SetValueIntegerForKeyPointer), \
3205 unsigned short: _Generic((key), \
3206 const char*: LuaHashMap_SetValueIntegerForKeyString, \
3207 char*: LuaHashMap_SetValueIntegerForKeyString, \
3208 void*: LuaHashMap_SetValueIntegerForKeyPointer, \
3209 float: LuaHashMap_SetValueIntegerForKeyNumber, \
3210 double: LuaHashMap_SetValueIntegerForKeyNumber, \
3211 long double: LuaHashMap_SetValueIntegerForKeyNumber, \
3212 char: LuaHashMap_SetValueIntegerForKeyInteger, \
3213 unsigned char: LuaHashMap_SetValueIntegerForKeyInteger, \
3214 short: LuaHashMap_SetValueIntegerForKeyInteger, \
3215 unsigned short: LuaHashMap_SetValueIntegerForKeyInteger, \
3216 int: LuaHashMap_SetValueIntegerForKeyInteger, \
3217 unsigned int: LuaHashMap_SetValueIntegerForKeyInteger, \
3218 long: LuaHashMap_SetValueIntegerForKeyInteger, \
3219 unsigned long: LuaHashMap_SetValueIntegerForKeyInteger, \
3220 default: LuaHashMap_SetValueIntegerForKeyPointer), \
3221 int: _Generic((key), \
3222 const char*: LuaHashMap_SetValueIntegerForKeyString, \
3223 char*: LuaHashMap_SetValueIntegerForKeyString, \
3224 void*: LuaHashMap_SetValueIntegerForKeyPointer, \
3225 float: LuaHashMap_SetValueIntegerForKeyNumber, \
3226 double: LuaHashMap_SetValueIntegerForKeyNumber, \
3227 long double: LuaHashMap_SetValueIntegerForKeyNumber, \
3228 char: LuaHashMap_SetValueIntegerForKeyInteger, \
3229 unsigned char: LuaHashMap_SetValueIntegerForKeyInteger, \
3230 short: LuaHashMap_SetValueIntegerForKeyInteger, \
3231 unsigned short: LuaHashMap_SetValueIntegerForKeyInteger, \
3232 int: LuaHashMap_SetValueIntegerForKeyInteger, \
3233 unsigned int: LuaHashMap_SetValueIntegerForKeyInteger, \
3234 long: LuaHashMap_SetValueIntegerForKeyInteger, \
3235 unsigned long: LuaHashMap_SetValueIntegerForKeyInteger, \
3236 default: LuaHashMap_SetValueIntegerForKeyPointer), \
3237 unsigned int: _Generic((key), \
3238 const char*: LuaHashMap_SetValueIntegerForKeyString, \
3239 char*: LuaHashMap_SetValueIntegerForKeyString, \
3240 void*: LuaHashMap_SetValueIntegerForKeyPointer, \
3241 float: LuaHashMap_SetValueIntegerForKeyNumber, \
3242 double: LuaHashMap_SetValueIntegerForKeyNumber, \
3243 long double: LuaHashMap_SetValueIntegerForKeyNumber, \
3244 char: LuaHashMap_SetValueIntegerForKeyInteger, \
3245 unsigned char: LuaHashMap_SetValueIntegerForKeyInteger, \
3246 short: LuaHashMap_SetValueIntegerForKeyInteger, \
3247 unsigned short: LuaHashMap_SetValueIntegerForKeyInteger, \
3248 int: LuaHashMap_SetValueIntegerForKeyInteger, \
3249 unsigned int: LuaHashMap_SetValueIntegerForKeyInteger, \
3250 long: LuaHashMap_SetValueIntegerForKeyInteger, \
3251 unsigned long: LuaHashMap_SetValueIntegerForKeyInteger, \
3252 default: LuaHashMap_SetValueIntegerForKeyPointer), \
3253 long: _Generic((key), \
3254 const char*: LuaHashMap_SetValueIntegerForKeyString, \
3255 char*: LuaHashMap_SetValueIntegerForKeyString, \
3256 void*: LuaHashMap_SetValueIntegerForKeyPointer, \
3257 float: LuaHashMap_SetValueIntegerForKeyNumber, \
3258 double: LuaHashMap_SetValueIntegerForKeyNumber, \
3259 long double: LuaHashMap_SetValueIntegerForKeyNumber, \
3260 char: LuaHashMap_SetValueIntegerForKeyInteger, \
3261 unsigned char: LuaHashMap_SetValueIntegerForKeyInteger, \
3262 short: LuaHashMap_SetValueIntegerForKeyInteger, \
3263 unsigned short: LuaHashMap_SetValueIntegerForKeyInteger, \
3264 int: LuaHashMap_SetValueIntegerForKeyInteger, \
3265 unsigned int: LuaHashMap_SetValueIntegerForKeyInteger, \
3266 long: LuaHashMap_SetValueIntegerForKeyInteger, \
3267 unsigned long: LuaHashMap_SetValueIntegerForKeyInteger, \
3268 default: LuaHashMap_SetValueIntegerForKeyPointer), \
3269 unsigned long: _Generic((key), \
3270 const char*: LuaHashMap_SetValueIntegerForKeyString, \
3271 char*: LuaHashMap_SetValueIntegerForKeyString, \
3272 void*: LuaHashMap_SetValueIntegerForKeyPointer, \
3273 float: LuaHashMap_SetValueIntegerForKeyNumber, \
3274 double: LuaHashMap_SetValueIntegerForKeyNumber, \
3275 long double: LuaHashMap_SetValueIntegerForKeyNumber, \
3276 char: LuaHashMap_SetValueIntegerForKeyInteger, \
3277 unsigned char: LuaHashMap_SetValueIntegerForKeyInteger, \
3278 short: LuaHashMap_SetValueIntegerForKeyInteger, \
3279 unsigned short: LuaHashMap_SetValueIntegerForKeyInteger, \
3280 int: LuaHashMap_SetValueIntegerForKeyInteger, \
3281 unsigned int: LuaHashMap_SetValueIntegerForKeyInteger, \
3282 long: LuaHashMap_SetValueIntegerForKeyInteger, \
3283 unsigned long: LuaHashMap_SetValueIntegerForKeyInteger, \
3284 default: LuaHashMap_SetValueIntegerForKeyPointer), \
3285 default: LuaHashMap_SetValuePointerForKeyPointer) \
3286 ) \
3287 (hash_map, value, key)
3288
3289
3301 #define LuaHashMap_SetValueForKeyWithLength(hash_map, value, key, strlength) \
3302 _Generic((hash_map), LuaHashMap*: _Generic((value), \
3303 const char*: _Generic((key), \
3304 void*: _Generic((strlength), \
3305 char: LuaHashMap_SetValueStringForKeyPointerWithLength, \
3306 unsigned char: LuaHashMap_SetValueStringForKeyPointerWithLength, \
3307 short: LuaHashMap_SetValueStringForKeyPointerWithLength, \
3308 unsigned short: LuaHashMap_SetValueStringForKeyPointerWithLength, \
3309 int: LuaHashMap_SetValueStringForKeyPointerWithLength, \
3310 unsigned int: LuaHashMap_SetValueStringForKeyPointerWithLength, \
3311 long: LuaHashMap_SetValueStringForKeyPointerWithLength, \
3312 unsigned long: LuaHashMap_SetValueStringForKeyPointerWithLength), \
3313 float: _Generic((strlength), \
3314 char: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3315 unsigned char: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3316 short: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3317 unsigned short: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3318 int: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3319 unsigned int: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3320 long: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3321 unsigned long: LuaHashMap_SetValueStringForKeyNumberWithLength), \
3322 double: _Generic((strlength), \
3323 char: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3324 unsigned char: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3325 short: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3326 unsigned short: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3327 int: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3328 unsigned int: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3329 long: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3330 unsigned long: LuaHashMap_SetValueStringForKeyNumberWithLength), \
3331 long double: _Generic((strlength), \
3332 char: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3333 unsigned char: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3334 short: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3335 unsigned short: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3336 int: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3337 unsigned int: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3338 long: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3339 unsigned long: LuaHashMap_SetValueStringForKeyNumberWithLength), \
3340 char: _Generic((strlength), \
3341 char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3342 unsigned char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3343 short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3344 unsigned short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3345 int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3346 unsigned int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3347 long: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3348 unsigned long: LuaHashMap_SetValueStringForKeyIntegerWithLength), \
3349 unsigned char: _Generic((strlength), \
3350 char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3351 unsigned char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3352 short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3353 unsigned short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3354 int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3355 unsigned int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3356 long: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3357 unsigned long: LuaHashMap_SetValueStringForKeyIntegerWithLength), \
3358 short: _Generic((strlength), \
3359 char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3360 unsigned char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3361 short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3362 unsigned short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3363 int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3364 unsigned int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3365 long: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3366 unsigned long: LuaHashMap_SetValueStringForKeyIntegerWithLength), \
3367 unsigned short: _Generic((strlength), \
3368 char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3369 unsigned char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3370 short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3371 unsigned short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3372 int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3373 unsigned int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3374 long: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3375 unsigned long: LuaHashMap_SetValueStringForKeyIntegerWithLength), \
3376 int: _Generic((strlength), \
3377 char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3378 unsigned char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3379 short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3380 unsigned short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3381 int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3382 unsigned int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3383 long: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3384 unsigned long: LuaHashMap_SetValueStringForKeyIntegerWithLength), \
3385 unsigned int: _Generic((strlength), \
3386 char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3387 unsigned char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3388 short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3389 unsigned short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3390 int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3391 unsigned int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3392 long: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3393 unsigned long: LuaHashMap_SetValueStringForKeyIntegerWithLength), \
3394 long: _Generic((strlength), \
3395 char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3396 unsigned char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3397 short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3398 unsigned short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3399 int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3400 unsigned int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3401 long: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3402 unsigned long: LuaHashMap_SetValueStringForKeyIntegerWithLength), \
3403 unsigned long: _Generic((strlength), \
3404 char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3405 unsigned char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3406 short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3407 unsigned short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3408 int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3409 unsigned int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3410 long: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3411 unsigned long: LuaHashMap_SetValueStringForKeyIntegerWithLength), \
3412 default: LuaHashMap_SetValueStringForKeyPointerWithLength), \
3413 char*: _Generic((key), \
3414 void*: _Generic((strlength), \
3415 char: LuaHashMap_SetValueStringForKeyPointerWithLength, \
3416 unsigned char: LuaHashMap_SetValueStringForKeyPointerWithLength, \
3417 short: LuaHashMap_SetValueStringForKeyPointerWithLength, \
3418 unsigned short: LuaHashMap_SetValueStringForKeyPointerWithLength, \
3419 int: LuaHashMap_SetValueStringForKeyPointerWithLength, \
3420 unsigned int: LuaHashMap_SetValueStringForKeyPointerWithLength, \
3421 long: LuaHashMap_SetValueStringForKeyPointerWithLength, \
3422 unsigned long: LuaHashMap_SetValueStringForKeyPointerWithLength), \
3423 float: _Generic((strlength), \
3424 char: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3425 unsigned char: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3426 short: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3427 unsigned short: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3428 int: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3429 unsigned int: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3430 long: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3431 unsigned long: LuaHashMap_SetValueStringForKeyNumberWithLength), \
3432 double: _Generic((strlength), \
3433 char: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3434 unsigned char: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3435 short: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3436 unsigned short: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3437 int: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3438 unsigned int: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3439 long: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3440 unsigned long: LuaHashMap_SetValueStringForKeyNumberWithLength), \
3441 long double: _Generic((strlength), \
3442 char: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3443 unsigned char: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3444 short: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3445 unsigned short: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3446 int: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3447 unsigned int: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3448 long: LuaHashMap_SetValueStringForKeyNumberWithLength, \
3449 unsigned long: LuaHashMap_SetValueStringForKeyNumberWithLength), \
3450 char: _Generic((strlength), \
3451 char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3452 unsigned char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3453 short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3454 unsigned short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3455 int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3456 unsigned int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3457 long: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3458 unsigned long: LuaHashMap_SetValueStringForKeyIntegerWithLength), \
3459 unsigned char: _Generic((strlength), \
3460 char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3461 unsigned char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3462 short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3463 unsigned short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3464 int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3465 unsigned int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3466 long: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3467 unsigned long: LuaHashMap_SetValueStringForKeyIntegerWithLength), \
3468 short: _Generic((strlength), \
3469 char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3470 unsigned char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3471 short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3472 unsigned short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3473 int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3474 unsigned int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3475 long: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3476 unsigned long: LuaHashMap_SetValueStringForKeyIntegerWithLength), \
3477 unsigned short: _Generic((strlength), \
3478 char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3479 unsigned char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3480 short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3481 unsigned short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3482 int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3483 unsigned int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3484 long: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3485 unsigned long: LuaHashMap_SetValueStringForKeyIntegerWithLength), \
3486 int: _Generic((strlength), \
3487 char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3488 unsigned char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3489 short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3490 unsigned short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3491 int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3492 unsigned int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3493 long: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3494 unsigned long: LuaHashMap_SetValueStringForKeyIntegerWithLength), \
3495 unsigned int: _Generic((strlength), \
3496 char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3497 unsigned char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3498 short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3499 unsigned short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3500 int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3501 unsigned int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3502 long: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3503 unsigned long: LuaHashMap_SetValueStringForKeyIntegerWithLength), \
3504 long: _Generic((strlength), \
3505 char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3506 unsigned char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3507 short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3508 unsigned short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3509 int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3510 unsigned int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3511 long: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3512 unsigned long: LuaHashMap_SetValueStringForKeyIntegerWithLength), \
3513 unsigned long: _Generic((strlength), \
3514 char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3515 unsigned char: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3516 short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3517 unsigned short: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3518 int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3519 unsigned int: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3520 long: LuaHashMap_SetValueStringForKeyIntegerWithLength, \
3521 unsigned long: LuaHashMap_SetValueStringForKeyIntegerWithLength), \
3522 default: LuaHashMap_SetValueStringForKeyPointerWithLength), \
3523 void*: _Generic((key), \
3524 const char*: _Generic((strlength), \
3525 char: LuaHashMap_SetValuePointerForKeyStringWithLength, \
3526 unsigned char: LuaHashMap_SetValuePointerForKeyStringWithLength, \
3527 short: LuaHashMap_SetValuePointerForKeyStringWithLength, \
3528 unsigned short: LuaHashMap_SetValuePointerForKeyStringWithLength, \
3529 int: LuaHashMap_SetValuePointerForKeyStringWithLength, \
3530 unsigned int: LuaHashMap_SetValuePointerForKeyStringWithLength, \
3531 long: LuaHashMap_SetValuePointerForKeyStringWithLength, \
3532 unsigned long: LuaHashMap_SetValuePointerForKeyStringWithLength), \
3533 char*: _Generic((strlength), \
3534 char: LuaHashMap_SetValuePointerForKeyStringWithLength, \
3535 unsigned char: LuaHashMap_SetValuePointerForKeyStringWithLength, \
3536 short: LuaHashMap_SetValuePointerForKeyStringWithLength, \
3537 unsigned short: LuaHashMap_SetValuePointerForKeyStringWithLength, \
3538 int: LuaHashMap_SetValuePointerForKeyStringWithLength, \
3539 unsigned int: LuaHashMap_SetValuePointerForKeyStringWithLength, \
3540 long: LuaHashMap_SetValuePointerForKeyStringWithLength, \
3541 unsigned long: LuaHashMap_SetValuePointerForKeyStringWithLength), \
3542 default: LuaHashMap_SetValuePointerForKeyStringWithLength), \
3543 float: _Generic((key), \
3544 const char*: _Generic((strlength), \
3545 char: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3546 unsigned char: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3547 short: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3548 unsigned short: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3549 int: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3550 unsigned int: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3551 long: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3552 unsigned long: LuaHashMap_SetValueNumberForKeyStringWithLength), \
3553 char*: _Generic((strlength), \
3554 char: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3555 unsigned char: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3556 short: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3557 unsigned short: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3558 int: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3559 unsigned int: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3560 long: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3561 unsigned long: LuaHashMap_SetValueNumberForKeyStringWithLength), \
3562 default: LuaHashMap_SetValueNumberForKeyStringWithLength), \
3563 double: _Generic((key), \
3564 const char*: _Generic((strlength), \
3565 char: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3566 unsigned char: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3567 short: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3568 unsigned short: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3569 int: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3570 unsigned int: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3571 long: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3572 unsigned long: LuaHashMap_SetValueNumberForKeyStringWithLength), \
3573 char*: _Generic((strlength), \
3574 char: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3575 unsigned char: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3576 short: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3577 unsigned short: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3578 int: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3579 unsigned int: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3580 long: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3581 unsigned long: LuaHashMap_SetValueNumberForKeyStringWithLength), \
3582 default: LuaHashMap_SetValueNumberForKeyStringWithLength), \
3583 long double: _Generic((key), \
3584 const char*: _Generic((strlength), \
3585 char: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3586 unsigned char: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3587 short: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3588 unsigned short: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3589 int: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3590 unsigned int: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3591 long: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3592 unsigned long: LuaHashMap_SetValueNumberForKeyStringWithLength), \
3593 char*: _Generic((strlength), \
3594 char: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3595 unsigned char: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3596 short: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3597 unsigned short: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3598 int: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3599 unsigned int: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3600 long: LuaHashMap_SetValueNumberForKeyStringWithLength, \
3601 unsigned long: LuaHashMap_SetValueNumberForKeyStringWithLength), \
3602 default: LuaHashMap_SetValueNumberForKeyStringWithLength), \
3603 char: _Generic((key), \
3604 const char*: _Generic((strlength), \
3605 char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3606 unsigned char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3607 short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3608 unsigned short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3609 int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3610 unsigned int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3611 long: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3612 unsigned long: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3613 char*: _Generic((strlength), \
3614 char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3615 unsigned char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3616 short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3617 unsigned short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3618 int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3619 unsigned int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3620 long: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3621 unsigned long: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3622 default: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3623 unsigned char: _Generic((key), \
3624 const char*: _Generic((strlength), \
3625 char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3626 unsigned char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3627 short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3628 unsigned short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3629 int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3630 unsigned int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3631 long: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3632 unsigned long: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3633 char*: _Generic((strlength), \
3634 char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3635 unsigned char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3636 short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3637 unsigned short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3638 int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3639 unsigned int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3640 long: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3641 unsigned long: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3642 default: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3643 short: _Generic((key), \
3644 const char*: _Generic((strlength), \
3645 char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3646 unsigned char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3647 short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3648 unsigned short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3649 int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3650 unsigned int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3651 long: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3652 unsigned long: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3653 char*: _Generic((strlength), \
3654 char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3655 unsigned char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3656 short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3657 unsigned short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3658 int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3659 unsigned int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3660 long: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3661 unsigned long: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3662 default: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3663 unsigned short: _Generic((key), \
3664 const char*: _Generic((strlength), \
3665 char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3666 unsigned char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3667 short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3668 unsigned short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3669 int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3670 unsigned int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3671 long: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3672 unsigned long: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3673 char*: _Generic((strlength), \
3674 char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3675 unsigned char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3676 short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3677 unsigned short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3678 int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3679 unsigned int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3680 long: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3681 unsigned long: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3682 default: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3683 int: _Generic((key), \
3684 const char*: _Generic((strlength), \
3685 char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3686 unsigned char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3687 short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3688 unsigned short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3689 int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3690 unsigned int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3691 long: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3692 unsigned long: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3693 char*: _Generic((strlength), \
3694 char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3695 unsigned char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3696 short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3697 unsigned short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3698 int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3699 unsigned int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3700 long: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3701 unsigned long: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3702 default: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3703 unsigned int: _Generic((key), \
3704 const char*: _Generic((strlength), \
3705 char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3706 unsigned char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3707 short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3708 unsigned short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3709 int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3710 unsigned int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3711 long: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3712 unsigned long: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3713 char*: _Generic((strlength), \
3714 char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3715 unsigned char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3716 short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3717 unsigned short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3718 int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3719 unsigned int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3720 long: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3721 unsigned long: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3722 default: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3723 long: _Generic((key), \
3724 const char*: _Generic((strlength), \
3725 char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3726 unsigned char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3727 short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3728 unsigned short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3729 int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3730 unsigned int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3731 long: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3732 unsigned long: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3733 char*: _Generic((strlength), \
3734 char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3735 unsigned char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3736 short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3737 unsigned short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3738 int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3739 unsigned int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3740 long: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3741 unsigned long: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3742 default: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3743 unsigned long: _Generic((key), \
3744 const char*: _Generic((strlength), \
3745 char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3746 unsigned char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3747 short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3748 unsigned short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3749 int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3750 unsigned int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3751 long: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3752 unsigned long: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3753 char*: _Generic((strlength), \
3754 char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3755 unsigned char: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3756 short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3757 unsigned short: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3758 int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3759 unsigned int: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3760 long: LuaHashMap_SetValueIntegerForKeyStringWithLength, \
3761 unsigned long: LuaHashMap_SetValueIntegerForKeyStringWithLength), \
3762 default: LuaHashMap_SetValueIntegerForKeyStringWithLength) \
3763 ) \
3764 ) \
3765 (hash_map, value, key, strlength)
3766
3767
3777 #define LuaHashMap_SetValueAtIterator(hash_iterator, value) \
3778 _Generic((hash_iterator), LuaHashMapIterator*: _Generic((value), \
3779 const char*: LuaHashMap_SetValueStringAtIterator, \
3780 char*: LuaHashMap_SetValueStringAtIterator, \
3781 void*: LuaHashMap_SetValuePointerAtIterator, \
3782 float: LuaHashMap_SetValueNumberAtIterator, \
3783 double: LuaHashMap_SetValueNumberAtIterator, \
3784 long double: LuaHashMap_SetValueNumberAtIterator, \
3785 char: LuaHashMap_SetValueIntegerAtIterator, \
3786 unsigned char: LuaHashMap_SetValueIntegerAtIterator, \
3787 short: LuaHashMap_SetValueIntegerAtIterator, \
3788 unsigned short: LuaHashMap_SetValueIntegerAtIterator, \
3789 int: LuaHashMap_SetValueIntegerAtIterator, \
3790 unsigned int: LuaHashMap_SetValueIntegerAtIterator, \
3791 long: LuaHashMap_SetValueIntegerAtIterator, \
3792 unsigned long: LuaHashMap_SetValueIntegerAtIterator, \
3793 default: LuaHashMap_SetValuePointerAtIterator) \
3794 ) \
3795 (hash_iterator, value)
3796
3797
3798
3799 /* Adapted from http://efesx.com/2010/08/31/overloading-macros */
3800 /* and http://efesx.com/2010/07/17/variadic-macro-to-count-number-of-arguments */
3801 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
3802
3803 /* Private multiple macros for each different number of arguments */
3804 /* Needed to add last parameter because it appears at least one argument needs to exist with __VA_ARGS__ with named parameters by the C99 standard */
3805 #define LUAHASHMAP_VA_NUM_ARGS(...) LUAHASHMAP_VA_NUM_ARGS_IMPL(__VA_ARGS__, 5,4,3,2,1,unused_to_suppress_pedantic_warnings)
3806 #define LUAHASHMAP_VA_NUM_ARGS_IMPL(_1,_2,_3,_4,_5,N,...) N
3807
3808 #define LUAHASHMAP_MACRO_DISPATCHER(func, ...) \
3809 LUAHASHMAP_MACRO_DISPATCHER_(func, LUAHASHMAP_VA_NUM_ARGS(__VA_ARGS__))
3810 #define LUAHASHMAP_MACRO_DISPATCHER_(func, nargs) \
3811 LUAHASHMAP_MACRO_DISPATCHER__(func, nargs)
3812 #define LUAHASHMAP_MACRO_DISPATCHER__(func, nargs) \
3813 func ## nargs
3814
3816 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
3817
3818
3819 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
3820
3821 /* Private multiple macros for each different number of arguments */
3822 #define LUAHASHMAP_SETVALUE_5(A,B,C,D,E) LuaHashMap_SetValueStringForKeyStringWithLength(A,B,C,D,E)
3823 #define LUAHASHMAP_SETVALUE_4(A,B,C,D) LuaHashMap_SetValueForKeyWithLength(A,B,C,D)
3824 /* I wanted to recursively reuse LuaHashMap_SetValueForKey, but clang gives me an undefined symbol error.
3825 * Maybe this is a clang bug? So I end up with a big copy-and-paste duplication.
3826 * Also, omitting the defaults in this case gives me compile errors.
3827 */
3828 #define LUAHASHMAP_SETVALUE_3(A,B,C) \
3829 _Generic((A), \
3830 LuaHashMap*: _Generic((B), \
3831 const char*: _Generic((C), \
3832 const char*: LuaHashMap_SetValueStringForKeyString, \
3833 char*: LuaHashMap_SetValueStringForKeyString, \
3834 void*: LuaHashMap_SetValueStringForKeyPointer, \
3835 float: LuaHashMap_SetValueStringForKeyNumber, \
3836 double: LuaHashMap_SetValueStringForKeyNumber, \
3837 long double: LuaHashMap_SetValueStringForKeyNumber, \
3838 char: LuaHashMap_SetValueStringForKeyInteger, \
3839 unsigned char: LuaHashMap_SetValueStringForKeyInteger, \
3840 short: LuaHashMap_SetValueStringForKeyInteger, \
3841 unsigned short: LuaHashMap_SetValueStringForKeyInteger, \
3842 int: LuaHashMap_SetValueStringForKeyInteger, \
3843 unsigned int: LuaHashMap_SetValueStringForKeyInteger, \
3844 long: LuaHashMap_SetValueStringForKeyInteger, \
3845 unsigned long: LuaHashMap_SetValueStringForKeyInteger, \
3846 default: LuaHashMap_SetValueStringForKeyPointer),\
3847 char*: _Generic((C), \
3848 const char*: LuaHashMap_SetValueStringForKeyString, \
3849 char*: LuaHashMap_SetValueStringForKeyString, \
3850 void*: LuaHashMap_SetValueStringForKeyPointer, \
3851 float: LuaHashMap_SetValueStringForKeyNumber, \
3852 double: LuaHashMap_SetValueStringForKeyNumber, \
3853 long double: LuaHashMap_SetValueStringForKeyNumber, \
3854 char: LuaHashMap_SetValueStringForKeyInteger, \
3855 unsigned char: LuaHashMap_SetValueStringForKeyInteger, \
3856 short: LuaHashMap_SetValueStringForKeyInteger, \
3857 unsigned short: LuaHashMap_SetValueStringForKeyInteger, \
3858 int: LuaHashMap_SetValueStringForKeyInteger, \
3859 unsigned int: LuaHashMap_SetValueStringForKeyInteger, \
3860 long: LuaHashMap_SetValueStringForKeyInteger, \
3861 unsigned long: LuaHashMap_SetValueStringForKeyInteger, \
3862 default: LuaHashMap_SetValueStringForKeyPointer),\
3863 void*: _Generic((C), \
3864 const char*: LuaHashMap_SetValuePointerForKeyString, \
3865 char*: LuaHashMap_SetValuePointerForKeyString, \
3866 void*: LuaHashMap_SetValuePointerForKeyPointer, \
3867 float: LuaHashMap_SetValuePointerForKeyNumber, \
3868 double: LuaHashMap_SetValuePointerForKeyNumber, \
3869 long double: LuaHashMap_SetValuePointerForKeyNumber, \
3870 char: LuaHashMap_SetValuePointerForKeyInteger, \
3871 unsigned char: LuaHashMap_SetValuePointerForKeyInteger, \
3872 short: LuaHashMap_SetValuePointerForKeyInteger, \
3873 unsigned short: LuaHashMap_SetValuePointerForKeyInteger, \
3874 int: LuaHashMap_SetValuePointerForKeyInteger, \
3875 unsigned int: LuaHashMap_SetValuePointerForKeyInteger, \
3876 long: LuaHashMap_SetValuePointerForKeyInteger, \
3877 unsigned long: LuaHashMap_SetValuePointerForKeyInteger, \
3878 default: LuaHashMap_SetValuePointerForKeyPointer),\
3879 float: _Generic((C), \
3880 const char*: LuaHashMap_SetValueNumberForKeyString, \
3881 char*: LuaHashMap_SetValueNumberForKeyString, \
3882 void*: LuaHashMap_SetValueNumberForKeyPointer, \
3883 float: LuaHashMap_SetValueNumberForKeyNumber, \
3884 double: LuaHashMap_SetValueNumberForKeyNumber, \
3885 long double: LuaHashMap_SetValueNumberForKeyNumber, \
3886 char: LuaHashMap_SetValueNumberForKeyInteger, \
3887 unsigned char: LuaHashMap_SetValueNumberForKeyInteger, \
3888 short: LuaHashMap_SetValueNumberForKeyInteger, \
3889 unsigned short: LuaHashMap_SetValueNumberForKeyInteger, \
3890 int: LuaHashMap_SetValueNumberForKeyInteger, \
3891 unsigned int: LuaHashMap_SetValueNumberForKeyInteger, \
3892 long: LuaHashMap_SetValueNumberForKeyInteger, \
3893 unsigned long: LuaHashMap_SetValueNumberForKeyInteger, \
3894 default: LuaHashMap_SetValueNumberForKeyPointer),\
3895 double: _Generic((C), \
3896 const char*: LuaHashMap_SetValueNumberForKeyString, \
3897 char*: LuaHashMap_SetValueNumberForKeyString, \
3898 void*: LuaHashMap_SetValueNumberForKeyPointer, \
3899 float: LuaHashMap_SetValueNumberForKeyNumber, \
3900 double: LuaHashMap_SetValueNumberForKeyNumber, \
3901 long double: LuaHashMap_SetValueNumberForKeyNumber, \
3902 char: LuaHashMap_SetValueNumberForKeyInteger, \
3903 unsigned char: LuaHashMap_SetValueNumberForKeyInteger, \
3904 short: LuaHashMap_SetValueNumberForKeyInteger, \
3905 unsigned short: LuaHashMap_SetValueNumberForKeyInteger, \
3906 int: LuaHashMap_SetValueNumberForKeyInteger, \
3907 unsigned int: LuaHashMap_SetValueNumberForKeyInteger, \
3908 long: LuaHashMap_SetValueNumberForKeyInteger, \
3909 unsigned long: LuaHashMap_SetValueNumberForKeyInteger, \
3910 default: LuaHashMap_SetValueNumberForKeyPointer),\
3911 long double: _Generic((C), \
3912 const char*: LuaHashMap_SetValueNumberForKeyString, \
3913 char*: LuaHashMap_SetValueNumberForKeyString, \
3914 void*: LuaHashMap_SetValueNumberForKeyPointer, \
3915 float: LuaHashMap_SetValueNumberForKeyNumber, \
3916 double: LuaHashMap_SetValueNumberForKeyNumber, \
3917 long double: LuaHashMap_SetValueNumberForKeyNumber, \
3918 char: LuaHashMap_SetValueNumberForKeyInteger, \
3919 unsigned char: LuaHashMap_SetValueNumberForKeyInteger, \
3920 short: LuaHashMap_SetValueNumberForKeyInteger, \
3921 unsigned short: LuaHashMap_SetValueNumberForKeyInteger, \
3922 int: LuaHashMap_SetValueNumberForKeyInteger, \
3923 unsigned int: LuaHashMap_SetValueNumberForKeyInteger, \
3924 long: LuaHashMap_SetValueNumberForKeyInteger, \
3925 unsigned long: LuaHashMap_SetValueNumberForKeyInteger, \
3926 default: LuaHashMap_SetValueNumberForKeyPointer),\
3927 char: _Generic((C), \
3928 const char*: LuaHashMap_SetValueIntegerForKeyString, \
3929 char*: LuaHashMap_SetValueIntegerForKeyString, \
3930 void*: LuaHashMap_SetValueIntegerForKeyPointer, \
3931 float: LuaHashMap_SetValueIntegerForKeyNumber, \
3932 double: LuaHashMap_SetValueIntegerForKeyNumber, \
3933 long double: LuaHashMap_SetValueIntegerForKeyNumber, \
3934 char: LuaHashMap_SetValueIntegerForKeyInteger, \
3935 unsigned char: LuaHashMap_SetValueIntegerForKeyInteger, \
3936 short: LuaHashMap_SetValueIntegerForKeyInteger, \
3937 unsigned short: LuaHashMap_SetValueIntegerForKeyInteger, \
3938 int: LuaHashMap_SetValueIntegerForKeyInteger, \
3939 unsigned int: LuaHashMap_SetValueIntegerForKeyInteger, \
3940 long: LuaHashMap_SetValueIntegerForKeyInteger, \
3941 unsigned long: LuaHashMap_SetValueIntegerForKeyInteger, \
3942 default: LuaHashMap_SetValueIntegerForKeyPointer), \
3943 unsigned char: _Generic((C), \
3944 const char*: LuaHashMap_SetValueIntegerForKeyString, \
3945 char*: LuaHashMap_SetValueIntegerForKeyString, \
3946 void*: LuaHashMap_SetValueIntegerForKeyPointer, \
3947 float: LuaHashMap_SetValueIntegerForKeyNumber, \
3948 double: LuaHashMap_SetValueIntegerForKeyNumber, \
3949 long double: LuaHashMap_SetValueIntegerForKeyNumber, \
3950 char: LuaHashMap_SetValueIntegerForKeyInteger, \
3951 unsigned char: LuaHashMap_SetValueIntegerForKeyInteger, \
3952 short: LuaHashMap_SetValueIntegerForKeyInteger, \
3953 unsigned short: LuaHashMap_SetValueIntegerForKeyInteger, \
3954 int: LuaHashMap_SetValueIntegerForKeyInteger, \
3955 unsigned int: LuaHashMap_SetValueIntegerForKeyInteger, \
3956 long: LuaHashMap_SetValueIntegerForKeyInteger, \
3957 unsigned long: LuaHashMap_SetValueIntegerForKeyInteger, \
3958 default: LuaHashMap_SetValueIntegerForKeyPointer), \
3959 short: _Generic((C), \
3960 const char*: LuaHashMap_SetValueIntegerForKeyString, \
3961 char*: LuaHashMap_SetValueIntegerForKeyString, \
3962 void*: LuaHashMap_SetValueIntegerForKeyPointer, \
3963 float: LuaHashMap_SetValueIntegerForKeyNumber, \
3964 double: LuaHashMap_SetValueIntegerForKeyNumber, \
3965 long double: LuaHashMap_SetValueIntegerForKeyNumber, \
3966 char: LuaHashMap_SetValueIntegerForKeyInteger, \
3967 unsigned char: LuaHashMap_SetValueIntegerForKeyInteger, \
3968 short: LuaHashMap_SetValueIntegerForKeyInteger, \
3969 unsigned short: LuaHashMap_SetValueIntegerForKeyInteger, \
3970 int: LuaHashMap_SetValueIntegerForKeyInteger, \
3971 unsigned int: LuaHashMap_SetValueIntegerForKeyInteger, \
3972 long: LuaHashMap_SetValueIntegerForKeyInteger, \
3973 unsigned long: LuaHashMap_SetValueIntegerForKeyInteger, \
3974 default: LuaHashMap_SetValueIntegerForKeyPointer), \
3975 unsigned short: _Generic((C), \
3976 const char*: LuaHashMap_SetValueIntegerForKeyString, \
3977 char*: LuaHashMap_SetValueIntegerForKeyString, \
3978 void*: LuaHashMap_SetValueIntegerForKeyPointer, \
3979 float: LuaHashMap_SetValueIntegerForKeyNumber, \
3980 double: LuaHashMap_SetValueIntegerForKeyNumber, \
3981 long double: LuaHashMap_SetValueIntegerForKeyNumber, \
3982 char: LuaHashMap_SetValueIntegerForKeyInteger, \
3983 unsigned char: LuaHashMap_SetValueIntegerForKeyInteger, \
3984 short: LuaHashMap_SetValueIntegerForKeyInteger, \
3985 unsigned short: LuaHashMap_SetValueIntegerForKeyInteger, \
3986 int: LuaHashMap_SetValueIntegerForKeyInteger, \
3987 unsigned int: LuaHashMap_SetValueIntegerForKeyInteger, \
3988 long: LuaHashMap_SetValueIntegerForKeyInteger, \
3989 unsigned long: LuaHashMap_SetValueIntegerForKeyInteger, \
3990 default: LuaHashMap_SetValueIntegerForKeyPointer), \
3991 int: _Generic((C), \
3992 const char*: LuaHashMap_SetValueIntegerForKeyString, \
3993 char*: LuaHashMap_SetValueIntegerForKeyString, \
3994 void*: LuaHashMap_SetValueIntegerForKeyPointer, \
3995 float: LuaHashMap_SetValueIntegerForKeyNumber, \
3996 double: LuaHashMap_SetValueIntegerForKeyNumber, \
3997 long double: LuaHashMap_SetValueIntegerForKeyNumber, \
3998 char: LuaHashMap_SetValueIntegerForKeyInteger, \
3999 unsigned char: LuaHashMap_SetValueIntegerForKeyInteger, \
4000 short: LuaHashMap_SetValueIntegerForKeyInteger, \
4001 unsigned short: LuaHashMap_SetValueIntegerForKeyInteger, \
4002 int: LuaHashMap_SetValueIntegerForKeyInteger, \
4003 unsigned int: LuaHashMap_SetValueIntegerForKeyInteger, \
4004 long: LuaHashMap_SetValueIntegerForKeyInteger, \
4005 unsigned long: LuaHashMap_SetValueIntegerForKeyInteger, \
4006 default: LuaHashMap_SetValueIntegerForKeyPointer), \
4007 unsigned int: _Generic((C), \
4008 const char*: LuaHashMap_SetValueIntegerForKeyString, \
4009 char*: LuaHashMap_SetValueIntegerForKeyString, \
4010 void*: LuaHashMap_SetValueIntegerForKeyPointer, \
4011 float: LuaHashMap_SetValueIntegerForKeyNumber, \
4012 double: LuaHashMap_SetValueIntegerForKeyNumber, \
4013 long double: LuaHashMap_SetValueIntegerForKeyNumber, \
4014 char: LuaHashMap_SetValueIntegerForKeyInteger, \
4015 unsigned char: LuaHashMap_SetValueIntegerForKeyInteger, \
4016 short: LuaHashMap_SetValueIntegerForKeyInteger, \
4017 unsigned short: LuaHashMap_SetValueIntegerForKeyInteger, \
4018 int: LuaHashMap_SetValueIntegerForKeyInteger, \
4019 unsigned int: LuaHashMap_SetValueIntegerForKeyInteger, \
4020 long: LuaHashMap_SetValueIntegerForKeyInteger, \
4021 unsigned long: LuaHashMap_SetValueIntegerForKeyInteger, \
4022 default: LuaHashMap_SetValueIntegerForKeyPointer), \
4023 long: _Generic((C), \
4024 const char*: LuaHashMap_SetValueIntegerForKeyString, \
4025 char*: LuaHashMap_SetValueIntegerForKeyString, \
4026 void*: LuaHashMap_SetValueIntegerForKeyPointer, \
4027 float: LuaHashMap_SetValueIntegerForKeyNumber, \
4028 double: LuaHashMap_SetValueIntegerForKeyNumber, \
4029 long double: LuaHashMap_SetValueIntegerForKeyNumber, \
4030 char: LuaHashMap_SetValueIntegerForKeyInteger, \
4031 unsigned char: LuaHashMap_SetValueIntegerForKeyInteger, \
4032 short: LuaHashMap_SetValueIntegerForKeyInteger, \
4033 unsigned short: LuaHashMap_SetValueIntegerForKeyInteger, \
4034 int: LuaHashMap_SetValueIntegerForKeyInteger, \
4035 unsigned int: LuaHashMap_SetValueIntegerForKeyInteger, \
4036 long: LuaHashMap_SetValueIntegerForKeyInteger, \
4037 unsigned long: LuaHashMap_SetValueIntegerForKeyInteger, \
4038 default: LuaHashMap_SetValueIntegerForKeyPointer), \
4039 unsigned long: _Generic((C), \
4040 const char*: LuaHashMap_SetValueIntegerForKeyString, \
4041 char*: LuaHashMap_SetValueIntegerForKeyString, \
4042 void*: LuaHashMap_SetValueIntegerForKeyPointer, \
4043 float: LuaHashMap_SetValueIntegerForKeyNumber, \
4044 double: LuaHashMap_SetValueIntegerForKeyNumber, \
4045 long double: LuaHashMap_SetValueIntegerForKeyNumber, \
4046 char: LuaHashMap_SetValueIntegerForKeyInteger, \
4047 unsigned char: LuaHashMap_SetValueIntegerForKeyInteger, \
4048 short: LuaHashMap_SetValueIntegerForKeyInteger, \
4049 unsigned short: LuaHashMap_SetValueIntegerForKeyInteger, \
4050 int: LuaHashMap_SetValueIntegerForKeyInteger, \
4051 unsigned int: LuaHashMap_SetValueIntegerForKeyInteger, \
4052 long: LuaHashMap_SetValueIntegerForKeyInteger, \
4053 unsigned long: LuaHashMap_SetValueIntegerForKeyInteger, \
4054 default: LuaHashMap_SetValueIntegerForKeyPointer), \
4055 default: LuaHashMap_SetValuePointerForKeyPointer), \
4056 LuaHashMapIterator*: _Generic((B), \
4057 const char*: _Generic((C), \
4058 char: LuaHashMap_SetValueStringAtIteratorWithLength, \
4059 unsigned char: LuaHashMap_SetValueStringAtIteratorWithLength, \
4060 short: LuaHashMap_SetValueStringAtIteratorWithLength, \
4061 unsigned short: LuaHashMap_SetValueStringAtIteratorWithLength, \
4062 int: LuaHashMap_SetValueStringAtIteratorWithLength, \
4063 unsigned int: LuaHashMap_SetValueStringAtIteratorWithLength, \
4064 long: LuaHashMap_SetValueStringAtIteratorWithLength, \
4065 unsigned long: LuaHashMap_SetValueStringAtIteratorWithLength, \
4066 default: LuaHashMap_SetValueStringAtIteratorWithLength), \
4067 char*: _Generic((C), \
4068 char: LuaHashMap_SetValueStringAtIteratorWithLength, \
4069 unsigned char: LuaHashMap_SetValueStringAtIteratorWithLength, \
4070 short: LuaHashMap_SetValueStringAtIteratorWithLength, \
4071 unsigned short: LuaHashMap_SetValueStringAtIteratorWithLength, \
4072 int: LuaHashMap_SetValueStringAtIteratorWithLength, \
4073 unsigned int: LuaHashMap_SetValueStringAtIteratorWithLength, \
4074 long: LuaHashMap_SetValueStringAtIteratorWithLength, \
4075 unsigned long: LuaHashMap_SetValueStringAtIteratorWithLength, \
4076 default: LuaHashMap_SetValueStringAtIteratorWithLength), \
4077 default: LuaHashMap_SetValueStringAtIteratorWithLength), \
4078 default: LuaHashMap_SetValuePointerForKeyPointer) \
4079 (A,B,C)
4080
4081 #define LUAHASHMAP_SETVALUE_2(A,B) LuaHashMap_SetValueAtIterator(A,B)
4082
4084 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
4085
4086
4096 #define LuaHashMap_SetValue(...) LUAHASHMAP_MACRO_DISPATCHER(LUAHASHMAP_SETVALUE_, __VA_ARGS__)(__VA_ARGS__)
4097
4098
4099
4100
4110 #define LuaHashMap_GetValueStringForKey(hash_map, key) \
4111 _Generic((hash_map), LuaHashMap*: _Generic((key), \
4112 const char*: LuaHashMap_GetValueStringForKeyString, \
4113 char*: LuaHashMap_GetValueStringForKeyString, \
4114 void*: LuaHashMap_GetValueStringForKeyPointer, \
4115 float: LuaHashMap_GetValueStringForKeyNumber, \
4116 double: LuaHashMap_GetValueStringForKeyNumber, \
4117 long double: LuaHashMap_GetValueStringForKeyNumber, \
4118 char: LuaHashMap_GetValueStringForKeyInteger, \
4119 unsigned char: LuaHashMap_GetValueStringForKeyInteger, \
4120 short: LuaHashMap_GetValueStringForKeyInteger, \
4121 unsigned short: LuaHashMap_GetValueStringForKeyInteger, \
4122 int: LuaHashMap_GetValueStringForKeyInteger, \
4123 unsigned int: LuaHashMap_GetValueStringForKeyInteger, \
4124 long: LuaHashMap_GetValueStringForKeyInteger, \
4125 unsigned long: LuaHashMap_GetValueStringForKeyInteger, \
4126 default: LuaHashMap_GetValueStringForKeyPointer) \
4127 ) \
4128 (hash_map, key)
4129
4139 #define LuaHashMap_GetValueStringForKeyWithLength(hash_map, key, strlengthoutptr) \
4140 _Generic((hash_map), LuaHashMap*: _Generic((key), \
4141 void*: _Generic((strlengthoutptr), \
4142 size_t*: LuaHashMap_GetValueStringForKeyPointerWithLength), \
4143 float: _Generic((strlengthoutptr), \
4144 size_t*: LuaHashMap_GetValueStringForKeyNumberWithLength), \
4145 double: _Generic((strlengthoutptr), \
4146 size_t*: LuaHashMap_GetValueStringForKeyNumberWithLength), \
4147 long double: _Generic((strlengthoutptr), \
4148 size_t*: LuaHashMap_GetValueStringForKeyNumberWithLength), \
4149 char: _Generic((strlengthoutptr), \
4150 size_t*: LuaHashMap_GetValueStringForKeyIntegerWithLength), \
4151 unsigned char: _Generic((strlengthoutptr), \
4152 size_t*: LuaHashMap_GetValueStringForKeyIntegerWithLength), \
4153 short: _Generic((strlengthoutptr), \
4154 size_t*: LuaHashMap_GetValueStringForKeyIntegerWithLength), \
4155 unsigned short: _Generic((strlengthoutptr), \
4156 size_t*: LuaHashMap_GetValueStringForKeyIntegerWithLength), \
4157 int: _Generic((strlengthoutptr), \
4158 size_t*: LuaHashMap_GetValueStringForKeyIntegerWithLength), \
4159 unsigned int: _Generic((strlengthoutptr), \
4160 size_t*: LuaHashMap_GetValueStringForKeyIntegerWithLength), \
4161 long: _Generic((strlengthoutptr), \
4162 size_t*: LuaHashMap_GetValueStringForKeyIntegerWithLength), \
4163 unsigned long: _Generic((strlengthoutptr), \
4164 size_t*: LuaHashMap_GetValueStringForKeyIntegerWithLength) \
4165 ) \
4166 ) \
4167 (hash_map, key, strlengthoutptr)
4168
4169
4170
4171 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
4172
4173 /* Private multiple macros for each different number of arguments */
4174 #define LUAHASHMAP_GETVALUESTRING_4(A,B,C,D) LuaHashMap_GetValueStringForKeyStringWithLength(A,B,C,D)
4175 #define LUAHASHMAP_GETVALUESTRING_3(A,B,C) LuaHashMap_GetValueStringForKeyWithLength(A,B,C)
4176 /*
4177 #define LUAHASHMAP_GETVALUESTRING_2(A,B) \
4178 _Generic((A), \
4179 LuaHashMap*: _Generic((B), \
4180 default: LuaHashMap_GetValueStringForKey), \
4181 LuaHashMapIterator*: _Generic((B), \
4182 default: LuaHashMap_GetValueStringAtIteratorWithLength) \
4183 ) \
4184 (A, B)
4185 */
4186 #define LUAHASHMAP_GETVALUESTRING_2(A,B) \
4187 _Generic((A), \
4188 LuaHashMap*: _Generic((B), \
4189 const char*: LuaHashMap_GetValueStringForKeyString, \
4190 char*: LuaHashMap_GetValueStringForKeyString, \
4191 void*: LuaHashMap_GetValueStringForKeyPointer, \
4192 float: LuaHashMap_GetValueStringForKeyNumber, \
4193 double: LuaHashMap_GetValueStringForKeyNumber, \
4194 long double: LuaHashMap_GetValueStringForKeyNumber, \
4195 char: LuaHashMap_GetValueStringForKeyInteger, \
4196 unsigned char: LuaHashMap_GetValueStringForKeyInteger, \
4197 short: LuaHashMap_GetValueStringForKeyInteger, \
4198 unsigned short: LuaHashMap_GetValueStringForKeyInteger, \
4199 int: LuaHashMap_GetValueStringForKeyInteger, \
4200 unsigned int: LuaHashMap_GetValueStringForKeyInteger, \
4201 long: LuaHashMap_GetValueStringForKeyInteger, \
4202 unsigned long: LuaHashMap_GetValueStringForKeyInteger, \
4203 default: LuaHashMap_GetValueStringForKeyPointer), \
4204 LuaHashMapIterator*: _Generic((B), \
4205 default: LuaHashMap_GetValueStringAtIteratorWithLength) \
4206 ) \
4207 (A,B)
4208
4209 #define LUAHASHMAP_GETVALUESTRING_1(A) LuaHashMap_GetValueStringAtIterator(A)
4210
4211
4213 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
4214
4224 #define LuaHashMap_GetValueString(...) LUAHASHMAP_MACRO_DISPATCHER(LUAHASHMAP_GETVALUESTRING_, __VA_ARGS__)(__VA_ARGS__)
4225
4226
4227
4237 #define LuaHashMap_GetValuePointerForKey(hash_map, key) \
4238 _Generic((hash_map), LuaHashMap*: _Generic((key), \
4239 const char*: LuaHashMap_GetValuePointerForKeyString, \
4240 char*: LuaHashMap_GetValuePointerForKeyString, \
4241 void*: LuaHashMap_GetValuePointerForKeyPointer, \
4242 float: LuaHashMap_GetValuePointerForKeyNumber, \
4243 double: LuaHashMap_GetValuePointerForKeyNumber, \
4244 long double: LuaHashMap_GetValuePointerForKeyNumber, \
4245 char: LuaHashMap_GetValuePointerForKeyInteger, \
4246 unsigned char: LuaHashMap_GetValuePointerForKeyInteger, \
4247 short: LuaHashMap_GetValuePointerForKeyInteger, \
4248 unsigned short: LuaHashMap_GetValuePointerForKeyInteger, \
4249 int: LuaHashMap_GetValuePointerForKeyInteger, \
4250 unsigned int: LuaHashMap_GetValuePointerForKeyInteger, \
4251 long: LuaHashMap_GetValuePointerForKeyInteger, \
4252 unsigned long: LuaHashMap_GetValuePointerForKeyInteger, \
4253 default: LuaHashMap_GetValuePointerForKeyPointer) \
4254 ) \
4255 (hash_map, key)
4256
4266 #define LuaHashMap_GetValueNumberForKey(hash_map, key) \
4267 _Generic((hash_map), LuaHashMap*: _Generic((key), \
4268 const char*: LuaHashMap_GetValueNumberForKeyString, \
4269 char*: LuaHashMap_GetValueNumberForKeyString, \
4270 void*: LuaHashMap_GetValueNumberForKeyPointer, \
4271 float: LuaHashMap_GetValueNumberForKeyNumber, \
4272 double: LuaHashMap_GetValueNumberForKeyNumber, \
4273 long double: LuaHashMap_GetValueNumberForKeyNumber, \
4274 char: LuaHashMap_GetValueNumberForKeyInteger, \
4275 unsigned char: LuaHashMap_GetValueNumberForKeyInteger, \
4276 short: LuaHashMap_GetValueNumberForKeyInteger, \
4277 unsigned short: LuaHashMap_GetValueNumberForKeyInteger, \
4278 int: LuaHashMap_GetValueNumberForKeyInteger, \
4279 unsigned int: LuaHashMap_GetValueNumberForKeyInteger, \
4280 long: LuaHashMap_GetValueNumberForKeyInteger, \
4281 unsigned long: LuaHashMap_GetValueNumberForKeyInteger, \
4282 default: LuaHashMap_GetValueNumberForKeyPointer) \
4283 ) \
4284 (hash_map, key)
4285
4295 #define LuaHashMap_GetValueIntegerForKey(hash_map, key) \
4296 _Generic((hash_map), LuaHashMap*: _Generic((key), \
4297 const char*: LuaHashMap_GetValueIntegerForKeyString, \
4298 char*: LuaHashMap_GetValueIntegerForKeyString, \
4299 void*: LuaHashMap_GetValueIntegerForKeyPointer, \
4300 float: LuaHashMap_GetValueIntegerForKeyNumber, \
4301 double: LuaHashMap_GetValueIntegerForKeyNumber, \
4302 long double: LuaHashMap_GetValueIntegerForKeyNumber, \
4303 char: LuaHashMap_GetValueIntegerForKeyInteger, \
4304 unsigned char: LuaHashMap_GetValueIntegerForKeyInteger, \
4305 short: LuaHashMap_GetValueIntegerForKeyInteger, \
4306 unsigned short: LuaHashMap_GetValueIntegerForKeyInteger, \
4307 int: LuaHashMap_GetValueIntegerForKeyInteger, \
4308 unsigned int: LuaHashMap_GetValueIntegerForKeyInteger, \
4309 long: LuaHashMap_GetValueIntegerForKeyInteger, \
4310 unsigned long: LuaHashMap_GetValueIntegerForKeyInteger, \
4311 default: LuaHashMap_GetValueIntegerForKeyPointer) \
4312 ) \
4313 (hash_map, key)
4314 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
4315
4316 /* Private multiple macros for each different number of arguments */
4317 #define LUAHASHMAP_GETVALUEPOINTER_2(A,B) LuaHashMap_GetValuePointerForKey(A,B)
4318 #define LUAHASHMAP_GETVALUEPOINTER_1(A) LuaHashMap_GetValuePointerAtIterator(A)
4319
4320 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
4321
4330 #define LuaHashMap_GetValuePointer(...) LUAHASHMAP_MACRO_DISPATCHER(LUAHASHMAP_GETVALUEPOINTER_, __VA_ARGS__)(__VA_ARGS__)
4331
4332 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
4333
4334 /* Private multiple macros for each different number of arguments */
4335 #define LUAHASHMAP_GETVALUENUMBER_2(A,B) LuaHashMap_GetValueNumberForKey(A,B)
4336 #define LUAHASHMAP_GETVALUENUMBER_1(A) LuaHashMap_GetValueNumberAtIterator(A)
4337
4338 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
4339
4348 #define LuaHashMap_GetValueNumber(...) LUAHASHMAP_MACRO_DISPATCHER(LUAHASHMAP_GETVALUENUMBER_, __VA_ARGS__)(__VA_ARGS__)
4349
4350 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
4351
4352 /* Private multiple macros for each different number of arguments */
4353 #define LUAHASHMAP_GETVALUEINTEGER_2(A,B) LuaHashMap_GetValueIntegerForKey(A,B)
4354 #define LUAHASHMAP_GETVALUEINTEGER_1(A) LuaHashMap_GetValueIntegerAtIterator(A)
4355
4356 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
4357
4366 #define LuaHashMap_GetValueInteger(...) LUAHASHMAP_MACRO_DISPATCHER(LUAHASHMAP_GETVALUEINTEGER_, __VA_ARGS__)(__VA_ARGS__)
4367
4368
4369
4370
4380 #define LuaHashMap_ExistsKey(hash_map, key) \
4381 _Generic((hash_map), LuaHashMap*: _Generic((key), \
4382 const char*: LuaHashMap_ExistsKeyString, \
4383 char*: LuaHashMap_ExistsKeyString, \
4384 void*: LuaHashMap_ExistsKeyPointer, \
4385 float: LuaHashMap_ExistsKeyNumber, \
4386 double: LuaHashMap_ExistsKeyNumber, \
4387 long double: LuaHashMap_ExistsKeyNumber, \
4388 char: LuaHashMap_ExistsKeyInteger, \
4389 unsigned char: LuaHashMap_ExistsKeyInteger, \
4390 short: LuaHashMap_ExistsKeyInteger, \
4391 unsigned short: LuaHashMap_ExistsKeyInteger, \
4392 int: LuaHashMap_ExistsKeyInteger, \
4393 unsigned int: LuaHashMap_ExistsKeyInteger, \
4394 long: LuaHashMap_ExistsKeyInteger, \
4395 unsigned long: LuaHashMap_ExistsKeyInteger, \
4396 default: LuaHashMap_ExistsKeyPointer) \
4397 ) \
4398 (hash_map, key)
4399
4400 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
4401
4402 /* Private multiple macros for each different number of arguments */
4403 #define LUAHASHMAP_EXISTS_1(A) LuaHashMap_ExistsAtIterator(A)
4404 #define LUAHASHMAP_EXISTS_2(A,B) LuaHashMap_ExistsKey(A,B)
4405
4406 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
4407
4416 #define LuaHashMap_Exists(...) LUAHASHMAP_MACRO_DISPATCHER(LUAHASHMAP_EXISTS_, __VA_ARGS__)(__VA_ARGS__)
4417
4418
4428 #define LuaHashMap_RemoveKey(hash_map, key) \
4429 _Generic((hash_map), LuaHashMap*: _Generic((key), \
4430 const char*: LuaHashMap_RemoveKeyString, \
4431 char*: LuaHashMap_RemoveKeyString, \
4432 void*: LuaHashMap_RemoveKeyPointer, \
4433 float: LuaHashMap_RemoveKeyNumber, \
4434 double: LuaHashMap_RemoveKeyNumber, \
4435 long double: LuaHashMap_RemoveKeyNumber, \
4436 char: LuaHashMap_RemoveKeyInteger, \
4437 unsigned char: LuaHashMap_RemoveKeyInteger, \
4438 short: LuaHashMap_RemoveKeyInteger, \
4439 unsigned short: LuaHashMap_RemoveKeyInteger, \
4440 int: LuaHashMap_RemoveKeyInteger, \
4441 unsigned int: LuaHashMap_RemoveKeyInteger, \
4442 long: LuaHashMap_RemoveKeyInteger, \
4443 unsigned long: LuaHashMap_RemoveKeyInteger, \
4444 default: LuaHashMap_RemoveKeyPointer) \
4445 ) \
4446 (hash_map, key)
4447
4448
4449 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
4450
4451 /* Private multiple macros for each different number of arguments */
4452 #define LUAHASHMAP_REMOVE_1(A) LuaHashMap_RemoveAtIterator(A)
4453 #define LUAHASHMAP_REMOVE_2(A,B) LuaHashMap_RemoveKey(A,B)
4454
4455 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
4456
4465 #define LuaHashMap_Remove(...) LUAHASHMAP_MACRO_DISPATCHER(LUAHASHMAP_REMOVE_, __VA_ARGS__)(__VA_ARGS__)
4466
4476 #define LuaHashMap_GetIteratorForKey(hash_map, key) \
4477 _Generic((hash_map), LuaHashMap*: _Generic((key), \
4478 const char*: LuaHashMap_GetIteratorForKeyString, \
4479 char*: LuaHashMap_GetIteratorForKeyString, \
4480 void*: LuaHashMap_GetIteratorForKeyPointer, \
4481 float: LuaHashMap_GetIteratorForKeyNumber, \
4482 double: LuaHashMap_GetIteratorForKeyNumber, \
4483 long double: LuaHashMap_GetIteratorForKeyNumber, \
4484 char: LuaHashMap_GetIteratorForKeyInteger, \
4485 unsigned char: LuaHashMap_GetIteratorForKeyInteger, \
4486 short: LuaHashMap_GetIteratorForKeyInteger, \
4487 unsigned short: LuaHashMap_GetIteratorForKeyInteger, \
4488 int: LuaHashMap_GetIteratorForKeyInteger, \
4489 unsigned int: LuaHashMap_GetIteratorForKeyInteger, \
4490 long: LuaHashMap_GetIteratorForKeyInteger, \
4491 unsigned long: LuaHashMap_GetIteratorForKeyInteger, \
4492 default: LuaHashMap_GetIteratorForKeyPointer) \
4493 ) \
4494 (hash_map, key)
4495
4496
4501 #define LUAHASHMAP_SUPPORTS_GENERICS 1
4502
4504 #else
4505
4506 #define LUAHASHMAP_SUPPORTS_GENERICS 0
4507
4508 #endif /* end of C11 _Generic */
4509
4510
4511 /* List Functions (Deprecated) */
4512 /* The iterator functions are much cleaner than these. These are also O(n).
4513 * Also, now that mixing key types in the same hash is allowed,
4514 * these functions are not resilient to mixed keys.
4515 * These functions are now deprecated.
4516 */
4533 /* End Experiemental Functions */
4534
4535
4536
4537 #if defined(__LUAHASHMAP_LUA_NUMBER_DEFINED__)
4538 #undef lua_Number
4539 #undef __LUAHASHMAP_LUA_NUMBER_DEFINED__
4540 #endif
4541
4542 #if defined(__LUAHASHMAP_LUA_INTEGER_DEFINED__)
4543 #undef lua_Integer
4544 #undef __LUAHASHMAP_LUA_INTEGER_DEFINED__
4545 #endif
4546
4547 #if defined(__LUAHASHMAP_LUA_STATE_DEFINED__)
4548 #undef lua_State
4549 #undef __LUAHASHMAP_LUA_STATE_DEFINED__
4550 #endif
4551
4552 #if defined(__LUAHASHMAP_LUA_TNONE_DEFINED__)
4553 #undef LUA_TNONE
4554 #undef __LUAHASHMAP_LUA_TNONE_DEFINED__
4555 #endif
4556
4557 #if defined(__LUAHASHMAP_LUA_TLIGHTUSERDATA_DEFINED__)
4558 #undef LUA_TLIGHTUSERDATA
4559 #undef __LUAHASHMAP_LUA_TLIGHTUSERDATA_DEFINED__
4560 #endif
4561
4562 #if defined(__LUAHASHMAP_LUA_TNUMBER_DEFINED__)
4563 #undef LUA_TNUMBER
4564 #undef __LUAHASHMAP_LUA_TNUMBER_DEFINED__
4565 #endif
4566
4567 #if defined(__LUAHASHMAP_LUA_TSTRING_DEFINED__)
4568 #undef LUA_TSTRING
4569 #undef __LUAHASHMAP_LUA_TSTRING_DEFINED__
4570 #endif
4571
4572 #if defined(__LUAHASHMAP_LUA_NOREF_DEFINED__)
4573 #undef LUA_NOREF
4574 #undef __LUAHASHMAP_LUA_NOREF_DEFINED__
4575 #endif
4576
4577 /* You can't undo a typedef */
4578 #if defined(__LUAHASHMAP_LUA_ALLOC_DEFINED__)
4579 /* #undef lua_Alloc */
4580 #undef __LUAHASHMAP_LUA_ALLOC_DEFINED__
4581 #endif
4582
4583
4584 #if defined(__LUAHASHMAP_RESTRICT_KEYWORD_DEFINED__)
4585 #undef restrict
4586 #undef __LUAHASHMAP_RESTRICT_KEYWORD_DEFINED__
4587 #endif
4588
4589 #if defined(__LUAHASHMAP_BOOL_KEYWORD_DEFINED__)
4590 #undef bool
4591 #undef __LUAHASHMAP_BOOL_KEYWORD_DEFINED__
4592 #endif
4593
4594 #if defined(__LUAHASHMAP_FALSE_KEYWORD_DEFINED__)
4595 #undef false
4596 #undef __LUAHASHMAP_FALSE_KEYWORD_DEFINED__
4597 #endif
4598
4599 #if defined(__LUAHASHMAP_TRUE_KEYWORD_DEFINED__)
4600 #undef true
4601 #undef __LUAHASHMAP_TRUE_KEYWORD_DEFINED__
4602 #endif
4603
4604
4605
4606 #ifdef __cplusplus
4607 }
4608 #endif
4609
4610
4611
4612 #endif /* C_LUA_HASH_MAP_H */
4613