(*************************************************) Function ListIndex (ArgNumber :ArgPosition ;DescriptorPtr :DescriptorPtrType ;Index1,Index2,Index3 : Integer ): Natural; (* This function finds the position in the Linked List of the element specified by the subsripts Index1,Index2,Index3 How many of theses are used is found from the descriptor DIM field *) Var i : integer; RowSize : integer; ColSize : integer; Begin Case DescriptorPtr^Dim of 1: ListIndex := Index1; 2: Begin RowSize:= DescriptorPtr^UB[1]-DescriptorPtr^LB[1]+1; ListIndex:= ((index1-1)*rowSize)+index2 End; 3: Begin RowSize:= DescriptorPtr^UB[1]-DescriptorPtr^LB[1]+1; ColSize:= DescriptorPtr^UB[2]-DescriptorPtr^LB[2]+1; ListIndex := ( (Index1-1)*rowSize +(Index2-1)*ColSize +Index3 End End End; (********************************************************) Procedure GetArrayElement (DescriptorPtr :DescriptorPtrType ;Index : Natural ); Var i : integer; Ptr: DataPtrType; Begin Ptr := DescriptorPtr^First; FOR i:=1 to (index-1) do Ptr := ptr^next; Case DescriptorPtr^AtomicId of CharId : GlobalChar := ptr^f1; IntegerId: GlobalInteger := ptr^f2; RealId : GlobalReal := ptr^f3; BooleanId: GlobalBoolean := ptr^f4 End End; (*******************************************************) Procedure InitDescriptor; Var i : integer; Begin New(GlobalArgList.Descriptors[GlobalArgNumber]); With GlobalArgList.descriptors[GlobalArgNumber]^ do Begin AtomicId := GlobalAtomicId; StructurId := GlobalStructurId; Dim := GlobalDim; FOR i := 1 to GlobalDim do Begin UB[i]:= GlobalUpperRang[i]; LB[i]:= GlobalLowerRang[i] End; New(first); Last := first; Last^next := NIL End End; (*****************************************************) Procedure LoadDescriptor; Begin With GlobalArgList.Descriptors[GlobalArgNumber]^ do Begin Case GlobalAtomicId of CharId : Last^.f1 := GlobalChar; IntegerId : Last^.f2 := GlobalInteger; RealId : Last^.f3 := GlobalReal; BooleanId : Last^.f4 := GlobalBoolean End End; New(Last^next); Last := Last^next; Last^Next := NIL End; (***************************************************) Procedure InitGlobals; Var i:integer; Begin GlobalInteger := 0; GlobalReal := 0.0; GlobalChar := GlobalBoolean := False; For i:= 1 to MaxDim do Begin GlobalUpperRang[i] := 1; GlobalLowerRang[i] := 1 End End; (**************************************************) Procedure UnloadDescriptor; Begin With GlobalArgList.Descriptors[GlobalArgNumber]^ do Begin Case AtomicId of CharId : GlobalChar := Last^.f1; IntegerId: GlobalInteger := Last^.f2; RealId : GlobalReal := Last^.f3; BooleanId: GlobalBoolean := Last^.f4 End End; Last := Last^next End; (******************************************************) Function NumberOfCells : Integer; Var i: integer; Begin NumberOfCells := ((GlobalUpperRang[1]-GlobalLowerRang[1])+1) *((GlobalUpperRang[2]-GlobalLowerRang[2])+1) *((GlobalUpperRang[3]-GlobalLowerRang[3])+1) End; (***********************************************************) Function ReferenceCodeGenerator( ArgPosition : Integer) : StringType1; Var str : stringtype1; Type_str : string[2]; begin With GlobalArgList.Descriptors[argposition]^ do Begin Case AtomicId of Case AtomicId of Case AtomicId of Case AtomicId of Case AtomicId of Case AtomicId of Case AtomicId of Case AtomicId of Case AtomicId of Case AtomicId of Case AtomicId of End; (***********************************************************) Procedure DisposeDescriptor; Var i : integer; Ptr: DataPtrType; Begin For i:= 1 to GlobalArgNumber do Begin With GlobalArgList.descriptors[i]^ do Begin Last:= First; While Last <> NIL do Begin ptr := Last^next; Dispose(last); Last := Ptr End End Dispose(GlobalArgList.Descriptors[i]) End; (*************************************************)