Outdated egg!

This is an egg for CHICKEN 3, the unsupported old release. You're almost certainly looking for the CHICKEN 4 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

  1. Outdated egg!
  2. FSPath - CommonLISP style Namestring and Pathname Object
    1. Namestring
    2. Record fs:pathname
    3. Record fs:filename
    4. UNC
    5. FIL
    6. FSS
    7. Parameters
      1. fs:default-unc-format
      2. fs:allow-empty-name
    8. Pathname Procedures
      1. fs:pathname?
      2. fs:make-pathname
      3. fs:pathname-host
      4. fs:pathname-origin
      5. fs:pathname-directory
      6. fs:pathname-filename
      7. ->fs:pathname
      8. fs:pathname-namestring
      9. fs:pathname-components
      10. fs:pathname+filename-components
      11. fs:make-relative-pathname
      12. fs:namestring->pathname
      13. uri->fs:pathname
      14. fs:pathname-default
      15. fs:pathname/host
      16. fs:pathname/origin
      17. fs:pathname/directory
      18. fs:pathname/filename
      19. fs:pathname/base
      20. fs:pathname/extensions
      21. fs:pathname/version
      22. fs:pathname=?
      23. fs:pathname-eqv?
      24. fs:filename-pathname?
      25. fs:filename-pathname
      26. fs:directory-pathname?
      27. fs:directory-pathname
      28. fs:directory-namestring
      29. fs:host-namestring
      30. fs:pathname-namelist
      31. fs:pathname->uri
      32. fs:expand-pathname
      33. fs:pathname-container
      34. fs:pathname-parent-directory
      35. fs:enough-pathname
      36. fs:enough-namestring
      37. fs:pathname-complete?
      38. ->fs:namestring
    9. Filename Procedures
      1. fs:filename?
      2. fs:make-filename
      3. fs:filename-base
      4. fs:filename-extensions
      5. fs:filename-version
      6. ->fs:filename
      7. fs:filename-namestring
      8. fs:filename-components
      9. fs:namestring->filename
      10. fs:filename-namestring
      11. fs:filename-default
      12. fs:filename/base
      13. fs:filename/extensions
      14. fs:filename/version
      15. fs:filename=?
      16. fs:filename-base?
      17. fs:filename-extensions?
      18. fs:filename-extension
      19. fs:filename-version?
      20. fs:filename-complete?
      21. fs:enough-filename
      22. fs:merge-filenames
      23. fs:filename-namelist
    10. Primitive Procedures
      1. fs$make-filename
      2. fs$make-filename/components
      3. fs$filename-base-set!
      4. fs$filename-extensions-set!
      5. fs$filename-version-set!
      6. fs$make-pathname
      7. fs$make-pathname/components
      8. fs$pathname-host-set!
      9. fs$pathname-origin-set!
      10. fs$pathname-directory-set!
      11. fs$pathname-filename-set!
    11. Usage
    12. Requirements
    13. Authors
    14. License
    15. Version History
    16. Bugs

FSPath - CommonLISP style Namestring and Pathname Object

FSPath is an extension of unit utils pathname concept.

The extended pathname is referred to as a namestring.

The CommonLISP pathname object analog is the fs:pathname record object.

Namestring

Four styles of namestring are supported:

UNC
Universal Naming Convention, platform specific
FIL
Filename, platform specific
URI
Universal Resource Identifier
FSS
Filesystem Specific (Unimplemented)

Record fs:pathname

These namestring forms are mapped into fs:pathname components:

host
host descriptor - hostname, IP address, domain name
origin
drive, port, volume, device, logical name, environment variable
directory
list of fs:filename representing directory components
filename
fs:fIlename

The fs:pathname record is to be a logical pathname, portable across platforms.

Any missing component is represented by #f.

A SRFI-10 reader and printer are supplied.

Record fs:filename

These namestring forms are mapped into fs:filename components:

base
string or symbol
extensions
list-of string or symbol
version
positive integer, symbol oldest, or symbol newest

The fs:filename record is to be a logical filename, portable across platforms.

Any missing component is represented by #f.

A SRFI-10 reader and printer are supplied.

UNC

Windows:

\\<host>\<origin>\<directory>\<name>.<extension>[.<extension> ...]~<version>~

\\?\UNC\<host>\<origin>\<directory>\<name>.<extension>[.<extension> ...].~<version>~

Unix:

//<host>/<origin>/<directory>/<name>.<extension>[.<extension> ...].~<version>~

<host>:/<origin>/<directory>/<name>.<extension>[.<extension> ...].~<version>~

FIL

Windows:

<origin>:\<directory>\<name>.<extension>[.<extension> ...]~<version>~

\\?\<origin>:\<directory>\<name>.<extension>[.<extension> ...]~<version>~

Unix:

/<directory>/<base>.<extension>[.<extension> ...]~<version>~

FSS

This form is filesystem specific.

<specific>

Parameters

fs:default-unc-format

[procedure] (fs:default-unc-format [FORM])

Gets or sets the behavior for converting a unc form to a namestring. Accepatble FORM is one of colon, slash, or uri.

fs:allow-empty-name

[procedure] (fs:allow-empty-name [FLAG])

Gets or sets the behavior for an empty namestring, where #f means empty strings are ignored.

Pathname Procedures

fs:pathname?

[procedure] (fs:pathname? OBJECT)

Is the OBJECT an fs:pathname object?

fs:make-pathname

[procedure] (fs:make-pathname FILENAME)
[procedure] (fs:make-pathname [DIRECTORY] FILENAME)
[procedure] (fs:make-pathname [BASE] DIRECTORY FILENAME)
[procedure] (fs:make-pathname [HOST] BASE DIRECTORY FILENAME)

Returns a new fs:pathname object. Default for all parameters is #f.

When directory is a string it is split into a list.

fs:pathname-host

[procedure] (fs:pathname-host PATHNAME)

Gets the host component of the PATHNAME object.

fs:pathname-origin

[procedure] (fs:pathname-origin PATHNAME)

Gets the origin component of the PATHNAME object.

fs:pathname-directory

[procedure] (fs:pathname-directory PATHNAME)

Gets the directory component of the PATHNAME object.

fs:pathname-filename

[procedure] (fs:pathname-filename PATHNAME)

Gets the filename component of the PATHNAME object.

->fs:pathname

[procedure] (->fs:pathname OBJECT)

Returns a new fs:pathname object from the OBJECT.

fs:pathname-namestring

[procedure] (fs:pathname-namestring PATHNAME)

Returns a new NAMESTRING from the PATHNAME object.

fs:pathname-components

[procedure] (fs:pathname-components PATHNAME)

Returns a list of the PATHNAME fields.

fs:pathname+filename-components

[procedure] (fs:pathname+filename-components PATHNAME)

Returns a list of the PATHNAME and the PATHNAME-FILENAME fields.

fs:make-relative-pathname

[procedure] (fs:make-relative-pathname DIRECTORY FILENAME)

Returns fs:pathname.

fs:namestring->pathname

[procedure] (fs:namestring->pathname NAMESTRING)

Returns fs:pathname.

uri->fs:pathname

[procedure] (uri->fs:pathname URI)

Returns fs:pathname.

fs:pathname-default

[procedure] (fs:pathname-default PATHNAME [FILENAME])
[procedure] (fs:pathname-default PATHNAME [DIRECTORY] FILENAME)
[procedure] (fs:pathname-default PATHNAME [ORIGIN] DIRECTORY FILENAME)
[procedure] (fs:pathname-default PATHNAME [HOST] ORIGIN DIRECTORY FILENAME)

Returns fs:pathname.

fs:pathname/host

[procedure] (fs:pathname/host PATHNAME HOST)

Returns fs:pathname.

fs:pathname/origin

[procedure] (fs:pathname/origin PATHNAME ORIGIN)

Returns fs:pathname.

fs:pathname/directory

[procedure] (fs:pathname/directory PATHNAME DIRECTORY)

Returns fs:pathname.

fs:pathname/filename

[procedure] (fs:pathname/filename PATHNAME FILENAME)

Returns fs:pathname.

fs:pathname/base

[procedure] (fs:pathname/base PATHNAME BASE)

Returns fs:pathname.

fs:pathname/extensions

[procedure] (fs:pathname/extensions PATHNAME EXTENSIONS)

Returns fs:pathname.

fs:pathname/version

[procedure] (fs:pathname/version PATHNAME VERSION)

Returns fs:pathname.

fs:pathname=?

[procedure] (fs:pathname=? PATHNAME ...)

Returns boolean.

fs:pathname-eqv?

[procedure] (fs:pathname-eqv? PATHNAME-A PATHNAME-B)

Returns boolean.

fs:filename-pathname?

[procedure] (fs:filename-pathname? PATHNAME)

Returns boolean.

fs:filename-pathname

[procedure] (fs:filename-pathname PATHNAME)

Returns fs:pathname.

fs:directory-pathname?

[procedure] (fs:directory-pathname? PATHNAME)

Returns boolean.

fs:directory-pathname

[procedure] (fs:directory-pathname PATHNAME)

Returns fs:pathname.

fs:directory-namestring

[procedure] (fs:directory-namestring PATHNAME)

Returns string.

fs:host-namestring

[procedure] (fs:host-namestring PATHNAME)

Returns string.

fs:pathname-namelist

[procedure] (fs:pathname-namelist PATHNAME)

Returns list.

fs:pathname->uri

[procedure] (fs:pathname->uri PATHNAME)

Returns uri.

(fs:merge-pathnames PATHNAME [DEFAULT-PATHNAME])

fs:expand-pathname

[procedure] (fs:expand-pathname PATHNAME)

Returns fs:pathname.

fs:pathname-container

[procedure] (fs:pathname-container PATHNAME)

Returns fs:pathname.

fs:pathname-parent-directory

[procedure] (fs:pathname-parent-directory PATHNAME)

Returns fs:pathname.

fs:enough-pathname

[procedure] (fs:enough-pathname PATHNAME [DEFAULT-PATHNAME])

Returns fs:pathname.

fs:enough-namestring

[procedure] (fs:enough-namestring PATHNAME [DEFAULT-PATHNAME])

Returns string.

fs:pathname-complete?

[procedure] (fs:pathname-complete? PATHNAME)

Returns boolean.

->fs:namestring

[procedure] (->fs:namestring OBJECT)

Returns string.

Filename Procedures

fs:filename?

[procedure] (fs:filename? OBJECT)

Is the OBJECT an fs:filename object?

fs:make-filename

[procedure] (fs:make-filename [BASE [EXTENSION [GENERATION]]])

Returns a new fs:filename object. Default for all parameters is #f.

fs:filename-base

[procedure] (fs:filename-base FILENAME)

Gets the base component of the FILENAME object.

fs:filename-extensions

[procedure] (fs:filename-extensions FILENAME)

Gets the extensions component of the FILENAME object.

fs:filename-version

[procedure] (fs:filename-version FILENAME)

Gets the version component of the FILENAME object.

->fs:filename

[procedure] (->fs:filename OBJECT)

Returns a new fs:filename object from the OBJECT.

fs:filename-namestring

[procedure] (fs:filename-namestring FILENAME)

Returns a new NAMESTRING from the FILENAME object.

fs:filename-components

[procedure] (fs:filename-components FILENAME)

Returns a list of the FILENAME fields.

fs:namestring->filename

[procedure] (fs:namestring->filename NAMESTRING)

Returns fs:filename.

fs:filename-namestring

[procedure] (fs:filename-namestring OBJECT)

Returns string.

fs:filename-default

[procedure] (fs:filename-default FILENAME [BASE [EXTENSIONS [VERSION]]])

Returns fs:filename.

fs:filename/base

[procedure] (fs:filename/base FILENAME BASE)

Returns fs:filename.

fs:filename/extensions

[procedure] (fs:filename/extensions FILENAME EXTENSIONS)

Returns fs:filename.

fs:filename/version

[procedure] (fs:filename/version FILENAME VERSION)

Returns fs:filename.

fs:filename=?

[procedure] (fs:filename=? FILENAME ...)

Returns boolean.

fs:filename-base?

[procedure] (fs:filename-base? OBJECT)

Returns boolean.

fs:filename-extensions?

[procedure] (fs:filename-extensions? OBJECT)

Returns boolean.

fs:filename-extension

[procedure] (fs:filename-extension FILENAME)

Returns (or symbol string #f).

fs:filename-version?

[procedure] (fs:filename-version? OBJECT)

Returns boolean.

fs:filename-complete?

[procedure] (fs:filename-complete? FILENAME)

Returns boolean.

fs:enough-filename

[procedure] (fs:enough-filename FILENAME [DEFAULT-FILENAME])

Returns fs:filename.

fs:merge-filenames

[procedure] (fs:merge-filenames FILENAME DEFAULT-FILENAME)

Returns fs:filename.

fs:filename-namelist

[procedure] (fs:filename-namelist FILENAME [FLATTEN?])

Returns list.

Primitive Procedures

fs$make-filename

[procedure] (fs$make-filename BASE EXTENSIONS VERSION)

Returns fs:filename.

fs$make-filename/components

[procedure] (fs$make-filename/components COMPONENTS CALLER)

Returns fs:filename.

fs$filename-base-set!

[procedure] (fs$filename-base-set! FILENAME BASE)

Returns unspecified.

fs$filename-extensions-set!

[procedure] (fs$filename-extensions-set! FILENAME EXTENSIONS)

Returns unspecified.

fs$filename-version-set!

[procedure] (fs$filename-version-set! FILENAME VERSION)

Returns unspecified.

fs$make-pathname

[procedure] (fs$make-pathname HOST ORIGIN DIRECTORY FILENAME)

Returns fs:pathname.

fs$make-pathname/components

[procedure] (fs$make-pathname/components COMPONENTS CALLER)

Returns fs:pathname.

fs$pathname-host-set!

[procedure] (fs$pathname-host-set! PATHNAME HOST)

Returns unspecified.

fs$pathname-origin-set!

[procedure] (fs$pathname-origin-set! PATHNAME ORIGIN)

Returns unspecified.

fs$pathname-directory-set!

[procedure] (fs$pathname-directory-set! PATHNAME DIRECTORY)

Returns unspecified.

fs$pathname-filename-set!

[procedure] (fs$pathname-filename-set! PATHNAME FILENAME)

Returns unspecified.

Usage

(require-extension fspath)

Requirements

uri

miscmacros

Authors

Kon Lovett

License

Copyright (c) 2007, 2008 Kon Lovett. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version History

0.2
Incompatible release with much more functionality
0.1
Initial release

Bugs

Probably a number since the test suite is very incomplete.