home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / nfsrc21.zip / CNTRYSET.PRG < prev    next >
Text File  |  1991-08-16  |  2KB  |  71 lines

  1. /*
  2.  * File......: CntrySet.Prg
  3.  * Author....: David Husnian
  4.  * Date......: $Date:   15 Aug 1991 23:03:12  $
  5.  * Revision..: $Revision:   1.2  $
  6.  * Log file..: $Logfile:   E:/nanfor/src/cntryset.prv  $
  7.  * 
  8.  * This is an original work by David Husnian and is placed in the
  9.  * public domain.
  10.  *
  11.  * Modification history:
  12.  * ---------------------
  13.  *
  14.  * $Log:   E:/nanfor/src/cntryset.prv  $
  15.  * 
  16.  *    Rev 1.2   15 Aug 1991 23:03:12   GLENN
  17.  * Forest Belt proofread/edited/cleaned up doc
  18.  * 
  19.  *    Rev 1.1   14 Jun 1991 19:51:20   GLENN
  20.  * Minor edit to file header
  21.  * 
  22.  *    Rev 1.0   01 Apr 1991 01:00:58   GLENN
  23.  * Nanforum Toolkit
  24.  *
  25.  */
  26.  
  27.  
  28. /*  $DOC$
  29.  *  $FUNCNAME$
  30.  *     FT_SETCENTURY()
  31.  *  $CATEGORY$
  32.  *     Environment
  33.  *  $ONELINER$
  34.  *     Check/Set the CENTURY Setting
  35.  *  $SYNTAX$
  36.  *     FT_SETCENTURY( [ <lNewSetState> ] ) -> <lOldState>
  37.  *  $ARGUMENTS$
  38.  *     lNewSetState - Boolean to Set CENTURY
  39.  *                      .F. - Toggle CENTURY off
  40.  *                      .T. - Toggle CENTURY on
  41.  *                      If not specified, leave CENTURY as is
  42.  *  $RETURNS$
  43.  *     The state of the CENTURY setting upon entry to the routine
  44.  *  $DESCRIPTION$
  45.  *     This function returns the state (ON/OFF, TRUE/FALSE) of the CENTURY
  46.  *     and optionally sets it ON or OFF.
  47.  *  $EXAMPLES$
  48.  *     lOldState := FT_SETCENTURY()     // Get current CENTURY Setting
  49.  *     
  50.  *     lOldState := FT_SETCENTURY(.T.)  // Get the current CENTURY Setting
  51.  *                                      // and turn it on (set it to TRUE)
  52.  *     
  53.  *     lOldState := FT_SETCENTURY(.F.)  // Get the current CENTURY Setting
  54.  *                                      // and turn it off (set it to FALSE)
  55.  *  $END$
  56.  */
  57.  
  58.  
  59. #define IS_LOGICAL(x)                (VALTYPE(x) == "L")
  60.  
  61. FUNCTION FT_SETCENTURY(lNewSetState)
  62.                                         // Note that if CENTURY is ON then
  63.                                         // DTOC() Will Return a String of Length
  64.                                         // 10, Otherwise it Will be of Length 8
  65.    LOCAL lOldSetState := (LEN(DTOC(DATE())) == 10)
  66.  
  67.    IF (IS_LOGICAL(lNewSetState))        // Did They Want it Set??
  68.       SET CENTURY (lNewSetState)        // Yes, Set it
  69.    ENDIF                                // IS_LOGICAL(lNewSetState)
  70.    RETURN (lOldSetState)                // FT_SetCentury
  71.