Makes the DynMemRef.h usable from C (#101)

This commit is contained in:
Miguel de Icaza 2020-04-30 02:54:19 -04:00 committed by GitHub
parent 64ed03295f
commit e785a75705
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 2 deletions

View File

@ -1,6 +1,10 @@
#ifdef __cplusplus
#pragma once
#include <cstdint>
#else
#include <stdint.h>
#endif
typedef int64_t INDEX_TYPE;
@ -16,15 +20,26 @@ struct DynMemRef {
INDEX_TYPE *sizes;
int64_t *strides;
#ifdef __cplusplus
DynMemRef(int _rank);
#endif
};
extern "C" {
#ifdef __cplusplus
// Ordered DynMemRef Dictionary is a data structure for wrapping the input
// dynmemrefs so that they can be addressed both by index and by name.
struct OrderedDynMemRefDict;
#else
typedef struct DynMemRef DynMemRef;
typedef struct _OrderedDynMemRefDict OrderedDynMemRefDict;
#endif
#ifdef __cplusplus
extern "C" {
#endif
// Get number of dynamic memrefs in OrderedDynMemRefDict dict.
int numDynMemRefs(OrderedDynMemRefDict *dict);
@ -58,4 +73,7 @@ INDEX_TYPE *getSizes(DynMemRef *);
// Get ptr to strides array.
int64_t *getStrides(DynMemRef *);
#ifdef __cplusplus
}
#endif