PFileSystem API functions


Detailed Description

Portable file-system API.

Must call pmemInit() before using this module. If threads are to be used, ptrdInit() must be called before using this module as well.


Data Structures

struct  PFileSystem

Defines

#define PSTDIN   stdin
#define PSTDOUT   stdout
#define PSTDERR   stderr

Functions

PORTABLE_API
ESR_ReturnCode 
PFileSystemCreate (void)
PORTABLE_API
ESR_ReturnCode 
PFileSystemIsCreated (ESR_BOOL *isCreated)
PORTABLE_API
ESR_ReturnCode 
PFileSystemDestroy (void)
PORTABLE_API
ESR_ReturnCode 
PFileSystemCreatePFile (const LCHAR *path, ESR_BOOL littleEndian, PFile **file)
PORTABLE_API
ESR_ReturnCode 
PFileSystemIsAbsolutePath (const LCHAR *path, ESR_BOOL *isAbsolute)
PORTABLE_API
ESR_ReturnCode 
PFileSystemGetAbsolutePath (LCHAR *path, size_t *len)
PORTABLE_API
ESR_ReturnCode 
PFileSystemCanonicalSlashes (LCHAR *path)
PORTABLE_API
ESR_ReturnCode 
PFileSystemGetParentDirectory (LCHAR *path, size_t *len)
PORTABLE_API
ESR_ReturnCode 
PFileSystemMkdir (const LCHAR *path)
PORTABLE_API
ESR_ReturnCode 
PFileSystemGetcwd (LCHAR *path, size_t *len)
PORTABLE_API
ESR_ReturnCode 
PFileSystemChdir (const LCHAR *path)
PORTABLE_API
ESR_ReturnCode 
PFileSystemLinearToPathTokens (const LCHAR *path, LCHAR ***tokenArray, size_t *count)


Define Documentation

#define PSTDIN   stdin

Portable standard input. Portable standard output. Portable standard error.


Function Documentation

PORTABLE_API ESR_ReturnCode PFileSystemCanonicalSlashes ( LCHAR path  ) 

Converts all slashes in path to '/'.

Parameters:
path [in/out] Path to process
Returns:
ESR_INVALID_ARGUMENT if path is null

PORTABLE_API ESR_ReturnCode PFileSystemChdir ( const LCHAR path  ) 

Sets the current working directory.

Parameters:
path Fully qualified file path
Returns:
ESR_SUCCESS if change of directory is allowed

PORTABLE_API ESR_ReturnCode PFileSystemCreate ( void   ) 

Initializes the portable file-system module.

Returns:
ESR_INVALID_STATE if calling StackTraceCreate() fails (see its documentation for more detail).

PORTABLE_API ESR_ReturnCode PFileSystemCreatePFile ( const LCHAR path,
ESR_BOOL  littleEndian,
PFile **  file 
)

Creates a new PFile using this file-system.

Parameters:
path Fully qualified file path
littleEndian True if file is in little-endian format
file [out] Resulting PFile
Returns:
ESR_OUT_OF_MEMORY if system is out of memory; ESR_INVALID_STATE if mutex could not be created

PORTABLE_API ESR_ReturnCode PFileSystemDestroy ( void   ) 

Shuts down the portable file-system module.

Returns:
ESR_INVALID_ARGUMENT if self is null

PORTABLE_API ESR_ReturnCode PFileSystemGetAbsolutePath ( LCHAR path,
size_t *  len 
)

Returns the canonical pathname string of this abstract pathname.

A canonical pathname is both absolute and unique. The precise definition of canonical form is system-dependent. This method first converts this pathname to absolute form. This typically involves removing redundant names such as "." and ".." from the pathname, resolving symbolic links (on UNIX platforms), and converting drive letters to a standard case (on Microsoft Windows platforms).

POST-CONDITION: Path will contain only canonical slashes

Parameters:
path Path to process
len [in/out] Length of path argument. If the return code is ESR_BUFFER_OVERFLOW, the required length is returned in this variable.
Returns:
ESR_INVALID_ARGUMENT if path or len are null

PORTABLE_API ESR_ReturnCode PFileSystemGetcwd ( LCHAR path,
size_t *  len 
)

Returns the current working directory (always ends with '/').

Parameters:
path [out] The current working directory
len [in/out] Length of path argument. If the return code is ESR_BUFFER_OVERFLOW, the required length is returned in this variable.
Returns:
ESR_INVALID_ARGUMENT if path or len are null; ESR_BUFFER_OVERFLOW if path is too small to contain the result

PORTABLE_API ESR_ReturnCode PFileSystemGetParentDirectory ( LCHAR path,
size_t *  len 
)

Returns parent directory of specified path. If the path ends with a filename, its directory is returned. If the path ends with a directory, its parent directory is returned.

PRECONDITION: Directory names must end with '/'

Parameters:
path [in/out] Path to process
len [in/out] Length of path argument. If the return code is ESR_BUFFER_OVERFLOW, the required length is returned in this variable.
Returns:
ESR_INVALID_ARGUMENT if path or len are null; ESR_BUFFER_OVERFLOW if path is too small to contain the result

PORTABLE_API ESR_ReturnCode PFileSystemIsAbsolutePath ( const LCHAR path,
ESR_BOOL *  isAbsolute 
)

Indicates if path is absolute.

Parameters:
path Path to be processed
isAbsolute True if path is absolute
Returns:
ESR_INVALID_ARGUMENT if path or isAbsolute are null

PORTABLE_API ESR_ReturnCode PFileSystemIsCreated ( ESR_BOOL *  isCreated  ) 

Indicates if the portable file-system module is initialized.

Parameters:
isCreated [in/out] True if the module is initialized.
Returns:
ESR_INVALID_ARGUMENT if isCreated is null

PORTABLE_API ESR_ReturnCode PFileSystemLinearToPathTokens ( const LCHAR path,
LCHAR ***  tokenArray,
size_t *  count 
)

Converts a linear path string to an array of path tokens. Tokens ending with a '/' denote a directory, otherwise they are a file.

POST-CONDITION: The array is allocated internally, but must be freed by the caller.

Parameters:
path Command-line string to parse
tokenArray [out] The array used to hold the tokens
count [out] The number of tokens found
Returns:
ESR_INVALID_ARGUMENT if path, tokenArray or count are null; ESR_OUT_OF_MEMORY if system is out of memory

PORTABLE_API ESR_ReturnCode PFileSystemMkdir ( const LCHAR path  ) 

Creates a new directory.

Parameters:
path Directory path
Returns:
ESR_INVALID_ARGUMENT if path is null; ESR_IDENTIFIER_COLLISION if directory already exists; ESR_NO_MATCH_ERROR if parent directory does not exist; ESR_INVALID_STATE if an internal error occurs


Generated on Thu May 1 15:37:26 2008 for SREC by  doxygen 1.5.3