mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-31 01:47:43 +02:00
codetools: h2p: implemented converting c octal numbers
git-svn-id: trunk@14649 -
This commit is contained in:
parent
647adc1d77
commit
aeceb42992
@ -103,6 +103,7 @@ struct hidp_connlist_req {
|
||||
#define SDP_PSM 0x0001
|
||||
#define SDP_PRIMARY_LANG_BASE 0x0100
|
||||
#define SDP_ATTR_SVCNAME_PRIMARY 0x0000 + SDP_PRIMARY_LANG_BASE
|
||||
#define AnOctal 0001
|
||||
|
||||
typedef struct {
|
||||
uint8_t type; // invalid pascal name
|
||||
|
@ -1425,10 +1425,13 @@ begin
|
||||
end else if IsCHexNumber(PasExpression,AtomStart) then begin
|
||||
// hex number
|
||||
// replace 0x with $
|
||||
DebugLn(['TH2PasTool.MacroValueIsConstant AAA2']);
|
||||
PasExpression:=copy(PasExpression,1,AtomStart-1)
|
||||
+'$'+copy(PasExpression,AtomStart+2,length(PasExpression));
|
||||
dec(p);
|
||||
end else if IsCOctalNumber(PasExpression,AtomStart) then begin
|
||||
// octal number
|
||||
// replace 0 with &
|
||||
PasExpression[AtomStart]:='&';
|
||||
end else if IsCDecimalNumber(PasExpression,AtomStart) then begin
|
||||
// decimal number
|
||||
end else if PasExpression[AtomStart]='"' then begin
|
||||
|
@ -44,6 +44,7 @@ procedure ReadRawNextCAtom(const Source: string;
|
||||
var Position: integer; out AtomStart: integer);
|
||||
function IsCDecimalNumber(const Source: string; Position: integer): boolean;
|
||||
function IsCHexNumber(const Source: string; Position: integer): boolean;
|
||||
function IsCOctalNumber(const Source: string; Position: integer): boolean;
|
||||
|
||||
function ExtractCodeFromMakefile(const Source: string): string;
|
||||
|
||||
@ -386,6 +387,12 @@ begin
|
||||
and (Source[Position]='0') and (Source[Position+1]='x');
|
||||
end;
|
||||
|
||||
function IsCOctalNumber(const Source: string; Position: integer): boolean;
|
||||
begin
|
||||
Result:=(Position>=1) and (Position<length(Source))
|
||||
and (Source[Position]='0') and (Source[Position+1] in ['0'..'7']);
|
||||
end;
|
||||
|
||||
function ExtractCodeFromMakefile(const Source: string): string;
|
||||
// remove comments, empty lines, double spaces, replace newline chars with #10
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user