Skip to content

Commit

Permalink
Add ctor_f and dtor_f
Browse files Browse the repository at this point in the history
  • Loading branch information
alkino committed Nov 25, 2024
1 parent d30948a commit 86ed556
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 33 deletions.
1 change: 0 additions & 1 deletion cmake/NeuronFileLists.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ set(HEADER_FILES_TO_INSTALL
nrnoc/section_fwd.hpp
nrnoc/treeset.h
oc/hoc.h
oc/hoc_membf.h
oc/hocassrt.h
oc/hocdec.h
oc/hocgetsym.h
Expand Down
4 changes: 2 additions & 2 deletions src/nrnoc/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1021,8 +1021,8 @@ int point_reg_helper(Symbol* s2) {
}

extern void class2oc_base(const char*,
void* (*cons)(Object*),
void (*destruct)(void*),
ctor_f* cons,
dtor_f* destruct,
Member_func*,
Member_ret_obj_func*,
Member_ret_str_func*);
Expand Down
6 changes: 3 additions & 3 deletions src/nrnoc/nrniv_mf.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "hoc_membf.h"
#include "classreg.h"
#include "hocdec.h"
#include "membfunc.h"

Expand Down Expand Up @@ -51,8 +51,8 @@ int point_register_mech(const char**,
nrn_init_t,
int,
int,
void* (*) (Object*),
void (*)(void*),
ctor_f*,
dtor_f*,
Member_func*);
extern int nrn_get_mechtype(const char*);
extern void nrn_writes_conc(int, int);
Expand Down
24 changes: 20 additions & 4 deletions src/oc/classreg.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
#pragma once

#include <hocdec.h>
#include <hoc_membf.h>
struct Object;

using ctor_f = void*(Object*);
using dtor_f = void(void*);

struct Member_func {
const char* name;
double (*member)(void*);
};

struct Member_ret_obj_func {
const char* name;
struct Object** (*member)(void*);
};

struct Member_ret_str_func {
const char* name;
const char** (*member)(void*);
};
void class2oc(const char*,
void* (*cons)(Object*),
void (*destruct)(void*),
ctor_f* cons,
dtor_f* destruct,
Member_func*,
Member_ret_obj_func*,
Member_ret_str_func*);
18 changes: 0 additions & 18 deletions src/oc/hoc_membf.h

This file was deleted.

8 changes: 4 additions & 4 deletions src/oc/hoc_oop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1581,8 +1581,8 @@ void hoc_endtemplate(Symbol* t) {
}

void class2oc_base(const char* name,
void* (*cons)(Object*),
void (*destruct)(void*),
ctor_f* cons,
dtor_f* destruct,
Member_func* m,
Member_ret_obj_func* mobjret,
Member_ret_str_func* strret) {
Expand Down Expand Up @@ -1629,8 +1629,8 @@ void class2oc_base(const char* name,


void class2oc(const char* name,
void* (*cons)(Object*),
void (*destruct)(void*),
ctor_f* cons,
dtor_f* destruct,
Member_func* m,
Member_ret_obj_func* mobjret,
Member_ret_str_func* strret) {
Expand Down
2 changes: 1 addition & 1 deletion test/unit_tests/oc/hoc_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "classreg.h"
#include "code.h"
#include "hocdec.h"
#include "hoc_membf.h"
#include "classreg.h"
#include "ocfunc.h"

#include <sstream>
Expand Down

0 comments on commit 86ed556

Please sign in to comment.