C-Types

Describes naming of user defined Ansi C types.

Summary
C-TypesDescribes naming of user defined Ansi C types.
List of TypesThe following list shows the suffixes of a type name and on the right side what kind of type this suffix stands for.
Enum Example
Struct & Function Pointer Example
Interface ExampleThe structure log_it defines the function table, i.e.

List of Types

The following list shows the suffixes of a type name and on the right side what kind of type this suffix stands for.

Name&suffixDescription
typename_tstruct or primitive type Special structs like struct log_t { void * object; log_it * iimpl } ; which describes an (interfaceable object) object with associated interface use also the suffix _t (formerly _iot).
typename_ffunction pointer type
typename_eenum type
typename_itinterface type

Enum Example

enum process_state_e {
    process_state_RUNNABLE
   ,process_state_STOPPED
   ,process_state_TERMINATED
   ,process_state_ABORTED
} ;

typedef enum process_state_e        process_state_e ;

Struct & Function Pointer Example

struct callback_param_t ;

typedef int                      (* task_callback_f) (struct callback_param_t * start_arg) ;

typedef struct task_callback_t      task_callback_t  ;

struct task_callback_t {
   task_callback_f            fct ;
   struct callback_param_t  * arg ;
} ;

Interface Example

The structure log_it defines the function table, i.e. the interface.

The structure log_t defines a pointer to an imlementation object, which can be manipulated by this kind of interface and a pointer to an implementation of that interface.

struct log_it {
   void  (*printf)      (void * log, const char * format, ... ) __attribute__ ((__format__ (__printf__, 2, 3))) ; \
   void  (*flushbuffer) (void * log) ;                                      \
   void  (*clearbuffer) (void * log) ;                                      \
   void  (*getbuffer)   (void * log, /*out*/char ** buffer, /*out*/size_t * size) ; \
} ;

struct log_ot {
   void   * object ;
   log_it * iimpl ;
} ;
struct log_it
The function table which describes the log service.
iobj_DECLARE(log_t,
log)
Uses iobj_DECLARE to declare object supporting interface log_it.
Close