|
@@ -33,203 +33,6 @@ Var
|
|
|
LEOL : Integer;
|
|
|
modir : string;
|
|
|
|
|
|
-resourcestring
|
|
|
- // Output strings
|
|
|
- SDocPackageTitle = 'Reference for package ''%s''';
|
|
|
- SDocPackageMenuTitle = 'Package ''%s''';
|
|
|
- SDocPackageLinkTitle = 'Package';
|
|
|
- SDocPrograms = 'Programs';
|
|
|
- SDocUnits = 'Units';
|
|
|
- SDocUnitTitle = 'Reference for unit ''%s''';
|
|
|
- SDocUnitMenuTitle = 'Unit ''%s''';
|
|
|
- SDocInheritanceHierarchy = 'Inheritance Hierarchy';
|
|
|
- SDocInterfaceSection = 'Interface section';
|
|
|
- SDocImplementationSection = 'Implementation section';
|
|
|
- SDocUsedUnits = 'Used units';
|
|
|
- SDocUsedUnitsByUnitXY = 'Used units by unit ''%s''';
|
|
|
- SDocConstsTypesVars = 'Constants, types and variables';
|
|
|
- SDocResStrings = 'Resource strings';
|
|
|
- SDocTypes = 'Types';
|
|
|
- SDocType = 'Type';
|
|
|
- SDocConstants = 'Constants';
|
|
|
- SDocConstant = 'Constant';
|
|
|
- SDocClasses = 'Classes';
|
|
|
- SDocClass = 'Class';
|
|
|
- SDocProceduresAndFunctions = 'Procedures and functions';
|
|
|
- SDocProcedureOrFunction = 'Procedure/function';
|
|
|
- SDocVariables = 'Variables';
|
|
|
- SDocVariable = 'Variable';
|
|
|
- SDocIdentifierIndex = 'Index';
|
|
|
- SDocPackageClassHierarchy = 'Class hierarchy';
|
|
|
- SDocModuleIndex = 'Index of all identifiers in unit ''%s''';
|
|
|
- SDocPackageIndex = 'Index of all identifiers in package ''%s''';
|
|
|
- SDocUnitOverview = 'Overview of unit ''%s''';
|
|
|
- SDocOverview = 'Overview';
|
|
|
- SDocSearch = 'Search';
|
|
|
- SDocDeclaration = 'Declaration';
|
|
|
- SDocDescription = 'Description';
|
|
|
- SDocErrors = 'Errors';
|
|
|
- SDocVersion = 'Version info';
|
|
|
- SDocSeeAlso = 'See also';
|
|
|
- SDocExample = 'Example';
|
|
|
- SDocArguments = 'Arguments';
|
|
|
- SDocFunctionResult = 'Function result';
|
|
|
- SDocRemark = 'Remark: ';
|
|
|
- SDocMethodOverview = 'Method overview';
|
|
|
- SDocPropertyOverview = 'Property overview';
|
|
|
- SDocEventOverview = 'Event overview';
|
|
|
- SDocInterfacesOverview = 'Interfaces overview';
|
|
|
- SDocInterface = 'Interfaces';
|
|
|
- SDocPage = 'Page';
|
|
|
- SDocMember = 'Member';
|
|
|
- SDocMembers = 'Members';
|
|
|
- SDocField = 'Field';
|
|
|
- SDocMethod = 'Method';
|
|
|
- SDocProperty = 'Property';
|
|
|
- SDocAccess = 'Access';
|
|
|
- SDocInheritance = 'Inheritance';
|
|
|
- SDocProperties = 'Properties';
|
|
|
- SDocMethods = 'Methods';
|
|
|
- SDocEvents = 'Events';
|
|
|
- SDocByName = 'by Name';
|
|
|
- SDocByInheritance = 'By inheritance';
|
|
|
- SDocValue = 'Value';
|
|
|
- SDocExplanation = 'Explanation';
|
|
|
- SDocProcedure = 'Procedure';
|
|
|
- SDocValuesForEnum = 'Enumeration values for type %s';
|
|
|
- SDocSourcePosition = 'Source position: %s line %d';
|
|
|
- SDocSynopsis = 'Synopsis';
|
|
|
- SDocVisibility = 'Visibility';
|
|
|
- SDocOpaque = 'Opaque type';
|
|
|
- SDocDateGenerated = 'Documentation generated on: %s';
|
|
|
- // The next line requires leading/trailing space due to XML comment layout:
|
|
|
- SDocGeneratedByComment = ' Generated using FPDoc - (c) 2000-2012 FPC contributors and Sebastian Guenther, [email protected] ';
|
|
|
- SDocNotes = 'Notes';
|
|
|
- SDocName = 'Name';
|
|
|
- SDocType_s = 'Type(s)';
|
|
|
- SDocTopic = 'Topic';
|
|
|
- SDocNoneAVailable = 'No members available';
|
|
|
-
|
|
|
- // Topics
|
|
|
- SDocRelatedTopics = 'Related topics';
|
|
|
- SDocUp = 'Up';
|
|
|
- SDocNext = 'Next';
|
|
|
- SDocPrevious = 'Previous';
|
|
|
-
|
|
|
- // Various backend constants
|
|
|
- SDocChapter = 'Chapter';
|
|
|
- SDocSection = 'Section';
|
|
|
- SDocSubSection = 'Subsection';
|
|
|
- SDocTable = 'Table';
|
|
|
- SDocListing = 'Listing';
|
|
|
-
|
|
|
- // Man page usage
|
|
|
- SManUsageManSection = 'Use ASection as the man page section';
|
|
|
- SManUsageNoUnitPrefix = 'Do not prefix man pages with unit name.';
|
|
|
- SManUsageWriterDescr = 'UNIX man page output.';
|
|
|
- SManUsagePackageDescription = 'Use descr as the description of man pages';
|
|
|
-
|
|
|
- // HTML usage
|
|
|
- SHTMLUsageFooter = 'Append xhtml (@filename reads from file) as footer to html page';
|
|
|
- SHTMLUsageNavigator = 'Append xhtml (@filename reads from file) in navigator bar';
|
|
|
- SHTMLUsageHeader = 'Append xhtml (@filename reads from file) as header to html page below navigation bar';
|
|
|
- SHTMLUsageFooterDate = 'Append footer with date. fmt is Optional format for FormatDateTime';
|
|
|
- SHTMLUsageCharset = 'Set the HTML character set';
|
|
|
- SHTMLHtmlSearch = 'Add search page with given name to the menu bar';
|
|
|
- SHTMLIndexColcount = 'Use N columns in the identifier index pages';
|
|
|
- SHTMLImageUrl = 'Prefix image URLs with url';
|
|
|
- SHTMLDisableMenuBrackets = 'Disable ''['' and '']'' characters around menu items at the top of the page. Useful for custom css';
|
|
|
-
|
|
|
- // CHM usage
|
|
|
- SCHMUsageTOC = 'Use [File] as the table of contents. Usually a .hhc file.';
|
|
|
- SCHMUsageIndex = 'Use [File] as the index. Usually a .hhk file.';
|
|
|
- SCHMUsageDefPage = 'Set the "Home" page relative to where it lives in the chm. i.e. "/index.html"';
|
|
|
- SCHMUsageOtrFiles= 'A txt file containing a list of files to be added relative to the working directory.';
|
|
|
- SCHMUsageCSSFile = 'Filename of a .css file to be included in the chm.';
|
|
|
- SCHMUsageAutoTOC = 'Automatically generate a Table of Contents. Ignores --toc-file';
|
|
|
- SCHMUsageAutoIDX = 'Automatically generate an Index. Ignores --index-file';
|
|
|
- SCHMUsageMakeSearch = 'Automatically generate a Search Index from filenames that match *.htm*';
|
|
|
- SCHMUsageChmTitle= 'Title of the chm. Defaults to the value from --package';
|
|
|
-
|
|
|
- // MarkDown usage
|
|
|
- SMDUsageFooter = 'Append markdown (@filename reads from file) as footer to every markdown page';
|
|
|
- SMDUsageHeader = 'Prepend markdown (@filename reads from file) as header to every markdown page';
|
|
|
- SMDIndexColcount = 'Use N columns in the identifier index pages';
|
|
|
- SMDImageUrl = 'Prefix image URLs with url';
|
|
|
- SMDTheme = 'Use name as theme name';
|
|
|
- SMDNavigation = 'Use scheme for navigation tree, here scheme is one of:';
|
|
|
- SMDNavSubtree = ' UnitSubTree : put all units in a sub tree of a Units node';
|
|
|
- SMDNavTree = ' UnitTree : put every units as a node on the same level as packages node';
|
|
|
-
|
|
|
- SXMLUsageFlatStructure = 'Use a flat output structure of XML files and directories';
|
|
|
- SXMLUsageSource = 'Include source file and line info in generated XML';
|
|
|
-
|
|
|
- // Linear usage
|
|
|
- SLinearUsageDupLinkedDocsP1 = 'Duplicate linked element documentation in';
|
|
|
- SLinearUsageDupLinkedDocsP2 = 'descendant classes.';
|
|
|
-
|
|
|
- STitle = 'FPDoc - Free Pascal Documentation Tool';
|
|
|
- SVersion = 'Version %s [%s]';
|
|
|
- SCopyright1 = '(c) 2000 - 2003 Areca Systems GmbH / Sebastian Guenther, [email protected]';
|
|
|
- SCopyright2 = '(c) 2005 - 2021 various FPC contributors';
|
|
|
-
|
|
|
- SCmdLineHelp = 'Usage: %s [options]';
|
|
|
- SUsageOption008 = '--base-descr-dir=DIR prefix all description files with this directory';
|
|
|
- SUsageOption009 = '--base-input-dir=DIR prefix all input files with this directory';
|
|
|
- SUsageOption010 = '--content Create content file for package cross-references';
|
|
|
- SUsageOption020 = '--cputarget=value Set the target CPU for the scanner.';
|
|
|
- SUsageOption030 = '--descr=file use file as description file, e.g.: ';
|
|
|
- SUsageOption035 = ' --descr=c:\WIP\myzipperdoc.xml';
|
|
|
- SUsageOption040 = ' This option is allowed more than once';
|
|
|
- SUsageOption050 = '--descr-dir=Dir Add All XML files in Dir to list of description files';
|
|
|
- SUsageOption060 = '--format=fmt Select output format.';
|
|
|
- SUsageOption070 = '--help Show this help.';
|
|
|
- SUsageOption080 = '--hide-protected Do not show protected methods in overview';
|
|
|
- SUsageOption090 = '--import=file Import content file for package cross-references';
|
|
|
- SUsageOption100 = '--input=cmd use cmd as input for the parser, e.g.:';
|
|
|
- SUsageOption110 = ' --input=C:\fpc\packages\paszlib\src\zipper.pp';
|
|
|
- SUsageOption120 = ' At least one input option is required.';
|
|
|
- SUsageOption130 = '--input-dir=Dir Add All *.pp and *.pas files in Dir to list of input files';
|
|
|
- SUsageOption140 = '--lang=lng Select output language.';
|
|
|
- SUsageOption145 = '--macro=name=value Define a macro to preprocess the project file with.';
|
|
|
- SUsageOption150 = '--ostarget=value Set the target OS for the scanner.';
|
|
|
- SUsageOption160 = '--output=name use name as the output name.';
|
|
|
- SUsageOption170 = ' Each backend interprets this as needed.';
|
|
|
- SUsageOption180 = '--package=name Set the package name for which to create output,';
|
|
|
- SUsageOption190 = ' e.g. --package=fcl';
|
|
|
- SUsageOption200 = '--project=file Use file as project file';
|
|
|
- SUsageOption210 = '--show-private Show private methods.';
|
|
|
- SUsageOption215 = '--stop-on-parser-error';
|
|
|
- SUsageOption215A = ' Stop when a parser error occurs. Default is to ignore parser errors.';
|
|
|
- SUsageOption220 = '--warn-no-node Warn if no documentation node was found.';
|
|
|
- SUsageOption230 = '--mo-dir=dir Set directory where language files reside to dir';
|
|
|
- SUsageOption240 = '--parse-impl (Experimental) try to parse implementation too';
|
|
|
- SUsageOption250 = '--dont-trim Do not trim XML contents. Useful for preserving';
|
|
|
- SUsageOption260 = ' formatting inside e.g <pre> tags';
|
|
|
- SUsageOption270 = '--write-project=file';
|
|
|
- SUsageOption280 = ' Do not write documentation, create project file instead';
|
|
|
- SUsageOption290 = '--verbose Write more information on the screen';
|
|
|
- SUsageOption300 = '--dry-run Only parse sources and XML, do not create output';
|
|
|
- SUsageOption310 = '--write-project=file';
|
|
|
- SUsageOption320 = ' Write all command-line options to a project file';
|
|
|
- SUsageSubNames = 'Use the file subnames instead the indexes as postfixes';
|
|
|
-
|
|
|
- SUsageFormats = 'The following output formats are supported by this fpdoc:';
|
|
|
- SUsageBackendHelp = 'Specify an output format, combined with --help to get more help for this backend.';
|
|
|
- SUsageFormatSpecific = 'Output format "%s" supports the following options:';
|
|
|
- SCmdLineErrInvalidMacro = 'Macro needs to be in the form name=value';
|
|
|
-
|
|
|
- SCmdLineInvalidOption = 'Ignoring unknown option "%s"';
|
|
|
- SCmdLineInvalidFormat = 'Invalid format "%s" specified';
|
|
|
- SCmdLineOutputOptionMissing = 'Need an output filename, please specify one with --output=<filename>';
|
|
|
- SWritingPages = 'Writing %d pages...';
|
|
|
- SNeedPackageName = 'No package name specified. Please specify one using the --package option.';
|
|
|
- SAvailablePackages = 'Available packages: ';
|
|
|
- SDone = 'Done.';
|
|
|
- SErrCouldNotCreateOutputDir = 'Could not create output directory "%s"';
|
|
|
- SErrCouldNotCreateFile = 'Could not create file "%s": %s';
|
|
|
- SSeeURL = '(See %s)'; // For linear text writers.
|
|
|
- SParsingUsedUnit = 'Parsing used unit "%s" with commandLine "%s"';
|
|
|
|
|
|
Const
|
|
|
SVisibility: array[TPasMemberVisibility] of string =
|
|
@@ -335,7 +138,7 @@ type
|
|
|
|
|
|
|
|
|
// The main FPDoc engine
|
|
|
- TFPDocLogLevel = (dleWarnNoNode);
|
|
|
+ TFPDocLogLevel = (dleWarnNoNode, dleWarnUsedFile, dleDocumentationEmpty, dleXCT);
|
|
|
TFPDocLogLevels = set of TFPDocLogLevel;
|
|
|
TOnParseUnitEvent = Procedure (Sender : TObject; Const AUnitName : String; Out AInputFile,OSTarget,CPUTarget : String) of Object;
|
|
|
|
|
@@ -364,7 +167,6 @@ type
|
|
|
HasContentFile: Boolean;
|
|
|
HidePrivate: Boolean; // Hide private class members in output?
|
|
|
HideProtected: Boolean; // Hide protected class members in output?
|
|
|
- WarnNoNode : Boolean; // Warn if no description node found for element.
|
|
|
|
|
|
constructor Create;
|
|
|
destructor Destroy; override;
|
|
@@ -378,7 +180,7 @@ type
|
|
|
AParent: TPasElement; AVisibility: TPasMemberVisibility;
|
|
|
const ASourceFilename: String; ASourceLinenumber: Integer): TPasElement;
|
|
|
override;
|
|
|
- function FindInModule(const AName: String ; AModule: TPasModule): TPasElement;
|
|
|
+ function FindElement(const AName: String ; AModule: TPasModule): TPasElement; overload;
|
|
|
function FindElement(const AName: String): TPasElement; override;
|
|
|
function FindModule(const AName: String): TPasModule; override;
|
|
|
Function HintsToStr(Hints : TPasMemberHints) : String;
|
|
@@ -411,7 +213,9 @@ type
|
|
|
|
|
|
|
|
|
procedure TranslateDocStrings(const Lang: String);
|
|
|
+{$IFDEF EXCEPTION_STACK}
|
|
|
function DumpExceptionCallStack(E: Exception):String;
|
|
|
+{$ENDIF}
|
|
|
|
|
|
Function IsLinkNode(Node : TDomNode) : Boolean;
|
|
|
Function IsExampleNode(Example : TDomNode) : Boolean;
|
|
@@ -422,7 +226,7 @@ Function IsLinkAbsolute(ALink: String): boolean;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
-uses Gettext, XMLRead;
|
|
|
+uses Gettext, XMLRead, fpdocstrs;
|
|
|
|
|
|
const
|
|
|
AbsoluteLinkPrefixes : array[0..2] of string = ('/', 'http://', 'ms-its:');
|
|
@@ -670,8 +474,11 @@ destructor TFPDocEngine.Destroy;
|
|
|
var
|
|
|
i: Integer;
|
|
|
begin
|
|
|
+ if FPackages.Count > 0 then
|
|
|
for i := 0 to FPackages.Count - 1 do
|
|
|
- TPasPackage(FPackages[i]).Release{$IFDEF CheckPasTreeRefCount}('TFPDocEngine.Destroy'){$ENDIF};
|
|
|
+ TPasPackage(FPackages[i]).Release{$IFDEF CheckPasTreeRefCount}('TFPDocEngine.Destroy'){$ENDIF}
|
|
|
+ else
|
|
|
+ FreeAndNil(FPackages);
|
|
|
FreeAndNil(FRootDocNode);
|
|
|
FreeAndNil(FRootLinkNode);
|
|
|
FreeAndNil(DescrDocNames);
|
|
@@ -910,7 +717,7 @@ var
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
- if cls<>result then
|
|
|
+ if (dleXCT in FDocLogLevels) and (cls<>result) then
|
|
|
DoLog('Warning : ancestor class %s of class %s could not be resolved',[clname,cls.name]);
|
|
|
end;
|
|
|
|
|
@@ -970,7 +777,7 @@ var
|
|
|
if alname<>'' then // the class//interface we refered to is an alias
|
|
|
begin
|
|
|
// writeln('Found alias pair ',clname,' = ',alname);
|
|
|
- if not assigned(CreateAliasType(alname,clname,cls,cls2)) then
|
|
|
+ if (dleXCT in FDocLogLevels) and not assigned(CreateAliasType(alname,clname,cls,cls2)) then
|
|
|
DoLog('Warning: creating alias %s for %s failed!',[alname,clname]);
|
|
|
end
|
|
|
else
|
|
@@ -1217,7 +1024,7 @@ begin
|
|
|
Result.SourceLinenumber := ASourceLinenumber;
|
|
|
end;
|
|
|
|
|
|
-function TFPDocEngine.FindInModule ( const AName: String; AModule: TPasModule
|
|
|
+function TFPDocEngine.FindElement ( const AName: String; AModule: TPasModule
|
|
|
) : TPasElement;
|
|
|
var
|
|
|
l: TFPList;
|
|
@@ -1244,14 +1051,14 @@ var
|
|
|
i: Integer;
|
|
|
Module: TPasElement;
|
|
|
begin
|
|
|
- Result := FindInModule( AName, CurModule );
|
|
|
+ Result := FindElement( AName, CurModule );
|
|
|
if not Assigned(Result) and assigned (CurModule.InterfaceSection) then
|
|
|
for i := CurModule.InterfaceSection.UsesList.Count - 1 downto 0 do
|
|
|
begin
|
|
|
Module := TPasElement(CurModule.InterfaceSection.UsesList[i]);
|
|
|
if Module.ClassType.InheritsFrom(TPasModule) then
|
|
|
begin
|
|
|
- Result := FindInModule(AName, TPasModule(Module));
|
|
|
+ Result := FindElement(AName, TPasModule(Module));
|
|
|
if Assigned(Result) then
|
|
|
exit;
|
|
|
end;
|
|
@@ -1264,6 +1071,7 @@ function TFPDocEngine.FindModule(const AName: String): TPasModule;
|
|
|
var
|
|
|
i: Integer;
|
|
|
begin
|
|
|
+ if not Assigned(APackage) then Exit;
|
|
|
for i := 0 to APackage.Modules.Count - 1 do
|
|
|
begin
|
|
|
Result := TPasModule(APackage.Modules[i]);
|
|
@@ -1279,7 +1087,7 @@ var
|
|
|
|
|
|
begin
|
|
|
Result := FindInPackage(Package);
|
|
|
- if not Assigned(Result) then
|
|
|
+ if not Assigned(Result) and (FPackages.Count > 0) then
|
|
|
for i := FPackages.Count - 1 downto 0 do
|
|
|
begin
|
|
|
if TPasPackage(FPackages[i]) = Package then
|
|
@@ -1319,11 +1127,12 @@ Var
|
|
|
M : TPasModule;
|
|
|
|
|
|
begin
|
|
|
- DoLog(SParsingUsedUnit,[AName,AInputLine]);
|
|
|
+ if dleWarnUsedFile in FDocLogLevels then
|
|
|
+ DoLog(SParsingUsedUnit,[AName,AInputLine]);
|
|
|
M:=CurModule;
|
|
|
CurModule:=Nil;
|
|
|
try
|
|
|
- ParseSource(Self,AInputLine,AOSTarget,ACPUTarget,[poUseStreams,poSkipDefaultDefs]);
|
|
|
+ ParseSource(Self,AInputLine,AOSTarget,ACPUTarget,[poUseStreams]); //[poSkipDefaultDefs];
|
|
|
Result:=CurModule;
|
|
|
finally
|
|
|
CurModule:=M;
|
|
@@ -1590,7 +1399,7 @@ begin
|
|
|
if aElement.CustomData=Nil then
|
|
|
aElement.CustomData:=Result;
|
|
|
end
|
|
|
- else if WarnNoNode and
|
|
|
+ else if (dleWarnNoNode in FDocLogLevels) and
|
|
|
(Length(AElement.PathName)>0) and
|
|
|
(AElement.PathName[1]='#') then
|
|
|
DoLog(Format('No documentation node found for identifier : %s',[AElement.PathName]));
|
|
@@ -1791,6 +1600,7 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
+{$IFDEF EXCEPTION_STACK}
|
|
|
function DumpExceptionCallStack(E: Exception):String;
|
|
|
var
|
|
|
I: Integer;
|
|
@@ -1807,6 +1617,7 @@ begin
|
|
|
for I := 0 to ExceptFrameCount - 1 do
|
|
|
Result := Result + LineEnding + BackTraceStrFunc(Frames[I]);
|
|
|
end;
|
|
|
+{$ENDIF}
|
|
|
|
|
|
initialization
|
|
|
LEOL:=Length(LineEnding);
|