home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 125.img / PRO-C4.ZIP / BENCH1.ZIP / BENCH / RNGFLT.C < prev    next >
C/C++ Source or Header  |  1990-05-28  |  2KB  |  82 lines

  1. /* ==( bench/rngflt.c )== */
  2.  
  3. /* ----------------------------------------------- */
  4. /* Pro-C  Copyright (C) 1988 - 1990 Vestronix Inc. */
  5. /* Modification to this source is not supported    */
  6. /* by Vestronix Inc.                               */
  7. /*            All Rights Reserved                  */
  8. /* ----------------------------------------------- */
  9. /* Written   Nig   1-Jan-87                        */
  10. /* Modified  Geo  11-Dec-89  See comments below    */
  11. /* ----------------------------------------------- */
  12. /* %W%  (%H% %T%) */
  13.  
  14. /*
  15.  *  Modifications
  16.  *
  17.  *  11-Dec-89  Geo - V2 version
  18.  *  25-Oct-89  Geo - 1.32 Merge
  19. */
  20.  
  21. /*
  22.  *     This routine will get the hi and lo values for range checks in
  23.  * a generated program
  24. */
  25. # include <stdio.h>
  26. # include <bench.h>
  27. # include <field.h>
  28.  
  29. static char low_mask[] = "z9";
  30.  
  31. static FIELD f_low = 
  32. {
  33.    2, 9, 1, NULL, low_mask,
  34.    0, 2, F_NUMERIC, REVVID, REVVID, CONFIRM_NEEDED | NO_BLANK,
  35.    NULL, text_input, NULL, NULL
  36. };
  37.  
  38. static char hi_mask[] = "z9";
  39.  
  40. static FIELD f_hi = 
  41. {
  42.    4, 9, 1, NULL, hi_mask,
  43.    0, 2, F_NUMERIC, REVVID, REVVID, CONFIRM_NEEDED | NO_BLANK,
  44.    NULL, text_input, NULL, NULL
  45. };
  46.  
  47. void range_flt(width, hlp, lo, hi, mask, ich)
  48. int width, hlp;
  49. float *lo, *hi;
  50. int *ich;
  51. char *mask;
  52. {
  53.     char tmp[256];
  54.  
  55.    create_w(11, 30, 5, width+10);
  56.    border_w(boxset, BOLD);
  57.  
  58.    disp_w(2, 2, NORMAL, "FROM :");
  59.    disp_w(4, 2, NORMAL, "  TO :");
  60.  
  61.     f_low.fmask = f_hi.fmask = mask;
  62.     f_low.fbuff = f_hi.fbuff = tmp;
  63.     f_low.fhelp = f_hi.fhelp = hlp;
  64.     f_low.fieldlen = f_hi.fieldlen = width;
  65.     tmp[width] = '\0';
  66.    f_to_a(f_low.fbuff, (double)*lo, strlen(mask));
  67.  
  68.     *ich = 1;
  69.    if ( input_wx(&f_low, K_ESC, K_DOWN, 0) != K_ESC )
  70.    {
  71.       *lo = (float) atof(f_low.fbuff);
  72.        f_to_a(f_hi.fbuff, (double)*hi, strlen(mask));
  73.        if( input_wx(&f_hi, K_ESC, K_DOWN, 0) != K_ESC )
  74.         {
  75.           *hi = (float) atof(f_hi.fbuff);
  76.             *ich = 0;
  77.         }
  78.    }
  79.    delete_w();
  80. }
  81.  
  82.