1get_constant(3)                     GETDATA                    get_constant(3)
2
3
4

NAME

6       get_constant — retrieve a scalar constant from a dirfile database
7

SYNOPSIS

9       #include <getdata.h>
10
11       int get_constant(DIRFILE *dirfile, const char *field_code, gd_type_t
12              return_type, void *data_out);
13

DESCRIPTION

15       The get_constant() function queries a dirfile(5) database specified  by
16       dirfile  for the CONST scalar field_code, which may contain a represen‐
17       tation suffix.  The constant is converted to the data type specified by
18       return_type, and stored in the user-supplied buffer data_out.
19
20       The  dirfile  argument  must point to a valid DIRFILE object previously
21       created by a call to dirfile_open(3).  The argument data_out must point
22       to  a  valid  memory location of sufficient size to hold a value of the
23       return type specified.
24
25       The return_type argument should be one of the following symbols,  which
26       indicates the desired return type of the data:
27
28              GD_UINT8   unsigned 8-bit integer
29
30              GD_INT8    signed (two's complement) 8-bit integer
31
32              GD_UINT16  unsigned 16-bit integer
33
34              GD_INT16   signed (two's complement) 16-bit integer
35
36              GD_UINT32  unsigned 32-bit integer
37
38              GD_INT32   signed (two's complement) 32-bit integer
39
40              GD_UINT64  unsigned 64-bit integer
41
42              GD_INT64   signed (two's complement) 64-bit integer
43
44              GD_FLOAT32 IEEE-754  standard  32-bit  single precision floating
45                         point number
46
47              GD_FLOAT64 IEEE-754 standard 64-bit  double  precision  floating
48                         point number
49
50              GD_COMPLEX64
51                         C99-conformant 64-bit single precision complex number
52
53              GD_COMPLEX128
54                         C99-conformant  128-bit double precision complex num‐
55                         ber
56
57              GD_NULL    the null type: the database is queried as usual,  but
58                         no  data  is returned.  In this case, data_out is ig‐
59                         nored and may be NULL.
60
61       The return type of the constant need not be the same as the type of the
62       data stored in the database.  Type conversion will be performed as nec‐
63       essary to return the requested type.  If the field_code does not  indi‐
64       cate  a representation, but conversion from a complex value to a purely
65       real one is required, only the real portion  of  the  requested  vector
66       will be returned.
67

RETURN VALUE

69       On  success,  get_constant() returns zero.  On error, it returns -1 and
70       sets the dirfile error to a non-zero value.  Possible error values are:
71
72       GD_E_BAD_CODE
73               The field specified by field_code was not found  in  the  data‐
74               base.
75
76       GD_E_BAD_DIRFILE
77               An invalid dirfile was supplied.
78
79       GD_E_BAD_FIELD_TYPE
80               The  supplied  field_code  referred  to a field of a type other
81               than CONST.  The caller should use getdata(3), or get_string(3)
82               instead.
83
84       GD_E_BAD_REPR
85               The  representation suffix specified in fieldcode, or in one of
86               the field codes it uses for input, was invalid.
87
88       GD_E_BAD_TYPE
89               An invalid return_type was specified.
90
91       GD_E_INTERNAL_ERROR
92               An internal error occurred in the library while trying to  per‐
93               form  the  task.   This indicates a bug in the library.  Please
94               report the incident to the maintainer.
95
96       The dirfile error may be retrieved by calling get_error(3).  A descrip‐
97       tive error string for the last error encountered may be obtained from a
98       call to get_error_string(3).
99

SEE ALSO

101       dirfile(5), dirfile_open(3),  get_constants(3),  get_error(3),  get_er‐
102       ror_string(3), put_constant(3)
103
104
105
106Version 0.6.0                   19 October 2009                get_constant(3)
Impressum