1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
# CQ_DTYPE -- Decode the field data type.
define NTYPES 6
# CQ_DTYPE -- Given a single character data type from the set [csilrd] return
# the appropriate integer type,
int procedure cq_dtype (c)
char c
int type_codes[NTYPES], i
string types "csilrd"
int stridx()
data type_codes /TY_CHAR, TY_SHORT, TY_INT, TY_LONG, TY_REAL, TY_DOUBLE/
begin
i = stridx (c, types)
if (i == 0)
return (TY_CHAR)
else
return (type_codes[stridx(c,types)])
end
# CQ_ITYPE -- Given an integer code from the set TY_CHAR, TY_SHORT, TY_INT,
# TY_LONG, TY_REAL, and TY_DOUBLE return the appropriate character code
# from the set [csilrd].
char procedure cq_itype (itype)
int itype #I the integer data type
char c
begin
switch (itype) {
case TY_CHAR:
c = 'c'
case TY_SHORT:
c = 's'
case TY_INT:
c = 'i'
case TY_LONG:
c = 'l'
case TY_REAL:
c = 'r'
case TY_DOUBLE:
c = 'd'
default:
c = 'c'
}
return (c)
end
|