home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 1.ddi / FUNCS.EXE / CSCAPE / SOURCE / FNSTDVAL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-07  |  1.2 KB  |  58 lines

  1. /*
  2.     fnstdval.c      8/07/89
  3.  
  4.     % std_NumValid
  5.  
  6.     Standard numeric validation routine.
  7.  
  8.     C-scape 3.1
  9.     Copyright (c) 1989, by Oakland Group, Inc.
  10.     ALL RIGHTS RESERVED.
  11.  
  12.     By using these routines duplicate code is eliminated, shrinking code
  13.     size.
  14.  
  15.     Revision History:
  16.     -----------------
  17. */
  18.  
  19. #include <stdio.h>
  20.  
  21. #include "cscape.h"
  22.  
  23. boolean std_NumValid(sed, val)
  24.     sed_type sed;
  25.     double val;
  26. /*
  27.     Standard numeric validation routine for numeric field fexit functions.
  28.  
  29.     Validates the field record using the information in the
  30.     field's second data pointer.  If invalid it beeps, flashes
  31.     a message and waits for a keystroke.
  32.  
  33.     It also calls the field's sexit and senter functions to make sure
  34.     that what the user sees is exactly what is stored in the variable.
  35.  
  36.     Combining all the separate fexit routines saves on code size.
  37. */
  38. {
  39.     if ( !valid_Double(val, (char *) sed_GetCurrFieldData(sed, 1)) ) {
  40.         tone();
  41.         sed_BorderPrompt(sed, fnnum_errmsg);
  42.  
  43.         /* wait for a keystroke */
  44.         while (!kb_Check()) {
  45.             ;
  46.         }
  47.  
  48.         sed_BorderPrompt(sed, sed_GetCurrFieldData(sed, 0));
  49.         return(FALSE);
  50.     }
  51.  
  52.     sed_DoFieldSexit(sed, sed_GetFieldNo(sed));
  53.     sed_DoFieldSenter(sed, sed_GetFieldNo(sed));
  54.     sed_UpdateCurrField(sed);
  55.  
  56.     return(TRUE);
  57. }
  58.