|
|
| CPT Documentation | | | | |
Table of Contents | - Endian Interface
- File Interface
- Float Type Interface
- Integer Type Interface
- Mutex Interface
- Semaphore Interface
- Socket Interface
- Structure Padding Interface
- System Interface
- Thread Interface
- Time Interface
| Endian Interface |
- Header: CPT/cpt_endian.h
- Macros
-
CPT_ENDIAN_BIG
- Defined if the native platform is big endian.
-
CPT_ENDIAN_LITTLE
- Defined if the native platform is little endian.
- Functions
-
CPT_UInt16 CPT_EndianBTON16(CPT_UInt16)
- Return Value: Parameter 1 in native byte order.
- Parameter 1: A 16 bit big endian value.
-
CPT_UInt32 CPT_EndianBTON32(CPT_UInt32)
- Return Value: Parameter 1 in native byte order.
- Parameter 1: A 32 bit big endian value.
-
CPT_UInt64 CPT_EndianBTON64(CPT_UInt64)
- Return Value: Parameter 1 in native byte order.
- Parameter 1: A 64 bit big endian value.
-
void CPT_EndianBTONArray16(CPT_UInt16 *, const CPT_UInt16 *, size_t)
- Parameter 1: Array to place native endian values in.
- Parameter 2: Array to read big endian values from (can be the same as Parameter 1).
- Parameter 3: The number of indices in each array.
-
void CPT_EndianBTONArray32(CPT_UInt32 *, const CPT_UInt32 *, size_t)
- Parameter 1: Array to place native endian values in.
- Parameter 2: Array to read big endian values from (can be the same as Parameter 1).
- Parameter 3: The number of indices in each array.
-
void CPT_EndianBTONArray64(CPT_UInt64 *, const CPT_UInt64 *, size_t)
- Parameter 1: Array to place native endian values in.
- Parameter 2: Array to read big endian values from (can be the same as Parameter 1).
- Parameter 3: The number of indices in each array.
-
CPT_UInt16 CPT_EndianLTON16(CPT_UInt16)
- Return Value: Parameter 1 in native byte order.
- Parameter 1: A 16 bit little endian value.
-
CPT_UInt32 CPT_EndianLTON32(CPT_UInt32)
- Return Value: Parameter 1 in native byte order.
- Parameter 1: A 32 bit little endian value.
-
CPT_UInt64 CPT_EndianLTON64(CPT_UInt64)
- Return Value: Parameter 1 in native byte order.
- Parameter 1: A 64 bit little endian value.
-
void CPT_EndianLTONArray16(CPT_UInt16 *, const CPT_UInt16 *, size_t)
- Parameter 1: Array to place native endian values in.
- Parameter 2: Array to read little endian values from (can be the same as Parameter 1).
- Parameter 3: The number of indices in each array.
-
void CPT_EndianLTONArray32(CPT_UInt32 *, const CPT_UInt32 *, size_t)
- Parameter 1: Array to place native endian values in.
- Parameter 2: Array to read little endian values from (can be the same as Parameter 1).
- Parameter 3: The number of indices in each array.
-
void CPT_EndianLTONArray64(CPT_UInt64 *, const CPT_UInt64 *, size_t)
- Parameter 1: Array to place native endian values in.
- Parameter 2: Array to read little endian values from (can be the same as Parameter 1).
- Parameter 3: The number of indices in each array.
-
CPT_UInt16 CPT_EndianNTOB16(CPT_UInt16)
- Return Value: Parameter 1 in big byte order.
- Parameter 1: A 16 bit native endian value.
-
CPT_UInt32 CPT_EndianNTOB32(CPT_UInt32)
- Return Value: Parameter 1 in big byte order.
- Parameter 1: A 32 bit native endian value.
-
CPT_UInt64 CPT_EndianNTOB64(CPT_UInt64)
- Return Value: Parameter 1 in big byte order.
- Parameter 1: A 64 bit native endian value.
-
void CPT_EndianNTOBArray16(CPT_UInt16 *, const CPT_UInt16 *, size_t)
- Parameter 1: Array to place big endian values in.
- Parameter 2: Array to read native endian values from (can be the same as Parameter 1).
- Parameter 3: The number of indices in each array.
-
void CPT_EndianNTOBArray32(CPT_UInt32 *, const CPT_UInt32 *, size_t)
- Parameter 1: Array to place big endian values in.
- Parameter 2: Array to read native endian values from (can be the same as Parameter 1).
- Parameter 3: The number of indices in each array.
-
void CPT_EndianNTOBArray64(CPT_UInt64 *, const CPT_UInt64 *, size_t)
- Parameter 1: Array to place big endian values in.
- Parameter 2: Array to read native endian values from (can be the same as Parameter 1).
- Parameter 3: The number of indices in each array.
-
CPT_UInt16 CPT_EndianNTOL16(CPT_UInt16)
- Return Value: Parameter 1 in little byte order.
- Parameter 1: A 16 bit native endian value.
-
CPT_UInt32 CPT_EndianNTOL32(CPT_UInt32)
- Return Value: Parameter 1 in little byte order.
- Parameter 1: A 32 bit native endian value.
-
CPT_UInt64 CPT_EndianNTOL64(CPT_UInt64)
- Return Value: Parameter 1 in little byte order.
- Parameter 1: A 64 bit native endian value.
-
void CPT_EndianNTOLArray16(CPT_UInt16 *, const CPT_UInt16 *, size_t)
- Parameter 1: Array to place little endian values in.
- Parameter 2: Array to read native endian values from (can be the same as Parameter 1).
- Parameter 3: The number of indices in each array.
-
void CPT_EndianNTOLArray32(CPT_UInt32 *, const CPT_UInt32 *, size_t)
- Parameter 1: Array to place little endian values in.
- Parameter 2: Array to read native endian values from (can be the same as Parameter 1).
- Parameter 3: The number of indices in each array.
-
void CPT_EndianNTOLArray64(CPT_UInt64 *, const CPT_UInt64 *, size_t)
- Parameter 1: Array to place little endian values in.
- Parameter 2: Array to read native endian values from (can be the same as Parameter 1).
- Parameter 3: The number of indices in each array.
-
CPT_UInt16 CPT_EndianSwap16(CPT_UInt16)
- Return Value: Parameter 1 with its endianness swapped.
- Parameter 1: A 16 bit value.
-
CPT_UInt32 CPT_EndianSwap32(CPT_UInt32)
- Return Value: Parameter 1 with its endianness swapped.
- Parameter 1: A 32 bit value.
-
CPT_UInt64 CPT_EndianSwap64(CPT_UInt64)
- Return Value: Parameter 1 with its endianness swapped.
- Parameter 1: A 64 bit value.
-
void CPT_EndianSwapArray16(CPT_UInt16 *, const CPT_UInt16 *, size_t)
- Parameter 1: Array to place swapped values in.
- Parameter 2: Array to read values from (can be the same as Parameter 1).
- Parameter 3: The number of indices in each array.
-
void CPT_EndianSwapArray32(CPT_UInt32 *, const CPT_UInt32 *, size_t)
- Parameter 1: Array to place swapped values in.
- Parameter 2: Array to read values from (can be the same as Parameter 1).
- Parameter 3: The number of indices in each array.
-
void CPT_EndianSwapArray64(CPT_UInt64 *, const CPT_UInt64 *, size_t)
- Parameter 1: Array to place swapped values in.
- Parameter 2: Array to read values from (can be the same as Parameter 1).
- Parameter 3: The number of indices in each array.
| Top | File Interface |
- Header: CPT/cpt_file.h
- Functions
-
int CPT_FileKill(CPT_File *)
- Return Value: 0 on success.
- Parameter 1: A pointer to a CPT_File to close.
-
int CPT_FileRead(CPT_File *, void *, size_t)
- Return Value: <0 on error, 0 on EOF, else the number of bytes read.
- Parameter 1: A pointer to a CPT_File to read from.
- Parameter 2: A pointer to a buffer to read into.
- Parameter 3: The maximum number of bytes to read.
-
int CPT_FileSeek(CPT_File *, int, unsigned int)
- Return Value: 0 on success.
- Parameter 1: A pointer to a CPT_File to move the file pointer of.
- Parameter 2: The number of bytes to move the file pointer.
- Parameter 3: How to move the file pointer.
-
CPT_FILE_CUR: Move the file pointer from the current location.
-
CPT_FILE_SET: Move the file pointer relative to the beginning of the file.
-
CPT_FILE_END: Move the file pointer relative to the end of the file.
-
unsigned int CPT_FileSize(CPT_File *)
- Return Value: The size of the file in bytes.
- Parameter 1: A pointer to a CPT_File to refer to.
- The file pointer's location is undefined after calling this.
-
int CPT_FileSpawn(CPT_File *, const char *, unsigned int, unsigned int)
- Return Value: 0 on success.
- Parameter 1: A pointer to a CPT_File to open to.
- Parameter 2: The name of the file to open.
- Parameter 3: The permissions you're requesting to get to the file.
-
CPT_FILE_READ: Read only.
-
CPT_FILE_WRITE: Write only.
-
CPT_FILE_READWRITE: Read and write.
- Parameter 4: The method to open the file.
-
CPT_FILE_NORMAL: Do nothing special.
-
CPT_FILE_CREATE: Create the file if it doesn't exist.
-
CPT_FILE_NOCREATE: If the file doesn't exist, fail.
-
CPT_FILE_NEW: Create a new file even if one already exists.
-
unsigned int CPT_FileTell(const CPT_File *)
- Return Value: The offset of the file pointer from the beginning of the file.
- Parameter 1: A pointer to a CPT_File to refer to.
-
int CPT_FileTrunc(CPT_File *, unsigned int)
- Return Value: 0 on success.
- Parameter 1: A pointer to a CPT_File to truncate.
- Parameter 2: The bytes offset from the beginning of the file to truncate to.
-
int CPT_FileWrite(CPT_File *, const void *, size_t)
- Return Value: <0 on error, 0 on EOF, else the number of bytes written.
- Parameter 1: A pointer to a CPT_File to write to.
- Parameter 2: A pointer to a buffer to write from.
- Parameter 3: The maximum number of bytes to write.
| Top | Float Type Interface |
- Header: CPT/cpt_floattype.h
- Types
-
CPT_IeeeFloat: An array of CPT_UInt8's the size of an IEEE float.
-
CPT_IeeeDouble: An array of CPT_UInt8's the size of an IEEE double.
-
CPT_IeeeExtended: An array of CPT_UInt8's the size of an IEEE extended.
- Functions
-
double CPT_IeeeGetDoubleBig(CPT_IeeeDouble)
- Return Value: The value of parameter 1.
- Parameter 1: A big endian IeeeDouble to use.
-
double CPT_IeeeGetDoubleLittle(CPT_IeeeDouble)
- Return Value: The value of parameter 1.
- Parameter 1: A big endian IeeeDouble to use.
-
double CPT_IeeeGetDoubleNative(CPT_IeeeDouble)
- Return Value: The value of parameter 1.
- Parameter 1: A native endian IeeeDouble to use.
-
double CPT_IeeeGetExtendedBig(CPT_IeeeExtended)
- Return Value: The value of parameter 1.
- Parameter 1: A big endian IeeeExtended to use.
-
double CPT_IeeeGetExtendedLittle(CPT_IeeeExtended)
- Return Value: The value of parameter 1.
- Parameter 1: A little endian IeeeExtended to use.
-
double CPT_IeeeGetExtendedNative(CPT_IeeeExtended)
- Return Value: The value of parameter 1.
- Parameter 1: A native endian IeeeExtended to use.
-
double CPT_IeeeGetFloatBig(CPT_IeeeFloat)
- Return Value: The value of parameter 1.
- Parameter 1: A big endian IeeeFloat to use.
-
double CPT_IeeeGetFloatLittle(CPT_IeeeFloat)
- Return Value: The value of parameter 1.
- Parameter 1: A little endian IeeeFloat to use.
-
double CPT_IeeeGetFloatNative(CPT_IeeeFloat)
- Return Value: The value of parameter 1.
- Parameter 1: A native endian IeeeFloat to use.
-
void CPT_IeeePutDoubleBig(double, CPT_IeeeDouble)
- Parameter 1: The value to place in to parameter 2.
- Parameter 2: The variable to fill with a big endian IeeeDouble.
-
void CPT_IeeePutDoubleLittle(double, CPT_IeeeDouble)
- Parameter 1: The value to place in to parameter 2.
- Parameter 2: The variable to fill with a little endian IeeeDouble.
-
void CPT_IeeePutDoubleNative(double, CPT_IeeeDouble)
- Parameter 1: The value to place in to parameter 2.
- Parameter 2: The variable to fill with a native endian IeeeDouble.
-
void CPT_IeeePutExtendedBig(double, CPT_IeeeExtended)
- Parameter 1: The value to place in to parameter 2.
- Parameter 2: The variable to fill with a big endian IeeeExtended.
-
void CPT_IeeePutExtendedLittle(double, CPT_IeeeExtended)
- Parameter 1: The value to place in to parameter 2.
- Parameter 2: The variable to fill with a little endian IeeeExtended.
-
void CPT_IeeePutExtendedNative(double, CPT_IeeeExtended)
- Parameter 1: The value to place in to parameter 2.
- Parameter 2: The variable to fill with a native endian IeeeExtended.
-
void CPT_IeeePutFloatBig(double, CPT_IeeeFloat)
- Parameter 1: The value to place in to parameter 2.
- Parameter 2: The variable to fill with a big endian IeeeFloat.
-
void CPT_IeeePutFloatLittle(double, CPT_IeeeFloat)
- Parameter 1: The value to place in to parameter 2.
- Parameter 2: The variable to fill with a little endian IeeeFloat.
-
void CPT_IeeePutFloatNative(double, CPT_IeeeFloat)
- Parameter 1: The value to place in to parameter 2.
- Parameter 2: The variable to fill with a native endian IeeeFloat.
| Top | Integer Type Interface |
- Header: CPT/cpt_inttype.h
- Types:
-
CPT_Int8: A signed 8 bit integer.
-
CPT_Int16: A signed 16 bit integer.
-
CPT_Int32: A signed 32 bit integer.
-
CPT_Int64: A signed 64 bit integer.
-
CPT_UInt8: An unsigned 8 bit integer.
-
CPT_UInt16: An unsigned 16 bit integer.
-
CPT_UInt32: An unsigned 32 bit integer.
-
CPT_UInt64: An unsigned 64 bit integer.
| Top | Mutex Interface |
- Header: CPT/cpt_mutex.h
- Functions
-
void CPT_MutexKill(CPT_Mutex *)
- Parameter 1: The mutex to free (you cannot use this Mutex after this call, unless you pass it to CPT_MutexSpawn again).
-
void CPT_MutexLock(CPT_Mutex *)
- Parameter 1: The mutex to lock. This will block the current thread until the mutex is locked (i.e. unlocked by every other thread).
-
void CPT_MutexUnlock(CPT_Mutex *)
- Parameter 1: The mutex to unlock (so that other threads may lock it).
-
int CPT_MutexSpawn(CPT_Mutex *)
- Return Value: 0 on success.
- Parameter 1: The mutex to setup for use (each mutex must be setup).
| Top | Semaphore Interface |
- Header: CPT/cpt_semaphore.h
- Functions
-
int CPT_SemaphoreDown(CPT_Semaphore *)
- Return Value: Zero on success.
- Parameter 1: Decrement the semaphore (this will block if the semaphore is less than or equal to zero).
-
int CPT_SemaphoreDownTimeout(CPT_Semaphore *, unsigned int)
- Return Value:
- Zero on a successful decrement.
- Non-Zero on error or timeout.
- Parameter 1: Decrement the semaphore if it can be access within time.
- Parameter 2: The number of milliseconds to wait to decrement the semaphore before giving up.
-
void CPT_SemaphoreKill(CPT_Semaphore *)
- Parameter 1: The semaphore to free (you cannot use this Semaphore after this call, unless you again pass it to CPT_SemaphoreSpawn).
-
int CPT_SemaphoreUp(CPT_Semaphore *)
- Return Value: Zero on success.
- Parameter 1: Increment the semaphore (unblock a thread waiting waiting on the semaphore if at least one is waiting).
-
int CPT_SemaphoreSpawn(CPT_Semaphore *, unsigned int)
- Return Value: Zero on success.
- Parameter 1: The semaphore to setup (this must be called before use).
- Parameter 2: The initial value of the semaphore.
| Top | Socket Interface |
- Header: CPT/cpt_socket.h
- Functions
-
void CPT_Init_Sockets(void)
- Call once before using any other socket functions.
-
void CPT_Kill_Sockets(void)
- Call once after you're done using any socket functions.
-
int CPT_SocketCanAccept(const CPT_Socket *)
- Return Value: 1 if the socket can accept.
- Parameter 1: A pointer to the socket to check.
-
int CPT_SocketAccept(const CPT_Socket *, CPT_Address *, CPT_Socket *)
- Return Value: Zero on success.
- Parameter 1: A pointer to the socket to check.
- Parameter 2: The address of the accepted socket.
- Parameter 3: A pointer to a socket to place the accepted socket into.
-
int CPT_SocketCanRead(const CPT_Socket *)
- Return Value: 1 if the socket can read.
- Parameter 1: A pointer to the socket to check.
-
int CPT_SocketClient(CPT_Socket *, CPT_Protocol, const char *, int)
- Return Value: 0 on success.
- Parameter 1: A pointer to the socket to make a client.
- Parameter 2: The protocol to use.
-
CPT_PROTOCOL_TCPIP: TCP/IP Protocol
-
CPT_PROTOCOL_UDPIP: UDP/IP Protocol
- Parameter 3: The IP address or name of the server to connect to.
- Examples: www.example.com or 127.0.0.1
- Parameter 4: The port to connect to.
-
int CPT_SocketKill(CPT_Socket *)
- Return Value: 0 on success.
- Parameter 1: A pointer to the socket you're done with.
-
int CPT_SocketRead(const CPT_Socket *, void *, size_t)
- Return Value: -1 on error, 0 if disconnected, >0 number of bytes read
- Parameter 1: A pointer to the sender's socket.
- Parameter 2: A buffer to read the data into.
- Parameter 3: The maximum amount of data to read.
-
int CPT_SocketReadFrom(const CPT_Socket *, void *, size_t, CPT_Address *)
- Return Value: -1 on error, 0 if disconnected (?), >0 number of bytes read
- Parameter 1: A pointer to the reader's socket.
- Parameter 2: A buffer to read the data into.
- Parameter 3: The maximum amount of data to read.
- Parameter 4: A pointer to the place to put the address you read from into.
-
int CPT_SocketSend(const CPT_Socket *, const void *, size_t)
- Return Value: -1 on error, >0 number of bytes sent
- Parameter 1: A pointer to the reader's socket.
- Parameter 2: A buffer with the data to send.
- Parameter 3: The maximum amount of data to send.
-
int CPT_SocketSendTo(const CPT_Socket *, const void *, size_t, CPT_Address *)
- Return Value: -1 on error, >0 number of bytes sent
- Parameter 1: A pointer to the sender's socket.
- Parameter 2: A buffer with the data to send.
- Parameter 3: The maximum amount of data to send.
- Parameter 4: The place to send the data.
-
int CPT_SocketServer(CPT_Socket *, CPT_Protocol, int)
- Return Value: 0 on success.
- Parameter 1: A pointer to the socket to make a server.
- Parameter 2: The protocol to use.
-
CPT_PROTOCOL_TCPIP: TCP/IP Protocol
-
CPT_PROTOCOL_UDPIP: UDP/IP Protocol
- Parameter 3: The port to connect to.
| Top | Structure Padding Interface |
- Headers: CPT/cpt_padoff_begin.h CPT/cpt_padoff_end.h
- Macros
-
CPT_PADOFF_VAR: To be placed after a structure member to prevent padding.
- Example Usage
/* Include before any number of structs to not pad */
#include "CPT/cpt_padoff_begin.h"
/* CPT_PADOFF_VAR must be included after every structure
member between padoff_begin and padoff_end, or the
padding results are undefined */
struct UnpaddedStruct {
char Alpha CPT_PADOFF_VAR;
long Beta CPT_PADOFF_VAR;
short Gamma CPT_PADOFF_VAR;
};
/* Include after the structs that must not be padded */
#include "CPT/cpt_padoff_end.h"
| Top | System Interface |
- Header: CPT/cpt_system.h
- Structures
-
CPT_SystemFile
-
unsigned int Type
- Is a mask of the following:
-
CPT_SYSTEM_DIR
- The file specified is a directory.
-
CPT_SYSTEM_ABSTRACT
- The file specified is abstract, you will probably want to ignore it.
-
char *Name
- A NULL-terminated string that contains the relative name of the file being refered to.
-
CPT_SystemDevice
-
unsigned int Type
- Is a mask of the following:
-
CPT_SYSTEM_UNKNOWN
- The device specified's type cannot be determined (often a floppy drive).
-
CPT_SYSTEM_FIXED
- The device specified is some form of fixed media (i.e. HDD).
-
CPT_SYSTEM_CDROM
- The device specified is a CD-ROM drive (or CD-R drive or DVD-ROM drive, or something equivalent).
-
char *Name
- A NULL-terminated string that gives a name of the device to present to the user.
-
char *Path
- A NULL-terminated string that contains the absolute name of the device. Pass this to CPT_SystemSetCurDir to move to it.
-
CPT_SystemDeviceSize
-
Total
-
GB
- The number of gigabytes (1024 megabytes) that the device can hold. To be added with the other sizes provided for the total space.
-
MB
- The number of megabytes (1024 kilobytes) that the device can hold. To be added with the other sizes provided for the total space.
-
KB
- The number of kilobytes (1024 bytes) that the device can hold. To be added with the other sizes provided for the total space.
-
Free
-
GB
- The number of gigabytes (1024 megabytes) that the device has available. To be added with the other sizes provided for the total available space.
-
MB
- The number of megabytes (1024 kilobytes) that the device has available. To be added with the other sizes provided for the total available space.
-
KB
- The number of kilobytes (1024 bytes) that the device has available. To be added with the other sizes provided for the total available space.
- Functions
-
int CPT_SystemChangeDir(const char *)
- Return value: 0 on success.
- Parameter 1: A NULL-terminated string containing the relative name of a directory to move to.
-
int CPT_SystemChangeDirs(const char *, ...)
- Return value: 0 on success.
- Parameters 1+: A NULL-terminated string containing the relative name of a directory to move to.
-
int CPT_SystemChangeDirsV(const char *, va_list)
- Return value: 0 on success.
- Parameter 1: A NULL-terminated string containing the relative name of a directory to move to.
- Parameter 2: An argument list of NULL-terminated strings containing the relative name of a directories to move to.
-
int CPT_SystemDirKill(const char *)
- Return value: 0 on success.
- Parameter 1: A NULL-terminated string that contains the relative name of a directory to delete.
-
int CPT_SystemDirSpawn(const char *)
- Return value: 0 on success.
- Parameter 1: A NULL-terminated string that contains the name of a directory to create.
-
void CPT_SystemEnumDevices(CPT_SystemDeviceEnumFunc, void *)
- Parameter 1: The function to call with each device.
- The function must take a constant pointer to a CPT_SystemDevice as the first parameter and a void pointer as the second and return nothing.
- void (*CPT_SystemDeviceEnumFunc)(const CPT_SystemDevice *, void *);
- Parameter 2: Any value that you'd like to have passed to your callback function for its second parameter.
-
void CPT_SystemEnumFiles(CPT_SystemFileEnumFunc, void *)
- Parameter 1: The function to call with each device.
- The function must take a constant pointer to a CPT_SystemFile as the first parameter and a void pointer as the second and return nothing.
- void (*CPT_SystemFileEnumFunc)(const CPT_SystemFile *, void *);
- Parameter 2: Any value that you'd like to have passed to your callback function for its second parameter.
-
int CPT_SystemFileCopy(const char *, const char *, int)
- Return value: 0 on success.
- Parameter 1: A NULL-terminated string with the absolute or relative name of the file to read from.
- Parameter 2: A NULL-terminated string with the absolute or relative name of the file to write to.
- Parameter 3: Non-zero value if the function can overwrite the file refered to by parameter 2 if it exists.
- Note: The new and old file will possibly share a single 'node' on the file system (see CPT_SystemFileDuplicate if you don't desire this).
-
int CPT_SystemFileDelete(const char *)
- Return value: 0 on success.
- Parameter 1: A NULL-terminated string with the absolute or relative name of the file to delete.
-
int CPT_SystemFileDuplicate(const char *, const char *, int)
- Return value: 0 on success.
- Parameter 1: A NULL-terminated string with the absolute or relative name of the file to read from.
- Parameter 2: A NULL-terminated string with the absolute or relative name of the file to write to.
- Parameter 3: Non-zero value if the function can overwrite the file refered to by parameter 2 if it exists.
-
int CPT_SystemFileMove(const char *, const char *, int)
- Return value: 0 on success.
- Parameter 1: A NULL-terminated string with the absolute or relative name of the file to move.
- Parameter 2: A NULL-terminated string with the absolute or relative name of the file to create.
- Parameter 3: Non-zero value if the function can overwrite the file refered to by parameter 2 if it exists.
-
int CPT_SystemGet(unsigned int, char *)
- Return value: 0 on success.
- Parameter 1: One of the following:
-
CPT_SYSTEM_DATADIR
- Used to get a user dependent directory (on multiuser systems) for storing configuration files.
-
CPT_SYSTEM_DESKTOPDIR
- Used to get the users 'home' directory.
-
CPT_SYSTEM_ROOTDIR
- Used to get the system's root directory.
-
CPT_SYSTEM_LIBRARYDIR
- Used to get the system's directory for dynamic libraries.
-
CPT_SYSTEM_TEMPDIR
- Used to get the system's directory for temporary files.
- Parameter 2: A pointer to a buffer of at least CPT_SYSTEM_PATHMAX bytes in size.
-
int CPT_SystemGetCurDir(char *)
- Return value: 0 on success.
- Parameter 1: A buffer of at least size CPT_SYSTEM_PATHMAX to recieve the absolute name of the current directory.
-
int CPT_SytstemGetDeviceSize(const CPT_SystemDevice *, CPT_SystemDeviceSize *)
- Return value: 0 on success.
- Parameter 1: A pointer to the device to analyze.
- Parameter 2: A pointer to the CPT_SystemDeviceSize structure to fill with information about the device.
-
int CPT_SystemLinkKill(const char *)
- Return value: 0 on success.
- Parameter 1: A NULL-terminated string that contains the relative name of a link file to delete.
-
int CPT_SystemLinkSpawn(const char *, const char *)
- Return value: 0 on success.
- Parameter 1: A NULL-terminated string that contains the name of the link file to create.
- Parameter 2: A NULL-terminated string that contains the relative or absolute name of the file to link to.
-
int CPT_SystemSetCurDir(const char *)
- Return value: 0 on success.
- Parameter 1: A NULL-terminated string that contains the absolute path of a directory to switch to.
| Top | Thread Interface |
- Header: CPT/cpt_thread.h
- Functions
-
int CPT_Init_Threads(void)
- Return Value: 0 on success.
- Call before using any other mutex, thread, or semaphore functions.
-
int CPT_Kill_Threads(void)
- Return Value: 0 on success.
- Call after you're done with any mutex, thread, and semaphore functions.
-
unsigned int CPT_ThreadID(void)
- Return Value: A relative thread ID. Each thread has it's own, but they're just for reference.
-
int CPT_ThreadJoin(CPT_Thread *)
- Return Value: 0 on success.
- Parameter 1: The thread to wait for the completion of before returning.
-
int CPT_ThreadKill(CPT_Thread *)
- Return Value: 0 on success.
- Parameter 1: The thread to forcibly end.
-
int CPT_ThreadSpawn(CPT_Thread *, CPT_ThreadFunc, void *)
- Return Value: 0 on success.
- Parameter 1: The structure to store thread information in.
- Parameter 2: The function to call.
- The function must return nothing and take a single void pointer parameter.
- Parameter 3: The void pointer 'data' to pass to the function.
-
void CPT_ThreadYield(void)
- Give up this process's current CPU time.
| Top | Time Interface |
- Header: CPT/cpt_time.h
- Functions
-
int CPT_Init_Time(void)
- Return Value: 0 on success.
- Call this once before using any CPT_Time* functions.
-
int CPT_Kill_Time(void)
- Return Value: 0 on success.
- Call this once after you're done using any CPT_Time* functions.
-
void CPT_TimeDelay(unsigned int)
- Parameter 1: The minimum number of seconds to wait before returning from this function
- Thread safety is not yet guaranteed.
-
void CPT_TimeDelayMicro(unsigned int)
- Parameter 1: The minimum number of microseconds to wait before returning from this function
- Thread safety is not yet guaranteed.
-
void CPT_TimeDelayMilli(unsigned int)
- Parameter 1: The minimum number of milliseconds to wait before returning from this function
- Thread safety is not yet guaranteed.
-
void CPT_TimeDelayNano(unsigned int)
- Parameter 1: The minimum number of nanoseconds to wait before returning from this function
- Thread safety is not yet guaranteed.
-
unsigned int CPT_TimeGet(void)
- Return Value: The number of seconds that have passed since an arbitrary but constant point in time. This value is only comparable to other values returned from this function.
-
unsigned int CPT_TimeGetMicro(void)
- Return Value: The number of microseconds that have passed since an arbitrary but constant point in time. This value is only comparable to other values returned from this function.
-
unsigned int CPT_TimeGetMilli(void)
- Return Value: The number of milliseconds that have passed since an arbitrary but constant point in time. This value is only comparable to other values returned from this function.
-
unsigned int CPT_TimeGetNano(void)
- Return Value: The number of nanoseconds that have passed since an arbitrary but constant point in time. This value is only comparable to other values returned from this function.
| Top |
| | | | |
|
|
|
|
|