NEURON
cabcode.cpp File Reference
#include "neuron/container/generic_data_handle.hpp"
#include <../../nrnconf.h>
#include <regex>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include "section.h"
#include "nrniv_mf.h"
#include "membfunc.h"
#include "parse.hpp"
#include "hocparse.h"
#include "membdef.h"

Go to the source code of this file.

Classes

class  VoidPointerError
 

Macros

#define HOC_L_LIST   1
 
#define symlist   hoc_symlist
 
#define NSECSTACK   200
 
#define CAB_SIZE   10
 
#define PI   3.14159265358979323846
 
#define relative(pc)   (pc + (pc)->i)
 

Functions

static char * escape_bracket (const char *s)
 
static int range_vec_indx (Symbol *s)
 
int nrn_isecstack (void)
 
void nrn_secstack (int i)
 
void nrn_initcode (void)
 
void oc_save_cabcode (int *a1, int *a2)
 
void oc_restore_cabcode (int *a1, int *a2)
 
void nrn_pushsec (Section *sec)
 
void nrn_popsec (void)
 
void sec_access_pop (void)
 
void add_section (void)
 
Objectnrn_sec2cell (Section *sec)
 
int nrn_sec2cell_equals (Section *sec, Object *obj)
 
static Sectionnew_section (Object *ob, Symbol *sym, int i)
 
void new_sections (Object *ob, Symbol *sym, Item **pitm, int size)
 
Sectionsection_new (Symbol *sym)
 Creates a new section and registers with the global section list. More...
 
void delete_section (void)
 
double section_length (Section *sec)
 
int arc0at0 (Section *sec)
 
double nrn_ra (Section *sec)
 
void cab_alloc (Prop *p)
 
void morph_alloc (Prop *p)
 
double nrn_diameter (Node *nd)
 
Sectionchk_access ()
 
Sectionnrn_noerr_access (void)
 return 0 if no accessed section More...
 
static void nrn_remove_sibling_list (Section *sec)
 
static double ncp_abs (Section *sec)
 
static void nrn_add_sibling_list (Section *sec)
 
static void reverse_sibling_list (Section *sec)
 
void disconnect ()
 
static void reverse_nodes (Section *sec)
 
void nrn_disconnect (Section *sec)
 
static void connectsec_impl (Section *parent, Section *sec)
 
void simpleconnectsection (void)
 
void connectsection (void)
 
static SectionSec_access (void)
 
void sec_access (void)
 
void sec_access_object (void)
 
void sec_access_push (void)
 
Sectionnrn_sec_pop (void)
 
void hoc_sec_internal_push (void)
 
void * hoc_sec_internal_name2ptr (const char *s, int eflag)
 
void * hoc_pysec_name2ptr (const char *s, int)
 
void ob_sec_access_push (hoc_Item *qsec)
 
void ob_sec_access ()
 
void mech_access (void)
 
void mech_insert1 (Section *sec, int type)
 
void mech_uninsert (void)
 
void mech_uninsert1 (Section *sec, Symbol *s)
 
void nrn_rangeconst (Section *sec, Symbol *s, neuron::container::data_handle< double > pd, int op)
 
void range_const ()
 
Propnrn_mechanism (int type, Node *nd)
 
Propnrn_mechanism_check (int type, Section *sec, int inode)
 returns prop given mech type, section, and inode error if mech not at this position More...
 
Prophoc_getdata_range (int type)
 
static Datumpdprop (Symbol *s, int indx, Section *sec, short inode)
 
void connectpointer ()
 
void range_interpolate_single (void)
 
void range_interpolate (void)
 
int nrn_exists (Symbol *s, Node *node)
 
neuron::container::data_handle< double > nrn_rangepointer (Section *sec, Symbol *s, double d)
 
neuron::container::generic_data_handle nrnpy_rangepointer (Section *sec, Symbol *s, double d, int *err, int idx)
 return nullptr if failure instead of hoc_execerror and return pointer to the 0 element if an array More...
 
void rangevarevalpointer ()
 
void rangevareval (void)
 
void rangepoint (void)
 
void rangeobjeval (void)
 
void rangeobjevalmiddle (void)
 
int node_index (Section *sec, double x)
 returns nearest index to x More...
 
int node_index_exact (Section *sec, double x)
 return -1 if x at connection end, nnode-1 if at other end More...
 
double cable_prop_eval (Symbol *sym)
 
double * cable_prop_eval_pointer (Symbol *sym)
 
void keep_nseg_parm (void)
 
void nrn_change_nseg (Section *sec, int n)
 
void cable_prop_assign (Symbol *sym, double *pd, int op)
 
double nrn_connection_position (Section *sec)
 
double nrn_section_orientation (Section *sec)
 
int nrn_at_beginning (Section *sec)
 
static void nrn_rootnode_alloc (Section *sec)
 
Sectionnrn_trueparent (Section *sec)
 
void nrn_parent_info (Section *s)
 
void setup_topology (void)
 
const char * secname (Section *sec)
 name of section (for use in error messages) More...
 
const char * nrn_sec2pysecname (Section *sec)
 
void section_owner (void)
 
char * hoc_section_pathname (Section *sec)
 
double nrn_arc_position (Section *sec, Node *node)
 
const char * sec_and_position (Section *sec, Node *nd)
 
int segment_limits (double *pdx)
 
Nodenode_exact (Section *sec, double x)
 like node_index but give proper node when x is 0 or 1 as well as in between More...
 
Nodenode_ptr (Section *sec, double x, double *parea)
 
int nrn_get_mechtype (const char *mechname)
 
double * nrn_vext_pd (Symbol *s, int indx, Node *nd)
 
neuron::container::generic_data_handle dprop_impl (Prop *m, Symbol *s, int indx, Section *sec, short inode)
 
neuron::container::data_handle< double > dprop (Symbol *s, int indx, Section *sec, short inode)
 returns location of property symbol More...
 
neuron::container::generic_data_handle nrnpy_dprop (Symbol *s, int indx, Section *sec, short inode, int *err)
 returns location of property symbol, return nullptr instead of hoc_execerror More...
 
static char * objectname (void)
 
void forall_section (void)
 
void hoc_ifsec (void)
 
void issection (void)
 
int has_membrane (char *mechanism_name, Section *sec)
 
void ismembrane (void)
 
void sectionname (void)
 
void hoc_secname (void)
 
static double chk_void2dbl (void *vp, const char *mes)
 
void this_section (void)
 
void this_node (void)
 
void parent_section (void)
 
void parent_connection (void)
 
void section_orientation (void)
 
void parent_node (void)
 
void pop_section (void)
 
void hoc_level_pushsec (Section *sec)
 turn off section stack fixing (in case of return, continue, break in a section statement) between explicit user level push_section, etc and pop_section More...
 
void push_section (void)
 
Sectionnrn_section_exists (char *name, int indx, Object *cell)
 
void section_exists (void)
 

Variables

int hoc_execerror_messages
 
int tree_changed = 1
 
int diam_changed = 1
 
int nrn_shape_changed_
 
char *(* nrnpy_pysec_name_p_ )(Section *)
 
Object *(* nrnpy_pysec_cell_p_ )(Section *)
 
int(* nrnpy_pysec_cell_equals_p_ )(Section *, Object *)
 
static Sectionsecstack [NSECSTACK+1]
 
static int isecstack = 0
 
static int skip_secstack_check = 0
 
int keep_nseg_parm_
 

Macro Definition Documentation

◆ CAB_SIZE

#define CAB_SIZE   10

◆ HOC_L_LIST

#define HOC_L_LIST   1

Definition at line 10 of file cabcode.cpp.

◆ NSECSTACK

#define NSECSTACK   200

Definition at line 73 of file cabcode.cpp.

◆ PI

#define PI   3.14159265358979323846

Definition at line 1798 of file cabcode.cpp.

◆ relative

#define relative (   pc)    (pc + (pc)->i)

Definition at line 1961 of file cabcode.cpp.

◆ symlist

#define symlist   hoc_symlist

Definition at line 49 of file cabcode.cpp.

Function Documentation

◆ add_section()

void add_section ( void  )

Definition at line 205 of file cabcode.cpp.

◆ arc0at0()

int arc0at0 ( Section sec)

Definition at line 413 of file cabcode.cpp.

◆ cab_alloc()

void cab_alloc ( Prop p)

Definition at line 421 of file cabcode.cpp.

◆ cable_prop_assign()

void cable_prop_assign ( Symbol sym,
double *  pd,
int  op 
)

Definition at line 1512 of file cabcode.cpp.

◆ cable_prop_eval()

double cable_prop_eval ( Symbol sym)

Definition at line 1447 of file cabcode.cpp.

◆ cable_prop_eval_pointer()

double* cable_prop_eval_pointer ( Symbol sym)

Definition at line 1461 of file cabcode.cpp.

◆ chk_access()

Section* chk_access ( )

Definition at line 449 of file cabcode.cpp.

◆ chk_void2dbl()

static double chk_void2dbl ( void *  vp,
const char *  mes 
)
static

Definition at line 2106 of file cabcode.cpp.

◆ connectpointer()

void connectpointer ( void  )

Definition at line 1084 of file cabcode.cpp.

◆ connectsec_impl()

static void connectsec_impl ( Section parent,
Section sec 
)
static

Definition at line 615 of file cabcode.cpp.

◆ connectsection()

void connectsection ( void  )

Definition at line 673 of file cabcode.cpp.

◆ delete_section()

void delete_section ( void  )

Definition at line 339 of file cabcode.cpp.

◆ disconnect()

void disconnect ( )

Definition at line 568 of file cabcode.cpp.

◆ dprop()

neuron::container::data_handle<double> dprop ( Symbol s,
int  indx,
Section sec,
short  inode 
)

returns location of property symbol

Definition at line 1922 of file cabcode.cpp.

◆ dprop_impl()

neuron::container::generic_data_handle dprop_impl ( Prop m,
Symbol s,
int  indx,
Section sec,
short  inode 
)

Definition at line 1890 of file cabcode.cpp.

◆ escape_bracket()

static char* escape_bracket ( const char *  s)
static

Definition at line 18 of file cabcode.cpp.

◆ forall_section()

void forall_section ( void  )

Definition at line 1963 of file cabcode.cpp.

◆ has_membrane()

int has_membrane ( char *  mechanism_name,
Section sec 
)

Definition at line 2061 of file cabcode.cpp.

◆ hoc_getdata_range()

Prop* hoc_getdata_range ( int  type)

Definition at line 1065 of file cabcode.cpp.

◆ hoc_ifsec()

void hoc_ifsec ( void  )

Definition at line 2036 of file cabcode.cpp.

◆ hoc_level_pushsec()

void hoc_level_pushsec ( Section sec)

turn off section stack fixing (in case of return, continue, break in a section statement) between explicit user level push_section, etc and pop_section

Definition at line 2187 of file cabcode.cpp.

◆ hoc_sec_internal_push()

void hoc_sec_internal_push ( void  )

Definition at line 759 of file cabcode.cpp.

◆ hoc_secname()

void hoc_secname ( void  )

Definition at line 2091 of file cabcode.cpp.

◆ hoc_section_pathname()

char* hoc_section_pathname ( Section sec)

Definition at line 1728 of file cabcode.cpp.

◆ ismembrane()

void ismembrane ( void  )

Definition at line 2073 of file cabcode.cpp.

◆ issection()

void issection ( void  )

Definition at line 2052 of file cabcode.cpp.

◆ keep_nseg_parm()

void keep_nseg_parm ( void  )

Definition at line 1475 of file cabcode.cpp.

◆ mech_access()

void mech_access ( void  )

Definition at line 846 of file cabcode.cpp.

◆ mech_insert1()

void mech_insert1 ( Section sec,
int  type 
)

Definition at line 852 of file cabcode.cpp.

◆ mech_uninsert()

void mech_uninsert ( void  )

Definition at line 892 of file cabcode.cpp.

◆ mech_uninsert1()

void mech_uninsert1 ( Section sec,
Symbol s 
)

Definition at line 898 of file cabcode.cpp.

◆ morph_alloc()

void morph_alloc ( Prop p)

Definition at line 438 of file cabcode.cpp.

◆ ncp_abs()

static double ncp_abs ( Section sec)
static

Definition at line 518 of file cabcode.cpp.

◆ new_section()

static Section* new_section ( Object ob,
Symbol sym,
int  i 
)
static

Definition at line 278 of file cabcode.cpp.

◆ new_sections()

void new_sections ( Object ob,
Symbol sym,
Item **  pitm,
int  size 
)

Definition at line 304 of file cabcode.cpp.

◆ node_exact()

Node* node_exact ( Section sec,
double  x 
)

like node_index but give proper node when x is 0 or 1 as well as in between

Definition at line 1800 of file cabcode.cpp.

◆ node_index()

int node_index ( Section sec,
double  x 
)

returns nearest index to x

Definition at line 1406 of file cabcode.cpp.

◆ node_index_exact()

int node_index_exact ( Section sec,
double  x 
)

return -1 if x at connection end, nnode-1 if at other end

Definition at line 1426 of file cabcode.cpp.

◆ node_ptr()

Node* node_ptr ( Section sec,
double  x,
double *  parea 
)

Definition at line 1828 of file cabcode.cpp.

◆ nrn_add_sibling_list()

static void nrn_add_sibling_list ( Section sec)
static

Definition at line 528 of file cabcode.cpp.

◆ nrn_arc_position()

double nrn_arc_position ( Section sec,
Node node 
)

Definition at line 1755 of file cabcode.cpp.

◆ nrn_at_beginning()

int nrn_at_beginning ( Section sec)

Definition at line 1560 of file cabcode.cpp.

◆ nrn_change_nseg()

void nrn_change_nseg ( Section sec,
int  n 
)

Definition at line 1482 of file cabcode.cpp.

◆ nrn_connection_position()

double nrn_connection_position ( Section sec)

Definition at line 1552 of file cabcode.cpp.

◆ nrn_diameter()

double nrn_diameter ( Node nd)

Definition at line 444 of file cabcode.cpp.

◆ nrn_disconnect()

void nrn_disconnect ( Section sec)

Definition at line 593 of file cabcode.cpp.

◆ nrn_exists()

int nrn_exists ( Symbol s,
Node node 
)

Definition at line 1258 of file cabcode.cpp.

◆ nrn_get_mechtype()

int nrn_get_mechtype ( const char *  mechname)

Definition at line 1842 of file cabcode.cpp.

◆ nrn_initcode()

void nrn_initcode ( void  )

Definition at line 107 of file cabcode.cpp.

◆ nrn_isecstack()

int nrn_isecstack ( void  )

Definition at line 85 of file cabcode.cpp.

◆ nrn_mechanism()

Prop* nrn_mechanism ( int  type,
Node nd 
)

Definition at line 1038 of file cabcode.cpp.

◆ nrn_mechanism_check()

Prop* nrn_mechanism_check ( int  type,
Section sec,
int  inode 
)

returns prop given mech type, section, and inode error if mech not at this position

Definition at line 1050 of file cabcode.cpp.

◆ nrn_noerr_access()

Section* nrn_noerr_access ( void  )

return 0 if no accessed section

Definition at line 474 of file cabcode.cpp.

◆ nrn_parent_info()

void nrn_parent_info ( Section s)

Definition at line 1589 of file cabcode.cpp.

◆ nrn_popsec()

void nrn_popsec ( void  )

Definition at line 154 of file cabcode.cpp.

◆ nrn_pushsec()

void nrn_pushsec ( Section sec)

Definition at line 130 of file cabcode.cpp.

◆ nrn_ra()

double nrn_ra ( Section sec)

Definition at line 417 of file cabcode.cpp.

◆ nrn_rangeconst()

void nrn_rangeconst ( Section sec,
Symbol s,
neuron::container::data_handle< double >  pd,
int  op 
)

Definition at line 935 of file cabcode.cpp.

◆ nrn_rangepointer()

neuron::container::data_handle<double> nrn_rangepointer ( Section sec,
Symbol s,
double  d 
)

Definition at line 1274 of file cabcode.cpp.

◆ nrn_remove_sibling_list()

static void nrn_remove_sibling_list ( Section sec)
static

Definition at line 502 of file cabcode.cpp.

◆ nrn_rootnode_alloc()

static void nrn_rootnode_alloc ( Section sec)
static

Definition at line 1565 of file cabcode.cpp.

◆ nrn_sec2cell()

Object* nrn_sec2cell ( Section sec)

Definition at line 252 of file cabcode.cpp.

◆ nrn_sec2cell_equals()

int nrn_sec2cell_equals ( Section sec,
Object obj 
)

Definition at line 267 of file cabcode.cpp.

◆ nrn_sec2pysecname()

const char* nrn_sec2pysecname ( Section sec)

Definition at line 1703 of file cabcode.cpp.

◆ nrn_sec_pop()

Section* nrn_sec_pop ( void  )

Definition at line 753 of file cabcode.cpp.

◆ nrn_secstack()

void nrn_secstack ( int  i)

Definition at line 89 of file cabcode.cpp.

◆ nrn_section_exists()

Section* nrn_section_exists ( char *  name,
int  indx,
Object cell 
)

Definition at line 2218 of file cabcode.cpp.

◆ nrn_section_orientation()

double nrn_section_orientation ( Section sec)

Definition at line 1556 of file cabcode.cpp.

◆ nrn_trueparent()

Section* nrn_trueparent ( Section sec)

Definition at line 1577 of file cabcode.cpp.

◆ nrn_vext_pd()

double* nrn_vext_pd ( Symbol s,
int  indx,
Node nd 
)

Definition at line 1860 of file cabcode.cpp.

◆ nrnpy_dprop()

neuron::container::generic_data_handle nrnpy_dprop ( Symbol s,
int  indx,
Section sec,
short  inode,
int *  err 
)

returns location of property symbol, return nullptr instead of hoc_execerror

Definition at line 1933 of file cabcode.cpp.

◆ nrnpy_rangepointer()

neuron::container::generic_data_handle nrnpy_rangepointer ( Section sec,
Symbol s,
double  d,
int *  err,
int  idx 
)

return nullptr if failure instead of hoc_execerror and return pointer to the 0 element if an array

Definition at line 1306 of file cabcode.cpp.

◆ ob_sec_access()

void ob_sec_access ( void  )

Definition at line 834 of file cabcode.cpp.

◆ ob_sec_access_push()

void ob_sec_access_push ( hoc_Item qsec)

Definition at line 827 of file cabcode.cpp.

◆ objectname()

static char* objectname ( void  )
static

Definition at line 1951 of file cabcode.cpp.

◆ oc_restore_cabcode()

void oc_restore_cabcode ( int *  a1,
int *  a2 
)

Definition at line 122 of file cabcode.cpp.

◆ oc_save_cabcode()

void oc_save_cabcode ( int *  a1,
int *  a2 
)

Definition at line 117 of file cabcode.cpp.

◆ parent_connection()

void parent_connection ( void  )

Definition at line 2153 of file cabcode.cpp.

◆ parent_node()

void parent_node ( void  )

Definition at line 2165 of file cabcode.cpp.

◆ parent_section()

void parent_section ( void  )

Definition at line 2145 of file cabcode.cpp.

◆ pdprop()

static Datum* pdprop ( Symbol s,
int  indx,
Section sec,
short  inode 
)
static

Definition at line 1075 of file cabcode.cpp.

◆ pop_section()

void pop_section ( void  )

Definition at line 2174 of file cabcode.cpp.

◆ push_section()

void push_section ( void  )

Definition at line 2192 of file cabcode.cpp.

◆ range_const()

void range_const ( void  )

Definition at line 1014 of file cabcode.cpp.

◆ range_interpolate()

void range_interpolate ( void  )

Definition at line 1138 of file cabcode.cpp.

◆ range_interpolate_single()

void range_interpolate_single ( void  )

Definition at line 1097 of file cabcode.cpp.

◆ range_vec_indx()

static int range_vec_indx ( Symbol s)
static

Definition at line 1026 of file cabcode.cpp.

◆ rangeobjeval()

void rangeobjeval ( void  )

Definition at line 1388 of file cabcode.cpp.

◆ rangeobjevalmiddle()

void rangeobjevalmiddle ( void  )

Definition at line 1400 of file cabcode.cpp.

◆ rangepoint()

void rangepoint ( void  )

Definition at line 1382 of file cabcode.cpp.

◆ rangevareval()

void rangevareval ( void  )

Definition at line 1373 of file cabcode.cpp.

◆ rangevarevalpointer()

void rangevarevalpointer ( void  )

Definition at line 1339 of file cabcode.cpp.

◆ reverse_nodes()

static void reverse_nodes ( Section sec)
static

Definition at line 580 of file cabcode.cpp.

◆ reverse_sibling_list()

static void reverse_sibling_list ( Section sec)
static

Definition at line 551 of file cabcode.cpp.

◆ Sec_access()

static Section* Sec_access ( void  )
static

Definition at line 681 of file cabcode.cpp.

◆ sec_access()

void sec_access ( void  )

Definition at line 720 of file cabcode.cpp.

◆ sec_access_object()

void sec_access_object ( void  )

Definition at line 732 of file cabcode.cpp.

◆ sec_access_pop()

void sec_access_pop ( void  )

Definition at line 164 of file cabcode.cpp.

◆ sec_access_push()

void sec_access_push ( void  )

Definition at line 749 of file cabcode.cpp.

◆ sec_and_position()

const char* sec_and_position ( Section sec,
Node nd 
)

Definition at line 1773 of file cabcode.cpp.

◆ secname()

const char* secname ( Section sec)

name of section (for use in error messages)

Definition at line 1674 of file cabcode.cpp.

◆ section_exists()

void section_exists ( void  )

Definition at line 2252 of file cabcode.cpp.

◆ section_length()

double section_length ( Section sec)

Definition at line 401 of file cabcode.cpp.

◆ section_new()

Section* section_new ( Symbol sym)

Creates a new section and registers with the global section list.

Definition at line 323 of file cabcode.cpp.

◆ section_orientation()

void section_orientation ( void  )

Definition at line 2159 of file cabcode.cpp.

◆ section_owner()

void section_owner ( void  )

Definition at line 1719 of file cabcode.cpp.

◆ sectionname()

void sectionname ( void  )

Definition at line 2079 of file cabcode.cpp.

◆ segment_limits()

int segment_limits ( double *  pdx)

Definition at line 1784 of file cabcode.cpp.

◆ setup_topology()

void setup_topology ( void  )

Definition at line 1635 of file cabcode.cpp.

◆ simpleconnectsection()

void simpleconnectsection ( void  )

Definition at line 664 of file cabcode.cpp.

◆ this_node()

void this_node ( void  )

Definition at line 2135 of file cabcode.cpp.

◆ this_section()

void this_section ( void  )

Definition at line 2127 of file cabcode.cpp.

Variable Documentation

◆ diam_changed

int diam_changed = 1

Definition at line 55 of file cabcode.cpp.

◆ hoc_execerror_messages

int hoc_execerror_messages
extern

Definition at line 607 of file hoc.cpp.

◆ isecstack

int isecstack = 0
static

Definition at line 75 of file cabcode.cpp.

◆ keep_nseg_parm_

int keep_nseg_parm_

Definition at line 1474 of file cabcode.cpp.

◆ nrn_shape_changed_

int nrn_shape_changed_
extern

Definition at line 24 of file neuron.h.

◆ nrnpy_pysec_cell_equals_p_

int(* nrnpy_pysec_cell_equals_p_) (Section *, Object *) ( Section ,
Object  
)

Definition at line 62 of file cabcode.cpp.

◆ nrnpy_pysec_cell_p_

Object*(* nrnpy_pysec_cell_p_) (Section *) ( Section )

Definition at line 61 of file cabcode.cpp.

◆ nrnpy_pysec_name_p_

char*(* nrnpy_pysec_name_p_) (Section *) ( Section )

Definition at line 60 of file cabcode.cpp.

◆ secstack

Section* secstack[NSECSTACK+1]
static

Definition at line 74 of file cabcode.cpp.

◆ skip_secstack_check

int skip_secstack_check = 0
static

Definition at line 81 of file cabcode.cpp.

◆ tree_changed

int tree_changed = 1

Definition at line 51 of file cabcode.cpp.