|
|
1.1 root 1: /* SYNTAX boolean ::= 'TRUE' | 'FALSE' */
2:
3: #include "quipu/util.h"
4: #include "quipu/attr.h"
5: #include "psap.h"
6:
7: strprint();
8: sfree();
9: pstrcmp();
10:
11: static PE boolenc (x)
12: char *x;
13: {
14: return (bool2prim (lexequ (x,"TRUE") ? 0 : 1));
15: }
16:
17: static char * booldec (pe)
18: PE pe;
19: {
20: if (! test_prim_pe (pe,PE_CLASS_UNIV,PE_PRIM_BOOL))
21: return (NULLCP);
22:
23: if (prim2flag (pe) == 1)
24: return (strdup ("TRUE"));
25: else
26: return (strdup ("FALSE"));
27: }
28:
29: static char * boolget (x)
30: char * x;
31: {
32: if ((lexequ (x,"TRUE") == 0) || (lexequ (x,"FALSE") == 0))
33: return (strdup(x));
34:
35: parse_error ("TRUE or FALSE expected (%s)",x);
36: return (NULLCP);
37: }
38:
39: boolean_syntax ()
40: {
41: (void) add_attribute_syntax ("boolean",
42: (IFP) boolenc, (IFP) booldec,
43: (IFP) boolget, strprint,
44: (IFP) strdup, pstrcmp,
45: sfree, NULLCP,
46: NULLIFP, FALSE);
47: }
48:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.