mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 14:29:14 +02:00
pastojs: added option -SI<interfacestyel>
git-svn-id: trunk@38964 -
This commit is contained in:
parent
26cc97745a
commit
e9843bccf0
@ -72,6 +72,7 @@ const
|
|||||||
nSrcMapSourceRootIs = 134; sSrcMapSourceRootIs = 'source map "sourceRoot" is %s';
|
nSrcMapSourceRootIs = 134; sSrcMapSourceRootIs = 'source map "sourceRoot" is %s';
|
||||||
nSrcMapBaseDirIs = 135; sSrcMapBaseDirIs = 'source map "local base directory" is %s';
|
nSrcMapBaseDirIs = 135; sSrcMapBaseDirIs = 'source map "local base directory" is %s';
|
||||||
nUnitFileNotFound = 136; sUnitFileNotFound = 'unit file not found "%s"';
|
nUnitFileNotFound = 136; sUnitFileNotFound = 'unit file not found "%s"';
|
||||||
|
nInterfaceStyleIs = 137; sInterfaceStyleIs = 'Interface style is %s';
|
||||||
// Note: error numbers 201+ are used by Pas2jsFileCache
|
// Note: error numbers 201+ are used by Pas2jsFileCache
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -410,6 +411,7 @@ type
|
|||||||
procedure SetTargetProcessor(const AValue: TPasToJsProcessor);
|
procedure SetTargetProcessor(const AValue: TPasToJsProcessor);
|
||||||
procedure SetWriteMsgToStdErr(const AValue: boolean);
|
procedure SetWriteMsgToStdErr(const AValue: boolean);
|
||||||
private
|
private
|
||||||
|
FInterfaceType: TPasClassInterfaceType;
|
||||||
FPrecompileInitialFlags: TPCUInitialFlags;
|
FPrecompileInitialFlags: TPCUInitialFlags;
|
||||||
procedure AddDefinesForTargetPlatform;
|
procedure AddDefinesForTargetPlatform;
|
||||||
procedure AddDefinesForTargetProcessor;
|
procedure AddDefinesForTargetProcessor;
|
||||||
@ -490,6 +492,7 @@ type
|
|||||||
property FileCache: TPas2jsFilesCache read FFileCache write SetFileCache;
|
property FileCache: TPas2jsFilesCache read FFileCache write SetFileCache;
|
||||||
property FileCacheAutoFree: boolean read FFileCacheAutoFree write FFileCacheAutoFree;
|
property FileCacheAutoFree: boolean read FFileCacheAutoFree write FFileCacheAutoFree;
|
||||||
property FileCount: integer read GetFileCount;
|
property FileCount: integer read GetFileCount;
|
||||||
|
property InterfaceType: TPasClassInterfaceType read FInterfaceType write FInterfaceType;
|
||||||
property Log: TPas2jsLogger read FLog;
|
property Log: TPas2jsLogger read FLog;
|
||||||
property MainFile: TPas2jsCompilerFile read FMainFile;
|
property MainFile: TPas2jsCompilerFile read FMainFile;
|
||||||
property Mode: TP2jsMode read FMode write SetMode;
|
property Mode: TP2jsMode read FMode write SetMode;
|
||||||
@ -842,6 +845,11 @@ begin
|
|||||||
Scanner.CurrentModeSwitches:=GetInitialModeSwitches;
|
Scanner.CurrentModeSwitches:=GetInitialModeSwitches;
|
||||||
Scanner.AllowedBoolSwitches:=msAllPas2jsBoolSwitches;
|
Scanner.AllowedBoolSwitches:=msAllPas2jsBoolSwitches;
|
||||||
Scanner.CurrentBoolSwitches:=GetInitialBoolSwitches;
|
Scanner.CurrentBoolSwitches:=GetInitialBoolSwitches;
|
||||||
|
Scanner.CurrentValueSwitch[vsInterfaces]:=InterfaceTypeNames[Compiler.InterfaceType];
|
||||||
|
if coAllowCAssignments in Compiler.Options then
|
||||||
|
Scanner.Options:=Scanner.Options+[po_cassignments];
|
||||||
|
if Compiler.Mode=p2jmDelphi then
|
||||||
|
Scanner.Options:=Scanner.Options+[po_delphi];
|
||||||
// Note: some Scanner.Options are set by TPasResolver
|
// Note: some Scanner.Options are set by TPasResolver
|
||||||
for i:=0 to Compiler.Defines.Count-1 do
|
for i:=0 to Compiler.Defines.Count-1 do
|
||||||
begin
|
begin
|
||||||
@ -851,10 +859,6 @@ begin
|
|||||||
else
|
else
|
||||||
Scanner.AddMacro(M.Name,M.Value);
|
Scanner.AddMacro(M.Name,M.Value);
|
||||||
end;
|
end;
|
||||||
if coAllowCAssignments in Compiler.Options then
|
|
||||||
Scanner.Options:=Scanner.Options+[po_cassignments];
|
|
||||||
if Compiler.Mode=p2jmDelphi then
|
|
||||||
Scanner.Options:=Scanner.Options+[po_delphi];
|
|
||||||
|
|
||||||
// parser
|
// parser
|
||||||
Parser.LogEvents:=PascalResolver.ParserLogEvents;
|
Parser.LogEvents:=PascalResolver.ParserLogEvents;
|
||||||
@ -3320,7 +3324,7 @@ begin
|
|||||||
inc(p);
|
inc(p);
|
||||||
Identifier:=String(p);
|
Identifier:=String(p);
|
||||||
for aProc in TPasToJsProcessor do
|
for aProc in TPasToJsProcessor do
|
||||||
if CompareText(Identifier,PasToJsProcessorNames[aProc])=0 then
|
if SameText(Identifier,PasToJsProcessorNames[aProc]) then
|
||||||
begin
|
begin
|
||||||
TargetProcessor:=aProc;
|
TargetProcessor:=aProc;
|
||||||
Identifier:='';
|
Identifier:='';
|
||||||
@ -3332,14 +3336,25 @@ begin
|
|||||||
'S': // Syntax
|
'S': // Syntax
|
||||||
begin
|
begin
|
||||||
inc(p);
|
inc(p);
|
||||||
ReadSyntaxFlags(Param,p);
|
if p^='I' then
|
||||||
|
begin
|
||||||
|
Identifier:=String(p);
|
||||||
|
if SameText(Identifier,'com') then
|
||||||
|
InterfaceType:=citCom
|
||||||
|
else if SameText(Identifier,'corba') then
|
||||||
|
InterfaceType:=citCorba
|
||||||
|
else
|
||||||
|
ParamFatal('invalid interface style (-SI) "'+Identifier+'"');
|
||||||
|
end
|
||||||
|
else
|
||||||
|
ReadSyntaxFlags(Param,p);
|
||||||
end;
|
end;
|
||||||
'T': // target platform
|
'T': // target platform
|
||||||
begin
|
begin
|
||||||
inc(p);
|
inc(p);
|
||||||
Identifier:=String(p);
|
Identifier:=String(p);
|
||||||
for aPlatform in TPasToJsPlatform do
|
for aPlatform in TPasToJsPlatform do
|
||||||
if CompareText(Identifier,PasToJsPlatformNames[aPlatform])=0 then
|
if SameText(Identifier,PasToJsPlatformNames[aPlatform]) then
|
||||||
begin
|
begin
|
||||||
TargetPlatform:=aPlatform;
|
TargetPlatform:=aPlatform;
|
||||||
Identifier:='';
|
Identifier:='';
|
||||||
@ -3598,6 +3613,7 @@ begin
|
|||||||
r(mtInfo,nSrcMapSourceRootIs,sSrcMapSourceRootIs);
|
r(mtInfo,nSrcMapSourceRootIs,sSrcMapSourceRootIs);
|
||||||
r(mtInfo,nSrcMapBaseDirIs,sSrcMapBaseDirIs);
|
r(mtInfo,nSrcMapBaseDirIs,sSrcMapBaseDirIs);
|
||||||
r(mtFatal,nUnitFileNotFound,sUnitFileNotFound);
|
r(mtFatal,nUnitFileNotFound,sUnitFileNotFound);
|
||||||
|
r(mtInfo,nInterfaceStyleIs,sInterfaceStyleIs);
|
||||||
Pas2jsPParser.RegisterMessages(Log);
|
Pas2jsPParser.RegisterMessages(Log);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3986,6 +4002,9 @@ begin
|
|||||||
l(' c : Support operators like C (*=,+=,/= and -=)');
|
l(' c : Support operators like C (*=,+=,/= and -=)');
|
||||||
l(' d : Same as -Mdelphi');
|
l(' d : Same as -Mdelphi');
|
||||||
l(' 2 : Same as -Mobjfpc (default)');
|
l(' 2 : Same as -Mobjfpc (default)');
|
||||||
|
l(' -SI<x> : Set interface style to <x>');
|
||||||
|
l(' -SIcom : COM compatible interface (default)');
|
||||||
|
l(' -SIcorba : CORBA compatible interface');
|
||||||
l(' -T<x> : Set target platform');
|
l(' -T<x> : Set target platform');
|
||||||
l(' -Tbrowser : default');
|
l(' -Tbrowser : default');
|
||||||
l(' -Tnodejs : add pas.run(), includes -Jc');
|
l(' -Tnodejs : add pas.run(), includes -Jc');
|
||||||
@ -4035,6 +4054,14 @@ var
|
|||||||
co: TP2jsCompilerOption;
|
co: TP2jsCompilerOption;
|
||||||
fco: TP2jsFileCacheOption;
|
fco: TP2jsFileCacheOption;
|
||||||
begin
|
begin
|
||||||
|
// message encoding
|
||||||
|
Log.LogMsgIgnoreFilter(nMessageEncodingIs,[IntToStr(Log.MsgCount)]);
|
||||||
|
// target platform
|
||||||
|
Log.LogMsgIgnoreFilter(nTargetPlatformIs,[PasToJsPlatformNames[TargetPlatform]]);
|
||||||
|
Log.LogMsgIgnoreFilter(nTargetProcessorIs,[PasToJsProcessorNames[TargetProcessor]]);
|
||||||
|
// default syntax mode
|
||||||
|
Log.LogMsgIgnoreFilter(nSyntaxModeIs,[p2jscModeNames[Mode]]);
|
||||||
|
Log.LogMsgIgnoreFilter(nInterfaceStyleIs,[InterfaceTypeNames[InterfaceType]]);
|
||||||
// boolean options
|
// boolean options
|
||||||
for co in TP2jsCompilerOption do
|
for co in TP2jsCompilerOption do
|
||||||
Log.LogMsgIgnoreFilter(nOptionIsEnabled,
|
Log.LogMsgIgnoreFilter(nOptionIsEnabled,
|
||||||
@ -4043,13 +4070,6 @@ begin
|
|||||||
Log.LogMsgIgnoreFilter(nOptionIsEnabled,
|
Log.LogMsgIgnoreFilter(nOptionIsEnabled,
|
||||||
[p2jsfcoCaption[fco],BoolToStr(fco in FileCache.Options,'enabled','disabled')]);
|
[p2jsfcoCaption[fco],BoolToStr(fco in FileCache.Options,'enabled','disabled')]);
|
||||||
|
|
||||||
// default syntax mode
|
|
||||||
Log.LogMsgIgnoreFilter(nSyntaxModeIs,[p2jscModeNames[Mode]]);
|
|
||||||
// target platform
|
|
||||||
Log.LogMsgIgnoreFilter(nTargetPlatformIs,[PasToJsPlatformNames[TargetPlatform]]);
|
|
||||||
Log.LogMsgIgnoreFilter(nTargetProcessorIs,[PasToJsProcessorNames[TargetProcessor]]);
|
|
||||||
// message encoding
|
|
||||||
Log.LogMsgIgnoreFilter(nMessageEncodingIs,[IntToStr(Log.MsgCount)]);
|
|
||||||
// source map options
|
// source map options
|
||||||
if SrcMapEnable then
|
if SrcMapEnable then
|
||||||
begin
|
begin
|
||||||
|
@ -186,6 +186,9 @@ Put + after a boolean switch option to enable it, - to disable it
|
|||||||
c : Support operators like C (*=,+=,/= and -=)
|
c : Support operators like C (*=,+=,/= and -=)
|
||||||
d : Same as -Mdelphi
|
d : Same as -Mdelphi
|
||||||
2 : Same as -Mobjfpc (default)
|
2 : Same as -Mobjfpc (default)
|
||||||
|
-SI<x> : Set interface style to <x>
|
||||||
|
-SIcom : COM compatible interface (default)
|
||||||
|
-SIcorba : CORBA compatible interface
|
||||||
-T<x> : Set target platform, case insensitive.
|
-T<x> : Set target platform, case insensitive.
|
||||||
-Tbrowser : default
|
-Tbrowser : default
|
||||||
-Tnodejs : add pas.run(), includes -Jc
|
-Tnodejs : add pas.run(), includes -Jc
|
||||||
@ -2403,6 +2406,7 @@ type
|
|||||||
public
|
public
|
||||||
Id: NativeInt; external name '$Id';
|
Id: NativeInt; external name '$Id';
|
||||||
x: NativeInt; external name '[0]';
|
x: NativeInt; external name '[0]';
|
||||||
|
y: NativeInt; external name '["A B"]';
|
||||||
function GetState(typ: longint): NativeInt; external name '$Handle.GetState';
|
function GetState(typ: longint): NativeInt; external name '$Handle.GetState';
|
||||||
procedure DoIt;
|
procedure DoIt;
|
||||||
end;
|
end;
|
||||||
@ -2415,7 +2419,8 @@ var
|
|||||||
Begin
|
Begin
|
||||||
W.Id := 2;
|
W.Id := 2;
|
||||||
W.x := 3;
|
W.x := 3;
|
||||||
W.GetState(4);
|
W.y := 4;
|
||||||
|
W.GetState(5);
|
||||||
End.
|
End.
|
||||||
</pre>
|
</pre>
|
||||||
</td>
|
</td>
|
||||||
@ -2433,7 +2438,8 @@ function(){
|
|||||||
$mod.$main = function(){
|
$mod.$main = function(){
|
||||||
$mod.W.$Id = 2;
|
$mod.W.$Id = 2;
|
||||||
$mod.W[0] = 3;
|
$mod.W[0] = 3;
|
||||||
$mod.W.$Handle.GetState(4);
|
$mod.W["A B"] = 4;
|
||||||
|
$mod.W.$Handle.GetState(5);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
[]);
|
[]);
|
||||||
|
Loading…
Reference in New Issue
Block a user