NEURON
inithoc.cpp File Reference
#include "../../nrnconf.h"
#include "nrnmpiuse.h"
#include <stdio.h>
#include <stdint.h>
#include "nrnmpi.h"
#include "nrnpy_utils.h"
#include <stdlib.h>
#include <ctype.h>
#include "nrn_export.hpp"
#include <iostream>
#include <string>

Go to the source code of this file.

Functions

int ivocmain (int, const char **, const char **)
 Main entrypoint function into the HOC interpeter. More...
 
PyObjectnrnpy_hoc ()
 
static int add_arg (const char *name, const char *value)
 
static int is_string (PyObject *po)
 Return 1 if string, 0 otherwise. More...
 
static int add_neuron_options ()
 Add all name:value from main.neuron_options dict if exists to the argc,argv for calling ivocmain Note: if value is None then only name is added to argv. More...
 
static int add_space_separated_options (const char *str)
 Space separated options. More...
 
static int have_opt (const char *arg)
 Return 1 if the option exists in argv[]. More...
 
void nrnpython_finalize ()
 
NRN_EXPORT PyObjectPyInit_hoc ()
 
NRN_EXPORT void modl_reg ()
 

Variables

int nrn_is_python_extension
 
int nrn_nobanner_
 
int nrn_main_launch
 
char ** nrn_global_argv
 
void(* p_nrnpython_finalize )()
 
static size_t arg_size
 Manage argc,argv for calling ivocmain add_arg(...) will only add if name is not already in the arg list returns 1 if added, 0 if not. More...
 
static int argc
 
static char ** argv
 
static char * env [] = {0}
 

Function Documentation

◆ add_arg()

static int add_arg ( const char *  name,
const char *  value 
)
static

Definition at line 47 of file inithoc.cpp.

◆ add_neuron_options()

static int add_neuron_options ( )
static

Add all name:value from main.neuron_options dict if exists to the argc,argv for calling ivocmain Note: if value is None then only name is added to argv.

The special "-print-options" name is not added to argv but causes a return value of 1. Otherwise the return value is 0.

Definition at line 91 of file inithoc.cpp.

◆ add_space_separated_options()

static int add_space_separated_options ( const char *  str)
static

Space separated options.

Must handle escaped space, '...' and "...". Return 1 if contains a -print-options (not added to options)

Definition at line 133 of file inithoc.cpp.

◆ have_opt()

static int have_opt ( const char *  arg)
static

Return 1 if the option exists in argv[].

Definition at line 199 of file inithoc.cpp.

◆ is_string()

static int is_string ( PyObject po)
static

Return 1 if string, 0 otherwise.

Definition at line 77 of file inithoc.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.

◆ modl_reg()

NRN_EXPORT void modl_reg ( void  )

Definition at line 414 of file inithoc.cpp.

◆ nrnpy_hoc()

PyObject* nrnpy_hoc ( )

Definition at line 3354 of file nrnpy_hoc.cpp.

◆ nrnpython_finalize()

void nrnpython_finalize ( )

Definition at line 238 of file inithoc.cpp.

◆ PyInit_hoc()

NRN_EXPORT PyObject* PyInit_hoc ( )

Definition at line 261 of file inithoc.cpp.

Variable Documentation

◆ arg_size

size_t arg_size
static

Manage argc,argv for calling ivocmain add_arg(...) will only add if name is not already in the arg list returns 1 if added, 0 if not.

Definition at line 44 of file inithoc.cpp.

◆ argc

int argc
static

Definition at line 45 of file inithoc.cpp.

◆ argv

char** argv
static

Definition at line 46 of file inithoc.cpp.

◆ env

char* env[] = {0}
static

Definition at line 259 of file inithoc.cpp.

◆ nrn_global_argv

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_main_launch

int nrn_main_launch
extern

Definition at line 333 of file hoc_init.cpp.

◆ nrn_nobanner_

int nrn_nobanner_
extern

Definition at line 119 of file hoc.cpp.

◆ p_nrnpython_finalize

void(* p_nrnpython_finalize) () ( )
extern