str.c File Reference

#include <str.h>
#include <stdlib.h>
#include <assert.h>
#include <stdint.h>
#include <ctype.h>
#include <malloc.h>
#include <errno.h>
#include <align.h>
#include <mem.h>

Go to the source code of this file.

Defines

#define CONT_BITS   6
 Number of data bits in a UTF-8 continuation byte.
#define HI_MASK_8(n)   (~LO_MASK_8(8 - (n)))
 Byte mask consisting of highest
bits (out of 8).
#define LO_MASK_32(n)   ((uint32_t) ((1 << (n)) - 1))
 Byte mask consisting of lowest
bits (out of 32).
#define LO_MASK_8(n)   ((uint8_t) ((1 << (n)) - 1))
 Byte mask consisting of lowest
bits (out of 8).

Functions

static unsigned long _strtoul (const char *nptr, char **endptr, int base, char *sgn)
 Convert string to a number.
bool ascii_check (wchar_t ch)
 Check whether character is plain ASCII.
void bin_order_suffix (const uint64_t val, uint64_t *rv, const char **suffix, bool fixed)
bool chr_check (wchar_t ch)
 Check whether character is valid.
int chr_encode (const wchar_t ch, char *str, size_t *offset, size_t size)
 Encode a single character to string representation.
void order_suffix (const uint64_t val, uint64_t *rv, char *suffix)
void str_append (char *dest, size_t size, const char *src)
 Append one string to another.
char * str_chr (const char *str, wchar_t ch)
 Find first occurence of character in string.
int str_cmp (const char *s1, const char *s2)
 Compare two NULL terminated strings.
void str_cpy (char *dest, size_t size, const char *src)
 Copy string.
wchar_t str_decode (const char *str, size_t *offset, size_t size)
 Decode a single character from a string.
char * str_dup (const char *src)
 Duplicate string.
int str_lcmp (const char *s1, const char *s2, size_t max_len)
 Compare two NULL terminated strings with length limit.
size_t str_length (const char *str)
 Get number of characters in a string.
size_t str_lsize (const char *str, size_t max_len)
 Get size of string with length limit.
void str_ncpy (char *dest, size_t size, const char *src, size_t n)
 Copy size-limited substring.
char * str_ndup (const char *src, size_t n)
 Duplicate string with size limit.
size_t str_nlength (const char *str, size_t size)
 Get number of characters in a string with size limit.
char * str_rchr (const char *str, wchar_t ch)
 Find last occurence of character in string.
size_t str_size (const char *str)
 Get size of string.
int str_size_t (const char *nptr, char **endptr, unsigned int base, bool strict, size_t *result)
 Convert string to size_t.
void str_to_wstr (wchar_t *dest, size_t dlen, const char *src)
 Convert string to wide string.
static int str_uint (const char *nptr, char **endptr, unsigned int base, bool *neg, uint64_t *result)
 Convert string to uint64_t (internal variant).
int str_uint64 (const char *nptr, char **endptr, unsigned int base, bool strict, uint64_t *result)
 Convert string to uint64_t.
int stricmp (const char *a, const char *b)
char * strtok (char *s, const char *delim)
char * strtok_r (char *s, const char *delim, char **next)
long int strtol (const char *nptr, char **endptr, int base)
 Convert initial part of string to long int according to given base.
unsigned long strtoul (const char *nptr, char **endptr, int base)
 Convert initial part of string to unsigned long according to given base.
size_t wstr_length (const wchar_t *wstr)
 Get number of characters in a wide string.
bool wstr_linsert (wchar_t *str, wchar_t ch, size_t pos, size_t max_pos)
 Insert a wide character into a wide string.
size_t wstr_lsize (const wchar_t *str, size_t max_len)
 Get size of wide string with length limit.
size_t wstr_nlength (const wchar_t *str, size_t size)
 Get number of characters in a string with size limit.
bool wstr_remove (wchar_t *str, size_t pos)
 Remove a wide character from a wide string.
size_t wstr_size (const wchar_t *str)
 Get size of wide string.
char * wstr_to_astr (const wchar_t *src)
 Convert wide string to new string.
void wstr_to_str (char *dest, size_t size, const wchar_t *src)
 Convert wide string to string.


Detailed Description

Definition in file str.c.


Generated on Thu Jun 2 07:45:53 2011 for HelenOS/USB by  doxygen 1.4.7