diff options
author | marco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2016-05-22 15:53:13 +0000 |
---|---|---|
committer | marco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2016-05-22 15:53:13 +0000 |
commit | 17e96b7b641c10f925e7785f65cf88e8edad0b20 (patch) | |
tree | 0829940f1fc04524c4c68673ed43062297aa7e19 /utils | |
parent | 015ad4bb88e509885dbcc329192e7fc97fc6f9aa (diff) | |
download | fpc-17e96b7b641c10f925e7785f65cf88e8edad0b20.tar.gz |
# revisions: 32896,32897,32985,32988,32044,33061,33151,33170,33194,33206,33207,33220,33221,33226,33237,33241,33265
git-svn-id: http://svn.freepascal.org/svn/fpc/branches/fixes_3_0@33749 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'utils')
-rw-r--r-- | utils/fpdoc/dw_html.pp | 21 | ||||
-rw-r--r-- | utils/fpdoc/dw_latex.pp | 87 | ||||
-rw-r--r-- | utils/instantfpc/instantfpc.pas | 14 |
3 files changed, 113 insertions, 9 deletions
diff --git a/utils/fpdoc/dw_html.pp b/utils/fpdoc/dw_html.pp index facd7a3e3f..f41fe543da 100644 --- a/utils/fpdoc/dw_html.pp +++ b/utils/fpdoc/dw_html.pp @@ -3236,6 +3236,8 @@ begin AppendKw(CodeEl, 'property '); AppendHyperlink(CodeEl, Member); t:=TPasProperty(Member).ResolvedType; + if Assigned(TPasProperty(Member).Args) and (TPasProperty(Member).Args.Count>0) then + AppendText(CodeEl, ' []'); if Assigned(T) then begin AppendSym(CodeEl, ': '); @@ -3674,12 +3676,31 @@ var var NeedBreak: Boolean; T : TPasType; + A : TPasArgument; + I : integer; begin AppendKw(CodeEl, 'property '); AppendHyperlink(CodeEl, Element.Parent); AppendSym(CodeEl, '.'); AppendText(CodeEl, Element.Name); + if Assigned(Element.Args) and (Element.Args.Count>0) then + begin + AppendSym(CodeEl,'['); + For I:=0 to Element.Args.Count-1 do + begin + If I>0 then + AppendSym(CodeEl,','); + A:=TPasArgument(Element.Args[i]); + AppendText(CodeEl, A.Name); + AppendSym(CodeEl,': '); + if Assigned(A.ArgType) then + AppendText(CodeEl,A.ArgType.Name) + else + AppendText(CodeEl,'<Unknown>'); + end; + AppendSym(CodeEl,']'); + end; T:=Element.ResolvedType; if Assigned(T) then begin diff --git a/utils/fpdoc/dw_latex.pp b/utils/fpdoc/dw_latex.pp index cb8aae96d1..0c2193875d 100644 --- a/utils/fpdoc/dw_latex.pp +++ b/utils/fpdoc/dw_latex.pp @@ -23,6 +23,7 @@ uses DOM, dGlobals, PasTree; const LateXHighLight : Boolean = False; + MaxVerbatimLength : Integer = 65; TexExtension : String = '.tex'; Procedure CreateLaTeXDocForPackage(APackage: TPasPackage; AEngine: TFPDocEngine); @@ -130,8 +131,10 @@ Type // TFPDocWriter class methods Property ImageDir : String Read FImageDir Write FImageDir; public + Function SplitLine (ALine : String): String; virtual; Function InterPretOption(Const Cmd,Arg : String) : boolean; override; Class Function FileNameExtension : String; override; + class procedure Usage(List: TStrings); override; end; @@ -153,15 +156,75 @@ begin Result[i] := ':'; end; +Function TLaTeXWriter.SplitLine (ALine : String): String; + + Function FindLastSplit(S : String) : Integer; + + Const + NonSplit = ['a'..'z','A'..'Z','0'..'9','_']; + + Var + L,I : integer; + C : PChar; + InString : Boolean; + + begin + Result:=0; + L:=Length(S); + if (L>MaxVerbatimLength) then + begin + InString:=False; + Result:=0; + I:=1; + C:=@S[1]; + While (I<=MaxVerbatimLength) do + begin + If C^='''' then + InString:=Not Instring + else if Not InString then + begin + if Not (C^ in NonSplit) then + Result:=I; + end; + Inc(I); + Inc(C); + end; + end; + If Result=0 then + Result:=L+1; + end; + +Var + SP : Integer; + L : String; + +begin + Result:=''; + While (Aline<>'') do + begin + SP:=FindLastSplit(Aline); + L:=Copy(ALine,1,SP-1); + Delete(ALine,1,SP-1); + If (Result<>'') then + Result:=Result+sLineBreak+' '; + Result:=Result+Trim(L); + end; +end; function TLaTeXWriter.EscapeText(S: String): String; + var i: Integer; begin if FInVerBatim=True then - Result:=S + begin + if (MaxVerbatimLength=0) or (length(S)<=MaxVerbatimLength) then + Result:=S + else + Result:=SplitLine(S); + end else begin SetLength(Result, 0); @@ -725,12 +788,34 @@ begin LatexHighLight:=True else if Cmd = '--latex-extension' then TexExtension:=Arg + else if Cmd = '--latex--verbatim-length' then + MaxVerbatimLength:=StrToInt(Arg) else if Cmd = '--image-dir' then ImageDir:=Arg else Result:=False; end; +Resourcestring + SLatexHighlightDocs = 'Use the syntax highlighter for declarations.'; + SLatexExtensionDocs = 'Specify the extension for the latex files.'; + SLatexVerbatimLengthDocs = 'Specify maximum line length for verbatim environments (default 64).'; + SLatexImageDirDocs = 'Specify the directory where the images are stored.'; + +class procedure TLaTeXWriter.Usage(List: TStrings); + +begin + Inherited; + List.Add('--latex-highlight'); + List.Add(SLatexHighlightDocs); + List.Add('--latex-extension=ext'); + List.Add(SLatexExtensionDocs); + List.Add('--latex-verbatim-length=len'); + List.Add(SLatexVerbatimLengthDocs); + List.Add('--image-dir=dir'); + List.Add(SLatexImageDirDocs); +end; + initialization // Do not localize. RegisterWriter(TLaTeXWriter,'latex','Latex output using fpc.sty class.'); diff --git a/utils/instantfpc/instantfpc.pas b/utils/instantfpc/instantfpc.pas index 0a9a3549bf..dbd0571ea4 100644 --- a/utils/instantfpc/instantfpc.pas +++ b/utils/instantfpc/instantfpc.pas @@ -29,9 +29,11 @@ const // 1.3 compile in a separate directory, so that parallel invocations do not overwrite link.res files -Procedure Usage; +Procedure Usage(Err : string); begin + if (Err<>'') then + Writeln('Error : ',Err); writeln('instantfpc '+Version); writeln; writeln('Run pascal source files as scripts.'); @@ -76,7 +78,7 @@ begin writeln; writeln(' -B'); writeln(' Always recompile.'); - Halt(0); + Halt(Ord(Err<>'')); end; Procedure DisplayCache; @@ -108,7 +110,7 @@ begin Halt(1); end else if p='-h' then - usage + usage('') else if p='--get-cache' then DisplayCache else if copy(p,1,11)='--compiler=' then @@ -167,12 +169,8 @@ begin end; end; if (Filename='') then - begin - writeln('missing source file'); - Halt(1); - end; + Usage('Missing source file'); CheckSourceName(Filename); - Src:=TStringList.Create; try Src.LoadFromFile(Filename); |