1 #include <../../nrnconf.h>
108 #if defined(__GO32__)
111 #include <gppconio.h>
134 #define BEEP Printf("\007")
153 #define MENU_ACTION 2
170 static void appendvar(
int,
const char*,
const char*);
171 static void appendaction(
int,
const char*,
const char*);
174 static void prval(
int,
int,
int,
double);
175 static void prs(
int,
int,
int,
const char*);
192 #define diag(s) hoc_execerror(s, (char*) 0);
195 if (i < 0 || i >= maxmenus) \
196 diag("menu number out of range"); \
220 int imenu, flag,
i,
narg;
222 hoc_execerror(
"fmenu not available under mswindows.",
"Use xpanel series");
236 diag(
"can't destroy current menu");
258 diag(
" can't destroy current menu");
286 diag(
"illegal argument flag");
308 int86(0x10, ®s, ®s);
316 intdos(®s, ®s);
317 return (
int) regs.h.al;
321 intdos(®s, ®s);
322 return (
int) regs.h.al;
331 if (imenu < 0 || imenu >=
maxmenus) {
332 diag(
"menu number out of range");
365 static void appendvar(
int imenu,
const char* variable,
const char* command) {
375 item->
command = (
char*)
emalloc((
unsigned) (strlen(command) + 1));
382 for (
i = 0;
i <
p->nsub;
i++) {
390 static void appendaction(
int imenu,
const char* prompt,
const char* command) {
394 item->
prompt = (
char*)
emalloc((
unsigned) (strlen(prompt) + 1));
396 item->
command = (
char*)
emalloc((
unsigned) (strlen(command) + 1));
406 for (pnow = menu; pnow; pnow = pnow->
nextitem) {
410 switch (pnow->
type) {
428 for (pnow = menu; pnow; pnow = nextitem) {
438 free((
char*) pnow->
psym);
447 int row, col,
key, current_col;
461 switch (pnow->
type) {
467 prs(1,
row, col,
"execute");
472 if (
key == 27 ||
key == 3)
492 current_col = pnow->
col;
498 }
while (pcur->
col != current_col);
501 current_col = pnow->
col;
507 }
while (pcur->
col != current_col);
514 ((isdigit(
key) ||
key ==
'-' ||
key ==
'+' ||
key == 015 ||
key ==
'.'))) {
519 prs(0, pnow->
row + 1, pnow->
col,
"executing");
526 prs(0, pnow->
row + 1, pnow->
col,
"executing");
530 }
else if (isalpha(
key)) {
537 if (toupper(pcur->
prompt[0]) == toupper(
key))
539 }
while (pcur != pnow);
545 switch (pnow->
type) {
560 char istr[80], *istrptr;
574 if (isdigit(
key) ||
key ==
'.' ||
key ==
'e' ||
key ==
'-' ||
key ==
'+') {
579 }
else if (
key == 27) {
581 }
else if (
key ==
'\b') {
582 if (istrptr > istr) {
593 }
else if (
key == 13) {
595 if (sscanf(istr,
"%lf", &
input) == 1)
596 if (
input >= pnow->
symmin && input <= pnow->symmax) {
620 static void prval(
int oldnew,
int row,
int col,
double val) {
623 prs(oldnew,
row, col,
string);
626 static void prs(
int oldnew,
int row,
int col,
const char*
string) {
636 snprintf(
buf, 100,
"<%s>",
string);
sprintf(buf, " if (secondorder) {\n" " int _i;\n" " for (_i = 0; _i < %d; ++_i) {\n" " _p[_slist%d[_i]] += dt*_p[_dlist%d[_i]];\n" " }}\n", numeqn, listnum, listnum)
void hoc_execerror(const char *, const char *)
double hoc_getsymval(Psym *p)
void hoc_assignsym(Psym *p, double val)
void hoc_execstr(const char *cp)
Psym * hoc_getsym(const char *cp)
void hoc_menu_cleanup(void)
void free_arrayinfo(Arrayinfo *a)
#define input(prompt, fmt, var)
char * emalloc(unsigned n)