1 #include <../../nrnconf.h> 108 #if defined(__GO32__) 111 #include <gppconio.h> 128 #define Ret(a) hoc_ret(); hoc_pushx(a) 132 #define BEEP Printf("\007") 151 #define MENU_ACTION 2 166 static void appendvar(
int,
const char*,
const char*);
167 static void appendaction(
int,
const char*,
const char*);
170 static void prval(
int,
int,
int,
double);
171 static void prs(
int,
int,
int,
const char*);
188 #define diag(s) hoc_execerror(s, (char*)0); 189 #define chk(i) {if (i < 0 || i >= maxmenus) diag("menu number out of range");} 212 int imenu, flag,
i,
narg;
214 hoc_execerror(
"fmenu not available under mswindows.",
"Use xpanel series");
228 diag(
"can't destroy current menu");
234 free((
char *) menusfirst);
235 free((
char *) menuslast);
244 menusfirst[
i] = menuslast[
i] = menuscurrent[
i]
250 diag(
" can't destroy current menu");
256 while (
ifarg(narg = narg + 1)) {
263 while (
ifarg(narg = narg + 1)) {
266 command =
gargstr(narg = narg + 1);
271 while (
ifarg(narg = narg + 1)) {
278 diag(
"illegal argument flag");
300 int86(0x10, ®s, ®s);
309 return (
int)regs.h.al;
314 return (
int)regs.h.al;
323 if (imenu < 0 || imenu >=
maxmenus) {
324 diag(
"menu number out of range");
326 last = menuslast[imenu];
331 menuslast[imenu] = pnow;
344 menusfirst[imenu] = pnow;
347 menuscurrent[imenu] = pnow;
375 for (i = 0; i < p->
nsub; i++) {
388 item->
prompt = (
char *)
emalloc((
unsigned)(strlen(prompt) + 1));
400 menu = menusfirst[imenu];
401 for(pnow=menu;pnow;pnow=pnow->
nextitem){
405 switch (pnow->
type) {
411 xcursor(menuslast[imenu]->row+2, 0);
419 menu = menusfirst[imenu];
422 menuscurrent[imenu] = (
Menuitem *)0;
423 for(pnow = menu;pnow;pnow =
nextitem){
433 free((
char *)pnow->
psym);
445 menu = menusfirst[imenu];
450 pcur = menuscurrent[imenu];
456 switch (pnow->
type) {
459 prval(1, row, col, val);
462 prs(1, row, col,
"execute");
467 if(key == 27 || key == 3)
483 pcur = menuslast[imenu];
487 current_col = pnow->
col;
493 }
while(pcur->
col != current_col);
496 current_col = pnow->
col;
500 pcur = menuslast[imenu];
502 }
while(pcur->
col != current_col);
509 (isdigit(key) || key ==
'-' || key ==
'+' 510 || key == 015 || key ==
'.')) ){
511 prs(0, row, col,
"");
512 val =
enter(row, col,val,key, pnow);
515 prs(0, pnow->
row+1, pnow->
col,
"executing");
516 xcursor(menuslast[imenu]->row+2, 0);
520 prval(1, row, col, val);
522 prs(0, pnow->
row+1, pnow->
col,
"executing");
523 xcursor(menuslast[imenu]->row+2, 0);
526 }
else if (isalpha(key)) {
531 pcur = menusfirst[imenu];
533 if ( toupper(pcur->
prompt[0]) == toupper(key) )
535 }
while (pcur!=pnow);
539 menuscurrent[imenu] = pcur;
541 switch (pnow->
type) {
543 prval(0, row, col, val);
546 prs(0, row, col,
"");
550 label:
xcursor(menuslast[imenu]->row+2, 0);
556 char istr[80],*istrptr;
int key;
569 if(isdigit(key)|| key ==
'.' || key ==
'e' 570 || key ==
'-' || key ==
'+'){
575 }
else if(key == 27){
577 }
else if (key ==
'\b') {
578 if (istrptr > istr) {
589 }
else if (key == 13){
591 if(sscanf(istr,
"%lf",&input) == 1)
620 prs(oldnew, row, col,
string);
623 static void prs(
int oldnew,
int row,
int col,
const char*
string)
661 for (i = menuslast[imenu]->
row - menusfirst[imenu]->
row + 2;
i; i--) {
Psym * hoc_getsym(const char *cp)
sprintf(buf," if (secondorder) {\ " int _i;\" " for(_i=0;_i< %d;++_i) {\" " _p[_slist%d[_i]]+=dt *_p[_dlist%d[_i]];\" " }}\", numeqn, listnum, listnum)
void hoc_execerror(const char *, const char *)
void free_arrayinfo(Arrayinfo *a)
char * emalloc(unsigned n)
void hoc_menu_cleanup(void)
void hoc_execstr(const char *cp)
#define input(prompt, fmt, var)
void hoc_assignsym(Psym *p, double val)
double hoc_getsymval(Psym *p)