#include "kmp_str.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "kmp.h"
#include "kmp_i18n.h"
Go to the source code of this file.
Defines | |
#define | _case(ch, exp) |
#define | args _args |
#define | KMP_STR_BUF_INVARIANT(b) |
Functions | |
void | __kmp_str_buf_cat (kmp_str_buf_t *buffer, char const *str, int len) |
void | __kmp_str_buf_clear (kmp_str_buf_t *buffer) |
void | __kmp_str_buf_detach (kmp_str_buf_t *buffer) |
void | __kmp_str_buf_free (kmp_str_buf_t *buffer) |
void | __kmp_str_buf_print (kmp_str_buf_t *buffer, char const *format,...) |
void | __kmp_str_buf_print_size (kmp_str_buf_t *buf, size_t size) |
void | __kmp_str_buf_reserve (kmp_str_buf_t *buffer, int size) |
void | __kmp_str_buf_vprint (kmp_str_buf_t *buffer, char const *format, va_list args) |
int | __kmp_str_eqf (char const *lhs, char const *rhs) |
void | __kmp_str_fname_free (kmp_str_fname_t *fname) |
void | __kmp_str_fname_init (kmp_str_fname_t *fname, char const *path) |
int | __kmp_str_fname_match (kmp_str_fname_t const *fname, char const *pattern) |
char * | __kmp_str_format (char const *format,...) |
void | __kmp_str_free (char const **str) |
void | __kmp_str_loc_free (kmp_str_loc_t *loc) |
kmp_str_loc_t | __kmp_str_loc_init (char const *psource, int init_fname) |
int | __kmp_str_match (char const *target, int len, char const *data) |
int | __kmp_str_match_false (char const *data) |
int | __kmp_str_match_true (char const *data) |
void | __kmp_str_replace (char *str, char search_for, char replace_with) |
void | __kmp_str_split (char *str, char delim, char **head, char **tail) |
int | __kmp_str_to_int (char const *str, char sentinel) |
void | __kmp_str_to_size (char const *str, size_t *out, size_t dfactor, char const **error) |
void | __kmp_str_to_uint (char const *str, kmp_uint64 *out, char const **error) |
char * | __kmp_str_token (char *str, char const *delim, char **buf) |
#define _case | ( | ch, | |||
exp | ) |
case ch : \ case ch - ( 'a' - 'A' ) : { \ size_t shift = (exp) * 10; \ ++ i; \ if ( shift < sizeof( size_t ) * 8 ) { \ factor = (size_t)( 1 ) << shift; \ } else { \ overflow = 1; \ }; \ } break;
Referenced by __kmp_str_to_size().
#define args _args |
Referenced by __kmp_fork_call(), __kmp_msg(), __kmp_msg_format(), __kmp_str_buf_print(), __kmp_str_format(), and main().
#define KMP_STR_BUF_INVARIANT | ( | b | ) |
{ \ KMP_DEBUG_ASSERT( (b)->str != NULL ); \ KMP_DEBUG_ASSERT( (b)->size >= sizeof( (b)->bulk ) ); \ KMP_DEBUG_ASSERT( (b)->size % sizeof( (b)->bulk ) == 0 ); \ KMP_DEBUG_ASSERT( (b)->used < (b)->size ); \ KMP_DEBUG_ASSERT( (b)->size == sizeof( (b)->bulk ) ? (b)->str == & (b)->bulk[ 0 ] : 1 ); \ KMP_DEBUG_ASSERT( (b)->size > sizeof( (b)->bulk ) ? (b)->str != & (b)->bulk[ 0 ] : 1 ); \ }
Definition at line 101 of file kmp_str.c.
Referenced by __kmp_str_buf_cat(), __kmp_str_buf_clear(), __kmp_str_buf_detach(), __kmp_str_buf_free(), __kmp_str_buf_reserve(), and __kmp_str_buf_vprint().
void __kmp_str_buf_cat | ( | kmp_str_buf_t * | buffer, | |
char const * | str, | |||
int | len | |||
) |
Definition at line 198 of file kmp_str.c.
References __kmp_str_buf_reserve(), KMP_DEBUG_ASSERT, KMP_STR_BUF_INVARIANT, kmp_str_buf::str, and kmp_str_buf::used.
Referenced by __kmp_msg(), and __kmp_msg_format().
void __kmp_str_buf_clear | ( | kmp_str_buf_t * | buffer | ) |
Definition at line 112 of file kmp_str.c.
References KMP_STR_BUF_INVARIANT, kmp_str_buf::str, and kmp_str_buf::used.
Referenced by __kmp_vprintf().
void __kmp_str_buf_detach | ( | kmp_str_buf_t * | buffer | ) |
Definition at line 164 of file kmp_str.c.
References kmp_str_buf::bulk, KMP_FATAL, KMP_INTERNAL_MALLOC, KMP_STR_BUF_INVARIANT, kmp_str_buf::size, kmp_str_buf::str, and kmp_str_buf::used.
Referenced by __kmp_msg_format().
void __kmp_str_buf_free | ( | kmp_str_buf_t * | buffer | ) |
Definition at line 183 of file kmp_str.c.
References kmp_str_buf::bulk, KMP_INTERNAL_FREE, KMP_STR_BUF_INVARIANT, kmp_str_buf::size, kmp_str_buf::str, and kmp_str_buf::used.
Referenced by __kmp_do_serial_initialize(), __kmp_env_print(), __kmp_msg(), __kmp_pragma(), __kmp_print_version_1(), __kmp_runtime_initialize(), __kmp_stg_parse_int(), __kmp_stg_parse_size(), __kmp_stg_print_num_threads(), and dump_cons_stack().
void __kmp_str_buf_print | ( | kmp_str_buf_t * | buffer, | |
char const * | format, | |||
... | ||||
) |
Definition at line 281 of file kmp_str.c.
References __kmp_str_buf_vprint(), and args.
Referenced by __kmp_env_print(), __kmp_i18n_dump_catalog(), __kmp_pragma(), __kmp_print_version_1(), __kmp_runtime_initialize(), __kmp_stg_parse_int(), __kmp_stg_print_barrier_branch_bit(), __kmp_stg_print_barrier_pattern(), __kmp_stg_print_bool(), __kmp_stg_print_cpuinfo_file(), __kmp_stg_print_force_reduction(), __kmp_stg_print_int(), __kmp_stg_print_kmp_dynamic_mode(), __kmp_stg_print_monitor_stacksize(), __kmp_stg_print_num_threads(), __kmp_stg_print_omp_schedule(), __kmp_stg_print_schedule(), __kmp_stg_print_size(), __kmp_stg_print_stacksize(), __kmp_stg_print_str(), __kmp_stg_print_uint64(), __kmp_str_buf_print_size(), __kmp_vprintf(), and dump_cons_stack().
void __kmp_str_buf_print_size | ( | kmp_str_buf_t * | buf, | |
size_t | size | |||
) |
Definition at line 301 of file kmp_str.c.
References __kmp_str_buf_print().
Referenced by __kmp_stg_parse_size(), __kmp_stg_print_size(), and __kmp_stg_print_stacksize().
void __kmp_str_buf_reserve | ( | kmp_str_buf_t * | buffer, | |
int | size | |||
) |
Definition at line 125 of file kmp_str.c.
References kmp_str_buf::bulk, KMP_DEBUG_ASSERT, KMP_FATAL, KMP_INTERNAL_MALLOC, KMP_INTERNAL_REALLOC, KMP_STR_BUF_INVARIANT, kmp_str_buf::size, kmp_str_buf::str, and kmp_str_buf::used.
Referenced by __kmp_runtime_initialize(), __kmp_str_buf_cat(), and __kmp_str_buf_vprint().
void __kmp_str_buf_vprint | ( | kmp_str_buf_t * | buffer, | |
char const * | format, | |||
va_list | args | |||
) |
Definition at line 215 of file kmp_str.c.
References __kmp_str_buf_reserve(), KMP_DEBUG_ASSERT, KMP_STR_BUF_INVARIANT, kmp_str_buf::size, kmp_str_buf::str, and kmp_str_buf::used.
Referenced by __kmp_msg_format(), __kmp_str_buf_print(), and __kmp_vprintf().
int __kmp_str_eqf | ( | char const * | lhs, | |
char const * | rhs | |||
) |
Definition at line 471 of file kmp_str.c.
Referenced by __kmp_stg_parse_file(), and __kmp_str_fname_match().
void __kmp_str_fname_free | ( | kmp_str_fname_t * | fname | ) |
Definition at line 358 of file kmp_str.c.
References __kmp_str_free(), kmp_str_fname::base, kmp_str_fname::dir, and kmp_str_fname::path.
Referenced by __kmp_str_fname_match(), and __kmp_str_loc_free().
void __kmp_str_fname_init | ( | kmp_str_fname_t * | fname, | |
char const * | path | |||
) |
Definition at line 323 of file kmp_str.c.
References __kmp_str_format(), __kmp_str_replace(), kmp_str_fname::base, kmp_str_fname::dir, KMP_OS_WINDOWS, kmp_str_fname::path, and TOLOWER.
Referenced by __kmp_str_fname_match(), and __kmp_str_loc_init().
int __kmp_str_fname_match | ( | kmp_str_fname_t const * | fname, | |
char const * | pattern | |||
) |
Definition at line 368 of file kmp_str.c.
References __kmp_str_eqf(), __kmp_str_fname_free(), __kmp_str_fname_init(), kmp_str_fname::base, and kmp_str_fname::dir.
char* __kmp_str_format | ( | char const * | format, | |
... | ||||
) |
Definition at line 516 of file kmp_str.c.
References args, KMP_FATAL, KMP_INTERNAL_MALLOC, and KMP_INTERNAL_REALLOC.
Referenced by ___kmp_env_blk_parse_string(), __kmp_dispatch_deo(), __kmp_dispatch_finish(), __kmp_dispatch_init(), __kmp_dispatch_next(), __kmp_for_static_init(), __kmp_is_address_mapped(), __kmp_msg_error_mesg(), __kmp_reg_status_name(), __kmp_register_library_startup(), __kmp_stg_parse_file(), __kmp_stg_parse_str(), __kmp_str_fname_init(), __kmp_str_loc_init(), and sys_error().
void __kmp_str_free | ( | char const ** | str | ) |
Definition at line 567 of file kmp_str.c.
References KMP_DEBUG_ASSERT, and KMP_INTERNAL_FREE.
Referenced by __kmp_dispatch_deo(), __kmp_dispatch_finish(), __kmp_dispatch_init(), __kmp_dispatch_next(), __kmp_for_static_init(), and __kmp_str_fname_free().
void __kmp_str_loc_free | ( | kmp_str_loc_t * | loc | ) |
Definition at line 451 of file kmp_str.c.
References __kmp_str_fname_free(), kmp_str_loc::_bulk, kmp_str_loc::file, kmp_str_loc::fname, kmp_str_loc::func, and KMP_INTERNAL_FREE.
Referenced by __kmp_cleanup_user_locks().
kmp_str_loc_t __kmp_str_loc_init | ( | char const * | psource, | |
int | init_fname | |||
) |
Definition at line 396 of file kmp_str.c.
References __kmp_str_fname_init(), __kmp_str_format(), __kmp_str_split(), kmp_str_loc::_bulk, kmp_str_loc::col, kmp_str_loc::file, kmp_str_loc::fname, kmp_str_loc::func, and kmp_str_loc::line.
Referenced by __kmp_cleanup_user_locks().
int __kmp_str_match | ( | char const * | target, | |
int | len, | |||
char const * | data | |||
) |
Definition at line 582 of file kmp_str.c.
References FALSE, i, and TOLOWER.
Referenced by __kmp_convert_to_milliseconds(), __kmp_stg_parse_barrier_pattern(), __kmp_stg_parse_force_reduction(), __kmp_stg_parse_kmp_dynamic_mode(), __kmp_stg_parse_lock_kind(), __kmp_stg_parse_storage_map(), __kmp_stg_parse_wait_policy(), __kmp_str_match_false(), and __kmp_str_match_true().
int __kmp_str_match_false | ( | char const * | data | ) |
Definition at line 601 of file kmp_str.c.
References __kmp_str_match().
Referenced by __kmp_ignore_mppbeg(), __kmp_ignore_mppend(), and __kmp_stg_parse_bool().
int __kmp_str_match_true | ( | char const * | data | ) |
Definition at line 614 of file kmp_str.c.
References __kmp_str_match().
Referenced by __kmp_do_serial_initialize(), __kmp_register_library_startup(), and __kmp_stg_parse_bool().
void __kmp_str_replace | ( | char * | str, | |
char | search_for, | |||
char | replace_with | |||
) |
Definition at line 626 of file kmp_str.c.
Referenced by __kmp_str_fname_init().
void __kmp_str_split | ( | char * | str, | |
char | delim, | |||
char ** | head, | |||
char ** | tail | |||
) |
Definition at line 644 of file kmp_str.c.
Referenced by ___kmp_env_blk_parse_string(), ___kmp_env_blk_parse_unix(), ___kmp_env_blk_parse_windows(), __kmp_pragma(), __kmp_register_library_startup(), and __kmp_str_loc_init().
int __kmp_str_to_int | ( | char const * | str, | |
char | sentinel | |||
) |
Definition at line 700 of file kmp_str.c.
Referenced by __kmp_parse_nested_num_threads(), __kmp_stg_parse_barrier_branch_bit(), and __kmp_stg_parse_omp_schedule().
void __kmp_str_to_size | ( | char const * | str, | |
size_t * | out, | |||
size_t | dfactor, | |||
char const ** | error | |||
) |
Definition at line 757 of file kmp_str.c.
References _case, i, KMP_DEBUG_ASSERT, KMP_I18N_STR, and KMP_SIZE_T_MAX.
Referenced by __kmp_stg_parse_size().
void __kmp_str_to_uint | ( | char const * | str, | |
kmp_uint64 * | out, | |||
char const ** | error | |||
) |
Definition at line 862 of file kmp_str.c.
References i, KMP_DEBUG_ASSERT, KMP_I18N_STR, and KMP_SIZE_T_MAX.
Referenced by __kmp_stg_parse_int().
char* __kmp_str_token | ( | char * | str, | |
char const * | delim, | |||
char ** | buf | |||
) |
Definition at line 671 of file kmp_str.c.
Referenced by ___kmp_env_blk_parse_string().