Harlequin RIP SDK

Implementation of the skinkit file I/O interfaces, in terms of the Microsoft Windows API. More...

#include <stdio.h>
#include <windows.h>
#include <direct.h>
#include <io.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>
#include <lm.h>
#include <string.h>
#include "skinkit.h"
#include "pfile.h"
#include "file.h"
#include "paths.h"
#include "mem.h"
#include "skinmon.h"
#include "swoften.h"

Data Structures

struct  FindFileState
 FindFileState. More...
 

Functions

static int32 PKErrorMap (int32 platformError)
 Map platform errors to PKErrors from file.h. More...
 
static int32 PKWin32ErrorMap (int32 platformError)
 Map Win32 errors to PKErrors from file.h. More...
 
HqBool PKAppDir (uint8 *pAppDir)
 Copy, into the buffer provided, the directory in which the application executable lives. This directory will be terminated with a directory separator. More...
 
HqBool PKCurrDir (uint8 *pCurrDir)
 Copy into the buffer provided the directory in which the application is running. This directory will be terminated with a directory separator. More...
 
HqBool PKParseRoot (uint8 *pOutput, const uint8 **ppInput)
 Parse the root part of an absolute filename *ppInput. More...
 
uint32 PKBuildRoot (uint8 *pOutput, const uint8 *pInput)
 Performs the inverse of PKParseRoot(), and builds a complete root part of a platform dependent filename from the variable part as previously output by PKParseRoot(). More...
 
FileDescPKOpenFile (const uint8 *filename, int32 openflags, int32 *pError)
 Open a file, with the given flags (from swdevice.h.) More...
 
int32 PKReadFile (FileDesc *pDescriptor, uint8 *buff, int32 len, int32 *pError)
 Read a specified number of bytes from a file into a buffer. More...
 
int32 PKWriteFile (FileDesc *pDescriptor, const uint8 *buff, int32 len, int32 *pError)
 Write a specified number of bytes from a buffer into a file. More...
 
int32 PKCloseFile (FileDesc *pDescriptor, int32 *pError)
 Close an open file. More...
 
HqBool PKSeekFile (FileDesc *pDescriptor, Hq32x2 *destination, int32 flags, int32 *pError)
 Seek to a byte position within a file, with the given flags. More...
 
HqBool PKBytesFile (FileDesc *pDescriptor, Hq32x2 *bytes, int32 reason, int32 *pError)
 Return the number of bytes in a file in the bytes parameter. More...
 
int32 PKStatusFile (const uint8 *filename, STAT *statbuff, int32 *pError)
 Populate a structure with information about a file. More...
 
int32 PKDeleteFile (const uint8 *filename, int32 *pError)
 Delete a file. More...
 
int32 PKRenameFile (const uint8 *fromname, const uint8 *toname, int32 *pError)
 Rename a file. More...
 
void * PKFindFirstFile (const uint8 *pszPattern, uint8 *pszEntryName, int32 *pError)
 Find the first file matching a pattern. More...
 
HqBool PKFindNextFile (void *handle, uint8 *pszEntryName, int32 *pError)
 Enumerate file entries matching a pattern. It returns, in pszEntryName, the path of an entry in the directory. Calls on the same handle will enumerate the matched entries until all entries have been enumerated. More...
 
HqBool PKCloseFindFile (void *handle, int32 *pError)
 Close the file matching specified by the handle. More...
 
void * PKDirOpen (const uint8 *pszDirName, int32 *pError)
 Open a directory. More...
 
HqBool PKDirNext (void *handle, uint8 *pszEntryName, HqBool *fIsFolder, int32 *pError)
 Enumerate entries in a directory. It returns, in pszEntryName, the leaf name of an entry in the directory. Calls on the same handle will enumerate the entries in the directory until all entries have been enumerated. More...
 
HqBool PKDirClose (void *handle, int32 *pError)
 Close the directory specified by the handle. More...
 
static HqBool make_directories (WCHAR *wName, BOOL *pfDirsMade)
 A utility routine to create directories in a path. More...
 
HqBool PKMakePSFilename (const uint8 *pszFilename, uint8 *pszPSFilename)
 Converts an absolute or relative filename to an absolute PostScript filename. Relative filenames are made absolute by prefixing the current working directory as returned by PKCurrDir(). More...
 
void PKRecordSystemError (int32 errcode, int32 errline, const char *pErrfile, HqBool fSysErr)
 Record through the monitor callback system errors according to the error level set by KSetSystemErrorLevel(). More...
 
HqBool PKOSFontDir (uint8 *pszFontDir)
 Get an explicit path to the OS font folder, converted to PostScript form (e.g., %C%/WINDOWS/fonts/). More...
 
int32 PKFilenameToUTF8 (const uint8 *filename, uint8 *utf8name, int32 *pError)
 Convert a partial filename to UTF-8. More...
 
int32 PKFlushFile (FileDesc *pDescriptor, int32 *pError)
 Flush an open file. More...
 

Detailed Description

Implementation of the skinkit file I/O interfaces, in terms of the Microsoft Windows API.

Function Documentation

◆ make_directories()

static HqBool make_directories ( WCHAR *  wName,
BOOL *  pfDirsMade 
)
static

A utility routine to create directories in a path.

Returns
TRUE if successful, FALSE if an error occurs. *pfDirsMade indicates if directories wre created, i.e. if the open call should be tried again.

◆ PKErrorMap()

static int32 PKErrorMap ( int32  platformError)
static

Map platform errors to PKErrors from file.h.

Parameters
platformErrorPlatform error code.
Returns
The PKError mapped, or PKErrorNone if the platformError did not map to any PKError.

◆ PKWin32ErrorMap()

int32 PKWin32ErrorMap ( int32  platformError)
static

Map Win32 errors to PKErrors from file.h.

Parameters
platformErrorPlatform error code.
Returns
The PKError mapped, or PKErrorNone if the platformError did not map to any PKError.