source: rtems/c/src/exec/score/macros/rtems/score/object.inl @ 08311cc3

4.104.114.84.95
Last change on this file since 08311cc3 was 08311cc3, checked in by Joel Sherrill <joel.sherrill@…>, on Nov 17, 1999 at 5:51:34 PM

Updated copyright notice.

  • Property mode set to 100644
File size: 3.1 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_class, _node, _index ) \
26  ( ((_the_class) << OBJECTS_CLASS_START_BIT) | \
27    ((_node) << OBJECTS_NODE_START_BIT)       | \
28    ((_index) << OBJECTS_INDEX_START_BIT) )
29
30/*PAGE
31 *
32 *  _Objects_Get_class
33 */
34 
35#define _Objects_Get_class( _id ) \
36  (Objects_Classes) \
37    (((_id) >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS)
38
39/*PAGE
40 *
41 *  _Objects_Get_node
42 *
43 */
44
45#define _Objects_Get_node( _id ) \
46  (((_id) >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS)
47
48/*PAGE
49 *
50 *  _Objects_Get_index
51 *
52 */
53
54#define _Objects_Get_index( _id ) \
55  (((_id) >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS)
56
57/*PAGE
58 *
59 *  _Objects_Is_class_valid
60 *
61 */
62 
63#define _Objects_Is_class_valid( _the_class ) \
64  ( (_the_class) && (_the_class) <= OBJECTS_CLASSES_LAST )
65
66/*PAGE
67 *
68 *  _Objects_Is_local_node
69 *
70 */
71
72#define _Objects_Is_local_node( _node ) \
73  ( (_node) == _Objects_Local_node )
74
75/*PAGE
76 *
77 *  _Objects_Is_local_id
78 *
79 */
80
81#define _Objects_Is_local_id( _id ) \
82  _Objects_Is_local_node( _Objects_Get_node(_id) )
83
84/*PAGE
85 *
86 *  _Objects_Are_ids_equal
87 *
88 */
89
90#define _Objects_Are_ids_equal( _left, _right ) \
91  ( (_left) == (_right) )
92
93/*PAGE
94 *
95 *  _Objects_Get_local_object
96 *
97 */
98
99#define _Objects_Get_local_object( information, index ) \
100  ( ( index > information->maximum) ?  NULL : \
101                       information->local_table[ index ] )
102
103/*PAGE
104 *
105 *  _Objects_Set_local_object
106 *
107 */
108
109#define _Objects_Set_local_object( information, index, the_object ) \
110  { \
111    if ( index <= information->maximum) \
112      information->local_table[ index ] = the_object; \
113  }
114
115
116/*PAGE
117 *
118 *  _Objects_Get_information
119 *
120 */
121 
122#define _Objects_Get_information( id ) \
123 ( \
124   ( !_Objects_Is_class_valid( _Objects_Get_class( id ) ) ) ? \
125     NULL : \
126     _Objects_Information_table[ _Objects_Get_class( id ) ] \
127 )
128
129/*PAGE
130 *
131 *  _Objects_Open
132 *
133 */
134
135#define _Objects_Open( _information, _the_object, _name ) \
136  { \
137    unsigned32 _index; \
138    \
139    _index = _Objects_Get_index( (_the_object)->id ); \
140    (_information)->local_table[ _index ] = (_the_object); \
141    \
142    if ( (_information)->is_string ) \
143      _Objects_Copy_name_string( (_name), (_the_object)->name ); \
144    else \
145      _Objects_Copy_name_raw( \
146        (_name), (_the_object)->name, (_information)->name_length ); \
147  }
148
149/*PAGE
150 *
151 *  _Objects_Close
152 *
153 */
154
155#define _Objects_Close( _information, _the_object ) \
156  { \
157    unsigned32 _index; \
158    \
159    _index = _Objects_Get_index( (_the_object)->id ); \
160    (_information)->local_table[ _index ] = (Objects_Control *) NULL; \
161    _Objects_Clear_name( (_the_object)->name, (_information)->name_length ); \
162  }
163
164#endif
165/* end of include file */
Note: See TracBrowser for help on using the repository browser.