ChibiOS/HAL 9.0.0
Input Formatter Utility

Detailed Description

Mini scanf-like functionality.

Collaboration diagram for Input Formatter Utility:

Macros

#define CHSCANF_USE_FLOAT   FALSE
 Float type support.

Functions

static long sym_to_val (char sym, int base)
int chvscanf (BaseBufferedStream *chp, const char *fmt, va_list ap)
 System formatted input function.
int chscanf (BaseBufferedStream *chp, const char *fmt,...)
 System formatted input function.
int chsnscanf (char *str, size_t size, const char *fmt,...)
 System formatted input function.
int chvsnscanf (char *str, size_t size, const char *fmt, va_list ap)
 System formatted input function.

Macro Definition Documentation

◆ CHSCANF_USE_FLOAT

#define CHSCANF_USE_FLOAT   FALSE

Float type support.

Definition at line 40 of file chscanf.h.

Function Documentation

◆ sym_to_val()

long sym_to_val ( char sym,
int base )
static

Definition at line 36 of file chscanf.c.

Referenced by chvscanf().

◆ chvscanf()

int chvscanf ( BaseBufferedStream * chp,
const char * fmt,
va_list ap )

System formatted input function.

This function implements a minimal vscanf()-like functionality with input on a BaseSequentialStream. The general parameters format is: %[*][width][l|L]p The following parameter types (p) are supported:

  • x hexadecimal integer.
  • X hexadecimal long.
  • o octal integer.
  • O octal long.
  • d decimal signed integer.
  • D decimal signed long.
  • u decimal unsigned integer.
  • U decimal unsigned long.
  • c character.
  • s string.
Parameters
[in]chppointer to a BufferedStream implementing object
[in]fmtformatting string
[in]aplist of parameters
Returns
The number parameters in ap that have been successfully filled. This does not conform to the standard in that if a failure (either matching or input) occurs before any parameters are assigned, the function will return 0.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 111 of file chscanf.c.

References STM_RESET, streamGet, streamUnget, and sym_to_val().

Referenced by chscanf(), and chvsnscanf().

Here is the call graph for this function:

◆ chscanf()

int chscanf ( BaseBufferedStream * chp,
const char * fmt,
... )

System formatted input function.

This function implements a minimal scanf() like functionality with input from a BufferedStream. The general parameters format is: %[*][width][l|L]p The following parameter types (p) are supported:

  • x hexadecimal integer.
  • X hexadecimal long.
  • o octal integer.
  • O octal long.
  • d decimal signed integer.
  • D decimal signed long.
  • u decimal unsigned integer.
  • U decimal unsigned long.
  • c character.
  • s string.
Parameters
[in]chppointer to a BufferedStream implementing object
[in]fmtformatting string
Returns
The number parameters in ap that have been successfully filled. This does not conform to the standard in that if a failure (either matching or input) occurs before any parameters are assigned, the function will return 0.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 695 of file chscanf.c.

References chvscanf().

Here is the call graph for this function:

◆ chsnscanf()

int chsnscanf ( char * str,
size_t size,
const char * fmt,
... )

System formatted input function.

This function implements a minimal snscanf()-like functionality. The general parameters format is: %[*][width][l|L]p The following parameter types (p) are supported:

  • x hexadecimal integer.
  • X hexadecimal long.
  • o octal integer.
  • O octal long.
  • d decimal signed integer.
  • D decimal signed long.
  • u decimal unsigned integer.
  • U decimal unsigned long.
  • c character.
  • s string.
Parameters
[in]strpointer to a buffer
[in]sizesize of the buffer
[in]fmtformatting string
Returns
The number parameters in ap that have been successfully filled. This does not conform to the standard in that if a failure (either matching or input) occurs before any parameters are assigned, the function will return 0.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 734 of file chscanf.c.

References chvsnscanf().

Here is the call graph for this function:

◆ chvsnscanf()

int chvsnscanf ( char * str,
size_t size,
const char * fmt,
va_list ap )

System formatted input function.

This function implements a minimal vsnscanf()-like functionality. The general parameters format is: %[*][width][l|L]p The following parameter types (p) are supported:

  • x hexadecimal integer.
  • X hexadecimal long.
  • o octal integer.
  • O octal long.
  • d decimal signed integer.
  • D decimal signed long.
  • u decimal unsigned integer.
  • U decimal unsigned long.
  • c character.
  • s string.
Parameters
[in]strpointer to a buffer
[in]sizesize of the buffer
[in]fmtformatting string
[in]aplist of parameters
Returns
The number parameters in ap that have been successfully filled. This does not conform to the standard in that if a failure (either matching or input) occurs before any parameters are assigned, the function will return 0.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 776 of file chscanf.c.

References chvscanf(), and msObjectInit().

Referenced by chsnscanf().

Here is the call graph for this function: