home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / NEURLNET / NERVES.ZIP / 87 / NSMENU.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-01-12  |  15.9 KB  |  779 lines

  1. #include "defn.h"
  2. #include "nsdata.c"
  3. #include "proto.h"
  4.  
  5. void nsmenu(void)
  6.  { /* main menu */
  7.   int i,j,k,done;
  8.   enum asc_val asc;
  9.   char str[41];
  10.   char *p;
  11.   FILE *file;
  12.   struct neuron *np;
  13.   struct con *cp;
  14.   struct Iint *ip;
  15.   int msg;
  16.  
  17.   msg = FALSE;
  18. display: /* display menu */
  19.   clrscr();
  20.   if (msg)
  21.    {
  22.     gotoxy(1,1);
  23.     cputs("Recording path not found, Press P to change");
  24.     msg = FALSE;
  25.    }
  26.   gotoxy(5,8);
  27.   textattr(WHITE);
  28.   cputs("R");
  29.   textattr(LIGHTGRAY);
  30.   cputs("ead files");
  31.   gotoxy(5,10);
  32.   textattr(WHITE);
  33.   cputs("W");
  34.   textattr(LIGHTGRAY);
  35.   cputs("rite files");
  36.   gotoxy(5,12);
  37.   textattr(WHITE);
  38.   cputs("N");
  39.   textattr(LIGHTGRAY);
  40.   cputs("euron data modification");
  41.   gotoxy(5,14);
  42.   textattr(WHITE);
  43.   cputs("E");
  44.   textattr(LIGHTGRAY);
  45.   cputs("nvironment specification");
  46.   gotoxy(5,16);
  47.   textattr(WHITE);
  48.   cputs("I");
  49.   textattr(LIGHTGRAY);
  50.   cputs("nitialize conditions");
  51.   gotoxy(5,18);
  52.   textattr(WHITE);
  53.   cputs("G");
  54.   textattr(LIGHTGRAY);
  55.   cputs("raph specification");
  56.   gotoxy(5,20);
  57.   textattr(WHITE);
  58.   cputs("P");
  59.   textattr(LIGHTGRAY);
  60.   cputs("ath specification for recording");
  61.   gotoxy(5,22);
  62.   textattr(WHITE);
  63.   cputs("S");
  64.   textattr(LIGHTGRAY);
  65.   cputs("imulate");
  66.   gotoxy(5,24);
  67.   textattr(WHITE);
  68.   cputs("Q");
  69.   textattr(LIGHTGRAY);
  70.   cputs("uit");
  71.   gotoxy(37,8);
  72.   if (neurfname[0])
  73.    cprintf("Neuron file: %s",neurfname);
  74.   gotoxy(37,9);
  75.   if (envfname[0])
  76.    cprintf("Environment file: %s",envfname);
  77.   gotoxy(37,10);
  78.   if (recpath[0])
  79.    cprintf("Recording path: %s",recpath);
  80.   erasecursor();
  81.  
  82.   /* get choice */
  83.   done = FALSE;
  84.   while (!done)
  85.    {
  86.     i = toupper(bioskey(0) & 0xff);
  87.     switch (i)
  88.      {
  89.       case 'R': /* read files */
  90. start: /* get the neuron filespec & read in */
  91.        gotoxy(1,1);
  92.        cputs("Enter neuron file spec:                                       ");
  93.        gotoxy(25,1);
  94.        j = 0;
  95.        while (!j)
  96.     j = bioskey(1);
  97.        asc = j & 0xff;
  98.        if (asc == ESC)
  99.     {
  100.      bioskey(0);
  101.      goto display;
  102.     }
  103.        else
  104.     if (asc == CR)
  105.      {
  106.       bioskey(0);
  107.       goto envfile;
  108.      }
  109.        str[0] = 38;
  110.        p = cgets(str);
  111.        file = fopen(p,"rb");
  112.        if (file == NULL)
  113.     goto start;
  114.        else
  115.     { /* read in file */
  116.      fread(&nn,2,1,file);
  117.      fread(ns,sizeof(struct neuron),nn,file);
  118.      fread(&ni,2,1,file);
  119.      fread(Iinta,sizeof(struct Iint),ni,file);
  120.      fread(&nc,2,1,file);
  121.      fread(cona,sizeof(struct con),nc,file);
  122.      fclose(file);
  123.      /* change pointers */
  124.      for (j=0, np=ns; j<nn; j++, np++)
  125.       {
  126.        if (np->Iint != NULL)
  127.         (int)np->Iint = (int)Iinta + (int)np->Iint - 1;
  128.        if (np->con != NULL)
  129.         (int)np->con = (int)cona + (int)np->con - 1;
  130.       }
  131.      for (j=0, cp=cona; j<nc; j++, cp++)
  132.       {
  133.        if (cp->next != NULL)
  134.         (int)cp->next = (int)cona + (int)cp->next - 1;
  135.       }
  136.      strcpy(neurfname,p);
  137.      gotoxy(37,8);
  138.      cprintf("Neuron file: %s                                ",neurfname);
  139.     }
  140. envfile:
  141.        gotoxy(1,1);
  142.        cputs("Enter environment file spec:                                       ");
  143.        gotoxy(30,1);
  144.        j = 0;
  145.        while (!j)
  146.     j = bioskey(1);
  147.        asc = j & 0xff;
  148.        if (asc == ESC || asc == CR)
  149.     {
  150.      bioskey(0);
  151.      goto display;
  152.     }
  153.        str[0] = 38;
  154.        p = cgets(str);
  155.        file = fopen(p,"rb");
  156.        if (file == NULL)
  157.     goto envfile;
  158.        else
  159.     { /* read in file */
  160.      fread(&bug.x,sizeof(float),1,file);
  161.      fread(&bug.y,sizeof(float),1,file);
  162.      fread(&bug.ang,sizeof(float),1,file);
  163.      fread(&nfood,2,1,file);
  164.      fread(foodx,2,NFOOD,file);
  165.      fread(foody,2,NFOOD,file);
  166.      fread(foodsize,2,NFOOD,file);
  167.      fread(&nblock,2,1,file);
  168.      fread(blockx,2,NBLOCK,file);
  169.      fread(blocky,2,NBLOCK,file);
  170.      fread(gr,sizeof(struct graph),5,file);
  171.      fclose(file);
  172.      strcpy(envfname,p);
  173.     }
  174.        goto display;
  175.       case 'W': /* write files */
  176.        gotoxy(1,1);
  177.        cputs("Write neuron file? ");
  178.        if (toupper(bioskey(0) & 0xff) != 'Y')
  179.     goto wenvfile;
  180.        /* write neuron file */
  181.        /* count neurons */
  182.        for (i=0, j=0, np=ns; i<nn; i++, np++)
  183.     if (np->name[0])
  184.      j++;
  185.        gotoxy(1,1);
  186.        if (neurfname[0])
  187.     {
  188.      cprintf("Save neurons to %s? ",neurfname);
  189.      i = toupper(bioskey(0) & 0xff);
  190.     }
  191.        if (!neurfname[0] || i != 'Y')
  192.     {
  193.      gotoxy(1,1);
  194.      cputs("Enter file spec:                                      ");
  195.      gotoxy(18,1);
  196.      str[0] = 38;
  197.      p = cgets(str);
  198.      strcpy(neurfname,p);
  199.     }
  200.        file = fopen(neurfname,"wb");
  201.        fwrite(&j,2,1,file);
  202.        for (i=0, np=ns; i<nn; i++, np++)
  203.     if (np->name[0])
  204.      {
  205.       fwrite(np,27,1,file);
  206.       if (np->Iint)
  207.        j = (int)np->Iint - (int)Iinta + 1;
  208.       else
  209.        j = 0;
  210.       fwrite(&j,2,1,file);
  211.       fwrite(&(np->Isens),18,1,file);
  212.       if (np->con)
  213.        j = (int)np->con - (int)cona + 1;
  214.       else
  215.        j = 0;
  216.       fwrite(&j,2,1,file);
  217.      }
  218.        fwrite(&ni,2,1,file);
  219.        fwrite(Iinta,sizeof(struct Iint),ni,file);
  220.        fwrite(&nc,2,1,file);
  221.        for (i=0, cp=cona; i<nc; i++, cp++)
  222.     {
  223.      fwrite(cp,sizeof(struct con)-2,1,file);
  224.      if (cp->next)
  225.       j = (int)cp->next - (int)cona + 1;
  226.      else
  227.       j = 0;
  228.      fwrite(&j,2,1,file);
  229.     }
  230.        fclose(file);
  231. wenvfile: /* write environment file */
  232.        gotoxy(1,1);
  233.        cputs("Write environment file?                                    ");
  234.        gotoxy(1,25);
  235.        if (toupper(bioskey(0) & 0xff) != 'Y')
  236.     goto display;
  237.        gotoxy(1,1);
  238.        if (envfname[0])
  239.     {
  240.      cprintf("Save environment to %s? ",envfname);
  241.      j = toupper(bioskey(0) & 0xff);
  242.     }
  243.        if (!envfname[0] || j != 'Y')
  244.     {
  245.      gotoxy(1,1);
  246.      cputs("Enter file spec:                                      ");
  247.      gotoxy(18,1);
  248.      str[0] = 38;
  249.      p = cgets(str);
  250.      strcpy(envfname,p);
  251.     }
  252.        file = fopen(envfname,"wb");
  253.        fwrite(&bug.x,sizeof(float),1,file);
  254.        fwrite(&bug.y,sizeof(float),1,file);
  255.        fwrite(&bug.ang,sizeof(float),1,file);
  256.        fwrite(&nfood,2,1,file);
  257.        fwrite(foodx,2,NFOOD,file);
  258.        fwrite(foody,2,NFOOD,file);
  259.        fwrite(foodsize,2,NFOOD,file);
  260.        fwrite(&nblock,2,1,file);
  261.        fwrite(blockx,2,NBLOCK,file);
  262.        fwrite(blocky,2,NBLOCK,file);
  263.        fwrite(gr,sizeof(struct graph),5,file);
  264.        fclose(file);
  265.        goto display;
  266.       case 'N': /* neuron data modification */
  267.        datamod();
  268.        goto display;
  269.       case 'E': /* environment set up */
  270. pent:  gotoxy(1,1);
  271.        cprintf("Enter number of food patches (0 - %d): %d   ",NFOOD,nfood);
  272.        gotoxy(39,1);
  273.        j = 0;
  274.        while (!j)
  275.     j = bioskey(1);
  276.        asc = j & 0xff;
  277.        if (asc == CR)
  278.     {
  279.      bioskey(0);
  280.      goto pdat;
  281.     }
  282.        else
  283.     if (asc == ESC)
  284.      {
  285.       bioskey(0);
  286.       goto display;
  287.      }
  288.        gotoxy(39,1);
  289.        cputs("   ");
  290.        gotoxy(39,1);
  291.        str[0] = 3;
  292.        p = cgets(str);
  293.        j = atoi(p);
  294.        if (j < 0 || j > NFOOD)
  295.     goto pent;
  296.        nfood = j;
  297. pdat:  clrline(1);
  298.        for (k=0; k<nfood; k++)
  299.     {
  300.      gotoxy(1,1);
  301.      cprintf("Food patch #%d",k+1);
  302. xpat:     gotoxy(1,2);
  303.      cprintf("Enter patch's x coordinate (0 - 956): %d   ",foodx[k]);
  304.      gotoxy(39,2);
  305.      j = 0;
  306.      while (!j)
  307.       j = bioskey(1);
  308.      asc = j & 0xff;
  309.      if (asc == CR)
  310.       {
  311.        bioskey(0);
  312.        goto ypat;
  313.       }
  314.      else
  315.       if (asc == ESC)
  316.        {
  317.         bioskey(0);
  318.         goto display;
  319.        }
  320.      gotoxy(39,2);
  321.      cputs("     ");
  322.      gotoxy(39,2);
  323.      str[0] = 4;
  324.      p = cgets(str);
  325.      j = atoi(p);
  326.      if (j < MINY || j > MAXX)
  327.       goto xpat;
  328.      foodx[k] = j;
  329.      gotoxy(39,2);
  330.      cprintf("%d",foodx[k]);
  331. ypat:     gotoxy(1,3);
  332.      cprintf("Enter patch's y coordinate (0 - 902): %d   ",foody[k]);
  333.      gotoxy(39,3);
  334.      j = 0;
  335.      while (!j)
  336.       j = bioskey(1);
  337.      asc = j & 0xff;
  338.      if (asc == CR)
  339.       {
  340.        bioskey(0);
  341.        goto patsiz;
  342.       }
  343.      else
  344.       if (asc == ESC)
  345.        {
  346.         bioskey(0);
  347.         goto display;
  348.        }
  349.      gotoxy(39,3);
  350.      cputs("     ");
  351.      gotoxy(39,3);
  352.      str[0] = 4;
  353.      p = cgets(str);
  354.      j = atoi(p);
  355.      if (j < MINY || j > MAXY)
  356.       goto ypat;
  357.      foody[k] = j;
  358.      gotoxy(39,3);
  359.      cprintf("%d",foody[k]);
  360. patsiz:     gotoxy(1,4);
  361.      cprintf("Enter size of patch (0 - 5000): %d   ",foodsize[k]);
  362.      gotoxy(33,4);
  363.      j = 0;
  364.      while (!j)
  365.       j = bioskey(1);
  366.      asc = j & 0xff;
  367.      if (asc == CR)
  368.       {
  369.        bioskey(0);
  370.        goto patdone;
  371.       }
  372.      else
  373.       if (asc == ESC)
  374.        {
  375.         bioskey(0);
  376.         goto display;
  377.        }
  378.      gotoxy(33,4);
  379.      cputs("     ");
  380.      gotoxy(33,4);
  381.      str[0] = 5;
  382.      p = cgets(str);
  383.      j = atoi(p);
  384.      if (j < 0 || j > 5000)
  385.       goto patsiz;
  386.      foodsize[k] = j;
  387.      gotoxy(33,4);
  388.      cprintf("%d",foodsize[k]);
  389. patdone: clrline(1);
  390.      clrline(2);
  391.      clrline(3);
  392.      clrline(4);
  393.     }
  394. bent:  clrline(1);
  395.        gotoxy(1,1);
  396.        cprintf("Enter number of blocks (0 - %d): %d   ",NBLOCK,nblock);
  397.        gotoxy(33,1);
  398.        j = 0;
  399.        while (!j)
  400.     j = bioskey(1);
  401.        asc = j & 0xff;
  402.        if (asc == CR)
  403.     {
  404.      bioskey(0);
  405.      goto bdat;
  406.     }
  407.        else
  408.     if (asc == ESC)
  409.      {
  410.       bioskey(0);
  411.       goto display;
  412.      }
  413.        gotoxy(33,1);
  414.        cputs("   ");
  415.        gotoxy(33,1);
  416.        str[0] = 3;
  417.        p = cgets(str);
  418.        nblock = atoi(p);
  419.        if (nblock < 0 || nblock > NBLOCK)
  420.     goto bent;
  421. bdat:  clrline(1);
  422.        for (k=0; k<nblock; k++)
  423.     {
  424.      gotoxy(1,1);
  425.      cprintf("Block #%d",k+1);
  426. xblk:     gotoxy(1,2);
  427.      cprintf("Enter block's x coordinate (0 - 760): %d   ",blockx[k]);
  428.      gotoxy(39,2);
  429.      j = 0;
  430.      while (!j)
  431.       j = bioskey(1);
  432.      asc = j & 0xff;
  433.      if (asc == CR)
  434.       {
  435.        bioskey(0);
  436.        goto yblk;
  437.       }
  438.      else
  439.       if (asc == ESC)
  440.        {
  441.         bioskey(0);
  442.         goto display;
  443.        }
  444.      gotoxy(39,2);
  445.      cputs("     ");
  446.      gotoxy(39,2);
  447.      str[0] = 4;
  448.      p = cgets(str);
  449.      j = atoi(p);
  450.      if (j < 0 || j > 760)
  451.       goto xblk;
  452.      blockx[k] = j;
  453.      gotoxy(39,2);
  454.      cprintf("%d",blockx[k]);
  455. yblk:     gotoxy(1,3);
  456.      cprintf("Enter block's y coordinate (0 - 805): %d   ",blocky[k]);
  457.      gotoxy(39,3);
  458.      j = 0;
  459.      while (!j)
  460.       j = bioskey(1);
  461.      asc = j & 0xff;
  462.      if (asc == CR)
  463.       {
  464.        bioskey(0);
  465.        goto blockdone;
  466.       }
  467.      else
  468.       if (asc == ESC)
  469.        {
  470.         bioskey(0);
  471.         goto display;
  472.        }
  473.      gotoxy(39,3);
  474.      cputs("     ");
  475.      gotoxy(39,3);
  476.      str[0] = 4;
  477.      p = cgets(str);
  478.      j = atoi(p);
  479.      if (j < 0 || j > 805)
  480.       goto yblk;
  481.      blocky[k] = j;
  482.      gotoxy(39,3);
  483.      cprintf("%d",blocky[k]);
  484. blockdone: clrline(1);
  485.      clrline(2);
  486.      clrline(3);
  487.     }
  488.        goto display;
  489.       case 'I': /* initial conditions */
  490. xent:  gotoxy(1,1);
  491.        cprintf("Enter x coordinate of bug (80 - 880): %d    ",(int)bug.x);
  492.        gotoxy(39,1);
  493.        j = 0;
  494.        while (!j)
  495.     j = bioskey(1);
  496.        asc = j & 0xff;
  497.        if (asc == CR)
  498.     {
  499.      bioskey(0);
  500.      goto yent;
  501.     }
  502.        else
  503.     if (asc == ESC)
  504.      {
  505.       bioskey(0);
  506.       goto display;
  507.      }
  508.        gotoxy(39,1);
  509.        cputs("      ");
  510.        gotoxy(39,1);
  511.        str[0] = 4;
  512.        p = cgets(str);
  513.        j = atoi(p);
  514.        if (j < 80 || j > 880)
  515.     goto xent;
  516.        bug.x = j;
  517.        gotoxy(39,1);
  518.        cprintf("%d",(int)bug.x);
  519. yent:  gotoxy(1,2);
  520.        cprintf("Enter y coordinate of bug (80 - 820): %d    ",(int)bug.y);
  521.        gotoxy(39,2);
  522.        j = 0;
  523.        while (!j)
  524.     j = bioskey(1);
  525.        asc = j & 0xff;
  526.        if (asc == CR)
  527.     {
  528.      bioskey(0);
  529.      goto aent;
  530.     }
  531.        else
  532.     if (asc == ESC)
  533.      {
  534.       bioskey(0);
  535.       goto display;
  536.      }
  537.        gotoxy(39,2);
  538.        cputs("      ");
  539.        gotoxy(39,2);
  540.        str[0] = 4;
  541.        p = cgets(str);
  542.        j = atoi(p);
  543.        if (j < 80 || j > 820)
  544.     goto yent;
  545.        bug.y = j;
  546.        gotoxy(39,2);
  547.        cprintf("%d",(int)bug.y);
  548. aent:  gotoxy(1,3);
  549.        cprintf("Enter bug angle (0 - 359): %d    ",(int)(180.*bug.ang/PI));
  550.        gotoxy(28,3);
  551.        j = 0;
  552.        while (!j)
  553.     j = bioskey(1);
  554.        asc = j & 0xff;
  555.        if (asc == CR)
  556.     {
  557.      bioskey(0);
  558.      goto eent;
  559.     }
  560.        else
  561.     if (asc == ESC)
  562.      goto display;
  563.        gotoxy(28,3);
  564.        cputs("      ");
  565.        gotoxy(28,3);
  566.        str[0] = 4;
  567.        p = cgets(str);
  568.        j = atoi(p);
  569.        if (j < 0 || j > 359)
  570.     goto aent;
  571.        bug.ang = PI*j/180;
  572.        gotoxy(28,3);
  573.        cprintf("%d",(int)(180.*bug.ang/PI));
  574. eent:  gotoxy(1,4);
  575.        cprintf("Enter energy (100 - 999): %d    ",(int)energy);
  576.        gotoxy(27,4);
  577.        j = 0;
  578.        while (!j)
  579.     j = bioskey(1);
  580.        asc = j & 0xff;
  581.        if (asc == CR || asc == ESC)
  582.     {
  583.      bioskey(0);
  584.      goto display;
  585.     }
  586.        gotoxy(27,4);
  587.        cputs("      ");
  588.        gotoxy(27,4);
  589.        str[0] = 4;
  590.        p = cgets(str);
  591.        j = atoi(p);
  592.        if (j < 100 || j > 999)
  593.     goto eent;
  594.        energy = j;
  595.        gotoxy(27,4);
  596.        cprintf("%d",(int)energy);
  597.        goto display;
  598.       case 'G': /* graph specification */
  599.        for (k=0; k<5; k++)
  600.     {
  601.      gotoxy(1,1);
  602.      cprintf("Graph #%d",k+1);
  603. gtent:     gotoxy(1,2);
  604.      cprintf("Enter graph type (0=None, 1=Variable, 2=Gait): %d   ",gr[k].gtype);
  605.      gotoxy(48,2);
  606.      j = 0;
  607.      while (!j)
  608.       j = bioskey(1);
  609.      asc = j & 0xff;
  610.      if (asc == CR)
  611.       {
  612.        bioskey(0);
  613.        if (gr[k].gtype != 1)
  614.         goto grend;
  615.        goto gneur;
  616.       }
  617.      else
  618.       if (asc == ESC)
  619.        {
  620.         bioskey(0);
  621.         goto display;
  622.        }
  623.      gotoxy(48,2);
  624.      cputs("      ");
  625.      gotoxy(48,2);
  626.      str[0] = 2;
  627.      p = cgets(str);
  628.      j = atoi(p);
  629.      if (j < 0 || j > 2)
  630.       goto gtent;
  631.      gr[k].gtype = j;
  632.      gotoxy(48,2);
  633.      cprintf("%d",gr[k].gtype);
  634.      if (gr[k].gtype != 1)
  635.       goto grend;
  636. gneur:   gotoxy(1,3);
  637.      cprintf("Enter neuron name: %s       ",gr[k].gneur);
  638.      gotoxy(20,3);
  639.      j = 0;
  640.      while (!j)
  641.       j = bioskey(1);
  642.      asc = j & 0xff;
  643.      if (asc == CR)
  644.       {
  645.        bioskey(0);
  646.        goto gvar;
  647.       }
  648.      else
  649.       if (asc == ESC)
  650.        {
  651.         bioskey(0);
  652.         goto display;
  653.        }
  654.      gotoxy(20,3);
  655.      cputs("      ");
  656.      gotoxy(20,3);
  657.      str[0] = 7;
  658.      p = cgets(str);
  659.      strcpy(gr[k].gneur,p);
  660. gvar:    gotoxy(1,4);
  661.      cprintf("Enter variable (0=V [milliV], 1=F, 2=I [pA]): %d",gr[k].gvar);
  662.      gotoxy(47,4);
  663.      j = 0;
  664.      while (!j)
  665.       j = bioskey(1);
  666.      asc = j & 0xff;
  667.      if (asc == CR)
  668.       {
  669.        bioskey(0);
  670.        if (gr[k].gvar == 1)
  671.         goto grend;
  672.        goto gscale;
  673.       }
  674.      else
  675.       if (asc == ESC)
  676.        {
  677.         bioskey(0);
  678.         goto display;
  679.        }
  680.      gotoxy(47,4);
  681.      cputs("      ");
  682.      gotoxy(47,4);
  683.      str[0] = 2;
  684.      p = cgets(str);
  685.      j = atoi(p);
  686.      if (j < 0 || j > 2)
  687.       goto gvar;
  688.      gr[k].gvar = j;
  689.      gotoxy(47,4);
  690.      cprintf("%d",gr[k].gvar);
  691.      if (gr[k].gvar == 1)
  692.       goto grend;
  693. gscale:  gotoxy(1,5);
  694.          gr[k].gscale = 50;
  695.      cprintf("Enter scale (1 - 300): %d",gr[k].gscale);
  696.      gotoxy(24,5);
  697.      j = 0;
  698.      while (!j)
  699.       j = bioskey(1);
  700.      asc = j & 0xff;
  701.      if (asc == CR)
  702.       {
  703.        bioskey(0);
  704.        goto grend;
  705.       }
  706.      else
  707.       if (asc == ESC)
  708.        {
  709.         bioskey(0);
  710.         goto display;
  711.        }
  712.      gotoxy(24,5);
  713.      cputs("      ");
  714.      gotoxy(24,5);
  715.      str[0] = 10;
  716.      p = cgets(str);
  717.          j = atoi(p);
  718.          if (j < 1 || j > 300)
  719.           goto gscale;
  720.      gr[k].gscale = j;
  721.      gotoxy(24,5);
  722.      cprintf("%d",gr[k].gscale);
  723. grend:   clrline(1);
  724.      clrline(2);
  725.      clrline(3);
  726.      clrline(4);
  727.      clrline(5);
  728.     }
  729.        goto display;
  730.       case 'P': /* path for recording */
  731.        gotoxy(1,1);
  732.        cputs("Enter recording path:                                       ");
  733.        gotoxy(23,1);
  734.        j = 0;
  735.        while (!j)
  736.     j = bioskey(1);
  737.        asc = j & 0xff;
  738.        if (asc == ESC || asc == CR)
  739.     {
  740.      bioskey(0);
  741.      goto display;
  742.     }
  743.        str[0] = 25;
  744.        p = cgets(str);
  745.        strcpy(recpath,p);
  746.        i = strlen(recpath) - 1;
  747.        if (recpath[i] == '\\')
  748.     recpath[i] = 0; /* get rid of final \ */
  749.        goto display;
  750.       case 'S': /* simulate */
  751.        msg = initsim();
  752.        closegraph();
  753.        goto display;
  754.       case 'Q': /* quit */
  755.        done = TRUE;
  756.        break;
  757.       default:
  758.        break;
  759.      }
  760.    }
  761.  }
  762.  
  763. void erasecursor(void)
  764.  {
  765.   union REGS regs;
  766.  
  767.   regs.x.bx = 0;
  768.   regs.x.dx = 0x1900;
  769.   regs.x.ax = 0x200;
  770.   int86(0x10,®s,®s);
  771.  }
  772.  
  773. void clrline(int n)
  774.  {
  775.   gotoxy(1,n);
  776.   cputs("                                                              ");
  777.  }
  778.  
  779.