     NOLIST
Lock        MACRO              ; 14 Jan 88
*------------------------------; Start of Lock macro.
     NOLIST
     IFC '\4','read'
     LIST
                               ; Make D2 indicate the read accessMode.
     MOVE.L #-2,D2
     NOLIST
     ENDC
     IFC '\4','write'
     LIST
                               ; Make D2 indicate the write accessMode.
     MOVE.L #-1,D2
     NOLIST
     ENDC
     IFC '\1','I'              ; If <PointerToFileName> is specified, then
     LIST
                               ; Put <PointerToFileName> in D1.
     MOVE.L #\2,D1
     NOLIST
     ENDC
     IFC '\1','D'              ; If <filename> is specified, then
     LIST
                               ; Make D1 point to <filename>.str .
     MOVE.L #\2.str,D1
     NOLIST
     IFND \2.str               ; Unless it was previously defined,
     LIST
     SECTION DataSection,DATA  ; The ASCII <filename> string goes here.
\2.str:
     DC.B '\2',0
     CNOP 0,2
     SECTION   "",CODE
     NOLIST
     ENDC
     ENDC
     LIST
     CallLib Lock,dos          ; Call Lock to get a lock on <filename>.
                               ; Put the lock at <LockName>.
     MOVE.L D0,\3
     SECTION   BSS_Section,BSS
     CNOP 0,2
\3:
     DS.L 1                    ; This is the location of <LockName>.
     SECTION   "",CODE
     TST.L D0                  ; Make the zero flag indicate failure.
*------------------------------; End of Lock macro.
     ENDM
     LIST
