ext/nmatrix/nmatrix.h in nmatrix-0.1.0.rc4 vs ext/nmatrix/nmatrix.h in nmatrix-0.1.0.rc5

- old
+ new

@@ -51,11 +51,13 @@ #include <sys/time.h> #include <sys/resource.h> #endif #endif -#include "nm_memory.h" +#ifdef __cplusplus + #include "nm_memory.h" +#endif /* * Macros */ @@ -286,19 +288,19 @@ NM_DECL_STRUCT(STORAGE*, storage); // STORAGE* storage; // Pointer to storage struct. NM_DEF_STRUCT_POST(NMATRIX); // }; /* Structs for dealing with VALUEs in use so that they don't get GC'd */ -typedef struct __NM_GC_LL_NODE { - VALUE* val; - size_t n; - __NM_GC_LL_NODE* next; -} nm_gc_ll_node; +NM_DEF_STRUCT_PRE(NM_GC_LL_NODE); // struct NM_GC_LL_NODE { + VALUE* val; // VALUE* val; + size_t n; // size_t n; + NM_DECL_STRUCT(NM_GC_LL_NODE*, next); // NM_GC_LL_NODE* next; +NM_DEF_STRUCT_POST(NM_GC_LL_NODE); // }; -typedef struct __NM_GC_HOLDER { - __NM_GC_LL_NODE* start; -} nm_gc_holder; +NM_DEF_STRUCT_PRE(NM_GC_HOLDER); // struct NM_GC_HOLDER { + NM_DECL_STRUCT(NM_GC_LL_NODE*, start); // NM_GC_LL_NODE* start; +NM_DEF_STRUCT_POST(NM_GC_HOLDER); // }; #define NM_MAX_RANK 15 #define UnwrapNMatrix(obj,var) Data_Get_Struct(obj, NMATRIX, var) @@ -380,18 +382,19 @@ VALUE nm_cast(VALUE self, VALUE new_stype_symbol, VALUE new_dtype_symbol, VALUE init); void nm_mark(NMATRIX* mat); void nm_delete(NMATRIX* mat); void nm_delete_ref(NMATRIX* mat); void nm_register_values(VALUE* vals, size_t n); + void nm_register_value(VALUE* val); + void nm_unregister_value(VALUE* val); void nm_unregister_values(VALUE* vals, size_t n); - void nm_register_value(VALUE& val); - void nm_unregister_value(VALUE& val); - void nm_register_storage(nm::stype_t stype, const STORAGE* storage); - void nm_unregister_storage(nm::stype_t stype, const STORAGE* storage); + void nm_register_storage(NM_DECL_ENUM(stype_t, stype), const STORAGE* storage); + void nm_unregister_storage(NM_DECL_ENUM(stype_t, stype), const STORAGE* storage); void nm_register_nmatrix(NMATRIX* nmatrix); void nm_unregister_nmatrix(NMATRIX* nmatrix); - void nm_completely_unregister_value(VALUE& val); + void nm_completely_unregister_value(VALUE* val); #ifdef __cplusplus } + #endif #endif // NMATRIX_H