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 5 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
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/ivoc/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ extern Image* gif_image(const char*);
#include "ivocvect.h"
#endif /* HAVE_IV */

#include "classreg.h"
#include "classreg.hpp"
#include "gui-redirect.h"

#if HAVE_IV
Expand Down Expand Up @@ -1194,7 +1194,7 @@ static Member_func gr_members[] = {{"plot", gr_plot},
{"gif", ivoc_gr_gif},
{"menu_remove", ivoc_gr_menu_remove},
{"line_info", gr_line_info},
{0, 0}};
{nullptr, nullptr}};

static void* gr_cons(Object* ho) {
TRY_GUI_REDIRECT_OBJ("Graph", NULL);
Expand Down
8 changes: 3 additions & 5 deletions src/ivoc/grglyph.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <../../nrnconf.h>
// hoc level Glyph implementation for graphing
#include <stdio.h>
#include "classreg.h"
#include "classreg.hpp"
#include "oc2iv.h"
#if HAVE_IV
#include "ivoc.h"
Expand Down Expand Up @@ -184,8 +184,6 @@ static Object** g_gif(void* v) {

static Symbol* sggl_;

Member_func members[] = {{0, 0}};

Member_ret_obj_func objmembers[] = {{"path", g_new_path},
{"m", g_move_to},
{"l", g_line_to},
Expand All @@ -197,7 +195,7 @@ Member_ret_obj_func objmembers[] = {{"path", g_new_path},
{"erase", g_erase},
{"gif", g_gif},
{"circle", g_circle},
{0, 0}};
{nullptr, nullptr}};

static void* cons(Object* o) {
TRY_GUI_REDIRECT_OBJ("Glyph", NULL);
Expand All @@ -213,7 +211,7 @@ static void destruct(void* v) {
}

void GrGlyph_reg() {
class2oc("Glyph", cons, destruct, members, objmembers, NULL);
class2oc("Glyph", cons, destruct, nullptr, objmembers, nullptr);
sggl_ = hoc_lookup("Glyph");
}

Expand Down
4 changes: 2 additions & 2 deletions src/ivoc/ivocrand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "Rand.hpp"

#include <InterViews/resource.h>
#include "classreg.h"
#include "classreg.hpp"
#include "oc2iv.h"
#include "utils/enumerate.h"

Expand Down Expand Up @@ -425,7 +425,7 @@ static Member_func r_members[] = {{"MCellRan4", r_MCellRan4},
{nullptr, nullptr}};

void Random_reg() {
class2oc("Random", r_cons, r_destruct, r_members, NULL, NULL);
class2oc("Random", r_cons, r_destruct, r_members, nullptr, nullptr);
random_play_list_ = new RandomPlayList;
}

Expand Down
8 changes: 4 additions & 4 deletions src/ivoc/ivocvect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <IV-look/kit.h>
#endif

#include "classreg.h"
#include "classreg.hpp"
#if HAVE_IV
#include "apwindow.h"
#include "ivoc.h"
Expand Down Expand Up @@ -3737,7 +3737,7 @@ static Member_func v_members[] = {

{"scale", v_scale},

{0, 0}};
{nullptr, nullptr}};

static Member_ret_obj_func v_retobj_members[] = {{"c", v_c},
{"cl", v_cl},
Expand Down Expand Up @@ -3813,11 +3813,11 @@ static Member_ret_obj_func v_retobj_members[] = {{"c", v_c},
{"to_python", v_to_python},
{"as_numpy", v_as_numpy},

{0, 0}};
{nullptr, nullptr}};

static Member_ret_str_func v_retstr_members[] = {{"label", v_label},

{0, 0}};
{nullptr, nullptr}};

extern int hoc_araypt(Symbol*, int);

Expand Down
8 changes: 4 additions & 4 deletions src/ivoc/matrix.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <../../nrnconf.h>
#include "classreg.h"
#include "classreg.hpp"

#include <stdio.h>
#include <math.h>
Expand Down Expand Up @@ -657,7 +657,7 @@ static Member_func m_members[] = {
{"printf", m_printf},
{"fprint", m_fprint},
{"scanf", m_scanf},
{0, 0}};
{nullptr, nullptr}};

static Member_ret_obj_func m_retobj_members[] = {
// returns Vector
Expand Down Expand Up @@ -687,7 +687,7 @@ static Member_ret_obj_func m_retobj_members[] = {
{"set", m_set},
{"to_vector", m_to_vector},
{"from_vector", m_from_vector},
{0, 0}};
{nullptr, nullptr}};

static void* m_cons(Object* o) {
int i = 1, j = 1, storage_type = Matrix::MFULL;
Expand Down Expand Up @@ -729,7 +729,7 @@ void Matrix_reg();
#endif

void Matrix_reg() {
class2oc("Matrix", m_cons, m_destruct, m_members, m_retobj_members, NULL);
class2oc("Matrix", m_cons, m_destruct, m_members, m_retobj_members, nullptr);
nrn_matrix_sym = hoc_lookup("Matrix");
// now make the x variable an actual double
Symbol* sx = hoc_table_lookup("x", nrn_matrix_sym->u.ctemplate->symtable);
Expand Down
6 changes: 3 additions & 3 deletions src/ivoc/mlinedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extern int hoc_return_type_code;
#include "ocglyph.h"
#endif

#include "classreg.h"
#include "classreg.hpp"
#if HAVE_IV
#include "oc2iv.h"
#include "apwindow.h"
Expand Down Expand Up @@ -101,9 +101,9 @@ static const char** v_text(void* v) {
}


static Member_func members[] = {{"readonly", readonly}, {"map", map}, {0, 0}};
static Member_func members[] = {{"readonly", readonly}, {"map", map}, {nullptr, nullptr}};

static Member_ret_str_func retstr_members[] = {{"text", v_text}, {0, 0}};
static Member_ret_str_func retstr_members[] = {{"text", v_text}, {nullptr, nullptr}};

static void* cons(Object*) {
TRY_GUI_REDIRECT_OBJ("TextEditor", NULL);
Expand Down
6 changes: 3 additions & 3 deletions src/ivoc/mymath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <../../nrnconf.h>
#include <InterViews/geometry.h>
#include "mymath.h"
#include "classreg.h"
#include "classreg.hpp"
#include "oc2iv.h"
#include <cmath>
#include <cstdio>
Expand Down Expand Up @@ -64,7 +64,7 @@ static Member_func members[] = {{"d2line", distance_to_line},
{"d2line_seg", distance_to_line_segment},
{"inside", inside},
{"feround", feround},
{0, 0}};
{nullptr, nullptr}};

static void* cons(Object*) {
return NULL;
Expand All @@ -73,7 +73,7 @@ static void* cons(Object*) {
static void destruct(void*) {}

void GUIMath_reg() {
class2oc("GUIMath", cons, destruct, members, NULL, NULL);
class2oc("GUIMath", cons, destruct, members, nullptr, nullptr);
}

double MyMath::anint(double x) {
Expand Down
8 changes: 4 additions & 4 deletions src/ivoc/ocbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#endif /* HAVE_IV */

#include "oc2iv.h"
#include "classreg.h"
#include "classreg.hpp"

#include "gui-redirect.h"

Expand Down Expand Up @@ -426,14 +426,14 @@ static Member_func members[] = {{"intercept", intercept}, // #if HAVE
{"dialog", dialog}, // #if HAVE_IV ok
{"priority", ses_pri},
{"size", b_size},
{0, 0}};
{nullptr, nullptr}};

void HBox_reg() {
class2oc("HBox", hcons, destruct, members, NULL, NULL);
class2oc("HBox", hcons, destruct, members, nullptr, nullptr);
}

void VBox_reg() {
class2oc("VBox", vcons, destruct, members, NULL, NULL);
class2oc("VBox", vcons, destruct, members, nullptr, nullptr);
}
#if HAVE_IV
OcGlyphContainer::OcGlyphContainer()
Expand Down
6 changes: 3 additions & 3 deletions src/ivoc/ocdeck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "apwindow.h"
#include "oc2iv.h"
#endif /* HAVE_IV */
#include "classreg.h"
#include "classreg.hpp"
#include "gui-redirect.h"

#if HAVE_IV
Expand Down Expand Up @@ -236,10 +236,10 @@ static Member_func members[] = {{"flip_to", flip_to},
{"remove_last", remove_last},
{"remove", remove},
{"move_last", move_last},
{0, 0}};
{nullptr, nullptr}};

void OcDeck_reg() {
class2oc("Deck", cons, destruct, members, NULL, NULL);
class2oc("Deck", cons, destruct, members, nullptr, nullptr);
}
#if HAVE_IV
OcDeck::OcDeck()
Expand Down
10 changes: 6 additions & 4 deletions src/ivoc/ocfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extern int hoc_return_type_code;
#endif
#include "nrnmpi.h"
#include "oc2iv.h"
#include "classreg.h"
#include "classreg.hpp"
#include "ocfile.h"
#include "nrnfilewrap.h"

Expand Down Expand Up @@ -294,12 +294,14 @@ Member_func f_members[] = {{"ropen", f_ropen},
{"mktemp", f_mktemp},
{"unlink", f_unlink},
{"flush", f_flush},
{0, 0}};
{nullptr, nullptr}};

static Member_ret_str_func f_retstr_members[] = {{"getname", f_get_name}, {"dir", f_dir}, {0, 0}};
static Member_ret_str_func f_retstr_members[] = {{"getname", f_get_name},
{"dir", f_dir},
{nullptr, nullptr}};

void OcFile_reg() {
class2oc("File", f_cons, f_destruct, f_members, NULL, f_retstr_members);
class2oc("File", f_cons, f_destruct, f_members, nullptr, f_retstr_members);
file_class_sym_ = hoc_lookup("File");
}

Expand Down
4 changes: 2 additions & 2 deletions src/ivoc/oclist.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <../../nrnconf.h>

#include <stdio.h>
#include "classreg.h"
#include "classreg.hpp"
#include "oclist.h"
#include "oc2iv.h"
#include "hoclist.h"
Expand Down Expand Up @@ -454,7 +454,7 @@ OcList::~OcList() {

void OcList_reg() {
// printf("Oclist_reg\n");
class2oc("List", l_cons, l_destruct, l_members, l_retobj_members, NULL);
class2oc("List", l_cons, l_destruct, l_members, l_retobj_members, nullptr);
list_class_sym_ = hoc_lookup("List");
}

Expand Down
6 changes: 3 additions & 3 deletions src/ivoc/ocpointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
#include <InterViews/observe.h>
#include <string.h>
#include "classreg.h"
#include "classreg.hpp"
#include "oc_ansi.h"
#include "oc2iv.h"
#include "ocpointer.h"
Expand Down Expand Up @@ -68,7 +68,7 @@ static const char** pname(void* v) {

static Member_func members[] = {{"val", 0}, // will be changed below
{"assign", assign}, // will call assign_stmt if it exists
{0, 0}};
{nullptr, nullptr}};

static Member_ret_str_func s_memb[] = {{"s", pname}, {nullptr, nullptr}};

Expand Down Expand Up @@ -108,7 +108,7 @@ static void steer_val(void* v) {
}

void OcPointer_reg() {
class2oc("Pointer", cons, destruct, members, NULL, s_memb);
class2oc("Pointer", cons, destruct, members, nullptr, s_memb);
// now make the val variable an actual double
Symbol* sv = hoc_lookup("Pointer");
Symbol* sx = hoc_table_lookup("val", sv->u.ctemplate->symtable);
Expand Down
8 changes: 4 additions & 4 deletions src/ivoc/ocptrvector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
p.scatter(Vector)
p.gather(Vector)
*/
#include "classreg.h"
#include "classreg.hpp"
#include "oc2iv.h"
#include "ocptrvector.h"
#include "objcmd.h"
Expand Down Expand Up @@ -206,9 +206,9 @@ static Member_func members[] = {{"size", get_size},
{"scatter", scatter},
{"gather", gather},
{"plot", ptr_plot},
{0, 0}};
{nullptr, nullptr}};

static Member_ret_str_func retstr_members[] = {{"label", ptr_label}, {0, 0}};
static Member_ret_str_func retstr_members[] = {{"label", ptr_label}, {nullptr, nullptr}};

static void* cons(Object*) {
int sz;
Expand All @@ -222,6 +222,6 @@ static void destruct(void* v) {
}

void OcPtrVector_reg() {
class2oc("PtrVector", cons, destruct, members, 0, retstr_members);
class2oc("PtrVector", cons, destruct, members, nullptr, retstr_members);
pv_class_sym_ = hoc_lookup("PtrVector");
}
9 changes: 6 additions & 3 deletions src/ivoc/octimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "oc2iv.h"
#include "objcmd.h"
#endif /* HAVE_IV */
#include "classreg.h"
#include "classreg.hpp"

#ifdef MINGW
#include <windows.h>
Expand Down Expand Up @@ -96,10 +96,13 @@ static void t_destruct(void* v) {
#endif /* HAVE_IV */
}

Member_func t_members[] = {{"seconds", t_seconds}, {"start", t_start}, {"end", t_stop}, {0, 0}};
Member_func t_members[] = {{"seconds", t_seconds},
{"start", t_start},
{"end", t_stop},
{nullptr, nullptr}};

void OcTimer_reg() {
class2oc("Timer", t_cons, t_destruct, t_members, NULL, NULL);
class2oc("Timer", t_cons, t_destruct, t_members, nullptr, nullptr);
}
#if HAVE_IV
OcTimer::OcTimer(const char* cmd) {
Expand Down
8 changes: 4 additions & 4 deletions src/ivoc/pwman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extern int hoc_return_type_code;
#endif // HAVE_IV
#include <stdio.h>
#include <stdlib.h>
#include "classreg.h"
#include "classreg.hpp"
#include "oc2iv.h"
#include <cmath>

Expand Down Expand Up @@ -794,11 +794,11 @@ static Member_func members[] = {{"count", pwman_count},
{"printfile", pwman_printfile},
{"landscape", pwman_landscape},
{"deco", pwman_deco},
{0, 0}};
{nullptr, nullptr}};

static Member_ret_obj_func retobj_members[] = {{"group", pwman_group}, {0, 0}};
static Member_ret_obj_func retobj_members[] = {{"group", pwman_group}, {nullptr, nullptr}};

static Member_ret_str_func s_memb[] = {{"name", pwman_name}, {0, 0}};
static Member_ret_str_func s_memb[] = {{"name", pwman_name}, {nullptr, nullptr}};

void PWManager_reg() {
class2oc("PWManager", pwman_cons, pwman_destruct, members, retobj_members, s_memb);
Expand Down
Loading
Loading