These interfaces are implemented using the Wildmatch package of XSB. This package provides the following functionality:
[abc]
'' or
``[^abc]
'') are supported.To use this package, you need to type:
| ?- [wildmatch].If you are planning to use it in an XSB program, you need this directive:
:- import glob_directory/4, wildmatch/3, convert_string/3 from wildmatch.
The calling sequence for glob_directory/4
is:
glob_directory(+Wildcard, +Directory, ?MarkDirs, -FileList)The parameter Wildcard can be either a Prolog atom or a Prolog string. Directory is also an atom or a string; it specifies the directory to be globbed. MarkDirs indicates whether directory names should be decorated with a trailing slash: if MarkDirs is bound, then directories will be so decorated. If MarkDirs is an unbound variable, then trailing slashes will not be added.
FileList gets the list of files in Directory that match Wildcard. If Directory is bound to an atom, then FileList gets bound to a list of atoms; if Directory is a Prolog string, then FileList will be bound to a list of strings as well.
This predicate succeeds is at least one match is found. If no matches are found or if Directory does not exist or cannot be read, then the predicate fails.
The calling sequence for wildmatch/3 is as follows:
wildmatch(+Wildcard, +String, ?IgnoreCase)Wildcard is the same as before. String represents the string to be matched against Wildcard. Like Wildcard, String can be an atom or a string. IgnoreCase indicates whether case of letters should be ignored during matching. Namely, if this argument is bound to a non-variable, then the case of letters is ignored. Otherwise, if IgnoreCase is a variable, then the case of letters is preserved.
This predicate succeeds when Wildcard matches String and fails otherwise.
The calling sequence for convert_string/3 is as follows:
convert_string(+InputString, +OutputString, +ConversionFlag)The input string must be an atom or a character list. The output string must be unbound. Its type will ``atom'' if so was the input and it will be a character list if so was the input string. The conversion flag must be the atom tolower or toupper.
This predicate always succeeds, unless there was an error, such as wrong type argument passed as a parameter.