#include <stdlib.h>#include <string.h>#include <time.h>#include <stdio.h>#include <errno.h>#include <stdint.h>#include <stddef.h>
Go to the source code of this file.
Classes | |
| struct | dr_cmdline |
| struct | dr_timer |
| struct | drpath_iterator |
| struct | drpath_segment |
Macros | |
| #define | _TRUNCATE ((size_t)-1) |
| #define | dr_abs(x) (((x) < 0) ? (-(x)) : (x)) |
| #define | dr_clamp(x, low, high) (dr_max(low, dr_min(x, high))) |
| #define | DR_FALSE 0 |
| #define | DR_INLINE static inline |
| #define | dr_max(x, y) (((x) > (y)) ? (x) : (y)) |
| #define | dr_min(x, y) (((x) < (y)) ? (x) : (y)) |
| #define | dr_path_h |
| #define | dr_round_up(x, multiple) ((((x) + ((multiple) - 1)) / (multiple)) * (multiple)) |
| #define | dr_round_up_signed(x, multiple) ((((x) + (((x) >= 0)*((multiple) - 1))) / (multiple)) * (multiple)) |
| #define | DR_SIZED_TYPES_DEFINED |
| #define | DR_TRUE 1 |
| #define | dr_zero_object(pObject) memset(pObject, 0, sizeof(*pObject)); |
| #define | IN |
| #define | OUT |
| #define | STRINGIFY(x) #x |
| #define | TOSTRING(x) STRINGIFY(x) |
| #define | UNUSED(x) ((void)(x)) |
Typedefs | |
| typedef dr_uint32 | dr_bool32 |
| typedef dr_uint8 | dr_bool8 |
| typedef struct dr_cmdline | dr_cmdline |
| typedef dr_bool32 | dr_cmdline_parse_proc(const char *key, const char *value, void *pUserData) |
| typedef int16_t | dr_int16 |
| typedef int32_t | dr_int32 |
| typedef int64_t | dr_int64 |
| typedef int8_t | dr_int8 |
| typedef dr_bool32(* | dr_iterate_files_proc) (const char *filePath, void *pUserData) |
| typedef void(* | dr_key_value_error_proc) (void *pUserData, const char *message, unsigned int line) |
| typedef void(* | dr_key_value_pair_proc) (void *pUserData, const char *key, const char *value) |
| typedef size_t(* | dr_key_value_read_proc) (void *pUserData, void *pDataOut, size_t bytesToRead) |
| typedef void * | dr_mutex |
| Mutex. More... | |
| typedef void * | dr_semaphore |
| Semaphore. More... | |
| typedef void * | dr_thread |
| Thread. More... | |
| typedef int(* | dr_thread_entry_proc) (void *pData) |
| typedef uint16_t | dr_uint16 |
| typedef uint32_t | dr_uint32 |
| typedef uint64_t | dr_uint64 |
| typedef uint8_t | dr_uint8 |
| typedef struct drpath_iterator | drpath_iterator |
Functions | |
| DR_INLINE int | _itoa_s (int value, char *dst, size_t dstSizeInBytes, int radix) |
| DR_INLINE int | _stricmp (const char *string1, const char *string2) |
| DR_INLINE void | dr_aligned_free (void *ptr) |
| DR_INLINE void * | dr_aligned_malloc (size_t alignment, size_t size) |
| dr_bool32 | dr_cmdline_key_exists (dr_cmdline *pCmdLine, const char *key) |
| Helper for determining whether or not the given key exists. More... | |
| int | dr_cmdline_to_argv (dr_cmdline *pCmdLine, char ***argvOut) |
| dr_bool32 | dr_copy_file (const char *srcPath, const char *dstPath, dr_bool32 failIfExists) |
| size_t | dr_copy_line (const char *str, char *lineOut, size_t lineOutSize) |
| Makes a copy of the first line of the given string. More... | |
| dr_bool32 | dr_create_empty_file (const char *fileName, dr_bool32 failIfExists) |
| dr_mutex | dr_create_mutex () |
| dr_semaphore | dr_create_semaphore (int initialValue) |
| dr_thread | dr_create_thread (dr_thread_entry_proc entryProc, void *pData) |
| void | dr_date_YYYYMMDD (time_t t, char *strOut, unsigned int strOutSize) |
| void | dr_datetime_short (time_t t, char *strOut, unsigned int strOutSize) |
| Formats a data/time string. More... | |
| dr_bool32 | dr_delete_file (const char *filePath) |
| void | dr_delete_mutex (dr_mutex mutex) |
| Deletes a mutex object. More... | |
| void | dr_delete_semaphore (dr_semaphore semaphore) |
| Deletes the given semaphore. More... | |
| void | dr_delete_thread (dr_thread thread) |
| dr_bool32 | dr_directory_exists (const char *directoryPath) |
| dr_bool32 | dr_file_exists (const char *filePath) |
| const char * | dr_first_non_whitespace (const char *str) |
| Finds the first non-whitespace character in the given string. More... | |
| const char * | dr_first_whitespace (const char *str) |
| Finds the first occurance of a whitespace character in the given string. More... | |
| FILE * | dr_fopen (const char *fileName, const char *openMode) |
| void | dr_free_argv (char **argv) |
| void | dr_free_file_data (void *valueReturnedByOpenAndReadFile) |
| dr_bool32 | dr_get_config_folder_path (char *pathOut, size_t pathOutSize) |
| const char * | dr_get_current_directory (char *pathOut, size_t pathOutSize) |
| Retrieves the current directory. More... | |
| dr_bool32 | dr_get_executable_directory_path (char *pathOut, size_t pathOutSize) |
| dr_bool32 | dr_get_executable_path (char *pathOut, size_t pathOutSize) |
| dr_uint64 | dr_get_file_modified_time (const char *filePath) |
| dr_bool32 | dr_get_log_folder_path (char *pathOut, size_t pathOutSize) |
| unsigned int | dr_get_logical_processor_count () |
| Retrieves the number of logical cores on system. More... | |
| unsigned int | dr_get_process_id () |
| size_t | dr_get_username (char *usernameOut, size_t usernameOutSize) |
| dr_bool32 | dr_hex_char_to_uint (char ascii, unsigned int *out) |
| dr_bool32 | dr_init_cmdline (dr_cmdline *pCmdLine, int argc, char **argv) |
| Initializes a command line object. More... | |
| dr_bool32 | dr_init_cmdline_win32 (dr_cmdline *pCmdLine, const char *args) |
| Initializes a command line object using a Win32 style command line. More... | |
| static dr_bool32 | dr_is_directory (const char *directoryPath) |
| dr_bool32 | dr_is_file_read_only (const char *filePath) |
| dr_bool32 | dr_is_whitespace (dr_uint32 utf32) |
| dr_bool32 | dr_iterate_files (const char *directory, dr_bool32 recursive, dr_iterate_files_proc proc, void *pUserData) |
| int | dr_itoa_s (int value, char *dst, size_t dstSizeInBytes, int radix) |
| void | dr_lock_mutex (dr_mutex mutex) |
| Locks the given mutex. More... | |
| static const char * | dr_ltrim (const char *str) |
| dr_bool32 | dr_mkdir (const char *directoryPath) |
| dr_bool32 | dr_mkdir_recursive (const char *directoryPath) |
| dr_bool32 | dr_move_file (const char *oldPath, const char *newPath) |
| const char * | dr_next_line (const char *str) |
| Finds the beginning of the next line. More... | |
| DR_INLINE dr_uint32 | dr_next_power_of_2 (dr_uint32 value) |
| const char * | dr_next_token (const char *tokens, char *tokenOut, size_t tokenOutSize) |
| time_t | dr_now () |
| Retrieves a time_t as of the time the function was called. More... | |
| void * | dr_open_and_read_file (const char *filePath, size_t *pFileSizeOut) |
| char * | dr_open_and_read_text_file (const char *filePath, size_t *pFileSizeOut) |
| dr_bool32 | dr_open_and_write_file (const char *filePath, const void *pData, size_t dataSize) |
| dr_bool32 | dr_open_and_write_text_file (const char *filePath, const char *text) |
| void | dr_parse_cmdline (dr_cmdline *pCmdLine, dr_cmdline_parse_proc callback, void *pUserData) |
| Parses the given command line. More... | |
| void | dr_parse_key_value_pairs (dr_key_value_read_proc onRead, dr_key_value_pair_proc onPair, dr_key_value_error_proc onError, void *pUserData) |
| dr_bool32 | dr_parse_key_value_pairs_from_file (const char *filePath, dr_key_value_pair_proc onPair, dr_key_value_error_proc onError, void *pUserData) |
| double | dr_randd () |
| float | dr_randf () |
| dr_bool32 | dr_release_semaphore (dr_semaphore semaphore) |
| Releases the given semaphore and increments it's counter by one upon returning. More... | |
| static const char * | dr_rtrim (const char *str) |
| dr_bool32 | dr_set_current_directory (const char *path) |
| Sets the current directory. More... | |
| void | dr_sleep (unsigned int milliseconds) |
| int | dr_strcat_s (char *dst, size_t dstSizeInBytes, const char *src) |
| int | dr_strcpy_s (char *dst, size_t dstSizeInBytes, const char *src) |
| char * | dr_string_replace (const char *src, const char *query, const char *replacement) |
| void | dr_string_replace_ascii (char *src, char c, char replacement) |
| int | dr_strncat_s (char *dst, size_t dstSizeInBytes, const char *src, size_t count) |
| int | dr_strncpy_s (char *dst, size_t dstSizeInBytes, const char *src, size_t count) |
| void | dr_strrmchar (char *str, char c) |
| Removes every occurance of the given character from the given string. More... | |
| void | dr_timer_init (dr_timer *pTimer) |
| double | dr_timer_tick (dr_timer *pTimer) |
| void | dr_trim (char *str) |
| Trims both the leading and trailing whitespace from the given string. More... | |
| void | dr_unlock_mutex (dr_mutex mutex) |
| Unlocks the given mutex. More... | |
| DR_INLINE unsigned int | dr_utf16_to_utf32_ch (unsigned short utf16[2]) |
| Converts a UTF-16 character to UTF-32. More... | |
| DR_INLINE unsigned int | dr_utf16pair_to_utf32_ch (unsigned short utf160, unsigned short utf161) |
| Converts a UTF-16 surrogate pair to UTF-32. More... | |
| DR_INLINE int | dr_utf32_to_utf16_ch (unsigned int utf32, unsigned short utf16[2]) |
| void | dr_wait_and_delete_thread (dr_thread thread) |
| Helper function for waiting for a thread and then deleting the handle after it has terminated. More... | |
| dr_bool32 | dr_wait_semaphore (dr_semaphore semaphore) |
| Waits on the given semaphore object and decrements it's counter by one upon returning. More... | |
| void | dr_wait_thread (dr_thread thread) |
| Waits for the given thread to terminate. More... | |
| int | dr_winmain_to_argv (const char *cmdlineWinMain, char ***argvOut) |
| void | dr_yield () |
| dr_bool32 | drpath_append (char *base, size_t baseBufferSizeInBytes, const char *other) |
| size_t | drpath_append_and_clean (char *dst, size_t dstSizeInBytes, const char *base, const char *other) |
| Appends one path to the other and then cleans it. More... | |
| dr_bool32 | drpath_append_extension (char *base, size_t baseBufferSizeInBytes, const char *extension) |
| Appends an extension to the given path. More... | |
| dr_bool32 | drpath_append_iterator (char *base, size_t baseBufferSizeInBytes, drpath_iterator i) |
| Appends an iterator object to the given base path. More... | |
| dr_bool32 | drpath_at_end (drpath_iterator i) |
| dr_bool32 | drpath_at_start (drpath_iterator i) |
| char * | drpath_base_path (char *path) |
| size_t | drpath_clean (const char *path, char *pathOut, size_t pathOutSizeInBytes) |
| dr_bool32 | drpath_copy_and_append (char *dst, size_t dstSizeInBytes, const char *base, const char *other) |
| dr_bool32 | drpath_copy_and_append_extension (char *dst, size_t dstSizeInBytes, const char *base, const char *extension) |
| dr_bool32 | drpath_copy_and_append_iterator (char *dst, size_t dstSizeInBytes, const char *base, drpath_iterator i) |
| dr_bool32 | drpath_copy_and_remove_extension (char *dst, size_t dstSizeInBytes, const char *path) |
| Creates a copy of the given string and removes the extension. More... | |
| dr_bool32 | drpath_copy_and_remove_file_name (char *dst, size_t dstSizeInBytes, const char *path) |
| Creates a copy of the given string and removes the extension. More... | |
| void | drpath_copy_base_path (const char *path, char *baseOut, size_t baseSizeInBytes) |
| const char * | drpath_copy_file_name (const char *path, char *fileNameOut, size_t fileNameSizeInBytes) |
| Copies the file name into the given buffer. More... | |
| dr_bool32 | drpath_equal (const char *path1, const char *path2) |
| const char * | drpath_extension (const char *path) |
| dr_bool32 | drpath_extension_equal (const char *path, const char *extension) |
| const char * | drpath_file_name (const char *path) |
| dr_bool32 | drpath_first (const char *path, drpath_iterator *i) |
| dr_bool32 | drpath_is_absolute (const char *path) |
| dr_bool32 | drpath_is_child (const char *childAbsolutePath, const char *parentAbsolutePath) |
| dr_bool32 | drpath_is_descendant (const char *descendantAbsolutePath, const char *parentAbsolutePath) |
| dr_bool32 | drpath_is_linux_style_root_segment (const drpath_iterator i) |
| Determines whether or not the given iterator refers to a Linux style root directory ("/") More... | |
| dr_bool32 | drpath_is_relative (const char *path) |
| dr_bool32 | drpath_is_root_segment (const drpath_iterator i) |
| Determines whether or not the given iterator refers to the root segment of a path. More... | |
| dr_bool32 | drpath_is_win32_style_root_segment (const drpath_iterator i) |
| Determines whether or not the given iterator refers to a Windows style root directory. More... | |
| dr_bool32 | drpath_iterators_equal (const drpath_iterator i0, const drpath_iterator i1) |
| dr_bool32 | drpath_last (const char *path, drpath_iterator *i) |
| Creates an iterator beginning at the last segment. More... | |
| dr_bool32 | drpath_next (drpath_iterator *i) |
| dr_bool32 | drpath_prev (drpath_iterator *i) |
| dr_bool32 | drpath_remove_extension (char *path) |
| dr_bool32 | drpath_remove_file_name (char *path) |
| Removes the last segment from the given path. More... | |
| dr_bool32 | drpath_segments_equal (const char *s0Path, const drpath_segment s0, const char *s1Path, const drpath_segment s1) |
| dr_bool32 | drpath_to_absolute (const char *relativePathToMakeAbsolute, const char *basePath, char *absolutePathOut, size_t absolutePathOutSizeInBytes) |
| void | drpath_to_backslashes (char *path) |
| void | drpath_to_forward_slashes (char *path) |
| dr_bool32 | drpath_to_relative (const char *absolutePathToMakeRelative, const char *absolutePathToMakeRelativeTo, char *relativePathOut, size_t relativePathOutSizeInBytes) |
| DR_INLINE int | strcat_s (char *dst, size_t dstSizeInBytes, const char *src) |
| DR_INLINE int | strcpy_s (char *dst, size_t dstSizeInBytes, const char *src) |
| DR_INLINE int | strncat_s (char *dst, size_t dstSizeInBytes, const char *src, size_t count) |
| DR_INLINE int | strncpy_s (char *dst, size_t dstSizeInBytes, const char *src, size_t count) |
| #define _TRUNCATE ((size_t)-1) |
Definition at line 154 of file porcupine/demo/c/dr_libs/old/dr.h.
| #define dr_abs | ( | x | ) | (((x) < 0) ? (-(x)) : (x)) |
Definition at line 131 of file porcupine/demo/c/dr_libs/old/dr.h.
Definition at line 108 of file porcupine/demo/c/dr_libs/old/dr.h.
| #define DR_FALSE 0 |
Definition at line 72 of file porcupine/demo/c/dr_libs/old/dr.h.
| #define DR_INLINE static inline |
Definition at line 34 of file porcupine/demo/c/dr_libs/old/dr.h.
| #define dr_max | ( | x, | |
| y | |||
| ) | (((x) > (y)) ? (x) : (y)) |
Definition at line 104 of file porcupine/demo/c/dr_libs/old/dr.h.
| #define dr_min | ( | x, | |
| y | |||
| ) | (((x) < (y)) ? (x) : (y)) |
Definition at line 100 of file porcupine/demo/c/dr_libs/old/dr.h.
| #define dr_path_h |
Definition at line 3412 of file porcupine/demo/c/dr_libs/old/dr.h.
| #define dr_round_up | ( | x, | |
| multiple | |||
| ) | ((((x) + ((multiple) - 1)) / (multiple)) * (multiple)) |
Definition at line 112 of file porcupine/demo/c/dr_libs/old/dr.h.
| #define dr_round_up_signed | ( | x, | |
| multiple | |||
| ) | ((((x) + (((x) >= 0)*((multiple) - 1))) / (multiple)) * (multiple)) |
Definition at line 116 of file porcupine/demo/c/dr_libs/old/dr.h.
| #define DR_SIZED_TYPES_DEFINED |
Definition at line 48 of file porcupine/demo/c/dr_libs/old/dr.h.
| #define DR_TRUE 1 |
Definition at line 71 of file porcupine/demo/c/dr_libs/old/dr.h.
| #define dr_zero_object | ( | pObject | ) | memset(pObject, 0, sizeof(*pObject)); |
Definition at line 750 of file porcupine/demo/c/dr_libs/old/dr.h.
| #define IN |
Definition at line 84 of file porcupine/demo/c/dr_libs/old/dr.h.
| #define OUT |
Definition at line 88 of file porcupine/demo/c/dr_libs/old/dr.h.
| #define STRINGIFY | ( | x | ) | #x |
Definition at line 76 of file porcupine/demo/c/dr_libs/old/dr.h.
| #define TOSTRING | ( | x | ) | STRINGIFY(x) |
Definition at line 77 of file porcupine/demo/c/dr_libs/old/dr.h.
| #define UNUSED | ( | x | ) | ((void)(x)) |
Definition at line 92 of file porcupine/demo/c/dr_libs/old/dr.h.
Definition at line 70 of file porcupine/demo/c/dr_libs/old/dr.h.
Definition at line 69 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef struct dr_cmdline dr_cmdline |
Definition at line 574 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef dr_bool32 dr_cmdline_parse_proc(const char *key, const char *value, void *pUserData) |
Definition at line 585 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef int16_t dr_int16 |
Definition at line 62 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef int32_t dr_int32 |
Definition at line 64 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef int64_t dr_int64 |
Definition at line 66 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef int8_t dr_int8 |
Definition at line 60 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef dr_bool32(* dr_iterate_files_proc) (const char *filePath, void *pUserData) |
Definition at line 422 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef void(* dr_key_value_error_proc) (void *pUserData, const char *message, unsigned int line) |
Definition at line 337 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef void(* dr_key_value_pair_proc) (void *pUserData, const char *key, const char *value) |
Definition at line 336 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef size_t(* dr_key_value_read_proc) (void *pUserData, void *pDataOut, size_t bytesToRead) |
Definition at line 335 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef void* dr_mutex |
Mutex.
Definition at line 665 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef void* dr_semaphore |
Semaphore.
Definition at line 685 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef void* dr_thread |
Thread.
Definition at line 631 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef int(* dr_thread_entry_proc) (void *pData) |
Definition at line 632 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef uint16_t dr_uint16 |
Definition at line 63 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef uint32_t dr_uint32 |
Definition at line 65 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef uint64_t dr_uint64 |
Definition at line 67 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef uint8_t dr_uint8 |
Definition at line 61 of file porcupine/demo/c/dr_libs/old/dr.h.
| typedef struct drpath_iterator drpath_iterator |
| DR_INLINE int _itoa_s | ( | int | value, |
| char * | dst, | ||
| size_t | dstSizeInBytes, | ||
| int | radix | ||
| ) |
Definition at line 184 of file porcupine/demo/c/dr_libs/old/dr.h.
| DR_INLINE int _stricmp | ( | const char * | string1, |
| const char * | string2 | ||
| ) |
Definition at line 178 of file porcupine/demo/c/dr_libs/old/dr.h.
| DR_INLINE void dr_aligned_free | ( | void * | ptr | ) |
Definition at line 320 of file porcupine/demo/c/dr_libs/old/dr.h.
| DR_INLINE void* dr_aligned_malloc | ( | size_t | alignment, |
| size_t | size | ||
| ) |
Definition at line 306 of file porcupine/demo/c/dr_libs/old/dr.h.
| dr_bool32 dr_cmdline_key_exists | ( | dr_cmdline * | pCmdLine, |
| const char * | key | ||
| ) |
Helper for determining whether or not the given key exists.
| int dr_cmdline_to_argv | ( | dr_cmdline * | pCmdLine, |
| char *** | argvOut | ||
| ) |
| size_t dr_copy_line | ( | const char * | str, |
| char * | lineOut, | ||
| size_t | lineOutSize | ||
| ) |
Makes a copy of the first line of the given string.
| dr_mutex dr_create_mutex | ( | ) |
Creates a mutex object.
| dr_semaphore dr_create_semaphore | ( | int | initialValue | ) |
Creates a semaphore object.
| dr_thread dr_create_thread | ( | dr_thread_entry_proc | entryProc, |
| void * | pData | ||
| ) |
Creates and begins executing a new thread.
| void dr_date_YYYYMMDD | ( | time_t | t, |
| char * | strOut, | ||
| unsigned int | strOutSize | ||
| ) |
| void dr_datetime_short | ( | time_t | t, |
| char * | strOut, | ||
| unsigned int | strOutSize | ||
| ) |
Formats a data/time string.
| dr_bool32 dr_delete_file | ( | const char * | filePath | ) |
| void dr_delete_mutex | ( | dr_mutex | mutex | ) |
Deletes a mutex object.
| void dr_delete_semaphore | ( | dr_semaphore | semaphore | ) |
Deletes the given semaphore.
| void dr_delete_thread | ( | dr_thread | thread | ) |
Deletes the given thread.
| dr_bool32 dr_directory_exists | ( | const char * | directoryPath | ) |
| dr_bool32 dr_file_exists | ( | const char * | filePath | ) |
| const char* dr_first_non_whitespace | ( | const char * | str | ) |
Finds the first non-whitespace character in the given string.
| const char* dr_first_whitespace | ( | const char * | str | ) |
Finds the first occurance of a whitespace character in the given string.
| FILE* dr_fopen | ( | const char * | fileName, |
| const char * | openMode | ||
| ) |
| void dr_free_argv | ( | char ** | argv | ) |
| void dr_free_file_data | ( | void * | valueReturnedByOpenAndReadFile | ) |
| dr_bool32 dr_get_config_folder_path | ( | char * | pathOut, |
| size_t | pathOutSize | ||
| ) |
Retrieves the path of the user's config directory.
| const char* dr_get_current_directory | ( | char * | pathOut, |
| size_t | pathOutSize | ||
| ) |
Retrieves the current directory.
| dr_bool32 dr_get_executable_directory_path | ( | char * | pathOut, |
| size_t | pathOutSize | ||
| ) |
Retrieves the path of the directory containing the executable.
| dr_bool32 dr_get_executable_path | ( | char * | pathOut, |
| size_t | pathOutSize | ||
| ) |
Retrieves the path of the executable.
| dr_uint64 dr_get_file_modified_time | ( | const char * | filePath | ) |
| dr_bool32 dr_get_log_folder_path | ( | char * | pathOut, |
| size_t | pathOutSize | ||
| ) |
Retrieves the path of the user's log directory.
| unsigned int dr_get_logical_processor_count | ( | ) |
Retrieves the number of logical cores on system.
| unsigned int dr_get_process_id | ( | ) |
| size_t dr_get_username | ( | char * | usernameOut, |
| size_t | usernameOutSize | ||
| ) |
| dr_bool32 dr_hex_char_to_uint | ( | char | ascii, |
| unsigned int * | out | ||
| ) |
| dr_bool32 dr_init_cmdline | ( | dr_cmdline * | pCmdLine, |
| int | argc, | ||
| char ** | argv | ||
| ) |
Initializes a command line object.
| dr_bool32 dr_init_cmdline_win32 | ( | dr_cmdline * | pCmdLine, |
| const char * | args | ||
| ) |
Initializes a command line object using a Win32 style command line.
|
inlinestatic |
Definition at line 456 of file porcupine/demo/c/dr_libs/old/dr.h.
| dr_bool32 dr_is_file_read_only | ( | const char * | filePath | ) |
| dr_bool32 dr_iterate_files | ( | const char * | directory, |
| dr_bool32 | recursive, | ||
| dr_iterate_files_proc | proc, | ||
| void * | pUserData | ||
| ) |
| int dr_itoa_s | ( | int | value, |
| char * | dst, | ||
| size_t | dstSizeInBytes, | ||
| int | radix | ||
| ) |
| void dr_lock_mutex | ( | dr_mutex | mutex | ) |
Locks the given mutex.
|
inlinestatic |
Definition at line 203 of file porcupine/demo/c/dr_libs/old/dr.h.
| dr_bool32 dr_mkdir | ( | const char * | directoryPath | ) |
| dr_bool32 dr_mkdir_recursive | ( | const char * | directoryPath | ) |
| dr_bool32 dr_move_file | ( | const char * | oldPath, |
| const char * | newPath | ||
| ) |
| const char* dr_next_line | ( | const char * | str | ) |
Finds the beginning of the next line.
Definition at line 119 of file porcupine/demo/c/dr_libs/old/dr.h.
| const char* dr_next_token | ( | const char * | tokens, |
| char * | tokenOut, | ||
| size_t | tokenOutSize | ||
| ) |
Retrieves the first token in the given string.
| time_t dr_now | ( | ) |
Retrieves a time_t as of the time the function was called.
| void* dr_open_and_read_file | ( | const char * | filePath, |
| size_t * | pFileSizeOut | ||
| ) |
Definition at line 675 of file porcupine/demo/c/dr_libs/tests/common/dr_common.c.
| char* dr_open_and_read_text_file | ( | const char * | filePath, |
| size_t * | pFileSizeOut | ||
| ) |
| dr_bool32 dr_open_and_write_file | ( | const char * | filePath, |
| const void * | pData, | ||
| size_t | dataSize | ||
| ) |
| dr_bool32 dr_open_and_write_text_file | ( | const char * | filePath, |
| const char * | text | ||
| ) |
| void dr_parse_cmdline | ( | dr_cmdline * | pCmdLine, |
| dr_cmdline_parse_proc | callback, | ||
| void * | pUserData | ||
| ) |
Parses the given command line.
| void dr_parse_key_value_pairs | ( | dr_key_value_read_proc | onRead, |
| dr_key_value_pair_proc | onPair, | ||
| dr_key_value_error_proc | onError, | ||
| void * | pUserData | ||
| ) |
Parses a series of simple Key/Value pairs.
| dr_bool32 dr_parse_key_value_pairs_from_file | ( | const char * | filePath, |
| dr_key_value_pair_proc | onPair, | ||
| dr_key_value_error_proc | onError, | ||
| void * | pUserData | ||
| ) |
| double dr_randd | ( | ) |
| float dr_randf | ( | ) |
| dr_bool32 dr_release_semaphore | ( | dr_semaphore | semaphore | ) |
Releases the given semaphore and increments it's counter by one upon returning.
|
static |
| dr_bool32 dr_set_current_directory | ( | const char * | path | ) |
Sets the current directory.
| void dr_sleep | ( | unsigned int | milliseconds | ) |
Puts the calling thread to sleep for approximately the given number of milliseconds.
| int dr_strcat_s | ( | char * | dst, |
| size_t | dstSizeInBytes, | ||
| const char * | src | ||
| ) |
Definition at line 163 of file porcupine/demo/c/dr_libs/tests/common/dr_common.c.
| int dr_strcpy_s | ( | char * | dst, |
| size_t | dstSizeInBytes, | ||
| const char * | src | ||
| ) |
Definition at line 101 of file porcupine/demo/c/dr_libs/tests/common/dr_common.c.
| char* dr_string_replace | ( | const char * | src, |
| const char * | query, | ||
| const char * | replacement | ||
| ) |
| void dr_string_replace_ascii | ( | char * | src, |
| char | c, | ||
| char | replacement | ||
| ) |
| int dr_strncat_s | ( | char * | dst, |
| size_t | dstSizeInBytes, | ||
| const char * | src, | ||
| size_t | count | ||
| ) |
Definition at line 205 of file porcupine/demo/c/dr_libs/tests/common/dr_common.c.
| int dr_strncpy_s | ( | char * | dst, |
| size_t | dstSizeInBytes, | ||
| const char * | src, | ||
| size_t | count | ||
| ) |
Definition at line 129 of file porcupine/demo/c/dr_libs/tests/common/dr_common.c.
| void dr_strrmchar | ( | char * | str, |
| char | c | ||
| ) |
Removes every occurance of the given character from the given string.
| void dr_timer_init | ( | dr_timer * | pTimer | ) |
| double dr_timer_tick | ( | dr_timer * | pTimer | ) |
| void dr_trim | ( | char * | str | ) |
Trims both the leading and trailing whitespace from the given string.
| void dr_unlock_mutex | ( | dr_mutex | mutex | ) |
Unlocks the given mutex.
| DR_INLINE unsigned int dr_utf16_to_utf32_ch | ( | unsigned short | utf16[2] | ) |
Converts a UTF-16 character to UTF-32.
Definition at line 268 of file porcupine/demo/c/dr_libs/old/dr.h.
| DR_INLINE unsigned int dr_utf16pair_to_utf32_ch | ( | unsigned short | utf160, |
| unsigned short | utf161 | ||
| ) |
Converts a UTF-16 surrogate pair to UTF-32.
Definition at line 293 of file porcupine/demo/c/dr_libs/old/dr.h.
| DR_INLINE int dr_utf32_to_utf16_ch | ( | unsigned int | utf32, |
| unsigned short | utf16[2] | ||
| ) |
Converts a UTF-32 character to UTF-16.
| utf16 | [in] A pointer to an array of at least two 16-bit values that will receive the UTF-16 character. |
Definition at line 237 of file porcupine/demo/c/dr_libs/old/dr.h.
| void dr_wait_and_delete_thread | ( | dr_thread | thread | ) |
Helper function for waiting for a thread and then deleting the handle after it has terminated.
| dr_bool32 dr_wait_semaphore | ( | dr_semaphore | semaphore | ) |
Waits on the given semaphore object and decrements it's counter by one upon returning.
| void dr_wait_thread | ( | dr_thread | thread | ) |
Waits for the given thread to terminate.
| int dr_winmain_to_argv | ( | const char * | cmdlineWinMain, |
| char *** | argvOut | ||
| ) |
| void dr_yield | ( | ) |
| dr_bool32 drpath_append | ( | char * | base, |
| size_t | baseBufferSizeInBytes, | ||
| const char * | other | ||
| ) |
Appends two paths together, ensuring there is not double up on the last slash.
| base | [in, out] The base path that is being appended to. |
| baseBufferSizeInBytes | [in] The size of the buffer pointed to by "base", in bytes. |
| other | [in] The other path segment. |
| size_t drpath_append_and_clean | ( | char * | dst, |
| size_t | dstSizeInBytes, | ||
| const char * | base, | ||
| const char * | other | ||
| ) |
Appends one path to the other and then cleans it.
| dr_bool32 drpath_append_extension | ( | char * | base, |
| size_t | baseBufferSizeInBytes, | ||
| const char * | extension | ||
| ) |
Appends an extension to the given path.
| dr_bool32 drpath_append_iterator | ( | char * | base, |
| size_t | baseBufferSizeInBytes, | ||
| drpath_iterator | i | ||
| ) |
Appends an iterator object to the given base path.
| dr_bool32 drpath_at_end | ( | drpath_iterator | i | ) |
Determines if the given iterator is at the end.
| i | [in] The iterator to check. |
| dr_bool32 drpath_at_start | ( | drpath_iterator | i | ) |
Determines if the given iterator is at the start.
| i | [in] The iterator to check. |
| char* drpath_base_path | ( | char * | path | ) |
Modifies the given path by transforming it into it's base path.
Returns <path>, for convenience.
| size_t drpath_clean | ( | const char * | path, |
| char * | pathOut, | ||
| size_t | pathOutSizeInBytes | ||
| ) |
Cleans the path and resolves the ".." and "." segments.
| path | [in] The path to clean. |
| pathOut | [out] A pointer to the buffer that will receive the path. |
| pathOutSizeInBytes | [in] The size of the buffer pointed to by pathOut, in bytes. |
| dr_bool32 drpath_copy_and_append | ( | char * | dst, |
| size_t | dstSizeInBytes, | ||
| const char * | base, | ||
| const char * | other | ||
| ) |
Appends two paths together, and copyies them to a separate buffer.
| dst | [out] The destination buffer. |
| dstSizeInBytes | [in] The size of the buffer pointed to by "dst", in bytes. |
| base | [in] The base directory. |
| other | [in] The relative path to append to "base". |
| dr_bool32 drpath_copy_and_append_extension | ( | char * | dst, |
| size_t | dstSizeInBytes, | ||
| const char * | base, | ||
| const char * | extension | ||
| ) |
Appends an extension to the given base path and copies them to a separate buffer.
| dst | [out] The destination buffer. |
| dstSizeInBytes | [in] The size of the buffer pointed to by "dst", in bytes. |
| base | [in] The base directory. |
| extension | [in] The relative path to append to "base". |
| dr_bool32 drpath_copy_and_append_iterator | ( | char * | dst, |
| size_t | dstSizeInBytes, | ||
| const char * | base, | ||
| drpath_iterator | i | ||
| ) |
Appends a base path and an iterator together, and copyies them to a separate buffer.
| dst | [out] The destination buffer. |
| dstSizeInBytes | [in] The size of the buffer pointed to by "dst", in bytes. |
| base | [in] The base directory. |
| i | [in] The iterator to append. |
| dr_bool32 drpath_copy_and_remove_extension | ( | char * | dst, |
| size_t | dstSizeInBytes, | ||
| const char * | path | ||
| ) |
Creates a copy of the given string and removes the extension.
| dr_bool32 drpath_copy_and_remove_file_name | ( | char * | dst, |
| size_t | dstSizeInBytes, | ||
| const char * | path | ||
| ) |
Creates a copy of the given string and removes the extension.
| void drpath_copy_base_path | ( | const char * | path, |
| char * | baseOut, | ||
| size_t | baseSizeInBytes | ||
| ) |
Retrieves the base path from the given path, not including the trailing slash.
| path | [in] The full path. |
| baseOut | [out] A pointer to the buffer that will receive the base path. |
| baseSizeInBytes | [in] The size in bytes of the buffer that will receive the base directory. |
| const char* drpath_copy_file_name | ( | const char * | path, |
| char * | fileNameOut, | ||
| size_t | fileNameSizeInBytes | ||
| ) |
Copies the file name into the given buffer.
| dr_bool32 drpath_equal | ( | const char * | path1, |
| const char * | path2 | ||
| ) |
Checks whether or not the two paths are equal.
| path1 | [in] The first path. |
| path2 | [in] The second path. |
| const char* drpath_extension | ( | const char * | path | ) |
Finds the file extension of the given file path.
| path | [in] The path to search. |
| dr_bool32 drpath_extension_equal | ( | const char * | path, |
| const char * | extension | ||
| ) |
Checks if the extension of the given path is equal to the given extension.
| const char* drpath_file_name | ( | const char * | path | ) |
Finds the file name portion of the path.
| path | [in] The path to search. |
| dr_bool32 drpath_first | ( | const char * | path, |
| drpath_iterator * | i | ||
| ) |
Creates an iterator for iterating over each segment in a path.
| path | [in] The path whose segments are being iterated. |
| dr_bool32 drpath_is_absolute | ( | const char * | path | ) |
Determines whether or not the given path is absolute.
| path | [in] The path to check. |
| dr_bool32 drpath_is_child | ( | const char * | childAbsolutePath, |
| const char * | parentAbsolutePath | ||
| ) |
Determines whether or not the given path is a direct child of another.
| childAbsolutePath | [in] The absolute of the child. |
| parentAbsolutePath | [in] The absolute path of the parent. |
| dr_bool32 drpath_is_descendant | ( | const char * | descendantAbsolutePath, |
| const char * | parentAbsolutePath | ||
| ) |
Determines whether or not the given path is a decendant of another.
| descendantAbsolutePath | [in] The absolute path of the descendant. |
| parentAbsolutePath | [in] The absolute path of the parent. |
| dr_bool32 drpath_is_linux_style_root_segment | ( | const drpath_iterator | i | ) |
Determines whether or not the given iterator refers to a Linux style root directory ("/")
| dr_bool32 drpath_is_relative | ( | const char * | path | ) |
Determines whether or not the given path is relative.
| path | [in] The path to check. |
| dr_bool32 drpath_is_root_segment | ( | const drpath_iterator | i | ) |
Determines whether or not the given iterator refers to the root segment of a path.
| dr_bool32 drpath_is_win32_style_root_segment | ( | const drpath_iterator | i | ) |
Determines whether or not the given iterator refers to a Windows style root directory.
| dr_bool32 drpath_iterators_equal | ( | const drpath_iterator | i0, |
| const drpath_iterator | i1 | ||
| ) |
Compares the string values of two iterators for equality.
| i0 | [in] The first iterator to compare. |
| i1 | [in] The second iterator to compare. |
| dr_bool32 drpath_last | ( | const char * | path, |
| drpath_iterator * | i | ||
| ) |
Creates an iterator beginning at the last segment.
| dr_bool32 drpath_next | ( | drpath_iterator * | i | ) |
Goes to the next segment in the path as per the given iterator.
| i | [in] A pointer to the iterator to increment. |
| dr_bool32 drpath_prev | ( | drpath_iterator * | i | ) |
Goes to the previous segment in the path.
| i | [in] A pointer to the iterator to decrement. |
| dr_bool32 drpath_remove_extension | ( | char * | path | ) |
Removes the extension from the given path.
| dr_bool32 drpath_remove_file_name | ( | char * | path | ) |
Removes the last segment from the given path.
| dr_bool32 drpath_segments_equal | ( | const char * | s0Path, |
| const drpath_segment | s0, | ||
| const char * | s1Path, | ||
| const drpath_segment | s1 | ||
| ) |
Compares a section of two strings for equality.
| s0Path | [in] The first path. |
| s0 | [in] The segment of the first path to compare. |
| s1Path | [in] The second path. |
| s1 | [in] The segment of the second path to compare. |
| dr_bool32 drpath_to_absolute | ( | const char * | relativePathToMakeAbsolute, |
| const char * | basePath, | ||
| char * | absolutePathOut, | ||
| size_t | absolutePathOutSizeInBytes | ||
| ) |
Converts a relative path to an absolute path based on a base path.
| void drpath_to_backslashes | ( | char * | path | ) |
Converts the slashes in the given path to back slashes.
| path | [in] The path whose slashes are being converted. |
| void drpath_to_forward_slashes | ( | char * | path | ) |
Converts the slashes in the given path to forward slashes.
| path | [in] The path whose slashes are being converted. |
| dr_bool32 drpath_to_relative | ( | const char * | absolutePathToMakeRelative, |
| const char * | absolutePathToMakeRelativeTo, | ||
| char * | relativePathOut, | ||
| size_t | relativePathOutSizeInBytes | ||
| ) |
Converts an absolute path to a relative path.
| DR_INLINE int strcat_s | ( | char * | dst, |
| size_t | dstSizeInBytes, | ||
| const char * | src | ||
| ) |
Definition at line 167 of file porcupine/demo/c/dr_libs/old/dr.h.
| DR_INLINE int strcpy_s | ( | char * | dst, |
| size_t | dstSizeInBytes, | ||
| const char * | src | ||
| ) |
Definition at line 157 of file porcupine/demo/c/dr_libs/old/dr.h.
| DR_INLINE int strncat_s | ( | char * | dst, |
| size_t | dstSizeInBytes, | ||
| const char * | src, | ||
| size_t | count | ||
| ) |
Definition at line 172 of file porcupine/demo/c/dr_libs/old/dr.h.
| DR_INLINE int strncpy_s | ( | char * | dst, |
| size_t | dstSizeInBytes, | ||
| const char * | src, | ||
| size_t | count | ||
| ) |
Definition at line 162 of file porcupine/demo/c/dr_libs/old/dr.h.