procedure V2OA(V: Variant; var OA: TOpenArray; var OAValues: TValueArray; var Size: Integer); var I: Integer; ArrayRec: PJvInterpreterArrayRec; Element: TJvInterpreterArrayValues; ElementVariant: Variant; begin if TVarData(V).VType = varArray then //JvInterpreterError(ieTypeMistmatch, -1); begin ArrayRec := PJvInterpreterArrayRec(TVarData(V).VPointer); if ArrayRec^.Dimension > 1 then raise EJVCLException.CreateRes(@RsESorryForOneDimensionalArraysOnly); Size := ArrayRec^.Size; for I := 0 to Size - 1 do begin Element[0] := I; ElementVariant := JvInterpreterArrayGetElement(Element, ArrayRec); case TVarData(ElementVariant).VType of varInteger, varSmallint: begin OAValues[I] := ElementVariant; OA[I].VInteger := ElementVariant; OA[I].VType := vtInteger; end; varString, varOleStr: begin // OA[I].vPChar := PChar(string(V[I])); // OA[I].VType := vtPChar; OAValues[I] := ElementVariant; OA[I].VVariant := @OAValues[I]; OA[I].VType := vtVariant; end; varBoolean: begin OAValues[I] := ElementVariant; OA[I].VBoolean := ElementVariant; OA[I].VType := vtBoolean; end; varDouble, varCurrency: begin { Commented by Alex Vulpe 19.02.2005 OAValues[I] := V[I]; OA[I].VExtended := TVarData(V[I]).VPointer; OA[I].VType := vtExtended; } // Inserted by Alex Vulpe 19.02.2005 // begin block --------------------- OAValues[i] := V[i]; VarCast(OAValues[I], OAValues[I], varCurrency); OA[i].vCurrency := @TVarData(OAValues[i]).vCurrency; OA[i].VType := vtCurrency; // end block --------------------- end; else OAValues[I] := ElementVariant; OA[I].VVariant := @OAValues[I]; OA[I].VType := vtVariant; end; end; end else begin Size := VarArrayHighBound(V, 1) - VarArrayLowBound(V, 1) + 1; for I := VarArrayLowBound(V, 1) to VarArrayHighBound(V, 1) do begin case TVarData(V[I]).VType of varInteger, varSmallint: begin OAValues[I] := V[I]; OA[I].VInteger := V[I]; OA[I].VType := vtInteger; end; varString, varOleStr: begin // OA[I].vPChar := PChar(string(V[I])); // OA[I].VType := vtPChar; OAValues[I] := V[I]; OA[I].VVariant := @OAValues[I]; OA[I].VType := vtVariant; end; varBoolean: begin OAValues[I] := V[I]; OA[I].VBoolean := V[I]; OA[I].VType := vtBoolean; end; varDouble, varCurrency: begin { Commented by Alex Vulpe 19.02.2005 OAValues[I] := V[I]; OA[I].VExtended := TVarData(V[I]).VPointer; OA[I].VType := vtExtended; } // Inserted by Alex Vulpe 19.02.2005 // begin block --------------------- OAValues[i] := V[i]; VarCast(OAValues[I], OAValues[I], varCurrency); OA[i].vCurrency := @TVarData(OAValues[i]).vCurrency; OA[i].VType := vtCurrency; // end block --------------------- end; else OAValues[I] := V[I]; OA[I].VVariant := @OAValues[I]; OA[I].VType := vtVariant; end; end; end; end;