List Info

Thread: regardin dynamic array from delphi3 to delphi5




regardin dynamic array from delphi3 to delphi5
user name
2006-04-03 12:34:12
Hi There!
  
  I m trying to migrate from delphi3 to delphi5.
  In That i would like to know is there any difference for dynamic arrays that were used in Delphi3 and Delphi5?
  I m just trying to execute delphi3 code in delphi5 enviroment. Is there any change needed to make it run properly?
  
  I m giving code snippet, Please help me in moving ahead:
  
  In LibInfo.pas file:
  
  TSysElClass = class of TSysEl;
 
TDirectory = class
  private
    FPDataTypes: TList;
   FSysElClasses: TList;    
  public
  constructor Create(PDataTypes : array of TPDataType;
       ;           ;     SysElClasses : array of TSysElClass;
     ;           ;       ReqdDirs     : array of ShortString;
     ;           ;       UsedPubUnits : array of ShortString;
     ;           ;       UsedPriUnits : array of ShortString);    virtual;
 
    destructor Destroy;      ;           ;           ;           ;         override;
  
    property PDataType [DTID:Integer]: TPDataType  read GetPDataType;  default;
  ;
   property SysElClass[SEID: Integer]: TSysElClass read GetSysElClass;
 ; end;
  
  Implementation
 
  Some global functions declarations ....
  
  constructor TDirectory.Create(PDataTypes   : array of TPDataType;
       ;           ;           ; SysElClasses : array of TSysElClass;
     ;           ;           ;   ReqdDirs     : array of ShortString;
     ;           ;           ;   UsedPubUnits : array of ShortString;
     ;           ;           ;   UsedPriUnits : array of ShortString);
var
  i: Integer;
  begin
    inherited Create;
   FPDataTypes:= TList.Create;
  FEditorClasses:= TList.Create;
  FDataTypesModified := False;
  for i:= 0 to High(PDataTypes) do
   ; if assigned(PDataTypes[i]) then begin
      FPDataTypes.Add(PDataTypes[i]);
      if Assigned(PDataTypes[i].EditorClass)then
      ;  FEditorClasses.Add(PDataTypes[i].EditorClass)
     ; ;//end if
   ; end;//if
  /// SysElClasses
  FSysElClasses:= TList.Create;
  for i:= 0 to High(SysElClasses) do
   ; if Assigned(SysElClasses[i]) then begin
      FSysElClasses.Add(SysElClasses[i]);
   ; &nbsp; if SysElClasses[i].ClassName <> 'TSysEl' then
&nbsp; &nbsp; &nbsp; &nbsp; RegisterClass(SysElClasses[i])&nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;  // Register SysEl Classes
&nbsp;   ;  ;//end if
   ; end//if
&nbsp; ;//end for every SysEl Class
&nbsp; // SysEls to be turned into SysElClasses
 
and such more loops for ReqdDirs,UsedPubUnits  and UsedPriUnits
 &nbsp;
  end;
&nbsp; 
  TSIDELib = class(TList)
 &nbsp;
  private....
 &nbsp;
  procedure SetDir......
  function GetDir......
  public
  Constructor create(..........
&nbsp; destructor destroy..............
 &nbsp;
  end;
&nbsp; 
  Now in SeTsysel.pas file:
&nbsp; 
  TPDataType = ^TDataType;
 &nbsp;
  TDataType = record //----------------------------------------------------------
&nbsp; Name   : ShortString; &nbsp; &nbsp;  //String
  Size   : Integer;
  KindOf : ShortString; &nbsp; // used to search library for PDataType
  EditorClass: TEditorClass;
  ViewerClass: TViewerClass;
  //Modified: Boolean;
  case Typ: TDataTyp of
   ; //dtSimple:(
 &nbsp;  dtEnum:&nbsp; (
 &nbsp;   ; NumEnums&nbsp; &nbsp; : Integer;
  ; &nbsp;  EnumName&nbsp; &nbsp; : TEnumName;
 &nbsp; &nbsp;  EnumNameL&nbsp;  : TStringList  );
  
 &nbsp; and such for dtRecord,dtObject,dtArray,dtDynArray diff. case Typ.
&nbsp; 
  end;
&nbsp; 
  Now in dtSideLib.pas file. This file resides in sub-folder and is used in package SideLib.Pkg.
 &nbsp;
  unit .....
&nbsp; interface.....
 ; uses....
  ; function GetDPLDir: TDirectory; // TDirectory is class in LibInfo.pas
  procedure SetSIDELib(aSIDELib: TSIDELib); // TSideLib is again class in LibInfo.pas
  exports GetDPLDir, SetSIDELib; // provides access to its Directory obj
 ;
const
dtTDynArray: TDataType= (Name:'TDynArray'; Size:SizeOf(Single); KindOf:'SystemDefined';
 &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp;  EditorClass:nil; ViewerClass:nil; Typ:dtDynArray);
&nbsp; const
dtByte: TDataType= (Name:'Byte'; Size:SizeOf(Byte); KindOf:'SystemDefined';
 &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp;  EditorClass:nil; ViewerClass:nil; Typ:dtSimple);
 ;
const
dtUnknown: TDataType= (Name:'Unknown'; Size:SizeOf(Unknown); KindOf:'SystemDefined';
 &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp;  EditorClass:nil; ViewerClass:nil; Typ:dtSimple);
 ;
and similar type of few more DataTypes.....
 
  implementation
 ; //Initialization & Finalization Code //////////////////////////////////////////
var
 ; &nbsp; Directory: TDirectory;  // created when loaded, freed when unloaded
  function GetDPLDir: TDirectory; &nbsp; &nbsp; &nbsp; &nbsp;   ;  // every directory must have one
begin  Result:= Directory;  ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; // ...used by TSIDELib
end;
 ; procedure SetSIDELib(aSIDELib: TSIDELib);  ; // every directory must have one
begin  SIDELib := aSIDELib;&nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  // ...used by TSIDELib
end;
 ; initialization ////////////////////////////////////////////////////////////////
  Directory:= TDirectory.Create(
&nbsp; //DataTypes Defined
&nbsp;   [dtByte,
&nbsp;   ; dtUnknown,
 &nbsp; &nbsp; dtSingle,
 &nbsp; &nbsp; dtInteger,
 &nbsp; &nbsp; dtString,
 &nbsp; &nbsp; dtDouble,
 &nbsp; &nbsp; dtDateTime,
 &nbsp; &nbsp; dtBoolean,
 &nbsp; &nbsp; dtTDynArray,
 &nbsp;   dtStringList,
   dtList],
  //Contained SysElClasses
 &nbsp;  [TSysEl{,
 &nbsp; &nbsp; TLandingGearDesign}],
  //Required Directory Packages
  ;  [''],
&nbsp; //Used Public Units
&nbsp; &nbsp; [''],
&nbsp; //Used Private Units
&nbsp; &nbsp; ['']
&nbsp; );
  finalization //////////////////////////////////////////////////////////////////
  Directory.Free;
&nbsp; end.
&nbsp; 
  Here all  'DataTypes'  written with .... get displayed properly on screen on running, but 'SysElClasses'  values not displayed.
  I don't know why ???
 ; According to my program requirement, it should display followed by DataTypes.
  What should i do to display this components?
 &nbsp;
  There is no pointer defined for SysElClasses as for DataType like
  TPDataType = ^TDataType.
  Is this the cause of problem.
  I m not familier with delphi + dynamic arrays too.
&nbsp; Any guidence regarding How to solve this would greatly be appreciated.
  Thanks.....
 &nbsp;
  Looking for your kind help always.
&nbsp; With regards,
  -Bijal...
 &nbsp;
 &nbsp;
 &nbsp;

   ; &nbsp;  &nbsp; &nbsp;   &nbsp; &nbsp;   &nbsp; &nbsp; 
---------------------------------
Jiyo cricket on Yahoo! India cricket
Yahoo! Messenger Mobile Stay in touch with your buddies all the time.

[Non-text portions of this message have been removed]

regardin dynamic array from delphi3 to delphi5
user name
2006-04-03 17:22:50
Bijal Mandviya wrote:
&gt; &nbsp; I m trying to migrate from delphi3 to delphi5.
> &nbsp; In That i would like to know is there any difference for dynamic arrays
&gt; that were used in Delphi3 and Delphi5?

For starters, Delphi 3 doesn't have dynamic arrays.

  I m just trying to execute delphi3 code in delphi5 enviroment. Is there
>; any change needed to make it run properly?

No, it should just work.

&gt; &nbsp; Here all  'DataTypes'  written with .... get displayed properly on
> screen on running, but 'SysElClasses'  values not displayed.

Not displayed where? I'm not sure what your code is supposed to do. Can
you try to trim it down to something that illustrates the problem
succinctly?

--
Rob


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )