WIZlib Library API  ver 1.0
WIZlib Library API User Menual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Modules | Functions
Utilities

Utilities for common use. More...

Collaboration diagram for Utilities:

Modules

 Alarm
 Event Alarm Module.
 
 Base64
 Base64 Codec.
 
 Macro Util
 Simple Macro Utilities.
 

Functions

int8 digit_length (int32 dgt, int8 base)
 Count digit's letter Ex) digit_length(12345, 10) : This will return 5. More...
 
int32 str_check (int(*method)(int), int8 *str)
 Check string with standard library method. More...
 
int8 * strsep (register int8 **stringp, register const int8 *delim)
 Separate string into small peace by delimiter like strtok. More...
 
void print_dump (void *buf, uint16 len)
 Print Binary Dump Data. More...
 
uint16 checksum (uint8 *src, uint32 len)
 Calculate checksum of a stream. More...
 

Detailed Description

Utilities for common use.

Function Documentation

uint16 checksum ( uint8 *  src,
uint32  len 
)

Calculate checksum of a stream.

Parameters
srcThe string to calculate checksum.
lenThe string length.
Returns
Checksum

Definition at line 319 of file util.c.

int8 digit_length ( int32  dgt,
int8  base 
)

Count digit's letter Ex) digit_length(12345, 10) : This will return 5.

Parameters
dgtThe digit value to count
baseDigit base like 2, 8, 10, 16
Returns
>0: Counted digit letter
RET_NOK: Error

Definition at line 200 of file util.c.

void print_dump ( void *  buf,
uint16  len 
)

Print Binary Dump Data.

Parameters
bufThe data to print
lenThe data length

Definition at line 288 of file util.c.

int32 str_check ( int(*)(int)  method,
int8 *  str 
)

Check string with standard library method.

Below is the method you can use.

  • isalpha, isupper, islower
  • isdigit, isxdigit, isalnum
  • isspace, ispunct, isprint
  • isgraph, iscntrl, isascii

Ex) str_check(isdigit, "12345") : This will return RET_OK.
Ex) str_check(islower, "AbcDe") : This will return RET_NOK.

Parameters
methodThe method to use for check
strThe string to check
Returns
RET_OK: Success
RET_NOK: Error

Definition at line 233 of file util.c.

Here is the caller graph for this function:

int8* strsep ( register int8 **  stringp,
register const int8 *  delim 
)

Separate string into small peace by delimiter like strtok.

But if the input string contains more than one character from delimiter
in a row, strsep returns an empty string for each pair of characters from delimiter.

Ex) strsep("a,b,c,,,f,gh", ",") : When meet ,,, strtok returns 'f' but this returns NULL.

Parameters
stringpString to separate
delimDelimiter
Returns
Next pointer separated by delimiter

Definition at line 257 of file util.c.