home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / datamage.zip / CODE.ZIP / MAGEDEMO.C < prev    next >
C/C++ Source or Header  |  1991-02-09  |  16KB  |  790 lines

  1. /*****************************************************************************
  2. *  This code is provided as an example of how to interface your C programs   *
  3. *  with DATAMAGE files.  The program makes use of the two libraries provided *
  4. *  but does not call all the functions they contain.                         *
  5. *                                                                            *
  6. *  Only REGISTERED USERS of DATAMAGE are allowed to insert this code into    *
  7. *  their programs.  It is provided here for reference and testing only.      *
  8. *                                                                            *
  9. *  The implementation of this program required the writing of only one func- *
  10. *  tion: browse_MAGE_files.  Of course, I made it out of a function already  *
  11. *  present in the library: vs_MAGE_record.                                   *
  12. *                                                                            *
  13. *  The code compiles with Quick C 2.5.  If you are a turbo fan you should be *
  14. *  able to get it to go, but you may need to write your own functions to     *
  15. *  convert the "mbf" numerics to ieee, and vice-versa.                       *
  16. *                                                                            *
  17. *  I thougt long and hard before giving this code away.  It's not that great *
  18. *  but it took me a few minutes to write it, I'll guarantee you!  I hope you *
  19. *  can find it in your heart to register your DATAMAGE.                      *
  20. *                                                                            *
  21. *  If you find you like the code I'm looking for a good, steady job.         *
  22. *****************************************************************************/
  23.  
  24. #include <direct.h>
  25. #include <math.h>
  26. #include <malloc.h>
  27. #include <stdio.h>
  28. #include <string.h>
  29. #include <stdlib.h>
  30.  
  31. #include "hcwp_lib.h"
  32. #include "mageisam.h"
  33.  
  34. void draw_border ()
  35.     {
  36.     BYTE register d;
  37.  
  38.     locate (0,0); crt_out (201);
  39.     locate (0,1); line_out (78,205);
  40.     locate (0,79); crt_out (187);
  41.  
  42.     locate (20,0); crt_out (204);
  43.     locate (20,1); line_out (78,205);
  44.     locate (20,79); crt_out (185);
  45.  
  46.     for (d = 1; d < 24; d++)
  47.         {
  48.         if (d == 20) continue;
  49.         locate (d,0);   crt_out (186);
  50.         locate (d,79);  crt_out (186);
  51.         }
  52.  
  53.     locate (24,0); crt_out (200);
  54.     locate (24,1); line_out (78,205);
  55.     locate (24,79); crt_out (188);
  56.  
  57.     locate (0,29);
  58.     clr_prnt ("[ D A T A  M A G E ]", 25);
  59.  
  60.     locate (24,30);
  61.     clr_prnt ("[C LANGUAGE DEMO]", 25);
  62.     }
  63.  
  64. BYTE b_line (BYTE file, BYTE field, SWORD line,
  65.                SWORD subscr, BYTE revsw, SWORD far * base)
  66.     {
  67. /*   print line for browse file  */
  68.  
  69.     BYTE b, c, d, row, z;
  70.  
  71.     WORD x;
  72.  
  73.     SWORD rno;
  74.  
  75.     DWORD offset;
  76.  
  77.     double temp, msbin;
  78.  
  79.     row = (line * 2) + 2;
  80.  
  81.     /*  get offset of next record from array  */
  82.  
  83.     x = * (base + subscr);
  84.  
  85.     /*  offset in control file  */
  86.  
  87.     offset = x * 2;
  88.  
  89.     /*  read in record number  */
  90.  
  91.     c = fseek (fi [file].ctrl, offset, SEEK_SET);
  92.     fread (& rno, 2, 1, fi [file].ctrl);
  93.  
  94.     strcpy (gp_str [12], "RCD# ");
  95.     sprintf (gp_str [11], "%hi", rno);
  96.     strcat (gp_str [12], gp_str [11]);
  97.  
  98.     locate (row, 7); prnt (gp_str [12]);
  99.  
  100.     strcpy (gp_str [12], "# ");
  101.     sprintf (gp_str [11], "%u", field + 1);
  102.     strcat (gp_str [12], gp_str [11]);
  103.  
  104.     locate (row, 20); prnt (gp_str [12]);
  105.  
  106.     /*  offset in main file  */
  107.  
  108.     offset = (fi [file].rcd_len * x) + fi [file].key  [field] -> offset;
  109.  
  110.     /*  read in field  */
  111.  
  112.     c = fseek (fi [file].main, offset, SEEK_SET);
  113.     fread (f_buff, 1, fi [file].key  [field] -> length, fi [file].main);
  114.  
  115.     f_buff [fi [file].key  [field] -> length] = 0;
  116.  
  117.     if (fi [file].key  [field] -> type < 2) rtrim (f_buff);
  118.  
  119.     else
  120.         {
  121.         c = dmsbintoieee ( (double *) f_buff, & temp);
  122.  
  123.         strcpy (gp_str [4], "%. lf");
  124.         gp_str [4] [2] = fi [file].key  [field] -> spare + 48;
  125.  
  126.         sprintf (f_buff, gp_str [4], temp);
  127.         }
  128.  
  129.     locate (row, 30);
  130.  
  131.     prnt (f_buff);
  132.  
  133.     return (0);
  134.     }
  135.  
  136. BYTE fill_b (BYTE file, BYTE field, SWORD * curr_line,
  137.                SWORD * top_line, WORD last, SWORD far * base)
  138.     {
  139. /*   fill screen for browse file  */
  140.  
  141.     BYTE c;
  142.  
  143.     SWORD d, m;
  144.  
  145.     clw (2);
  146.  
  147.     /*  do lines  */
  148.  
  149.     for (d = 0; d < 9; d++)
  150.             {
  151.             m = d + * top_line;
  152.  
  153.             if (m >= last) continue;
  154.  
  155.             c = b_line (file, field, d, m, 0, base);
  156.             if (c) return (1);
  157.             }
  158.  
  159.     /*  check current line  */
  160.  
  161.     if (* top_line + * curr_line >= last)
  162.         * curr_line = last - * top_line - 1;
  163.  
  164.     return (0);
  165.     }
  166.  
  167. void b_menu (BYTE file)
  168.     {
  169. /*   menu for browse file  */
  170.  
  171.     clw (3);
  172.     locate (21,6);
  173.     prnt ("FILE:  ");
  174.  
  175.     prnt (fi [file].dir);
  176.  
  177.     locate (21, 58);
  178.     prnt ("LOCATION: ");
  179.  
  180.     locate (22,6);
  181.     prnt ("CONTROL KEYS:  \x018 \x019 Pg-U Pg-D Home End Quit Eneter Delete View Search");
  182.     }
  183.  
  184. BYTE far browse_MAGE_files (BYTE file, BYTE field, BYTE * error_str)
  185.     {
  186. /*   browses file passed.  this is a NEW one, and not well tested  */
  187.  
  188.     BYTE c, close_sw [3], d, ft_sw, wfg = 0, wfg2 = 0, ret_val, row;
  189.  
  190.     WORD i = 0, max_rcd, n = 0, x;
  191.  
  192.     SWORD rno, top_line = 0, curr_line = 5, far * base;
  193.  
  194.     DWORD offset = 0;
  195.  
  196.     BYTE b_line (BYTE, BYTE, SWORD, SWORD, BYTE, SWORD far *);
  197.  
  198.     BYTE fill_b (BYTE, BYTE, SWORD *, SWORD *, WORD, SWORD far *);
  199.  
  200.     void b_menu (BYTE);
  201.  
  202.     for (c = 0; c < 3; c++) close_sw [c] = 0;
  203.  
  204.     /*  open ctrl file  */
  205.  
  206.     c = condit_open (file, 3, "r+b");
  207.  
  208.     switch (c)
  209.         {
  210.         case 0: break;
  211.  
  212.         case 1: {close_sw [2] = 1; break;}
  213.  
  214.         case 2: return (1);
  215.         }
  216.  
  217.     c = fseek (fi [file].ctrl, offset, SEEK_SET);
  218.  
  219.     /*  open main file  */
  220.  
  221.     c = condit_open (file, 1, "r+b");
  222.  
  223.     switch (c)
  224.         {
  225.         case 0: break;
  226.  
  227.         case 1: {close_sw [0] = 1; break;}
  228.  
  229.         case 2: return (1);
  230.         }
  231.  
  232. check_open:
  233.  
  234.     if (wfg)
  235.         {
  236.         strcpy (error_str, "UNABLE TO ACCESS BROWSE FILES");
  237.  
  238.         ret_val = 2;
  239.         goto bf_end;
  240.         }
  241.  
  242.     while (i < fi [file].num_rcds)
  243.         {
  244.  
  245.         fread (& rno, 2, 1, fi [file].ctrl);
  246.  
  247.         if (rno) n++;
  248.  
  249.         i ++;
  250.         }
  251.  
  252.     if (! n)
  253.         {
  254.         strcpy (error_str, "BROWSE FILE HAS NO RECORDS");
  255.  
  256.         ret_val = 2;
  257.         goto bf_end;
  258.         }
  259.  
  260.     max_rcd = n + 100;
  261.  
  262.     base = (SWORD far *) _fmalloc ( (max_rcd * 2) + 10);
  263.  
  264.     if (base == NULL)
  265.         {
  266.         strcpy (error_str, "INSUFFICIANT MEMORY FOR FILE BROWSE");
  267.  
  268.         ret_val = 2;
  269.         goto bf_end;
  270.         }
  271.  
  272.     i = x = 0;
  273.  
  274.     c = fseek (fi [file].ctrl, (DWORD) 0, SEEK_SET);
  275.  
  276.     while (i < fi [file].num_rcds)
  277.         {
  278.         fread (& rno, 2, 1, fi [file].ctrl);
  279.  
  280.         if (rno) * (base + x++) = i;
  281.  
  282.         i ++;
  283.         }
  284.  
  285.     ft_sw = 0; /*  check_heap ();  */
  286.  
  287.     c = fill_b (file, field, & curr_line, & top_line, n, base);
  288.  
  289.     if (c) {ret_val = 1; goto bf_end_2;}
  290.  
  291.     while (! wfg)
  292.         {
  293.         if (! ft_sw) {b_menu (file); ft_sw = 1;}
  294.  
  295.         row = (curr_line * 2) + 2;
  296.  
  297.         gp_str [6] [0] = 0;
  298.         sprintf (gp_str [6],"%hi", top_line + curr_line + 1);
  299.  
  300.         locate (21, 68);
  301.         prnt ("         ");
  302.  
  303.         locate (21, 68);
  304.         prnt (gp_str [6]);
  305.  
  306.         /*  get offset of next record from array  */
  307.  
  308.         x = * (base + top_line + curr_line);
  309.  
  310.         /*  offset in control file  */
  311.  
  312.         offset = x * 2;
  313.  
  314.         /*  read in record number  */
  315.  
  316.         c = fseek (fi [file].ctrl, offset, SEEK_SET);
  317.         fread (& rno, 2, 1, fi [file].ctrl);
  318.  
  319.         sprintf (gp_str [11], "%hi", rno);
  320.  
  321.         strcpy (gp_str [12], "#"); strcat (gp_str [12], gp_str [11]);
  322.  
  323.         locate (row, 7);
  324.         clr_prnt ("RCD# ", 155);
  325.         clr_prnt (gp_str [11], 155);
  326.  
  327.         get_one (& ctrl_val, & nrml_val);
  328.  
  329.         locate (row, 7);
  330.         clr_prnt ("RCD# ", attr);
  331.         clr_prnt (gp_str [11], attr);
  332.  
  333.         if (nrml_val)
  334.             {
  335.             switch (nrml_val)
  336.                 {
  337.                 case 'Q' :
  338.                 case 'q' :
  339.                     {
  340.                     clw (3); locate (22,32); ft_sw = 0;
  341.                     prnt ("1=QUIT   2=NO");
  342.  
  343.                     if (get_choice (2) - 1) break;
  344.  
  345.                     wfg = 1; ret_val = 1;
  346.                     nrml_val = 0; break;
  347.                     }
  348.  
  349.                 case 13 :  /*  record selected  */
  350.                     {
  351.                     ft_sw = 0;
  352.  
  353.                     /*  get offset of record from array  */
  354.  
  355.                     x = * (base + top_line + curr_line);
  356.  
  357.                     fi [file].sequence = x;
  358.  
  359.                     /*  offset in control file  */
  360.  
  361.                     offset = x * 2;
  362.  
  363.                     /*  read in record number  */
  364.  
  365.                     c = fseek (fi [file].ctrl, offset, SEEK_SET);
  366.                     fread (& rno, 2, 1, fi [file].ctrl);
  367.  
  368.                     fi [file].r_number = rno;
  369.  
  370.                     /*  read record in  */
  371.  
  372.                     c = read_MAGErcd (file, x);
  373.  
  374.                     /*  display/edit record  */
  375.  
  376.                     c = access_MAGE_record (file, 0);
  377.  
  378.                     c = fill_b (file, field, & curr_line,
  379.                               & top_line, n, base);
  380.  
  381.                     break;
  382.                     }
  383.  
  384.                 case 'e':
  385.                 case 'E':
  386.                     {
  387.                     clw (3); locate (22,28); ft_sw = 0;
  388.                     prnt ("1=ENTER A RECORD   2=NO");
  389.  
  390.                     if (get_choice (2) - 1) break;
  391.  
  392.                     /*  get next record number and sequence  */
  393.  
  394.                     c = get_next_rno (file);
  395.                     if (c) break;
  396.  
  397.                     /*  balk if addition and 100 have been added  */
  398.  
  399.                     if (fi [file].sequence == fi [file].num_rcds &&
  400.                         n + 1 > max_rcd)
  401.                         {
  402.                         clw (3); beep(); locate (22, 25);
  403.                         prnt ("100 RECORDS HAVE BEEN ENTERED");
  404.                         wait (4); break;
  405.                         }
  406.  
  407.                     /*  display record for entry  */
  408.  
  409.                     c = access_MAGE_record (file, 0);
  410.  
  411.                     /*  if write add new record to display,
  412.                         increment total  */
  413.  
  414.                     if (! c) * (base + n++) = fi [file].sequence;
  415.  
  416.                     /*  new screen  */
  417.  
  418.                     c = fill_b (file, field, & curr_line,
  419.                               & top_line, n, base);
  420.  
  421.                     break;
  422.                     }
  423.  
  424.                 case 'd':
  425.                 case 'D':
  426.                     {
  427.                     ft_sw = 0;
  428.  
  429.                     strcpy (c_s [0], "1=DELETE RECORD: ");
  430.  
  431.                     /*  get offset of record from array  */
  432.  
  433.                     x = * (base + top_line + curr_line);
  434.  
  435.                     fi [file].sequence = x;
  436.  
  437.                     /*  offset in control file  */
  438.  
  439.                     offset = x * 2;
  440.  
  441.                     /*  read in record number  */
  442.  
  443.                     c = fseek (fi [file].ctrl, offset, SEEK_SET);
  444.                     fread (& rno, 2, 1, fi [file].ctrl);
  445.  
  446.                     sprintf (gp_str [14], "%hi", rno);
  447.                     strcat (c_s [0], gp_str [14]);
  448.  
  449.                     strcpy (c_s [1], "2=NO");
  450.  
  451.                     c = cntrstrp ();
  452.  
  453.                     clw (3); locate (22,c);
  454.                     prnt (c_s [2]);
  455.  
  456.                     if (get_choice (2) - 1) break;
  457.  
  458.                     /*  set index values  */
  459.  
  460.                     for (d = 0; d < 5; d++)
  461.                         fi [file].index_results [d] = 0;
  462.  
  463.                     /*  blank buffer  */
  464.  
  465.                     ready_files (file);
  466.  
  467.                     /*  zero record number  */
  468.  
  469.                     fi [file].r_number = 0;
  470.  
  471.                     /*  write blank  */
  472.  
  473.                     c = write_MAGErcd (file);
  474.  
  475.                     /*  remove record from display array  */
  476.  
  477.                     for (i = top_line + curr_line; i < n; i++)
  478.                         {
  479.                         * (base + i) = * (base + i + 1);
  480.                         }
  481.  
  482.                     /*  decrement number of records  */
  483.  
  484.                     n--;
  485.  
  486.                     /*  protect from showing blank screen  */
  487.  
  488.                     if (top_line >= n) top_line = n - 9;
  489.                     if (top_line < 0) top_line = 0;
  490.  
  491.                     c = fill_b (file, field, & curr_line,
  492.                               & top_line, n, base);
  493.  
  494.                     break;
  495.                     }
  496.  
  497.                 case 'v':
  498.                 case 'V':
  499.                     {
  500.                     clw (3); locate (22,31); ft_sw = 0;
  501.                     prnt ("SELECT VIEW FIELD");
  502.  
  503.                     save_window (9); clw (9);
  504.                     c = show_fields (file, 9);
  505.                     repl_window (9);
  506.  
  507.                     if (! c) field = nrml_val;
  508.  
  509.                     c = fill_b (file, field, & curr_line,
  510.                               & top_line, n, base);
  511.  
  512.                     break;
  513.                     }
  514.  
  515.                 case 's':
  516.                 case 'S':
  517.                     {
  518.                     ft_sw = 0;
  519.                     c = search_MAGE_files (file);
  520.  
  521.                     if (! c)
  522.                         {
  523.                         /*  find offset in array  */
  524.  
  525.                         for (wfg2 = 0, i = 0; ! wfg2 && i < n; i++)
  526.                             if (* (base + i) ==
  527.                                 fi [file].sequence) wfg2 = 1;
  528.  
  529.                         /*  locate display  */
  530.  
  531.                         if (wfg2)
  532.                             {
  533.                             c = 0;
  534.                             top_line = i - 6;
  535.  
  536.                             if (top_line < 0)
  537.                                 {
  538.                                 c = 0 - top_line;
  539.                                 top_line = 0;
  540.                                 }
  541.  
  542.                             curr_line = 5 - c;
  543.                             }
  544.  
  545.                         }
  546.  
  547.                     c = fill_b (file, field, & curr_line,
  548.                               & top_line, n, base);
  549.  
  550.                     break;
  551.                     }
  552.  
  553.  
  554.                 default : beep (); break;
  555.                 }
  556.  
  557.             continue;
  558.             }
  559.  
  560.         switch (ctrl_val)
  561.             {
  562.             case 71:        /* home */
  563.                 {
  564.                 top_line = 0;
  565.  
  566.                 c = fill_b (file, field, & curr_line,
  567.                               & top_line, n, base);
  568.  
  569.                 if (c) return (1);
  570.  
  571.                 continue;
  572.                 }
  573.  
  574.             case 72:        /* line up */
  575.                 {
  576.                 if ( (curr_line) - 1 >= 0) {curr_line -= 1; continue;}
  577.  
  578.                 if ( (top_line) - 1 < 0) {beep(); continue;}
  579.                 top_line -= 1;
  580.                 scroll_window (2, 2, 2);
  581.  
  582.                 c =  b_line (file, field, 0, top_line, 0, base);
  583.                 if (c) return (1);
  584.  
  585.                 continue;
  586.                 }
  587.  
  588.             case 73:        /* page up */
  589.                 {
  590.                 top_line -= 9;
  591.                 if (top_line < 0) top_line = 0;
  592.  
  593.                 c = fill_b (file, field,
  594.                               & curr_line, & top_line, n, base);
  595.  
  596.                 if (c) return (1);
  597.  
  598.                 continue;
  599.                 }
  600.  
  601.             case 79:        /* end */
  602.                 {
  603.                 top_line = n - 9;
  604.                 if (top_line < 0) top_line = 0;
  605.  
  606.                 c = fill_b (file, field, & curr_line,
  607.                           & top_line, n, base);
  608.  
  609.                 if (c) return (1);
  610.  
  611.                 continue;
  612.                 }
  613.  
  614.             case 80:        /* line down */
  615.                 {
  616.                 x = curr_line + 1;
  617.  
  618.                 if (x <= 8)
  619.                     {
  620.                     if (x < n) curr_line += 1; else beep();
  621.                     continue;
  622.                     }
  623.  
  624.                 if (top_line + 10 > n)
  625.                     {beep (); continue;}
  626.  
  627.                 top_line += 1;
  628.                 scroll_window (2, 1, 2);
  629.  
  630.                 c = b_line (file, field, 8, top_line + 8, 0, base);
  631.  
  632.                 if (c) {wfg = 1; ret_val = 1; continue;}
  633.  
  634.                 continue;
  635.                 }
  636.  
  637.             case 81:        /* page down */
  638.                 {
  639.                 top_line += 9;
  640.  
  641.                 if (top_line > n - 9)
  642.                     top_line = n - 9;
  643.  
  644.                 if (top_line < 0) top_line = 0;
  645.  
  646.                 c = fill_b (file, field,
  647.                               & curr_line, & top_line, n, base);
  648.  
  649.                 if (c) return (1);
  650.  
  651.                 continue;
  652.                 }
  653.  
  654.             default: beep(); continue;
  655.             }
  656.  
  657.         }
  658.  
  659.     if (wfg == 2) {_ffree (base); goto check_open;}
  660.  
  661. bf_end_2:
  662.  
  663.     _ffree (base);
  664.  
  665. bf_end:
  666.  
  667.     if (close_sw [3]) {fclose (fi [file].ctrl); fi [file].ctrl = NULL;}
  668.     if (close_sw [1]) {fclose (fi [file].main); fi [file].main = NULL;}
  669.  
  670.     return (ret_val);
  671.     }
  672.  
  673. main (BYTE argc, BYTE * argv [])
  674.     {
  675.     BYTE c, choice, color = 0, d, i, running = 1;
  676.  
  677.     BYTE * cwd;
  678.  
  679.     SBYTE swfg;
  680.  
  681.     FILE * target;
  682.  
  683.     /*  find current path  */
  684.  
  685.     cwd = getcwd (pth_str, 55);
  686.  
  687.     if (cwd == NULL)
  688.         {
  689.         prnt ("CURRENT PATH TOO LONG - PROCESSING TERMINATED");
  690.         return (0);
  691.         }
  692.  
  693.     c = strlen (pth_str) - 1;
  694.  
  695.     if (pth_str [c] == 92) pth_str [c] = 0;
  696.  
  697.     /*  get video  */
  698.  
  699.     get_vs (& attr);
  700.     if (attr != 7) color = 1;
  701.  
  702.     /*  define windows  */
  703.  
  704.     c = 0; d = attr;
  705.  
  706.     if (color) d = 22;
  707.     c = set_window (0, 0, 0, 24, 79, d);       /*  whole screen  */
  708.     if (c) return (0);
  709.  
  710.     c = set_window (2, 1, 1, 19, 78, attr);    /*  data display area  */
  711.     if (c) return (0);
  712.  
  713.     if (color) d = 31;
  714.     c = set_window (3, 21, 1, 23, 78, d);   /*  dialog box  */
  715.     if (c) return (0);
  716.  
  717.     if (color) d = 14; else d = 120;
  718.     c = set_window (9, 3, 8, 19, 71, d);  /*  1 taller than files window */
  719.     if (c) return (0);
  720.  
  721.     if (color) d = 75; else d = attr;
  722.     c = set_window (4, 4, 8, 19, 71, d);  /*  files border */
  723.     if (c) return (0);
  724.  
  725.     c = set_window (5, 5, 9, 18, 70, d);  /*  files/fields window  */
  726.     if (c) return (0);
  727.  
  728.     if (color) d = 14; else d = 120;
  729.     c = set_window (8, 9, 8, 14, 71, d);  /*  1 taller than datafiles  */
  730.     if (c) return (0);
  731.  
  732.     if (color) d = 44; else d = attr;
  733.     c = set_window (6, 10, 8, 14, 71, d);   /*  datafiles border  */
  734.     if (c) return (0);
  735.  
  736.     if (color) d = 46;
  737.     c = set_window (7, 11, 9, 13, 70, d);   /*  datafiles window  */
  738.     if (c) return (0);
  739.  
  740.     /*  re-vector int 24h - establish hardware error handler  */
  741.  
  742.     _harderr (hard_err);
  743.  
  744.     /* ready buffers */
  745.  
  746.     for (d = 0; d < 8; d++) fi [d].buff = NULL;
  747.  
  748.     /*  ready field definition pointers  */
  749.  
  750.     for (d = 0; d < 8; d++)
  751.         for (i = 0; i < 200; i++) fi [d].key [i] = NULL;
  752.  
  753.     /*  begin program  */
  754.  
  755.     no_cursor (); clw (0);
  756.  
  757.     draw_border (); clw (2); clw (3);
  758.  
  759. /*    strcpy (pth_str, "b:");  */
  760.  
  761.     strcpy (gp_str [10], pth_str);
  762.  
  763.     c = select_datafile();
  764.     if (c) {cls (); return (0);}
  765.  
  766.     strcpy (gp_str [1], gp_str [10]);
  767.     strcat (gp_str [1], "\\");
  768.     get_farst (gp_str [11], files [0] [nrml_val].name);
  769.     strcat (gp_str [1], gp_str [11]);
  770.     rtrim (gp_str [1]);
  771.  
  772.     strcpy (c_s [0], "LOADING DATAFILE IN: ");
  773.     strcpy (c_s [1], gp_str [1]);
  774.     c = cntrstrp ();
  775.     clw (3); locate (22, c); prnt (c_s [2]);
  776.  
  777.     c = open_file (0); clw (2);
  778.  
  779.     if (!c)
  780.         {
  781.         c = browse_MAGE_files (0, 0, gp_str [10]);
  782.  
  783.         close_file (0);
  784.         }
  785.  
  786.     for (d = 1; d < 10; d++) free (w_a [d].save);
  787.  
  788.     attr = 7; cls (); nrml_cursor (); locate (12, 0);
  789.     }
  790.