Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#pragma message("touching: "__FILE__)
#include "common.h"
#include <string.h>
#include <assert.h>
#include <math.h>
#ifdef __cplusplus
extern "C"{
#endif
//#define MAXSEG 5
//#define DYNARR_DATA_TYPE int
//#define TYPED_NAME(name) TOKEN_PASTE(DYNARR_DATA_TYPE, name)
/* Assuming MAXSEG is defined.
Size of each block of the dynamic array.
Must be a positive integer.*/
/* Assuming DYNARR_DATA_TYPE is defined.
The data type of the array.
Must be a valid one-word type without space, *, etc. (use typedef if necessary)
*/
#ifndef MAXSEG
// #pragma message("MAXSEG must be defined before including " __FILE__)
// must be pow of 2
#define MAXSEG 1024
#elif MAXSEG <= 0
#pragma message("MAXSEG has non positive value: " MAXSEG)
#elif !defined(DYNARR_DATA_TYPE)
#pragma message("DYNARR_DATA_TYPE must be defined before including " __FILE__)
#endif
// everything is fine
#include "dynarrc.freeseglistonce.h"
// state variables
#include "dynarrc.vars.h"
// external declarations for allocating/resizing blocks
#define SEG_ARR_ALLOC_NEXT_FUNC(type) TYPED_NAME(type, _seg_bank_alloc_next)
#define SEG_ARR_INC_MAX_FUNC(type) TYPED_NAME(type, _seg_bank_increase_max)
#define SEG_ARR_ALLOC_SEG_FUNC(type) TYPED_NAME(type, _seg_arr_alloc_seg)
// early declarations
extern int SEG_ARR_ALLOC_NEXT_FUNC(DYNARR_DATA_TYPE)();
extern int SEG_ARR_INC_MAX_FUNC(DYNARR_DATA_TYPE)();
extern DYNARR_SEG_TYPE(DYNARR_DATA_TYPE) SEG_ARR_ALLOC_SEG_FUNC(DYNARR_DATA_TYPE)();
// Free segment list methods
#include "dynarrc.freeseglistmethods.h"
/* DynArr core methods*/
#include "dynarrc.coremethods.h"
/* Segment access methods */
#include "dynarrc.segmentmethods.h"
/*------- Seg banks methods -------------*/
#include "dynarrc.segbankmethods.h"
/* Finally, the interface used by clients */
#include "dynarrc.interface.h"
/*---------------------------------*/
// Ready to use LLArr
// create the state variables
// prepare for further use by undefining DYNARR_DATA_TYPE
createLLArr(MyStruct); // global allocator
#undef DYNARR_DATA_TYPE
#ifdef __cplusplus
} // extern "C"
#endif