codetools: c paresers: implemented function with return type pointer

git-svn-id: trunk@15917 -
This commit is contained in:
mattias 2008-07-30 09:56:31 +00:00
parent aad576fab2
commit cb341f3456
2 changed files with 9 additions and 6 deletions

View File

@ -905,8 +905,11 @@ procedure TCCodeParserTool.ReadVariable(AsParameter: boolean);
return memcmp(ba1, ba2, sizeof(bdaddr_t));
}
bdaddr_t *strtoba(const char *str);
*)
{
const char* (*item_name)(void* ctx);
int (*fp)(char*); // pointer to function taking a char* argument; returns an int
int * f(char*); // function taking a char* argument; returns a pointer to int
@ -976,6 +979,10 @@ begin
// read name
ReadNextAtom;
while AtomIsChar('*') or AtomIs('const') do begin
// pointer or const
ReadNextAtom;
end;
if AtomIs('operator') then begin
if AsParameter then
RaiseException('operator not allowed as parameter');
@ -1012,11 +1019,6 @@ begin
if not AtomIsChar(')') then
RaiseExpectedButAtomFound(')');
end else begin
while AtomIsChar('*') or AtomIs('const') do begin
// pointer or const
ReadNextAtom;
end;
{$IFDEF VerboseCCodeParser}
DebugLn(['TCCodeParserTool.ReadVariable name=',GetAtom]);
{$ENDIF}
@ -2047,7 +2049,6 @@ begin
exit;
end;
Result:=IfNDefNode;
DebugLn(['TCCodeParserTool.FindEnclosingIFNDEF ']);
end;
function TCCodeParserTool.GetAtom: string;

View File

@ -166,6 +166,8 @@ static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2)
typedef unsigned short sa_family_t;
int hci_inquiry(int dev_id, int len, int num_rsp, const uint8_t *lap, inquiry_info **ii, long flags);
const char* (*item_name)(void* ctx);
#ifdef __cplusplus
}
#endif