sysutils.tex 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538
  1. %
  2. % $Id$
  3. % This file is part of the FPC documentation.
  4. % Copyright (C) 1999, by Michael Van Canneyt
  5. %
  6. % The FPC documentation is free text; you can redistribute it and/or
  7. % modify it under the terms of the GNU Library General Public License as
  8. % published by the Free Software Foundation; either version 2 of the
  9. % License, or (at your option) any later version.
  10. %
  11. % The FPC Documentation is distributed in the hope that it will be useful,
  12. % but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. % Library General Public License for more details.
  15. %
  16. % You should have received a copy of the GNU Library General Public
  17. % License along with the FPC documentation; see the file COPYING.LIB. If not,
  18. % write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. % Boston, MA 02111-1307, USA.
  20. %
  21. \chapter{The SYSUTILS unit.}
  22. This chapter describes the \file{sysutils} unit. The \var{sysutils} unit
  23. was largely written by Gertjan Schouten, and completed by michael Van Canneyt.
  24. It aims to be compatible to the Delphi sysutils unit, but in contrast with
  25. the latter, it is designed to work on multiple platforms.
  26. This chapter starts out with a definition of all types and constants
  27. that are defined, followed by a complete explanation of each function.
  28. \section{Constants and types}
  29. The following general-purpose constants are defined:
  30. \begin{verbatim}
  31. const
  32. SecsPerDay = 24 * 60 * 60; // Seconds and milliseconds per day
  33. MSecsPerDay = SecsPerDay * 1000;
  34. DateDelta = 693594; // Days between 1/1/0001 and 12/31/1899
  35. Eoln = #10;
  36. \end{verbatim}
  37. The following types are used frequently in date and time functions.
  38. They are the same on all platforms.
  39. \begin{verbatim}
  40. type
  41. TSystemTime = record
  42. Year, Month, Day: word;
  43. Hour, Minute, Second, MilliSecond: word;
  44. end ;
  45. TDateTime = double;
  46. TTimeStamp = record
  47. Time: integer; { Number of milliseconds since midnight }
  48. Date: integer; { One plus number of days since 1/1/0001 }
  49. end ;
  50. \end{verbatim}
  51. The following type is used in the \seef{FindFirst},\seef{FindNext}
  52. and \seep{FindClose} functions. The \var{win32} version differs from
  53. the other versions. If code is to be portable, that part shouldn't
  54. be used.
  55. \begin{verbatim}
  56. Type
  57. THandle = Longint;
  58. TSearchRec = Record
  59. Time,Size, Attr : Longint;
  60. Name : TFileName;
  61. ExcludeAttr : Longint;
  62. FindHandle : THandle;
  63. {$ifdef Win32}
  64. FindData : TWin32FindData;
  65. {$endif}
  66. end;
  67. \end{verbatim}
  68. The following constants are file-attributes that need to be matched in the
  69. findfirst call.
  70. \begin{verbatim}
  71. Const
  72. faReadOnly = $00000001;
  73. faHidden = $00000002;
  74. faSysFile = $00000004;
  75. faVolumeId = $00000008;
  76. faDirectory = $00000010;
  77. faArchive = $00000020;
  78. faAnyFile = $0000003f;
  79. \end{verbatim}
  80. The following constants can be used in the \seef{FileOpen} call.
  81. \begin{verbatim}
  82. Const
  83. fmOpenRead = $0000;
  84. fmOpenWrite = $0001;
  85. fmOpenReadWrite = $0002;
  86. \end{verbatim}
  87. The following variables are used in the case translation routines.
  88. \begin{verbatim}
  89. type
  90. TCaseTranslationTable = array[0..255] of char;
  91. var
  92. UpperCaseTable: TCaseTranslationTable;
  93. LowerCaseTable: TCaseTranslationTable;
  94. \end{verbatim}
  95. The initialization code of the \file{sysutils} unit fills these
  96. tables with the appropriate values. For the win32 and go32v2
  97. versions, this information is obtained from the operating system.
  98. The following constants control the formatting of dates.
  99. For the Win32 version of the \file{sysutils} unit, these
  100. constants are set according to the internationalization
  101. settings of Windows by the initialization code of the unit.
  102. \begin{verbatim}
  103. Const
  104. DateSeparator: char = '-';
  105. ShortDateFormat: string = 'd/m/y';
  106. LongDateFormat: string = 'dd" "mmmm" "yyyy';
  107. ShortMonthNames: array[1..12] of string[128] =
  108. ('Jan','Feb','Mar','Apr','May','Jun',
  109. 'Jul','Aug','Sep','Oct','Nov','Dec');
  110. LongMonthNames: array[1..12] of string[128] =
  111. ('January','February','March','April',
  112. 'May','June','July','August',
  113. 'September','October','November','December');
  114. ShortDayNames: array[1..7] of string[128] =
  115. ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
  116. LongDayNames: array[1..7] of string[128] =
  117. ('Sunday','Monday','Tuesday','Wednesday',
  118. 'Thursday','Friday','Saturday');
  119. \end{verbatim}
  120. The following constants control the formatting of times.
  121. For the Win32 version of the \file{sysutils} unit, these
  122. constants are set according to the internationalization
  123. settings of Windows by the initialization code of the unit.
  124. \begin{verbatim}
  125. Const
  126. ShortTimeFormat: string = 'hh:nn';
  127. LongTimeFormat: string = 'hh:nn:ss';
  128. TimeSeparator: char = ':';
  129. TimeAMString: string[7] = 'AM';
  130. TimePMString: string[7] = 'PM';
  131. \end{verbatim}
  132. The following constants control the formatting of currencies
  133. and numbers. For the Win32 version of the \file{sysutils} unit,
  134. these constants are set according to the internationalization
  135. settings of Windows by the initialization code of the unit.
  136. \begin{verbatim}
  137. Const
  138. DecimalSeparator : Char = '.';
  139. ThousandSeparator : Char = ',';
  140. CurrencyDecimals : Byte = 2;
  141. CurrencyString : String[7] = '$';
  142. { Format to use when formatting currency :
  143. 0 = $1 1 = 1$ 2 = $ 1 3 = 1 $
  144. 4 = Currency string replaces decimal indicator.
  145. e.g. 1$50
  146. }
  147. CurrencyFormat : Byte = 1;
  148. { Same as above, only for negative currencies:
  149. 0 = ($1)
  150. 1 = -$1
  151. 2 = $-1
  152. 3 = $1-
  153. 4 = (1$)
  154. 5 = -1$
  155. 6 = 1-$
  156. 7 = 1$-
  157. 8 = -1 $
  158. 9 = -$ 1
  159. 10 = $ 1-
  160. }
  161. NegCurrFormat : Byte = 5;
  162. \end{verbatim}
  163. The following types are used in various string functions.
  164. \begin{verbatim}
  165. type
  166. PString = ^String;
  167. TFloatFormat = (ffGeneral, ffExponent, ffFixed, ffNumber, ffCurrency);
  168. \end{verbatim}
  169. The following constants are used in the file name handling routines. Do not
  170. use a slash of backslash character directly as a path separator; instead
  171. use the \var{OsDirSeparator} character.
  172. \begin{verbatim}
  173. Const
  174. DirSeparators : set of char = ['/','\'];
  175. {$ifdef Linux}
  176. OSDirSeparator = '/';
  177. {$else}
  178. OsDirSeparator = '\';
  179. {$endif}
  180. \end{verbatim}
  181. \section{Date and time functions}
  182. \subsection{Date and time formatting characters}
  183. \label{se:formatchars}
  184. Various date and time formatting routines accept a format string.
  185. to format the date and or time. The following characters can be used
  186. to control the date and time formatting:
  187. \begin{description}
  188. \item[c] : shortdateformat + ' ' + shorttimeformat
  189. \item[d] : day of month
  190. \item[dd] : day of month (leading zero)
  191. \item[ddd] : day of week (abbreviation)
  192. \item[dddd] : day of week (full)
  193. \item[ddddd] : shortdateformat
  194. \item[dddddd] : longdateformat
  195. \item[m] : month
  196. \item[mm] : month (leading zero)
  197. \item[mmm] : month (abbreviation)
  198. \item[mmmm] : month (full)
  199. \item[y] : year (four digits)
  200. \item[yy] : year (two digits)
  201. \item[yyyy] : year (with century)
  202. \item[h] : hour
  203. \item[hh] : hour (leading zero)
  204. \item[n] : minute
  205. \item[nn] : minute (leading zero)
  206. \item[s] : second
  207. \item[ss] : second (leading zero)
  208. \item[t] : shorttimeformat
  209. \item[tt] : longtimeformat
  210. \item[am/pm] : use 12 hour clock and display am and pm accordingly
  211. \item[a/p] : use 12 hour clock and display a and p accordingly
  212. \item[/] : insert date seperator
  213. \item[:] : insert time seperator
  214. \item["xx"] : literal text
  215. \item['xx'] : literal text
  216. \end{description}
  217. \begin{type}{TDateTime}
  218. \Declaration
  219. TDateTime = Double;
  220. \Description
  221. Many functions return or require a \var{TDateTime} type, which contains
  222. a date and time in encoded form. The date and time are converted to a double
  223. as follows:
  224. \end{type}
  225. \begin{function}{Date}
  226. \Declaration
  227. Function Date: TDateTime;
  228. \Description
  229. \var{Date} returns the current date in \var{TDateTime} format.
  230. For more information about the \var{TDateTime} type, see \seety{TDateTime}.
  231. \Errors
  232. None.
  233. \SeeAlso
  234. \seef{Time},\seef{Now}, \seety{TDateTime}.
  235. \end{function}
  236. \latex{\inputlisting{sysutex/ex1.pp}}
  237. \html{\input{sysutex/ex1.tex}}
  238. \begin{function}{DateTimeToFileDate}
  239. \Declaration
  240. Function DateTimeToFileDate(DateTime : TDateTime) : Longint;
  241. \Description
  242. \var{DateTimeToFileDate} function converts a date/time indication in
  243. \var{TDateTime} format to a filedate function, such as returned for
  244. instance by the \seef{FileAge} function.
  245. \Errors
  246. None.
  247. \SeeAlso
  248. \seef{Time}, \seef{Date}, \seef{FileDateToDateTime},
  249. \seep{DateTimeToSystemTime}, \seef{DateTimeToTimeStamp}
  250. \end{function}
  251. \latex{\inputlisting{sysutex/ex2.pp}}
  252. \html{\input{sysutex/ex2.tex}}
  253. \begin{function}{DateTimeToStr}
  254. \Declaration
  255. Function DateTimeToStr(DateTime: TDateTime): string;
  256. \Description
  257. \var{DateTimeToStr} returns a string representation of
  258. \var{DateTime} using the formatting specified in
  259. \var{ShortDateTimeFormat}. It corresponds to a call to
  260. \var{FormatDateTime('c',DateTime)} (see \sees{formatchars}).
  261. \Errors
  262. None.
  263. \SeeAlso
  264. \seef{FormatDateTime}, \seety{TDateTime}.
  265. \end{function}
  266. \latex{\inputlisting{sysutex/ex3.pp}}
  267. \html{\input{sysutex/ex3.tex}}
  268. \begin{procedure}{DateTimeToString}
  269. \Declaration
  270. Procedure DateTimeToString(var Result: string; const FormatStr: string; const DateTime: TDateTime);
  271. \Description
  272. \var{DateTimeToString} returns in \var{Result} a string representation of
  273. \var{DateTime} using the formatting specified in \var{FormatStr}.
  274. for a list of characters that can be used in the \var{FormatStr} formatting
  275. string, see \sees{formatchars}.
  276. \Errors
  277. In case a wrong formatting character is found, an \var{EConvertError} is
  278. raised.
  279. \SeeAlso
  280. \seef{FormatDateTime}, \sees{formatchars}.
  281. \end{procedure}
  282. \latex{\inputlisting{sysutex/ex4.pp}}
  283. \html{\input{sysutex/ex4.tex}}
  284. \begin{procedure}{DateTimeToSystemTime}
  285. \Declaration
  286. Procedure DateTimeToSystemTime(DateTime: TDateTime; var SystemTime: TSystemTime);
  287. \Description
  288. \var{DateTimeToSystemTime} converts a date/time pair in \var{DateTime}, with
  289. \var{TDateTime} format to a system time \var{SystemTime}.
  290. \Errors
  291. None.
  292. \SeeAlso
  293. \seef{DateTimeToFileDate}, \seef{SystemTimeToDateTime},
  294. \seef{DateTimeToTimeStamp}
  295. \end{procedure}
  296. \latex{\inputlisting{sysutex/ex5.pp}}
  297. \html{\input{sysutex/ex5.tex}}
  298. \begin{function}{DateTimeToTimeStamp}
  299. \Declaration
  300. Function DateTimeToTimeStamp(DateTime: TDateTime): TTimeStamp;
  301. \Description
  302. \var{DateTimeToSystemTime} converts a date/time pair in \var{DateTime}, with
  303. \var{TDateTime} format to a \var{TTimeStamp} format.
  304. \Errors
  305. None.
  306. \SeeAlso
  307. \seef{DateTimeToFileDate}, \seef{SystemTimeToDateTime},
  308. \seef{DateTimeToSystemTime}
  309. \end{function}
  310. \latex{\inputlisting{sysutex/ex6.pp}}
  311. \html{\input{sysutex/ex6.tex}}
  312. \begin{function}{DateToStr}
  313. \Declaration
  314. Function DateToStr(Date: TDateTime): string;
  315. \Description
  316. \var{DateToStr} converts \var{Date} to a string representation. It uses
  317. \var{ShortDateFormat} as it's formatting string. It is hence completely
  318. equivalent to a \var{FormatDateTime('ddddd', Date)}.
  319. \Errors
  320. None.
  321. \SeeAlso
  322. \seef{TimeToStr}, \seef{DateTimeToStr}, \seef{FormatDateTime},
  323. \seef{StrToDate}
  324. \end{function}
  325. \latex{\inputlisting{sysutex/ex7.pp}}
  326. \html{\input{sysutex/ex7.tex}}
  327. \begin{function}{DayOfWeek}
  328. \Declaration
  329. Function DayOfWeek(DateTime: TDateTime): integer;
  330. \Description
  331. \var{DayOfWeek} returns the day of the week from \var{DateTime}.
  332. \var{Sunday} is counted as day 1, \var{Saturday} is counted as
  333. day 7. The result of \var{DayOfWeek} can serve as an index to
  334. the \var{LongDayNames} constant array, to retrieve the name of
  335. the day.
  336. \Errors
  337. None.
  338. \SeeAlso
  339. \seef{Date}, \seef{DateToStr}
  340. \end{function}
  341. \latex{\inputlisting{sysutex/ex8.pp}}
  342. \html{\input{sysutex/ex8.tex}}
  343. \begin{procedure}{DecodeDate}
  344. \Declaration
  345. Procedure DecodeDate(Date: TDateTime; var Year, Month, Day: word);
  346. \Description
  347. \var{DecodeDate} decodes the Year, Month and Day stored in \var{Date},
  348. and returns them in the \var{Year}, \var{Month} and \var{Day} variables.
  349. \Errors
  350. None.
  351. \SeeAlso
  352. \seef{EncodeDate}, \seep{DecodeTime}.
  353. \end{procedure}
  354. \latex{\inputlisting{sysutex/ex9.pp}}
  355. \html{\input{sysutex/ex9.tex}}
  356. \begin{procedure}{DecodeTime}
  357. \Declaration
  358. Procedure DecodeTime(Time: TDateTime; var Hour, Minute, Second, MilliSecond: word);
  359. \Description
  360. \var{DecodeDate} decodes the hours, minutes, second and milliseconds stored
  361. in \var{Time}, and returns them in the \var{Hour}, \var{Minute} and
  362. \var{Second} and \var{MilliSecond} variables.
  363. \Errors
  364. None.
  365. \SeeAlso
  366. \seef{EncodeTime}, \seep{DecodeDate}.
  367. \end{procedure}
  368. \latex{\inputlisting{sysutex/ex10.pp}}
  369. \html{\input{sysutex/ex10.tex}}
  370. \begin{function}{EncodeDate}
  371. \Declaration
  372. Function EncodeDate(Year, Month, Day :word): TDateTime;
  373. \Description
  374. \var{EncodeDate} encodes the \var{Year}, \var{Month} and \var{Day} variables to
  375. a date in \var{TDateTime} format. It does the opposite of the
  376. \seep{DecodeDate} procedure.
  377. The parameters must lie withing valid ranges (boundaries included):
  378. \begin{description}
  379. \item[Year] must be between 1 and 9999.
  380. \item[Month] must be within the range 1-12.
  381. \item[Day] msut be between 1 and 31.
  382. \end{description}
  383. \Errors
  384. In case one of the parameters is out of it's valid range, 0 is returned.
  385. \SeeAlso
  386. \seef{EncodeTime}, \seep{DecodeDate}.
  387. \end{function}
  388. \latex{\inputlisting{sysutex/ex11.pp}}
  389. \html{\input{sysutex/ex11.tex}}
  390. \begin{function}{EncodeTime}
  391. \Declaration
  392. Function EncodeTime(Hour, Minute, Second, MilliSecond:word): TDateTime;
  393. \Description
  394. \var{EncodeTime} encodes the \var{Hour}, \var{Minute}, \var{Second},
  395. \var{MilliSecond} variables to a \var{TDateTime} format result.
  396. It does the opposite of the \seep{DecodeTime} procedure.
  397. The parameters must have a valid range (boundaries included):
  398. \begin{description}
  399. \item[Hour] must be between 0 and 23.
  400. \item[Minute,second] must both be between 0 and 59.
  401. \item[Millisecond] must be between 0 and 999.
  402. \end{description}
  403. \Errors
  404. In case one of the parameters is outside of it's valid range, 0 is returned.
  405. \SeeAlso
  406. \seef{EncodeDate}, \seep{DecodeTime}.
  407. \end{function}
  408. \latex{\inputlisting{sysutex/ex12.pp}}
  409. \html{\input{sysutex/ex12.tex}}
  410. \begin{function}{FileDateToDateTime}
  411. \Declaration
  412. Function FileDateToDateTime(Filedate : Longint) : TDateTime;
  413. \Description
  414. \Errors
  415. \SeeAlso
  416. \end{function}
  417. \begin{function}{FormatDateTime}
  418. \Declaration
  419. Function FormatDateTime(FormatStr: string; DateTime: TDateTime):string;
  420. \Description
  421. \Errors
  422. \SeeAlso
  423. \end{function}
  424. \begin{function}{IncMonth}
  425. \Declaration
  426. Function IncMonth(const DateTime: TDateTime; NumberOfMonths: integer): TDateTime;
  427. \Description
  428. \Errors
  429. \SeeAlso
  430. \end{function}
  431. \begin{function}{IsLeapYear}
  432. \Declaration
  433. Function IsLeapYear(Year: Word): boolean;
  434. \Description
  435. \Errors
  436. \SeeAlso
  437. \end{function}
  438. \begin{function}{MSecsToTimeStamp}
  439. \Declaration
  440. Function MSecsToTimeStamp(MSecs: Comp): TTimeStamp;
  441. \Description
  442. \Errors
  443. \SeeAlso
  444. \end{function}
  445. \begin{function}{Now}
  446. \Declaration
  447. Function Now: TDateTime;
  448. \Description
  449. \Errors
  450. \SeeAlso
  451. \end{function}
  452. \begin{function}{StrToDate}
  453. \Declaration
  454. Function StrToDate(const S: string): TDateTime;
  455. \Description
  456. \Errors
  457. \SeeAlso
  458. \end{function}
  459. \begin{function}{StrToDateTime}
  460. \Declaration
  461. Function StrToDateTime(const S: string): TDateTime;
  462. \Description
  463. \Errors
  464. \SeeAlso
  465. \end{function}
  466. \begin{function}{StrToTime}
  467. \Declaration
  468. Function StrToTime(const S: string): TDateTime;
  469. \Description
  470. \Errors
  471. \SeeAlso
  472. \end{function}
  473. \begin{function}{SystemTimeToDateTime}
  474. \Declaration
  475. Function SystemTimeToDateTime(const SystemTime: TSystemTime): TDateTime;
  476. \Description
  477. \Errors
  478. \SeeAlso
  479. \end{function}
  480. \begin{function}{Time}
  481. \Declaration
  482. Function Time: TDateTime;
  483. \Description
  484. \Errors
  485. \SeeAlso
  486. \end{function}
  487. \begin{function}{TimeStampToDateTime}
  488. \Declaration
  489. Function TimeStampToDateTime(const TimeStamp: TTimeStamp): TDateTime;
  490. \Description
  491. \Errors
  492. \SeeAlso
  493. \end{function}
  494. \begin{function}{TimeStampToMSecs}
  495. \Declaration
  496. Function TimeStampToMSecs(const TimeStamp: TTimeStamp): comp;
  497. \Description
  498. \Errors
  499. \SeeAlso
  500. \end{function}
  501. \begin{function}{TimeToStr}
  502. \Declaration
  503. Function TimeToStr(Time: TDateTime): string;
  504. \Description
  505. \Errors
  506. \SeeAlso
  507. \end{function}
  508. \section{Disk functions}
  509. \begin{function}{CreateDir}
  510. \Declaration
  511. Function CreateDir(Const NewDir : String) : Boolean;
  512. \Description
  513. \Errors
  514. \SeeAlso
  515. \end{function}
  516. \begin{function}{DiskFree}
  517. \Declaration
  518. Function DiskFree(Drive : Byte) : Longint;
  519. \Description
  520. \Errors
  521. \SeeAlso
  522. \end{function}
  523. \begin{function}{DiskSize}
  524. \Declaration
  525. Function DiskSize(Drive : Byte) : Longint;
  526. \Description
  527. \Errors
  528. \SeeAlso
  529. \end{function}
  530. \begin{function}{GetCurrentDir}
  531. \Declaration
  532. Function GetCurrentDir : String;
  533. \Description
  534. \Errors
  535. \SeeAlso
  536. \end{function}
  537. \begin{function}{RemoveDir}
  538. \Declaration
  539. Function RemoveDir(Const Dir : String) : Boolean;
  540. \Description
  541. \Errors
  542. \SeeAlso
  543. \end{function}
  544. \begin{function}{SetCurrentDir}
  545. \Declaration
  546. Function SetCurrentDir(Const NewDir : String) : Boolean;
  547. \Description
  548. \Errors
  549. \SeeAlso
  550. \end{function}
  551. \section{File handling functions}
  552. \begin{function}{ChangeFileExt}
  553. \Declaration
  554. Function ChangeFileExt(const FileName, Extension: string): string;
  555. \Description
  556. \Errors
  557. \SeeAlso
  558. \end{function}
  559. \begin{function}{DeleteFile}
  560. \Declaration
  561. Function DeleteFile(Const FileName : String) : Boolean;
  562. \Description
  563. \Errors
  564. \SeeAlso
  565. \end{function}
  566. \begin{procedure}{DoDirSeparators}
  567. \Declaration
  568. Procedure DoDirSeparators(Var FileName : String);
  569. \Description
  570. \Errors
  571. \SeeAlso
  572. \end{procedure}
  573. \begin{function}{ExpandFileName}
  574. \Declaration
  575. Function ExpandFileName(Const FileName : string): String;
  576. \Description
  577. \Errors
  578. \SeeAlso
  579. \end{function}
  580. \begin{function}{ExpandUNCFileName}
  581. \Declaration
  582. Function ExpandUNCFileName(Const FileName : string): String;
  583. \Description
  584. \Errors
  585. \SeeAlso
  586. \end{function}
  587. \begin{function}{ExtractFileDir}
  588. \Declaration
  589. Function ExtractFileDir(Const FileName : string): string;
  590. \Description
  591. \Errors
  592. \SeeAlso
  593. \end{function}
  594. \begin{function}{ExtractFileDrive}
  595. \Declaration
  596. Function ExtractFileDrive(const FileName: string): string;
  597. \Description
  598. \Errors
  599. \SeeAlso
  600. \end{function}
  601. \begin{function}{ExtractFileExt}
  602. \Declaration
  603. Function ExtractFileExt(const FileName: string): string;
  604. \Description
  605. \Errors
  606. \SeeAlso
  607. \end{function}
  608. \begin{function}{ExtractFileName}
  609. \Declaration
  610. Function ExtractFileName(const FileName: string): string;
  611. \Description
  612. \Errors
  613. \SeeAlso
  614. \end{function}
  615. \begin{function}{ExtractFilePath}
  616. \Declaration
  617. Function ExtractFilePath(const FileName: string): string;
  618. \Description
  619. \Errors
  620. \SeeAlso
  621. \end{function}
  622. \begin{function}{ExtractRelativepath}
  623. \Declaration
  624. Function ExtractRelativepath(Const BaseName,DestNAme : String): String;
  625. \Description
  626. \Errors
  627. \SeeAlso
  628. \end{function}
  629. \begin{function}{FileAge}
  630. \Declaration
  631. Function FileAge(Const FileName : String): Longint;
  632. \Description
  633. \Errors
  634. \SeeAlso
  635. \end{function}
  636. \begin{procedure}{FileClose}
  637. \Declaration
  638. Procedure FileClose(Handle : Longint);
  639. \Description
  640. \Errors
  641. \SeeAlso
  642. \end{procedure}
  643. \begin{function}{FileCreate}
  644. \Declaration
  645. Function FileCreate(Const FileName : String) : Longint;
  646. \Description
  647. \Errors
  648. \SeeAlso
  649. \end{function}
  650. \begin{function}{FileExists}
  651. \Declaration
  652. Function FileExists(Const FileName : String) : Boolean;
  653. \Description
  654. \Errors
  655. \SeeAlso
  656. \end{function}
  657. \begin{function}{FileGetAttr}
  658. \Declaration
  659. Function FileGetAttr(Const FileName : String) : Longint;
  660. \Description
  661. \Errors
  662. \SeeAlso
  663. \end{function}
  664. \begin{function}{FileGetDate}
  665. \Declaration
  666. Function FileGetDate(Handle : Longint) : Longint;
  667. \Description
  668. \Errors
  669. \SeeAlso
  670. \end{function}
  671. \begin{function}{FileOpen}
  672. \Declaration
  673. Function FileOpen(Const FileName : string; Mode : Integer) : Longint;
  674. \Description
  675. \Errors
  676. \SeeAlso
  677. \end{function}
  678. \begin{function}{FileRead}
  679. \Declaration
  680. Function FileRead(Handle : Longint; Var Buffer; Count : longint) : Longint;
  681. \Description
  682. \Errors
  683. \SeeAlso
  684. \end{function}
  685. \begin{function}{FileSearch}
  686. \Declaration
  687. Function FileSearch(Const Name, DirList : String) : String;
  688. \Description
  689. \Errors
  690. \SeeAlso
  691. \end{function}
  692. \begin{function}{FileSeek}
  693. \Declaration
  694. Function FileSeek(Handle,Offset,Origin : Longint) : Longint;
  695. \Description
  696. \Errors
  697. \SeeAlso
  698. \end{function}
  699. \begin{function}{FileSetAttr}
  700. \Declaration
  701. Function FileSetAttr(Const Filename : String; Attr: longint) : Longint;
  702. \Description
  703. \Errors
  704. \SeeAlso
  705. \end{function}
  706. \begin{function}{FileSetDate}
  707. \Declaration
  708. Function FileSetDate(Handle,Age : Longint) : Longint;
  709. \Description
  710. \Errors
  711. \SeeAlso
  712. \end{function}
  713. \begin{function}{FileTruncate}
  714. \Declaration
  715. Function FileTruncate(Handle,Size: Longint) : boolean;
  716. \Description
  717. \Errors
  718. \SeeAlso
  719. \end{function}
  720. \begin{function}{FileWrite}
  721. \Declaration
  722. Function FileWrite(Handle : Longint; Var Buffer; Count : Longint) : Longint;
  723. \Description
  724. \Errors
  725. \SeeAlso
  726. \end{function}
  727. \begin{procedure}{FindClose}
  728. \Declaration
  729. Procedure FindClose(Var F : TSearchrec);
  730. \Description
  731. \Errors
  732. \SeeAlso
  733. \end{procedure}
  734. \begin{function}{FindFirst}
  735. \Declaration
  736. Function FindFirst(Const Path : String; Attr : Longint; Var Rslt : TSearchRec) : Longint;
  737. \Description
  738. \Errors
  739. \SeeAlso
  740. \end{function}
  741. \begin{function}{FindNext}
  742. \Declaration
  743. Function FindNext(Var Rslt : TSearchRec) : Longint;
  744. \Description
  745. \Errors
  746. \SeeAlso
  747. \end{function}
  748. \begin{function}{GetDirs}
  749. \Declaration
  750. Function GetDirs(Var DirName : String; Var Dirs : Array of pchar) : Longint;
  751. \Description
  752. \Errors
  753. \SeeAlso
  754. \end{function}
  755. \begin{function}{RenameFile}
  756. \Declaration
  757. Function RenameFile(Const OldName, NewName : String) : Boolean;
  758. \Description
  759. \Errors
  760. \SeeAlso
  761. \end{function}
  762. \begin{function}{SetDirSeparators}
  763. \Declaration
  764. Function SetDirSeparators(Const FileName : String) : String;
  765. \Description
  766. \Errors
  767. \SeeAlso
  768. \end{function}
  769. \section{PChar functions}
  770. \begin{function}{StrAlloc}
  771. \Declaration
  772. Function StrAlloc(Size: cardinal): PChar;
  773. \Description
  774. \Errors
  775. \SeeAlso
  776. \end{function}
  777. \begin{function}{StrBufSize}
  778. \Declaration
  779. Function StrBufSize(var Str: PChar): cardinal;
  780. \Description
  781. \Errors
  782. \SeeAlso
  783. \end{function}
  784. \begin{procedure}{StrDispose}
  785. \Declaration
  786. Procedure StrDispose(var Str: PChar);
  787. \Description
  788. \Errors
  789. \SeeAlso
  790. \end{procedure}
  791. \begin{function}{StrPCopy}
  792. \Declaration
  793. Function StrPCopy(Dest: PChar; Source: string): PChar;
  794. \Description
  795. \Errors
  796. \SeeAlso
  797. \end{function}
  798. \begin{function}{StrPLCopy}
  799. \Declaration
  800. Function StrPLCopy(Dest: PChar; Source: string; MaxLen: cardinal): PChar;
  801. \Description
  802. \Errors
  803. \SeeAlso
  804. \end{function}
  805. \begin{function}{StrPas}
  806. \Declaration
  807. Function StrPas(Str: PChar): string;
  808. \Description
  809. \Errors
  810. \SeeAlso
  811. \end{function}
  812. \begin{function}{StrCat}
  813. \Declaration
  814. Function StrCat(dest,source : pchar) : pchar;
  815. \Description
  816. \Errors
  817. \SeeAlso
  818. \end{function}
  819. \begin{function}{StrComp}
  820. \Declaration
  821. Function StrComp(str1,str2 : pchar) : longint;
  822. \Description
  823. \Errors
  824. \SeeAlso
  825. \end{function}
  826. \begin{function}{StrCopy}
  827. \Declaration
  828. Function StrCopy(dest,source : pchar) : pchar;
  829. \Description
  830. \Errors
  831. \SeeAlso
  832. \end{function}
  833. \begin{function}{StrECopy}
  834. \Declaration
  835. Function StrECopy(dest,source : pchar) : pchar;
  836. \Description
  837. \Errors
  838. \SeeAlso
  839. \end{function}
  840. \begin{function}{StrEnd}
  841. \Declaration
  842. Function StrEnd(p : pchar) : pchar;
  843. \Description
  844. \Errors
  845. \SeeAlso
  846. \end{function}
  847. \begin{function}{StrIComp}
  848. \Declaration
  849. Function StrIComp(str1,str2 : pchar) : longint;
  850. \Description
  851. \Errors
  852. \SeeAlso
  853. \end{function}
  854. \begin{function}{StrLCat}
  855. \Declaration
  856. Function StrLCat(dest,source : pchar;l : longint) : pchar;
  857. \Description
  858. \Errors
  859. \SeeAlso
  860. \end{function}
  861. \begin{function}{StrLComp}
  862. \Declaration
  863. Function StrLComp(str1,str2 : pchar;l : longint) : longint;
  864. \Description
  865. \Errors
  866. \SeeAlso
  867. \end{function}
  868. \begin{function}{StrLCopy}
  869. \Declaration
  870. Function StrLCopy(dest,source : pchar;maxlen : longint) : pchar;
  871. \Description
  872. \Errors
  873. \SeeAlso
  874. \end{function}
  875. \begin{function}{StrLen}
  876. \Declaration
  877. Function StrLen(p : pchar) : longint;
  878. \Description
  879. \Errors
  880. \SeeAlso
  881. \end{function}
  882. \begin{function}{StrLIComp}
  883. \Declaration
  884. Function StrLIComp(str1,str2 : pchar;l : longint) : longint;
  885. \Description
  886. \Errors
  887. \SeeAlso
  888. \end{function}
  889. \begin{function}{StrLower}
  890. \Declaration
  891. Function strlower(p : pchar) : pchar;
  892. \Description
  893. \Errors
  894. \SeeAlso
  895. \end{function}
  896. \begin{function}{StrMove}
  897. \Declaration
  898. Function StrMove(dest,source : pchar;l : longint) : pchar;
  899. \Description
  900. \Errors
  901. \SeeAlso
  902. \end{function}
  903. \begin{function}{StrNew}
  904. \Declaration
  905. Function StrNew(p : pchar) : pchar;
  906. \Description
  907. \Errors
  908. \SeeAlso
  909. \end{function}
  910. \begin{function}{StrPos}
  911. \Declaration
  912. Function StrPos(str1,str2 : pchar) : pchar;
  913. \Description
  914. \Errors
  915. \SeeAlso
  916. \end{function}
  917. \begin{function}{StrRScan}
  918. \Declaration
  919. Function StrRScan(p : pchar;c : char) : pchar;
  920. \Description
  921. \Errors
  922. \SeeAlso
  923. \end{function}
  924. \begin{function}{StrScan}
  925. \Declaration
  926. Function StrScan(p : pchar;c : char) : pchar;
  927. \Description
  928. \Errors
  929. \SeeAlso
  930. \end{function}
  931. \begin{function}{StrUpper}
  932. \Declaration
  933. Function StrUpper(p : pchar) : pchar;
  934. \Description
  935. \Errors
  936. \SeeAlso
  937. \end{function}
  938. \section{String functions}
  939. \begin{function}{AdjustLineBreaks}
  940. \Declaration
  941. Function AdjustLineBreaks(const S: string): string;
  942. \Description
  943. \Errors
  944. \SeeAlso
  945. \end{function}
  946. \begin{function}{AnsiCompareStr}
  947. \Declaration
  948. Function AnsiCompareStr(const S1, S2: string): integer;
  949. \Description
  950. \Errors
  951. \SeeAlso
  952. \end{function}
  953. \begin{function}{AnsiCompareText}
  954. \Declaration
  955. Function AnsiCompareText(const S1, S2: string): integer;
  956. \Description
  957. \Errors
  958. \SeeAlso
  959. \end{function}
  960. \begin{function}{AnsiExtractQuotedStr}
  961. \Declaration
  962. Function AnsiExtractQuotedStr(var Src: PChar; Quote: Char): string;
  963. \Description
  964. \Errors
  965. \SeeAlso
  966. \end{function}
  967. \begin{function}{AnsiLastChar}
  968. \Declaration
  969. Function AnsiLastChar(const S: string): PChar;
  970. \Description
  971. \Errors
  972. \SeeAlso
  973. \end{function}
  974. \begin{function}{AnsiLowerCase}
  975. \Declaration
  976. Function AnsiLowerCase(const s: string): string;
  977. \Description
  978. \Errors
  979. \SeeAlso
  980. \end{function}
  981. \begin{function}{AnsiQuotedStr}
  982. \Declaration
  983. Function AnsiQuotedStr(const S: string; Quote: char): string;
  984. \Description
  985. \Errors
  986. \SeeAlso
  987. \end{function}
  988. \begin{function}{AnsiStrComp}
  989. \Declaration
  990. Function AnsiStrComp(S1, S2: PChar): integer;
  991. \Description
  992. \Errors
  993. \SeeAlso
  994. \end{function}
  995. \begin{function}{AnsiStrIComp}
  996. \Declaration
  997. Function AnsiStrIComp(S1, S2: PChar): integer;
  998. \Description
  999. \Errors
  1000. \SeeAlso
  1001. \end{function}
  1002. \begin{function}{AnsiStrLComp}
  1003. \Declaration
  1004. Function AnsiStrLComp(S1, S2: PChar; MaxLen: cardinal): integer;
  1005. \Description
  1006. \Errors
  1007. \SeeAlso
  1008. \end{function}
  1009. \begin{function}{AnsiStrLIComp}
  1010. \Declaration
  1011. Function AnsiStrLIComp(S1, S2: PChar; MaxLen: cardinal): integer;
  1012. \Description
  1013. \Errors
  1014. \SeeAlso
  1015. \end{function}
  1016. \begin{function}{AnsiStrLast}
  1017. \Declaration
  1018. Function AnsiStrLast(Str: PChar): PChar;
  1019. \Description
  1020. \Errors
  1021. \SeeAlso
  1022. \end{function}
  1023. \begin{function}{CharAnsiStrLower}
  1024. \Declaration
  1025. Function AnsiStrLower(Str: PChar): PChar;
  1026. \Description
  1027. \Errors
  1028. \SeeAlso
  1029. \end{function}
  1030. \begin{function}{AnsiStrUpper}
  1031. \Declaration
  1032. Function AnsiStrUpper(Str: PChar): PChar;
  1033. \Description
  1034. \Errors
  1035. \SeeAlso
  1036. \end{function}
  1037. \begin{function}{AnsiUpperCase}
  1038. \Declaration
  1039. Function AnsiUpperCase(const s: string): string;
  1040. \Description
  1041. \Errors
  1042. \SeeAlso
  1043. \end{function}
  1044. \begin{procedure}{AppendStr}
  1045. \Declaration
  1046. Procedure AppendStr(var Dest: PString; const S: string);
  1047. \Description
  1048. \Errors
  1049. \SeeAlso
  1050. \end{procedure}
  1051. \begin{procedure}{AssignStr}
  1052. \Declaration
  1053. Procedure AssignStr(var P: PString; const S: string);
  1054. \Description
  1055. \Errors
  1056. \SeeAlso
  1057. \end{procedure}
  1058. \begin{function}{BCDToInt}
  1059. \Declaration
  1060. Function BCDToInt(Value: integer): integer;
  1061. \Description
  1062. \Errors
  1063. \SeeAlso
  1064. \end{function}
  1065. \begin{function}{CompareMem}
  1066. \Declaration
  1067. Function CompareMem(P1, P2: Pointer; Length: cardinal): integer;
  1068. \Description
  1069. \Errors
  1070. \SeeAlso
  1071. \end{function}
  1072. \begin{function}{CompareStr}
  1073. \Declaration
  1074. Function CompareStr(const S1, S2: string): Integer;
  1075. \Description
  1076. \Errors
  1077. \SeeAlso
  1078. \end{function}
  1079. \begin{function}{CompareText}
  1080. \Declaration
  1081. Function CompareText(const S1, S2: string): integer;
  1082. \Description
  1083. \Errors
  1084. \SeeAlso
  1085. \end{function}
  1086. \begin{procedure}{DisposeStr}
  1087. \Declaration
  1088. Procedure DisposeStr(S: PString);
  1089. \Description
  1090. \Errors
  1091. \SeeAlso
  1092. \end{procedure}
  1093. \begin{function}{FloatToStr}
  1094. \Declaration
  1095. Function FloatToStr(Value: Extended): String;
  1096. \Description
  1097. \Errors
  1098. \SeeAlso
  1099. \end{function}
  1100. \begin{function}{FloatToStrF}
  1101. \Declaration
  1102. Function FloatToStrF(Value: Extended; format: TFloatFormat; Precision, Digits: Integer): String;
  1103. \Description
  1104. \Errors
  1105. \SeeAlso
  1106. \end{function}
  1107. \begin{procedure}{FmtStr}
  1108. \Declaration
  1109. Procedure (Var Res: String; Const Fmt : String; Const args: Array of const);
  1110. \Description
  1111. \Errors
  1112. \SeeAlso
  1113. \end{procedure}
  1114. \begin{function}{Format}
  1115. \Declaration
  1116. Function Format(Const Fmt : String; const Args : Array of const) : String;
  1117. \Description
  1118. \Errors
  1119. \SeeAlso
  1120. \end{function}
  1121. \begin{function}{FormatBuf}
  1122. \Declaration
  1123. Function FormatBuf(Var Buffer; BufLen : Cardinal; Const Fmt; fmtLen : Cardinal; Const Args : Array of const) : Cardinal;
  1124. \Description
  1125. \Errors
  1126. \SeeAlso
  1127. \end{function}
  1128. \begin{function}{IntToHex}
  1129. \Declaration
  1130. Function IntToHex(Value: integer; Digits: integer): string;
  1131. \Description
  1132. \Errors
  1133. \SeeAlso
  1134. \end{function}
  1135. \begin{function}{IntToStr}
  1136. \Declaration
  1137. Function IntToStr(Value: integer): string;
  1138. \Description
  1139. \Errors
  1140. \SeeAlso
  1141. \end{function}
  1142. \begin{function}{IsValidIdent}
  1143. \Declaration
  1144. Function IsValidIdent(const Ident: string): boolean;
  1145. \Description
  1146. \Errors
  1147. \SeeAlso
  1148. \end{function}
  1149. \begin{function}{LeftStr}
  1150. \Declaration
  1151. Function LeftStr(const S: string; Count: integer): string;
  1152. \Description
  1153. \Errors
  1154. \SeeAlso
  1155. \end{function}
  1156. \begin{function}{LoadStr}
  1157. \Declaration
  1158. Function LoadStr(Ident: integer): string;
  1159. \Description
  1160. \Errors
  1161. \SeeAlso
  1162. \end{function}
  1163. \begin{function}{LowerCase}
  1164. \Declaration
  1165. Function LowerCase(const s: string): string;
  1166. \Description
  1167. \Errors
  1168. \SeeAlso
  1169. \end{function}
  1170. \begin{function}{NewStr}
  1171. \Declaration
  1172. Function NewStr(const S: string): PString;
  1173. \Description
  1174. \Errors
  1175. \SeeAlso
  1176. \end{function}
  1177. \begin{function}{QuotedStr}
  1178. \Declaration
  1179. Function QuotedStr(const S: string): string;
  1180. \Description
  1181. \Errors
  1182. \SeeAlso
  1183. \end{function}
  1184. \begin{function}{RightStr}
  1185. \Declaration
  1186. Function RightStr(const S: string; Count: integer): string;
  1187. \Description
  1188. \Errors
  1189. \SeeAlso
  1190. \end{function}
  1191. \begin{function}{StrFmt}
  1192. \Declaration
  1193. Function StrFmt(Buffer,Fmt : PChar; Const args: Array of const) : Pchar;
  1194. \Description
  1195. \Errors
  1196. \SeeAlso
  1197. \end{function}
  1198. \begin{function}{StrLFmt}
  1199. \Declaration
  1200. Function StrLFmt(Buffer : PCHar; Maxlen : Cardinal;Fmt : PChar; Const args: Array of const) : Pchar;
  1201. \Description
  1202. \Errors
  1203. \SeeAlso
  1204. \end{function}
  1205. \begin{function}{StrToInt}
  1206. \Declaration
  1207. Function StrToInt(const s: string): integer;
  1208. \Description
  1209. \Errors
  1210. \SeeAlso
  1211. \end{function}
  1212. \begin{function}{StrToIntDef}
  1213. \Declaration
  1214. Function StrToIntDef(const S: string; Default: integer): integer;
  1215. \Description
  1216. \Errors
  1217. \SeeAlso
  1218. \end{function}
  1219. \begin{function}{Trim}
  1220. \Declaration
  1221. Function Trim(const S: string): string;
  1222. \Description
  1223. \Errors
  1224. \SeeAlso
  1225. \end{function}
  1226. \begin{function}{TrimLeft}
  1227. \Declaration
  1228. Function TrimLeft(const S: string): string;
  1229. \Description
  1230. \Errors
  1231. \SeeAlso
  1232. \end{function}
  1233. \begin{function}{TrimRight}
  1234. \Declaration
  1235. Function TrimRight(const S: string): string;
  1236. \Description
  1237. \Errors
  1238. \SeeAlso
  1239. \end{function}
  1240. \begin{function}{UpperCase}
  1241. \Declaration
  1242. Function UpperCase(const s: string): string;
  1243. \Description
  1244. \Errors
  1245. \SeeAlso
  1246. \end{function}