NEURON
neuronapi.cpp File Reference
#include "neuronapi.h"
#include "../../nrnconf.h"
#include "hocdec.h"
#include "cabcode.h"
#include "nrniv_mf.h"
#include "nrnmpi.h"
#include "nrnmpiuse.h"
#include "ocfunc.h"
#include "ocjump.h"
#include "parse.hpp"
#include "nrn_ansi.h"
#include "section.h"
#include "shapeplt.h"
#include <cstring>
#include <exception>

Go to the source code of this file.

Classes

struct  nrn_Item
 A public face of hoc_Item. More...
 
struct  SectionListIterator
 
struct  SymbolTableIterator
 

Functions

void nrnpy_set_pr_etal (int(*cbpr_stdoe)(int, char *), int(*cbpass)())
 
int ivocmain_session (int, const char **, const char **, int start_session)
 This used to be ivocmain, the main entrypoint to the HOC interpreter. More...
 
void simpleconnectsection ()
 
Objecthoc_newobj1 (Symbol *, int)
 
std::tuple< int, const char ** > nrn_mpi_setup (int argc, const char **argv)
 A top-level initialization of MPI given argc and argv. More...
 
int nrn_init (int argc, const char **argv)
 
void nrn_stdout_redirect (int(*myprint)(int, char *))
 
Sectionnrn_section_new (char const *const name)
 
void nrn_section_connect (Section *child_sec, double child_x, Section *parent_sec, double parent_x)
 
void nrn_section_length_set (Section *sec, const double length)
 
double nrn_section_length_get (Section *sec)
 
double nrn_section_Ra_get (Section *sec)
 
void nrn_section_Ra_set (Section *sec, double const val)
 
double nrn_section_rallbranch_get (const Section *sec)
 
void nrn_section_rallbranch_set (Section *sec, double const val)
 
char const * nrn_secname (Section *sec)
 
void nrn_section_push (Section *sec)
 
void nrn_section_pop (void)
 
void nrn_mechanism_insert (Section *sec, const Symbol *mechanism)
 
bool nrn_section_is_active (const Section *sec)
 
void nrn_section_ref (Section *sec)
 
void nrn_section_unref (Section *sec)
 
Sectionnrn_cas (void)
 
int nrn_nseg_get (const Section *sec)
 
void nrn_nseg_set (Section *const sec, const int nseg)
 
void nrn_segment_diam_set (Section *const sec, const double x, const double diam)
 
double nrn_segment_diam_get (Section *const sec, const double x)
 
int nrn_segment_node_index (Section *const sec, const double x)
 
double nrn_rangevar_get (Symbol *sym, Section *sec, double x)
 
void nrn_rangevar_set (Symbol *sym, Section *sec, double x, double value)
 
void nrn_rangevar_push (Symbol *sym, Section *sec, double x)
 
nrn_Itemnrn_allsec (void)
 
nrn_Itemnrn_sectionlist_data (const Object *obj)
 
Symbolnrn_symbol (char const *const name)
 
int nrn_symbol_type (const Symbol *sym)
 
int nrn_symbol_subtype (const Symbol *sym)
 
double * nrn_symbol_dataptr (const Symbol *sym)
 
bool nrn_symbol_is_array (const Symbol *sym)
 
void nrn_symbol_push (Symbol *sym)
 
void nrn_double_push (double val)
 
double nrn_double_pop (void)
 
void nrn_double_ptr_push (double *addr)
 
double * nrn_double_ptr_pop (void)
 
void nrn_str_push (char **str)
 
char ** nrn_str_pop (void)
 
void nrn_int_push (int i)
 
int nrn_int_pop (void)
 
void nrn_object_push (Object *obj)
 
Objectnrn_object_pop (void)
 
nrn_stack_types_t nrn_stack_type (void)
 
char const * nrn_stack_type_name (nrn_stack_types_t id)
 
Objectnrn_object_new (Symbol *sym, int narg)
 
Symbolnrn_method_symbol (const Object *obj, char const *const name)
 
void nrn_method_call (Object *obj, Symbol *method_sym, int narg)
 
void nrn_function_call (Symbol *sym, int narg)
 
int nrn_method_call_nothrow (Object *obj, Symbol *method_sym, int narg, char *error_msg, size_t error_msg_size)
 
int nrn_function_call_nothrow (Symbol *sym, int narg, char *error_msg, size_t error_msg_size)
 
void nrn_object_ref (Object *obj)
 
void nrn_object_unref (Object *obj)
 
char const * nrn_class_name (const Object *obj)
 
bool nrn_prop_exists (const Object *obj)
 
double nrn_distance (Section *sec0, double x0, Section *sec1, double x1)
 
ShapePlotInterfacenrn_get_plotshape_interface (Object *ps)
 
Objectnrn_get_plotshape_section_list (ShapePlotInterface *spi)
 
const char * nrn_get_plotshape_varname (ShapePlotInterface *spi)
 
float nrn_get_plotshape_low (ShapePlotInterface *spi)
 
float nrn_get_plotshape_high (ShapePlotInterface *spi)
 
int nrn_hoc_call (char const *const command)
 
SectionListIteratornrn_sectionlist_iterator_new (nrn_Item *my_sectionlist)
 
void nrn_sectionlist_iterator_free (SectionListIterator *sl)
 
Sectionnrn_sectionlist_iterator_next (SectionListIterator *sl)
 
int nrn_sectionlist_iterator_done (SectionListIterator *sl)
 
SymbolTableIteratornrn_symbol_table_iterator_new (Symlist *my_symbol_table)
 
void nrn_symbol_table_iterator_free (SymbolTableIterator *st)
 
Symbolnrn_symbol_table_iterator_next (SymbolTableIterator *st)
 
int nrn_symbol_table_iterator_done (SymbolTableIterator *st)
 
int nrn_vector_capacity (const Object *vec)
 
double * nrn_vector_data (Object *vec)
 
double nrn_property_get (const Object *obj, const char *name)
 
double nrn_property_array_get (const Object *obj, const char *name, int i)
 
void nrn_property_set (Object *obj, const char *name, double value)
 
void nrn_property_array_set (Object *obj, const char *name, int i, double value)
 
void nrn_property_push (Object *obj, const char *name)
 
void nrn_property_array_push (Object *obj, const char *name, int i)
 
char const * nrn_symbol_name (const Symbol *sym)
 
Symlistnrn_symbol_table (const Symbol *sym)
 
Symlistnrn_global_symbol_table (void)
 
Symlistnrn_top_level_symbol_table (void)
 
int nrn_symbol_array_length (const Symbol *sym)
 
void nrn_register_function (void(*proc)(), const char *func_name, int type)
 
void nrn_hoc_ret ()
 
Object ** nrn_objgetarg (int arg)
 
char * nrn_gargstr (int arg)
 
double * nrn_getarg (int arg)
 
std::FILE * nrn_obj_file_arg (int i)
 
bool nrn_ifarg (int arg)
 
bool nrn_is_object_arg (int arg)
 
bool nrn_is_str_arg (int arg)
 
bool nrn_is_double_arg (int arg)
 
bool nrn_is_pdouble_arg (int arg)
 

Variables

int nrn_nobanner_
 
int diam_changed
 
int nrn_try_catch_nest_depth
 

Function Documentation

◆ hoc_newobj1()

Object* hoc_newobj1 ( Symbol sym,
int  narg 
)

Definition at line 502 of file hoc_oop.cpp.

◆ ivocmain_session()

int ivocmain_session ( int  argc,
const char **  argv,
const char **  env,
int  start_session 
)

This used to be ivocmain, the main entrypoint to the HOC interpreter.

ivocmain_session parses command line argument, calls of initialization functions and drops into an interactive HOC session. This function is called for example by the "real main" in nrnmain.cpp , but can be also called from other external user applications that use NEURON. Additionally to the original implemenation a new parameter start_session was introduced to control whether an interactive HOC session shoudl be started or simply NEURON and all data structures be initialized and control returned to the caller.

Note
env argument should not be used as it might become invalid
Parameters
argcargument count as found in C/C++ main functions
argvargument vector as found in C/C++ main functions
envenvironment variable array as optionally found in main functions.
start_sessionset to 1 for default behavior (drop into interactive HOC session otherwise set to 0. If set to 1, but compiled with python support this function will still directly return (since in that mode we don't need an interactive HOC session either.
Returns
0 on success, otherwise error code.

Definition at line 361 of file ivocmain.cpp.

◆ nrn_allsec()

nrn_Item* nrn_allsec ( void  )

Definition at line 233 of file neuronapi.cpp.

◆ nrn_cas()

Section* nrn_cas ( void  )

Definition at line 167 of file neuronapi.cpp.

◆ nrn_class_name()

char const* nrn_class_name ( const Object obj)

Definition at line 448 of file neuronapi.cpp.

◆ nrn_distance()

double nrn_distance ( Section sec0,
double  x0,
Section sec1,
double  x1 
)

Definition at line 456 of file neuronapi.cpp.

◆ nrn_double_pop()

double nrn_double_pop ( void  )

Definition at line 288 of file neuronapi.cpp.

◆ nrn_double_ptr_pop()

double* nrn_double_ptr_pop ( void  )

Definition at line 296 of file neuronapi.cpp.

◆ nrn_double_ptr_push()

void nrn_double_ptr_push ( double *  addr)

Definition at line 292 of file neuronapi.cpp.

◆ nrn_double_push()

void nrn_double_push ( double  val)

Definition at line 284 of file neuronapi.cpp.

◆ nrn_function_call()

void nrn_function_call ( Symbol sym,
int  narg 
)

Definition at line 382 of file neuronapi.cpp.

◆ nrn_function_call_nothrow()

int nrn_function_call_nothrow ( Symbol sym,
int  narg,
char *  error_msg,
size_t  error_msg_size 
)

Definition at line 416 of file neuronapi.cpp.

◆ nrn_gargstr()

char* nrn_gargstr ( int  arg)

Definition at line 719 of file neuronapi.cpp.

◆ nrn_get_plotshape_high()

float nrn_get_plotshape_high ( ShapePlotInterface spi)

Definition at line 487 of file neuronapi.cpp.

◆ nrn_get_plotshape_interface()

ShapePlotInterface* nrn_get_plotshape_interface ( Object ps)

Definition at line 468 of file neuronapi.cpp.

◆ nrn_get_plotshape_low()

float nrn_get_plotshape_low ( ShapePlotInterface spi)

Definition at line 483 of file neuronapi.cpp.

◆ nrn_get_plotshape_section_list()

Object* nrn_get_plotshape_section_list ( ShapePlotInterface spi)

Definition at line 475 of file neuronapi.cpp.

◆ nrn_get_plotshape_varname()

const char* nrn_get_plotshape_varname ( ShapePlotInterface spi)

Definition at line 479 of file neuronapi.cpp.

◆ nrn_getarg()

double* nrn_getarg ( int  arg)

Definition at line 723 of file neuronapi.cpp.

◆ nrn_global_symbol_table()

Symlist* nrn_global_symbol_table ( void  )

Definition at line 687 of file neuronapi.cpp.

◆ nrn_hoc_call()

int nrn_hoc_call ( char const *const  command)

Definition at line 494 of file neuronapi.cpp.

◆ nrn_hoc_ret()

void nrn_hoc_ret ( void  )

Definition at line 708 of file neuronapi.cpp.

◆ nrn_ifarg()

bool nrn_ifarg ( int  arg)

Definition at line 731 of file neuronapi.cpp.

◆ nrn_init()

int nrn_init ( int  argc,
const char **  argv 
)

Definition at line 58 of file neuronapi.cpp.

◆ nrn_int_pop()

int nrn_int_pop ( void  )

Definition at line 312 of file neuronapi.cpp.

◆ nrn_int_push()

void nrn_int_push ( int  i)

Definition at line 308 of file neuronapi.cpp.

◆ nrn_is_double_arg()

bool nrn_is_double_arg ( int  arg)

Definition at line 746 of file neuronapi.cpp.

◆ nrn_is_object_arg()

bool nrn_is_object_arg ( int  arg)

Definition at line 736 of file neuronapi.cpp.

◆ nrn_is_pdouble_arg()

bool nrn_is_pdouble_arg ( int  arg)

Definition at line 751 of file neuronapi.cpp.

◆ nrn_is_str_arg()

bool nrn_is_str_arg ( int  arg)

Definition at line 741 of file neuronapi.cpp.

◆ nrn_mechanism_insert()

void nrn_mechanism_insert ( Section sec,
const Symbol mechanism 
)

Definition at line 147 of file neuronapi.cpp.

◆ nrn_method_call()

void nrn_method_call ( Object obj,
Symbol method_sym,
int  narg 
)

Definition at line 378 of file neuronapi.cpp.

◆ nrn_method_call_nothrow()

int nrn_method_call_nothrow ( Object obj,
Symbol method_sym,
int  narg,
char *  error_msg,
size_t  error_msg_size 
)

Definition at line 388 of file neuronapi.cpp.

◆ nrn_method_symbol()

Symbol* nrn_method_symbol ( const Object obj,
char const *const  name 
)

Definition at line 374 of file neuronapi.cpp.

◆ nrn_mpi_setup()

std::tuple<int, const char**> nrn_mpi_setup ( int  argc,
const char **  argv 
)

A top-level initialization of MPI given argc and argv.

Sets stubs, load dyn lib, and initializes

Definition at line 770 of file ivocmain.cpp.

◆ nrn_nseg_get()

int nrn_nseg_get ( const Section sec)

Definition at line 176 of file neuronapi.cpp.

◆ nrn_nseg_set()

void nrn_nseg_set ( Section *const  sec,
const int  nseg 
)

Definition at line 181 of file neuronapi.cpp.

◆ nrn_obj_file_arg()

std::FILE* nrn_obj_file_arg ( int  i)

Definition at line 727 of file neuronapi.cpp.

◆ nrn_object_new()

Object* nrn_object_new ( Symbol sym,
int  narg 
)

Definition at line 370 of file neuronapi.cpp.

◆ nrn_object_pop()

Object* nrn_object_pop ( void  )

Definition at line 320 of file neuronapi.cpp.

◆ nrn_object_push()

void nrn_object_push ( Object obj)

Definition at line 316 of file neuronapi.cpp.

◆ nrn_object_ref()

void nrn_object_ref ( Object obj)

Definition at line 440 of file neuronapi.cpp.

◆ nrn_object_unref()

void nrn_object_unref ( Object obj)

Definition at line 444 of file neuronapi.cpp.

◆ nrn_objgetarg()

Object** nrn_objgetarg ( int  arg)

Definition at line 715 of file neuronapi.cpp.

◆ nrn_prop_exists()

bool nrn_prop_exists ( const Object obj)

Definition at line 452 of file neuronapi.cpp.

◆ nrn_property_array_get()

double nrn_property_array_get ( const Object obj,
const char *  name,
int  i 
)

Definition at line 613 of file neuronapi.cpp.

◆ nrn_property_array_push()

void nrn_property_array_push ( Object obj,
const char *  name,
int  i 
)

Definition at line 664 of file neuronapi.cpp.

◆ nrn_property_array_set()

void nrn_property_array_set ( Object obj,
const char *  name,
int  i,
double  value 
)

Definition at line 639 of file neuronapi.cpp.

◆ nrn_property_get()

double nrn_property_get ( const Object obj,
const char *  name 
)

Definition at line 600 of file neuronapi.cpp.

◆ nrn_property_push()

void nrn_property_push ( Object obj,
const char *  name 
)

Definition at line 652 of file neuronapi.cpp.

◆ nrn_property_set()

void nrn_property_set ( Object obj,
const char *  name,
double  value 
)

Definition at line 626 of file neuronapi.cpp.

◆ nrn_rangevar_get()

double nrn_rangevar_get ( Symbol sym,
Section sec,
double  x 
)

Definition at line 221 of file neuronapi.cpp.

◆ nrn_rangevar_push()

void nrn_rangevar_push ( Symbol sym,
Section sec,
double  x 
)

Definition at line 229 of file neuronapi.cpp.

◆ nrn_rangevar_set()

void nrn_rangevar_set ( Symbol sym,
Section sec,
double  x,
double  value 
)

Definition at line 225 of file neuronapi.cpp.

◆ nrn_register_function()

void nrn_register_function ( void(*)()  proc,
const char *  func_name,
int  type 
)

Definition at line 700 of file neuronapi.cpp.

◆ nrn_secname()

char const* nrn_secname ( Section sec)

Definition at line 135 of file neuronapi.cpp.

◆ nrn_section_connect()

void nrn_section_connect ( Section child_sec,
double  child_x,
Section parent_sec,
double  parent_x 
)

Definition at line 89 of file neuronapi.cpp.

◆ nrn_section_is_active()

bool nrn_section_is_active ( const Section sec)

Definition at line 152 of file neuronapi.cpp.

◆ nrn_section_length_get()

double nrn_section_length_get ( Section sec)

Definition at line 108 of file neuronapi.cpp.

◆ nrn_section_length_set()

void nrn_section_length_set ( Section sec,
const double  length 
)

Definition at line 97 of file neuronapi.cpp.

◆ nrn_section_new()

Section* nrn_section_new ( char const *const  name)

Definition at line 76 of file neuronapi.cpp.

◆ nrn_section_pop()

void nrn_section_pop ( void  )

Definition at line 143 of file neuronapi.cpp.

◆ nrn_section_push()

void nrn_section_push ( Section sec)

Definition at line 139 of file neuronapi.cpp.

◆ nrn_section_Ra_get()

double nrn_section_Ra_get ( Section sec)

Definition at line 112 of file neuronapi.cpp.

◆ nrn_section_Ra_set()

void nrn_section_Ra_set ( Section sec,
double const  val 
)

Definition at line 116 of file neuronapi.cpp.

◆ nrn_section_rallbranch_get()

double nrn_section_rallbranch_get ( const Section sec)

Definition at line 124 of file neuronapi.cpp.

◆ nrn_section_rallbranch_set()

void nrn_section_rallbranch_set ( Section sec,
double const  val 
)

Definition at line 128 of file neuronapi.cpp.

◆ nrn_section_ref()

void nrn_section_ref ( Section sec)

Definition at line 159 of file neuronapi.cpp.

◆ nrn_section_unref()

void nrn_section_unref ( Section sec)

Definition at line 163 of file neuronapi.cpp.

◆ nrn_sectionlist_data()

nrn_Item* nrn_sectionlist_data ( const Object obj)

Definition at line 237 of file neuronapi.cpp.

◆ nrn_sectionlist_iterator_done()

int nrn_sectionlist_iterator_done ( SectionListIterator sl)

Definition at line 570 of file neuronapi.cpp.

◆ nrn_sectionlist_iterator_free()

void nrn_sectionlist_iterator_free ( SectionListIterator sl)

Definition at line 562 of file neuronapi.cpp.

◆ nrn_sectionlist_iterator_new()

SectionListIterator* nrn_sectionlist_iterator_new ( nrn_Item my_sectionlist)

Definition at line 558 of file neuronapi.cpp.

◆ nrn_sectionlist_iterator_next()

Section* nrn_sectionlist_iterator_next ( SectionListIterator sl)

Definition at line 566 of file neuronapi.cpp.

◆ nrn_segment_diam_get()

double nrn_segment_diam_get ( Section *const  sec,
const double  x 
)

Definition at line 198 of file neuronapi.cpp.

◆ nrn_segment_diam_set()

void nrn_segment_diam_set ( Section *const  sec,
const double  x,
const double  diam 
)

Definition at line 185 of file neuronapi.cpp.

◆ nrn_segment_node_index()

int nrn_segment_node_index ( Section *const  sec,
const double  x 
)

Definition at line 214 of file neuronapi.cpp.

◆ nrn_stack_type()

nrn_stack_types_t nrn_stack_type ( void  )

Definition at line 329 of file neuronapi.cpp.

◆ nrn_stack_type_name()

char const* nrn_stack_type_name ( nrn_stack_types_t  id)

Definition at line 349 of file neuronapi.cpp.

◆ nrn_stdout_redirect()

void nrn_stdout_redirect ( int(*)(int, char *)  myprint)

Definition at line 65 of file neuronapi.cpp.

◆ nrn_str_pop()

char** nrn_str_pop ( void  )

Definition at line 304 of file neuronapi.cpp.

◆ nrn_str_push()

void nrn_str_push ( char **  str)

Definition at line 300 of file neuronapi.cpp.

◆ nrn_symbol()

Symbol* nrn_symbol ( char const *const  name)

Definition at line 246 of file neuronapi.cpp.

◆ nrn_symbol_array_length()

int nrn_symbol_array_length ( const Symbol sym)

Definition at line 695 of file neuronapi.cpp.

◆ nrn_symbol_dataptr()

double* nrn_symbol_dataptr ( const Symbol sym)

Definition at line 260 of file neuronapi.cpp.

◆ nrn_symbol_is_array()

bool nrn_symbol_is_array ( const Symbol sym)

Definition at line 276 of file neuronapi.cpp.

◆ nrn_symbol_name()

char const* nrn_symbol_name ( const Symbol sym)

Definition at line 677 of file neuronapi.cpp.

◆ nrn_symbol_push()

void nrn_symbol_push ( Symbol sym)

Definition at line 280 of file neuronapi.cpp.

◆ nrn_symbol_subtype()

int nrn_symbol_subtype ( const Symbol sym)

Definition at line 256 of file neuronapi.cpp.

◆ nrn_symbol_table()

Symlist* nrn_symbol_table ( const Symbol sym)

Definition at line 681 of file neuronapi.cpp.

◆ nrn_symbol_table_iterator_done()

int nrn_symbol_table_iterator_done ( SymbolTableIterator st)

Definition at line 586 of file neuronapi.cpp.

◆ nrn_symbol_table_iterator_free()

void nrn_symbol_table_iterator_free ( SymbolTableIterator st)

Definition at line 578 of file neuronapi.cpp.

◆ nrn_symbol_table_iterator_new()

SymbolTableIterator* nrn_symbol_table_iterator_new ( Symlist my_symbol_table)

Definition at line 574 of file neuronapi.cpp.

◆ nrn_symbol_table_iterator_next()

Symbol* nrn_symbol_table_iterator_next ( SymbolTableIterator st)

Definition at line 582 of file neuronapi.cpp.

◆ nrn_symbol_type()

int nrn_symbol_type ( const Symbol sym)

Definition at line 250 of file neuronapi.cpp.

◆ nrn_top_level_symbol_table()

Symlist* nrn_top_level_symbol_table ( void  )

Definition at line 691 of file neuronapi.cpp.

◆ nrn_vector_capacity()

int nrn_vector_capacity ( const Object vec)

Definition at line 590 of file neuronapi.cpp.

◆ nrn_vector_data()

double* nrn_vector_data ( Object vec)

Definition at line 595 of file neuronapi.cpp.

◆ nrnpy_set_pr_etal()

void nrnpy_set_pr_etal ( int(*)(int, char *)  cbpr_stdoe,
int(*)()  cbpass 
)

Definition at line 816 of file fileio.cpp.

◆ simpleconnectsection()

void simpleconnectsection ( )

Definition at line 664 of file cabcode.cpp.

Variable Documentation

◆ diam_changed

int diam_changed
extern

Definition at line 55 of file cabcode.cpp.

◆ nrn_nobanner_

int nrn_nobanner_
extern

Definition at line 119 of file hoc.cpp.

◆ nrn_try_catch_nest_depth

int nrn_try_catch_nest_depth
extern

Definition at line 608 of file hoc.cpp.