From: George H. <geo...@us...> - 2006-09-22 10:50:25
|
Update of /cvsroot/win32forth/win32forth/doc In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15918/win32forth/doc Added Files: p-ansfile.htm Log Message: gah:Adde more documentaion for ansfile --- NEW FILE: p-ansfile.htm --- <?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta name="GENERATOR" content="dexh v03"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title> W32F ansfile</title><style><!-- h1 { font-family: Tahoma; font-size: 24pt; font-weight: bold } h2 { font-family: Tahoma; font-size: 18pt; font-weight: bold } --> </style> </head> <body><h1 align="center"> <a href="mailto:win...@ya...?subject=DOC:Doc error in $Id: p-ansfile.htm,v 1.1 2006/09/22 10:50:22 georgeahubert Exp $"> <img border="0" src="TELLUS.gif" align="left" width="32" height="32"></a> <img border="0" src="FORTHPRO.gif" width="32" height="32"> Win32Forth</h1> <hr /><h1>File and directory searching words. </h1><hr /><p>These words are extensions to the ANSI file words for finding files. </p>If ior = 0, operation is O.K.; Otherwse, it is a failure. <h2>Glossary </h2><pre><b><a name="0">cell newuser _hdl-search ( -- addr ) </a></b></pre><p>Variable holding handle. </p><pre><b><a name="1">0 newuser _systemtime </a></b></pre><p>Structure FileTimeToSystemTime function; this struc is same as time-buf in kernel.tom </p><pre><b><a name="2">: get-fspace { zroot \ clus freclus b/sec s/clus -- as bs cs ds } </a></b></pre><p>Get a drive's free space, cluster and sector information "zroot" is the root directory spec zString for the desired drive in the format z" x:\", where x can be a, b, c, d or e etc... </p><pre><b><a name="3">: find-first-file ( addr1 len1 -- addr2 ior ) </a></b></pre><p>addr1 len1 is a string that specifies a valid directory or path and filename, which can contain wildcard characters (* and ?). This string must not exceed MAX_PATH characters. addr2 is the address of the _win32-find-data structure. ior is 0 for success in which case _hdl-search contains a valid handle. </p><p>Find-First-File searches a directory for a file whose name matches the specified filename. Find-First-File examines subdirectory names as well as filenames. </p><p>Find-First-File opens a search handle and returns information about the first file whose name matches the specified pattern. Once the search handle is established, you can use Find-Next-File to search for other files that match the same pattern. When the search handle is no longer needed, close it by using Find-Close. Find-First-File searches for files by name only; it cannot be used for attribute-based searches. </p><pre><b><a name="4">: find-next-file ( -- addr ior ) </a></b></pre><p>Find-first-file word must be called before this word can be called due to the fact that _hdl-search is needed </p><pre><b><a name="5">: find-close ( -- ior ) </a></b></pre><p>Close the _hdl-search handle. </p><pre><b><a name="6">: get-DOS-create-datetime ( -- ;convert 64 bit file time to MS_DOS ) </a></b></pre><p>Date and time values of creation. <br /> You need to call find-first-file or find-next-file word in the current task before using this word. </p><pre><b><a name="7">: get-DOS-access-datetime ( -- ;convert 64 bit file time to MS_DOS ) </a></b></pre><p>date and time values of last access. <br /> You need to call find-first-file or find-next-file word in the current task before using this word. </p><pre><b><a name="8">: get-DOS-write-datetime ( -- ;convert 64 bit file time to MS_DOS ) </a></b></pre><p>Date and time values of last write. <br /> You need to call find-first-file or find-next-file word in the current task before using this word. </p><pre><b><a name="9">: get-file-size ( -- size ) \ W32F Files Extra </a></b></pre><p>Size of the last found file. <br /> You need to call find-first-file or find-next-file word in the current task before using this word. </p><pre><b><a name="10">: get-file-name ( -- adr; address for file name ) </a></b></pre><p>get the name of the last found file. <br /> You need to call find-first-file or find-next-file word in the current task before using this word. </p><pre><b><a name="11">: dir-attribute? ( - flag ) </a></b></pre><p>Returns true when a file is a directory. <br /> You need to call find-first-file or find-next-file word in the current task before using this word. <br /> Can be used in combination with ForAllFileNames </p><pre><b><a name="12">2 cells newuser file-time-buf </a></b></pre><p>2Variable to hold the FILETIME structure, which is a little endian (i.e. reversed order) 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601. </p><pre><b><a name="13">: dir->file-name ( -- adr count ) </a></b></pre><p>Returns the address and count of a file in a directory. <br /> Need to call find-first-file or find-next-file word before using this word. <br /> Can be used in combination with ForAllFileNames </p><pre><b><a name="14">: ForAllFileNames { cfa } ( adr slen cfa -- ) </a></b></pre><p>Executes the CFA for each found file in a directory. <br /> A file specification adr slen may contain wildcards <br /> NOTE: Directory names are also considered to be a file-name. <br /> Directory names can be detected by dir-attribute? </p><pre><b><a name="15">: ForAllFiles ( cfa -- ) </a></b></pre><p>Executes the CFA on ALL found files in a directory. <br /> NOTE: Directory names are also considered to be a file-name. <br /> Directory names can be detected by dir-attribute? <br /> </p><pre><b><a name="16">: .dir->file-size ( -- ) </a></b></pre><p>Print the size or directory indication of a file <br /> Need to call find-first-file or find-next-file word before using this word. <br /> Can be used in combination with ForAllFileNames </p><pre><b><a name="17">: .file-size-name ( adr len - ) </a></b></pre><p>Print the size or directory indication and the name of file. It also formats the line. <br /> Need to call find-first-file or find-next-file word before using this word. <br /> Can be used in combination with ForAllFileNames </p><pre><b><a name="18">: print-dir-files ( adr slen -- ) \ W32F Files Extra </a></b></pre><p>Print all the files and sub-directories in a directory that match a specific pattern. </p><pre><b><a name="19">: dir ( "name" -- ) \ W32F Files Extra </a></b></pre><p>Print all the files and sub-directories in a directory that match a specific pattern. <br /> If "name" is missing or ends in \ or / search for all files that match *.* <br /> If "name" contains a relative path then it's relative to the current directory. <br /> If "name" ends in : assume a drive use "name"\*.* for the search pattern. <br /> </p><p>The pattern can contain the standard Windows wildcards. </p><hr><p>Document $Id: p-ansfile.htm,v 1.1 2006/09/22 10:50:22 georgeahubert Exp $</p> </body></html> |