/*
 * Copyright (c) 1994, 2021 Alex Leigh, All Rights Reserved
 *
 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ALEX LEIGH The copyright
 * notice above does not evidence any actual or intended publication of such
 * source code.
 *
 * Disclosure, copying, distribution, or transmission of this code without
 * express permission is prohibited.
 */

#ifndef MECHA_A_H
#define MECHA_A_H

#include <memory.h>
#include <stdint.h>

#define M_DA_FLAG_NULLTERMINATE (1<<0)

// Manipulate this on a platform-basis to set the limits for the # of elements and sz of elements
typedef unsigned int mTda_sz;

struct mSda {
    char *buf;
    mTda_sz sz;
    mTda_sz len;
    mTda_sz elem_sz;
    int flags;
};

int mFda_init(struct mSda *array, mTda_sz elem_sz, uint8_t flags);

void mFda_free(struct mSda *array,void (*free_func)(void *));

int mFda_cat(struct mSda *dst, const void *src, mTda_sz elem_sz);

void *mFda_ptr(struct mSda *array, mTda_sz elem);

#endif // MECHA_A_H