NEURON
ivocmain.cpp File Reference
#include <../../nrnconf.h>
#include <../nrnpython/nrnpython_config.h>
#include <stdio.h>
#include <stdlib.h>
#include <OS/string.h>
#include "oc2iv.h"
#include "nrnmpi.h"
#include "../nrnjava/njconf.h"
#include <nrnisaac.h>

Go to the source code of this file.

Macros

#define Session   void
 
#define PR_PROFILE   pr_profile();
 

Functions

int hoc_main1 (int, const char **, const char **)
 
void hoc_main1_init (const char *, const char **)
 
void pr_profile ()
 
int hoc_obj_run (const char *, Object *)
 
char * nrn_version (int)
 
void hoc_final_exit ()
 
void ivoc_final_exit ()
 
void ivoc_cleanup ()
 
void setneuronhome (const char *)
 
int hoc_xopen1 (const char *filename, const char *rcs)
 
int ivocmain (int argc, const char **argv, const char **env)
 Main entrypoint function into the HOC interpeter. More...
 
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. More...
 
void hoc_nrnmpi_init ()
 
static void force_load ()
 
static bool nrn_optarg_on (const char *opt, int *argc, char **argv)
 
static char * nrn_optarg (const char *opt, int *argc, char **argv)
 
static int nrn_optargint (const char *opt, int *argc, char **argv, int dflt)
 
static bool nrn_optarg_on (const char *opt, int *pargc, const char **argv)
 
static const char * nrn_optarg (const char *opt, int *pargc, const char **argv)
 
static int nrn_optargint (const char *opt, int *pargc, const char **argv, int dflt)
 
double * getarg (int i)
 
int ifarg (int)
 
void hoc_ret ()
 
void hoc_pushx (double)
 
void hoc_single_event_run ()
 
int run_til_stdin ()
 
void hoc_notify_value ()
 

Variables

long hoc_nframe
 
long hoc_nstack
 
int nrn_istty_
 
int nrn_nobanner_
 
const char * neuron_home
 
int units_on_flag_
 
double hoc_default_dll_loaded_
 
int hoc_print_first_instance
 
int nrnpy_nositeflag
 
int(* p_neosim_main )(int, const char **, const char **)
 
int nrn_global_argc
 
const char ** nrn_global_argv
 
int always_false
 
int nrn_is_python_extension
 

Macro Definition Documentation

◆ PR_PROFILE

#define PR_PROFILE   pr_profile();

Definition at line 56 of file ivocmain.cpp.

◆ Session

#define Session   void

Definition at line 7 of file ivocmain.cpp.

Function Documentation

◆ force_load()

static void force_load ( )
static

Definition at line 293 of file ivocmain.cpp.

◆ getarg()

double* getarg ( int  i)

Definition at line 1611 of file code.cpp.

◆ hoc_final_exit()

void hoc_final_exit ( )

Definition at line 1130 of file hoc.cpp.

◆ hoc_main1()

int hoc_main1 ( int  ,
const char **  ,
const char **   
)

Definition at line 972 of file hoc.cpp.

◆ hoc_main1_init()

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

Definition at line 875 of file hoc.cpp.

◆ hoc_notify_value()

void hoc_notify_value ( )

Definition at line 891 of file ivocmain.cpp.

◆ hoc_nrnmpi_init()

void hoc_nrnmpi_init ( )

Definition at line 378 of file ivocmain.cpp.

◆ hoc_obj_run()

int hoc_obj_run ( const char *  ,
Object  
)

Definition at line 323 of file hoc_oop.cpp.

◆ hoc_pushx()

void hoc_pushx ( double  )

◆ hoc_single_event_run()

void hoc_single_event_run ( void  )

Definition at line 877 of file ivocmain.cpp.

◆ hoc_xopen1()

int hoc_xopen1 ( const char *  filename,
const char *  rcs 
)

Definition at line 229 of file fileio.cpp.

◆ ifarg()

int ifarg ( int  )

Definition at line 1562 of file code.cpp.

◆ ivoc_cleanup()

void ivoc_cleanup ( )

Definition at line 17 of file ocnoiv1.cpp.

◆ ivocmain()

int ivocmain ( int  argc,
const char **  argv,
const char **  env 
)

Main entrypoint function into the HOC interpeter.

This function simply calls ivocmain_session with the start_session = 1.

Note
This is part of NEURON's public interface
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.
Returns
0 on success, otherwise error code.

Definition at line 417 of file ivocmain.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 446 of file ivocmain.cpp.

◆ nrn_optarg() [1/2]

static char* nrn_optarg ( const char *  opt,
int argc,
char **  argv 
)
static

◆ nrn_optarg() [2/2]

static const char* nrn_optarg ( const char *  opt,
int pargc,
const char **  argv 
)
static

Definition at line 335 of file ivocmain.cpp.

◆ nrn_optarg_on() [1/2]

static bool nrn_optarg_on ( const char *  opt,
int argc,
char **  argv 
)
static

◆ nrn_optarg_on() [2/2]

static bool nrn_optarg_on ( const char *  opt,
int pargc,
const char **  argv 
)
static

Definition at line 319 of file ivocmain.cpp.

◆ nrn_optargint() [1/2]

static int nrn_optargint ( const char *  opt,
int argc,
char **  argv,
int  dflt 
)
static

◆ nrn_optargint() [2/2]

static int nrn_optargint ( const char *  opt,
int pargc,
const char **  argv,
int  dflt 
)
static

Definition at line 352 of file ivocmain.cpp.

◆ nrn_version()

char* nrn_version ( int  )

Definition at line 27 of file nrnversion.cpp.

◆ pr_profile()

void pr_profile ( )

Definition at line 123 of file hoc.cpp.

◆ run_til_stdin()

int run_til_stdin ( )

Definition at line 890 of file ivocmain.cpp.

◆ setneuronhome()

void setneuronhome ( const char *  )

Definition at line 196 of file ivocmain.cpp.

Variable Documentation

◆ always_false

int always_false

Definition at line 283 of file ivocmain.cpp.

◆ hoc_default_dll_loaded_

double hoc_default_dll_loaded_

Definition at line 266 of file hoc_init.cpp.

◆ hoc_nframe

long hoc_nframe

Definition at line 4 of file ivocmain.cpp.

◆ hoc_nstack

long hoc_nstack

Definition at line 4 of file ivocmain.cpp.

◆ hoc_print_first_instance

int hoc_print_first_instance

Definition at line 50 of file hoc_oop.cpp.

◆ neuron_home

const char* neuron_home

Definition at line 268 of file hoc_init.cpp.

◆ nrn_global_argc

int nrn_global_argc

Definition at line 34 of file nrnpython.cpp.

◆ nrn_global_argv

char ** nrn_global_argv

Definition at line 35 of file nrnpython.cpp.

◆ nrn_is_python_extension

int nrn_is_python_extension

Definition at line 871 of file fileio.cpp.

◆ nrn_istty_

int nrn_istty_

Definition at line 870 of file hoc.cpp.

◆ nrn_nobanner_

int nrn_nobanner_

Definition at line 130 of file init.cpp.

◆ nrnpy_nositeflag

int nrnpy_nositeflag

Definition at line 193 of file ivocmain.cpp.

◆ p_neosim_main

int(* p_neosim_main) (int, const char **, const char **)

Definition at line 280 of file ivocmain.cpp.

◆ units_on_flag_

int units_on_flag_

Definition at line 18 of file code2.cpp.