7#include <ae2f/errGlob.h>
10#include <ae2f/Pack/Beg.h>
11#include <ae2f/Macro.h>
12#include <ae2f/Guide.h>
17
18
19
20
33 ae2f_mMMap*
const mmap
35 ,
const size_t*
const lens
37 , size_t*
const opt_ret_sz
44 const size_t*
const lens,
46 ae2f_FREE(free, ae2f_mMMapDel) ae2f_mMMap**
const ret_mmap
51 const ae2f_mMMap*
const mmap,
53 const size_t*
const idxs,
58 const size_t dim,
const size_t*
const lens
80#define ae2f_mMMapDimLen(mmap, ...)
84#define ae2f_mMMapField(mmap, ...)
108 ae2f_mMMapInit_t m_initstack;
111#include <ae2f/Pack/End.h>
119#include <ae2f/MMap/MMap.h>
126 ae2f_mMMapSz_t v_mapsz
137 while(v_mapsz.m_dim--) {
138 v_mapsz.m_ret *= (
lens)[(v_mapsz).m_dim];
141 assert(v_mapsz.m_dim == -1);
145 + ((
dim)) *
sizeof(size_t)
151ae2f_MAC() _ae2f_mMMapSz(
const size_t dim,
const size_t*
const lens
155 assert(0 &&
"lens is not good");
156 (ret) && (*(ret) = -1);
160 (ret) && (*(ret) = v_sz.m_ret);
166
167
168
169
170
171
172
173
174
175
176constextendedfun size_t _ae2f_mMMapSz(
186 __ae2f_mMMapSz_imp(v_sz, dim, lens);
194 ae2f_mMMapFieldIdx_t v_fidx,
195 const ae2f_mMMap*
const mmap,
197 const size_t*
const idxs
200 assert((mmap) &&
"mmap is null");
207 for(v_fidx.m_i = 0; v_fidx.m_i < v_fidx.m_dim - 1 && v_fidx.m_L; v_fidx.m_i++) {
209 v_fidx.m_I = (idxs)[v_fidx.m_dim - 1 - v_fidx.m_i] % v_fidx.m_L;
210 v_fidx.m_ret += v_fidx.m_I;
211 v_fidx.m_ret *= v_fidx.m_L;
214 if(v_fidx.m_i < v_fidx.m_dim - 1)
216 assert(0 &&
"who are you");
227 v_fidx.m_dim = (mmap)->m_dim;
229 for(; v_fidx.m_i < v_fidx.m_dim - 1; v_fidx.m_i++) {
236 const ae2f_mMMap*
const mmap,
238 const size_t*
const idxs,
244 unless((idxs) && (mmap)) {
245 assert(0 &&
"nullptr from __ae2f_mMMapFieldIdx");
249 ae2f_mMMapFieldIdx_t v_idx;
251 *(ret) = v_idx.m_ret;
259constextendedfun size_t _ae2f_mMMapFieldIdx(
260 const ae2f_mMMap* mmap,
268 ae2f_mMMapFieldIdx_t v_idx;
269 __ae2f_mMMapFieldIdx_imp(v_idx, mmap, dim, idxs);
277 ae2f_mMMapInit_t v_init,
278 struct ae2f_mMMap*
const mmap,
280 const size_t*
const lens
283 (mmap)->m_dim = (dim);
284 for(v_init.m_i = 0; v_init.m_i < (dim); v_init.m_i++)
292 struct ae2f_mMMap*
const mmap,
294 const size_t*
const lens,
299 if((ret_e) && *(ret_e))
301 else unless((mmap) && (lens))
304 ae2f_mMMapInit_t v_init;
306 (opt_sz) && (*(opt_sz) = v_init.m_ret);
310ae2f_MAC() _ae2f_mMMapMk_imp(ae2f_mMMapMk_t v_mk,
const size_t dim,
const size_t*
const lens) {
311 assert((lens) &&
"lens is null");
314 assert((v_mk.m_initstack.m_ret != -1) &&
"Sz has failed.");
315 assert((v_mk.m_initstack.m_ret >
sizeof(ae2f_mMMap)) &&
"Sz is fishy.");
318 if((v_mk.m_ptr = calloc(1, v_mk.m_initstack.m_ret))) {
321 assert(0 &&
"allocation has failed");
327 const size_t*
const lens,
329 ae2f_mMMap**
const ret_mmap
332 if(opt_ret_err && *(opt_ret_err));
333 else unless((lens) && (ret_mmap))
344 *(ret_mmap) = v_mk.m_ptr;
#define ae2f_structdef(key, name)
#define ae2f_structdef_v(key, name,...)
#define ae2f_reinterpret_cast(t, v)
#define unless(...)
Invokes when condition is false.
#define ae2f_extern
Suggests the existence of external variable or function, in naming of C. [non-mangling].
#define ae2f_CmpGetLs(a, b)
#define ae2f_WhenCXX(...)
Appears when the current language is C.
#define ae2f_FREE(...)
Use this marker to show the desired functions to effectively free the resources.
#define __ae2f_mMMapFieldIdx(mmap, dim, idxs, ret)
#define __ae2f_mMMapDel(a)
#define __ae2f_mMMapSz_imp(v_mapsz, dim, lens)
#define ae2f_mMMapDimLen(mmap,...)
Length vector for every dimension index.
#define __ae2f_mMMapMk_imp(v_mk, dim, lens)
#define __ae2f_mMMapInit(mmap, dim, lens, ret_e, opt_sz)
#define __ae2f_mMMapMk(dim, lens, opt_ret_err, ret_mmap)
#define __ae2f_mMMapSz(dim, lens, ret)
#define __ae2f_mMMapInit_imp(v_init, mmap, dim, lens)
#define __ae2f_mMMapFieldIdx_imp(v_fidx, mmap, dim, idxs)
const size_t const size_t *const lens
ae2f_extern ae2f_SHAREDCALL void ae2f_mMMapMk(const size_t dim, const size_t *const lens, ae2f_err_t *const opt_ret_err, ae2f_FREE(free, ae2f_mMMapDel) ae2f_mMMap **const ret_mmap) noexcept
ae2f_extern ae2f_SHAREDCALL void ae2f_mMMapSz(const size_t dim, const size_t *const lens, size_t *const ret)
ae2f_extern ae2f_SHAREDCALL void ae2f_mMMapDel(ae2f_mMMap *mmap)
ae2f_extern ae2f_SHAREDCALL void ae2f_mMMapInit(ae2f_mMMap *const mmap, const size_t dim, const size_t *const lens, ae2f_err_t *const opt_ret_err, size_t *const opt_ret_sz) noexcept
ae2f_extern ae2f_SHAREDCALL void ae2f_mMMapFieldIdx(const ae2f_mMMap *const mmap, const size_t dim, const size_t *const idxs, size_t *const ret)
#define ae2f_errGlob_ALLOC_FAILED
stdlib allocating functions (malloc, calloc, realloc) has been failed.
uint8_t ae2f_err_t
Informs that this number represents the error.
#define ae2f_errGlob_PTR_IS_NULL
Failed to refer the pointer either l-value inside the function.
#define __ae2f_MACRO_GENERATED
#define ae2f_MAC()
delta to delta