#include "ncbi_ansi_ext.h"
#include "ncbi_priv.h"
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
Include dependency graph for ncbi_util.c:
Go to the source code of this file.
Classes | |
struct | SLogData |
Defines | |
#define | NCBI_USE_ERRCODE_X Connect_Util |
#define | NCBI_USE_PRECOMPILED_CRC32_TABLES 1 |
#define | CRC32_POLY 0x04C11DB7UL |
Functions | |
void | CORE_SetLOCK (MT_LOCK lk) |
Set the MT critical section lock/unlock handler -- to be used by the core internals for protection of internal static variables and other MT-sensitive code from being accessed/changed by several threads simultaneously. | |
MT_LOCK | CORE_GetLOCK (void) |
void | CORE_SetLOG (LOG lg) |
Set the log handle (no logging if "lg" is passed zero) -- to be used by the core internals. | |
LOG | CORE_GetLOG (void) |
Get the log handle which is be used by the core internals. | |
void | CORE_SetLOGFILE_Ex (FILE *fp, ELOG_Level cut_off, int auto_close) |
Standard logging to the specified file stream. | |
void | CORE_SetLOGFILE (FILE *fp, int auto_close) |
Same as CORE_SetLOGFILE_Ex() with last parameter passed as 0 (all messages pass). | |
int | CORE_SetLOGFILE_NAME_Ex (const char *filename, ELOG_Level cut_off) |
Same as CORE_SetLOGFILE_Ex(fopen(filename, "a"), cut_off, TRUE). | |
int | CORE_SetLOGFILE_NAME (const char *filename) |
Same as CORE_SetLOGFILE_NAME_Ex with last parameter passed as 0 (all messages pass). | |
TLOG_FormatFlags | CORE_SetLOGFormatFlags (TLOG_FormatFlags flags) |
static int | s_IsQuoted (unsigned char c) |
size_t | UTIL_PrintableStringSize (const char *data, size_t size) |
Calculate size of buffer needed to store printable representation of the block of data of the specified size (or, if size is 0, strlen(data)). | |
char * | UTIL_PrintableString (const char *data, size_t size, char *buf, int full_octal) |
Create printable representation of the block of data of the specified size (or, if size is 0, strlen(data), and return buffer pointer past the last stored character (non ''-terminated). | |
const char * | NcbiMessagePlusError (int *dynamic, const char *message, int error, const char *descr) |
Add current "error" (and maybe its description) to the message: <message>[ {error=[[<error>][,]][<descr>]}]. | |
char * | LOG_ComposeMessage (const SLOG_Handler *call_data, TLOG_FormatFlags format_flags) |
Compose message using the "call_data" info. | |
static void | s_LOG_FileHandler (void *user_data, SLOG_Handler *call_data) |
static void | s_LOG_FileCleanup (void *user_data) |
void | LOG_ToFILE_Ex (LOG lg, FILE *fp, ELOG_Level cut_off, int auto_close) |
LOG_Reset specialized to log to a "FILE*" stream using LOG_ComposeMessage. | |
void | LOG_ToFILE (LOG lg, FILE *fp, int auto_close) |
Same as LOG_ToFILEx with "cut_off" parameter passed as 0 (all messages pass). | |
void | CORE_SetREG (REG rg) |
Set the registry (no registry if "rg" is passed zero) -- to be used by the core internals. | |
REG | CORE_GetREG (void) |
Get the registry previously set by CORE_SetREG(). | |
const char * | CORE_GetPlatform (void) |
const char * | CORE_GetUsername (char *buf, size_t bufsize) |
Obtain and store current user's name in the buffer provided. | |
size_t | CORE_GetVMPageSize (void) |
Obtain virtual memory page size. | |
unsigned int | CRC32_Update (unsigned int checksum, const void *ptr, size_t count) |
Calculate/Update CRC32. | |
int | UTIL_MatchesMaskEx (const char *name, const char *mask, int ignore_case) |
int | UTIL_MatchesMask (const char *name, const char *mask) |
Same as UTIL_MatchesMaskEx(name, mask, 1). | |
char * | UTIL_NcbiLocalHostName (char *hostname) |
Cut off well-known NCBI domain suffix out of the passed "hostname". | |
Variables | |
static TLOG_FormatFlags | s_LogFormatFlags = fLOG_Default |
static const unsigned int | s_CRC32Table [256] |
|
Definition at line 760 of file ncbi_util.c. |
|
Definition at line 61 of file ncbi_util.c. |
|
Definition at line 63 of file ncbi_util.c. |
|
Definition at line 179 of file ncbi_util.c. Referenced by s_WritePrintable(), UTIL_PrintableString(), and UTIL_PrintableStringSize(). |
|
Definition at line 516 of file ncbi_util.c. References SLogData::auto_close, and SLogData::fp. Referenced by LOG_ToFILE_Ex(). |
|
Definition at line 498 of file ncbi_util.c. References SLogData::cut_off, eLOG_Fatal, SLogData::fp, SLOG_Handler::level, LOG_ComposeMessage(), and s_LogFormatFlags. Referenced by LOG_ToFILE_Ex(). |
|
Definition at line 765 of file ncbi_util.c. |
|
Definition at line 165 of file ncbi_util.c. Referenced by s_LOG_FileHandler(). |