NEURON
hoc.cpp File Reference
#include <../../nrnconf.h>
#include "../nrnpython/nrnpython_config.h"
#include "hoc.h"
#include "hocstr.h"
#include "equation.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <errno.h>
#include "parse.hpp"
#include "hocparse.h"
#include "ocfunc.h"
#include "ocmisc.h"
#include "nrnmpi.h"
#include "nrnfilewrap.h"
#include "../nrniv/backtrace_utils.h"
#include <ctype.h>
#include <signal.h>
#include <setjmp.h>

Go to the source code of this file.

Macros

#define NRN_FLOAT_EXCEPTION   0
 
#define READLINE   1
 
#define CHAR   char
 
#define TMPBUFSIZE   512
 
#define CBUFSIZE   512
 
#define EPS   hoc_epsilon
 
#define HAS_SIGPIPE   1
 
#define YYNEEDMORE   -3
 

Typedefs

typedef RETSIGTYPE(* SignalType) (int)
 

Functions

void nrn_feenableexcept ()
 
void start_profile (int i)
 
void add_profile (int i)
 
void pr_profile (void)
 
char * readline (const char *prompt)
 
void rl_deprep_terminal (void)
 
void add_history (const char *)
 
static int follow (int expect, int ifyes, int ifno)
 
static int Getc (NrnFILEWrap *fp)
 
static void unGetc (int c, NrnFILEWrap *fp)
 
static int backslash (int c)
 
void nrn_exit (int i)
 
static RETSIGTYPE sigpipe_handler (int sig)
 
int getnb (void)
 
static char * optarray (char *buf)
 
int yylex (void)
 
void arayinstal (void)
 
int hoc_arayinfo_install (Symbol *sp, int nsub)
 
void hoc_freearay (Symbol *sp)
 
void free_arrayinfo (Arrayinfo *a)
 
void defnonly (const char *s)
 
void hoc_show_errmess_always (void)
 
void hoc_newobj1_err ()
 unref partially constructed objects controlled by current longjump handle More...
 
voidnrn_get_hoc_jmp ()
 If one of the two jmp_buf is controlling the longjmp hoc_newobj1_err needs handle to know how much to unwrap the newobj1 stack. More...
 
void hoc_execerror_mes (const char *s, const char *t, int prnt)
 
void hoc_execerror (const char *s, const char *t)
 
RETSIGTYPE onintr (int sig)
 
void hoc_coredump_on_error (void)
 
void print_bt ()
 
RETSIGTYPE fpecatch (int sig)
 
int hoc_pid (void)
 
void hoc_main1_init (const char *pname, const char **envp)
 
HocStrhocstr_create (size_t size)
 
static CHARfgets_unlimited_nltrans (HocStr *s, NrnFILEWrap *f, int nltrans)
 
char * fgets_unlimited (HocStr *s, NrnFILEWrap *f)
 
void hocstr_delete (HocStr *hs)
 
void hocstr_resize (HocStr *hs, size_t n)
 
void hocstr_copy (HocStr *hs, const char *buf)
 
static void hoc_run1 (void)
 
int hoc_main1 (int argc, const char **argv, const char **envp)
 
void hoc_final_exit (void)
 
void hoc_quit (void)
 
int moreinput (void)
 
void hoc_run (void)
 
static void set_signals (void)
 
static void restore_signals (void)
 
static void nrn_inputbuf_getline (void)
 
void oc_save_input_info (const char **i1, int *i2, int *i3, NrnFILEWrap **i4)
 
void oc_restore_input_info (const char *i1, int i2, int i3, NrnFILEWrap *i4)
 
int hoc_oc (const char *buf)
 
void warning (const char *s, const char *t)
 
int hoc_yyparse (void)
 
CHARhoc_fgets_unlimited (HocStr *bufstr, NrnFILEWrap *f)
 
int hoc_get_line (void)
 
void hoc_help (void)
 

Variables

int nrnignore
 
int nrn_global_argc
 
char ** nrn_global_argv
 
int nrn_inpython_
 
int(* p_nrnpy_pyrun )(const char *fname)
 
int nrn_mpiabort_on_error_ {1}
 
int nrn_feenableexcept_ = 0
 
int nrn_nobanner_
 
int pipeflag
 
int hoc_usegui
 
HocStrhoc_tmpbuf
 
HocStrhoc_cbufstr
 
const char * hoc_promptstr
 
static CHARcbuf
 
CHARctp
 
int hoc_ictp
 
char * RCS_hoc_version
 
char * RCS_hoc_date
 
char * neuron_home
 
int hoc_print_first_instance
 
NrnFILEWrapfin
 
const char * progname
 
int lineno
 
static int control_jmpbuf = 0
 
jmp_buf begin
 
static int hoc_oc_jmpbuf
 
static jmp_buf hoc_oc_begin
 
int intset
 
int indef
 
const char * infile
 
size_t hoc_xopen_file_size_
 
char * hoc_xopen_file_
 
const char ** gargv
 
int gargc
 
static int c = '\n'
 
static int eos
 
static int debug_message_
 
int hoc_execerror_messages
 
void(* oc_jump_target_ )()
 
int yystart
 
static int coredump
 
int nrn_istty_
 
int hoc_main1_inited_
 
static SignalType signals [4]
 
static const char * nrn_inputbufptr
 
int hoc_in_yyparse =0
 
int hoc_interviews = 0
 

Macro Definition Documentation

◆ CBUFSIZE

#define CBUFSIZE   512

Definition at line 163 of file hoc.cpp.

◆ CHAR

#define CHAR   char

Definition at line 153 of file hoc.cpp.

◆ EPS

#define EPS   hoc_epsilon

Definition at line 176 of file hoc.cpp.

◆ HAS_SIGPIPE

#define HAS_SIGPIPE   1

Definition at line 258 of file hoc.cpp.

◆ NRN_FLOAT_EXCEPTION

#define NRN_FLOAT_EXCEPTION   0

Definition at line 52 of file hoc.cpp.

◆ READLINE

#define READLINE   1

Definition at line 135 of file hoc.cpp.

◆ TMPBUFSIZE

#define TMPBUFSIZE   512

Definition at line 162 of file hoc.cpp.

◆ YYNEEDMORE

#define YYNEEDMORE   -3

Definition at line 283 of file hoc.cpp.

Typedef Documentation

◆ SignalType

typedef RETSIGTYPE(* SignalType) (int)

Definition at line 1367 of file hoc.cpp.

Function Documentation

◆ add_history()

void add_history ( const char *  )

◆ add_profile()

void add_profile ( int  i)

Definition at line 122 of file hoc.cpp.

◆ arayinstal()

void arayinstal ( void  )

Definition at line 553 of file hoc.cpp.

◆ backslash()

static int backslash ( int  c)
static

Definition at line 533 of file hoc.cpp.

◆ defnonly()

void defnonly ( const char *  s)

Definition at line 649 of file hoc.cpp.

◆ fgets_unlimited()

char* fgets_unlimited ( HocStr s,
NrnFILEWrap f 
)

Definition at line 944 of file hoc.cpp.

◆ fgets_unlimited_nltrans()

static CHAR * fgets_unlimited_nltrans ( HocStr s,
NrnFILEWrap f,
int  nltrans 
)
static

Definition at line 1784 of file hoc.cpp.

◆ follow()

static int follow ( int  expect,
int  ifyes,
int  ifno 
)
static

Definition at line 543 of file hoc.cpp.

◆ fpecatch()

RETSIGTYPE fpecatch ( int  sig)

Definition at line 823 of file hoc.cpp.

◆ free_arrayinfo()

void free_arrayinfo ( Arrayinfo a)

Definition at line 637 of file hoc.cpp.

◆ Getc()

static int Getc ( NrnFILEWrap fp)
static

Definition at line 1581 of file hoc.cpp.

◆ getnb()

int getnb ( void  )

Definition at line 268 of file hoc.cpp.

◆ hoc_coredump_on_error()

void hoc_coredump_on_error ( void  )

Definition at line 761 of file hoc.cpp.

◆ hoc_fgets_unlimited()

CHAR* hoc_fgets_unlimited ( HocStr bufstr,
NrnFILEWrap f 
)

Definition at line 1780 of file hoc.cpp.

◆ hoc_help()

void hoc_help ( void  )

Definition at line 1979 of file hoc.cpp.

◆ hoc_main1_init()

void hoc_main1_init ( const char *  pname,
const char **  envp 
)

Definition at line 875 of file hoc.cpp.

◆ hoc_newobj1_err()

void hoc_newobj1_err ( )

unref partially constructed objects controlled by current longjump handle

Definition at line 557 of file hoc_oop.cpp.

◆ hoc_quit()

void hoc_quit ( void  )

Definition at line 1164 of file hoc.cpp.

◆ hoc_run()

void hoc_run ( void  )

Definition at line 1358 of file hoc.cpp.

◆ hoc_run1()

static void hoc_run1 ( void  )
static

Definition at line 1393 of file hoc.cpp.

◆ hoc_show_errmess_always()

void hoc_show_errmess_always ( void  )

Definition at line 658 of file hoc.cpp.

◆ hoc_yyparse()

int hoc_yyparse ( void  )

Definition at line 1612 of file hoc.cpp.

◆ hocstr_copy()

void hocstr_copy ( HocStr hs,
const char *  buf 
)

Definition at line 961 of file hoc.cpp.

◆ hocstr_create()

HocStr* hocstr_create ( size_t  size)

Definition at line 934 of file hoc.cpp.

◆ hocstr_delete()

void hocstr_delete ( HocStr hs)

Definition at line 948 of file hoc.cpp.

◆ hocstr_resize()

void hocstr_resize ( HocStr hs,
size_t  n 
)

Definition at line 953 of file hoc.cpp.

◆ moreinput()

int moreinput ( void  )

Definition at line 1216 of file hoc.cpp.

◆ nrn_feenableexcept()

void nrn_feenableexcept ( void  )

Definition at line 81 of file hoc.cpp.

◆ nrn_get_hoc_jmp()

void* nrn_get_hoc_jmp ( )

If one of the two jmp_buf is controlling the longjmp hoc_newobj1_err needs handle to know how much to unwrap the newobj1 stack.

Definition at line 683 of file hoc.cpp.

◆ nrn_inputbuf_getline()

static void nrn_inputbuf_getline ( void  )
static

Definition at line 1460 of file hoc.cpp.

◆ oc_restore_input_info()

void oc_restore_input_info ( const char *  i1,
int  i2,
int  i3,
NrnFILEWrap i4 
)

Definition at line 1484 of file hoc.cpp.

◆ oc_save_input_info()

void oc_save_input_info ( const char **  i1,
int i2,
int i3,
NrnFILEWrap **  i4 
)

Definition at line 1478 of file hoc.cpp.

◆ onintr()

RETSIGTYPE onintr ( int  sig)

Definition at line 746 of file hoc.cpp.

◆ optarray()

static char* optarray ( char *  buf)
static

Definition at line 294 of file hoc.cpp.

◆ pr_profile()

void pr_profile ( void  )

Definition at line 123 of file hoc.cpp.

◆ print_bt()

void print_bt ( )

Definition at line 767 of file hoc.cpp.

◆ readline()

char* readline ( const char *  prompt)

◆ restore_signals()

static void restore_signals ( void  )
static

Definition at line 1382 of file hoc.cpp.

◆ rl_deprep_terminal()

void rl_deprep_terminal ( void  )

◆ set_signals()

static void set_signals ( void  )
static

Definition at line 1371 of file hoc.cpp.

◆ sigpipe_handler()

static RETSIGTYPE sigpipe_handler ( int  sig)
static

Definition at line 262 of file hoc.cpp.

◆ start_profile()

void start_profile ( int  i)

Definition at line 121 of file hoc.cpp.

◆ unGetc()

static void unGetc ( int  c,
NrnFILEWrap fp 
)
static

Definition at line 1603 of file hoc.cpp.

◆ warning()

void warning ( const char *  s,
const char *  t 
)

Definition at line 1542 of file hoc.cpp.

◆ yylex()

int yylex ( void  )

Definition at line 315 of file hoc.cpp.

Variable Documentation

◆ begin

jmp_buf begin

Definition at line 193 of file hoc.cpp.

◆ c

int c = '\n'
static

Definition at line 203 of file hoc.cpp.

◆ cbuf

CHAR* cbuf
static

Definition at line 167 of file hoc.cpp.

◆ control_jmpbuf

int control_jmpbuf = 0
static

Definition at line 192 of file hoc.cpp.

◆ coredump

int coredump
static

Definition at line 759 of file hoc.cpp.

◆ ctp

CHAR* ctp

Definition at line 168 of file hoc.cpp.

◆ debug_message_

int debug_message_
static

Definition at line 657 of file hoc.cpp.

◆ eos

int eos
static

Definition at line 292 of file hoc.cpp.

◆ gargc

int gargc

Definition at line 202 of file hoc.cpp.

◆ gargv

const char** gargv

Definition at line 201 of file hoc.cpp.

◆ hoc_cbufstr

HocStr* hoc_cbufstr

Definition at line 165 of file hoc.cpp.

◆ hoc_execerror_messages

int hoc_execerror_messages

Definition at line 666 of file hoc.cpp.

◆ hoc_ictp

int hoc_ictp

Definition at line 169 of file hoc.cpp.

◆ hoc_in_yyparse

int hoc_in_yyparse =0

Definition at line 1610 of file hoc.cpp.

◆ hoc_interviews

int hoc_interviews = 0

Definition at line 1665 of file hoc.cpp.

◆ hoc_main1_inited_

int hoc_main1_inited_

Definition at line 872 of file hoc.cpp.

◆ hoc_oc_begin

jmp_buf hoc_oc_begin
static

Definition at line 195 of file hoc.cpp.

◆ hoc_oc_jmpbuf

int hoc_oc_jmpbuf
static

Definition at line 194 of file hoc.cpp.

◆ hoc_print_first_instance

int hoc_print_first_instance

Definition at line 50 of file hoc_oop.cpp.

◆ hoc_promptstr

const char* hoc_promptstr

Definition at line 166 of file hoc.cpp.

◆ hoc_tmpbuf

HocStr* hoc_tmpbuf

Definition at line 164 of file hoc.cpp.

◆ hoc_usegui

int hoc_usegui

Definition at line 148 of file hoc.cpp.

◆ hoc_xopen_file_

char* hoc_xopen_file_

Definition at line 223 of file fileio.cpp.

◆ hoc_xopen_file_size_

size_t hoc_xopen_file_size_

Definition at line 222 of file fileio.cpp.

◆ indef

int indef

Definition at line 197 of file hoc.cpp.

◆ infile

const char* infile

Definition at line 198 of file hoc.cpp.

◆ intset

int intset

Definition at line 196 of file hoc.cpp.

◆ lineno

int lineno

Definition at line 185 of file hoc.cpp.

◆ neuron_home

char* neuron_home

Definition at line 268 of file hoc_init.cpp.

◆ nrn_feenableexcept_

int nrn_feenableexcept_ = 0

Definition at line 79 of file hoc.cpp.

◆ nrn_global_argc

int nrn_global_argc

Definition at line 29 of file hoc.cpp.

◆ nrn_global_argv

char** nrn_global_argv

Definition at line 30 of file hoc.cpp.

◆ nrn_inputbufptr

const char* nrn_inputbufptr
static

Definition at line 1459 of file hoc.cpp.

◆ nrn_istty_

int nrn_istty_

Definition at line 870 of file hoc.cpp.

◆ nrn_nobanner_

int nrn_nobanner_

Definition at line 146 of file hoc.cpp.

◆ oc_jump_target_

void(* oc_jump_target_) ()

Definition at line 672 of file hoc.cpp.

◆ p_nrnpy_pyrun

int(* p_nrnpy_pyrun) (const char *fname)

Definition at line 38 of file hoc.cpp.

◆ pipeflag

int pipeflag

Definition at line 147 of file hoc.cpp.

◆ progname

const char* progname

Definition at line 184 of file hoc.cpp.

◆ RCS_hoc_date

char* RCS_hoc_date

Definition at line 999 of file version.cpp.

◆ RCS_hoc_version

char* RCS_hoc_version

Definition at line 998 of file version.cpp.

◆ signals

SignalType signals[4]
static

Definition at line 1369 of file hoc.cpp.

◆ yystart

int yystart

Definition at line 675 of file hoc.cpp.