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

  1. /* ==( bench/rngint.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_int(width, hlp, lo, hi, mask, ich)
  48. int width, hlp;
  49. int *lo, *hi, *ich;
  50. char *mask;
  51. {
  52.     char tmp[256];
  53.  
  54.    create_w(11, 30, 5, width+10);
  55.    border_w(boxset, BOLD);
  56.  
  57.    disp_w(2, 2, NORMAL, "FROM :");
  58.    disp_w(4, 2, NORMAL, "  TO :");
  59.  
  60.     f_low.fmask = f_hi.fmask = mask;
  61.     f_low.fbuff = f_hi.fbuff = tmp;
  62.     f_low.fhelp = f_hi.fhelp = hlp;
  63.     f_low.fieldlen = f_hi.fieldlen = width;
  64.    i_to_a(f_low.fbuff, *lo, strlen(mask));
  65.     tmp[width] = '\0';
  66.  
  67.     *ich = 1;
  68.    if ( input_wx(&f_low, K_ESC, K_DOWN, 0) != K_ESC )
  69.    {
  70.       *lo = atoi(f_low.fbuff);
  71.        i_to_a(f_hi.fbuff, *hi, strlen(mask));
  72.        if( input_wx(&f_hi, K_ESC, K_DOWN, 0) != K_ESC )
  73.         {
  74.           *hi = atoi(f_hi.fbuff);
  75.             *ich = 0;
  76.         }
  77.    }
  78.    delete_w();
  79. }
  80.  
  81.