Browse Source

* PChar -> PAnsiChar

Michaël Van Canneyt 2 years ago
parent
commit
a4e8a15c70

+ 8 - 8
utils/fpdoc/dw_basehtml.pp

@@ -99,11 +99,11 @@ type
     Procedure SetHTMLDocument(aDoc : THTMLDocument);
     procedure PushOutputNode(ANode: TDOMNode);
     procedure PopOutputNode;
-    procedure AppendText(Parent: TDOMNode; const AText: String);
+    procedure AppendText(Parent: TDOMNode; const AText: AnsiString);
     procedure AppendText(Parent: TDOMNode; const AText: DOMString);
     procedure AppendNbSp(Parent: TDOMNode; ACount: Integer);
     procedure AppendSym(Parent: TDOMNode; const AText: DOMString);
-    procedure AppendKw(Parent: TDOMNode; const AText: String);
+    procedure AppendKw(Parent: TDOMNode; const AText: AnsiString);
     procedure AppendKw(Parent: TDOMNode; const AText: DOMString);
     function  AppendPasSHFragment(Parent: TDOMNode; const AText: String; AShFlags: Byte): Byte;
     procedure AppendFragment(aParentNode: TDOMElement; aStream: TStream);
@@ -116,7 +116,7 @@ type
     procedure AppendShortDescrCell(Parent: TDOMNode; Element: TPasElement);
     procedure AppendDescr(AContext: TPasElement; Parent: TDOMNode; DescrNode: TDOMElement; AutoInsertBlock: Boolean);
     procedure AppendDescrSection(AContext: TPasElement; Parent: TDOMNode; DescrNode: TDOMElement; const ATitle: DOMString);
-    procedure AppendDescrSection(AContext: TPasElement; Parent: TDOMNode; DescrNode: TDOMElement; const ATitle: String);
+    procedure AppendDescrSection(AContext: TPasElement; Parent: TDOMNode; DescrNode: TDOMElement; const ATitle: AnsiString);
     function AppendHyperlink(Parent: TDOMNode; Element: TPasElement): TDOMElement;
 
     // Helper functions for creating DOM elements
@@ -131,7 +131,7 @@ type
     function CreateTR(Parent: TDOMNode): THTMLElement;
     function CreateTD(Parent: TDOMNode): THTMLElement;
     function CreateTD_vtop(Parent: TDOMNode): THTMLElement;
-    function CreateLink(Parent: TDOMNode; const AHRef: String): THTMLElement;
+    function CreateLink(Parent: TDOMNode; const AHRef: AnsiString): THTMLElement;
     function CreateLink(Parent: TDOMNode; const AHRef: DOMString): THTMLElement;
     function CreateAnchor(Parent: TDOMNode; const AName: DOMString): THTMLElement;
     function CreateCode(Parent: TDOMNode): THTMLElement;
@@ -244,7 +244,7 @@ begin
   Result['valign'] := 'top';
 end;
 
-function TBaseHTMLWriter.CreateLink(Parent: TDOMNode; const AHRef: String): THTMLElement;
+function TBaseHTMLWriter.CreateLink(Parent: TDOMNode; const AHRef: AnsiString): THTMLElement;
 begin
   Result := CreateEl(Parent, 'a');
   Result['href'] := UTF8Decode(FixHtmlPath(AHRef));
@@ -648,7 +648,7 @@ begin
   FCurOutputNode:=Nil;
 end;
 
-procedure TBaseHTMLWriter.AppendText(Parent: TDOMNode; const AText: String);
+procedure TBaseHTMLWriter.AppendText(Parent: TDOMNode; const AText: AnsiString);
 begin
   AppendText(Parent,UTF8Decode(aText));
 end;
@@ -677,7 +677,7 @@ begin
   AppendText(El, AText);
 end;
 
-procedure TBaseHTMLWriter.AppendKw(Parent: TDOMNode; const AText: String);
+procedure TBaseHTMLWriter.AppendKw(Parent: TDOMNode; const AText: AnsiString);
 begin
   AppendKW(Parent,UTF8Decode(aText));
 end;
@@ -970,7 +970,7 @@ begin
   end;
 end;
 
-procedure TBaseHTMLWriter.AppendDescrSection(AContext: TPasElement; Parent: TDOMNode; DescrNode: TDOMElement; const ATitle: String);
+procedure TBaseHTMLWriter.AppendDescrSection(AContext: TPasElement; Parent: TDOMNode; DescrNode: TDOMElement; const ATitle: AnsiString);
 begin
   AppendDescrSection(aContext,Parent,DescrNode,UTF8Decode(aTitle));
 end;

+ 4 - 4
utils/fpdoc/dw_basemd.pp

@@ -119,8 +119,8 @@ Type
   Protected
     // Emit current line, if any
     Function OutputCurrentLine : Boolean;
-    function EscapeMarkDown(aText: Domstring): string;
-    function EscapeMarkDown(aText: String): string;
+    function EscapeMarkDown(aText: Domstring): Ansistring;
+    function EscapeMarkDown(aText: AnsiString): Ansistring;
     function CreateLink(Const aText,aLink : String) : String;
     function GetListPrefix: String;virtual;
 
@@ -227,13 +227,13 @@ begin
   EnsureEmptyLine;
 end;
 
-function TBaseMarkdownWriter.EscapeMarkDown(aText: Domstring): string;
+function TBaseMarkdownWriter.EscapeMarkDown(aText: Domstring): Ansistring;
 
 begin
   Result:=EscapeMarkDown(UTF8Encode(aText))
 end;
 
-function TBaseMarkdownWriter.EscapeMarkDown(aText: String): string;
+function TBaseMarkdownWriter.EscapeMarkDown(aText: AnsiString): Ansistring;
 begin
   Result:=StringReplace(aText,'*','\*',[rfReplaceAll]);
   Result:=StringReplace(Result,'_','\_',[rfReplaceAll]);

+ 2 - 2
utils/fpdoc/dw_html.pp

@@ -50,7 +50,7 @@ type
 
     procedure CreateCSSFile; virtual;
 
-    procedure AppendTitle(const AText: String; Hints : TPasMemberHints = []); virtual;
+    procedure AppendTitle(const AText: AnsiString; Hints : TPasMemberHints = []); virtual;
     procedure AppendTitle(const AText: DOMString; Hints : TPasMemberHints = []); virtual;
     function AppendType(CodeEl, TableEl: TDOMElement;
       Element: TPasType; Expanded: Boolean;
@@ -1697,7 +1697,7 @@ begin
      end;
 end;
 
-procedure THTMLWriter.AppendTitle(const AText: String; Hints: TPasMemberHints);
+procedure THTMLWriter.AppendTitle(const AText: AnsiString; Hints: TPasMemberHints);
 begin
   AppendTitle(UTF8Decode(aText),Hints);
 end;

+ 2 - 2
utils/fpdoc/dw_ipflin.pas

@@ -79,7 +79,7 @@ type
     function  GetLabel(AElement: TPasElement): String; override;
     procedure StartListing(Frames: Boolean; const name: String); override;
     procedure EndListing; override;
-    Function  EscapeText(S : String) : String; override;
+    Function  EscapeText(S : AnsiString) : AnsiString; override;
     Function  StripText(S : String) : String; override;
     procedure WriteCommentLine; override;
     procedure WriteComment(Comment : String);override;
@@ -641,7 +641,7 @@ begin
   Result := StringReplace(Result, ' ', '_', [rfReplaceAll]);
 end;
 
-function TIPFNewWriter.EscapeText(S: String): String;
+function TIPFNewWriter.EscapeText(S: AnsiString): AnsiString;
 var
   i: Integer;
 begin

+ 2 - 2
utils/fpdoc/dw_latex.pp

@@ -68,7 +68,7 @@ Type
     function  GetLabel(AElement: TPasElement): String; override;
     procedure StartListing(Frames: Boolean; const name: String); override;
     procedure EndListing; override;
-    Function  EscapeText(S : String) : String; override;
+    Function  EscapeText(S : AnsiString) : AnsiString; override;
     Function  StripText(S : String) : String; override;overload;
     procedure WriteCommentLine; override;
     procedure WriteComment(Comment : String);override;
@@ -213,7 +213,7 @@ begin
     end;
 end;
 
-function TLaTeXWriter.EscapeText(S: String): String;
+function TLaTeXWriter.EscapeText(S: AnsiString): AnsiString;
 
 
 var

+ 2 - 2
utils/fpdoc/dw_linrtf.pp

@@ -102,7 +102,7 @@ type
     function  GetLabel(AElement: TPasElement): String; override;
     procedure StartListing(Frames: Boolean; const name: String); override;
     procedure EndListing; override;
-    Function  EscapeText(S : String) : String; override;
+    Function  EscapeText(S : AnsiString) : AnsiString; override;
     Function  StripText(S : String) : String; override;
     procedure WriteCommentLine; override;
     procedure WriteComment(Comment : String);override;
@@ -187,7 +187,7 @@ begin
 end;
 
 
-function TRTFWriter.EscapeText(S: String): String;
+function TRTFWriter.EscapeText(S: AnsiString): AnsiString;
 
 var
   i: Integer;

+ 2 - 2
utils/fpdoc/dw_markdown.pp

@@ -70,7 +70,7 @@ type
     procedure AppendShortDescr(Element: TPasElement); virtual;
     procedure AppendShortDescrCell(Element: TPasElement);  virtual;
     procedure AppendDescr(AContext: TPasElement; DescrNode: TDOMElement; AutoInsertBlock: Boolean); virtual;
-    procedure AppendDescrSection(AContext: TPasElement; DescrNode: TDOMElement; const ATitle: String); virtual;
+    procedure AppendDescrSection(AContext: TPasElement; DescrNode: TDOMElement; const ATitle: AnsiString); virtual;
     procedure AppendDescrSection(AContext: TPasElement; DescrNode: TDOMElement; const ATitle: DOMString); virtual;
     Procedure AppendHyperlink(Element: TPasElement);
     Function CreateHyperlink(Element: TPasElement) : string;
@@ -365,7 +365,7 @@ begin
   ConvertDescr(AContext, DescrNode, AutoInsertBlock);
 end;
 
-procedure TMarkdownWriter.AppendDescrSection(AContext: TPasElement;  DescrNode: TDOMElement; const ATitle: String);
+procedure TMarkdownWriter.AppendDescrSection(AContext: TPasElement;  DescrNode: TDOMElement; const ATitle: AnsiString);
 begin
   if IsDescrNodeEmpty(DescrNode) then
     exit;

+ 4 - 4
utils/fpdoc/dwlinear.pp

@@ -47,8 +47,8 @@ Type
     // Procedures which MAY be overridden in descendents
     procedure WriteBeginDocument; virtual;
     procedure WriteEndDocument; virtual;
-    Function  EscapeText(S : UnicodeString) : String; overload;
-    Function  EscapeText(S : String) : String; virtual; overload;
+    Function  EscapeText(S : UnicodeString) : AnsiString; overload;
+    Function  EscapeText(S : AnsiString) : AnsiString; virtual; overload;
     Function  StripText(S : String) : String; virtual;
     Procedure StartProcedure; Virtual;
     Procedure EndProcedure; Virtual;
@@ -280,7 +280,7 @@ end;
   Default implementations, may be overridden in descendents
   ---------------------------------------------------------------------}
 
-function TLinearWriter.EscapeText(S: String): String;
+function TLinearWriter.EscapeText(S: AnsiString): AnsiString;
 
 begin
   Result:=S;
@@ -1486,7 +1486,7 @@ begin
   // do nothing
 end;
 
-function TLinearWriter.EscapeText(S: UnicodeString): String;
+function TLinearWriter.EscapeText(S: UnicodeString): AnsiString;
 begin
   Result:=EscapeText(UTF8Encode(S));
 end;

+ 23 - 8
utils/fpdoc/sh_pas.pp

@@ -68,7 +68,7 @@ const
   MaxKeywordLength = 15;
   MaxKeyword = 60;
 
-  KeywordTable: array[0..MaxKeyword] of PChar =
+  KeywordTable: array[0..MaxKeyword] of String =
     ('AND', 'ARRAY', 'ASM', 'ASSEMBLER',
      'BEGIN', 'BREAK',
      'CASE', 'CONST', 'CONSTRUCTOR', 'CLASS',
@@ -110,6 +110,19 @@ var
   begin
     dest[dp] := source[0]; Inc(dp); Inc(source);
   end;
+  procedure PutChars(S : String);
+  
+  Var
+    C : char;
+  
+  begin
+    for C in S do
+      begin
+      dest[dp] := c; 
+      Inc(dp); 
+      Inc(source);
+      end;
+  end;
 
   procedure ProcessComment1;
   begin
@@ -199,28 +212,30 @@ var
 
   function CheckForKeyword: Boolean;
   var
-    keyword, ukeyword: array[0..MaxKeywordLength] of Char;
+    keyword, ukeyword: string;
     i, j: Integer;
   begin
-    i := 0;
-    while (source[i] <> #0) and (i < MaxKeywordLength) and
+    i := 1;
+    SetLength(KeyWord,MaxKeywordLength);
+    SetLength(UKeyWord,MaxKeywordLength);
+    while (source[i] <> #0) and (i <= MaxKeywordLength) and
       (source[i] in ['0'..'9', 'A'..'Z', 'a'..'z']) do begin
       keyword[i] := source[i];
       ukeyword[i] := UpCase(source[i]);
       Inc(i);
     end;
-    keyword[i] := #0; ukeyword[i] := #0;
+    SetLength(keyword,I-1);
+    SetLength(ukeyword,I-1);
     Result := False;
     if i < MaxKeywordLength then
       for j := 0 to MaxKeyword do
-        if StrIComp(KeywordTable[j], ukeyword) = 0 then begin
+        if KeywordTable[j]=ukeyword  then begin
           Result := True; break;
         end;
     if not Result then exit;
     Inc(source, i);
     AddSH(shKeyword);
-    StrCopy(dest + dp, keyword);
-    Inc(dp, i);
+    PutChars(keyword);
     if j <> KeywordAsmIndex then
       AddSH(shDefault)
     else begin