source: rtems/cpukit/score/macros/rtems/score/object.inl @ 7e4c3d8b

4.104.114.84.95
Last change on this file since 7e4c3d8b was 7e4c3d8b, checked in by Joel Sherrill <joel.sherrill@…>, on 06/18/98 at 18:58:42

Modified _Objects_Is_class_valid() to correctly report that 0 was
not a valid object class. This was discovered while looking for
a bug reported by Jennifer.

  • Property mode set to 100644
File size: 2.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-1998.
7 *  On-Line Applications Research Corporation (OAR).
8 *  Copyright assigned to U.S. Government, 1994.
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.OARcorp.com/rtems/license.html.
13 *
14 *  $Id$
15 */
16
17#ifndef __OBJECTS_inl
18#define __OBJECTS_inl
19
20/*PAGE
21 *
22 *  _Objects_Build_id
23 *
24 */
25
26#define _Objects_Build_id( _the_class, _node, _index ) \
27  ( ((_the_class) << OBJECTS_CLASS_START_BIT) | \
28    ((_node) << OBJECTS_NODE_START_BIT)       | \
29    ((_index) << OBJECTS_INDEX_START_BIT) )
30
31/*PAGE
32 *
33 *  _Objects_Get_class
34 */
35 
36#define _Objects_Get_class( _id ) \
37  (Objects_Classes) \
38    (((_id) >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS)
39
40/*PAGE
41 *
42 *  _Objects_Get_node
43 *
44 */
45
46#define _Objects_Get_node( _id ) \
47  (((_id) >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS)
48
49/*PAGE
50 *
51 *  _Objects_Get_index
52 *
53 */
54
55#define _Objects_Get_index( _id ) \
56  (((_id) >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS)
57
58/*PAGE
59 *
60 *  _Objects_Is_class_valid
61 *
62 */
63 
64#define _Objects_Is_class_valid( _the_class ) \
65  ( (_the_class) && (_the_class) <= OBJECTS_CLASSES_LAST )
66
67/*PAGE
68 *
69 *  _Objects_Is_local_node
70 *
71 */
72
73#define _Objects_Is_local_node( _node ) \
74  ( (_node) == _Objects_Local_node )
75
76/*PAGE
77 *
78 *  _Objects_Is_local_id
79 *
80 */
81
82#define _Objects_Is_local_id( _id ) \
83  _Objects_Is_local_node( _Objects_Get_node(_id) )
84
85/*PAGE
86 *
87 *  _Objects_Are_ids_equal
88 *
89 */
90
91#define _Objects_Are_ids_equal( _left, _right ) \
92  ( (_left) == (_right) )
93
94/*PAGE
95 *
96 *  _Objects_Allocate
97 *
98 */
99
100#define _Objects_Allocate( _information )  \
101  (Objects_Control *) _Chain_Get( &(_information)->Inactive )
102
103/*PAGE
104 *
105 *  _Objects_Free
106 *
107 */
108
109#define _Objects_Free( _information, _the_object )  \
110  _Chain_Append( &(_information)->Inactive, &(_the_object)->Node )
111
112/*PAGE
113 *
114 *  _Objects_Open
115 *
116 */
117
118#define _Objects_Open( _information, _the_object, _name ) \
119  { \
120    unsigned32 _index; \
121    \
122    _index = _Objects_Get_index( (_the_object)->id ); \
123    (_information)->local_table[ _index ] = (_the_object); \
124    \
125    if ( (_information)->is_string ) \
126      _Objects_Copy_name_string( (_name), (_the_object)->name ); \
127    else \
128      _Objects_Copy_name_raw( \
129        (_name), (_the_object)->name, (_information)->name_length ); \
130  }
131
132/*PAGE
133 *
134 *  _Objects_Close
135 *
136 */
137
138#define _Objects_Close( _information, _the_object ) \
139  { \
140    unsigned32 _index; \
141    \
142    _index = _Objects_Get_index( (_the_object)->id ); \
143    (_information)->local_table[ _index ] = (Objects_Control *) NULL; \
144    _Objects_Clear_name( (_the_object)->name, (_information)->name_length ); \
145  }
146
147#endif
148/* end of include file */
Note: See TracBrowser for help on using the repository browser.