home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / zfamily.zip / zfamily / ZISFUNCS / SAMPLE / TSTCHECK.INC < prev    next >
Text File  |  1993-09-01  |  4KB  |  145 lines

  1. /*
  2. ** /----------------------------------------------------------------------\
  3. ** |             IBM Z Family Reusable Libraries/2 (5641-504)             |
  4. ** |----------------------------------------------------------------------|
  5. ** | (C) Copyright International Business Machines Corporation 1993, 1994 |
  6. ** |----------------------------------------------------------------------|
  7. ** |                       DISCLAIMER OF WARRANTIES                       |
  8. ** |                       ------------------------                       |
  9. ** | The following code is sample code created by IBM Corporation.        |
  10. ** | Such a code is provided to you solely for the purpose of assisting   |
  11. ** | you in the development of your applications. The code is provided    |
  12. ** | "AS IS", without warranty of any kind.  IBM shall not be liable for  |
  13. ** | any damages arising out of your use of the following code, even if   |
  14. ** | they have been advised of the possibility of such damages.           |                                                                         *
  15. ** \----------------------------------------------------------------------/
  16. **
  17. **  Header  : TSTCHECK.INC
  18. **  Authors : Alessandro Cavallini (CAVALLI at ROMEPPC)
  19. **            Pino Venturella (VENTUREL at ROMEPPC)
  20. **  Reviewer: Dario de Judicibus (DEJUDICI at ROMEPPC)
  21. **  Created : 06 Jul 1992
  22. **  Updated : 31 Aug 1993
  23. **  Version : 3.12
  24. **  Content : Called by TSTFUNMsgProc in WM_COMMAND and TSTFUNCHKBUT case
  25. **            statement. Call the appropriate zis* functions
  26. **
  27. */
  28. {
  29.   char   szWorkBuf[33] ;
  30.   BOOL   Res = FALSE   ,
  31.          Err = FALSE   ;
  32.  
  33.   GLBL   gbl      ;     // Global data
  34.   FIELD  type     ,     // Type field
  35.          notation ;     // Notation field
  36.   USHORT funcID   ;     // Selected function ID
  37.  
  38.  /*
  39.  ** Get the address of the variable connected to the Dialog
  40.  */
  41.   Tstfun = (TSTFUNStruct *)WinQueryWindowULong(hWndClient, OFFSET_TSTFUN) ;
  42.  
  43.  /*
  44.  ** Get the selected type
  45.  */
  46.   WinQueryDlgItemText(hWndDlg, TSTFUNTYPDDL, sizeof(szWorkBuf), szWorkBuf) ;
  47.   strcpy(Tstfun->TstFunType, szWorkBuf) ;
  48.  
  49.  /*
  50.  ** Get the selected notation
  51.  */
  52.   WinQueryDlgItemText(hWndDlg, TSTFUNNOTDDL, sizeof(szWorkBuf), szWorkBuf) ;
  53.   strcpy(Tstfun->TstFunNotation, szWorkBuf) ;
  54.  
  55.  /*
  56.  ** Get the function ID
  57.  */
  58.   gbl.data = &hAB  ;
  59.   type.dim = 32  ;
  60.   type.psz = (PSZ)Tstfun->TstFunType ;
  61.  
  62.   notation.dim = 32 ;
  63.   notation.psz = (PSZ)Tstfun->TstFunNotation ;
  64.  
  65.   funcID = tstGetFunctionID(&gbl, &type, ¬ation) ;
  66.  
  67.  /*
  68.  ** Get the input field
  69.  */
  70.   WinQueryDlgItemText(hWndDlg, TSTFUNINPFLD, sizeof(szWorkBuf), szWorkBuf) ;
  71.   strcpy(Tstfun->TstFunInput, szWorkBuf) ;
  72.  
  73.  /*
  74.  ** Call the appropriate function
  75.  */
  76.   switch (funcID)
  77.   {
  78.     case TST_FLAT_NAT :
  79.        Res = zisNatString (Tstfun->TstFunInput) ;
  80.        break ;
  81.  
  82.     case TST_THS_NAT :
  83.        Res = zisThsNatString (Tstfun->TstFunInput) ;
  84.        break ;
  85.  
  86.     case TST_ANY_NAT :
  87.        Res = zisAnyNatString (Tstfun->TstFunInput) ;
  88.        break ;
  89.  
  90.     case TST_FLAT_INT :
  91.        Res = zisIntString (Tstfun->TstFunInput) ;
  92.        break ;
  93.  
  94.     case TST_THS_INT :
  95.        Res = zisThsIntString (Tstfun->TstFunInput) ;
  96.        break ;
  97.  
  98.     case TST_ANY_INT :
  99.        Res = zisAnyIntString (Tstfun->TstFunInput) ;
  100.        break ;
  101.  
  102.     case TST_FLAT_REAL :
  103.        Res = zisRealString (Tstfun->TstFunInput) ;
  104.        break ;
  105.  
  106.     case TST_THS_REAL :
  107.        Res = zisThsRealString (Tstfun->TstFunInput) ;
  108.        break ;
  109.  
  110.     case TST_SCI_REAL :
  111.        Res = zisSciRealString (Tstfun->TstFunInput) ;
  112.        break ;
  113.  
  114.     case TST_EXP_REAL :
  115.        Res = zisExpRealString (Tstfun->TstFunInput) ;
  116.        break ;
  117.  
  118.     case TST_ANY_REAL :
  119.        Res = zisAnyRealString (Tstfun->TstFunInput) ;
  120.        break ;
  121.  
  122.     default:
  123.        Err = TRUE ;
  124.        WinAlarm(HWND_DESKTOP, WA_ERROR) ;
  125.        break ;
  126.   }
  127.  
  128.   if (!Err)
  129.   {
  130.     if (Res)
  131.     {
  132.       WinAlarm(HWND_DESKTOP, WA_NOTE) ;
  133.       cwCheckDlgItem(hWndDlg, TSTFUNTRURDB, TRUE) ;
  134.       cwCheckDlgItem(hWndDlg, TSTFUNFALRDB, FALSE) ;
  135.     }
  136.     else
  137.     {
  138.       WinAlarm(HWND_DESKTOP, WA_WARNING) ;
  139.       cwCheckDlgItem(hWndDlg, TSTFUNFALRDB, TRUE) ;
  140.       cwCheckDlgItem(hWndDlg, TSTFUNTRURDB, FALSE) ;
  141.     }
  142.   }
  143. }
  144.  
  145.