* PChar -> PAnsiChar

This commit is contained in:
Michaël Van Canneyt 2023-01-13 23:44:50 +01:00
parent 4a15ca0cbe
commit 9c680b6669
9 changed files with 31 additions and 31 deletions

View File

@ -375,7 +375,7 @@ begin
if (ALine<>'') then if (ALine<>'') then
S:=StringOfChar(' ',FIndent)+ALine; S:=StringOfChar(' ',FIndent)+ALine;
S:=S+sLineBreak; S:=S+sLineBreak;
FStream.WriteBuffer(S[1],Length(s)*SizeOf(Char)); FStream.WriteBuffer(S[1],Length(s)*SizeOf(AnsiChar));
end; end;
procedure TCustomPasGenerator.Line(const Fmt: String; Args: array of const); procedure TCustomPasGenerator.Line(const Fmt: String; Args: array of const);

View File

@ -150,7 +150,7 @@ type
{$IFDEF USE_UNICODE} {$IFDEF USE_UNICODE}
TSDOChar = WideChar; TSDOChar = WideChar;
{$ELSE USE_UNICODE} {$ELSE USE_UNICODE}
TSDOChar = Char; TSDOChar = AnsiChar;
{$ENDIF USE_UNICODE} {$ENDIF USE_UNICODE}
{$ENDIF HAS_SDO_CHAR} {$ENDIF HAS_SDO_CHAR}
{$IFDEF HAS_SDO_CURRENCY} {$IFDEF HAS_SDO_CURRENCY}
@ -300,13 +300,13 @@ type
['{76F00A3A-A6F8-4D78-8514-570207853453}'] ['{76F00A3A-A6F8-4D78-8514-570207853453}']
{ getName returns the name of the type { getName returns the name of the type
* *
* This method returns a const char* name of the type. * This method returns a const AnsiChar* name of the type.
} }
function getName() : string; function getName() : string;
{ getAlias returns the n'th alias { getAlias returns the n'th alias
* *
* This method returns a const char* corresponding to the * This method returns a const AnsiChar* corresponding to the
* alias at index n of the list of aliases. Use getAliasCount to * alias at index n of the list of aliases. Use getAliasCount to
* discover the size of the list. * discover the size of the list.
} }
@ -434,7 +434,7 @@ type
{ getAlias returns the n'th alias { getAlias returns the n'th alias
* *
* This method returns a const char* corresponding to the * This method returns a const AnsiChar* corresponding to the
* alias at index n of the list of aliases. Use getAliasCount to * alias at index n of the list of aliases. Use getAliasCount to
* discover the size of the list. * discover the size of the list.
} }
@ -851,7 +851,7 @@ type
procedure setBoolean(const APropertyIndex : PtrUInt; const AValue : TSDOBoolean); overload; procedure setBoolean(const APropertyIndex : PtrUInt; const AValue : TSDOBoolean); overload;
procedure setBoolean(const AProperty : ISDOProperty; const AValue : TSDOBoolean); overload; procedure setBoolean(const AProperty : ISDOProperty; const AValue : TSDOBoolean); overload;
{ getByte returns a char by path, index or property { getByte returns a AnsiChar by path, index or property
* *
* Returns the value of a property of either this object or an object * Returns the value of a property of either this object or an object
* reachable from it, as identified by the specified path. * reachable from it, as identified by the specified path.
@ -912,7 +912,7 @@ type
procedure setBytes(const AProperty : ISDOProperty; AValue : TSDOBytes);overload; procedure setBytes(const AProperty : ISDOProperty; AValue : TSDOBytes);overload;
{$ENDIF HAS_SDO_BYTES} {$ENDIF HAS_SDO_BYTES}
{ getString returns a wide char buffer { getString returns a wide AnsiChar buffer
* *
* A DataObject of type String holds an array of wide characters as its value. These * A DataObject of type String holds an array of wide characters as its value. These
* methods transfer the contents of that buffer into an array of wchar_t allocated * methods transfer the contents of that buffer into an array of wchar_t allocated
@ -1068,11 +1068,11 @@ type
* just a place to store anything for later retrieval. * just a place to store anything for later retrieval.
} }
{virtual SDO_API void setUserData(const char* path,void* value) = 0; {virtual SDO_API void setUserData(const AnsiChar* path,void* value) = 0;
virtual SDO_API void setUserData(unsigned int propertyIndex, void* value) = 0; virtual SDO_API void setUserData(unsigned int propertyIndex, void* value) = 0;
virtual SDO_API void setUserData(const Property& property, void* value) = 0; virtual SDO_API void setUserData(const Property& property, void* value) = 0;
virtual SDO_API void setUserData(void* value) = 0; virtual SDO_API void setUserData(void* value) = 0;
virtual SDO_API void* getUserData(const char* path) = 0; virtual SDO_API void* getUserData(const AnsiChar* path) = 0;
virtual SDO_API void* getUserData(unsigned int propertyIndex) = 0; virtual SDO_API void* getUserData(unsigned int propertyIndex) = 0;
virtual SDO_API void* getUserData(const Property& property) = 0; virtual SDO_API void* getUserData(const Property& property) = 0;
virtual SDO_API void* getUserData() = 0; virtual SDO_API void* getUserData() = 0;
@ -1085,7 +1085,7 @@ type
} }
{virtual SDO_API SequencePtr getSequence() = 0; {virtual SDO_API SequencePtr getSequence() = 0;
virtual SDO_API SequencePtr getSequence(const char* path) = 0; virtual SDO_API SequencePtr getSequence(const AnsiChar* path) = 0;
virtual SDO_API SequencePtr getSequence(unsigned int propertyIndex) = 0; virtual SDO_API SequencePtr getSequence(unsigned int propertyIndex) = 0;
virtual SDO_API SequencePtr getSequence(const Property& property) = 0; virtual SDO_API SequencePtr getSequence(const Property& property) = 0;
} }
@ -1155,7 +1155,7 @@ type
* object from the root data object of the graph. * object from the root data object of the graph.
} }
//virtual SDO_SPI const char* objectToXPath() = 0; //virtual SDO_SPI const AnsiChar* objectToXPath() = 0;
end; end;

View File

@ -531,7 +531,7 @@ end;
//--------------- END: Byte procs ----------------------------- //--------------- END: Byte procs -----------------------------
{$IFDEF HAS_SDO_BYTES} {$IFDEF HAS_SDO_BYTES}
//--------------- START : Char procs ----------------------------- //--------------- START : AnsiChar procs -----------------------------
procedure listUndo_append_bytes(const AList : ISDODataObjectList; const AItm : TManyValuePropRecordData); procedure listUndo_append_bytes(const AList : ISDODataObjectList; const AItm : TManyValuePropRecordData);
begin begin
if not AList.getCursor().MoveLast() then if not AList.getCursor().MoveLast() then
@ -574,7 +574,7 @@ end;
{$ENDIF HAS_SDO_BYTES} {$ENDIF HAS_SDO_BYTES}
{$IFDEF HAS_SDO_CHAR} {$IFDEF HAS_SDO_CHAR}
//--------------- START : Char procs ----------------------------- //--------------- START : AnsiChar procs -----------------------------
procedure listUndo_append_char(const AList : ISDODataObjectList; const AItm : TManyValuePropRecordData); procedure listUndo_append_char(const AList : ISDODataObjectList; const AItm : TManyValuePropRecordData);
begin begin
if not AList.getCursor().MoveLast() then if not AList.getCursor().MoveLast() then
@ -613,7 +613,7 @@ begin
raise ESDOInvalidStateOperationException.Create('listUndo_change_char'); raise ESDOInvalidStateOperationException.Create('listUndo_change_char');
AList.setCharacter(AItm.Index,AItm.Value.CharValue); AList.setCharacter(AItm.Index,AItm.Value.CharValue);
end; end;
//--------------- END: Char procs ----------------------------- //--------------- END: AnsiChar procs -----------------------------
{$ENDIF HAS_SDO_CHAR} {$ENDIF HAS_SDO_CHAR}
{$IFDEF HAS_SDO_CURRENCY} {$IFDEF HAS_SDO_CURRENCY}

View File

@ -244,7 +244,7 @@ var
buffer : string; buffer : string;
bufferPos, bufferLen : Integer; bufferPos, bufferLen : Integer;
function ReadInt(out AValue : Integer; const ASeparatorAtEnd : Char) : Boolean; function ReadInt(out AValue : Integer; const ASeparatorAtEnd : AnsiChar) : Boolean;
var var
locStartPos : Integer; locStartPos : Integer;
begin begin
@ -482,7 +482,7 @@ var
buffer : string; buffer : string;
bufferPos, bufferLen : Integer; bufferPos, bufferLen : Integer;
function ReadInt(out AValue : Integer; const ASeparatorAtEnd : Char) : Boolean; function ReadInt(out AValue : Integer; const ASeparatorAtEnd : AnsiChar) : Boolean;
var var
locStartPos : Integer; locStartPos : Integer;
begin begin
@ -650,7 +650,7 @@ function xsd_TryStrToDuration(
out AResult : TDurationRec out AResult : TDurationRec
) : Boolean; ) : Boolean;
var var
pc : PChar; pc : PAnsiChar;
locIntBuffer : array[dpYear..dpFractionalSecond] of PtrUInt; locIntBuffer : array[dpYear..dpFractionalSecond] of PtrUInt;
i, bufferLength, lastPos : PtrInt; i, bufferLength, lastPos : PtrInt;
localBuffer : string; localBuffer : string;
@ -662,7 +662,7 @@ begin
bufferLength := Length(ABuffer); bufferLength := Length(ABuffer);
if ( bufferLength < 3 ) then if ( bufferLength < 3 ) then
Exit; Exit;
pc := PChar(ABuffer); pc := PAnsiChar(ABuffer);
i := 1; i := 1;
isNeg := False; isNeg := False;
if ( pc^ = '-' ) then begin if ( pc^ = '-' ) then begin

View File

@ -159,7 +159,7 @@ function StringToVarBytes(const AValue : string) : TSDOBytes;
var var
c : Integer; c : Integer;
begin begin
c := Length(AValue) * SizeOf(Char); c := Length(AValue) * SizeOf(AnsiChar);
SetLength(Result,c); SetLength(Result,c);
if ( c > 0 ) then if ( c > 0 ) then
Move(AValue[1],Result[Low(Result)],c); Move(AValue[1],Result[Low(Result)],c);

View File

@ -106,7 +106,7 @@ uses StrUtils, sdo_rtti_filters;
const LANGAGE_TOKEN : array[0..127] of string = ( const LANGAGE_TOKEN : array[0..127] of string = (
'ABSOLUTE', 'ABSTRACT', 'AND', 'ARRAY', 'AS', 'ASM', 'ABSOLUTE', 'ABSTRACT', 'AND', 'ARRAY', 'AS', 'ASM',
'BEGIN', 'BOOLEAN', 'BYTE', 'BEGIN', 'BOOLEAN', 'BYTE',
'CASE', 'CDECL', 'CHAR', 'CLASS', 'COMP', 'CONST', 'CONSTRUCTOR', 'CONTAINS', 'CASE', 'CDECL', 'AnsiChar', 'CLASS', 'COMP', 'CONST', 'CONSTRUCTOR', 'CONTAINS',
'CURRENCY', 'DEFAULT', 'DEPRECATED', 'DESTRUCTOR', 'DISPINTERFACE', 'DISPOSE', 'DIV', 'DO', 'CURRENCY', 'DEFAULT', 'DEPRECATED', 'DESTRUCTOR', 'DISPINTERFACE', 'DISPOSE', 'DIV', 'DO',
'DOUBLE', 'DOWNTO', 'DYNAMIC', 'END', 'EXCEPT', 'EXIT', 'EXPORT', 'EXPORTS', 'DOUBLE', 'DOWNTO', 'DYNAMIC', 'END', 'EXCEPT', 'EXIT', 'EXPORT', 'EXPORTS',
'EXTERNAL', 'FALSE', 'FAR', 'FILE', 'FINALIZATION', 'FINALLY', 'FOR', 'EXTERNAL', 'FALSE', 'FAR', 'FILE', 'FINALIZATION', 'FINALLY', 'FOR',
@ -116,7 +116,7 @@ const LANGAGE_TOKEN : array[0..127] of string = (
'LABEL', 'LIBRARY', 'LOCAL', 'LONGINT', 'LONGWORD', 'LABEL', 'LIBRARY', 'LOCAL', 'LONGINT', 'LONGWORD',
'MOD', 'NEAR', 'NEW', 'NIL', 'NODEFAULT', 'NOT', 'MOD', 'NEAR', 'NEW', 'NIL', 'NODEFAULT', 'NOT',
'OBJECT', 'OF', 'OLEVARIANT', 'ON', 'OPERATOR', 'OR', 'OUT', 'OVERLOAD', 'OBJECT', 'OF', 'OLEVARIANT', 'ON', 'OPERATOR', 'OR', 'OUT', 'OVERLOAD',
'OVERRIDE','PACKAGE', 'PACKED', 'PASCAL', 'PCHAR', 'PRIVATE', 'PROCEDURE', 'OVERRIDE','PACKAGE', 'PACKED', 'PASCAL', 'PAnsiChar', 'PRIVATE', 'PROCEDURE',
'PROGRAM', 'PROPERTY', 'PROTECTED', 'PUBLIC', 'PUBLISHED', 'PROGRAM', 'PROPERTY', 'PROTECTED', 'PUBLIC', 'PUBLISHED',
'RAISE', 'READ', 'REAL', 'RECORD', 'REGISTER', 'REINTRODUCE', 'REPEAT', 'RAISE', 'READ', 'REAL', 'RECORD', 'REGISTER', 'REINTRODUCE', 'REPEAT',
'REQUIRES', 'RESOURCESTRING', 'RESULT', 'SAFECALL', 'SELF', 'SET', 'SHL', 'REQUIRES', 'RESOURCESTRING', 'RESULT', 'SAFECALL', 'SELF', 'SET', 'SHL',
@ -128,8 +128,8 @@ const LANGAGE_TOKEN : array[0..127] of string = (
const SDO_RESERVED_TOKEN : array[0..1] of string = ( 'Item', 'Item' ); const SDO_RESERVED_TOKEN : array[0..1] of string = ( 'Item', 'Item' );
function IsReservedKeyWord(const AValue : string):Boolean ; function IsReservedKeyWord(const AValue : string):Boolean ;
begin begin
Result := AnsiMatchText(AValue,LANGAGE_TOKEN) or Result := MatchText(AValue,LANGAGE_TOKEN) or
AnsiMatchText(AValue,SDO_RESERVED_TOKEN); MatchText(AValue,SDO_RESERVED_TOKEN);
end; end;
function IsStrEmpty(Const AStr : String):Boolean; function IsStrEmpty(Const AStr : String):Boolean;
@ -212,11 +212,11 @@ end;
function DecodeLineBreak(const AInStr : string) : string; function DecodeLineBreak(const AInStr : string) : string;
var var
i, c : PtrInt; i, c : PtrInt;
pc : PChar; pc : PAnsiChar;
tmp, res : string; tmp, res : string;
begin begin
res := ''; res := '';
pc := PChar(AInStr); pc := PAnsiChar(AInStr);
i := 1; i := 1;
c := Length(AInStr); c := Length(AInStr);
while ( i <= c ) do begin while ( i <= c ) do begin
@ -238,7 +238,7 @@ begin
tmp := res; tmp := res;
res := ''; res := '';
pc := PChar(tmp); pc := PAnsiChar(tmp);
i := 1; i := 1;
c := Length(tmp); c := Length(tmp);
while ( i <= c ) do begin while ( i <= c ) do begin

View File

@ -734,7 +734,7 @@ end;
constructor TSDOCharacterType.Create(const AOwner : ISDODataFactory); constructor TSDOCharacterType.Create(const AOwner : ISDODataFactory);
begin begin
inherited Create(AOwner, 'Character',sdo_namespace); inherited Create(AOwner, 'Character',sdo_namespace);
setAlias('Char'); setAlias('AnsiChar');
setAlias('WideChar'); setAlias('WideChar');
setAlias('AnsiChar'); setAlias('AnsiChar');
end; end;

View File

@ -88,9 +88,9 @@ begin
SetLength(Result,l); SetLength(Result,l);
for i := 1 to l do begin for i := 1 to l do begin
case j of case j of
1 : Result[i] := Char(RandomRange(Ord('a'),Ord('z'))); 1 : Result[i] := AnsiChar(RandomRange(Ord('a'),Ord('z')));
2 : Result[i] := Char(RandomRange(Ord('0'),Ord('9'))); 2 : Result[i] := AnsiChar(RandomRange(Ord('0'),Ord('9')));
3 : Result[i] := Char(RandomRange(Ord('A'),Ord('Z'))); 3 : Result[i] := AnsiChar(RandomRange(Ord('A'),Ord('Z')));
end; end;
j := ( j + 1 ); j := ( j + 1 );
if ( j > 3 ) then if ( j > 3 ) then

View File

@ -682,7 +682,7 @@ end;
procedure TUtilsProc_Test.GetNextToken_test(); procedure TUtilsProc_Test.GetNextToken_test();
var var
buffer, x : string; buffer, x : string;
sep : Char; sep : AnsiChar;
begin begin
sep := ';'; sep := ';';
buffer := ''; buffer := '';