Classes | |
| class | MacDim |
| Wrapper class to detect and manage the MacDim screen saver shell. More... | |
| class | Mac |
| Class containing MacOS specific helper functions. More... | |
| class | Base |
| Base class for virtual destructor. More... | |
| class | ConsoleApp |
| Base class for console applications. More... | |
| class | SwapEndian |
| Swap the byte order of 16, 32 and 64 bit values. More... | |
| class | NativeEndian |
| Loads a 16, 32 or 64 bit value with no byte swapping. More... | |
| class | LittleEndian |
| Loads a 16, 32 or 64 bit value with byte swapping if needed. More... | |
| class | BigEndian |
| Loads a 16, 32 or 64 bit value with byte swapping if needed. More... | |
| class | GlobalMemoryManager |
| Singleton class for global memory allocation. More... | |
| class | MemoryManagerANSI |
| ANSI Memory Manager. More... | |
| class | MemoryManagerGlobalANSI |
| Global ANSI Memory Manager helper class. More... | |
| struct | MemoryManager |
| Base class for memory managers. More... | |
| class | NumberString |
| Simple "C" string numeric conversion class. More... | |
| class | Random |
| A simple random number generator. More... | |
| class | SimpleString |
| Simple "C" string container. More... | |
| class | String |
| class | String16 |
| struct | TimeDate_t |
| Structure to hold a date and time. More... | |
| struct | FileManager |
| Global file system manager. More... | |
| class | Filename |
| File name container. More... | |
| class | FileManagerSimple |
| Initialization class for the global Burger::FileManager structure. More... | |
| class | DirectorySearch |
| Directory contents iteration class. More... | |
| class | File |
| class | FPMath |
| Generic floating point math routines. More... | |
| struct | Vector2D_t |
| class | IntMath |
| Helper routines for integer math. More... | |
| class | FixedMath |
| Functions to handle fixed point integer math. More... | |
| class | FracMath |
| Functions to handle Frac point integer math. More... | |
| struct | FixedVector2D_t |
| A 2D Fixed32 vector. More... | |
| struct | FixedVector3D_t |
| 3D Fixed32 vector. More... | |
| struct | FixedVector4D_t |
| 4D Fixed32 vector. More... | |
| struct | FixedMatrix3D_t |
| 3x3 Fixed32 matrix. More... | |
| struct | FixedMatrix4D_t |
| 4x4 Fixed32 matrix. More... | |
| struct | Point2D_t |
| Integer 2D coordinate. More... | |
| struct | Rect_t |
| Structure describing an integer precision 2D rectangle. More... | |
| struct | RectList_t |
| class | Quicktime |
| Class containing Quicktime helper functions. More... | |
| class | FunctionList |
| Simple manager of a list of function pointers. More... | |
| class | UTF8 |
| Conversion routines to support the UTF8 format. More... | |
| class | MacRomanUS |
| Conversion routines to support the MacRomanUS text encoding scheme. More... | |
| class | Win1252 |
| Conversion routines to support the Win1252 text encoding scheme. More... | |
| class | ISOLatin1 |
| Conversion routines to support the ISOLatin1 text encoding scheme. More... | |
| class | UTF16 |
| Conversion routines to the UTF8 format. More... | |
| class | UTF32 |
| Conversion routines to the UTF32 format. More... | |
| class | NumStringHex |
| class | Win32 |
| class | Windows |
| Class containing Win32 and Win64 specific helper functions. More... | |
Typedefs | |
| typedef char | Float80Bit [10] |
| 80 bit float (Extended) | |
Enumerations | |
| enum | { LEADINGZEROS = 0x8000, NOENDINGNULL = 0x4000 } |
Functions | |
| Word32 BURGER_API | BCDToWord (Word32 uInput) |
| Convert a BCD value into a decimal integer. | |
| Word32 BURGER_API | WordToBCD (Word32 uInput) |
| Convert a decimal integer into BCD format. | |
| Word32 BURGER_API | PowerOf2 (Word32 uInput) |
| Round up an integer to the nearest power of 2. | |
| void BURGER_API | CStringToPString (Word8 *pOutput, const char *pInput) |
| Convert a "C" string into a Pascal string. | |
| void BURGER_API | PStringToCString (char *pOutput, const Word8 *pInput) |
| Convert a Pascal string into a "C" string. | |
| char *BURGER_API | ParseBeyondWhiteSpace (const char *pInput) |
| Parse a "C" string until a non-white space character is found. | |
| char *BURGER_API | ParseToDelimiter (const char *pInput) |
| Return a pointer to whitespace, CR, LF or zero. | |
| char *BURGER_API | ParseBeyondEOL (const char *pInput) |
| Parse a "C" string until a zero or EOL. | |
| char *BURGER_API | ParseQuotedString (char *pOutput, WordPtr uOutputSize, const char *pInput) |
| Parse out a quoted string. | |
| Word BURGER_API | Wildcardcmp (const char *pInput, const char *pWildcard) |
| Perform a string comparison using the wildcard system. | |
| WordPtr BURGER_API | CopyUpToEOL (char *pOutput, WordPtr uOutputSize, const char *pInput, WordPtr uInputSize) |
| Read a stream of text chars until a NULL, LF, CR or CR/LF is found. | |
| void BURGER_API | StripLeadingSpaces (char *pInput) |
| Remove spaces from the beginning of a string. | |
| void BURGER_API | StripTrailingSpaces (char *pInput) |
| Remove spaces from the end of a string. | |
| void BURGER_API | StripLeadingWhiteSpace (char *pInput) |
| Remove whitespace from the beginning of a string. | |
| void BURGER_API | StripTrailingWhiteSpace (char *pInput) |
| Remove whitespace from the end of a string. | |
| void BURGER_API | StripLeadingAndTrailingSpaces (char *pInput) |
| Remove spaces from the beginning and end of a string. | |
| void BURGER_API | StripLeadingAndTrailingWhiteSpace (char *pInput) |
| Remove whitespace from the beginning and end of a string. | |
| void BURGER_API | StripAllFromList (char *pInput, const char *pList) |
| Remove all characters that match those in a list. | |
| void BURGER_API | StripAllButList (char *pInput, const char *pList) |
| Remove all characters except those in a list. | |
| void BURGER_API | StripTrailing (char *pInput, const char *pList) |
| Remove characters from the end of a string. | |
| void BURGER_API | StripLeading (char *pInput, const char *pList) |
| Remove characters from the beginning of a string. | |
| char *BURGER_API | GetFileExtension (const char *pInput) |
| Get a pointer to the beginning of the file extension. | |
| void BURGER_API | SetFileExtension (char *pInput, const char *pNewExtension) |
| Replace the text after the last period for filename extensions. | |
| void BURGER_API | RemoveTrailingChar (char *pInput, Word uRemove) |
| Remove a character from the end of a string if present. | |
| void BURGER_API | ForceTrailingChar (char *pInput, Word uLast) |
| Force a character to be at the end of a string if missing. | |
| void BURGER_API | SlashesToColons (char *pInput) |
| Convert all forward and back slashes to colons. | |
| void BURGER_API | SlashesToColons (char *pOutput, const char *pInput) |
| Convert all forward and back slashes to colons. | |
| void BURGER_API | SlashesToWin32Slashes (char *pInput) |
| Convert all forward slashes ('/') to back slashes ('\'). | |
| void BURGER_API | SlashesToWin32Slashes (char *pOutput, const char *pInput) |
| Convert all forward slashes ('/') to back slashes ('\'). | |
| WordPtr BURGER_API | StringLength (const char *pInput) |
| Perform an ANSI compatible strlen(). | |
| WordPtr BURGER_API | StringLength (const Word16 *pInput) |
| Perform an ANSI compatible strlen() for UTF16 strings.. | |
| void BURGER_API | StringCopy (char *pOutput, const char *pInput) |
| Copy a "C" string. | |
| void BURGER_API | StringCopy (char *pOutput, WordPtr uOutputSize, const char *pInput) |
| Copy a "C" string with bounds checking. | |
| void BURGER_API | StringConcatenate (char *pOutput, const char *pInput) |
| Concatenate a "C" string with another "C" string. | |
| void BURGER_API | StringConcatenate (char *pOutput, WordPtr uOutputSize, const char *pInput) |
| Concatenate a "C" string with another "C" string bounds checked. | |
| int BURGER_API | StringCompare (const char *pInput1, const char *pInput2) |
| Compare two "C" strings for equality. | |
| int BURGER_API | StringCaseCompare (const char *pInput1, const char *pInput2) |
| Compare two "C" strings for equality, case insensitive. | |
| int BURGER_API | StringCaseCompare (const char *pInput1, const char *pInput2, WordPtr uMaxLength) |
| Compare two "C" strings for equality, case insensitive, length delimited. | |
| void BURGER_API | MemoryCopy (void *pOutput, const void *pInput, WordPtr uCount) |
| Copy raw memory from one buffer to another. | |
| void BURGER_API | MemoryMove (void *pOutput, const void *pInput, WordPtr uCount) |
| Copy raw memory from one buffer to another in any direction. | |
| void BURGER_API | MemoryClear (void *pOutput, WordPtr uCount) |
| Set a buffer to all zeros. | |
| void BURGER_API | MemoryFill (void *pOutput, Word8 uFill, WordPtr uCount) |
| Set a buffer to a specific value. | |
| int BURGER_API | MemoryCompare (const void *pInput1, const void *pInput2, WordPtr uCount) |
| Compare two byte buffers for equality. | |
| int BURGER_API | MemoryCaseCompare (const void *pInput1, const void *pInput2, WordPtr uCount) |
| Compare two byte buffers for equality, case insensitive. | |
| void BURGER_API | StringUppercase (char *pInput) |
| Convert a string to upper case. | |
| void BURGER_API | StringUppercase (char *pOutput, const char *pInput) |
| Convert a string to upper case into a new buffer. | |
| void BURGER_API | StringLowercase (char *pInput) |
| Convert a string to lower case. | |
| void BURGER_API | StringLowercase (char *pOutput, const char *pInput) |
| Convert a string to lower case into a new buffer. | |
| char *BURGER_API | StringDuplicate (const char *pInput) |
| Make a copy of a "C" string. | |
| char *BURGER_API | StringDuplicate (const char *pInput, WordPtr uPadding) |
| Make a copy of a "C" string with some padding. | |
| BURGER_INLINE void BURGER_API | StringDelete (const char *pInput) |
| Delete an allocated string. | |
| char *BURGER_API | NumberToAscii (char *pOutput, Word32 uInput, Word uDigits=0) |
| Convert an unsigned 32 bit integer into ASCII. | |
| char *BURGER_API | NumberToAscii (char *pOutput, Int32 iInput, Word uDigits=0) |
| Convert a signed 32 bit integer into ASCII. | |
| char *BURGER_API | NumberToAscii (char *pOutput, float fInput) |
| Convert a 32 bit float into ASCII. | |
| char *BURGER_API | NumberToAscii (char *pOutput, double dInput) |
| Convert a 64 bit float into ASCII. | |
| char *BURGER_API | NumberToAsciiHex (char *pOutput, Word32 uInput, Word uDigits=0) |
| Convert an unsigned 32 bit integer into hexadecimal ASCII. | |
| Word32 BURGER_API | AsciiToInteger (const char *pInput, const char **pDest=NULL) |
| Convert an ASCII string into an integer. | |
| float BURGER_API | AsciiToFloat (const char *pInput, const char **pDest=NULL) |
| Convert an ASCII string into a floating point number. | |
| double BURGER_API | AsciiToDouble (const char *pInput, const char **pDest=NULL) |
| Convert an ASCII string into a floating point number. | |
| void BURGER_API | WriteBig (FILE *fp, Word32 uInput) |
| Write a big endian 32-bit value to a file. | |
| void BURGER_API | WriteBig (FILE *fp, Word16 uInput) |
| Write a big endian 16-bit value to a file. | |
| void BURGER_API | WriteLittle (FILE *fp, Word32 uInput) |
| Write a little endian 32-bit value to a file. | |
| void BURGER_API | WriteLittle (FILE *fp, Word16 uInput) |
| Write a little endian 16-bit value to a file. | |
| void BURGER_API | WriteCString (FILE *fp, const char *pInput) |
| Write a "C" string with the terminating zero to a file stream. | |
| Word32 BURGER_API | ReadBigWord32 (FILE *fp) |
| Read a big endian 32-bit value from a file. | |
| Word16 BURGER_API | ReadBigWord16 (FILE *fp) |
| Read a big endian 16-bit value from a file. | |
| Word32 BURGER_API | ReadLittleWord32 (FILE *fp) |
| Read a little endian 32-bit value from a file. | |
| Word16 BURGER_API | ReadLittleWord16 (FILE *fp) |
| Read a little endian 16-bit value from a file. | |
| Word BURGER_API | ReadCString (FILE *fp, char *pInput, WordPtr uLength) |
| Read a "C" string with the terminating zero to a file stream. | |
| WordPtr BURGER_API | GetSize (FILE *fp) |
| Return the size of a file. | |
| Word BURGER_API | SaveFile (FILE *fp, const void *pData, WordPtr uLength) |
| Save memory to a file opened with fopen(). | |
| void *BURGER_API | LoadFile (FILE *fp, WordPtr *uLength) |
| Load a file opened with fopen() into memory. | |
| float BURGER_API | Unpack16ToFloat (Int16 Input) |
| Decompress a packed floating point number. | |
| Int16 BURGER_API | PackFloatTo16 (float Input) |
| Convert a float in the range of 0.999999 to -0.999999 into a 16 bit packed integer. | |
| float BURGER_API | Unpack16ToFloatExp (Int16 Input, Word32 BaseExponent) |
| Decompress a packed floating point number with a supplied base exponent. | |
| Int16 BURGER_API | PackFloatTo16Exp (float Input, Word32 BaseExponent) |
| Convert a float in the range of a supplied exponent into a 16 bit packed integer. | |
Variables | |
| const char | EmptyString [1] = {0} |
| "" | |
| const char | CRLFString [3] = {'\r','\n',0} |
| "\r\n" | |
| const char | CRString [2] = {'\r',0} |
| "\r" | |
| const char | LFString [2] = {'\n',0} |
| "\n" | |
| const char * | WeekDays [7] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"} |
| Days of the week. | |
| const char * | Months [12] = {"January","February","March","April","May","June","July","August","September","October","November","December"} |
| Months of the year. | |
| const char | NibbleToAsciiUppercase [16] |
| Table to convert nibbles (0-15) into upper case ASCII characters. | |
| const char | NibbleToAsciiLowercase [16] |
| Table to convert nibbles (0-15) into lower case ASCII characters. | |
| const Word8 | AsciiToWord8Table [256] |
| Table to convert ASCII characters into nibbles (0-15). | |
| const Word8 | ReverseBits [256] |
| Table to reverse the bit order of a byte. | |
| const Word32 | TensTable32 [10] |
| Table used for testing powers of ten for integer to ASCII conversion. | |
| const Word16 | MaxWord16 = 0xFFFFU |
| Maximum value for Word16 (Minimum is 0). | |
| const Word32 | MaxWord32 = 0xFFFFFFFFUL |
| Maximum value for Word32 (Minimum is 0). | |
| const Int16 | MinInt16 = (-0x7FFF)-1 |
| Minimum value for Int16. | |
| const Int16 | MaxInt16 = 0x7FFF |
| Maximum value for Int16. | |
| const Int32 | MinInt32 = (-0x7FFFFFFFL)-1 |
| Minimum value for Int32. | |
| const Int32 | MaxInt32 = 0x7FFFFFFFL |
| Maximum value for Int32. | |
| const Frac32 | MinFrac32 = (-0x7FFFFFFFL)-1 |
| Minimum value for Frac32. | |
| const Frac32 | MaxFrac32 = 0x7FFFFFFFL |
| Maximum value for Frac32. | |
| const Fixed32 | MinFixed32 = (-0x7FFFFFFFL)-1 |
| Minimum value for Fixed32. | |
| const Fixed32 | MaxFixed32 = 0x7FFFFFFFL |
| Maximum value for Fixed32. | |
| const Fixed32 | PiFixed32 = 0x0032440L |
| Pi in Fixed32 format (3.141...). | |
80 bit float (Extended)
This is a type to abstract the 80-bit floating point data type found in the x8087 and 680x0 math co-processors. Currently, this type is hardly used anymore with the exception of the audio frame rate used in AIFF files.
Burgerlib only has functions to read and write this format into double and float.
| anonymous enum |
| double BURGER_API Burger::AsciiToDouble | ( | const char * | pInput, | |
| const char ** | pDest = NULL | |||
| ) |
Convert an ASCII string into a floating point number.
Take a floating point number of the format (+/-)303.030e(+/-)1 and turn it into a double that is the equivalent.
If a number is parsed, the character at the end of the string after whitespace is removed is the one pointed by pDest.
Examples:
1.0
1.666
1666.4
1e3 -> 1000
NAN -> NAN
INF -> INF
| pInput | Pointer to the ASCII string with the number to parse. | |
| pDest | Pointer to receive the character beyond the last character parsed. Will equal pInput on error. |
| float BURGER_API Burger::AsciiToFloat | ( | const char * | pInput, | |
| const char ** | pDest = NULL | |||
| ) |
Convert an ASCII string into a floating point number.
Take a floating point number of the format (+/-)303.030e(+/-)1 and turn it into a float that is the equivalent.
If a number is parsed, the character at the end of the string after whitespace is removed is the one pointed by pDest.
Examples:
1.0
1.666
1666.4
1e3 -> 1000
NAN -> NAN
INF -> INF
| pInput | Pointer to the ASCII string with the number to parse. | |
| pDest | Pointer to receive the character beyond the last character parsed. Will equal pInput on error. |
| Word32 BURGER_API Burger::AsciiToInteger | ( | const char * | pInput, | |
| const char ** | pDest = NULL | |||
| ) |
Convert an ASCII string into an integer.
Take a string formatted as a simple integer number, a hex number of the form $5123 or 0x1234 with or without a preceeding '-' sign and convert it into a 32 bit integer value.
Overflow is detected and is considered an error condition. 0xFFFFFFFFU will be returned in this case.
| pInput | Pointer to the string to convert. NULL will page fault. | |
| pDest | Pointer to a const char * that will either be given pInput (Error) of pInput moved ahead until a non-numeric character was found. This can be NULL if the application doesn't require the location of the string after the integer was parsed. |
Convert a BCD value into a decimal integer.
Given an input value of 0x1234, assume it is Binary Coded Decimal (BCD) format and convert it to become the decimal integer 1234.
BCD's encoding rules dictate that only the number 0-9 are valid. Any use of the hex digits A-F are considered illegal.
| uInput | 32-bit hex value in BCD. |
| WordPtr BURGER_API Burger::CopyUpToEOL | ( | char * | pOutput, | |
| WordPtr | uOutputSize, | |||
| const char * | pInput, | |||
| WordPtr | uInputSize | |||
| ) |
Read a stream of text chars until a NULL, LF, CR or CR/LF is found.
Copy from the input stream of text characters until either a zero, a LF (Unix), CR/LF (Windows), or CR (Mac) is found. The output buffer will be zero terminated and will truncate excess data.
The value returned is the number of bytes that was processed. This number is how many bytes from the original input was used.
| pOutput | Pointer to the output buffer (Can be NULL if OutputSize is zero). | |
| uOutputSize | Size in bytes of the output buffer. | |
| pInput | Pointer to the input buffer. | |
| uInputSize | Size in bytes of the maximum number of bytes to process. |
| void BURGER_API Burger::CStringToPString | ( | Word8 * | pOutput, | |
| const char * | pInput | |||
| ) |
Convert a "C" string into a Pascal string.
Copy a "C" string and convert it into a Pascal style string. A byte will denote the length, followed by the text itself. There will be no terminating zero in the new string.
The destination and the source pointer can contain the same value. This function allows in buffer data conversion.
| pOutput | Pointer to a buffer (max 256 bytes) to receive the new string. NULL will page fault. | |
| pInput | Pointer to the "C" string to copy. NULL will page fault. |
| void BURGER_API Burger::ForceTrailingChar | ( | char * | pInput, | |
| Word | uLast | |||
| ) |
Force a character to be at the end of a string if missing.
Parse to the end of the string. If the last character is a match to uLast, then do nothing. Otherwise, append this single character to the end of the string and write a terminating zero after it. This function is a convenience routine used to ensure that a trailing ':' or '/' mark is at the end of a directory path.
| pInput | Pointer to the "C" string to scan. NULL will page fault. | |
| uLast | 8 bit character to test the last char with. |
| char *BURGER_API Burger::GetFileExtension | ( | const char * | pInput | ) |
Get a pointer to the beginning of the file extension.
A string is scanned until the last period is found. A pointer to the string fragment following the period is returned. If no period is found then a pointer to the terminating zero is returned. This function is a quick way to extract the file extension from a pc style filename.
Example filenames expected are: "Foo", "ReadMe.txt","ArtFile.gif" or "MyData.c".
These examples will return pointers to: "", "txt", "gif" or "c".
The pointer returned is a pointer within the string. You do not need to release the memory in any way.
| pInput | Pointer to the "C" string to scan. NULL will page fault. |
| WordPtr BURGER_API Burger::GetSize | ( | FILE * | fp | ) |
Return the size of a file.
Given an ANSI FILE *, return the size of the file.
| fp | FILE * to the stream to write to. |
This function is faster than the fseek(), ftell(seek), fseek() method since this uses custom code tailored for each compiler to directly access records in the FILE structure in most cases.
| void *BURGER_API Burger::LoadFile | ( | FILE * | fp, | |
| WordPtr * | pLength | |||
| ) |
Load a file opened with fopen() into memory.
Given an ANSI FILE * for a freshly opened file with read permissions, allocate enough memory to accomodate the entire file and read it into memory. The file is closed at the end of the function. The passed fp pointer is considered invalid and closed after this call is issued.
Dispose of the memory returned with a call to Burger::GlobalMemoryManager::Free(const void *)
| fp | FILE * to the file to read from | |
| pLength | to a WordPtr to receive the size of the file in bytes. |
| int BURGER_API Burger::MemoryCaseCompare | ( | const void * | pInput1, | |
| const void * | pInput2, | |||
| WordPtr | uCount | |||
| ) |
Compare two byte buffers for equality, case insensitive.
Given pointers to two unsiged byte arrays, compare them for equalty by using a subtraction of the first buffer to the second. If the subtraction's result is non-zero, sign extend the result and return it immediately. If both buffers are identical, return zero. If the byte is an upper case ASCII character, convert it to lower case before the subtraction is performed
| pInput1 | Pointer to the first buffer to subtract from. | |
| pInput2 | Pointer to the second buffer to subtract with. | |
| uCount | Size in bytes of both of the buffers. |
| void BURGER_API Burger::MemoryClear | ( | void * | pOutput, | |
| WordPtr | uCount | |||
| ) |
Set a buffer to all zeros.
Given a pointer to a byte array, erase it to all zeros
| pOutput | Pointer to the buffer to erase. | |
| uCount | Size in bytes of the buffer. |
| int BURGER_API Burger::MemoryCompare | ( | const void * | pInput1, | |
| const void * | pInput2, | |||
| WordPtr | uCount | |||
| ) |
Compare two byte buffers for equality.
Given pointers to two unsiged byte arrays, compare them for equalty by using a subtraction of the first buffer to the second. If the subtraction's result is non-zero, sign extend the result and return it immediately. If both buffers are identical, return zero.
| pInput1 | Pointer to the first buffer to subtract from. | |
| pInput2 | Pointer to the second buffer to subtract with. | |
| uCount | Size in bytes of both of the buffers. |
| void BURGER_API Burger::MemoryCopy | ( | void * | pOutput, | |
| const void * | pInput, | |||
| WordPtr | uCount | |||
| ) |
Copy raw memory from one buffer to another.
Given a pointer to a byte stream, copy it to a destination buffer using a supplied input length.
| pOutput | Pointer to the buffer to get the copy. | |
| pInput | Pointer to the buffer with the "C" to copy from. | |
| uCount | Size in bytes of the data to copy. |
Set a buffer to a specific value.
Given a pointer to a byte array, fill it with a specific value
| pOutput | Pointer to the buffer to erase. | |
| uFill | 8 bit value to fill memory with | |
| uCount | Size in bytes of the buffer. |
| void BURGER_API Burger::MemoryMove | ( | void * | pOutput, | |
| const void * | pInput, | |||
| WordPtr | uCount | |||
| ) |
Copy raw memory from one buffer to another in any direction.
Given a pointer to a byte stream, copy it to a destination buffer using a supplied input length. This differs from Burger::MemoryCopy() in that it is safe to use this function for up or down memory copies. It will determine which direction to perform the copy in a safe manner. As such, there is a small performance penalty for using this function instead of Burger::MemoryCopy().
| pOutput | Pointer to the buffer to get the copy. | |
| pInput | Pointer to the buffer with the "C" to copy from. | |
| uCount | Size in bytes of the data to copy. |
Convert an unsigned 32 bit integer into ASCII.
Convert an unsigned 32 bit integer into an ASCII string. You can modify how the data is formatted by passing a third parameter.
Burger::LEADINGZEROS will force leading zeros to be printed. Burger::NOENDINGNULL will disable the writing of a terminating zero character at the end of the string so you can modify the an existing string without accidentally truncating it.
Examples:
uInput = 1234567, uDigits = 4 -> "4567"
uInput = 1234567, uDigits = 0 -> "1234567"
uInput = 1234567, uDigits = Burger::LEADINGZEROS -> "0001234567"
uInput = 22, uDigits = Burger::LEADINGZEROS+4 -> "0022"
| pOutput | Pointer to a buffer to hold the converted integer. It has to be with uDigits+1 or 12 bytes in size Whichever is appropriate. | |
| uInput | Unsigned 32 bit integer to convert to ASCII. | |
| uDigits | Number of digits to convert. Flags Burger::LEADINGZEROS and Burger::NOENDINGNULL can be added or or'd to this value to affect output. |
Convert a signed 32 bit integer into ASCII.
Convert a signed 32 bit integer into an ascii string. You can modify how the data is formatted by passing a third parameter.
Burger::LEADINGZEROS will force leading zeros to be printed. Burger::NOENDINGNULL will disable the writing of a terminating zero character at the end of the string so you can modify the an existing string without accidentally truncating it.
Examples:
uInput = 1234567, uDigits = 4 -> "4567"
uInput = 1234567, uDigits = 0 -> "1234567"
uInput = -1234567, uDigits = 4 -> "-4567"
uInput = -1234567, uDigits = 0 -> "-1234567"
uInput = 1234567, uDigits = Burger::LEADINGZEROS -> "0001234567"
uInput = 22, uDigits = Burger::LEADINGZEROS+4 -> "0022"
uInput = -22, uDigits = Burger::LEADINGZEROS+4 -> "-0022"
| pOutput | Pointer to a buffer to hold the converted integer. It has to be with uDigits+1 or 12 bytes in size Whichever is appropriate. | |
| iInput | Unsigned 32 bit integer to convert to ASCII. | |
| uDigits | Number of digits to convert. Flags Burger::LEADINGZEROS and Burger::NOENDINGNULL can be added or or'd to this value to affect output. |
| char *BURGER_API Burger::NumberToAscii | ( | char * | pOutput, | |
| float | fInput | |||
| ) |
Convert a 32 bit float into ASCII.
Convert a 32 bit float into an ascii string.
Examples:
fInput = 123.4567 -> "123.4567"
fInput = 123456.7 -> "123456.7"
fInput = -1.234567 -> "-1.234567"
fInput = -1234.567 -> "-1234.567"
| pOutput | Pointer to a buffer to hold the converted integer. It has to be a minimum of 32 bytes in size. | |
| fInput | 32 bit float to convert to ASCII. |
| char *BURGER_API Burger::NumberToAscii | ( | char * | pOutput, | |
| double | dInput | |||
| ) |
Convert a 64 bit float into ASCII.
Convert a 64 bit float into an ascii string.
Examples:
dInput = 123.4567 -> "123.4567"
dInput = 123456.7 -> "123456.7"
dInput = -1.234567 -> "-1.234567"
dInput = -1234.567 -> "-1234.567"
| pOutput | Pointer to a buffer to hold the converted integer. It has to be a minimum of 32 bytes in size. | |
| dInput | 64 bit float to convert to ASCII. |
Convert an unsigned 32 bit integer into hexadecimal ASCII.
Convert an unsigned 32 bit integer into a hexadecimal ascii string. You can modify how the data is formatted by passing a third parameter.
Burger::LEADINGZEROS will force leading zeros to be printed. Burger::NOENDINGNULL will disable the writing of a terminating zero character at the end of the string so you can modify the an existing string without accidentally truncating it.
Examples:
uInput = 0x1234BCD, uDigits = 4 -> "4BCD"
uInput = 0x1234BCD, uDigits = 0 -> "1234BCD"
uInput = 0x1234BCD, uDigits = Burger::LEADINGZEROS -> "01234BCD"
uInput = 0x2A, uDigits = Burger::LEADINGZEROS+4 -> "002A"
| pOutput | Pointer to a buffer to hold the converted integer. It has to be with uDigits+1 or 9 bytes in size Whichever is appropriate. | |
| uInput | Unsigned 32 bit integer to convert to hexidecimal ASCII. | |
| uDigits | Number of digits to convert. Flags Burger::LEADINGZEROS and Burger::NOENDINGNULL can be added or or'd to this value to affect output. |
| Int16 BURGER_API Burger::PackFloatTo16 | ( | float | Input | ) |
Convert a float in the range of 0.999999 to -0.999999 into a 16 bit packed integer.
Apply compression to a floating point number in the range of 0.999999 to -0.999999 and create a 16 bit version. The input will be clamped.
Use Burger::Unpack16ToFloat() to reconstruct the number.
Result == 0 if the input was zero or too small to be represented. Result & 0x8000 if the input was negative. (Result>>11)&0xF The exponent where 0 = 111 and 15 = 126. (Result&0x7FF) The 11 bit mantissa.
| Input | Floating point number in the range of 0.999999 to -0.999999 |
Convert a float in the range of a supplied exponent into a 16 bit packed integer.
Apply compression to a floating point number in the range of 0.999999 to -0.999999 and create a 16 bit version. The input will be clamped.
Use Burger::Unpack16ToFloatExp() to reconstruct the number.
Result == 0 if the input was zero or too small to be represented. Result & 0x8000 if the input was negative. (Result>>11)&0xF The exponent where 0 = BaseExponent and 15 = BaseExponent+15. (Result&0x7FF) The 11 bit mantissa.
| Input | Floating point number in the range of the supplied exponent. | |
| BaseExponent | Minimum acceptable exponent, (111 is used for a max value of 0.999999). |
| char *BURGER_API Burger::ParseBeyondEOL | ( | const char * | pInput | ) |
Parse a "C" string until a zero or EOL.
Follow a stream of text input until either a zero is found or an EOL is found.
If a zero is found, return a pointer to the ZERO.
If an EOL is found, return a pointer to the text BEYOND the EOL which is a "\n" (10) or a "\r" (13). In the case of a CR/LF combination, found in PC style text files, return the pointer beyond the pair.
| pInput | Pointer to a "C" string to parse. NULL will page fault. |
| char *BURGER_API Burger::ParseBeyondWhiteSpace | ( | const char * | pInput | ) |
Parse a "C" string until a non-white space character is found.
Skip over any space (32) or tab (9) character and return the pointer to the first character that doesn't match.
| pInput | Pointer to a "C" string to parse. NULL will page fault. |
| char *BURGER_API Burger::ParseQuotedString | ( | char * | pOutput, | |
| WordPtr | uOutputSize, | |||
| const char * | pInput | |||
| ) |
Parse out a quoted string.
If the first character of the string is a quote "\"" (0x22), then parse out a quote delimited string. This function will parse double quotes ("") as a single quote to be inserted into the string.
If the first character is not a quote, return pInput to signal an error condition.
All tabs in the string become spaces.
If the output buffer isn't large enough to hold the resulting string, truncate the output to fit. The output will always be zero terminated in all cases.
| pOutput | Pointer to the output string. NULL is acceptable if uOutputSize is zero. | |
| uOutputSize | Size of the output string buffer in bytes. | |
| pInput | Pointer to a "C" string that has a " as the first character. NULL will page fault. \return Pointer to the character that ended parsing. ", CR, LF or zero. |
| char *BURGER_API Burger::ParseToDelimiter | ( | const char * | pInput | ) |
Return a pointer to whitespace, CR, LF or zero.
Parse a string until a whitespace, CR, LF or zero is found. Return the pointer at the point where the requested character is. Useful in parsing a token and finding the end of it.
| pInput | Pointer to a "C" string to parse. NULL will page fault. |
Round up an integer to the nearest power of 2.
Take an arbitrary value and round it up to the nearest power of 2 If the input is 0x40000001 to 0x7FFFFFFF, I return 0x80000000 0x80000000-0xFFFFFFFF is an overflow and returns zero. Zero will return zero
| uInput | Integer value to round up |
| void BURGER_API Burger::PStringToCString | ( | char * | pOutput, | |
| const Word8 * | pInput | |||
| ) |
Convert a Pascal string into a "C" string.
Copy a Pascal string and convert it into a "C" style string. A byte will denote the length, followed by the text itself. There will be text followed by a terminating zero in the new string.
The destination and the source pointer can contain the same value. This function allows in buffer data conversion.
| pOutput | Pointer to a buffer (max 256 bytes) to receive the new string. NULL will page fault. | |
| pInput | Pointer to the Pascal string to copy. NULL will page fault. |
| Word16 BURGER_API Burger::ReadBigWord16 | ( | FILE * | fp | ) |
Read a big endian 16-bit value from a file.
Given an ANSI FILE *, read a 16-bit value in big endian format from the file stream.
| fp | FILE * to the stream to read from. |
| Word32 BURGER_API Burger::ReadBigWord32 | ( | FILE * | fp | ) |
Read a big endian 32-bit value from a file.
Given an ANSI FILE *, read a 32-bit value in big endian format from the file stream.
| fp | FILE * to the stream to read from. |
Read a "C" string with the terminating zero to a file stream.
Given an ANSI FILE *, read a "C" string with a terminating zero into the file stream. If the string read is larger than the buffer, it is truncated. The buffer will have an ending zero on valid read or a trucated read. If uLength was zero, then pInput can be NULL
| fp | FILE * to the stream to write to. | |
| pInput | Pointer to a "C" string to write. | |
| uLength | Size of the buffer (To prevent overruns) |
| Word16 BURGER_API Burger::ReadLittleWord16 | ( | FILE * | fp | ) |
Read a little endian 16-bit value from a file.
Given an ANSI FILE *, read a 16-bit value in little endian format from the file stream.
| fp | FILE * to the stream to read from. |
| Word32 BURGER_API Burger::ReadLittleWord32 | ( | FILE * | fp | ) |
Read a little endian 32-bit value from a file.
Given an ANSI FILE *, read a 32-bit value in little endian format from the file stream.
| fp | FILE * to the stream to read from. |
| void BURGER_API Burger::RemoveTrailingChar | ( | char * | pInput, | |
| Word | uRemove | |||
| ) |
Remove a character from the end of a string if present.
Parse to the end of the string. If the last character is a match to uRemove, it's zero'd out, effectively removing it. This function is a convenience routine used to get rid of a trailing ':' or '/' mark from a directory path.
| pInput | Pointer to the "C" string to scan. NULL will page fault. | |
| uRemove | character to test the last char with (Range 0-255). |
Save memory to a file opened with fopen().
Given an ANSI FILE * for a freshly opened file with write permissions, write the chunk of memory to the file and close the file. The passed pointer is considered invalid and closed after this call is issued.
| fp | FILE * to the file to write to | |
| pInput | Pointer to the memory to write to | |
| uLength | Number of bytes to write |
| void BURGER_API Burger::SetFileExtension | ( | char * | pInput, | |
| const char * | pNewExtension | |||
| ) |
Replace the text after the last period for filename extensions.
A string is scanned until the last period is found. The text beyond the final period is discarded and the string pointed by pNewExtension is appended to the Input filename. If no final period is found, then a period is appended and then the new extension is added. If NewExtension has a period as the first character, it will be ignored to prevent a double period from occuring in the final string.
You must guarantee that the Input buffer has enough space to accomodate the new extension. This routine will not check for buffer overruns.
Examples: "Foo.txt" + "gif" = "Foo.gif", "Foo" + "gif" = "Foo.gif", "Foo.txt" + NULL = "Foo", "Foo.bin" + ".txt" = "Foo.txt".
| pInput | Pointer to the "C" string to scan. NULL will page fault. This will be modified with the new file extension. NewExtension = Pointer to a "C" string with the extension to apply. | |
| pNewExtension | Pointer to a "C" string that represents the new extension. A NULL or empty string will have the existing extension stripped. |
| void BURGER_API Burger::SlashesToColons | ( | char * | pInput | ) |
Convert all forward and back slashes to colons.
Burgerlib uses colons as directory seperators. This function will take unix ('\') and Win32 ('/') style slashes and convert them into colons.
| pInput | Pointer to the "C" string to perform the fixup on. NULL will page fault. |
| void BURGER_API Burger::SlashesToColons | ( | char * | pOutput, | |
| const char * | pInput | |||
| ) |
Convert all forward and back slashes to colons.
Burgerlib uses colons as directory seperators. This function will take unix ('\') and Win32 ('/') style slashes and convert them into colons.
| pOutput | Pointer to a buffer large enough to contain the new string | |
| pInput | Pointer to the "C" string to perform the fixup. NULL will page fault. |
| void BURGER_API Burger::SlashesToWin32Slashes | ( | char * | pInput | ) |
Convert all forward slashes ('/') to back slashes ('\').
Win32 uses backslashes as directory seperators. This function will take unix tyle slashes and convert them into Win32 slashes.
| pInput | Pointer to the "C" string to perform the fixup on. NULL will page fault. |
| void BURGER_API Burger::SlashesToWin32Slashes | ( | char * | pOutput, | |
| const char * | pInput | |||
| ) |
Convert all forward slashes ('/') to back slashes ('\').
Win32 uses backslashes as directory seperators. This function will take unix tyle slashes and convert them into Win32 slashes.
| pOutput | Pointer to a buffer large enough to hold the converted "C" string. | |
| pInput | Pointer to the "C" string to perform the fixup on. NULL will page fault. |
| int BURGER_API Burger::StringCaseCompare | ( | const char * | pInput1, | |
| const char * | pInput2 | |||
| ) |
Compare two "C" strings for equality, case insensitive.
Given pointers to two "C" strings, compare them for equalty by using a subtraction of the first buffer to the second. If the subtraction's result is non-zero, sign extend the result and return it immediately. If both buffers are identical, return zero. If the characters in the string are upper case, convert them to ASCII lowercase before the subtraction.
| pInput1 | Pointer to the first "C" string to subtract from. | |
| pInput2 | Pointer to the second "C" string to subtract with. |
| int BURGER_API Burger::StringCaseCompare | ( | const char * | pInput1, | |
| const char * | pInput2, | |||
| WordPtr | uMaxLength | |||
| ) |
Compare two "C" strings for equality, case insensitive, length delimited.
Given pointers to two "C" strings, compare them for equalty by using a subtraction of the first buffer to the second. If the subtraction's result is non-zero, sign extend the result and return it immediately. If both buffers are identical, return zero. If the characters in the string are upper case, convert them to ASCII lowercase before the subtraction.
The function determines equality by hitting a zero first or the maximum allowed length.
| pInput1 | Pointer to the first "C" string to subtract from. | |
| pInput2 | Pointer to the second "C" string to subtract with. | |
| uMaxLength | Maximum number of bytes to check |
| int BURGER_API Burger::StringCompare | ( | const char * | pInput1, | |
| const char * | pInput2 | |||
| ) |
Compare two "C" strings for equality.
Given pointers to two "C" strings, compare them for equalty by using a subtraction of the first buffer to the second. If the subtraction's result is non-zero, sign extend the result and return it immediately. If both buffers are identical, return zero.
| pInput1 | Pointer to the first "C" string to subtract from. | |
| pInput2 | Pointer to the second "C" string to subtract with. |
| void BURGER_API Burger::StringConcatenate | ( | char * | pOutput, | |
| WordPtr | uOutputSize, | |||
| const char * | pInput | |||
| ) |
Concatenate a "C" string with another "C" string bounds checked.
Given a pointer to a "C" string, append it to a destination buffer that contains a valid "C" string. If the destination buffer isn't big enough for the input string, truncate it.
| pOutput | Pointer to the buffer of a valid "C" string to be appended. | |
| uOutputSize | Size in bytes of the output buffer | |
| pInput | Pointer to the buffer with the "C" to copy from. |
| void BURGER_API Burger::StringConcatenate | ( | char * | pOutput, | |
| const char * | pInput | |||
| ) |
Concatenate a "C" string with another "C" string.
Given a pointer to a "C" string, append it to a destination buffer that contains a valid "C" string. No bounds checking is performed.
| pOutput | Pointer to the buffer of a valid "C" string to be appended. | |
| pInput | Pointer to the buffer with the "C" to copy from. |
| void BURGER_API Burger::StringCopy | ( | char * | pOutput, | |
| WordPtr | uOutputSize, | |||
| const char * | pInput | |||
| ) |
Copy a "C" string with bounds checking.
Given a pointer to a "C" string, copy it to a destination buffer. If the destination buffer isn't big enough for the input string, truncate it.
| pOutput | Pointer to the buffer to get the copy. | |
| uOutputSize | Size in bytes of the output buffer | |
| pInput | Pointer to the buffer with the "C" to copy from. |
| void BURGER_API Burger::StringCopy | ( | char * | pOutput, | |
| const char * | pInput | |||
| ) |
Copy a "C" string.
Given a pointer to a "C" string, copy it to a destination buffer.
| pOutput | Pointer to the buffer to get the copy. | |
| pInput | Pointer to the buffer with the "C" to copy from. |
| Burger::StringDelete | ( | const char * | pInput | ) |
Delete an allocated string.
If a string was allocated with Burger::StringDuplicate(const char *) or Burger::StringDuplicate(const char *,WordPtr) then you must dispose of it with this function.
| pInput | Pointer to the "C" string to delete. A null pointer will do nothing and is okay to pass. |
| char *BURGER_API Burger::StringDuplicate | ( | const char * | pInput | ) |
Make a copy of a "C" string.
The "C" string passed by pInput will be copied into a buffer allocated by AllocAPointer(WordPtr). The buffer is exactly the same size of the string. You must eventually dispose of the string with a call to Burger::StringDelete(const char *).
| pInput | Pointer to the "C" string to copy. A null pointer will page fault. |
| char *BURGER_API Burger::StringDuplicate | ( | const char * | pInput, | |
| WordPtr | uPadding | |||
| ) |
Make a copy of a "C" string with some padding.
The "C" string passed by pInput will be copied into a buffer allocated by AllocAPointer(WordPtr). The buffer is the same size of the string plus the padding value. The extra memory is not initialized but the string does terminate with a zero. You must eventually dispose of the string with a call to Burger::StringDelete(const char *).
| pInput | Pointer to the "C" string to copy. A null pointer will page fault. | |
| uPadding | Number of bytes to extend the buffer. |
| WordPtr BURGER_API Burger::StringLength | ( | const char * | pInput | ) |
Perform an ANSI compatible strlen().
Determine the length of a "C" string in memory. A "C" string is a random string of bytes that terminates with a zero.
This function works by first forcing 32-bit alignment and then grabbing four bytes at a time, and uses a psuedo vector operation to test all four of them at once.
Here's how it works. For each byte, perform an operation that will clear the high bit if it is not in a suitable range. The two tests are as follows.
#1) Negate the high bit. This eliminates 0x80-0xFF, because if the byte was 0xD5, then it would become 0x55 which has a clear high bit. (0xD5^0x80)&0x80 == 0. This test is performed by performing a "~" operation in "C".
#2) Add 0xFF to the byte. This converts 0x01-0x80 into 0x00-0x7F. This range of values all have their high bits clear. This test is preformed by adding the constant 0xFEFEFEFF to the Word32.
Take the output of these two tests and and them together, then and with 0x80 to test the high bit. If it is set, it must be zero since zero is the only value that passes both tests.
You may ask, why add with 0xFEFEFEFF, when I want to add 0xFF to each byte? Why wasn't it 0xFFFFFFFF? Because when I add 0xFF to the bottommost byte, it will carry a one to each upper byte. To compensate, I add 0xFE instead of 0xFF so the carried one is accounted for.
| pInput | Pointer to "C" string to determine the length |
Perform an ANSI compatible strlen() for UTF16 strings..
Determine the length of a UTF16 "C" string in memory. A UTF16 "C" string is a random string of shorts that terminates with a zero.
| pInput | Pointer to a UTF16 "C" string to determine the length |
| void BURGER_API Burger::StringLowercase | ( | char * | pOutput, | |
| const char * | pInput | |||
| ) |
Convert a string to lower case into a new buffer.
Copy a string and convert all 'A'-'Z' characters to 'a'-'z'. No localization is performed and no other characters are altered.
| pOutput | Pointer to a buffer large enoungh to hold the input "C" string. | |
| pInput | Pointer to "C" string to modify. |
| void BURGER_API Burger::StringLowercase | ( | char * | pInput | ) |
Convert a string to lower case.
Convert all 'A'-'Z' characters to 'a'-'z'. No localization is performed and no other characters are altered.
| pInput | Pointer to "C" string to modify. |
| void BURGER_API Burger::StringUppercase | ( | char * | pInput | ) |
Convert a string to upper case.
Convert all 'a'-'z' characters to 'A'-'Z'. No localization is performed and no other characters are altered.
| pInput | Pointer to "C" string to modify. |
| void BURGER_API Burger::StringUppercase | ( | char * | pOutput, | |
| const char * | pInput | |||
| ) |
Convert a string to upper case into a new buffer.
Copy a string and convert all 'a'-'z' characters to 'A'-'Z'. No localization is performed and no other characters are altered.
| pOutput | Pointer to a buffer large enoungh to hold the input "C" string. | |
| pInput | Pointer to "C" string to modify. |
| void BURGER_API Burger::StripAllButList | ( | char * | pInput, | |
| const char * | pList | |||
| ) |
Remove all characters except those in a list.
The Input string is scanned and every character that is not in the pList "C" string will be removed and compacted. The resulting string consists only of characters that are found in the pList "C" string.
| pInput | Pointer to the "C" string to purge. NULL will page fault. | |
| pList | Pointer to the "C" string that contains the valid characters to allow. |
| void BURGER_API Burger::StripAllFromList | ( | char * | pInput, | |
| const char * | pList | |||
| ) |
Remove all characters that match those in a list.
The Input string is scanned and every character that is in the pList "C" string will be removed and compacted. The resulting string consists only of characters that are not found in the pList "C" string.
| pInput | Pointer to the "C" string to purge. NULL will page fault. | |
| pList | Pointer to the "C" string that contains the characters to remove. Do not pass a null pointer. |
| void BURGER_API Burger::StripLeading | ( | char * | pInput, | |
| const char * | pList | |||
| ) |
Remove characters from the beginning of a string.
Starting from the beginning of a string, see if the character is in the supplied list. If so, then the character is removed by copying the rest of the string up. This is repeated until there are no more characters from the list at the beginning of the string or the string is empty.
| void BURGER_API Burger::StripLeadingAndTrailingSpaces | ( | char * | pInput | ) |
Remove spaces from the beginning and end of a string.
Starting from the beginning of a string, see if the character is a space. If so then the character is removed by copying the rest of the string up. This is repeated until there are no more spaces at the beginning of the string or the string is empty. Then the process is repeated but from the end of the string. The resulting string will not have any space characters at the beginning or the end.
Example: " Foo" becomes "Foo", "Foo " becomes "Foo", " Foo " becomes "Foo".
| pInput | Pointer to the "C" string to remove beginning and ending spaces from. NULL will page fault. |
| void BURGER_API Burger::StripLeadingAndTrailingWhiteSpace | ( | char * | pInput | ) |
Remove whitespace from the beginning and end of a string.
Starting from the beginning of a string, see if the character is whitespace. If so then the character is removed by copying the rest of the string up. This is repeated until there are no more whitespace at the beginning of the string or the string is empty. Then the process is repeated but from the end of the string. The resulting string will not have any whitespace characters at the beginning or the end.
Example: " \t Foo" becomes "Foo", "Foo \t " becomes "Foo", " \t Foo \t " becomes "Foo".
| pInput | Pointer to the "C" string to remove beginning and ending whitespace from. NULL will page fault. |
| void BURGER_API Burger::StripLeadingSpaces | ( | char * | pInput | ) |
Remove spaces from the beginning of a string.
Starting from the beginning of a string, see if the character is a space (32). If so, then the character is removed by copying the rest of the string up. This is repeated until there are no more spaces at the beginning of the string or the string is empty.
Example: " Foo" becomes "Foo", "Foo " remains "Foo ", " Foo " becomes "Foo ".
| pInput | Pointer to the "C" string to remove beginning spaces from. NULL will page fault. |
| void BURGER_API Burger::StripLeadingWhiteSpace | ( | char * | pInput | ) |
Remove whitespace from the beginning of a string.
Starting from the beginning of a string, see if the character is a space or a tab. If so, then the character is removed by copying the rest of the string up. This is repeated until there are no more spaces or tabs at the beginning of the string or the string is empty.
Example: " \t Foo" becomes "Foo", "Foo \t " remains "Foo \t ", " \t Foo \t " becomes "Foo \t ".
| pInput | Pointer to the "C" string to remove beginning whitespace from. NULL will page fault. |
| void BURGER_API Burger::StripTrailing | ( | char * | pInput, | |
| const char * | pList | |||
| ) |
Remove characters from the end of a string.
Starting from the end of a string but before the ending zero, see if the character found is inside the string passed in ListPtr. If so, then the character is removed by zeroing it out and the process begins again until the string is empty or a character that is not in the list is found.
| void BURGER_API Burger::StripTrailingSpaces | ( | char * | pInput | ) |
Remove spaces from the end of a string.
Starting from the end of a string but before the ending zero, see if the last character is a space. If so, then the character is removed by zeroing it out and the process begins again until the string is empty or a non space character is at the end of the "C" string. For speed purposes, only a single zero is ever written to the "C" string. Do not assume that all the spaces that were removed were actually overwritten with zeros.
Example: " Foo" remains " Foo", " Foo" becomes "Foo", " Foo " becomes " Foo".
| pInput | Pointer to the "C" string to remove ending spaces from. NULL will page fault. |
| void BURGER_API Burger::StripTrailingWhiteSpace | ( | char * | pInput | ) |
Remove whitespace from the end of a string.
Starting from the end of a string but before the ending zero, see if the last character is a space or tab. If so, then the character is removed by zeroing it out and the process begins again until the string is empty or a non space or tab character is at the end of the "C" string. For speed purposes, only a single zero is ever written to the "C" string. Do not assume that all the spaces and tabs that were removed were actually overwritten with zeros.
Example: " \t Foo" remains " \t Foo", "Foo \t " becomes "Foo", " \t Foo \t " becomes " \t Foo".
| pInput | Pointer to the "C" string to remove ending spaces and tabs from. NULL will page fault. |
| float BURGER_API Burger::Unpack16ToFloat | ( | Int16 | Input | ) |
Decompress a packed floating point number.
Decompress a 16 bit floating point number, assuming that the range is 0.999999 to -0.999999
Use Burger::Pack16ToFloat() to create the 16 bit value.
The 16 bits are represented in this manner.
val==0 = The value is zero. val&0x8000 = The value is negative. (val&0x7800)>>11 = 4 bit exponent where 0->111 and 15->126. (val&0x7FF) = 11 bit mantissa.
| Input | 16 bit representation of a floating point number. |
Decompress a packed floating point number with a supplied base exponent.
Decompress a 16 bit floating point number, assuming that the minimum exponent is the one supplied. For 0.999999 you should supply the exponent value of 111. This number must match the value used to compress the value in the first place. This function exists so that floating point compression can scale to different ranges.
Use Burger::Pack16ToFloatExp() to create the 16 bit value.
The 16 bits are represented in this manner.
val==0 = The value is zero. val&0x8000 = The value is negative. (val&0x7800)>>11 = 4 bit exponent where 0->111 and 15->126. (val&0x7FF) = 11 bit mantissa.
| Input | 16 bit representation of a floating point number. | |
| BaseExponent | Minimum exponent, should match the value used to apply compression (111 is used for a max value of 0.999999). |
| Word BURGER_API Burger::Wildcardcmp | ( | const char * | pInput, | |
| const char * | pWildcard | |||
| ) |
Perform a string comparison using the wildcard system.
An "*" denotes that the input is skipped until the character following is found, then the compare continues. If a "*" is the final character, then the input string is considered a match.
A "?" denotes that a single, non-zero character must occupy this location.
Examples for wildcards: .* = All strings that have a single period anywhere in them. = All strings match. .??? = All strings that have a exactly three characters at the end after a period.
| pInput | Pointer to a "C" to compare against. NULL will page fault. | |
| pWildcard | Pointer to a "C" string that has wildcard information. NULL will page fault. |
Convert a decimal integer into BCD format.
Given a decimal in the range of 0-99999999, convert it into that value into Binary Coded Decimal (BCD) format. Such that 1234 become 0x1234 and 50331 become 0x00050331. If the input value is greater than 99999999 it is clamped to 99999999.
| uInput | Integer value in the range of 0 to 99999999. |
| void BURGER_API Burger::WriteBig | ( | FILE * | fp, | |
| Word16 | uInput | |||
| ) |
Write a big endian 16-bit value to a file.
Given an ANSI FILE *, write a 16-bit value in big endian format into the file stream.
| fp | FILE * to the stream to write to. | |
| uInput | Data to write. |
| void BURGER_API Burger::WriteBig | ( | FILE * | fp, | |
| Word32 | uInput | |||
| ) |
Write a big endian 32-bit value to a file.
Given an ANSI FILE *, write a 32-bit value in big endian format into the file stream.
| fp | FILE * to the stream to write to. | |
| uInput | Data to write. |
| void BURGER_API Burger::WriteCString | ( | FILE * | fp, | |
| const char * | pInput | |||
| ) |
Write a "C" string with the terminating zero to a file stream.
Given an ANSI FILE *, write a "C" string with a terminating zero into the file stream.
| fp | FILE * to the stream to write to. | |
| pInput | Pointer to a "C" string to write. |
| void BURGER_API Burger::WriteLittle | ( | FILE * | fp, | |
| Word16 | uInput | |||
| ) |
Write a little endian 16-bit value to a file.
Given an ANSI FILE *, write a 16-bit value in little endian format into the file stream.
| fp | FILE * to the stream to write to. | |
| uInput | Data to write. |
| void BURGER_API Burger::WriteLittle | ( | FILE * | fp, | |
| Word32 | uInput | |||
| ) |
Write a little endian 32-bit value to a file.
Given an ANSI FILE *, write a 32-bit value in little endian format into the file stream.
| fp | FILE * to the stream to write to. | |
| uInput | Data to write. |
| const Word8 Burger::AsciiToWord8Table[256] |
Table to convert ASCII characters into nibbles (0-15).
This table is used for code to quickly map the ASCII values of '0'-'9', 'A'-'F' and 'a'-'f' into the hex digits 0x00-0x0F.
| const char Burger::CRLFString = {'\r','\n',0} |
"\r\n"
This string is hard coded to have the Win32 CR/LF EOL string. It saves space by having a singular occurance.
| const char Burger::CRString = {'\r',0} |
"\r"
This string is hard coded to have the MacOS CR EOL string. It saves space by having a singular occurance.
| const char Burger::EmptyString = {0} |
""
This string is hard coded to be an empty string. It saves space by having a singular occurance.
| const char Burger::LFString = {'\n',0} |
"\n"
This string is hard coded to have the Linux/Unix LF EOL string. It saves space by having a singular occurance.
| const Fixed32 Burger::MaxFixed32 = 0x7FFFFFFFL |
Maximum value for Fixed32.
| const Frac32 Burger::MaxFrac32 = 0x7FFFFFFFL |
Maximum value for Frac32.
| const Int16 Burger::MaxInt16 = 0x7FFF |
Maximum value for Int16.
| const Int32 Burger::MaxInt32 = 0x7FFFFFFFL |
Maximum value for Int32.
| const Word16 Burger::MaxWord16 = 0xFFFFU |
Maximum value for Word16 (Minimum is 0).
| const Word32 Burger::MaxWord32 = 0xFFFFFFFFUL |
Maximum value for Word32 (Minimum is 0).
| const Fixed32 Burger::MinFixed32 = (-0x7FFFFFFFL)-1 |
Minimum value for Fixed32.
| const Frac32 Burger::MinFrac32 = (-0x7FFFFFFFL)-1 |
Minimum value for Frac32.
| const Int16 Burger::MinInt16 = (-0x7FFF)-1 |
Minimum value for Int16.
| const Int32 Burger::MinInt32 = (-0x7FFFFFFFL)-1 |
Minimum value for Int32.
| const char * Burger::Months = {"January","February","March","April","May","June","July","August","September","October","November","December"} |
Months of the year.
An array of twelve strings for the twelve months of the year. Each string is capitalized so they are "January", "February", etc...
| const char Burger::NibbleToAsciiLowercase[16] |
Table to convert nibbles (0-15) into lower case ASCII characters.
This table is used for code to quickly map the hex values of 0-15 into the digits 0-9 and a-f.
| const char Burger::NibbleToAsciiUppercase[16] |
Table to convert nibbles (0-15) into upper case ASCII characters.
This table is used for code to quickly map the hex values of 0-15 into the digits 0-9 and A-F.
| const Fixed32 Burger::PiFixed32 = 0x0032440L |
Pi in Fixed32 format (3.141...).
| const Word8 Burger::ReverseBits[256] |
Table to reverse the bit order of a byte.
This table will take the a Word8 used as an index and return the bit reversed value of that index. 0x80 -> 0x01, 0xAA -> 0x55, 0x32 -> 0x4C.
| const Word32 Burger::TensTable32 |
{
1,
10,
100,
1000,
10000,
100000,
1000000,
10000000,
100000000,
1000000000
}
Table used for testing powers of ten for integer to ASCII conversion.
This table is used for code to test an integer against a power of ten for divisionless conversion of an integer to ASCII text.
| const char * Burger::WeekDays = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"} |
Days of the week.
An array of seven strings for the seven days of the week. Each string is capitalized so they are "Sunday", "Monday", etc...
1.7.1