1put_constant(3)                     GETDATA                    put_constant(3)
2
3
4

NAME

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

SYNOPSIS

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

DESCRIPTION

15       The put_constant() function queries a dirfile(5) database specified  by
16       dirfile  and sets the CONST scalar field_code , which may not contain a
17       representation suffix, to the value specified in data_in, which  should
18       be of the type indicated by data_type.
19
20       The  dirfile  argument  must point to a valid DIRFILE object previously
21       created by a call to dirfile_open(3).
22
23       The data_type argument should be one of the  following  symbols,  which
24       indicates the desired return type of the data:
25
26              GD_UINT8   unsigned 8-bit integer
27
28              GD_INT8    signed (two's complement) 8-bit integer
29
30              GD_UINT16  unsigned 16-bit integer
31
32              GD_INT16   signed (two's complement) 16-bit integer
33
34              GD_UINT32  unsigned 32-bit integer
35
36              GD_INT32   signed (two's complement) 32-bit integer
37
38              GD_UINT64  unsigned 64-bit integer
39
40              GD_INT64   signed (two's complement) 64-bit integer
41
42              GD_FLOAT32 or GD_FLOAT
43                         IEEE-754  standard  32-bit  single precision floating
44                         point number
45
46              GD_FLOAT64 or GD_DOUBLE
47                         IEEE-754 standard 64-bit  double  precision  floating
48                         point number
49
50       The data type of the supplied value need not be the same as the type of
51       the storage type of the constant in the database.  Type conversion will
52       be  performed  as necessary to return the requested type.  The argument
53       data_out must point to valid data type of the specified type.
54
55       Because constant values are stored in the  dirfile  metadata,  the  new
56       value of field_code won't be written to disk until the dirfile metadata
57       is flushed with dirfile_metaflush(3), or until the dirfile is closed.
58

RETURN VALUE

60       On success, put_constant() returns zero.  On error, it returns  -1  and
61       sets the dirfile error to a non-zero value.  Possible error values are:
62
63       GD_E_BAD_CODE
64               The  field  specified  by field_code was not found in the data‐
65               base.
66
67       GD_E_BAD_DIRFILE
68               An invalid dirfile was supplied.
69
70       GD_E_BAD_FIELD_TYPE
71               The supplied field_code referred to a field of type other  than
72               CONST.   The caller should use putdata(3), or put_string(3) in‐
73               stead.
74
75       GD_E_BAD_REPR
76               The representation  suffix  specified  in  field_code  was  not
77               recognised.
78
79       GD_E_BAD_TYPE
80               An invalid data_type was specified.
81
82       GD_E_INTERNAL_ERROR
83               An  internal error occurred in the library while trying to per‐
84               form the task.  This indicates a bug in  the  library.   Please
85               report the incident to the maintainer.
86
87       GD_E_PROTECTED
88               The fragment containing the constant was protected from change.
89
90       The dirfile error may be retrieved by calling get_error(3).  A descrip‐
91       tive error string for the last error encountered may be obtained from a
92       call to get_error_string(3).
93

SEE ALSO

95       dirfile(5), dirfile_metaflush(3), dirfile_open(3), getdata(3), get_con‐
96       stant(3), get_error(3), get_error_string(3), put_string(3), putdata(3)
97
98
99
100Version 0.6.0                   19 October 2009                put_constant(3)
Impressum