P4W two and three dimensional arrays
====================================

I wrote the attached simple DLLs when I found myself with a requirement for multi-dimensional 
arrays within OPAL. The functions that are available were determined by my particular needs 
and a desire to make the code legible (i.e. the increment functions will operate as decrement 
functions if passed a negative increment and vice versa)

DLLs are available for SMALLINT, LONGINT and NUMBER variables. Rather than create one large DLL 
I have set up one for each variable type. Subsequently when I required additional arrays I 
created clones of the DLLs (i.e P4WARRS2.DLL, P4WARRL2 and P4WARRD2).

DLL Naming conventions
----------------------

       P4WARR<variable-type><instance-number>.DLL

       <variable-type> S = SMALLINT (C int)
                       L = LONGINT  (C long)
                       D = NUMBER   (C double)

       <instance-number> 1,2,3

       e.g. if you wish to declare two SMALLINT arrays you would be using P4WARRS1.DLL and
            P4WARRS2.DLL and would require a USES section for each one.

Return Values
-------------

All routines (other than the one that returns the value of individual array elements) return
a SMALLINT value of 0 = Failed
                    1 = Success

Source Code
-----------

The code is very simple and if anyone desires a copy send me an eMail.

Example OPAL USES section
-------------------------

;
;  DLL to handle two or three dimensional array for 16-bit integers (SMALLINT)
;  ---------------------------------------------------------------------------
;
uses P4WARRS1 ; definitions for array holding SMALLINT values
  ;-----------------------------------------------------------------------------------------
  ; 
  ; Initialize the array to have dimensions [dX, dY, dZ]. This routine MUST be
  ; called before accessing the array.
  ;
  s1Init(dX CWORD, dY CWORD, dZ CWORD) CWORD
  ;-----------------------------------------------------------------------------------------

  ;-----------------------------------------------------------------------------------------
  ;
  ; Set the value of an individual element at [dX, dY, dZ] to s1Value
  ;
  s1Set(dX CWORD, dY CWORD, dZ CWORD, S1Value CWORD) CWORD
  ;-----------------------------------------------------------------------------------------

  ;-----------------------------------------------------------------------------------------
  ;
  ; Set a range of values to s1Value. The update commences at [dX, dY, dZ] and depending
  ; upon the value of sVec ("X", "Y", "Z") steps thru' the array until dTo is reached.
  ;
  s1SetRng(dX CWORD, dY CWORD, dZ CWORD, S1Value CWORD, sVec CPTR, dTo CWORD) CWORD
  ;-----------------------------------------------------------------------------------------

  ;-----------------------------------------------------------------------------------------
  ;
  ; Increment the value of an individual element at [dX, dY, dZ] by s1Value
  ;
  s1Inc(dX CWORD, dY CWORD, dZ CWORD, S1Value CWORD) CWORD
  ;-----------------------------------------------------------------------------------------

  ;-----------------------------------------------------------------------------------------
  ;
  ; Increment a range of values (see s1SetRng for syntax)
  ;
  s1IncRng(dX CWORD, dY CWORD, dZ CWORD, S1Value CWORD, sVec CPTR, dTo CWORD) CWORD
  ;-----------------------------------------------------------------------------------------

  ;-----------------------------------------------------------------------------------------
  ;
  ; Decrement the value of an individual element at [dX, dY, dZ] by s1Value
  ;
  s1Dec(dX CWORD, dY CWORD, dZ CWORD, S1Value CWORD) CWORD
  ;-----------------------------------------------------------------------------------------

  ;-----------------------------------------------------------------------------------------
  ;
  ; Decrement a range of values (see s1SetRng) by s1Value
  ;
  s1DecRng(dX CWORD, dY CWORD, dZ CWORD, S1Value CWORD, sVec CPTR, dTo CWORD) CWORD
  ;-----------------------------------------------------------------------------------------

  ;-----------------------------------------------------------------------------------------
  ;
  ; Get the value of an individual element at [dX, dY, dZ]
  ;
  s1Get(dX CWORD, dY CWORD, dZ CWORD) CWORD
endUses
uses P4WARRS2
  s2Init(dX CWORD, dY CWORD, dZ CWORD) CWORD
  s2Set(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE) CWORD
  s2SetRng(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE, sVec CPTR, dTo CWORD) CWORD
  s2Inc(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE) CWORD
  s2IncRng(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE, sVec CPTR, dTo CWORD) CWORD
  s2Dec(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE) CWORD
  s2DecRng(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE, sVec CPTR, dTo CWORD) CWORD
  s2Get(dX CWORD, dY CWORD, dZ CWORD) CDOUBLE
endUses
uses P4WARRS3
  s3Init(dX CWORD, dY CWORD, dZ CWORD) CWORD
  s3Set(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE) CWORD
  s3SetRng(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE, sVec CPTR, dTo CWORD) CWORD
  s3Inc(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE) CWORD
  s3IncRng(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE, sVec CPTR, dTo CWORD) CWORD
  s3Dec(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE) CWORD
  s3DecRng(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE, sVec CPTR, dTo CWORD) CWORD
  s3Get(dX CWORD, dY CWORD, dZ CWORD) CDOUBLE
endUses

;
;  DLL to handle two or three dimensional array for 32-bit integers (LONGINT)
;  --------------------------------------------------------------------------
;
; see USES P4WARRS1 for syntax
;
uses P4WARRL1
  l1Init(dX CWORD, dY CWORD, dZ CWORD) CWORD
  l1Set(dX CWORD, dY CWORD, dZ CWORD, l1Value CLONG) CWORD
  l1SetRng(dX CWORD, dY CWORD, dZ CWORD, l1Value CLONG, sVec CPTR, dTo CWORD) CWORD
  l1Inc(dX CWORD, dY CWORD, dZ CWORD, l1Value CLONG) CWORD
  l1IncRng(dX CWORD, dY CWORD, dZ CWORD, l1Value CLONG, sVec CPTR, dTo CWORD) CWORD
  l1Dec(dX CWORD, dY CWORD, dZ CWORD, l1Value CLONG) CWORD
  l1DecRng(dX CWORD, dY CWORD, dZ CWORD, l1Value CLONG, sVec CPTR, dTo CWORD) CWORD
  l1Get(dX CWORD, dY CWORD, dZ CWORD) CLONG
endUses
uses P4WARRL2
  l2Init(dX CWORD, dY CWORD, dZ CWORD) CWORD
  l2Set(dX CWORD, dY CWORD, dZ CWORD, l1Value CLONG) CWORD
  l2SetRng(dX CWORD, dY CWORD, dZ CWORD, l1Value CLONG, sVec CPTR, dTo CWORD) CWORD
  l2Inc(dX CWORD, dY CWORD, dZ CWORD, l1Value CLONG) CWORD
  l2IncRng(dX CWORD, dY CWORD, dZ CWORD, l1Value CLONG, sVec CPTR, dTo CWORD) CWORD
  l2Dec(dX CWORD, dY CWORD, dZ CWORD, l1Value CLONG) CWORD
  l2DecRng(dX CWORD, dY CWORD, dZ CWORD, l1Value CLONG, sVec CPTR, dTo CWORD) CWORD
  l2Get(dX CWORD, dY CWORD, dZ CWORD) CLONG
endUses
uses P4WARRL3
  l3Init(dX CWORD, dY CWORD, dZ CWORD) CWORD
  l3Set(dX CWORD, dY CWORD, dZ CWORD, l1Value CLONG) CWORD
  l3SetRng(dX CWORD, dY CWORD, dZ CWORD, l1Value CLONG, sVec CPTR, dTo CWORD) CWORD
  l3Inc(dX CWORD, dY CWORD, dZ CWORD, l1Value CLONG) CWORD
  l3IncRng(dX CWORD, dY CWORD, dZ CWORD, l1Value CLONG, sVec CPTR, dTo CWORD) CWORD
  l3Dec(dX CWORD, dY CWORD, dZ CWORD, l1Value CLONG) CWORD
  l3DecRng(dX CWORD, dY CWORD, dZ CWORD, l1Value CLONG, sVec CPTR, dTo CWORD) CWORD
  l3Get(dX CWORD, dY CWORD, dZ CWORD) CLONG
endUses
;
;  DLL to handle two or three dimensional array for 64-bit floating-point (NUMBER)
;  -------------------------------------------------------------------------------
;
; see USES P4WARRS1 for syntax
;
uses P4WARRD1
  d1Init(dX CWORD, dY CWORD, dZ CWORD) CWORD
  d1Set(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE) CWORD
  d1SetRng(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE, sVec CPTR, dTo CWORD) CWORD
  d1Inc(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE) CWORD
  d1IncRng(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE, sVec CPTR, dTo CWORD) CWORD
  d1Dec(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE) CWORD
  d1DecRng(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE, sVec CPTR, dTo CWORD) CWORD
  d1Get(dX CWORD, dY CWORD, dZ CWORD) CDOUBLE
endUses
uses P4WARRD2
  d2Init(dX CWORD, dY CWORD, dZ CWORD) CWORD
  d2Set(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE) CWORD
  d2SetRng(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE, sVec CPTR, dTo CWORD) CWORD
  d2Inc(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE) CWORD
  d2IncRng(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE, sVec CPTR, dTo CWORD) CWORD
  d2Dec(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE) CWORD
  d2DecRng(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE, sVec CPTR, dTo CWORD) CWORD
  d2Get(dX CWORD, dY CWORD, dZ CWORD) CDOUBLE
endUses
uses P4WARRD3
  d3Init(dX CWORD, dY CWORD, dZ CWORD) CWORD
  d3Set(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE) CWORD
  d3SetRng(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE, sVec CPTR, dTo CWORD) CWORD
  d3Inc(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE) CWORD
  d3IncRng(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE, sVec CPTR, dTo CWORD) CWORD
  d3Dec(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE) CWORD
  d3DecRng(dX CWORD, dY CWORD, dZ CWORD, d1Value CDOUBLE, sVec CPTR, dTo CWORD) CWORD
  d3Get(dX CWORD, dY CWORD, dZ CWORD) CDOUBLE
endUses

