mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 00:09:31 +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';
|
||||
nSrcMapBaseDirIs = 135; sSrcMapBaseDirIs = 'source map "local base directory" is %s';
|
||||
nUnitFileNotFound = 136; sUnitFileNotFound = 'unit file not found "%s"';
|
||||
nInterfaceStyleIs = 137; sInterfaceStyleIs = 'Interface style is %s';
|
||||
// Note: error numbers 201+ are used by Pas2jsFileCache
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -410,6 +411,7 @@ type
|
||||
procedure SetTargetProcessor(const AValue: TPasToJsProcessor);
|
||||
procedure SetWriteMsgToStdErr(const AValue: boolean);
|
||||
private
|
||||
FInterfaceType: TPasClassInterfaceType;
|
||||
FPrecompileInitialFlags: TPCUInitialFlags;
|
||||
procedure AddDefinesForTargetPlatform;
|
||||
procedure AddDefinesForTargetProcessor;
|
||||
@ -490,6 +492,7 @@ type
|
||||
property FileCache: TPas2jsFilesCache read FFileCache write SetFileCache;
|
||||
property FileCacheAutoFree: boolean read FFileCacheAutoFree write FFileCacheAutoFree;
|
||||
property FileCount: integer read GetFileCount;
|
||||
property InterfaceType: TPasClassInterfaceType read FInterfaceType write FInterfaceType;
|
||||
property Log: TPas2jsLogger read FLog;
|
||||
property MainFile: TPas2jsCompilerFile read FMainFile;
|
||||
property Mode: TP2jsMode read FMode write SetMode;
|
||||
@ -842,6 +845,11 @@ begin
|
||||
Scanner.CurrentModeSwitches:=GetInitialModeSwitches;
|
||||
Scanner.AllowedBoolSwitches:=msAllPas2jsBoolSwitches;
|
||||
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
|
||||
for i:=0 to Compiler.Defines.Count-1 do
|
||||
begin
|
||||
@ -851,10 +859,6 @@ begin
|
||||
else
|
||||
Scanner.AddMacro(M.Name,M.Value);
|
||||
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.LogEvents:=PascalResolver.ParserLogEvents;
|
||||
@ -3320,7 +3324,7 @@ begin
|
||||
inc(p);
|
||||
Identifier:=String(p);
|
||||
for aProc in TPasToJsProcessor do
|
||||
if CompareText(Identifier,PasToJsProcessorNames[aProc])=0 then
|
||||
if SameText(Identifier,PasToJsProcessorNames[aProc]) then
|
||||
begin
|
||||
TargetProcessor:=aProc;
|
||||
Identifier:='';
|
||||
@ -3332,14 +3336,25 @@ begin
|
||||
'S': // Syntax
|
||||
begin
|
||||
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;
|
||||
'T': // target platform
|
||||
begin
|
||||
inc(p);
|
||||
Identifier:=String(p);
|
||||
for aPlatform in TPasToJsPlatform do
|
||||
if CompareText(Identifier,PasToJsPlatformNames[aPlatform])=0 then
|
||||
if SameText(Identifier,PasToJsPlatformNames[aPlatform]) then
|
||||
begin
|
||||
TargetPlatform:=aPlatform;
|
||||
Identifier:='';
|
||||
@ -3598,6 +3613,7 @@ begin
|
||||
r(mtInfo,nSrcMapSourceRootIs,sSrcMapSourceRootIs);
|
||||
r(mtInfo,nSrcMapBaseDirIs,sSrcMapBaseDirIs);
|
||||
r(mtFatal,nUnitFileNotFound,sUnitFileNotFound);
|
||||
r(mtInfo,nInterfaceStyleIs,sInterfaceStyleIs);
|
||||
Pas2jsPParser.RegisterMessages(Log);
|
||||
end;
|
||||
|
||||
@ -3986,6 +4002,9 @@ begin
|
||||
l(' c : Support operators like C (*=,+=,/= and -=)');
|
||||
l(' d : Same as -Mdelphi');
|
||||
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(' -Tbrowser : default');
|
||||
l(' -Tnodejs : add pas.run(), includes -Jc');
|
||||
@ -4035,6 +4054,14 @@ var
|
||||
co: TP2jsCompilerOption;
|
||||
fco: TP2jsFileCacheOption;
|
||||
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
|
||||
for co in TP2jsCompilerOption do
|
||||
Log.LogMsgIgnoreFilter(nOptionIsEnabled,
|
||||
@ -4043,13 +4070,6 @@ begin
|
||||
Log.LogMsgIgnoreFilter(nOptionIsEnabled,
|
||||
[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
|
||||
if SrcMapEnable then
|
||||
begin
|
||||
|
@ -186,6 +186,9 @@ Put + after a boolean switch option to enable it, - to disable it
|
||||
c : Support operators like C (*=,+=,/= and -=)
|
||||
d : Same as -Mdelphi
|
||||
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.
|
||||
-Tbrowser : default
|
||||
-Tnodejs : add pas.run(), includes -Jc
|
||||
@ -2403,6 +2406,7 @@ type
|
||||
public
|
||||
Id: NativeInt; external name '$Id';
|
||||
x: NativeInt; external name '[0]';
|
||||
y: NativeInt; external name '["A B"]';
|
||||
function GetState(typ: longint): NativeInt; external name '$Handle.GetState';
|
||||
procedure DoIt;
|
||||
end;
|
||||
@ -2415,7 +2419,8 @@ var
|
||||
Begin
|
||||
W.Id := 2;
|
||||
W.x := 3;
|
||||
W.GetState(4);
|
||||
W.y := 4;
|
||||
W.GetState(5);
|
||||
End.
|
||||
</pre>
|
||||
</td>
|
||||
@ -2433,7 +2438,8 @@ function(){
|
||||
$mod.$main = function(){
|
||||
$mod.W.$Id = 2;
|
||||
$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