1 #include "csf.h"
2
3 /* global header (opt.) and strconst's prototypes "" */
4
5
6 /* headers of this app. modules called */
7
8 /***************/
9 /* EXTERNALS */
10 /***************/
11
12 /**********************/
13 /* LOCAL DECLARATIONS */
14 /**********************/
15
16 /*********************/
17 /* LOCAL DEFINITIONS */
18 /*********************/
19 static char errorBuf[64];
20 /******************/
21 /* IMPLEMENTATION */
22 /******************/
23
24 /* string with cell representation in plain English or acronym
25 * The string is in lower case except for INT1,INT2,UINT2 and UINT4
26 *, they return an acronym. If cr is not
27 * a valid constant, for example 999, then the string is
28 * "999 is no CR constant".
29 * The "no constant" message is stored in a static buffer
30 * used by both RstrCellRepr and RstrValueScale.
31 * returns
32 * string with cell representation
33 */
RstrCellRepr(CSF_CR cr)34 const char *RstrCellRepr(CSF_CR cr) /* cell representation constant */
35 {
36 switch(cr) {
37 case CR_INT1 : return "INT1";
38 case CR_INT2 : return "INT2";
39 case CR_INT4 : return "large integer";
40 case CR_UINT1 : return "small integer";
41 case CR_UINT2 : return "UINT2";
42 case CR_UINT4 : return "UINT4";
43 case CR_REAL4 : return "small real";
44 case CR_REAL8 : return "large real";
45 default : (void)snprintf(errorBuf, sizeof(errorBuf), "%u is no CR constant", (unsigned)cr);
46 return errorBuf;
47 }
48 }
49
50 /* string with value scale
51 * The string is in lower case. If cr is not
52 * a valid constant, for example 999, then the string is
53 * "999 is no VS constant".
54 * The "no constant" message is stored in a static buffer
55 * used by both RstrCellRepr and RstrValueScale.
56 * returns
57 * string with value scale in lower case
58 */
RstrValueScale(CSF_VS vs)59 const char *RstrValueScale(CSF_VS vs) /* value scale constant */
60 {
61 switch(vs) {
62 case VS_NOTDETERMINED : return "notdetermined";
63 case VS_CLASSIFIED : return "classified";
64 case VS_CONTINUOUS : return "continuous";
65 case VS_BOOLEAN : return "boolean";
66 case VS_NOMINAL : return "nominal";
67 case VS_ORDINAL : return "ordinal";
68 case VS_SCALAR : return "scalar";
69 case VS_DIRECTION : return "directional";
70 case VS_LDD : return "ldd";
71 default : (void)snprintf(errorBuf, sizeof(errorBuf), "%u is no VS constant", (unsigned)vs);
72 return errorBuf;
73 }
74 }
75
76 /* string with projection
77 * The string is in lower case.
78 * string with name of projection
79 */
MstrProjection(CSF_PT p)80 const char *MstrProjection(CSF_PT p) /* projection constant, 0 is
81 * top to bottom. non-0 is bottom
82 * to top
83 */
84 {
85 return (p) ?
86 "y increases from bottom to top"
87 :"y increases from top to bottom";
88 }
89