NEURON
ocmain.cpp
Go to the documentation of this file.
1 #include <../../nrnconf.h>
2 /* /local/src/master/nrn/src/oc/ocmain.cpp,v 1.7 1997/07/29 20:23:33 hines Exp */
3 
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <hocdec.h>
7 
8 extern const char* neuron_home;
9 
10 #if defined(WIN32)
11 void* cvode_pmem;
12 extern void setneuronhome(const char*);
13 #endif
14 
15 static void setnrnhome(const char* arg) {
16 #ifndef WIN32
17  /*
18  Gary Holt's first pass at this was:
19 
20  Set the NEURONHOME environment variable. This should override any setting
21  in the environment, so someone doesn't accidently use data files from an
22  old version of neuron.
23 
24  But I have decided to use the environment variable if it exists
25  */
26  neuron_home = getenv("NEURONHOME");
27  if (!neuron_home) {
28 #if defined(HAVE_SETENV)
29  setenv("NEURONHOME", NEURON_DATA_DIR, 1);
30  neuron_home = NEURON_DATA_DIR;
31 #else
32 #error "I don't know how to set environment variables."
33 // Maybe in this case the user will have to set it by hand.
34 #endif
35  }
36 
37 #else // Not unix:
38  setneuronhome(arg);
39 #endif
40 }
41 
42 int main(int argc, const char** argv, const char** envp) {
43  int err;
44  setnrnhome(argv[0]);
45  err = hoc_main1(argc, argv, envp);
46  if (!err) {
48  }
49 #if EXPRESS
50  exit(0);
51 #else
52  return err;
53 #endif
54 }
55 
56 
57 void hoc_single_event_run() { /* for interviews, ivoc make use of own main */
58 #if INTERVIEWS && 0
60 #endif
61  hoc_ret();
62  hoc_pushx(0.);
63 }
64 
66  return 1;
67 }
69 
70 #ifdef WIN32
71 void ivcleanup() {}
72 void ivoc_win32_cleanup() {}
73 int bad_install_ok;
74 #endif
void hoc_ret()
static int argc
Definition: inithoc.cpp:45
static char ** argv
Definition: inithoc.cpp:46
void setneuronhome(const char *)
Definition: ivocmain.cpp:185
void hoc_final_exit()
Definition: hoc.cpp:949
int hoc_main1(int, const char **, const char **)
Definition: hoc.cpp:867
void hoc_pushx(double)
Definition: code.cpp:779
void single_event_run()
const char * neuron_home
Definition: hoc_init.cpp:227
void hoc_notify_value()
Definition: ocmain.cpp:68
int main(int argc, const char **argv, const char **envp)
Definition: ocmain.cpp:42
void hoc_single_event_run()
Definition: ocmain.cpp:57
int run_til_stdin()
Definition: ocmain.cpp:65
static void setnrnhome(const char *arg)
Definition: ocmain.cpp:15