{***********************************************************************}
{									}
{ __CFlagUtl  Return the InDOS (critical section) flag pointer		}
{									}
{ function  __CFlagUtl : _BytePtr;				       }
{									}
{ Description DOS is not a reentrant operating system, which among	}
{	      other implications, means that it cannot be safely	}
{	      interrupted and invoked (i.e., it cannot always call	}
{	      itself). DOS, however, maintains a flag which DOS uses to }
{	      indicate that it cannot be safely interrupted, that is,	}
{	      it is in a critical section.  When the flag is zero, DOS	}
{	      can be safely interrupted and called, but when the flag	}
{	      is nonzero, DOS is in an unstable state and may not be	}
{	      safely invoked.						}
{									}
{	      __CFlagUtl returns a pointer to the DOS critical section	}
{	      flag.  Notice that __CFlagUtl does not return the value	}
{	      of the flag, but simply the pointer.  __CFlagUtl also	}
{	      initializes the global variable _CFlagPtr exported in the }
{	      interface.  The value can be used (just the returned	}
{	      function value) to inspect the state of the flag.  In	}
{	      particularly, DOS is busy if  _CFlagPtr^ <> 0.		}
{									}
{ Version     4.00 (C)Copyright Blaise Computing Inc. 1987		}
{_______________________________________________________________________}

function __CFlagUtl : _BytePtr;

  var
    Reg : registers;

  begin {__CFlagUtl}

    with Reg do 		       { Call DOS function $34		}
      begin			       { DOS returns the flag pointer	}
	AH := $34;		       { in the register pair ES:BX	}
	Intr(_DOS,Reg);
	_CFlagPtr  := Ptr(ES,BX);
	__CFlagUtl := _CFlagPtr
      end

  end;	{__CFlagUtl}
