Skip to content

Commit

Permalink
Refactor printing FUNCTIONS.
Browse files Browse the repository at this point in the history
Adds a method to print the definitions for FUNCTIONs and PROCEDUREs.
More precisely, the implementation function, not their wrappers for
HOC/Python.
  • Loading branch information
1uc committed Oct 18, 2024
1 parent 6bcacea commit d850d85
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/codegen/codegen_neuron_cpp_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2334,8 +2334,7 @@ void CodegenNeuronCppVisitor::print_g_unused() const {
)CODE");
}


void CodegenNeuronCppVisitor::print_compute_functions() {
void CodegenNeuronCppVisitor::print_function_definitions() {
print_hoc_py_wrapper_function_definitions();
for (const auto& procedure: info.procedures) {
print_procedure(*procedure);
Expand All @@ -2346,7 +2345,9 @@ void CodegenNeuronCppVisitor::print_compute_functions() {
for (const auto& function_table: info.function_tables) {
print_function_tables(*function_table);
}
}

void CodegenNeuronCppVisitor::print_compute_functions() {
print_nrn_init();
print_nrn_cur();
print_nrn_state();
Expand Down Expand Up @@ -2377,6 +2378,7 @@ void CodegenNeuronCppVisitor::print_codegen_routines() {
print_functors_definitions();
print_global_variables_for_hoc();
print_thread_memory_callbacks();
print_function_definitions();
print_compute_functions(); // only nrn_cur and nrn_state
print_nrn_constructor();
print_nrn_destructor();
Expand Down
8 changes: 8 additions & 0 deletions src/codegen/codegen_neuron_cpp_visitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,14 @@ class CodegenNeuronCppVisitor: public CodegenCppVisitor {
void print_function_prototypes() override;


/**
* Print function and procedures prototype definitions.
*
* This includes the HOC/Python wrappers.
*/
void print_function_definitions();


/**
* Print all `check_*` function declarations
*/
Expand Down

0 comments on commit d850d85

Please sign in to comment.