home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 7 / POWERCD7.ISO / prgmming / clipper / break.c < prev    next >
C/C++ Source or Header  |  1993-10-14  |  3KB  |  104 lines

  1. /*
  2.  * File......: BREAK.C
  3.  * Author....: Dave Pearson
  4.  * BBS.......: The Dark Knight Returns
  5.  * Net/Node..: 050/069
  6.  * User Name.: Dave Pearson
  7.  * Date......: $Date$
  8.  * Revision..: $Revision$
  9.  * Log file..: $Logfile$
  10.  *
  11.  * This is an original work by Dave Pearson and is placed in the public
  12.  * domain.
  13.  *
  14.  * Modification history:
  15.  * ---------------------
  16.  *
  17.  * $Log$
  18.  *
  19.  */
  20.  
  21. // NOTE: This code has been written for and compiled with Borland C++
  22. //       Version 3.1
  23. //
  24.  
  25. #include <extend.h>
  26.  
  27. Boolean GetBreak(void);
  28. void    SetBreak(char);
  29.  
  30. /*  $DOC$
  31.  *  $FUNCNAME$
  32.  *      GT_BREAK()
  33.  *  $CATEGORY$
  34.  *      Environment
  35.  *  $ONELINER$
  36.  *      Set/Get the DOS break flag.
  37.  *  $SYNTAX$
  38.  *      GT_Break([<lNewSetting>]) --> lOldSetting
  39.  *  $ARGUMENTS$
  40.  *      <lNewSetting> is an optional logical parameter. If true (.T.)
  41.  *      the DOS break flag will be turned on, if false (.F.) it will be
  42.  *      turned off. If not passed GT_Break() just returns the current
  43.  *      setting.
  44.  *  $RETURNS$
  45.  *      The status of the break flag. If a new setting is passed then
  46.  *      the previous setting is returned. If a new setting is not
  47.  *      passed then the current setting is returned.
  48.  *  $DESCRIPTION$
  49.  *      GT_Break() can be used to set and get the status of the DOS break
  50.  *      flag.
  51.  *  $EXAMPLES$
  52.  *      // Set the DOS break flag on.
  53.  *
  54.  *      GT_Break(TRUE)
  55.  *
  56.  *      // Display the current DOS break flag setting.
  57.  *
  58.  *      ? GT_Break()
  59.  *  $SEEALSO$
  60.  *      GT_VERIFY()
  61.  *  $END$
  62.  */
  63.  
  64. CLIPPER GT_Break()
  65. {
  66.         Boolean OldSetting = GetBreak();
  67.  
  68.         if (PCOUNT == 1 && ISLOG(1))
  69.         {
  70.                 SetBreak((char) _parl(1));
  71.         }
  72.         _retl(OldSetting);
  73. }
  74.  
  75. /*****************************************************************************
  76. * Function: GetBreak()                                                       *
  77. * Syntax..: Boolean GetBreak(void)                                           *
  78. * Usage...: Internal function to get the break flag.                         *
  79. * By......: David A Pearson                                                  *
  80. *****************************************************************************/
  81.  
  82. static Boolean GetBreak(void)
  83. {
  84.         asm     Mov     AH,0x33
  85.         asm     Mov     AL,0
  86.         asm     Int     0x21
  87.         return(_DL);
  88. }
  89.  
  90. /*****************************************************************************
  91. * Function: SetBreak()                                                       *
  92. * Syntax..: void SetBreak(void)                                              *
  93. * Usage...: Internal function to set the break flag.                         *
  94. * By......: David A Pearson                                                  *
  95. *****************************************************************************/
  96.  
  97. static void SetBreak(char NewSetting)
  98. {
  99.         asm     Mov     AH,0x33
  100.         asm     Mov     AL,1
  101.         asm     Mov     DL,NewSetting
  102.         asm     Int     0x21
  103. }
  104.