1
unit uPSI_ApplicationFileIO;
3
This file has been generated by UnitParser v0.7, written by M. Knight
4
and updated by NP. v/d Spek and George Birbilis.
5
Source Code from Carlo Kok has been used to implement various sections of
6
UnitParser. Components of ROPS are used in the construction of UnitParser,
7
code implementing the class wrapper is taken from Carlo Kok's conv utility
21
(*----------------------------------------------------------------------------*)
22
TPSImport_ApplicationFileIO = class(TPSPlugin)
24
procedure CompileImport1(CompExec: TPSScript); override;
25
procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override;
29
{ compile-time registration functions }
30
procedure SIRegister_TGLDataFile(CL: TPSPascalCompiler);
31
procedure SIRegister_TApplicationFileIO(CL: TPSPascalCompiler);
32
procedure SIRegister_ApplicationFileIO(CL: TPSPascalCompiler);
34
{ run-time registration functions }
35
procedure RIRegister_ApplicationFileIO_Routines(S: TPSExec);
36
procedure RIRegister_TGLDataFile(CL: TPSRuntimeClassImporter);
37
procedure RIRegister_TApplicationFileIO(CL: TPSRuntimeClassImporter);
38
procedure RIRegister_ApplicationFileIO(CL: TPSRuntimeClassImporter);
52
RegisterComponents('GLS ROPS', [TPSImport_ApplicationFileIO]);
55
(* === compile-time registration functions === *)
56
(*----------------------------------------------------------------------------*)
57
procedure SIRegister_TGLDataFile(CL: TPSPascalCompiler);
59
//with RegClassS(CL,'TPersistent', 'TGLDataFile') do
60
with CL.AddClassN(CL.FindClass('TPersistent'),'TGLDataFile') do
62
RegisterMethod('Constructor Create( AOwner : TPersistent)');
63
RegisterMethod('Function Capabilities : TGLDataFileCapabilities');
64
RegisterMethod('Function CreateCopy( AOwner : TPersistent) : TGLDataFile');
65
RegisterMethod('Procedure LoadFromFile( const fileName : String)');
66
RegisterMethod('Procedure SaveToFile( const fileName : String)');
67
RegisterMethod('Procedure LoadFromStream( stream : TStream)');
68
RegisterMethod('Procedure SaveToStream( stream : TStream)');
69
RegisterProperty('ResourceName', 'String', iptrw);
73
(*----------------------------------------------------------------------------*)
74
procedure SIRegister_TApplicationFileIO(CL: TPSPascalCompiler);
76
//with RegClassS(CL,'TComponent', 'TApplicationFileIO') do
77
with CL.AddClassN(CL.FindClass('TComponent'),'TApplicationFileIO') do
79
RegisterProperty('OnFileStream', 'TAFIOFileStreamEvent', iptrw);
80
RegisterProperty('OnFileStreamExists', 'TAFIOFileStreamExistsEvent', iptrw);
84
(*----------------------------------------------------------------------------*)
85
procedure SIRegister_ApplicationFileIO(CL: TPSPascalCompiler);
87
CL.AddTypeS('TAFIOFileStreamEvent', 'Function ( const fileName : String; mode'
88
+' : Word) : TStream');
89
CL.AddTypeS('TAFIOFileStreamExistsEvent', 'Function ( const fileName : String'
91
SIRegister_TApplicationFileIO(CL);
92
CL.AddTypeS('TGLDataFileCapability', '( dfcRead, dfcWrite )');
93
CL.AddTypeS('TGLDataFileCapabilities', 'set of TGLDataFileCapability');
94
SIRegister_TGLDataFile(CL);
95
//CL.AddTypeS('TGLDataFileClass', 'class of TGLDataFile');
96
CL.AddDelphiFunction('Function ApplicationFileIODefined : Boolean');
97
CL.AddDelphiFunction('Function CreateFileStream( const fileName : String; mode : Word) : TStream');
98
CL.AddDelphiFunction('Function FileStreamExists( const fileName : String) : Boolean');
101
(* === run-time registration functions === *)
102
(*----------------------------------------------------------------------------*)
103
procedure TGLDataFileResourceName_W(Self: TGLDataFile; const T: String);
104
begin Self.ResourceName := T; end;
106
(*----------------------------------------------------------------------------*)
107
procedure TGLDataFileResourceName_R(Self: TGLDataFile; var T: String);
108
begin T := Self.ResourceName; end;
110
(*----------------------------------------------------------------------------*)
111
procedure TApplicationFileIOOnFileStreamExists_W(Self: TApplicationFileIO; const T: TAFIOFileStreamExistsEvent);
112
begin Self.OnFileStreamExists := T; end;
114
(*----------------------------------------------------------------------------*)
115
procedure TApplicationFileIOOnFileStreamExists_R(Self: TApplicationFileIO; var T: TAFIOFileStreamExistsEvent);
116
begin T := Self.OnFileStreamExists; end;
118
(*----------------------------------------------------------------------------*)
119
procedure TApplicationFileIOOnFileStream_W(Self: TApplicationFileIO; const T: TAFIOFileStreamEvent);
120
begin Self.OnFileStream := T; end;
122
(*----------------------------------------------------------------------------*)
123
procedure TApplicationFileIOOnFileStream_R(Self: TApplicationFileIO; var T: TAFIOFileStreamEvent);
124
begin T := Self.OnFileStream; end;
126
(*----------------------------------------------------------------------------*)
127
procedure RIRegister_ApplicationFileIO_Routines(S: TPSExec);
129
S.RegisterDelphiFunction(@ApplicationFileIODefined, 'ApplicationFileIODefined', cdRegister);
130
S.RegisterDelphiFunction(@CreateFileStream, 'CreateFileStream', cdRegister);
131
S.RegisterDelphiFunction(@FileStreamExists, 'FileStreamExists', cdRegister);
134
(*----------------------------------------------------------------------------*)
135
procedure RIRegister_TGLDataFile(CL: TPSRuntimeClassImporter);
137
with CL.Add(TGLDataFile) do
139
RegisterVirtualConstructor(@TGLDataFile.Create, 'Create');
140
RegisterVirtualMethod(@TGLDataFile.Capabilities, 'Capabilities');
141
RegisterVirtualMethod(@TGLDataFile.CreateCopy, 'CreateCopy');
142
RegisterVirtualMethod(@TGLDataFile.LoadFromFile, 'LoadFromFile');
143
RegisterVirtualMethod(@TGLDataFile.SaveToFile, 'SaveToFile');
144
// RegisterVirtualAbstractMethod(@TGLDataFile, @!.LoadFromStream, 'LoadFromStream');
145
RegisterVirtualMethod(@TGLDataFile.SaveToStream, 'SaveToStream');
146
RegisterPropertyHelper(@TGLDataFileResourceName_R,@TGLDataFileResourceName_W,'ResourceName');
150
(*----------------------------------------------------------------------------*)
151
procedure RIRegister_TApplicationFileIO(CL: TPSRuntimeClassImporter);
153
with CL.Add(TApplicationFileIO) do
155
RegisterPropertyHelper(@TApplicationFileIOOnFileStream_R,@TApplicationFileIOOnFileStream_W,'OnFileStream');
156
RegisterPropertyHelper(@TApplicationFileIOOnFileStreamExists_R,@TApplicationFileIOOnFileStreamExists_W,'OnFileStreamExists');
160
(*----------------------------------------------------------------------------*)
161
procedure RIRegister_ApplicationFileIO(CL: TPSRuntimeClassImporter);
163
RIRegister_TApplicationFileIO(CL);
164
RIRegister_TGLDataFile(CL);
169
{ TPSImport_ApplicationFileIO }
170
(*----------------------------------------------------------------------------*)
171
procedure TPSImport_ApplicationFileIO.CompileImport1(CompExec: TPSScript);
173
SIRegister_ApplicationFileIO(CompExec.Comp);
175
(*----------------------------------------------------------------------------*)
176
procedure TPSImport_ApplicationFileIO.ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter);
178
RIRegister_ApplicationFileIO(ri);
179
RIRegister_ApplicationFileIO_Routines(CompExec.Exec); // comment it if no routines
181
(*----------------------------------------------------------------------------*)