NEURON
ivocmain.cpp File Reference
#include <../../nrnconf.h>
#include "nrn_ansi.h"
#include "../utils/profile/profiler_interface.h"
#include <stdio.h>
#include <stdlib.h>
#include <filesystem>
#include "string.h"
#include "oc2iv.h"
#include "nrnmpi.h"
#include "nrnpy.h"
#include "utils/logger.hpp"

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 *)
 
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 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)
 
void hoc_ret ()
 
void hoc_pushx (double)
 
void hoc_single_event_run ()
 
int run_til_stdin ()
 
void hoc_notify_value ()
 
std::tuple< int, const char ** > nrn_mpi_setup (int argc, const char **argv)
 A top-level initialization of MPI given argc and argv. More...
 

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 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 52 of file ivocmain.cpp.

◆ Session

#define Session   void

Definition at line 9 of file ivocmain.cpp.

Function Documentation

◆ hoc_final_exit()

void hoc_final_exit ( )

Definition at line 949 of file hoc.cpp.

◆ hoc_main1()

int hoc_main1 ( int  argc,
const char **  argv,
const char **  envp 
)

Definition at line 867 of file hoc.cpp.

◆ hoc_main1_init()

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

Definition at line 783 of file hoc.cpp.

◆ hoc_notify_value()

void hoc_notify_value ( )

Definition at line 764 of file ivocmain.cpp.

◆ hoc_nrnmpi_init()

void hoc_nrnmpi_init ( )

Definition at line 295 of file ivocmain.cpp.

◆ hoc_obj_run()

int hoc_obj_run ( const char *  cmd,
Object ob 
)

Definition at line 315 of file hoc_oop.cpp.

◆ hoc_pushx()

void hoc_pushx ( double  d)

Definition at line 779 of file code.cpp.

◆ hoc_single_event_run()

void hoc_single_event_run ( void  )

Definition at line 748 of file ivocmain.cpp.

◆ hoc_xopen1()

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

Definition at line 166 of file fileio.cpp.

◆ ivoc_cleanup()

void ivoc_cleanup ( )

Definition at line 15 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 334 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 361 of file ivocmain.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_optarg()

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

Definition at line 266 of file ivocmain.cpp.

◆ nrn_optarg_on()

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

Definition at line 252 of file ivocmain.cpp.

◆ nrn_optargint()

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

Definition at line 281 of file ivocmain.cpp.

◆ pr_profile()

void pr_profile ( )

Definition at line 101 of file hoc.cpp.

◆ run_til_stdin()

int run_til_stdin ( )

Definition at line 761 of file ivocmain.cpp.

◆ setneuronhome()

void setneuronhome ( const char *  )

Definition at line 185 of file ivocmain.cpp.

Variable Documentation

◆ always_false

int always_false

Definition at line 231 of file ivocmain.cpp.

◆ hoc_default_dll_loaded_

double hoc_default_dll_loaded_
extern

Definition at line 225 of file hoc_init.cpp.

◆ hoc_nframe

long hoc_nframe

Definition at line 6 of file ivocmain.cpp.

◆ hoc_nstack

long hoc_nstack

Definition at line 6 of file ivocmain.cpp.

◆ hoc_print_first_instance

int hoc_print_first_instance
extern

Definition at line 39 of file hoc_oop.cpp.

◆ neuron_home

const char* neuron_home
extern

Definition at line 227 of file hoc_init.cpp.

◆ nrn_global_argc

int nrn_global_argc
extern

Definition at line 45 of file hoc.cpp.

◆ nrn_global_argv

const char** nrn_global_argv
extern

Definition at line 46 of file hoc.cpp.

◆ nrn_is_python_extension

int nrn_is_python_extension
extern

Definition at line 810 of file fileio.cpp.

◆ nrn_istty_

int nrn_istty_
extern

Definition at line 778 of file hoc.cpp.

◆ nrn_nobanner_

int nrn_nobanner_
extern

Definition at line 117 of file init.cpp.

◆ nrnpy_nositeflag

int nrnpy_nositeflag

Definition at line 182 of file ivocmain.cpp.

◆ units_on_flag_

int units_on_flag_
extern

Definition at line 20 of file code2.cpp.