libc8
CHIP-8 utility library
|
#include "util.h"
#include "../defs.h"
#include "exception.h"
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
Functions | |
int | hex_to_int (char c) |
Get the integer value of hexadecimal ASCII representation. More... | |
int | parse_int (const char *s) |
Parse decimal or hexadecimal integer from s More... | |
char * | trim (char *s) |
Trim leading and trailing whitespace from s More... | |
Miscellaneous useful functions.
int hex_to_int | ( | char | c | ) |
Get the integer value of hexadecimal ASCII representation.
c | the char to convert |
int parse_int | ( | const char * | s | ) |
Parse decimal or hexadecimal integer from s
Converts string s
to an integer. Assumes decimal unless the first character is ‘’$'or
'x'`.
s | The string to convert. |
char * trim | ( | char * | s | ) |
Trim leading and trailing whitespace from s
Puts a NULL
character after the last non-whitespace character and returns a pointer to the first non-whitespace character.
s | string to trim |
s
.