home *** CD-ROM | disk | FTP | other *** search
/ PC Press 1997 July / Sezamfile97_1.iso / msdos / clipper / nettos11.a01 / SYNCHRO / LOCKMODE.PRG < prev    next >
Text File  |  1993-02-23  |  4KB  |  150 lines

  1. /*
  2.  * File......: LOCKMODE.PRG
  3.  * Author....: Glenn Scott
  4.  * CIS ID....: 71620,1521
  5.  * Date......: $Date$
  6.  * Revision..: $Revision$
  7.  * Log file..: $Logfile$
  8.  * 
  9.  * This is an original work by Glenn Scott and is placed in the
  10.  * public domain.
  11.  *
  12.  * Modification history:
  13.  * ---------------------
  14.  *
  15.  * $Log$
  16.  *
  17.  */
  18.  
  19. #include "netto.ch"
  20. #include "ftint86.ch"
  21.  
  22. #define GET_LOCKMODE         2
  23.  
  24. /*  $DOC$
  25.  *  $FUNCNAME$
  26.  *     fn_getLMod()
  27.  *  $CATEGORY$
  28.  *     Synchronization
  29.  *  $ONELINER$
  30.  *     Get lock mode
  31.  *  $SYNTAX$
  32.  *     
  33.  *     fn_getLMod() -> nLockMode
  34.  *
  35.  *  $ARGUMENTS$
  36.  *
  37.  *     None
  38.  *
  39.  *  $RETURNS$
  40.  *
  41.  *     <nLockMode>, a numeric, as follows:
  42.  *
  43.  *         0  =  NetWare 4.0-style "compatibility mode"
  44.  *         1  =  NetWare 4.6 and later "extended lock mode"
  45.  *
  46.  *  $DESCRIPTION$
  47.  *
  48.  *     Lock modes in NetWare are an outgrowth of some changes in 
  49.  *     NetWare locking behavior which happened in an early revision
  50.  *     of NetWare.  At the time, lock mode 0 was provided for 
  51.  *     compatibility.
  52.  *
  53.  *     Lock modes affect the behavior of the "log physical" and 
  54.  *     "lock physical" calls, as well as the logical file locking
  55.  *     calls. 
  56.  *
  57.  *     All programs today should be written to the extended lock
  58.  *     mode (mode 1), which is _not_ the default. Therefore, you
  59.  *     should consider setting lock mode to 1 before using the 
  60.  *     physical log and lock calls.
  61.  *
  62.  *     (Note: it is possible the physical log and lock calls are
  63.  *     not available in this release.  If so, never mind)
  64.  *     
  65.  *  $EXAMPLES$
  66.  *
  67.  *  $SEEALSO$
  68.  *     FN_SETLMOD()
  69.  *  $INCLUDE$
  70.  *
  71.  *  $END$
  72.  */
  73.  
  74.  
  75.  
  76. function fn_getLMod()
  77.   return  _fnLockMod( GET_LOCKMODE )
  78.  
  79.  
  80.  
  81. /*  $DOC$
  82.  *  $FUNCNAME$
  83.  *     fn_setLMod()
  84.  *  $CATEGORY$
  85.  *     Synchronization
  86.  *  $ONELINER$
  87.  *     Set lock mode
  88.  *  $SYNTAX$
  89.  *
  90.  *      fn_setLMod( <nLockMode> ) -> nCurMode
  91.  *
  92.  *  $ARGUMENTS$
  93.  *
  94.  *     <nLockMode>, a numeric, as follows:
  95.  *
  96.  *         0  =  NetWare 4.0-style "compatibility mode"
  97.  *         1  =  NetWare 4.6 and later "extended lock mode"
  98.  *         2  =  Just return the current lock mode
  99.  *               ( you can use fn_getLMod() instead )
  100.  *
  101.  *  $RETURNS$
  102.  *
  103.  *     <nCurMode>, a numeric, indicating the current lock mode.
  104.  *
  105.  *  $DESCRIPTION$
  106.  *
  107.  *     Lock modes in NetWare are an outgrowth of some changes in 
  108.  *     NetWare locking behavior which happened in an early revision
  109.  *     of NetWare.  At the time, lock mode 0 was provided for 
  110.  *     compatibility.
  111.  *
  112.  *     Lock modes affect the behavior of the "log physical" and 
  113.  *     "lock physical" calls, as well as the logical file locking
  114.  *     calls. 
  115.  *
  116.  *     All programs today should be written to the extended lock
  117.  *     mode (mode 1), which is _not_ the default. Therefore, you
  118.  *     should consider setting lock mode to 1 before using the 
  119.  *     physical log and lock calls.
  120.  *
  121.  *     (Note: it is possible the physical log and lock calls are
  122.  *     not available in this release.  If so, never mind)
  123.  *
  124.  *  $EXAMPLES$
  125.  *
  126.  *  $SEEALSO$
  127.  *     FN_GETLMOD()
  128.  *  $INCLUDE$
  129.  *
  130.  *  $END$
  131.  */
  132.  
  133.  
  134. function fn_setLMod( nMode )
  135.   return  _fnLockMod( nMode )
  136.  
  137.  
  138. static function _fnLockMod( nMode )
  139.   local aRegs[ INT86_MAX_REGS ]
  140.  
  141.   default nMode to GET_LOCKMODE
  142.  
  143.   aRegs[AX] := makehi( 198 )             // C6h
  144.   aRegs[AX] += nMode
  145.  
  146.   _fnSetErr( iif( ft_int86( INT21, aRegs ), ESUCCESS, EINT86 ) )
  147.  
  148.   return  UNSIGNED( lowbyte( aRegs[AX] ) )
  149.  
  150.