1
0
mirror of synced 2024-09-19 09:46:09 +00:00

Removed: old DocBook documentation

Added: experimental JavaDoc (Time2Help) documentation comments
Added: Delphi 8 and unknown compilers "support"
This commit is contained in:
Mark van Renswoude 2004-12-28 14:35:31 +00:00
parent 85ca72584c
commit 179e581441
11 changed files with 123 additions and 307 deletions

View File

@ -1,28 +0,0 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<xsl:import href="F:/DocBook/html/chunk.xsl"/>
<xsl:param name="html.stylesheet">html.css</xsl:param>
<xsl:param name="toc.section.depth">3</xsl:param>
<xsl:param name="annotate.toc">0</xsl:param>
<xsl:template match="sect1" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes"
select="sect2|refentry|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="sect2" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes"
select="sect3|refentry|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,28 +0,0 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<xsl:import href="F:/DocBook/html/docbook.xsl"/>
<xsl:param name="html.stylesheet">html.css</xsl:param>
<xsl:param name="toc.section.depth">3</xsl:param>
<xsl:param name="annotate.toc">0</xsl:param>
<xsl:template match="sect1" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes"
select="sect2|refentry|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="sect2" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes"
select="sect3|refentry|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,100 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<book>
<bookinfo>
<author>
<firstname>M.</firstname>
<surname>van Renswoude</surname>
</author>
</bookinfo>
<title>X²Utils</title>
<chapter>
<title>Introduction</title>
<section>
<title>Overview</title>
<para>
X²Utils is an open-source set of utility classes and functions released under the <ulink url="http://www.opensource.org/licenses/zlib-license.php">zlib/libpng license</ulink>, a copy of which is shown below. It's main function is reusability and convenience; anything which is used often deserves a spot in the library, assuming it is written with portability in mind.
</para>
<para>
The official website for X²Utils is located at <ulink url="http://x2utils.kamadev.net/">http://x2utils.kamadev.net/</ulink>. Contributions to the source code are appreciated, and after reviewing will be committed to the Subversion repository.
</para>
</section>
<section>
<title>Documentation</title>
<para>
The documentation for X²Utils is kept both as in-source comments and external docBook format. The in-source comments can be used in combination with <ulink url="http://www.thewsoft.com/">Delphi Component Help Builder</ulink> to generate reference documentation. The docBook sources must be kept in sync manually, but allow for detailed explanation of the various functions.
</para>
</section>
<section>
<title>License</title>
<para>
Copyright (c) 2004 X²Software</para> <para>This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
</para>
<para>
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
</para>
<orderedlist>
<listitem>
The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
</listitem>
<listitem>
Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
</listitem>
<listitem>
This notice may not be removed or altered from any source distribution.
</listitem>
</orderedlist>
</section>
</chapter>
<chapter>
<title>Environment information</title>
<section>
<title>X2UtApp.pas</title>
<para>
Contains a TX2App class which can be initiated as a singleton using the App() function. It provides information related to the application, such as the executable path and version information.
</para>
<para>
Note that you should not free the return value of the App() function, the unit's finalization clause takes care of destroying the object when the application closes. This makes it suitable to use the App() function in a way similar to Delphi's Application object.
</para>
<example>
<title>Using the App function</title>
<para>
MyDataFileLocation := App.Path + <phrase role="codestring">'data.ini'</phrase>;
</para>
</example>
<para>
The version information is accessible through App.Version. It contains the version numbers and various build flags as specified in the project options. You can also access the version strings through App.Version.Strings, which contain information such as the product name and copyright.
</para>
<para>
Useful for display purposes is the App.FormatVersion() function. It returns a string with the version information in the format &quot;vX.X.X&quot;. If the optional Build parameter is set to True (default), "build X" is appended as well.
</para>
</section>
<section>
<title>X2UtOS.pas</title>
<para>
Similar to X2UtApp.pas, this unit contains a TX2OS class which you can access using the OS() function. It provides information about the Operating System the application currently runs on.
</para>
<para>
OS.Version is an enumeration of versions recognized by X2UtOS. Extended information if available through OS.VersionEx, and an OS.FormatVersion() is provided for display purposes as well.
</para>
</section>
</chapter>
</book>

View File

@ -1,3 +0,0 @@
@Echo Off
call compile-html.bat
call compile-singlehtml.bat

View File

@ -1,6 +0,0 @@
@Echo Off
echo Compiling paged HTML documentation...
cd html
xsltproc ..\X2Utils-html.xsl ..\X2Utils.xml
cd ..
copy html.css html

View File

@ -1,5 +0,0 @@
@Echo Off
echo Compiling single-HTML documentation...
xsltproc X2Utils-singlehtml.xsl X2Utils.xml > singlehtml\index.html
cd ..
copy html.css singlehtml

View File

@ -1,87 +0,0 @@
body
{
background-color: #ffffff;
color: #000000;
font-family: verdana, tahoma, arial, sans-serif;
font-size: 10pt;
}
td
{
font-size: 10pt;
}
a
{
background-color: transparent;
color: #000080;
text-decoration: underline;
}
a:hover
{
background-color: #f0f0ff;
color: #000080;
}
h1, h2, h3, h4, h5
{
background-color: transparent;
color: #800000;
}
h3
{
font-size: 13pt;
font-weight: bold;
}
h4
{
font-size: 10pt;
font-weight: bold;
}
span.term
{
font-weight: bold;
}
div.sidebar
{
background-color: #f0f0f0;
border-color: gray;
border-style: solid;
border-width: 1px;
color: #000000;
margin: 20px;
padding: 5px;
}
pre.programlisting
{
background-color: #f0f0f0;
border-color: gray;
border-style: solid;
border-width: 1px;
color: #000000;
font-size: 10pt;
padding: 2px;
white-space: pre;
}
span.codestring
{
background-color: transparent;
color: #008000;
}
dl
{
margin-top: 0px;
}
dd
{
margin-left: 20px;
}

View File

@ -1,13 +0,0 @@
To build the documentation:
- Download the docBook XSL stylesheets from:
http://docbook.sourceforge.net/projects/xsl/index.html
- Download XSLTProc, Windows version available at:
http://www.zlatkovic.com/libxml.en.html
- Modify the XSL files and point the include directive
to the path where you extracted the docBook files.
- Run compile-html-chunk.bat for the multi-page output or
compile-html.bat for a single-page output.

View File

@ -1,12 +1,14 @@
{
:: X2UtApp provides a singleton App object to access properties associated
:: with the application, such as the version number or executable path.
:: It is part of the X2Utils suite.
::
:: Last changed: $Date$
:: Revision: $Rev$
:: Author: $Author$
}
{** Provides application related information
*
* Provides a singleton App object to access properties associated
* with the application, such as the version number or executable path.
* It is part of the X2Utils suite.
* <br /><br />
*
* Last changed: $Date$ <br />
* Revision: $Rev$ <br />
* Author: $Author$ <br />
*}
unit X2UtApp;
interface

View File

@ -1,5 +1,19 @@
// This makes it easier to check which compiler version is
// being used...
{$DEFINE DUNKNOWN}
{$IFDEF VER160}
{$DEFINE D8}
{$DEFINE D7}
{$DEFINE D6}
{$DEFINE D5}
{$DEFINE D4}
{$DEFINE D3}
{$DEFINE D2}
{$DEFINE D1}
{$UNDEF DUNKNOWN}
{$ENDIF}
{$IFDEF VER150}
{$DEFINE D7}
{$DEFINE D6}
@ -8,7 +22,9 @@
{$DEFINE D3}
{$DEFINE D2}
{$DEFINE D1}
{$UNDEF DUNKNOWN}
{$ENDIF}
{$IFDEF VER140}
{$DEFINE D6}
{$DEFINE D5}
@ -16,29 +32,55 @@
{$DEFINE D3}
{$DEFINE D2}
{$DEFINE D1}
{$UNDEF DUNKNOWN}
{$ENDIF}
{$IFDEF VER130}
{$DEFINE D5}
{$DEFINE D4}
{$DEFINE D3}
{$DEFINE D2}
{$DEFINE D1}
{$UNDEF DUNKNOWN}
{$ENDIF}
{$IFDEF VER120}
{$DEFINE D4}
{$DEFINE D3}
{$DEFINE D2}
{$DEFINE D1}
{$UNDEF DUNKNOWN}
{$ENDIF}
{$IFDEF VER100}
{$DEFINE D3}
{$DEFINE D2}
{$DEFINE D1}
{$UNDEF DUNKNOWN}
{$ENDIF}
{$IFDEF VER90}
{$DEFINE D2}
{$DEFINE D1}
{$UNDEF DUNKNOWN}
{$ENDIF}
{$IFDEF VER80}
{$DEFINE D1}
{$UNDEF DUNKNOWN}
{$ENDIF}
// For unknown compiler versions, assume it is newer.
// Anything other than Delphi; good luck. I don't use it,
// so I don't know what defines they have... if you do know,
// feel free to send me any changes...
{$IFDEF DUNKNOWN}
{$DEFINE D8}
{$DEFINE D7}
{$DEFINE D6}
{$DEFINE D5}
{$DEFINE D4}
{$DEFINE D3}
{$DEFINE D2}
{$DEFINE D1}
{$ENDIF}

View File

@ -1,42 +1,84 @@
{
:: X2UtStrings provides various string-related functions.
::
:: Last changed: $Date$
:: Revision: $Rev$
:: Author: $Author$
}
{** Provides various string-related functions.
*
* Last changed: $Date$ <br />
* Revision: $Rev$ <br />
* Author: $Author$ <br />
*}
unit X2UtStrings;
interface
type
//** Array of string values.
TSplitArray = array of String;
//:$ Formats the specified size
//:: If KeepBytes is true, the size will be formatted for decimal separators
//:: and 'bytes' will be appended. If KeepBytes is false the best suitable
//:: unit will be chosen (KB, MB, GB).
function FormatSize(const Bytes: Int64; KeepBytes: Boolean = False): String;
//:$ Compares two strings by ordinal value without case sensitivity up to
//:$ ALength characters.
{** Formats the specified size.
*
* @param ABytes the size to format in bytes.
* @param AKeepBytes if true, only decimal separators will be added and
* the text 'bytes' appended. If False, a suitable unit
* will be chosen (KB, MB, GB).
* @result the formatted size.
*}
function FormatSize(const ABytes: Int64; AKeepBytes: Boolean = False): String;
{** Compares two strings without case sensitivity.
*
* @param AMatch the string to match.
* @param AAgainst the string to match against.
* @param ALength the maximum length to compare.
* @result -1 if AMatch is lower by ordinal value than AAgainst,
* 0 if the two are equal, 1 if AMatch is higher.
*}
function CompareTextL(const AMatch, AAgainst: String;
const ALength: Integer): Integer;
//:$ Compares two strings by ordinal value without case sensitivity up to
//:$ ALength characters.
{** Compares two strings without case sensitivity.
*
* @param AMatch the string to match.
* @param AAgainst the string to match against.
* @param ALength the maximum length to compare.
* @result True if the comparison is a match, False otherwise.
*}
function SameTextL(const AMatch, AAgainst: String;
const ALength: Integer): Boolean;
//:$ Compares AMatch against AAgainst using AAgainst's length.
{** Compares two strings without case sensitivity.
*
* The length of AAgainst is used as the maximum length to check.
*
* @param AMatch the string to match
* @param AAgainst the string to match against
* @result -1 if AMatch is lower by ordinal value than AAgainst,
* 0 if the two are equal, 1 if AMatch is higher.
*}
function CompareTextS(const AMatch, AAgainst: String): Integer;
//:$ Compares AMatch against AAgainst using AAgainst's length.
{** Compares two strings without case sensitivity.
*
* The length of AAgainst is used as the maximum length to check.
*
* @param AMatch the string to match.
* @param AAgainst the string to match against.
* @result True if the comparison is a match, False otherwise.
*}
function SameTextS(const AMatch, AAgainst: String): Boolean;
//:$ Splits a string on the specified delimiter
{** Splits a string on a specified delimiter.
*
* @param ASource the source string.
* @param ADelimiter the delimiter to split on.
* @param ADest the array which will receive the split parts.
* @todo though optimized, it now fails on #0 characters, need
* to determine the end by checking the AnsiString length.
*}
procedure Split(const ASource, ADelimiter: String; out ADest: TSplitArray);
//:$ Appends the strings with the specified glue string
{** Appends string parts with a specified glue value
*
* @param ASource the source parts
* @param AGlue the string added between the parts
* @result the composed parts
*}
function Join(const ASource: TSplitArray; const AGlue: String): String;
implementation
@ -55,20 +97,20 @@ var
begin
sExt := ' bytes';
dSize := Bytes;
dSize := ABytes;
if (not KeepBytes) and (Bytes >= KB) then
if (Bytes >= KB) and (Bytes < MB) then begin
if (not AKeepBytes) and (ABytes >= KB) then
if (ABytes >= KB) and (ABytes < MB) then begin
// 1 kB ~ 1 MB
dSize := Bytes / KB;
dSize := ABytes / KB;
sExt := ' KB';
end else if (Bytes >= MB) and (Bytes < GB) then begin
end else if (ABytes >= MB) and (ABytes < GB) then begin
// 1 MB ~ 1 GB
dSize := Bytes / MB;
dSize := ABytes / MB;
sExt := ' MB';
end else begin
// 1 GB ~ x
dSize := Bytes / GB;
dSize := ABytes / GB;
sExt := ' GB';
end;