sf_type.h

Sifli middle common interface.

Author

Sifli software development team

Unnamed Group

SF_EOK

There is no error

SF_ERR

A generic error happens

SF_ETIMEOUT

Timed out

SF_EFULL

The resource is full

SF_EEMPTY

The resource is empty

SF_ENOMEM

No memory

SF_ENOSYS

No system

SF_EBUSY

Busy

SF_EIO

IO error

SF_EINTR

Interrupted system call

SF_EINVAL

Invalid argument

SF_ASSERT(expr)
CONCAT_2_(p1, p2)
CONCAT_2(p1, p2)

Concatenates two parameters.

It realizes two level expansion to make it sure that all the parameters are actually expanded before gluing them together.

参数:
  • p1 – First parameter to concatenating

  • p2 – Second parameter to concatenating

返回:

Two parameters glued together. They have to create correct C mnemonic in other case preprocessor error would be generated.

STRINGIFY_(val)
STRINGIFY(val)

Converts a macro argument into a character constant.

BRACKET_EXTRACT(a)

Extracting data from the brackets.

This macro get rid of brackets around the argument. It can be used to pass multiple arguments in logical one argument to a macro. Call it with arguments inside brackets:

#define ARGUMENTS (a, b, c)
BRACKET_EXTRACT(ARGUMENTS)
It would produce:
a, b, c

备注

The argument of the macro have to be inside brackets. In other case the compilation would fail.

参数:
  • a – Argument with anything inside brackets

返回:

Anything that appears inside the brackets of the argument

BRACKET_EXTRACT_(a)
BRACKET_EXTRACT__(...)
GET_VA_ARG_1(...)

Get the first argument.

参数:
  • ... – Arguments to select

返回:

First argument or empty if no arguments are provided

GET_VA_ARG_1_(a1, ...)
GET_ARGS_AFTER_1(...)

Get all the arguments but the first one.

参数:
  • ... – Arguments to select

返回:

All arguments after the first one or empty if less than 2 arguments are provided

GET_ARGS_AFTER_1_(a1, ...)
MACRO_MAP_FOR_N_LIST

Mapping macro with current index.

参数:
  • ... – Macro name to be used for argument processing followed by arguments to process. Macro should have following form: MACRO(argument, index)

返回:

All arguments processed by given macro

MACRO_REPEAT(count, macro, ...)

Repeating macro.

参数:
  • count – Count of repeats.

  • macro – Macro must have the following form: MACRO(arguments).

  • ... – Arguments passed to the macro.

返回:

All arguments processed by the given macro.

MACRO_REPEAT_(count, macro, ...)
MACRO_REPEAT_0(macro, ...)
MACRO_REPEAT_1(macro, ...)
MACRO_REPEAT_2(macro, ...)
MACRO_REPEAT_3(macro, ...)
MACRO_REPEAT_4(macro, ...)
MACRO_REPEAT_5(macro, ...)
MACRO_REPEAT_6(macro, ...)
MACRO_REPEAT_7(macro, ...)
MACRO_REPEAT_8(macro, ...)
MACRO_REPEAT_9(macro, ...)
MACRO_REPEAT_10(macro, ...)
MACRO_REPEAT_11(macro, ...)
MACRO_REPEAT_12(macro, ...)
MACRO_REPEAT_13(macro, ...)
MACRO_REPEAT_14(macro, ...)
MACRO_REPEAT_15(macro, ...)
MACRO_REPEAT_16(macro, ...)
MACRO_REPEAT_17(macro, ...)
MACRO_REPEAT_18(macro, ...)
MACRO_REPEAT_19(macro, ...)
MACRO_REPEAT_20(macro, ...)
MACRO_REPEAT_21(macro, ...)
MACRO_REPEAT_22(macro, ...)
MACRO_REPEAT_23(macro, ...)
MACRO_REPEAT_24(macro, ...)
MACRO_REPEAT_25(macro, ...)
MACRO_REPEAT_26(macro, ...)
MACRO_REPEAT_27(macro, ...)
MACRO_REPEAT_28(macro, ...)
MACRO_REPEAT_29(macro, ...)
MACRO_REPEAT_30(macro, ...)
MACRO_REPEAT_31(macro, ...)
MACRO_REPEAT_32(macro, ...)
MACRO_REPEAT_FOR(count, macro, ...)

Repeating macro with current index.

Macro similar to MACRO_REPEAT but the processing function gets the arguments and the current argument index (beginning from 0).

参数:
  • count – Count of repeats.

  • macro – Macro must have the following form: MACRO(index, arguments).

  • ... – Arguments passed to the macro.

返回:

All arguments processed by the given macro.

MACRO_REPEAT_FOR_(count, macro, ...)
MACRO_REPEAT_FOR_0(n_list, macro, ...)
MACRO_REPEAT_FOR_1(n_list, macro, ...)
MACRO_REPEAT_FOR_2(n_list, macro, ...)
MACRO_REPEAT_FOR_3(n_list, macro, ...)
MACRO_REPEAT_FOR_4(n_list, macro, ...)
MACRO_REPEAT_FOR_5(n_list, macro, ...)
MACRO_REPEAT_FOR_6(n_list, macro, ...)
MACRO_REPEAT_FOR_7(n_list, macro, ...)
MACRO_REPEAT_FOR_8(n_list, macro, ...)
MACRO_REPEAT_FOR_9(n_list, macro, ...)
MACRO_REPEAT_FOR_10(n_list, macro, ...)
MACRO_REPEAT_FOR_11(n_list, macro, ...)
MACRO_REPEAT_FOR_12(n_list, macro, ...)
MACRO_REPEAT_FOR_13(n_list, macro, ...)
MACRO_REPEAT_FOR_14(n_list, macro, ...)
MACRO_REPEAT_FOR_15(n_list, macro, ...)
MACRO_REPEAT_FOR_16(n_list, macro, ...)
MACRO_REPEAT_FOR_17(n_list, macro, ...)
MACRO_REPEAT_FOR_18(n_list, macro, ...)
MACRO_REPEAT_FOR_19(n_list, macro, ...)
MACRO_REPEAT_FOR_20(n_list, macro, ...)
MACRO_REPEAT_FOR_21(n_list, macro, ...)
MACRO_REPEAT_FOR_22(n_list, macro, ...)
MACRO_REPEAT_FOR_23(n_list, macro, ...)
MACRO_REPEAT_FOR_24(n_list, macro, ...)
MACRO_REPEAT_FOR_25(n_list, macro, ...)
MACRO_REPEAT_FOR_26(n_list, macro, ...)
MACRO_REPEAT_FOR_27(n_list, macro, ...)
MACRO_REPEAT_FOR_28(n_list, macro, ...)
MACRO_REPEAT_FOR_29(n_list, macro, ...)
MACRO_REPEAT_FOR_30(n_list, macro, ...)
MACRO_REPEAT_FOR_31(n_list, macro, ...)
MACRO_REPEAT_FOR_32(n_list, macro, ...)
typedef int sf_err_t