comparison src/gpf/ccd/ccddata_ccdent.c @ 0:4e78acac3d88

src/{condat,cs,gpf,nucleus}: import from Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:23:26 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4e78acac3d88
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul : ccddata_ccdent.c
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : Ccddata abstraction for use in lib/dll. The table ccdent.cdg
18 | genereraed by ccdgen is included.
19 | The exported function ccddata_get_ccdent delivers a mapping
20 | from an entitiy name (like e.g. "RR") to the generated
21 | entity number (CCDENT_RR).
22 +-----------------------------------------------------------------------------
23 */
24
25 #define CCDDATA_CCDENT_C
26 #include <string.h>
27 #include "typedefs.h"
28 #include "mconst.cdg"
29 #include "ccdtable.h"
30 #include "ccddata.h"
31
32 static struct
33 {
34 char* entname;
35 int ccdent;
36 } ccdenttbl [] =
37 {
38 #ifndef CCDDATA_NO_CCDENT
39 #include "ccdent.cdg"
40 #endif /* CCDDATA_NO_CCDENT */
41 { (char *) NULL , 65535 }
42 };
43
44 short ccddata_get_ccdent (char* entname)
45 {
46 int i = 0;
47
48 for (;;)
49 {
50 if (!ccdenttbl[i].entname)
51 return CCDDATA_CCDENT_INVALID;
52 if (!strcmp (ccdenttbl[i].entname, entname))
53 return ccdenttbl[i].ccdent;
54 ++i;
55 }
56 }
57
58 const char * ccddata_get_entname (short ccdent)
59 {
60 int i = 0;
61
62 for (;;)
63 {
64 if (!ccdenttbl[i].entname)
65 {
66 return NULL;
67 }
68 if (ccdenttbl[i].ccdent==ccdent)
69 {
70 return ccdenttbl[i].entname;
71 }
72 ++i;
73 }
74 }