WISP ERT (Client)  1.0.0
The WISP Extended Runtime (WISP side)
defs.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  wio_closure_t
 WIO closure type. More...
 

Macros

#define WIO_TRY(expr)
 WIO error handling marco. More...
 
#define WIO_CALLBACK(name)   wio_status_t name(void* data, wio_status_t status, void* result)
 Shorthand for declaring a WIO callback function. More...
 
#define WIO_INST_PTR(type)   &((type){})
 Create an anonymous variable on stack and return a pointer to it. More...
 
#define WIO_RETURN(ret_var, ret_val)
 Check pointer and return value through pointer. More...
 
#define WIO_MIN(x, y)   ((x<y)?x:y)
 Minimum value of two numbers. More...
 
#define WIO_MIN3(x, y, z)   WIO_MIN(WIO_MIN(x, y), z)
 Minimum value of three numbers. More...
 

Typedefs

typedef uint8_t wio_status_t
 WIO status type. More...
 
typedef wio_status_t(* wio_callback_t) (void *, wio_status_t, void *)
 WIO callback type. More...
 

Variables

static const wio_status_t WIO_OK = 0x00
 No error. More...
 
static const wio_status_t WIO_ERR_OUT_OF_RANGE = 0x01
 Out of range. More...
 
static const wio_status_t WIO_ERR_NO_MEMORY = 0x02
 No memory. More...
 
static const wio_status_t WIO_ERR_ALREADY = 0x03
 Already in use. More...
 
static const wio_status_t WIO_ERR_INVALID = 0x04
 Invalid parameter. More...
 
static const wio_status_t WIO_ERR_EMPTY = 0x05
 Empty data structure. More...
 

Macro Definition Documentation

◆ WIO_CALLBACK

#define WIO_CALLBACK (   name)    wio_status_t name(void* data, wio_status_t status, void* result)

Shorthand for declaring a WIO callback function.

◆ WIO_INST_PTR

#define WIO_INST_PTR (   type)    &((type){})

Create an anonymous variable on stack and return a pointer to it.

◆ WIO_MIN

#define WIO_MIN (   x,
 
)    ((x<y)?x:y)

Minimum value of two numbers.

◆ WIO_MIN3

#define WIO_MIN3 (   x,
  y,
 
)    WIO_MIN(WIO_MIN(x, y), z)

Minimum value of three numbers.

◆ WIO_RETURN

#define WIO_RETURN (   ret_var,
  ret_val 
)
Value:
{ \
if (ret_var) \
*ret_var = ret_val; \
}

Check pointer and return value through pointer.

◆ WIO_TRY

#define WIO_TRY (   expr)
Value:
{ \
wio_status_t __status = expr; \
if (__status) \
return __status; \
}

WIO error handling marco.

The marco continues execution if expression returns WIO_OK, or immediately return from current function is expression returns something else. Its usage is similar to rust's "try!" marco.

Typedef Documentation

◆ wio_callback_t

typedef wio_status_t(* wio_callback_t) (void *, wio_status_t, void *)

WIO callback type.

◆ wio_status_t

typedef uint8_t wio_status_t

WIO status type.

Variable Documentation

◆ WIO_ERR_ALREADY

const wio_status_t WIO_ERR_ALREADY = 0x03
static

Already in use.

◆ WIO_ERR_EMPTY

const wio_status_t WIO_ERR_EMPTY = 0x05
static

Empty data structure.

◆ WIO_ERR_INVALID

const wio_status_t WIO_ERR_INVALID = 0x04
static

Invalid parameter.

◆ WIO_ERR_NO_MEMORY

const wio_status_t WIO_ERR_NO_MEMORY = 0x02
static

No memory.

◆ WIO_ERR_OUT_OF_RANGE

const wio_status_t WIO_ERR_OUT_OF_RANGE = 0x01
static

Out of range.

◆ WIO_OK

const wio_status_t WIO_OK = 0x00
static

No error.