]>
Commit | Line | Data |
---|---|---|
1ac879da JR |
1 | Index: utils/fpdoc/dw_html.pp |
2 | =================================================================== | |
3 | --- fpcsrc/utils/fpdoc/dw_html.pp (revision 32373) | |
4 | +++ fpcsrc/utils/fpdoc/dw_html.pp (revision 32374) | |
5 | @@ -2471,7 +2471,7 @@ | |
6 | try | |
7 | B.BuildTree(AList); | |
8 | // Classes | |
9 | - WriteXMLFile(B.ClassTree,'tree.xml'); | |
10 | + // WriteXMLFile(B.ClassTree,'tree.xml'); | |
11 | // Dummy TObject | |
12 | E:=B.ClassTree.DocumentElement; | |
13 | PushClassList; | |
14 | Index: utils/fpdoc/mkfpdoc.pp | |
15 | =================================================================== | |
16 | --- fpcsrc/utils/fpdoc/mkfpdoc.pp (revision 32373) | |
17 | +++ fpcsrc/utils/fpdoc/mkfpdoc.pp (revision 32374) | |
18 | @@ -19,6 +19,8 @@ | |
19 | ||
20 | TFPDocCreator = Class(TComponent) | |
21 | Private | |
22 | + FBaseDescrDir: String; | |
23 | + FBaseInputDir: String; | |
24 | FCurPackage : TFPDocPackage; | |
25 | FProcessedUnits : TStrings; | |
26 | FOnLog: TPasParserLogHandler; | |
27 | @@ -28,7 +30,11 @@ | |
28 | FVerbose: Boolean; | |
29 | function GetOptions: TEngineOptions; | |
30 | function GetPackages: TFPDocPackages; | |
31 | + procedure SetBaseDescrDir(AValue: String); | |
32 | + procedure SetBaseInputDir(AValue: String); | |
33 | Protected | |
34 | + Function FixInputFile(Const AFileName : String) : String; | |
35 | + Function FixDescrFile(Const AFileName : String) : String; | |
36 | Procedure DoBeforeEmitNote(Sender : TObject; Note : TDomElement; Var EmitNote : Boolean); virtual; | |
37 | procedure HandleOnParseUnit(Sender: TObject; const AUnitName: String; out AInputFile, OSTarget, CPUTarget: String); | |
38 | procedure SetVerbose(AValue: Boolean); virtual; | |
39 | @@ -49,6 +55,9 @@ | |
40 | // Easy access | |
41 | Property Options : TEngineOptions Read GetOptions; | |
42 | Property Packages : TFPDocPackages Read GetPackages; | |
43 | + // When set, they will be prepended to non-absolute filenames. | |
44 | + Property BaseInputDir : String Read FBaseInputDir Write SetBaseInputDir; | |
45 | + Property BaseDescrDir : String Read FBaseDescrDir Write SetBaseDescrDir; | |
46 | end; | |
47 | ||
48 | implementation | |
49 | @@ -72,13 +81,13 @@ | |
50 | end; | |
51 | end; | |
52 | ||
53 | -procedure TFPDocCreator.DoLog(const Msg: String); | |
54 | +Procedure TFPDocCreator.DoLog(Const Msg: String); | |
55 | begin | |
56 | If Assigned(OnLog) then | |
57 | OnLog(Self,Msg); | |
58 | end; | |
59 | ||
60 | -procedure TFPDocCreator.DoLog(const Fmt: String; Args: array of const); | |
61 | +procedure TFPDocCreator.DoLog(Const Fmt: String; Args: Array of Const); | |
62 | begin | |
63 | DoLog(Format(Fmt,Args)); | |
64 | end; | |
65 | @@ -103,7 +112,7 @@ | |
66 | SplitInputFIleOption(S,UN,Opts); | |
67 | if CompareText(ChangeFileExt(ExtractFileName(Un),''),AUnitName)=0 then | |
68 | begin | |
69 | - AInputFile:=S; | |
70 | + AInputFile:=FixInputFile(UN)+' '+Opts; | |
71 | OSTarget:=FProject.Options.OSTarget; | |
72 | CPUTarget:=FProject.Options.CPUTarget; | |
73 | FProcessedUnits.Add(UN); | |
74 | @@ -123,13 +132,45 @@ | |
75 | Result:=FProject.Packages; | |
76 | end; | |
77 | ||
78 | -procedure TFPDocCreator.DoBeforeEmitNote(Sender: TObject; Note: TDomElement; | |
79 | - var EmitNote: Boolean); | |
80 | +Function TFPDocCreator.FixInputFile(Const AFileName: String): String; | |
81 | begin | |
82 | + Result:=AFileName; | |
83 | + If Result='' then exit; | |
84 | + if (ExtractFileDrive(Result)='') and (Result[1]<>PathDelim) then | |
85 | + Result:=BaseInputDir+Result; | |
86 | +end; | |
87 | + | |
88 | +Function TFPDocCreator.FixDescrFile(Const AFileName: String): String; | |
89 | +begin | |
90 | + Result:=AFileName; | |
91 | + If Result='' then exit; | |
92 | + if (ExtractFileDrive(Result)='') and (Result[1]<>PathDelim) then | |
93 | + Result:=BaseDescrDir+Result; | |
94 | +end; | |
95 | + | |
96 | +procedure TFPDocCreator.SetBaseDescrDir(AValue: String); | |
97 | +begin | |
98 | + if FBaseDescrDir=AValue then Exit; | |
99 | + FBaseDescrDir:=AValue; | |
100 | + If FBaseDescrDir<>'' then | |
101 | + FBaseDescrDir:=IncludeTrailingPathDelimiter(FBaseDescrDir); | |
102 | +end; | |
103 | + | |
104 | +procedure TFPDocCreator.SetBaseInputDir(AValue: String); | |
105 | +begin | |
106 | + if FBaseInputDir=AValue then Exit; | |
107 | + FBaseInputDir:=AValue; | |
108 | + If FBaseInputDir<>'' then | |
109 | + FBaseInputDir:=IncludeTrailingPathDelimiter(FBaseInputDir); | |
110 | +end; | |
111 | + | |
112 | +Procedure TFPDocCreator.DoBeforeEmitNote(Sender: TObject; Note: TDomElement; | |
113 | + Var EmitNote: Boolean); | |
114 | +begin | |
115 | EmitNote:=True; | |
116 | end; | |
117 | ||
118 | -constructor TFPDocCreator.Create(AOwner: TComponent); | |
119 | +Constructor TFPDocCreator.Create(AOwner: TComponent); | |
120 | begin | |
121 | inherited Create(AOwner); | |
122 | FProject:=TFPDocProject.Create(Self); | |
123 | @@ -139,7 +180,7 @@ | |
124 | FProcessedUnits:=TStringList.Create; | |
125 | end; | |
126 | ||
127 | -destructor TFPDocCreator.Destroy; | |
128 | +Destructor TFPDocCreator.Destroy; | |
129 | begin | |
130 | FreeAndNil(FProcessedUnits); | |
131 | FreeAndNil(FProject); | |
132 | @@ -180,7 +221,8 @@ | |
133 | Engine.WriteContentFile(APackage.ContentFile); | |
134 | end; | |
135 | ||
136 | -procedure TFPDocCreator.CreateDocumentation(APackage: TFPDocPackage; ParseOnly : Boolean); | |
137 | +Procedure TFPDocCreator.CreateDocumentation(APackage: TFPDocPackage; | |
138 | + ParseOnly: Boolean); | |
139 | ||
140 | var | |
141 | i,j: Integer; | |
142 | @@ -201,7 +243,7 @@ | |
143 | Engine.ReadContentFile(Arg, Cmd); | |
144 | end; | |
145 | for i := 0 to APackage.Descriptions.Count - 1 do | |
146 | - Engine.AddDocFile(APackage.Descriptions[i],Options.donttrim); | |
147 | + Engine.AddDocFile(FixDescrFile(APackage.Descriptions[i]),Options.donttrim); | |
148 | Engine.SetPackageName(APackage.Name); | |
149 | Engine.Output:=APackage.Output; | |
150 | Engine.OnLog:=Self.OnLog; | |
151 | @@ -216,10 +258,11 @@ | |
152 | for i := 0 to APackage.Inputs.Count - 1 do | |
153 | try | |
154 | SplitInputFileOption(APackage.Inputs[i],Cmd,Arg); | |
155 | + Cmd:=FixInputFIle(Cmd); | |
156 | if FProcessedUnits.IndexOf(Cmd)=-1 then | |
157 | begin | |
158 | FProcessedUnits.Add(Cmd); | |
159 | - ParseSource(Engine, APackage.Inputs[i], Options.OSTarget, Options.CPUTarget); | |
160 | + ParseSource(Engine,Cmd+' '+Arg, Options.OSTarget, Options.CPUTarget); | |
161 | end; | |
162 | except | |
163 | on e: EParserError do | |
164 | @@ -239,7 +282,7 @@ | |
165 | end; | |
166 | end; | |
167 | ||
168 | -procedure TFPDocCreator.CreateProjectFile(Const AFileName: string); | |
169 | +Procedure TFPDocCreator.CreateProjectFile(Const AFileName: string); | |
170 | begin | |
171 | With TXMLFPDocOptions.Create(Self) do | |
172 | try | |
173 | @@ -249,7 +292,7 @@ | |
174 | end; | |
175 | end; | |
176 | ||
177 | -procedure TFPDocCreator.LoadProjectFile(const AFileName: string); | |
178 | +Procedure TFPDocCreator.LoadProjectFile(Const AFileName: string); | |
179 | begin | |
180 | With TXMLFPDocOptions.Create(self) do | |
181 | try | |
182 | Index: utils/fpdoc/fpdoc.pp | |
183 | =================================================================== | |
184 | --- fpcsrc/utils/fpdoc/fpdoc.pp (revision 32373) | |
185 | +++ fpcsrc/utils/fpdoc/fpdoc.pp (revision 32374) | |
186 | @@ -73,6 +73,8 @@ | |
187 | ||
188 | begin | |
189 | Writeln(Format(SCmdLineHelp,[ExtractFileName(Paramstr(0))])); | |
190 | + Writeln(SUsageOption008); | |
191 | + Writeln(SUsageOption009); | |
192 | Writeln(SUsageOption010); | |
193 | Writeln(SUsageOption020); | |
194 | Writeln(SUsageOption030); | |
195 | @@ -311,6 +313,8 @@ | |
196 | AddToFileList(SelectedPackage.Descriptions, Arg) | |
197 | else if (Cmd = '--descr-dir') then | |
198 | AddDirToFileList(SelectedPackage.Descriptions, Arg, '*.xml') | |
199 | + else if (Cmd = '--base-descr-dir') then | |
200 | + FCreator.BaseDescrDir:=Arg | |
201 | else if (Cmd = '-f') or (Cmd = '--format') then | |
202 | begin | |
203 | Arg:=UpperCase(Arg); | |
204 | @@ -323,6 +327,8 @@ | |
205 | FCreator.Options.Language := Arg | |
206 | else if (Cmd = '-i') or (Cmd = '--input') then | |
207 | AddToFileList(SelectedPackage.Inputs, Arg) | |
208 | + else if (Cmd = '--base-input-dir') then | |
209 | + FCreator.BaseInputDir:=Arg | |
210 | else if (Cmd = '--input-dir') then | |
211 | begin | |
212 | AddDirToFileList(SelectedPackage.Inputs, Arg,'*.pp'); | |
213 | Index: utils/fpdoc/dglobals.pp | |
214 | =================================================================== | |
215 | --- fpcsrc/utils/fpdoc/dglobals.pp (revision 32373) | |
216 | +++ fpcsrc/utils/fpdoc/dglobals.pp (revision 32374) | |
217 | @@ -142,6 +142,8 @@ | |
218 | SCopyright2 = '(c) 2005 - 2012 various FPC contributors'; | |
219 | ||
220 | SCmdLineHelp = 'Usage: %s [options]'; | |
221 | + SUsageOption008 = '--base-descr-dir=DIR prefix all description files with this directory'; | |
222 | + SUsageOption009 = '--base-input-dir=DIR prefix all input files with this directory'; | |
223 | SUsageOption010 = '--content Create content file for package cross-references'; | |
224 | SUsageOption020 = '--cputarget=value Set the target CPU for the scanner.'; | |
225 | SUsageOption030 = '--descr=file use file as description file, e.g.: '; |