mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-09 15:10:29 +02:00
Refactor type definitions
This commit is contained in:
parent
a1b4311cfc
commit
aac0faf4cf
3 changed files with 31 additions and 25 deletions
26
heap-objects.h
Normal file
26
heap-objects.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
#ifndef HEAP_OBJECTS_H
|
||||
#define HEAP_OBJECTS_H
|
||||
|
||||
#include "inline.h"
|
||||
|
||||
#define DECLARE_NODE_TYPE(name, Name, NAME) \
|
||||
struct Name; \
|
||||
typedef struct Name Name;
|
||||
FOR_EACH_HEAP_OBJECT_KIND(DECLARE_NODE_TYPE)
|
||||
#undef DECLARE_NODE_TYPE
|
||||
|
||||
#define DEFINE_ENUM(name, Name, NAME) ALLOC_KIND_##NAME,
|
||||
enum alloc_kind {
|
||||
FOR_EACH_HEAP_OBJECT_KIND(DEFINE_ENUM)
|
||||
};
|
||||
#undef DEFINE_ENUM
|
||||
|
||||
#define DEFINE_METHODS(name, Name, NAME) \
|
||||
static inline size_t name##_size(Name *obj) ALWAYS_INLINE; \
|
||||
static inline void visit_##name##_fields(Name *obj,\
|
||||
void (*visit)(void **loc, void *visit_data), \
|
||||
void *visit_data) ALWAYS_INLINE;
|
||||
FOR_EACH_HEAP_OBJECT_KIND(DEFINE_METHODS)
|
||||
#undef DEFINE_METHODS
|
||||
|
||||
#endif // HEAP_OBJECTS_H
|
Loading…
Add table
Add a link
Reference in a new issue