Charles.Forsyth20070115bd7846519 years agoHistory
83 lines · 2.0 KB · Text
RawDownload
.TH COMPLETE 2.SH NAMEcomplete \- file name completion.SH SYNOPSIS.EXinclude "complete.m";complete := load Complete Complete->PATH; Completion: adt {    advance:  int;    # whether forward progress has been made    complete: int;    # whether the completion now represents a file or directory    str:      string; # string to advance, suffixed " " (file) or "/" (directory)    nmatch:   int;    # number of files that matched    filename: array of string;    # their names}; init:     fn();complete: fn(dir, s: string): (ref Completion, string);.EX.SH DESCRIPTION.B Completeimplements file name completion..PP.B Initmust be called before any other operation of the module..PPGiven a directory.I dirand a string.IR s ,.B completereturns a tuple.BI ( c,\ err ),where.I cis an analysis of the file names in that directory that begin with the string.IR s .The field.B nmatchwill be set to the number of files that match the prefix and.B filenamewill be filled in with their names.If the file named is a directory, a slash character will be appended to it.On an error,.I cis nil and.I erris a diagnostic string..PPIf no files match the string,.B nmatchwill be zero, but.I completewill return the full set of files in the directory..PPThe flag.B advancereports whether the string.I scan be extended without changing the set of files that match.  If true,.B strwill be set to the extension; that is, the value of.B strmay be appended to.I sby the caller to extend the embryonic file name unambiguously..PPThe flag.B completereports whether the extended file name uniquely identifies a file.If true,.B strwill be suffixed with a blank, or a slash and a blank,depending on whether the resulting file name identifies a plain file or a directory..SH SOURCE.B /appl/lib/complete.b.SH SEE ALSO.IR names (2).SH DIAGNOSTICSThe.I completefunction returns a nil reference and a diagnostic stringif the directory is unreadable or there is some other error.