comparison gsm-fw/ccd/ccddata_alias.c @ 648:970d6199f2c5

gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Thu, 04 Sep 2014 05:48:57 +0000
parents
children
comparison
equal deleted inserted replaced
647:a60b375014e3 648:970d6199f2c5
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul : ccddata_alias.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_ALIAS_C
26 #include <string.h>
27 #include "typedefs.h"
28 #include "ccdtable.h"
29
30 static char* nullstr = "";
31
32 static T_CCD_ALIASTABLE maliastbl [] =
33 {
34 #ifndef CCDDATA_NO_ALIAS
35 #include "malias.cdg"
36 #else /* CCDDATA_NO_ALIAS */
37 { "" }
38 #endif /* CCDDATA_NO_ALIAS */
39 };
40
41 static T_CCD_ALIASTABLE paliastbl [] =
42 {
43 #ifndef CCDDATA_NO_ALIAS
44 #include "palias.cdg"
45 #else /* CCDDATA_NO_ALIAS */
46 { "" }
47 #endif /* CCDDATA_NO_ALIAS */
48 };
49
50 char* ccddata_get_alias (USHORT idx, int from_msg)
51 {
52 #ifndef CCDDATA_NO_ALIAS
53 USHORT entries = (USHORT) (from_msg ?
54 sizeof (maliastbl) / sizeof (T_CCD_ALIASTABLE) :
55 sizeof (paliastbl) / sizeof (T_CCD_ALIASTABLE));
56 if (idx >= entries)
57 return nullstr;
58 return from_msg ? maliastbl[idx].as_name : paliastbl[idx].as_name;
59 #else /* CCDDATA_NO_ALIAS */
60 return nullstr;;
61 #endif /* CCDDATA_NO_ALIAS */
62 }