4.115
Last change
on this file since f031df0e was
a2e3f33,
checked in by Sebastian Huber <sebastian.huber@…>, on 07/24/13 at 11:50:54
|
score: Create object implementation header
Move implementation specific parts of object.h and object.inl into new
header file objectimpl.h. The object.h contains now only the
application visible API.
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Object ID to Name |
---|
5 | * @ingroup ScoreObject |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2010. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.com/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/score/objectimpl.h> |
---|
22 | |
---|
23 | #include <string.h> |
---|
24 | |
---|
25 | #if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES) |
---|
26 | Objects_Name_or_id_lookup_errors _Objects_Name_to_id_string( |
---|
27 | Objects_Information *information, |
---|
28 | const char *name, |
---|
29 | Objects_Id *id |
---|
30 | ) |
---|
31 | { |
---|
32 | Objects_Control *the_object; |
---|
33 | uint32_t index; |
---|
34 | |
---|
35 | /* ASSERT: information->is_string == true */ |
---|
36 | |
---|
37 | if ( !id ) |
---|
38 | return OBJECTS_INVALID_ADDRESS; |
---|
39 | |
---|
40 | if ( !name ) |
---|
41 | return OBJECTS_INVALID_NAME; |
---|
42 | |
---|
43 | if ( information->maximum != 0 ) { |
---|
44 | |
---|
45 | for ( index = 1; index <= information->maximum; index++ ) { |
---|
46 | the_object = information->local_table[ index ]; |
---|
47 | if ( !the_object ) |
---|
48 | continue; |
---|
49 | |
---|
50 | if ( !the_object->name.name_p ) |
---|
51 | continue; |
---|
52 | |
---|
53 | if (!strncmp( name, the_object->name.name_p, information->name_length)) { |
---|
54 | *id = the_object->id; |
---|
55 | return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL; |
---|
56 | } |
---|
57 | } |
---|
58 | } |
---|
59 | |
---|
60 | return OBJECTS_INVALID_NAME; |
---|
61 | } |
---|
62 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.