Import combinator and allocator APIs into SWIG. Next is glue. Need to fix unions in HParsedToken and HCaseResult.
This commit is contained in:
parent
4330a426e9
commit
34062d50a2
3 changed files with 19 additions and 9 deletions
|
|
@ -29,7 +29,11 @@ typedef struct HAllocator_ {
|
||||||
typedef struct HArena_ HArena ; // hidden implementation
|
typedef struct HArena_ HArena ; // hidden implementation
|
||||||
|
|
||||||
HArena *h_new_arena(HAllocator* allocator, size_t block_size); // pass 0 for default...
|
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) ));
|
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_arena_free(HArena *arena, void* ptr); // For future expansion, with alternate memory managers.
|
||||||
void h_delete_arena(HArena *arena);
|
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"
|
||||||
16
src/hammer.h
16
src/hammer.h
|
|
@ -34,7 +34,9 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
|
#ifndef HAMMER_INTERNAL__NO_STDARG_H
|
||||||
typedef int bool;
|
typedef int bool;
|
||||||
|
#endif // HAMMER_INTERNAL__NO_STDARG_H
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct HParseState_ HParseState;
|
typedef struct HParseState_ HParseState;
|
||||||
|
|
@ -183,7 +185,7 @@ typedef struct HBenchmarkResults_ {
|
||||||
rtype_t name(__VA_ARGS__) attr; \
|
rtype_t name(__VA_ARGS__) attr; \
|
||||||
rtype_t name##__m(HAllocator* mm__, __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, ...) \
|
#define HAMMER_FN_DECL_VARARGS(rtype_t, name, ...) \
|
||||||
rtype_t name(__VA_ARGS__, ...); \
|
rtype_t name(__VA_ARGS__, ...); \
|
||||||
rtype_t name##__m(HAllocator* mm__, __VA_ARGS__, ...); \
|
rtype_t name##__m(HAllocator* mm__, __VA_ARGS__, ...); \
|
||||||
|
|
@ -201,16 +203,16 @@ typedef struct HBenchmarkResults_ {
|
||||||
rtype_t name##__a(void *args[]); \
|
rtype_t name##__a(void *args[]); \
|
||||||
rtype_t name##__ma(HAllocator *mm__, void *args[])
|
rtype_t name##__ma(HAllocator *mm__, void *args[])
|
||||||
#else
|
#else
|
||||||
#define HAMMER_FN_DECL_VARARGS(rtype_t, name, ...) \
|
#define HAMMER_FN_DECL_VARARGS(rtype_t, name, params...) \
|
||||||
rtype_t name(__VA_ARGS__, ...); \
|
rtype_t name(params, ...); \
|
||||||
rtype_t name##__m(HAllocator* mm__, __VA_ARGS__, ...); \
|
rtype_t name##__m(HAllocator* mm__, params, ...); \
|
||||||
rtype_t name##__a(void *args[]); \
|
rtype_t name##__a(void *args[]); \
|
||||||
rtype_t name##__ma(HAllocator *mm__, void *args[])
|
rtype_t name##__ma(HAllocator *mm__, void *args[])
|
||||||
|
|
||||||
// Note: this drops the attributes on the floor for the __v versions
|
// Note: this drops the attributes on the floor for the __v versions
|
||||||
#define HAMMER_FN_DECL_VARARGS_ATTR(attr, rtype_t, name, ...) \
|
#define HAMMER_FN_DECL_VARARGS_ATTR(attr, rtype_t, name, params...) \
|
||||||
rtype_t name(__VA_ARGS__, ...) attr; \
|
rtype_t name(params, ...); \
|
||||||
rtype_t name##__m(HAllocator* mm__, __VA_ARGS__, ...) attr; \
|
rtype_t name##__m(HAllocator* mm__, params, ...); \
|
||||||
rtype_t name##__a(void *args[]); \
|
rtype_t name##__a(void *args[]); \
|
||||||
rtype_t name##__ma(HAllocator *mm__, void *args[])
|
rtype_t name##__ma(HAllocator *mm__, void *args[])
|
||||||
#endif // HAMMER_INTERNAL__NO_STDARG_H
|
#endif // HAMMER_INTERNAL__NO_STDARG_H
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue