Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group headers in once for class registration #3247

Merged
merged 9 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/NeuronFileLists.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ set(HEADER_FILES_TO_INSTALL
nrnoc/options.h
nrnoc/section_fwd.hpp
nrnoc/treeset.h
oc/classreg.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
11 changes: 1 addition & 10 deletions src/nrnoc/seclist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "parse.hpp"
#include "hocparse.h"
#include "code.h"
#include "hoc_membf.h"
#include "classreg.h"

/* needs trailing '}' */
#define ITERATE_REMOVE(q1, q2, lst) \
Expand Down Expand Up @@ -252,15 +252,6 @@ static Member_func members[] = {{"append", append},
{"allroots", allroots},
{nullptr, nullptr}};


extern void class2oc(const char*,
void* (*cons)(Object*),
void (*destruct)(void*),
Member_func*,
Member_ret_obj_func*,
Member_ret_str_func*);


void SectionList_reg(void) {
/* printf("SectionList_reg\n");*/
class2oc("SectionList", constructor, destructor, members, nullptr, nullptr);
Expand Down
11 changes: 1 addition & 10 deletions src/nrnoc/secref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ access s1.sec // soma becomes the default section
#include <stdlib.h>
#include "section.h"
#include "parse.hpp"
#include "hoc_membf.h"
#include "classreg.h"
#include "oc_ansi.h"

extern int hoc_return_type_code;
Expand Down Expand Up @@ -361,15 +361,6 @@ Section* nrn_sectionref_steer(Section* sec, Symbol* sym, int* pnindex) {
return s;
}


extern void class2oc(const char*,
void* (*cons)(Object*),
void (*destruct)(void*),
Member_func*,
Member_ret_obj_func*,
Member_ret_str_func*);


void SectionRef_reg(void) {
Symbol *s, *sr;

Expand Down
34 changes: 25 additions & 9 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>

extern void class2oc(const char*,
void* (*cons)(Object*),
void (*destruct)(void*),
Member_func*,
Member_ret_obj_func*,
Member_ret_str_func*);
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*,
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
Loading