File: cqdtype.x

package info (click to toggle)
iraf 2.18.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 86,000 kB
  • sloc: ansic: 115,890; fortran: 74,576; lisp: 18,888; yacc: 5,642; sh: 961; lex: 596; makefile: 509; asm: 159; csh: 54; xml: 33; sed: 4
file content (53 lines) | stat: -rw-r--r-- 997 bytes parent folder | download | duplicates (4)
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