1 #include <../../nrnconf.h>
22 #if NRN_ENABLE_THREADS
26 using PF = void (*)(
void*, int);
137 while (
pvob->find(pt, pv, ob)) {
139 pvob->remove(pv, ob);
161 while (
pdob->find(
p, size, pp, ob)) {
164 pdob->remove(pp, ob);
170 char* cp =
new char[sz];
187 Sprintf(m,
"%s (See terminal window)", mes);
196 #include <InterViews/event.h>
197 #include <InterViews/reqerr.h>
198 #include <InterViews/style.h>
199 #include <IV-look/kit.h>
234 extern bool (*IVDialog_setAcceptInput)(bool);
235 bool setAcceptInputCallback(
bool b) {
243 if (Session::instance()) {
244 Style*
s = Session::instance()->style();
250 if (WidgetKit::instance()->style()->find_attribute(
gargstr(1)+1,
s)) {
262 class ReqErr1:
public ReqErr {
265 virtual void Error();
266 virtual int count() {
280 void ReqErr1::Error() {
281 if (!count_ || code != r_) {
285 fprintf(stderr,
"X Error of failed request: %s\n", message);
287 fprintf(stderr,
"Further messages for error code %d will not be shown\n", r_);
293 static ReqErr1* reqerr1;
298 void winio_key_press() {
317 IVDialog_setAcceptInput = setAcceptInputCallback;
322 reqerr1 =
new ReqErr1;
329 Dispatcher::instance().link(0, Dispatcher::ReadMask,
handleStdin_);
330 Dispatcher::instance().link(0, Dispatcher::ExceptMask,
handleStdin_);
334 if (
session_->style()->find_attribute(
"first_instance_message", str)) {
350 if (reqerr1 && reqerr1->count()) {
351 fprintf(stderr,
"total X Errors: %d\n", reqerr1->count());
367 int Oc::run(
const std::string&
buf,
bool show_err_mes) {
368 return run(
buf.c_str(), show_err_mes);
371 int Oc::run(
const char*
buf,
bool show_err_mes) {
378 }
catch (std::exception
const& e) {
380 Fprintf(stderr,
"Oc::run: caught exception");
381 std::string_view what{e.what()};
383 Fprintf(stderr, fmt::format(
": {}", what).c_str());
475 bool dsav = session->done();
477 while (session->pending() && !session->done()) {
490 extern void nrniv_bind_call(
void);
496 if (!nrn_is_gui_thread()) {
virtual int exceptionRaised(int fd)
virtual int inputReady(int fd)
static void keep_updated()
virtual void attach(Observer *)
virtual void detach(Observer *)
virtual void update(Observable *)
static void setStdinSeen(bool i)
void notify_detach(Observer *)
int run(int argc, const char **argv)
static Observable * notify_change_
void notify_attach(Observer *)
void notify_freed(void(*pf)(void *, int))
static Session * session_
void notify_when_freed(void *p, Observer *)
const char * name(Symbol *)
static bool setAcceptInput(bool)
Symbol * parseExpr(const char *, Symlist **=NULL)
void notify_pointer_disconnect(Observer *)
static int getStdinSeen()
static HandleStdin * handleStdin_
static Session * getSession()
static void dismiss_defer()
void notify_pointer_freed(void *pt)
Symbol * hoc_parse_expr(const char *str, Symlist **psymlist)
int hoc_oc(const char *buf)
double hoc_run_expr(Symbol *sym)
void notify_freed(void *p)
#define TRY_GUI_REDIRECT_DOUBLE(name, obj)
void notify_freed_val_array(double *p, size_t size)
char * cxx_char_alloc(size_t sz)
void nrn_err_dialog(const char *mes)
static nrn::tool::bimap< double *, Observer * > * pdob
void nrn_notify_freed(PF pf)
static nrn::tool::bimap< void *, Observer * > * pvob
static identifier_observer_bimap * phob
int nrn_err_dialog_active_
void nrn_notify_when_void_freed(void *p, Observer *ob)
void nrn_notify_when_double_freed(double *p, Observer *ob)
void nrn_notify_pointer_disconnect(Observer *ob)
int hoc_print_first_instance
void hoc_main1_init(const char *, const char **)
int hoc_main1(int, const char **, const char **)
void notify_handle_dying(non_owning_identifier_without_container p)
Respond to the news that data_handles relying on p are now dead.
void notify_when_handle_dies(data_handle< double > dh, Observer *obs)
Register that obs should be notified when dh dies.
int Sprintf(char(&buf)[N], const char *fmt, Args &&... args)
Redirect sprintf to snprintf if the buffer size can be deduced.
#define MUTCONSTRUCT(mkmut)
HOC interpreter function declarations (included by hocdec.h)
static double done(void *v)
int hoc_execerror_messages
static const char ** pname(void *v)
non_owning_identifier_without_container identifier() const
Get the identifier used by this handle.
bool refers_to_a_modern_data_structure() const
Query whether this data handle is in "modern" mode.
A non-owning permutation-stable identifier for an entry in a container.
Helper type for incrementing/decrementing nrn_try_catch_nest_depth.
void continue_dialog(const char *label, Window *w=NULL, Coord x=400., Coord y=400.)
int Fprintf(FILE *stream, const char *fmt, Args... args)