Skip to content

Commit a2e0070

Browse files
author
Rajmund Szymanski
committed
updated objects definitions
1 parent f854dfc commit a2e0070

File tree

14 files changed

+120
-119
lines changed

14 files changed

+120
-119
lines changed

IntrOS/interface/inc/os_bar.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
@file IntrOS: os_bar.h
44
@author Rajmund Szymanski
5-
@date 29.03.2017
5+
@date 30.03.2017
66
@brief This file contains definitions for IntrOS.
77
88
******************************************************************************
@@ -41,7 +41,7 @@ extern "C" {
4141
* *
4242
**********************************************************************************************************************/
4343

44-
typedef struct __bar bar_t;
44+
typedef struct __bar bar_t, * const bar_id;
4545

4646
struct __bar
4747
{
@@ -50,8 +50,6 @@ struct __bar
5050
unsigned limit; // barrier's value limit
5151
};
5252

53-
typedef struct __bar bar_id[];
54-
5553
/**********************************************************************************************************************
5654
* *
5755
* Name : _BAR_INIT *
@@ -81,8 +79,9 @@ typedef struct __bar bar_id[];
8179
* *
8280
**********************************************************************************************************************/
8381

84-
#define OS_BAR( bar, limit ) \
85-
bar_t bar[1] = { _BAR_INIT( limit ) }
82+
#define OS_BAR( bar, limit ) \
83+
bar_t bar##__bar = _BAR_INIT( limit ); \
84+
bar_t * const bar = & bar##__bar
8685

8786
/**********************************************************************************************************************
8887
* *
@@ -96,8 +95,9 @@ typedef struct __bar bar_id[];
9695
* *
9796
**********************************************************************************************************************/
9897

99-
#define static_BAR( bar, limit ) \
100-
static bar_t bar[1] = { _BAR_INIT( limit ) }
98+
#define static_BAR( bar, limit ) \
99+
static bar_t bar##__bar = _BAR_INIT( limit ); \
100+
static bar_t * const bar = & bar##__bar
101101

102102
/**********************************************************************************************************************
103103
* *

IntrOS/interface/inc/os_box.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
@file IntrOS: os_box.h
44
@author Rajmund Szymanski
5-
@date 29.03.2017
5+
@date 30.03.2017
66
@brief This file contains definitions for IntrOS.
77
88
******************************************************************************
@@ -41,7 +41,7 @@ extern "C" {
4141
* *
4242
**********************************************************************************************************************/
4343

44-
typedef struct __box box_t;
44+
typedef struct __box box_t, * const box_id;
4545

4646
struct __box
4747
{
@@ -54,8 +54,6 @@ struct __box
5454
unsigned size; // size of a single mail (in bytes)
5555
};
5656

57-
typedef struct __box box_id[];
58-
5957
/**********************************************************************************************************************
6058
* *
6159
* Name : _BOX_INIT *
@@ -108,9 +106,10 @@ typedef struct __box box_id[];
108106
* *
109107
**********************************************************************************************************************/
110108

111-
#define OS_BOX( box, limit, size ) \
112-
char box##__buf[limt * size]; \
113-
box_t box[1] = { _BOX_INIT( limit, size, box##__buf ) }
109+
#define OS_BOX( box, limit, size ) \
110+
char box##__buf[limit*size]; \
111+
box_t box##__box = _BOX_INIT( limit, size, box##__buf ); \
112+
box_t * const box = & box##__box
114113

115114
/**********************************************************************************************************************
116115
* *
@@ -125,9 +124,10 @@ typedef struct __box box_id[];
125124
* *
126125
**********************************************************************************************************************/
127126

128-
#define static_BOX( box, limit, size ) \
129-
static char box##__buf[limt * size]; \
130-
static box_t box[1] = { _BOX_INIT( limit, size, box##__buf ) }
127+
#define static_BOX( box, limit, size ) \
128+
static char box##__buf[limit*size]; \
129+
static box_t box##__box = _BOX_INIT( limit, size, box##__buf ); \
130+
static box_t * const box = & box##__box
131131

132132
/**********************************************************************************************************************
133133
* *

IntrOS/interface/inc/os_cnd.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
@file IntrOS: os_cnd.h
44
@author Rajmund Szymanski
5-
@date 29.03.2017
5+
@date 30.03.2017
66
@brief This file contains definitions for IntrOS.
77
88
******************************************************************************
@@ -41,15 +41,13 @@ extern "C" {
4141
* *
4242
**********************************************************************************************************************/
4343

44-
typedef struct __cnd cnd_t;
44+
typedef struct __cnd cnd_t, * const cnd_id;
4545

4646
struct __cnd
4747
{
4848
unsigned signal;
4949
};
5050

51-
typedef struct __cnd cnd_id[];
52-
5351
/**********************************************************************************************************************
5452
* *
5553
* Name : _CND_INIT *
@@ -77,8 +75,9 @@ typedef struct __cnd cnd_id[];
7775
* *
7876
**********************************************************************************************************************/
7977

80-
#define OS_CND( cnd ) \
81-
cnd_t cnd[1] = { _CND_INIT() }
78+
#define OS_CND( cnd ) \
79+
cnd_t cnd##__cnd = _CND_INIT(); \
80+
cnd_t * const cnd = & cnd##__cnd
8281

8382
/**********************************************************************************************************************
8483
* *
@@ -91,8 +90,9 @@ typedef struct __cnd cnd_id[];
9190
* *
9291
**********************************************************************************************************************/
9392

94-
#define static_CND( cnd ) \
95-
static cnd_t cnd[1] = { _CND_INIT() }
93+
#define static_CND( cnd ) \
94+
static cnd_t cnd##__cnd = _CND_INIT(); \
95+
static cnd_t * const cnd = & cnd##__cnd
9696

9797
/**********************************************************************************************************************
9898
* *

IntrOS/interface/inc/os_evt.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
@file IntrOS: os_evt.h
44
@author Rajmund Szymanski
5-
@date 29.03.2017
5+
@date 30.03.2017
66
@brief This file contains definitions for IntrOS.
77
88
******************************************************************************
@@ -41,16 +41,14 @@ extern "C" {
4141
* *
4242
**********************************************************************************************************************/
4343

44-
typedef struct __evt evt_t;
44+
typedef struct __evt evt_t, * const evt_id;
4545

4646
struct __evt
4747
{
4848
unsigned signal;
4949
unsigned event;
5050
};
5151

52-
typedef struct __evt evt_id[];
53-
5452
/**********************************************************************************************************************
5553
* *
5654
* Name : _EVT_INIT *
@@ -78,8 +76,9 @@ typedef struct __evt evt_id[];
7876
* *
7977
**********************************************************************************************************************/
8078

81-
#define OS_EVT( evt ) \
82-
evt_t evt[1] = { _EVT_INIT() }
79+
#define OS_EVT( evt ) \
80+
evt_t evt##__evt = _EVT_INIT(); \
81+
evt_t * const evt = & evt##__evt
8382

8483
/**********************************************************************************************************************
8584
* *
@@ -92,8 +91,9 @@ typedef struct __evt evt_id[];
9291
* *
9392
**********************************************************************************************************************/
9493

95-
#define static_EVT( evt ) \
96-
static evt_t evt[1] = { _EVT_INIT() }
94+
#define static_EVT( evt ) \
95+
static evt_t evt##__evt = _EVT_INIT(); \
96+
static evt_t * const evt = & evt##__evt
9797

9898
/**********************************************************************************************************************
9999
* *

IntrOS/interface/inc/os_flg.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
@file IntrOS: os_flg.h
44
@author Rajmund Szymanski
5-
@date 29.03.2017
5+
@date 30.03.2017
66
@brief This file contains definitions for IntrOS.
77
88
******************************************************************************
@@ -41,15 +41,13 @@ extern "C" {
4141
* *
4242
**********************************************************************************************************************/
4343

44-
typedef struct __flg flg_t;
44+
typedef struct __flg flg_t, * const flg_id;
4545

4646
struct __flg
4747
{
4848
unsigned flags; // flag's current value
4949
};
5050

51-
typedef struct __flg flg_id[];
52-
5351
/* -------------------------------------------------------------------------- */
5452

5553
#define flgAny ( false )
@@ -82,8 +80,9 @@ typedef struct __flg flg_id[];
8280
* *
8381
**********************************************************************************************************************/
8482

85-
#define OS_FLG( flg ) \
86-
flg_t flg[1] = { _FLG_INIT() }
83+
#define OS_FLG( flg ) \
84+
flg_t flg##__flg = _FLG_INIT(); \
85+
flg_t * const flg = & flg##__flg
8786

8887
/**********************************************************************************************************************
8988
* *
@@ -96,8 +95,9 @@ typedef struct __flg flg_id[];
9695
* *
9796
**********************************************************************************************************************/
9897

99-
#define static_FLG( flg ) \
100-
static flg_t flg[1] = { _FLG_INIT() }
98+
#define static_FLG( flg ) \
99+
static flg_t flg##__flg = _FLG_INIT(); \
100+
static flg_t * const flg = & flg##__flg
101101

102102
/**********************************************************************************************************************
103103
* *

IntrOS/interface/inc/os_lst.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
@file IntrOS: os_lst.h
44
@author Rajmund Szymanski
5-
@date 29.03.2017
5+
@date 30.03.2017
66
@brief This file contains definitions for IntrOS.
77
88
******************************************************************************
@@ -41,15 +41,13 @@ extern "C" {
4141
* *
4242
**********************************************************************************************************************/
4343

44-
typedef struct __lst lst_t;
44+
typedef struct __lst lst_t, * const lst_id;
4545

4646
struct __lst
4747
{
4848
que_t * next; // next memory object in the queue, previously created in the memory pool
4949
};
5050

51-
typedef struct __lst lst_id[];
52-
5351
/**********************************************************************************************************************
5452
* *
5553
* Name : _LST_INIT *
@@ -77,8 +75,9 @@ typedef struct __lst lst_id[];
7775
* *
7876
**********************************************************************************************************************/
7977

80-
#define OS_LST( lst ) \
81-
lst_t lst[1] = { _LST_INIT() }
78+
#define OS_LST( lst ) \
79+
lst_t lst##__lst = _LST_INIT(); \
80+
lst_t * const lst = & lst##__lst
8281

8382
/**********************************************************************************************************************
8483
* *
@@ -91,8 +90,9 @@ typedef struct __lst lst_id[];
9190
* *
9291
**********************************************************************************************************************/
9392

94-
#define static_LST( lst ) \
95-
static lst_t[1] lst = { _LST_INIT() }
93+
#define static_LST( lst ) \
94+
static lst_t lst##__lst = _LST_INIT(); \
95+
static lst * const lst = & lst##__lst
9696

9797
/**********************************************************************************************************************
9898
* *

IntrOS/interface/inc/os_mem.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
@file IntrOS: os_mem.h
44
@author Rajmund Szymanski
5-
@date 29.03.2017
5+
@date 30.03.2017
66
@brief This file contains definitions for IntrOS.
77
88
******************************************************************************
@@ -41,7 +41,7 @@ extern "C" {
4141
* *
4242
**********************************************************************************************************************/
4343

44-
typedef struct __mem mem_t;
44+
typedef struct __mem mem_t, * const mem_id;
4545

4646
struct __mem
4747
{
@@ -51,8 +51,6 @@ struct __mem
5151
void * data; // pointer to memory pool buffer
5252
};
5353

54-
typedef struct __mem mem_id[];
55-
5654
/* -------------------------------------------------------------------------- */
5755

5856
#define MSIZE( size ) \
@@ -109,9 +107,10 @@ typedef struct __mem mem_id[];
109107
* *
110108
**********************************************************************************************************************/
111109

112-
#define OS_MEM( mem, limit, size ) \
113-
void *mem##__buf[limit * (1 + MSIZE(size))]; \
114-
mem_t mem[1] = { _MEM_INIT( limit, size, mem##__buf ) }
110+
#define OS_MEM( mem, limit, size ) \
111+
void*mem##__buf[limit*(1+MSIZE(size))]; \
112+
mem_t mem##__mem = _MEM_INIT( limit, size, mem##__buf ); \
113+
mem_t * const mem = & mem##__mem
115114

116115
/**********************************************************************************************************************
117116
* *
@@ -126,9 +125,10 @@ typedef struct __mem mem_id[];
126125
* *
127126
**********************************************************************************************************************/
128127

129-
#define static_MEM( mem, limit, size ) \
130-
static void *mem##__buf[limit * (1 + MSIZE(size))]; \
131-
static mem_t mem[1] = { _MEM_INIT( limit, size, mem##__buf ) }
128+
#define static_MEM( mem, limit, size ) \
129+
static void*mem##__buf[limit*(1+MSIZE(size))]; \
130+
static mem_t mem##__mem = _MEM_INIT( limit, size, mem##__buf ); \
131+
static mem_t * const mem = & mem##__mem
132132

133133
/**********************************************************************************************************************
134134
* *

0 commit comments

Comments
 (0)