Import combinator and allocator APIs into SWIG. Next is glue. Need to fix unions in HParsedToken and HCaseResult.
This commit is contained in:
parent
75453d8b2f
commit
49f22e2aff
3 changed files with 19 additions and 9 deletions
|
|
@ -29,7 +29,11 @@ typedef struct HAllocator_ {
|
|||
typedef struct HArena_ HArena ; // hidden implementation
|
||||
|
||||
HArena *h_new_arena(HAllocator* allocator, size_t block_size); // pass 0 for default...
|
||||
#ifndef SWIG
|
||||
void* h_arena_malloc(HArena *arena, size_t count) __attribute__(( malloc, alloc_size(2) ));
|
||||
#else
|
||||
void* h_arena_malloc(HArena *arena, size_t count);
|
||||
#endif
|
||||
void h_arena_free(HArena *arena, void* ptr); // For future expansion, with alternate memory managers.
|
||||
void h_delete_arena(HArena *arena);
|
||||
|
||||
|
|
|
|||
4
src/bindings/swig/hammer.i
Normal file
4
src/bindings/swig/hammer.i
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
%module hammer
|
||||
|
||||
%import "hammer/allocator.h"
|
||||
%import "hammer/hammer.h"
|
||||
20
src/hammer.h
20
src/hammer.h
|
|
@ -29,7 +29,9 @@
|
|||
#define BIT_LITTLE_ENDIAN 0x0
|
||||
#define BYTE_LITTLE_ENDIAN 0x0
|
||||
|
||||
#ifndef HAMMER_INTERNAL__NO_STDARG_H
|
||||
typedef int bool;
|
||||
#endif // HAMMER_INTERNAL__NO_STDARG_H
|
||||
|
||||
typedef struct HParseState_ HParseState;
|
||||
|
||||
|
|
@ -177,7 +179,7 @@ typedef struct HBenchmarkResults_ {
|
|||
rtype_t name(__VA_ARGS__) attr; \
|
||||
rtype_t name##__m(HAllocator* mm__, __VA_ARGS__) attr
|
||||
|
||||
#ifndef HAMMER_INTERNAL__NO_STDARG_H
|
||||
#ifndef SWIG
|
||||
#define HAMMER_FN_DECL_VARARGS(rtype_t, name, ...) \
|
||||
rtype_t name(__VA_ARGS__, ...); \
|
||||
rtype_t name##__m(HAllocator* mm__, __VA_ARGS__, ...); \
|
||||
|
|
@ -195,17 +197,17 @@ typedef struct HBenchmarkResults_ {
|
|||
rtype_t name##__a(void *args[]); \
|
||||
rtype_t name##__ma(HAllocator *mm__, void *args[])
|
||||
#else
|
||||
#define HAMMER_FN_DECL_VARARGS(rtype_t, name, ...) \
|
||||
rtype_t name(__VA_ARGS__, ...); \
|
||||
rtype_t name##__m(HAllocator* mm__, __VA_ARGS__, ...); \
|
||||
rtype_t name##__a(void *args[]); \
|
||||
#define HAMMER_FN_DECL_VARARGS(rtype_t, name, params...) \
|
||||
rtype_t name(params, ...); \
|
||||
rtype_t name##__m(HAllocator* mm__, params, ...); \
|
||||
rtype_t name##__a(void *args[]); \
|
||||
rtype_t name##__ma(HAllocator *mm__, void *args[])
|
||||
|
||||
// Note: this drops the attributes on the floor for the __v versions
|
||||
#define HAMMER_FN_DECL_VARARGS_ATTR(attr, rtype_t, name, ...) \
|
||||
rtype_t name(__VA_ARGS__, ...) attr; \
|
||||
rtype_t name##__m(HAllocator* mm__, __VA_ARGS__, ...) attr; \
|
||||
rtype_t name##__a(void *args[]); \
|
||||
#define HAMMER_FN_DECL_VARARGS_ATTR(attr, rtype_t, name, params...) \
|
||||
rtype_t name(params, ...); \
|
||||
rtype_t name##__m(HAllocator* mm__, params, ...); \
|
||||
rtype_t name##__a(void *args[]); \
|
||||
rtype_t name##__ma(HAllocator *mm__, void *args[])
|
||||
#endif // HAMMER_INTERNAL__NO_STDARG_H
|
||||
// }}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue