fcl-passrc: support for syscall functions, parameter location, HASAMIGA define

git-svn-id: trunk@31168 -
This commit is contained in:
marcus 2015-06-28 18:49:53 +00:00
parent 4eaf1ffa48
commit 09addc9e78
3 changed files with 25 additions and 5 deletions

View File

@ -91,7 +91,7 @@ type
visPublished, visAutomated,
visStrictPrivate, visStrictProtected);
TCallingConvention = (ccDefault,ccRegister,ccPascal,ccCDecl,ccStdCall,ccOldFPCCall,ccSafeCall);
TCallingConvention = (ccDefault,ccRegister,ccPascal,ccCDecl,ccStdCall,ccOldFPCCall,ccSafeCall,ccSysCall);
TPackMode = (pmNone,pmPacked,pmBitPacked);
TPasMemberVisibilities = set of TPasMemberVisibility;
@ -1183,7 +1183,7 @@ const
cPasMemberHint : array[TPasMemberHint] of string =
( 'deprecated', 'library', 'platform', 'experimental', 'unimplemented' );
cCallingConventions : array[TCallingConvention] of string =
( '', 'Register','Pascal','CDecl','StdCall','OldFPCCall','SafeCall');
( '', 'Register','Pascal','CDecl','StdCall','OldFPCCall','SafeCall','SysCall');
ModifierNames : Array[TProcedureModifier] of string
= ('virtual', 'dynamic','abstract', 'override',

View File

@ -307,7 +307,7 @@ Function IsCallingConvention(S : String; out CC : TCallingConvention) : Boolean;
Var
CCNames : Array[TCallingConvention] of String
= ('','register','pascal','cdecl','stdcall','oldfpccall','safecall');
= ('','register','pascal','cdecl','stdcall','oldfpccall','safecall','syscall');
Var
C : TCallingConvention;
@ -443,7 +443,13 @@ begin
else if s = 'BEOS' then
Scanner.AddDefine('UNIX')
else if s = 'QNX' then
Scanner.AddDefine('UNIX');
Scanner.AddDefine('UNIX')
else if s = 'AROS' then
Scanner.AddDefine('HASAMIGA')
else if s = 'MORPHOS' then
Scanner.AddDefine('HASAMIGA')
else if s = 'AMIGA' then
Scanner.AddDefine('HASAMIGA');
// TargetCPU
s := UpperCase(CPUTarget);
@ -2676,6 +2682,11 @@ begin
end;
NextToken;
if (CurToken = tkIdentifier) and (LowerCase(CurTokenString) = 'location') then
begin
NextToken; // remove 'location'
NextToken; // remove register
end;
if CurToken = EndToken then
break;
end;
@ -2905,6 +2916,15 @@ begin
begin
if Assigned(Element) then // !!!
Element.CallingConvention:=Cc;
if cc = ccSysCall then
begin
// remove LibBase
NextToken;
// remove legacy or basesysv on MorphOS syscalls
if CurTokenIsIdentifier('legacy') or CurTokenIsIdentifier('BaseSysV') then
NextToken;
NextToken; // remove offset
end;
ExpectToken(tkSemicolon);
end
else if TokenIsProcedureModifier(Parent,CurTokenString,pm) then

View File

@ -1647,7 +1647,7 @@ begin
else if Param[1]='%' then
begin
fcurtokenstring:='{$i '+param+'}';
fcurtoken:=tkstring;
fcurtoken:=tkstring;
result:=fcurtoken;
exit;
end