source: rtems/cpukit/score/macros/rtems/score/object.inl @ e90ff51f

4.104.114.84.95
Last change on this file since e90ff51f was e90ff51f, checked in by Joel Sherrill <joel.sherrill@…>, on 07/05/02 at 18:15:41

2002-07-05 Joel Sherrill <joel@…>

  • macros/rtems/score/object.inl: Corrected implementation of _Objects_Open, _Objects_Close, and _Objects_Namespace_remove to be consistent with the inline implementation.
  • Property mode set to 100644
File size: 3.8 KB
Line 
1/*  object.inl
2 *
3 *  This include file contains the macro implementation of all
4 *  of the inlined routines in the Object Handler.
5 *
6 *  COPYRIGHT (c) 1989-1999.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#ifndef __OBJECTS_inl
17#define __OBJECTS_inl
18
19/*PAGE
20 *
21 *  _Objects_Build_id
22 *
23 */
24
25#define _Objects_Build_id( _the_api, _the_class, _node, _index ) \
26  ( (( (Objects_Id) _the_api ) << OBJECTS_API_START_BIT) | \
27    (( (Objects_Id) _the_class ) << OBJECTS_CLASS_START_BIT) | \
28    (( (Objects_Id) _node ) << OBJECTS_NODE_START_BIT)       | \
29    (( (Objects_Id) _index ) << OBJECTS_INDEX_START_BIT) )
30
31/*PAGE
32 *
33 *  _Objects_Get_API
34 */
35 
36#define _Objects_Get_API( _id ) \
37  (Objects_APIs) \
38    (((_id) >> OBJECTS_API_START_BIT) & OBJECTS_API_VALID_BITS)
39
40/*PAGE
41 *
42 *  _Objects_Get_class
43 */
44 
45#define _Objects_Get_class( _id ) \
46  (unsigned32) \
47    (((_id) >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS)
48
49/*PAGE
50 *
51 *  _Objects_Get_node
52 *
53 */
54
55#define _Objects_Get_node( _id ) \
56  (((_id) >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS)
57
58/*PAGE
59 *
60 *  _Objects_Get_index
61 *
62 */
63
64#define _Objects_Get_index( _id ) \
65  (((_id) >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS)
66
67/*PAGE
68 *
69 *  _Objects_Is_class_valid
70 *
71 */
72 
73#define _Objects_Is_class_valid( _the_class ) \
74  ( (_the_class) /* XXX && (_the_class) <= OBJECTS_CLASSES_LAST */ )
75
76/*PAGE
77 *
78 *  _Objects_Is_local_node
79 *
80 */
81
82#define _Objects_Is_local_node( _node ) \
83  ( (_node) == _Objects_Local_node )
84
85/*PAGE
86 *
87 *  _Objects_Is_local_id
88 *
89 */
90
91#define _Objects_Is_local_id( _id ) \
92  _Objects_Is_local_node( _Objects_Get_node(_id) )
93
94/*PAGE
95 *
96 *  _Objects_Are_ids_equal
97 *
98 */
99
100#define _Objects_Are_ids_equal( _left, _right ) \
101  ( (_left) == (_right) )
102
103/*PAGE
104 *
105 *  _Objects_Get_local_object
106 *
107 */
108
109#define _Objects_Get_local_object( _information, _index ) \
110  ( ( (_index) > (_information)->maximum) ?  NULL : \
111                       (_information)->local_table[ (_index) ] )
112
113/*PAGE
114 *
115 *  _Objects_Set_local_object
116 *
117 */
118
119#define _Objects_Set_local_object( information, index, the_object ) \
120  { \
121    if ( index <= information->maximum) \
122      information->local_table[ index ] = the_object; \
123  }
124
125
126/*PAGE
127 *
128 *  _Objects_Get_information
129 *
130 */
131 
132#define _Objects_Get_information( id ) \
133 ( \
134   ( !_Objects_Is_class_valid( _Objects_Get_class( id ) ) ) ? \
135     NULL : \
136     _Objects_Information_table[ _Objects_Get_API( id ) ] \
137       [ _Objects_Get_class( id ) ] \
138 )
139
140/*PAGE
141 *
142 *  _Objects_Open
143 *
144 */
145
146#define _Objects_Open( _information, _the_object, _name ) \
147  do { \
148    unsigned32 _index; \
149    \
150    _index = _Objects_Get_index( (_the_object)->id ); \
151    (_information)->local_table[ _index ] = (_the_object); \
152    \
153    if ( (_information)->is_string ) \
154      /* _Objects_Copy_name_string( (_name), (_the_object)->name ); */\
155      (_the_object)->name = name; \
156    else \
157      /* _Objects_Copy_name_raw( \
158        (_name), (_the_object)->name, (_information)->name_length ); */ \
159      (_the_object)->name = name; \
160  } while (0)
161
162/*PAGE
163 *
164 *  _Objects_Close
165 *
166 */
167
168#define _Objects_Close( _information, _the_object ) \
169  do { \
170    unsigned32 _index; \
171    \
172    _index = _Objects_Get_index( (_the_object)->id ); \
173    (_information)->local_table[ _index ] = (Objects_Control *) NULL; \
174    /* _Objects_Clear_name( (_the_object)->name, (_information)->name_length );  */ \
175    (_the_object)->name = 0; \
176  } while (0)
177
178/*PAGE
179 *
180 *  _Objects_Namespace_remove
181 */
182
183#define _Objects_Namespace_remove( _information, _the_object ) \
184  (_the_object)->name = 0 \
185  _Objects_Clear_name( (_the_object)->name, (_information)->name_length )
186
187#endif
188/* end of include file */
Note: See TracBrowser for help on using the repository browser.