NEURON
ivoc.h
Go to the documentation of this file.
1 #ifndef oc_h
2 #define oc_h
3 
4 #include <Dispatch/iohandler.h>
5 #include <Dispatch/dispatcher.h>
6 #include <InterViews/session.h>
7 #include <OS/string.h>
8 #include <stdio.h>
9 #include <ivstream.h>
10 #include "gui-redirect.h"
11 extern int nrn_err_dialog_active_;
12 
13 
14 #if defined(MINGW)
15 extern bool nrn_is_gui_thread();
16 extern void nrn_gui_exec(void (*)(void*), void*);
17 #endif
18 
19 class Observer;
20 class Observable;
21 class Cursor;
22 struct Object;
23 
24 class HandleStdin: public IOHandler {
25 public:
26  HandleStdin();
27  virtual int inputReady(int fd);
28  virtual int exceptionRaised(int fd);
29  bool stdinSeen_;
30  bool acceptInput_;
31 };
32 
33 struct Symbol;
34 struct Symlist;
35 
36 class Oc {
37 public:
38  Oc();
39  Oc(Session*, const char* pname = NULL, const char** env = NULL);
40  virtual ~Oc();
41 
42  int run(int argc, const char** argv);
43  int run(const char *, bool show_err_mes = true);
44 
45  Symbol* parseExpr(const char *, Symlist** = NULL);
46  double runExpr(Symbol*);
47  static bool valid_expr(Symbol*);
48  static bool valid_stmt(const char*, Object* ob = NULL);
49  const char* name(Symbol*);
50 
51  void notifyHocValue(); // loops over HocValueBS buttonstates.
52 
53  void notify(); // called on doNotify from oc
54  void notify_attach(Observer*); // add to notify list
55  void notify_detach(Observer*);
56 
57  void notify_freed(void (*pf)(void*, int)); // register a callback func
58  void notify_when_freed(void* p, Observer*);
59  void notify_when_freed(double* p, Observer*);
60  void notify_pointer_disconnect(Observer*);
61 
62  static Session* getSession();
63  static int getStdinSeen() {return handleStdin_->stdinSeen_;}
64  static void setStdinSeen(bool i) {handleStdin_->stdinSeen_ = i;}
65  static bool setAcceptInput(bool);
66  static bool helpmode() {return helpmode_;}
67  static void helpmode(bool);
68  static void helpmode(Window*);
69  static void help(const char*);
70 
71  static ostream* save_stream;
72  static void cleanup();
73 private:
74  static int refcnt_;
75  static Session* session_;
77  static bool helpmode_;
78  static Cursor* help_cursor();
81 };
82 
83 #endif
Definition: hocdec.h:84
static bool helpmode()
Definition: ivoc.h:66
virtual int inputReady(int fd)
static Cursor * help_cursor_
Definition: ivoc.h:79
#define Cursor
Definition: _defines.h:85
virtual int exceptionRaised(int fd)
Definition: ivoc.h:36
size_t p
#define run
Definition: redef.h:125
static Session * session_
Definition: ivoc.h:75
static int refcnt_
Definition: ivoc.h:74
static bool helpmode_
Definition: ivoc.h:77
static ostream * save_stream
Definition: ivoc.h:71
void notify_freed(void *p)
Definition: ivoc.cpp:95
bool acceptInput_
Definition: ivoc.h:30
static int getStdinSeen()
Definition: ivoc.h:63
static Observable * notify_change_
Definition: ivoc.h:80
static void help(const char *)
Definition: hel2mos.cpp:104
Definition: model.h:57
static char * env[]
Definition: inithoc.cpp:228
char * name
Definition: init.cpp:16
static HandleStdin * handleStdin_
Definition: ivoc.h:76
int nrn_err_dialog_active_
Definition: ivoc.cpp:40
Definition: hocdec.h:226
#define i
Definition: md1redef.h:12
static void setStdinSeen(bool i)
Definition: ivoc.h:64
#define Window
Definition: _defines.h:333
static const char ** pname(void *v)
Definition: ocpointer.cpp:69
static int argc
Definition: inithoc.cpp:53
bool stdinSeen_
Definition: ivoc.h:29
#define Session
Definition: ivocmain.cpp:7
return NULL
Definition: cabcode.cpp:461
static char ** argv
Definition: inithoc.cpp:54