#include <../../nrnconf.h>

/*
allocate and free property data and Datum arrays for nrnoc
the nrniv/cxprop.cpp version allows for the possibility of
greater cache efficiency
*/

#include <stdio.h>
#include <section.h>
#include <stdlib.h>


void nrn_mk_prop_pools(int n) {}

void nrn_cache_prop_realloc() {}
void nrn_delete_prop_pool(int type) {}
int nrn_is_valid_section_ptr(void* v) {
    return 0;
}

extern "C" double* nrn_prop_data_alloc(int type, int count, Prop* p) {
    double* pd = (double*) hoc_Ecalloc(count, sizeof(double));
    hoc_malchk();
    return pd;
}

extern "C" Datum* nrn_prop_datum_alloc(int type, int count, Prop* p) {
    Datum* ppd = (Datum*) hoc_Ecalloc(count, sizeof(Datum));
    hoc_malchk();
    return ppd;
}

extern "C" void nrn_prop_data_free(int type, double* pd) {
    if (pd) {
        free(pd);
    }
}

extern "C" void nrn_prop_datum_free(int type, Datum* ppd) {
    if (ppd) {
        free(ppd);
    }
}

Section* nrn_section_alloc() {
    return (Section*) emalloc(sizeof(Section));
}

void nrn_section_free(Section* s) {
    free(s);
}
