NEURON
ivoc.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Dispatch/iohandler.h>
4 #include <Dispatch/dispatcher.h>
5 #include <InterViews/session.h>
6 #include <OS/string.h>
7 #include <stdio.h>
8 #include <string>
9 #include "gui-redirect.h"
10 extern int nrn_err_dialog_active_;
11 
12 #include <ostream>
13 
14 #ifdef 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:
27  virtual int inputReady(int fd);
28  virtual int exceptionRaised(int fd);
29  bool stdinSeen_;
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  int run(const std::string&, bool show_err_mes = true);
45 
46  Symbol* parseExpr(const char*, Symlist** = NULL);
47  double runExpr(Symbol*);
48  static bool valid_expr(Symbol*);
49  static bool valid_stmt(const char*, Object* ob = NULL);
50  const char* name(Symbol*);
51 
52  void notifyHocValue(); // loops over HocValueBS buttonstates.
53 
54  void notify(); // called on doNotify from oc
55  void notify_attach(Observer*); // add to notify list
57 
58  void notify_freed(void (*pf)(void*, int)); // register a callback func
59  void notify_when_freed(void* p, Observer*);
61 
62  static Session* getSession();
63  static int getStdinSeen() {
64  return handleStdin_->stdinSeen_;
65  }
66  static void setStdinSeen(bool i) {
68  }
69  static bool setAcceptInput(bool);
70  static bool helpmode() {
71  return helpmode_;
72  }
73  static void helpmode(bool);
74  static void helpmode(Window*);
75  static void help(const char*);
76 
77  static std::ostream* save_stream;
78  static void cleanup();
79 
80  private:
81  static int refcnt_;
82  static Session* session_;
84  static bool helpmode_;
85  static Cursor* help_cursor();
88 };
#define Window
Definition: _defines.h:330
#define Cursor
Definition: _defines.h:83
bool acceptInput_
Definition: ivoc.h:30
virtual int exceptionRaised(int fd)
bool stdinSeen_
Definition: ivoc.h:29
virtual int inputReady(int fd)
Definition: ivoc.h:36
double runExpr(Symbol *)
int run(const std::string &, bool show_err_mes=true)
static void setStdinSeen(bool i)
Definition: ivoc.h:66
static Cursor * help_cursor_
Definition: ivoc.h:86
virtual ~Oc()
static void help(const char *)
void notify_detach(Observer *)
void notify()
int run(int argc, const char **argv)
Oc()
static Observable * notify_change_
Definition: ivoc.h:87
static void helpmode(Window *)
static void helpmode(bool)
static Cursor * help_cursor()
void notify_attach(Observer *)
Oc(Session *, const char *pname=NULL, const char **env=NULL)
static bool valid_expr(Symbol *)
void notify_freed(void(*pf)(void *, int))
static Session * session_
Definition: ivoc.h:82
static int refcnt_
Definition: ivoc.h:81
static std::ostream * save_stream
Definition: ivoc.h:77
void notify_when_freed(void *p, Observer *)
static bool valid_stmt(const char *, Object *ob=NULL)
static void cleanup()
const char * name(Symbol *)
static bool helpmode_
Definition: ivoc.h:84
void notifyHocValue()
static bool setAcceptInput(bool)
Symbol * parseExpr(const char *, Symlist **=NULL)
void notify_pointer_disconnect(Observer *)
int run(const char *, bool show_err_mes=true)
static int getStdinSeen()
Definition: ivoc.h:63
static HandleStdin * handleStdin_
Definition: ivoc.h:83
static Session * getSession()
static bool helpmode()
Definition: ivoc.h:70
#define i
Definition: md1redef.h:19
static char * env[]
Definition: inithoc.cpp:259
static int argc
Definition: inithoc.cpp:45
static char ** argv
Definition: inithoc.cpp:46
int nrn_err_dialog_active_
Definition: ivoc.cpp:43
#define Session
Definition: ivocmain.cpp:9
size_t p
static const char ** pname(void *v)
Definition: ocpointer.cpp:64
#define NULL
Definition: spdefs.h:105
Definition: hocdec.h:173
Definition: model.h:47
Definition: hocdec.h:75