|
@@ -33,8 +33,8 @@ Type
|
|
Public
|
|
Public
|
|
Line, Column: integer;
|
|
Line, Column: integer;
|
|
SrcFile: string;
|
|
SrcFile: string;
|
|
- Constructor Create(APasName : String; const aFile: string; aLine, aCol: integer);
|
|
|
|
- Property PasName : String read FPasName;
|
|
|
|
|
|
+ Constructor Create(APasName: String; const aFile: string; aLine, aCol: integer);
|
|
|
|
+ Property PasName: String read FPasName;
|
|
end;
|
|
end;
|
|
|
|
|
|
TBaseConversionOption = (
|
|
TBaseConversionOption = (
|
|
@@ -67,8 +67,8 @@ type
|
|
FTypeAliases: TStrings;
|
|
FTypeAliases: TStrings;
|
|
FVerbose: Boolean;
|
|
FVerbose: Boolean;
|
|
FWebIDLVersion: TWebIDLVersion;
|
|
FWebIDLVersion: TWebIDLVersion;
|
|
- FPasNameList : TFPObjectList;
|
|
|
|
- FAutoTypes : TStrings;
|
|
|
|
|
|
+ FPasNameList: TFPObjectList;
|
|
|
|
+ FAutoTypes: TStrings;
|
|
procedure SetIncludeImplementationCode(AValue: TStrings);
|
|
procedure SetIncludeImplementationCode(AValue: TStrings);
|
|
procedure SetIncludeInterfaceCode(AValue: TStrings);
|
|
procedure SetIncludeInterfaceCode(AValue: TStrings);
|
|
procedure SetTypeAliases(AValue: TStrings);
|
|
procedure SetTypeAliases(AValue: TStrings);
|
|
@@ -78,8 +78,7 @@ type
|
|
Procedure WritePascal; virtual;
|
|
Procedure WritePascal; virtual;
|
|
function CreateParser(aContext: TWebIDLContext; S: TWebIDLScanner): TWebIDLParser; virtual;
|
|
function CreateParser(aContext: TWebIDLContext; S: TWebIDLScanner): TWebIDLParser; virtual;
|
|
function CreateScanner(S: TStream): TWebIDLScanner; virtual;
|
|
function CreateScanner(S: TStream): TWebIDLScanner; virtual;
|
|
- Function CreateContext : TWebIDLContext; virtual;
|
|
|
|
- Function BaseUnits : String; override;
|
|
|
|
|
|
+ Function CreateContext: TWebIDLContext; virtual;
|
|
// Auxiliary routines
|
|
// Auxiliary routines
|
|
procedure GetOptions(L: TStrings; Full: boolean); virtual;
|
|
procedure GetOptions(L: TStrings; Full: boolean); virtual;
|
|
procedure ProcessDefinitions; virtual;
|
|
procedure ProcessDefinitions; virtual;
|
|
@@ -107,29 +106,29 @@ type
|
|
function HaveConsts(aList: TIDLDefinitionList): Boolean; virtual;
|
|
function HaveConsts(aList: TIDLDefinitionList): Boolean; virtual;
|
|
// Code generation routines. Return the number of actually written defs.
|
|
// Code generation routines. Return the number of actually written defs.
|
|
function WriteCallBackDefs(aList: TIDLDefinitionList): Integer; virtual;
|
|
function WriteCallBackDefs(aList: TIDLDefinitionList): Integer; virtual;
|
|
- function WriteDictionaryDefs(aList: TIDLDefinitionList) : Integer; virtual;
|
|
|
|
- function WriteForwardClassDefs(aList: TIDLDefinitionList) : Integer; virtual;
|
|
|
|
- function WriteInterfaceDefs(aList: TIDLDefinitionList) : Integer; virtual;
|
|
|
|
- function WriteMethodDefs(aList: TIDLDefinitionList) : Integer; virtual;
|
|
|
|
- function WriteTypeDefs(aList: TIDLDefinitionList) : Integer; virtual;
|
|
|
|
- function WriteEnumDefs(aList: TIDLDefinitionList) : Integer; virtual;
|
|
|
|
|
|
+ function WriteDictionaryDefs(aList: TIDLDefinitionList): Integer; virtual;
|
|
|
|
+ function WriteForwardClassDefs(aList: TIDLDefinitionList): Integer; virtual;
|
|
|
|
+ function WriteInterfaceDefs(aList: TIDLDefinitionList): Integer; virtual;
|
|
|
|
+ function WriteMethodDefs(aList: TIDLDefinitionList): Integer; virtual;
|
|
|
|
+ function WriteTypeDefs(aList: TIDLDefinitionList): Integer; virtual;
|
|
|
|
+ function WriteEnumDefs(aList: TIDLDefinitionList): Integer; virtual;
|
|
function WriteConsts(aList: TIDLDefinitionList): Integer; virtual;
|
|
function WriteConsts(aList: TIDLDefinitionList): Integer; virtual;
|
|
function WriteProperties(aList: TIDLDefinitionList): Integer;
|
|
function WriteProperties(aList: TIDLDefinitionList): Integer;
|
|
function WritePlainFields(aList: TIDLDefinitionList): Integer; virtual;
|
|
function WritePlainFields(aList: TIDLDefinitionList): Integer; virtual;
|
|
function WriteDictionaryFields(aList: TIDLDefinitionList): Integer; virtual;
|
|
function WriteDictionaryFields(aList: TIDLDefinitionList): Integer; virtual;
|
|
function WritePrivateReadOnlyFields(aList: TIDLDefinitionList): Integer; virtual;
|
|
function WritePrivateReadOnlyFields(aList: TIDLDefinitionList): Integer; virtual;
|
|
// Definitions. Return true if a definition was written.
|
|
// Definitions. Return true if a definition was written.
|
|
- function WriteForwardClassDef(D: TIDLStructuredDefinition) : Boolean; virtual;
|
|
|
|
|
|
+ function WriteForwardClassDef(D: TIDLStructuredDefinition): Boolean; virtual;
|
|
function WriteFunctionTypeDefinition(aDef: TIDLFunctionDefinition): Boolean; virtual;
|
|
function WriteFunctionTypeDefinition(aDef: TIDLFunctionDefinition): Boolean; virtual;
|
|
function WriteFunctionDefinition(aDef: TIDLFunctionDefinition): Boolean; virtual;
|
|
function WriteFunctionDefinition(aDef: TIDLFunctionDefinition): Boolean; virtual;
|
|
function WriteTypeDef(aDef: TIDLTypeDefDefinition): Boolean; virtual;
|
|
function WriteTypeDef(aDef: TIDLTypeDefDefinition): Boolean; virtual;
|
|
function WriteRecordDef(aDef: TIDLRecordDefinition): Boolean; virtual;
|
|
function WriteRecordDef(aDef: TIDLRecordDefinition): Boolean; virtual;
|
|
function WriteEnumDef(aDef: TIDLEnumDefinition): Boolean; virtual;
|
|
function WriteEnumDef(aDef: TIDLEnumDefinition): Boolean; virtual;
|
|
function WriteDictionaryField(aField: TIDLDictionaryMemberDefinition): Boolean; virtual;
|
|
function WriteDictionaryField(aField: TIDLDictionaryMemberDefinition): Boolean; virtual;
|
|
- function WritePrivateReadOnlyField(aAttr: TIDLAttributeDefinition) : Boolean; virtual;
|
|
|
|
- function WriteField(aAttr: TIDLAttributeDefinition) : Boolean; virtual;
|
|
|
|
- function WriteReadonlyProperty(aAttr: TIDLAttributeDefinition) : Boolean; virtual;
|
|
|
|
- function WriteConst(aConst: TIDLConstDefinition) : Boolean ; virtual;
|
|
|
|
|
|
+ function WritePrivateReadOnlyField(aAttr: TIDLAttributeDefinition): Boolean; virtual;
|
|
|
|
+ function WriteField(aAttr: TIDLAttributeDefinition): Boolean; virtual;
|
|
|
|
+ function WriteReadonlyProperty(aAttr: TIDLAttributeDefinition): Boolean; virtual;
|
|
|
|
+ function WriteConst(aConst: TIDLConstDefinition): Boolean ; virtual;
|
|
function WriteInterfaceDef(Intf: TIDLInterfaceDefinition): Boolean; virtual;
|
|
function WriteInterfaceDef(Intf: TIDLInterfaceDefinition): Boolean; virtual;
|
|
function WriteDictionaryDef(aDict: TIDLDictionaryDefinition): Boolean; virtual;
|
|
function WriteDictionaryDef(aDict: TIDLDictionaryDefinition): Boolean; virtual;
|
|
// Additional
|
|
// Additional
|
|
@@ -140,24 +139,24 @@ type
|
|
// Extra interface/Implementation code.
|
|
// Extra interface/Implementation code.
|
|
procedure WriteImplementation; virtual;
|
|
procedure WriteImplementation; virtual;
|
|
procedure WriteIncludeInterfaceCode; virtual;
|
|
procedure WriteIncludeInterfaceCode; virtual;
|
|
- Property Context : TWebIDLContext Read FContext;
|
|
|
|
|
|
+ Property Context: TWebIDLContext Read FContext;
|
|
Public
|
|
Public
|
|
- constructor Create(TheOwner : TComponent); override;
|
|
|
|
|
|
+ constructor Create(TheOwner: TComponent); override;
|
|
destructor Destroy; override;
|
|
destructor Destroy; override;
|
|
procedure Execute; virtual;
|
|
procedure Execute; virtual;
|
|
procedure WriteOptions; virtual;
|
|
procedure WriteOptions; virtual;
|
|
Public
|
|
Public
|
|
- Property InputFileName : String Read FInputFileName Write FInputFileName;
|
|
|
|
- Property OutputFileName : String Read FOutputFileName Write FOutputFileName;
|
|
|
|
- Property Verbose : Boolean Read FVerbose Write FVerbose;
|
|
|
|
- Property FieldPrefix : String Read FFieldPrefix Write FFieldPrefix;
|
|
|
|
- Property ClassPrefix : String Read FClassPrefix Write FClassPrefix;
|
|
|
|
- Property ClassSuffix : String Read FClassSuffix Write FClassSuffix;
|
|
|
|
- Property WebIDLVersion : TWebIDLVersion Read FWebIDLVersion Write FWebIDLVersion;
|
|
|
|
- Property TypeAliases : TStrings Read FTypeAliases Write SetTypeAliases;
|
|
|
|
- Property IncludeInterfaceCode : TStrings Read FIncludeInterfaceCode Write SetIncludeInterfaceCode;
|
|
|
|
- Property IncludeImplementationCode : TStrings Read FIncludeImplementationCode Write SetIncludeImplementationCode;
|
|
|
|
- Property DictionaryClassParent : String Read FDictionaryClassParent Write FDictionaryClassParent;
|
|
|
|
|
|
+ Property InputFileName: String Read FInputFileName Write FInputFileName;
|
|
|
|
+ Property OutputFileName: String Read FOutputFileName Write FOutputFileName;
|
|
|
|
+ Property Verbose: Boolean Read FVerbose Write FVerbose;
|
|
|
|
+ Property FieldPrefix: String Read FFieldPrefix Write FFieldPrefix;
|
|
|
|
+ Property ClassPrefix: String Read FClassPrefix Write FClassPrefix;
|
|
|
|
+ Property ClassSuffix: String Read FClassSuffix Write FClassSuffix;
|
|
|
|
+ Property WebIDLVersion: TWebIDLVersion Read FWebIDLVersion Write FWebIDLVersion;
|
|
|
|
+ Property TypeAliases: TStrings Read FTypeAliases Write SetTypeAliases;
|
|
|
|
+ Property IncludeInterfaceCode: TStrings Read FIncludeInterfaceCode Write SetIncludeInterfaceCode;
|
|
|
|
+ Property IncludeImplementationCode: TStrings Read FIncludeImplementationCode Write SetIncludeImplementationCode;
|
|
|
|
+ Property DictionaryClassParent: String Read FDictionaryClassParent Write FDictionaryClassParent;
|
|
Property BaseOptions: TBaseConversionOptions read FBaseOptions write FBaseOptions;
|
|
Property BaseOptions: TBaseConversionOptions read FBaseOptions write FBaseOptions;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -182,6 +181,7 @@ type
|
|
Private
|
|
Private
|
|
FPas2jsOptions: TPas2jsConversionOptions;
|
|
FPas2jsOptions: TPas2jsConversionOptions;
|
|
Protected
|
|
Protected
|
|
|
|
+ Function BaseUnits: String; override;
|
|
// Auxiliary routines
|
|
// Auxiliary routines
|
|
procedure GetOptions(L: TStrings; Full: boolean); override;
|
|
procedure GetOptions(L: TStrings; Full: boolean); override;
|
|
function GetTypeName(const aTypeName: String; ForTypeDef: Boolean=False
|
|
function GetTypeName(const aTypeName: String; ForTypeDef: Boolean=False
|
|
@@ -191,7 +191,8 @@ type
|
|
// Definitions. Return true if a definition was written.
|
|
// Definitions. Return true if a definition was written.
|
|
function WriteConst(aConst: TIDLConstDefinition): Boolean; override;
|
|
function WriteConst(aConst: TIDLConstDefinition): Boolean; override;
|
|
Public
|
|
Public
|
|
- Property Pas2jsOptions : TPas2jsConversionOptions Read FPas2jsOptions Write FPas2jsOptions;
|
|
|
|
|
|
+ constructor Create(TheOwner: TComponent); override;
|
|
|
|
+ Property Pas2jsOptions: TPas2jsConversionOptions Read FPas2jsOptions Write FPas2jsOptions;
|
|
Published
|
|
Published
|
|
Property BaseOptions;
|
|
Property BaseOptions;
|
|
Property ClassPrefix;
|
|
Property ClassPrefix;
|
|
@@ -242,6 +243,7 @@ type
|
|
|
|
|
|
TWebIDLToPasWasmJob = class(TBaseWebIDLToPas)
|
|
TWebIDLToPasWasmJob = class(TBaseWebIDLToPas)
|
|
Protected
|
|
Protected
|
|
|
|
+ function BaseUnits: String; override;
|
|
// Auxiliary routines
|
|
// Auxiliary routines
|
|
procedure GetOptions(L: TStrings; Full: boolean); override;
|
|
procedure GetOptions(L: TStrings; Full: boolean); override;
|
|
function GetTypeName(const aTypeName: String; ForTypeDef: Boolean=False
|
|
function GetTypeName(const aTypeName: String; ForTypeDef: Boolean=False
|
|
@@ -302,6 +304,11 @@ end;
|
|
|
|
|
|
{ TWebIDLToPasWasmJob }
|
|
{ TWebIDLToPasWasmJob }
|
|
|
|
|
|
|
|
+function TWebIDLToPasWasmJob.BaseUnits: String;
|
|
|
|
+begin
|
|
|
|
+ Result:='SysUtils, JOB_WAsm';
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TWebIDLToPasWasmJob.GetOptions(L: TStrings; Full: boolean);
|
|
procedure TWebIDLToPasWasmJob.GetOptions(L: TStrings; Full: boolean);
|
|
begin
|
|
begin
|
|
inherited GetOptions(L, Full);
|
|
inherited GetOptions(L, Full);
|
|
@@ -325,16 +332,21 @@ end;
|
|
|
|
|
|
{ TWebIDLToPas2js }
|
|
{ TWebIDLToPas2js }
|
|
|
|
|
|
|
|
+function TWebIDLToPas2js.BaseUnits: String;
|
|
|
|
+begin
|
|
|
|
+ Result:='SysUtils, JS';
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TWebIDLToPas2js.GetOptions(L: TStrings; Full: boolean);
|
|
procedure TWebIDLToPas2js.GetOptions(L: TStrings; Full: boolean);
|
|
begin
|
|
begin
|
|
inherited GetOptions(L, Full);
|
|
inherited GetOptions(L, Full);
|
|
- L.Add('Extended Options : '+Pas2jsConversionOptionsToStr(Pas2jsOptions));
|
|
|
|
|
|
+ L.Add('Extended Options: '+Pas2jsConversionOptionsToStr(Pas2jsOptions));
|
|
end;
|
|
end;
|
|
|
|
|
|
function TWebIDLToPas2js.GetTypeName(const aTypeName: String;
|
|
function TWebIDLToPas2js.GetTypeName(const aTypeName: String;
|
|
ForTypeDef: Boolean): String;
|
|
ForTypeDef: Boolean): String;
|
|
|
|
|
|
- Function UsePascalType(Const aPascalType : string) : String;
|
|
|
|
|
|
+ Function UsePascalType(Const aPascalType: string): String;
|
|
|
|
|
|
begin
|
|
begin
|
|
if (p2jcoUseNativeTypeAliases in Pas2jsOptions) and ForTypeDef then
|
|
if (p2jcoUseNativeTypeAliases in Pas2jsOptions) and ForTypeDef then
|
|
@@ -355,12 +367,12 @@ begin
|
|
'unsigned long': Result:=UsePascalType('NativeInt');
|
|
'unsigned long': Result:=UsePascalType('NativeInt');
|
|
'unsigned long long': Result:=UsePascalType('NativeInt');
|
|
'unsigned long long': Result:=UsePascalType('NativeInt');
|
|
'octet': Result:=UsePascalType('Byte');
|
|
'octet': Result:=UsePascalType('Byte');
|
|
- 'any' : Result:=UsePascalType('JSValue');
|
|
|
|
- 'float' : Result:=UsePascalType('Double');
|
|
|
|
- 'double' : Result:=UsePascalType('Double');
|
|
|
|
|
|
+ 'any': Result:=UsePascalType('JSValue');
|
|
|
|
+ 'float': Result:=UsePascalType('Double');
|
|
|
|
+ 'double': Result:=UsePascalType('Double');
|
|
'DOMString',
|
|
'DOMString',
|
|
'USVString',
|
|
'USVString',
|
|
- 'ByteString' : Result:=UsePascalType('String');
|
|
|
|
|
|
+ 'ByteString': Result:=UsePascalType('String');
|
|
else
|
|
else
|
|
Result:=inherited GetTypeName(aTypeName,ForTypeDef);
|
|
Result:=inherited GetTypeName(aTypeName,ForTypeDef);
|
|
end;
|
|
end;
|
|
@@ -369,10 +381,10 @@ end;
|
|
function TWebIDLToPas2js.WriteConst(aConst: TIDLConstDefinition): Boolean;
|
|
function TWebIDLToPas2js.WriteConst(aConst: TIDLConstDefinition): Boolean;
|
|
|
|
|
|
Const
|
|
Const
|
|
- ConstTypes : Array[TConstType] of String =
|
|
|
|
|
|
+ ConstTypes: Array[TConstType] of String =
|
|
('Double','NativeInt','Boolean','JSValue','JSValue','JSValue','JSValue','String','JSValue','JSValue');
|
|
('Double','NativeInt','Boolean','JSValue','JSValue','JSValue','JSValue','String','JSValue','JSValue');
|
|
Var
|
|
Var
|
|
- S : String;
|
|
|
|
|
|
+ S: String;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=True;
|
|
Result:=True;
|
|
@@ -380,12 +392,18 @@ begin
|
|
if p2jcoExternalConst in Pas2jsOptions then
|
|
if p2jcoExternalConst in Pas2jsOptions then
|
|
begin
|
|
begin
|
|
S:=ConstTypes[aConst.ConstType];
|
|
S:=ConstTypes[aConst.ConstType];
|
|
- Addln('%s : %s;',[GetName(aConst),S])
|
|
|
|
|
|
+ Addln('%s: %s;',[GetName(aConst),S])
|
|
end
|
|
end
|
|
else
|
|
else
|
|
Result:=inherited WriteConst(aConst);
|
|
Result:=inherited WriteConst(aConst);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+constructor TWebIDLToPas2js.Create(TheOwner: TComponent);
|
|
|
|
+begin
|
|
|
|
+ inherited Create(TheOwner);
|
|
|
|
+ Switches.Add('modeswitch externalclass');
|
|
|
|
+end;
|
|
|
|
+
|
|
{ TPasData }
|
|
{ TPasData }
|
|
|
|
|
|
constructor TPasData.Create(APasName: String; const aFile: string; aLine,
|
|
constructor TPasData.Create(APasName: String; const aFile: string; aLine,
|
|
@@ -404,13 +422,13 @@ begin
|
|
Result:=TWebIDLContext.Create(True);
|
|
Result:=TWebIDLContext.Create(True);
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TBaseWebIDLToPas.CreateScanner(S : TStream) : TWebIDLScanner;
|
|
|
|
|
|
+function TBaseWebIDLToPas.CreateScanner(S: TStream): TWebIDLScanner;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=TWebIDLScanner.Create(S);
|
|
Result:=TWebIDLScanner.Create(S);
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TBaseWebIDLToPas.CreateParser(aContext : TWebIDLContext;S : TWebIDLScanner) : TWebIDLParser;
|
|
|
|
|
|
+function TBaseWebIDLToPas.CreateParser(aContext: TWebIDLContext;S: TWebIDLScanner): TWebIDLParser;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=TWebIDLParser.Create(aContext,S);
|
|
Result:=TWebIDLParser.Create(aContext,S);
|
|
@@ -421,8 +439,8 @@ procedure TBaseWebIDLToPas.Parse;
|
|
|
|
|
|
Var
|
|
Var
|
|
ms: TMemoryStream;
|
|
ms: TMemoryStream;
|
|
- S : TWebIDLScanner;
|
|
|
|
- P : TWebIDLParser;
|
|
|
|
|
|
+ S: TWebIDLScanner;
|
|
|
|
+ P: TWebIDLParser;
|
|
|
|
|
|
begin
|
|
begin
|
|
P:=Nil;
|
|
P:=Nil;
|
|
@@ -453,7 +471,7 @@ end;
|
|
function TBaseWebIDLToPas.HaveConsts(aList: TIDLDefinitionList): Boolean;
|
|
function TBaseWebIDLToPas.HaveConsts(aList: TIDLDefinitionList): Boolean;
|
|
|
|
|
|
Var
|
|
Var
|
|
- D : TIDLDefinition;
|
|
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=False;
|
|
Result:=False;
|
|
@@ -465,8 +483,8 @@ end;
|
|
function TBaseWebIDLToPas.WritePrivateReadOnlyFields(aList: TIDLDefinitionList): Integer;
|
|
function TBaseWebIDLToPas.WritePrivateReadOnlyFields(aList: TIDLDefinitionList): Integer;
|
|
|
|
|
|
Var
|
|
Var
|
|
- D : TIDLDefinition;
|
|
|
|
- A : TIDLAttributeDefinition absolute D;
|
|
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
+ A: TIDLAttributeDefinition absolute D;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=0;
|
|
Result:=0;
|
|
@@ -480,8 +498,8 @@ end;
|
|
function TBaseWebIDLToPas.WriteProperties(aList: TIDLDefinitionList): Integer;
|
|
function TBaseWebIDLToPas.WriteProperties(aList: TIDLDefinitionList): Integer;
|
|
|
|
|
|
Var
|
|
Var
|
|
- D : TIDLDefinition;
|
|
|
|
- A : TIDLAttributeDefinition absolute D;
|
|
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
+ A: TIDLAttributeDefinition absolute D;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=0;
|
|
Result:=0;
|
|
@@ -506,7 +524,7 @@ end;
|
|
function TBaseWebIDLToPas.WriteConsts(aList: TIDLDefinitionList): Integer;
|
|
function TBaseWebIDLToPas.WriteConsts(aList: TIDLDefinitionList): Integer;
|
|
|
|
|
|
Var
|
|
Var
|
|
- D : TIDLDefinition;
|
|
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
|
|
begin
|
|
begin
|
|
EnsureSection(csConst);
|
|
EnsureSection(csConst);
|
|
@@ -522,26 +540,24 @@ end;
|
|
function TBaseWebIDLToPas.WritePlainFields(aList: TIDLDefinitionList): Integer;
|
|
function TBaseWebIDLToPas.WritePlainFields(aList: TIDLDefinitionList): Integer;
|
|
|
|
|
|
Var
|
|
Var
|
|
- D : TIDLDefinition;
|
|
|
|
- A : TIDLAttributeDefinition absolute D;
|
|
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
+ A: TIDLAttributeDefinition absolute D;
|
|
|
|
|
|
begin
|
|
begin
|
|
EnsureSection(csDeclaration);
|
|
EnsureSection(csDeclaration);
|
|
- Indent;
|
|
|
|
Result:=0;
|
|
Result:=0;
|
|
For D in aList do
|
|
For D in aList do
|
|
if D is TIDLAttributeDefinition then
|
|
if D is TIDLAttributeDefinition then
|
|
if Not (aoReadOnly in A.Options) then
|
|
if Not (aoReadOnly in A.Options) then
|
|
if WriteField(A) then
|
|
if WriteField(A) then
|
|
Inc(Result);
|
|
Inc(Result);
|
|
- Undent;
|
|
|
|
end;
|
|
end;
|
|
|
|
|
|
function TBaseWebIDLToPas.WriteDictionaryField(
|
|
function TBaseWebIDLToPas.WriteDictionaryField(
|
|
aField: TIDLDictionaryMemberDefinition): Boolean;
|
|
aField: TIDLDictionaryMemberDefinition): Boolean;
|
|
|
|
|
|
Var
|
|
Var
|
|
- Def,N,TN : String;
|
|
|
|
|
|
+ Def,N,TN: String;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=True;
|
|
Result:=True;
|
|
@@ -551,7 +567,7 @@ begin
|
|
TN:='TJSObject';
|
|
TN:='TJSObject';
|
|
if SameText(N,TN) then
|
|
if SameText(N,TN) then
|
|
N:='_'+N;
|
|
N:='_'+N;
|
|
- Def:=Format('%s : %s;',[N,TN]);
|
|
|
|
|
|
+ Def:=Format('%s: %s;',[N,TN]);
|
|
if (N<>aField.Name) then
|
|
if (N<>aField.Name) then
|
|
Def:=Def+Format('external name ''%s'';',[aField.Name]);
|
|
Def:=Def+Format('external name ''%s'';',[aField.Name]);
|
|
AddLn(Def);
|
|
AddLn(Def);
|
|
@@ -560,8 +576,8 @@ end;
|
|
function TBaseWebIDLToPas.WriteDictionaryFields(aList: TIDLDefinitionList): Integer;
|
|
function TBaseWebIDLToPas.WriteDictionaryFields(aList: TIDLDefinitionList): Integer;
|
|
|
|
|
|
Var
|
|
Var
|
|
- D : TIDLDefinition;
|
|
|
|
- M : TIDLDictionaryMemberDefinition absolute D;
|
|
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
+ M: TIDLDictionaryMemberDefinition absolute D;
|
|
|
|
|
|
begin
|
|
begin
|
|
Indent;
|
|
Indent;
|
|
@@ -576,8 +592,8 @@ end;
|
|
function TBaseWebIDLToPas.WriteMethodDefs(aList: TIDLDefinitionList): Integer;
|
|
function TBaseWebIDLToPas.WriteMethodDefs(aList: TIDLDefinitionList): Integer;
|
|
|
|
|
|
Var
|
|
Var
|
|
- D : TIDLDefinition;
|
|
|
|
- FD : TIDLFunctionDefinition absolute D;
|
|
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
+ FD: TIDLFunctionDefinition absolute D;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=0;
|
|
Result:=0;
|
|
@@ -592,7 +608,7 @@ function TBaseWebIDLToPas.AddSequenceDef(ST: TIDLSequenceTypeDefDefinition
|
|
): Boolean;
|
|
): Boolean;
|
|
|
|
|
|
var
|
|
var
|
|
- TN : String;
|
|
|
|
|
|
+ TN: String;
|
|
begin
|
|
begin
|
|
TN:=GetTypeName(ST);
|
|
TN:=GetTypeName(ST);
|
|
Result:=FAutoTypes.IndexOf(TN)=-1;
|
|
Result:=FAutoTypes.IndexOf(TN)=-1;
|
|
@@ -608,10 +624,10 @@ end;
|
|
function TBaseWebIDLToPas.WriteFunctionImplicitTypes(aList: TIDLDefinitionList): Integer;
|
|
function TBaseWebIDLToPas.WriteFunctionImplicitTypes(aList: TIDLDefinitionList): Integer;
|
|
|
|
|
|
Var
|
|
Var
|
|
- D,D2,D3 : TIDLDefinition;
|
|
|
|
- FD : TIDLFunctionDefinition absolute D;
|
|
|
|
- DA : TIDLArgumentDefinition absolute D2;
|
|
|
|
- UT : TIDLUnionTypeDefDefinition;
|
|
|
|
|
|
+ D,D2,D3: TIDLDefinition;
|
|
|
|
+ FD: TIDLFunctionDefinition absolute D;
|
|
|
|
+ DA: TIDLArgumentDefinition absolute D2;
|
|
|
|
+ UT: TIDLUnionTypeDefDefinition;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=0;
|
|
Result:=0;
|
|
@@ -645,8 +661,8 @@ end;
|
|
function TBaseWebIDLToPas.WriteAttributeImplicitTypes(aList: TIDLDefinitionList
|
|
function TBaseWebIDLToPas.WriteAttributeImplicitTypes(aList: TIDLDefinitionList
|
|
): Integer;
|
|
): Integer;
|
|
Var
|
|
Var
|
|
- D : TIDLDefinition;
|
|
|
|
- FA : TIDLAttributeDefinition absolute D;
|
|
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
+ FA: TIDLAttributeDefinition absolute D;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=0;
|
|
Result:=0;
|
|
@@ -661,8 +677,8 @@ function TBaseWebIDLToPas.WriteDictionaryMemberImplicitTypes(
|
|
aList: TIDLDefinitionList): Integer;
|
|
aList: TIDLDefinitionList): Integer;
|
|
|
|
|
|
Var
|
|
Var
|
|
- D : TIDLDefinition;
|
|
|
|
- FD : TIDLDictionaryMemberDefinition absolute D;
|
|
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
+ FD: TIDLDictionaryMemberDefinition absolute D;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=0;
|
|
Result:=0;
|
|
@@ -673,17 +689,17 @@ begin
|
|
Inc(Result);
|
|
Inc(Result);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TBaseWebIDLToPas.EnsureUniqueNames(ML : TIDLDefinitionList);
|
|
|
|
|
|
+procedure TBaseWebIDLToPas.EnsureUniqueNames(ML: TIDLDefinitionList);
|
|
|
|
|
|
Var
|
|
Var
|
|
- L : TFPObjectHashTable;
|
|
|
|
|
|
+ L: TFPObjectHashTable;
|
|
|
|
|
|
- Procedure CheckRename(Def : TIDLDefinition);
|
|
|
|
|
|
+ Procedure CheckRename(Def: TIDLDefinition);
|
|
|
|
|
|
var
|
|
var
|
|
- I : integer;
|
|
|
|
- OrigName,BaseName,NewName : String;
|
|
|
|
- IsOverload : Boolean;
|
|
|
|
|
|
+ I: integer;
|
|
|
|
+ OrigName,BaseName,NewName: String;
|
|
|
|
+ IsOverload: Boolean;
|
|
CurDef , ConflictDef: TIDLDefinition;
|
|
CurDef , ConflictDef: TIDLDefinition;
|
|
|
|
|
|
begin
|
|
begin
|
|
@@ -724,7 +740,7 @@ Var
|
|
end;
|
|
end;
|
|
|
|
|
|
var
|
|
var
|
|
- D : TIDLDefinition;
|
|
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
|
|
begin
|
|
begin
|
|
L:=TFPObjectHashTable.Create(False);
|
|
L:=TFPObjectHashTable.Create(False);
|
|
@@ -743,9 +759,9 @@ end;
|
|
function TBaseWebIDLToPas.WriteInterfaceDef(Intf: TIDLInterfaceDefinition): Boolean;
|
|
function TBaseWebIDLToPas.WriteInterfaceDef(Intf: TIDLInterfaceDefinition): Boolean;
|
|
|
|
|
|
Var
|
|
Var
|
|
- CN,PN : String;
|
|
|
|
- Decl : String;
|
|
|
|
- ML : TIDLDefinitionList;
|
|
|
|
|
|
+ CN,PN: String;
|
|
|
|
+ Decl: String;
|
|
|
|
+ ML: TIDLDefinitionList;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=True;
|
|
Result:=True;
|
|
@@ -794,8 +810,8 @@ function TBaseWebIDLToPas.WriteDictionaryDef(aDict: TIDLDictionaryDefinition
|
|
): Boolean;
|
|
): Boolean;
|
|
|
|
|
|
Var
|
|
Var
|
|
- CurClassName,CurParent : String;
|
|
|
|
- DefList : TIDLDefinitionList;
|
|
|
|
|
|
+ CurClassName,CurParent: String;
|
|
|
|
+ DefList: TIDLDefinitionList;
|
|
CurDefs: TIDLDictionaryDefinition;
|
|
CurDefs: TIDLDictionaryDefinition;
|
|
|
|
|
|
begin
|
|
begin
|
|
@@ -832,7 +848,6 @@ begin
|
|
FieldPrefix:='F';
|
|
FieldPrefix:='F';
|
|
ClassPrefix:='T';
|
|
ClassPrefix:='T';
|
|
ClassSuffix:='';
|
|
ClassSuffix:='';
|
|
- Switches.Add('modeswitch externalclass');
|
|
|
|
FTypeAliases:=TStringList.Create;
|
|
FTypeAliases:=TStringList.Create;
|
|
FPasNameList:=TFPObjectList.Create(True);
|
|
FPasNameList:=TFPObjectList.Create(True);
|
|
FAutoTypes:=TStringList.Create;
|
|
FAutoTypes:=TStringList.Create;
|
|
@@ -854,7 +869,7 @@ end;
|
|
procedure TBaseWebIDLToPas.WriteImplementation;
|
|
procedure TBaseWebIDLToPas.WriteImplementation;
|
|
|
|
|
|
Var
|
|
Var
|
|
- S : String;
|
|
|
|
|
|
+ S: String;
|
|
|
|
|
|
begin
|
|
begin
|
|
Addln('');
|
|
Addln('');
|
|
@@ -863,7 +878,7 @@ begin
|
|
Addln('');
|
|
Addln('');
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TBaseWebIDLToPas.GetTypeName(aTypeDef : TIDLTypeDefDefinition; ForTypeDef : Boolean = False): String;
|
|
|
|
|
|
+function TBaseWebIDLToPas.GetTypeName(aTypeDef: TIDLTypeDefDefinition; ForTypeDef: Boolean = False): String;
|
|
|
|
|
|
begin
|
|
begin
|
|
if ATypeDef is TIDLSequenceTypeDefDefinition then
|
|
if ATypeDef is TIDLSequenceTypeDefDefinition then
|
|
@@ -891,8 +906,8 @@ function TBaseWebIDLToPas.GetTypeName(const aTypeName: String; ForTypeDef: Boole
|
|
end;
|
|
end;
|
|
|
|
|
|
Var
|
|
Var
|
|
- A,TN : UTF8String;
|
|
|
|
- D : TIDLDefinition;
|
|
|
|
|
|
+ A,TN: UTF8String;
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
|
|
begin
|
|
begin
|
|
Case aTypeName of
|
|
Case aTypeName of
|
|
@@ -906,15 +921,15 @@ begin
|
|
'unsigned long': TN:='LongWord';
|
|
'unsigned long': TN:='LongWord';
|
|
'unsigned long long': TN:='QWord';
|
|
'unsigned long long': TN:='QWord';
|
|
'octet': TN:='Byte';
|
|
'octet': TN:='Byte';
|
|
- 'any' : TN:='JSValue';
|
|
|
|
- 'float' : TN:='Single';
|
|
|
|
- 'double' : TN:='Double';
|
|
|
|
|
|
+ 'any': TN:='JSValue';
|
|
|
|
+ 'float': TN:='Single';
|
|
|
|
+ 'double': TN:='Double';
|
|
'DOMString',
|
|
'DOMString',
|
|
'USVString',
|
|
'USVString',
|
|
- 'ByteString' : TN:='UnicodeString';
|
|
|
|
- 'object' : TN:=GetClassName('Object');
|
|
|
|
|
|
+ 'ByteString': TN:='UnicodeString';
|
|
|
|
+ 'object': TN:=GetClassName('Object');
|
|
'Error',
|
|
'Error',
|
|
- 'DOMException' : TN:=GetClassName('Error');
|
|
|
|
|
|
+ 'DOMException': TN:=GetClassName('Error');
|
|
'ArrayBuffer',
|
|
'ArrayBuffer',
|
|
'DataView',
|
|
'DataView',
|
|
'Int8Array',
|
|
'Int8Array',
|
|
@@ -925,7 +940,7 @@ begin
|
|
'Uint32Array',
|
|
'Uint32Array',
|
|
'Uint8ClampedArray',
|
|
'Uint8ClampedArray',
|
|
'Float32Array',
|
|
'Float32Array',
|
|
- 'Float64Array' : TN:=GetClassName(aTypeName);
|
|
|
|
|
|
+ 'Float64Array': TN:=GetClassName(aTypeName);
|
|
else
|
|
else
|
|
if ForTypeDef then ;
|
|
if ForTypeDef then ;
|
|
|
|
|
|
@@ -947,14 +962,14 @@ function TBaseWebIDLToPas.WritePrivateReadOnlyField(aAttr: TIDLAttributeDefiniti
|
|
): Boolean;
|
|
): Boolean;
|
|
|
|
|
|
begin
|
|
begin
|
|
- AddLn('%s%s : %s; external name ''%s''; ',[FieldPrefix,GetName(aAttr),GetTypeName(aAttr.AttributeType),aAttr.Name]);
|
|
|
|
|
|
+ AddLn('%s%s: %s; external name ''%s''; ',[FieldPrefix,GetName(aAttr),GetTypeName(aAttr.AttributeType),aAttr.Name]);
|
|
Result:=true;
|
|
Result:=true;
|
|
end;
|
|
end;
|
|
|
|
|
|
function TBaseWebIDLToPas.WriteField(aAttr: TIDLAttributeDefinition): Boolean;
|
|
function TBaseWebIDLToPas.WriteField(aAttr: TIDLAttributeDefinition): Boolean;
|
|
|
|
|
|
Var
|
|
Var
|
|
- Def,TN,N : String;
|
|
|
|
|
|
+ Def,TN,N: String;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=True;
|
|
Result:=True;
|
|
@@ -969,7 +984,7 @@ begin
|
|
TN:='TJSObject';
|
|
TN:='TJSObject';
|
|
if SameText(N,TN) then
|
|
if SameText(N,TN) then
|
|
N:='_'+N;
|
|
N:='_'+N;
|
|
- Def:=Format('%s : %s;',[N,TN]);
|
|
|
|
|
|
+ Def:=Format('%s: %s;',[N,TN]);
|
|
if (N<>aAttr.Name) then
|
|
if (N<>aAttr.Name) then
|
|
Def:=Def+Format('external name ''%s'';',[aAttr.Name]);
|
|
Def:=Def+Format('external name ''%s'';',[aAttr.Name]);
|
|
AddLn(Def);
|
|
AddLn(Def);
|
|
@@ -979,7 +994,7 @@ function TBaseWebIDLToPas.WriteReadonlyProperty(aAttr: TIDLAttributeDefinition
|
|
): Boolean;
|
|
): Boolean;
|
|
|
|
|
|
Var
|
|
Var
|
|
- TN,N,PN : String;
|
|
|
|
|
|
+ TN,N,PN: String;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=True;
|
|
Result:=True;
|
|
@@ -988,10 +1003,9 @@ begin
|
|
TN:=GetTypeName(aAttr.AttributeType);
|
|
TN:=GetTypeName(aAttr.AttributeType);
|
|
if SameText(PN,TN) then
|
|
if SameText(PN,TN) then
|
|
PN:='_'+PN;
|
|
PN:='_'+PN;
|
|
- AddLn('Property %s : %s Read %s%s; ',[PN,TN,FieldPrefix,N]);
|
|
|
|
|
|
+ AddLn('Property %s: %s Read %s%s; ',[PN,TN,FieldPrefix,N]);
|
|
end;
|
|
end;
|
|
|
|
|
|
-
|
|
|
|
function TBaseWebIDLToPas.WriteForwardClassDef(D: TIDLStructuredDefinition): Boolean;
|
|
function TBaseWebIDLToPas.WriteForwardClassDef(D: TIDLStructuredDefinition): Boolean;
|
|
|
|
|
|
begin
|
|
begin
|
|
@@ -1003,7 +1017,7 @@ end;
|
|
function TBaseWebIDLToPas.WriteForwardClassDefs(aList: TIDLDefinitionList): Integer;
|
|
function TBaseWebIDLToPas.WriteForwardClassDefs(aList: TIDLDefinitionList): Integer;
|
|
|
|
|
|
Var
|
|
Var
|
|
- D : TIDLDefinition;
|
|
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=0;
|
|
Result:=0;
|
|
@@ -1019,18 +1033,18 @@ begin
|
|
Inc(Result);
|
|
Inc(Result);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TBaseWebIDLToPas.WriteSequenceDef(aDef : TIDLSequenceTypeDefDefinition);
|
|
|
|
|
|
+procedure TBaseWebIDLToPas.WriteSequenceDef(aDef: TIDLSequenceTypeDefDefinition);
|
|
|
|
|
|
begin
|
|
begin
|
|
Addln('%s = array of %s;',[GetName(aDef),GetTypeName(aDef.ElementType)])
|
|
Addln('%s = array of %s;',[GetName(aDef),GetTypeName(aDef.ElementType)])
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-procedure TBaseWebIDLToPas.WriteUnionDef(aDef : TIDLUnionTypeDefDefinition);
|
|
|
|
|
|
+procedure TBaseWebIDLToPas.WriteUnionDef(aDef: TIDLUnionTypeDefDefinition);
|
|
|
|
|
|
Var
|
|
Var
|
|
- S : UTF8String;
|
|
|
|
- D : TIDLDefinition;
|
|
|
|
|
|
+ S: UTF8String;
|
|
|
|
+ D: TIDLDefinition;
|
|
begin
|
|
begin
|
|
S:='';
|
|
S:='';
|
|
For D in adef.Union do
|
|
For D in adef.Union do
|
|
@@ -1044,16 +1058,16 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-procedure TBaseWebIDLToPas.WritePromiseDef(aDef : TIDLPromiseTypeDefDefinition);
|
|
|
|
|
|
+procedure TBaseWebIDLToPas.WritePromiseDef(aDef: TIDLPromiseTypeDefDefinition);
|
|
|
|
|
|
begin
|
|
begin
|
|
AddLn('%s = TJSPromise;',[GetName(aDef)]);
|
|
AddLn('%s = TJSPromise;',[GetName(aDef)]);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TBaseWebIDLToPas.WriteAliasTypeDef(aDef : TIDLTypeDefDefinition);
|
|
|
|
|
|
+procedure TBaseWebIDLToPas.WriteAliasTypeDef(aDef: TIDLTypeDefDefinition);
|
|
|
|
|
|
Var
|
|
Var
|
|
- TN : String;
|
|
|
|
|
|
+ TN: String;
|
|
|
|
|
|
begin
|
|
begin
|
|
TN:=GetTypeName(aDef,True);
|
|
TN:=GetTypeName(aDef,True);
|
|
@@ -1079,7 +1093,7 @@ end;
|
|
function TBaseWebIDLToPas.WriteRecordDef(aDef: TIDLRecordDefinition): Boolean;
|
|
function TBaseWebIDLToPas.WriteRecordDef(aDef: TIDLRecordDefinition): Boolean;
|
|
|
|
|
|
Var
|
|
Var
|
|
- KT,VT : String;
|
|
|
|
|
|
+ KT,VT: String;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=True;
|
|
Result:=True;
|
|
@@ -1101,8 +1115,8 @@ end;
|
|
function TBaseWebIDLToPas.WriteTypeDefs(aList: TIDLDefinitionList): Integer;
|
|
function TBaseWebIDLToPas.WriteTypeDefs(aList: TIDLDefinitionList): Integer;
|
|
|
|
|
|
Var
|
|
Var
|
|
- D : TIDLDefinition;
|
|
|
|
- TD : TIDLTypeDefDefinition absolute D;
|
|
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
+ TD: TIDLTypeDefDefinition absolute D;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=0;
|
|
Result:=0;
|
|
@@ -1123,8 +1137,8 @@ end;
|
|
function TBaseWebIDLToPas.WriteEnumDefs(aList: TIDLDefinitionList): Integer;
|
|
function TBaseWebIDLToPas.WriteEnumDefs(aList: TIDLDefinitionList): Integer;
|
|
|
|
|
|
Var
|
|
Var
|
|
- D : TIDLDefinition;
|
|
|
|
- ED : TIDLEnumDefinition absolute D;
|
|
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
+ ED: TIDLEnumDefinition absolute D;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=0;
|
|
Result:=0;
|
|
@@ -1139,16 +1153,16 @@ function TBaseWebIDLToPas.GetArguments(aList: TIDLDefinitionList;
|
|
ForceBrackets: Boolean): String;
|
|
ForceBrackets: Boolean): String;
|
|
|
|
|
|
Var
|
|
Var
|
|
- I : TIDLDefinition;
|
|
|
|
- A : TIDLArgumentDefinition absolute I;
|
|
|
|
- Arg : string;
|
|
|
|
|
|
+ I: TIDLDefinition;
|
|
|
|
+ A: TIDLArgumentDefinition absolute I;
|
|
|
|
+ Arg: string;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:='';
|
|
Result:='';
|
|
For I in aList do
|
|
For I in aList do
|
|
begin
|
|
begin
|
|
Arg:=GetName(A);
|
|
Arg:=GetName(A);
|
|
- Arg:=Arg+' : '+GetTypeName(A.ArgumentType);
|
|
|
|
|
|
+ Arg:=Arg+': '+GetTypeName(A.ArgumentType);
|
|
if Result<>'' then
|
|
if Result<>'' then
|
|
Result:=Result+'; ';
|
|
Result:=Result+'; ';
|
|
Result:=Result+Arg;
|
|
Result:=Result+Arg;
|
|
@@ -1166,9 +1180,9 @@ function TBaseWebIDLToPas.CloneNonPartialArgumentList(aList: TFPObjectlist;
|
|
ADest: TFPObjectlist; AsPartial: Boolean): integer;
|
|
ADest: TFPObjectlist; AsPartial: Boolean): integer;
|
|
|
|
|
|
Var
|
|
Var
|
|
- I,J : Integer;
|
|
|
|
- CD : TIDLDefinition;
|
|
|
|
- DL,CL : TIDLDefinitionList;
|
|
|
|
|
|
+ I,J: Integer;
|
|
|
|
+ CD: TIDLDefinition;
|
|
|
|
+ DL,CL: TIDLDefinitionList;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=0;
|
|
Result:=0;
|
|
@@ -1201,9 +1215,9 @@ procedure TBaseWebIDLToPas.AddArgumentToOverloads(aList: TFPObjectlist; AName,
|
|
ATypeName: String; PosEl: TIDLBaseObject);
|
|
ATypeName: String; PosEl: TIDLBaseObject);
|
|
|
|
|
|
Var
|
|
Var
|
|
- I : Integer;
|
|
|
|
- CD : TIDLArgumentDefinition;
|
|
|
|
- DL : TIDLDefinitionList;
|
|
|
|
|
|
+ I: Integer;
|
|
|
|
+ CD: TIDLArgumentDefinition;
|
|
|
|
+ DL: TIDLDefinitionList;
|
|
|
|
|
|
begin
|
|
begin
|
|
For I:=0 to aList.Count-1 do
|
|
For I:=0 to aList.Count-1 do
|
|
@@ -1223,9 +1237,9 @@ end;
|
|
procedure TBaseWebIDLToPas.AddArgumentToOverloads(aList: TFPObjectlist; aDef: TIDLArgumentDefinition);
|
|
procedure TBaseWebIDLToPas.AddArgumentToOverloads(aList: TFPObjectlist; aDef: TIDLArgumentDefinition);
|
|
|
|
|
|
Var
|
|
Var
|
|
- I : Integer;
|
|
|
|
- CD : TIDLDefinition;
|
|
|
|
- DL : TIDLDefinitionList;
|
|
|
|
|
|
+ I: Integer;
|
|
|
|
+ CD: TIDLDefinition;
|
|
|
|
+ DL: TIDLDefinitionList;
|
|
|
|
|
|
begin
|
|
begin
|
|
For I:=0 to aList.Count-1 do
|
|
For I:=0 to aList.Count-1 do
|
|
@@ -1243,13 +1257,13 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TBaseWebIDLToPas.AddUnionOverloads(aList: TFPObjectlist; AName : String; UT : TIDLUnionTypeDefDefinition);
|
|
|
|
|
|
+procedure TBaseWebIDLToPas.AddUnionOverloads(aList: TFPObjectlist; AName: String; UT: TIDLUnionTypeDefDefinition);
|
|
|
|
|
|
Var
|
|
Var
|
|
- L,L2 : TFPObjectList;
|
|
|
|
- I,J : Integer;
|
|
|
|
- D : TIDLDefinitionList;
|
|
|
|
- Dups : TStringList;
|
|
|
|
|
|
+ L,L2: TFPObjectList;
|
|
|
|
+ I,J: Integer;
|
|
|
|
+ D: TIDLDefinitionList;
|
|
|
|
+ Dups: TStringList;
|
|
|
|
|
|
begin
|
|
begin
|
|
L2:=Nil;
|
|
L2:=Nil;
|
|
@@ -1309,9 +1323,9 @@ procedure TBaseWebIDLToPas.AddOverloads(aList: TFPObjectlist;
|
|
adef: TIDLFunctionDefinition; aIdx: Integer);
|
|
adef: TIDLFunctionDefinition; aIdx: Integer);
|
|
|
|
|
|
Var
|
|
Var
|
|
- Arg : TIDLArgumentDefinition;
|
|
|
|
- D : TIDLDefinition;
|
|
|
|
- UT : TIDLUnionTypeDefDefinition;
|
|
|
|
|
|
+ Arg: TIDLArgumentDefinition;
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
+ UT: TIDLUnionTypeDefDefinition;
|
|
|
|
|
|
begin
|
|
begin
|
|
if aIdx>=ADef.Arguments.Count then
|
|
if aIdx>=ADef.Arguments.Count then
|
|
@@ -1347,7 +1361,7 @@ end;
|
|
function TBaseWebIDLToPas.WriteFunctionTypeDefinition(aDef: TIDLFunctionDefinition): Boolean;
|
|
function TBaseWebIDLToPas.WriteFunctionTypeDefinition(aDef: TIDLFunctionDefinition): Boolean;
|
|
|
|
|
|
Var
|
|
Var
|
|
- FN,RT,Args : String;
|
|
|
|
|
|
+ FN,RT,Args: String;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=True;
|
|
Result:=True;
|
|
@@ -1365,9 +1379,9 @@ end;
|
|
function TBaseWebIDLToPas.WriteFunctionDefinition(aDef: TIDLFunctionDefinition): Boolean;
|
|
function TBaseWebIDLToPas.WriteFunctionDefinition(aDef: TIDLFunctionDefinition): Boolean;
|
|
|
|
|
|
Var
|
|
Var
|
|
- FN,RT,Suff,Args : String;
|
|
|
|
- Overloads : TFPObjectList;
|
|
|
|
- I : Integer;
|
|
|
|
|
|
+ FN,RT,Suff,Args: String;
|
|
|
|
+ Overloads: TFPObjectList;
|
|
|
|
+ I: Integer;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=True;
|
|
Result:=True;
|
|
@@ -1410,8 +1424,8 @@ end;
|
|
function TBaseWebIDLToPas.WriteCallBackDefs(aList: TIDLDefinitionList): Integer;
|
|
function TBaseWebIDLToPas.WriteCallBackDefs(aList: TIDLDefinitionList): Integer;
|
|
|
|
|
|
Var
|
|
Var
|
|
- D : TIDLDefinition;
|
|
|
|
- FD : TIDLFunctionDefinition absolute D;
|
|
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
+ FD: TIDLFunctionDefinition absolute D;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=0;
|
|
Result:=0;
|
|
@@ -1426,8 +1440,8 @@ end;
|
|
function TBaseWebIDLToPas.WriteDictionaryDefs(aList: TIDLDefinitionList): Integer;
|
|
function TBaseWebIDLToPas.WriteDictionaryDefs(aList: TIDLDefinitionList): Integer;
|
|
|
|
|
|
Var
|
|
Var
|
|
- D : TIDLDefinition;
|
|
|
|
- DD : TIDLDictionaryDefinition absolute D;
|
|
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
+ DD: TIDLDictionaryDefinition absolute D;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=0;
|
|
Result:=0;
|
|
@@ -1442,8 +1456,8 @@ end;
|
|
function TBaseWebIDLToPas.WriteInterfaceDefs(aList: TIDLDefinitionList): Integer;
|
|
function TBaseWebIDLToPas.WriteInterfaceDefs(aList: TIDLDefinitionList): Integer;
|
|
|
|
|
|
Var
|
|
Var
|
|
- D : TIDLDefinition;
|
|
|
|
- ID : TIDLInterfaceDefinition absolute D;
|
|
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
+ ID: TIDLInterfaceDefinition absolute D;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=0;
|
|
Result:=0;
|
|
@@ -1466,11 +1480,11 @@ procedure TBaseWebIDLToPas.GetOptions(L: TStrings; Full: boolean);
|
|
end;
|
|
end;
|
|
|
|
|
|
Var
|
|
Var
|
|
- S : String;
|
|
|
|
- I : Integer;
|
|
|
|
|
|
+ S: String;
|
|
|
|
+ I: Integer;
|
|
|
|
|
|
begin
|
|
begin
|
|
- L.Add('Used command-line options : ');
|
|
|
|
|
|
+ L.Add('Used command-line options: ');
|
|
For I:=1 to ParamCount do
|
|
For I:=1 to ParamCount do
|
|
L.Add(ParamStr(i));
|
|
L.Add(ParamStr(i));
|
|
L.Add('');
|
|
L.Add('');
|
|
@@ -1478,36 +1492,36 @@ begin
|
|
L.Add('');
|
|
L.Add('');
|
|
if Full then
|
|
if Full then
|
|
begin
|
|
begin
|
|
- L.Add('Verbose : '+BoolToStr(Verbose,true));
|
|
|
|
- L.Add('Converter : '+ClassName);
|
|
|
|
- L.Add('InputFileName : '+InputFileName);
|
|
|
|
- L.Add('OutputFileName : '+OutputFileName);
|
|
|
|
|
|
+ L.Add('Verbose: '+BoolToStr(Verbose,true));
|
|
|
|
+ L.Add('Converter: '+ClassName);
|
|
|
|
+ L.Add('InputFileName: '+InputFileName);
|
|
|
|
+ L.Add('OutputFileName: '+OutputFileName);
|
|
end;
|
|
end;
|
|
- L.Add('Keyword prefix : '+KeywordPrefix);
|
|
|
|
- L.Add('Keyword suffix : '+KeywordSuffix);
|
|
|
|
- L.Add('Class prefix : '+ClassPrefix);
|
|
|
|
- L.Add('Class suffix : '+ClassSuffix);
|
|
|
|
- L.Add('Field prefix : '+FieldPrefix);
|
|
|
|
|
|
+ L.Add('Keyword prefix: '+KeywordPrefix);
|
|
|
|
+ L.Add('Keyword suffix: '+KeywordSuffix);
|
|
|
|
+ L.Add('Class prefix: '+ClassPrefix);
|
|
|
|
+ L.Add('Class suffix: '+ClassSuffix);
|
|
|
|
+ L.Add('Field prefix: '+FieldPrefix);
|
|
Str(WebIDLVersion,S);
|
|
Str(WebIDLVersion,S);
|
|
- L.Add('WebIDL version : '+S);
|
|
|
|
|
|
+ L.Add('WebIDL version: '+S);
|
|
if TypeAliases.Count>0 then
|
|
if TypeAliases.Count>0 then
|
|
begin
|
|
begin
|
|
L.Add('Type aliases:');
|
|
L.Add('Type aliases:');
|
|
L.AddStrings(Self.TypeAliases);
|
|
L.AddStrings(Self.TypeAliases);
|
|
end;
|
|
end;
|
|
- L.Add('Dictionary class parent : '+DictionaryClassParent);
|
|
|
|
|
|
+ L.Add('Dictionary class parent: '+DictionaryClassParent);
|
|
if Full then
|
|
if Full then
|
|
begin
|
|
begin
|
|
- L.Add('Include interface code : '+CodeInfo(IncludeInterfaceCode));
|
|
|
|
- L.Add('Include implementation code : '+CodeInfo(IncludeImplementationCode));
|
|
|
|
|
|
+ L.Add('Include interface code: '+CodeInfo(IncludeInterfaceCode));
|
|
|
|
+ L.Add('Include implementation code: '+CodeInfo(IncludeImplementationCode));
|
|
end;
|
|
end;
|
|
- L.Add('Base Options : '+BaseConversionOptionsToStr(BaseOptions));
|
|
|
|
|
|
+ L.Add('Base Options: '+BaseConversionOptionsToStr(BaseOptions));
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TBaseWebIDLToPas.AddOptionsToHeader;
|
|
procedure TBaseWebIDLToPas.AddOptionsToHeader;
|
|
|
|
|
|
Var
|
|
Var
|
|
- L : TStrings;
|
|
|
|
|
|
+ L: TStrings;
|
|
begin
|
|
begin
|
|
L:=TStringList.Create;
|
|
L:=TStringList.Create;
|
|
try
|
|
try
|
|
@@ -1523,7 +1537,7 @@ end;
|
|
procedure TBaseWebIDLToPas.WriteIncludeInterfaceCode;
|
|
procedure TBaseWebIDLToPas.WriteIncludeInterfaceCode;
|
|
|
|
|
|
Var
|
|
Var
|
|
- S : String;
|
|
|
|
|
|
+ S: String;
|
|
|
|
|
|
begin
|
|
begin
|
|
For S in IncludeInterfaceCode do
|
|
For S in IncludeInterfaceCode do
|
|
@@ -1554,12 +1568,6 @@ begin
|
|
Source.SaveToFile(OutputFileName);
|
|
Source.SaveToFile(OutputFileName);
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TBaseWebIDLToPas.BaseUnits: String;
|
|
|
|
-
|
|
|
|
-begin
|
|
|
|
- Result:='SysUtils, JS'
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
function TBaseWebIDLToPas.CreatePasName(aName: String; D: TIDLBaseObject
|
|
function TBaseWebIDLToPas.CreatePasName(aName: String; D: TIDLBaseObject
|
|
): TPasData;
|
|
): TPasData;
|
|
|
|
|
|
@@ -1571,7 +1579,7 @@ end;
|
|
function TBaseWebIDLToPas.AllocatePasName(D: TIDLDefinition; ParentName: String): TPasData;
|
|
function TBaseWebIDLToPas.AllocatePasName(D: TIDLDefinition; ParentName: String): TPasData;
|
|
|
|
|
|
Var
|
|
Var
|
|
- CN : String;
|
|
|
|
|
|
+ CN: String;
|
|
aData: TPasData;
|
|
aData: TPasData;
|
|
|
|
|
|
begin
|
|
begin
|
|
@@ -1641,10 +1649,10 @@ begin
|
|
FIncludeImplementationCode.Assign(AValue);
|
|
FIncludeImplementationCode.Assign(AValue);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TBaseWebIDLToPas.AllocatePasNames(aList : TIDLDefinitionList; ParentName: String = '');
|
|
|
|
|
|
+procedure TBaseWebIDLToPas.AllocatePasNames(aList: TIDLDefinitionList; ParentName: String = '');
|
|
|
|
|
|
var
|
|
var
|
|
- D : TIDLDefinition;
|
|
|
|
|
|
+ D: TIDLDefinition;
|
|
|
|
|
|
begin
|
|
begin
|
|
For D in aList do
|
|
For D in aList do
|