Delphi Example Directory
    This directory contains the basic components of the WinRT 3.0
    implementation for Delphi.

Release Notes:
        11/20/1998 - Added Global and Extern support
	07/23/1998 - Updated for Delphi 4.0
		Changed Integer to Cardinal where needed

Please note that these samples were developed for Delphi 3.0
and WinRT 3.0.  Some adaptation may be required to use these
samples with newer versions of Delphi and WinRT.  Please
check the BlueWater Systems web site for any announcements
regarding new Delphi samples.

There are two ways you can use WinRT under Delphi. The
first one is low level, similar to what is described in
Chapter 10, WinRT Driver Reference in the WinRT users
manual. The file WinRTDriver.PAS is the unit that allows you
to interface to the device driver through calls to
DeviceIOControl.

The second one is much higher level. It allows you to
have functions closely equivalent to the WinRT preprocessor
within the Delphi environment. The learning curve for this
is a litle longer, but the results can justify it. If
you need higher speed and more processing this is
the way to go. To work at a higher level you need the file
WinRT.PAS, which by itself calls the lower level WinRTDriver
unit.

WinRT.PAS implements a Delphi class tWinRT. To use it you
instantiate a variable of this class with information that
allows it to open a WinRT driver and get a handle. The handle
is stored inside the object and you don't normally need it,
but you can get it by reading the property handle.

If the class fails the getlasterror function will be called
and an exception will be thrown.

After creating the class, you use its methods to create
an internal array that can perform code. The principle
involved is similar to the preprocessor, but it's actually
done by Delphi itself. Once you finished calling all methods
needed you do a final call to the method DeclEnd to finish
the pseudo-preprocessing.

You have plenty of tools to make your code do what
you want in a fast and easy way. You have _While/_Wend and
_IF/_THEN/_ELSE control statements. For shadow constants
and variables use DimK for the first and Dim/DimStr for the
later. DimK allows you to declare a constant number that
can be used by the code in math, logical and bitwise
operations. Dim allows to create a variable that
shadows a pascal variable. Shadowing means that the content
of the pascal variable is copied to the shadow before
running ProcessBuffer or Wait for interrupt and copied from
the shadow variable to the pascal side after the ring 0 code
executed. Dim is used for simple variables and arrays, including
arrays of chars (C type strings). For pascal strings use
DimStr, which takes care of the additional level of
dereferencing required by the new huge string type. Short
strings are not supported, so use huge strings instead.
WinRt does not support unlimited size, so even if huge
strings are supported you have to predefine the maximum
size of the shadow string. 

Once you got to this stage you can run this WinRt code one
or any number of times. See the example in the Delphi\Comm2
directory for how you can create the code once and then 
run it again for each character to send out. There are three
methods that do it. One is ProcessBuffer, which will execute
the code but does not deal with interrupts. The others are
WaitInterrupt and SetInterrupt, which are similar, but you must
follow WinRT guidelines to handle interrupts.  WaitInterrupt
blocks processing until an interrupt occurs, SetInterrupt sets
up the ISR and continues processing.
