-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscary.h
63 lines (58 loc) · 2.18 KB
/
scary.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef SCARY_H
#define SCARY_H
#include <stddef.h>
#include <stdint.h>
void *scary_new(size_t size);
void scary_free(void *ary);
size_t scary_length(const void *ary);
#ifdef __APPLE__
#define scary_push_archdep_pattern() unsigned long: scary_push_uint64,
#else
#define scary_push_archdep_pattern() //empty
#endif
#define scary_push(pary, elem) \
_Generic(elem, \
scary_push_archdep_pattern() \
char: scary_push_char, \
int8_t: scary_push_int8, \
int16_t: scary_push_int16, \
int32_t: scary_push_int32, \
int64_t: scary_push_int64, \
uint8_t: scary_push_uint8, \
uint16_t: scary_push_uint16, \
uint32_t: scary_push_uint32, \
uint64_t: scary_push_uint64, \
char *: scary_push_charp, \
const char *: scary_push_ccharp, \
int8_t *: scary_push_int8p, \
int16_t *: scary_push_int16p, \
int32_t *: scary_push_int32, \
int64_t *: scary_push_int64p, \
uint8_t *: scary_push_uint8p, \
uint16_t *: scary_push_uint16p, \
uint32_t *: scary_push_uint32p, \
uint64_t *: scary_push_uint64p, \
void *: scary_push_voidp)(pary, elem)
void scary_push_char(char **, char);
void scary_push_int8(int8_t **, int8_t);
void scary_push_int16(int16_t **, int16_t);
void scary_push_int32(int32_t **, int32_t);
void scary_push_int64(int64_t **, int64_t);
void scary_push_uint8(uint8_t **, uint8_t);
void scary_push_uint16(uint16_t **, uint16_t);
void scary_push_uint32(uint32_t **, uint32_t);
void scary_push_uint64(uint64_t **, uint64_t);
void scary_push_ccharp(const char ***, const char *);
void scary_push_charp(char ***, const char *);
void scary_push_voidp(void ***, const void *);
void scary_push_int8p(int8_t ***, const int8_t *);
void scary_push_int16p(int16_t ***, const int16_t *);
void scary_push_int32p(int32_t ***, const int32_t *);
void scary_push_int64p(int64_t ***, const int64_t *);
void scary_push_uint8p(uint8_t ***, const uint8_t *);
void scary_push_uint16p(uint16_t ***, const uint16_t *);
void scary_push_uint32p(uint32_t ***, const uint32_t *);
void scary_push_uint64p(uint64_t ***, const uint64_t *);
void scary_pop(void *ary);
void *scary_dup(void *ary);
#endif