LZScene

Форк
0
/
uPSI_ApplicationFileIO.pas 
184 строки · 7.6 Кб
1
unit uPSI_ApplicationFileIO;
2
{
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
8

9
}
10
interface
11
 
12
uses
13
   SysUtils
14
  ,Classes
15
  ,uPSComponent
16
  ,uPSRuntime
17
  ,uPSCompiler
18
  ;
19
 
20
type 
21
(*----------------------------------------------------------------------------*)
22
  TPSImport_ApplicationFileIO = class(TPSPlugin)
23
  protected
24
    procedure CompileImport1(CompExec: TPSScript); override;
25
    procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override;
26
  end;
27
 
28
 
29
{ compile-time registration functions }
30
procedure SIRegister_TGLDataFile(CL: TPSPascalCompiler);
31
procedure SIRegister_TApplicationFileIO(CL: TPSPascalCompiler);
32
procedure SIRegister_ApplicationFileIO(CL: TPSPascalCompiler);
33

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);
39

40
procedure Register;
41

42
implementation
43

44

45
uses
46
   GLApplicationFileIO
47
  ;
48
 
49
 
50
procedure Register;
51
begin
52
  RegisterComponents('GLS ROPS', [TPSImport_ApplicationFileIO]);
53
end;
54

55
(* === compile-time registration functions === *)
56
(*----------------------------------------------------------------------------*)
57
procedure SIRegister_TGLDataFile(CL: TPSPascalCompiler);
58
begin
59
  //with RegClassS(CL,'TPersistent', 'TGLDataFile') do
60
  with CL.AddClassN(CL.FindClass('TPersistent'),'TGLDataFile') do
61
  begin
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);
70
  end;
71
end;
72

73
(*----------------------------------------------------------------------------*)
74
procedure SIRegister_TApplicationFileIO(CL: TPSPascalCompiler);
75
begin
76
  //with RegClassS(CL,'TComponent', 'TApplicationFileIO') do
77
  with CL.AddClassN(CL.FindClass('TComponent'),'TApplicationFileIO') do
78
  begin
79
    RegisterProperty('OnFileStream', 'TAFIOFileStreamEvent', iptrw);
80
    RegisterProperty('OnFileStreamExists', 'TAFIOFileStreamExistsEvent', iptrw);
81
  end;
82
end;
83

84
(*----------------------------------------------------------------------------*)
85
procedure SIRegister_ApplicationFileIO(CL: TPSPascalCompiler);
86
begin
87
  CL.AddTypeS('TAFIOFileStreamEvent', 'Function ( const fileName : String; mode'
88
   +' : Word) : TStream');
89
  CL.AddTypeS('TAFIOFileStreamExistsEvent', 'Function ( const fileName : String'
90
   +') : Boolean');
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');
99
end;
100

101
(* === run-time registration functions === *)
102
(*----------------------------------------------------------------------------*)
103
procedure TGLDataFileResourceName_W(Self: TGLDataFile; const T: String);
104
begin Self.ResourceName := T; end;
105

106
(*----------------------------------------------------------------------------*)
107
procedure TGLDataFileResourceName_R(Self: TGLDataFile; var T: String);
108
begin T := Self.ResourceName; end;
109

110
(*----------------------------------------------------------------------------*)
111
procedure TApplicationFileIOOnFileStreamExists_W(Self: TApplicationFileIO; const T: TAFIOFileStreamExistsEvent);
112
begin Self.OnFileStreamExists := T; end;
113

114
(*----------------------------------------------------------------------------*)
115
procedure TApplicationFileIOOnFileStreamExists_R(Self: TApplicationFileIO; var T: TAFIOFileStreamExistsEvent);
116
begin T := Self.OnFileStreamExists; end;
117

118
(*----------------------------------------------------------------------------*)
119
procedure TApplicationFileIOOnFileStream_W(Self: TApplicationFileIO; const T: TAFIOFileStreamEvent);
120
begin Self.OnFileStream := T; end;
121

122
(*----------------------------------------------------------------------------*)
123
procedure TApplicationFileIOOnFileStream_R(Self: TApplicationFileIO; var T: TAFIOFileStreamEvent);
124
begin T := Self.OnFileStream; end;
125

126
(*----------------------------------------------------------------------------*)
127
procedure RIRegister_ApplicationFileIO_Routines(S: TPSExec);
128
begin
129
 S.RegisterDelphiFunction(@ApplicationFileIODefined, 'ApplicationFileIODefined', cdRegister);
130
 S.RegisterDelphiFunction(@CreateFileStream, 'CreateFileStream', cdRegister);
131
 S.RegisterDelphiFunction(@FileStreamExists, 'FileStreamExists', cdRegister);
132
end;
133

134
(*----------------------------------------------------------------------------*)
135
procedure RIRegister_TGLDataFile(CL: TPSRuntimeClassImporter);
136
begin
137
  with CL.Add(TGLDataFile) do
138
  begin
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');
147
  end;
148
end;
149

150
(*----------------------------------------------------------------------------*)
151
procedure RIRegister_TApplicationFileIO(CL: TPSRuntimeClassImporter);
152
begin
153
  with CL.Add(TApplicationFileIO) do
154
  begin
155
    RegisterPropertyHelper(@TApplicationFileIOOnFileStream_R,@TApplicationFileIOOnFileStream_W,'OnFileStream');
156
    RegisterPropertyHelper(@TApplicationFileIOOnFileStreamExists_R,@TApplicationFileIOOnFileStreamExists_W,'OnFileStreamExists');
157
  end;
158
end;
159

160
(*----------------------------------------------------------------------------*)
161
procedure RIRegister_ApplicationFileIO(CL: TPSRuntimeClassImporter);
162
begin
163
  RIRegister_TApplicationFileIO(CL);
164
  RIRegister_TGLDataFile(CL);
165
end;
166

167
 
168
 
169
{ TPSImport_ApplicationFileIO }
170
(*----------------------------------------------------------------------------*)
171
procedure TPSImport_ApplicationFileIO.CompileImport1(CompExec: TPSScript);
172
begin
173
  SIRegister_ApplicationFileIO(CompExec.Comp);
174
end;
175
(*----------------------------------------------------------------------------*)
176
procedure TPSImport_ApplicationFileIO.ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter);
177
begin
178
  RIRegister_ApplicationFileIO(ri);
179
  RIRegister_ApplicationFileIO_Routines(CompExec.Exec); // comment it if no routines
180
end;
181
(*----------------------------------------------------------------------------*)
182
 
183
 
184
end.
185

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.