1
2
3
4
5
6
7
8
9gd_put_carray_slice(3)              GETDATA             gd_put_carray_slice(3)
10
11
12

NAME

14       gd_put_carray,  gd_put_carray_slice,  gd_put_constant  — write CONST or
15       CARRAY data to a dirfile database
16
17

SYNOPSIS

19       #include <getdata.h>
20
21       int gd_put_carray_slice(DIRFILE *dirfile, const char *field_code,
22              unsigned int start, size_t len, gd_type_t data_type, const void
23              *data_in);
24
25       int gd_put_carray(DIRFILE *dirfile, const char *field_code, gd_type_t
26              data_type, const void *data_in);
27
28       int gd_put_constant(DIRFILE *dirfile, const char *field_code, gd_type_t
29              data_type, const void *data_in);
30
31

DESCRIPTION

33       The gd_put_carray_slice() function writes data to a dirfile(5) database
34       specified by dirfile into the CARRAY scalar array field_code.  The data
35       in the field is converted from the data type  specified  by  data_type,
36       and read from in the user-supplied buffer data_in.  The location of the
37       first element of the field into which data is stored is given by start,
38       and the number of elements stored is given by len.
39
40       The gd_put_carray() function behaves similarly, except the whole scalar
41       array is written, as if gd_put_carray_slice() were  called  with  start
42       equal zero and len equal to the value returned by gd_array_len(3).  The
43       gd_put_constant()     function     is     equivalent     to     calling
44       gd_put_carray_slice()  with  start  equal to zero and len equal to one.
45       None of these interfaces can write to field representations.
46
47       The argument data_in must point to a valid memory  location  containing
48       all  the  data  to  be  written.   The number of elements which will be
49       stored by gd_put_carray() may be obtained by  calling  gd_array_len(3).
50       Unlike  gd_putdata(3),  writing  data  past the end of the field is not
51       permitted.  To add data to a CARRAY, first increase its length by call‐
52       ing gd_alter_carray(3), or another equivalent function.
53
54       The  data_type  argument  should be one of the following symbols, which
55       indicates the type of the data pointed to by data_in:
56
57              GD_UINT8   unsigned 8-bit integer
58
59              GD_INT8 signed (two's complement) 8-bit integer
60
61              GD_UINT16
62                      unsigned 16-bit integer
63
64              GD_INT16
65                      signed (two's complement) 16-bit integer
66
67              GD_UINT32
68                      unsigned 32-bit integer
69
70              GD_INT32
71                      signed (two's complement) 32-bit integer
72
73              GD_UINT64
74                      unsigned 64-bit integer
75
76              GD_INT64
77                      signed (two's complement) 64-bit integer
78
79              GD_FLOAT32
80                      IEEE-754 standard 32-bit single precision floating point
81                      number
82
83              GD_FLOAT64
84                      IEEE-754 standard 64-bit double precision floating point
85                      number
86
87              GD_COMPLEX64
88                      C99-conformant 64-bit single precision complex number
89
90              GD_COMPLEX128
91                      C99-conformant 128-bit double precision complex number
92
93       The type of the input data need not be the same as the storage type  of
94       the  field.   Type  conversion will be performed as necessary to return
95       the requested type.  The dirfile argument must point to a valid DIRFILE
96       object previously created by a call to gd_open(3).
97
98

RETURN VALUE

100       On      success,     gd_put_carray(),     gd_put_carray_slice()     and
101       gd_put_constant() return zero.  On error, they return a negative-valued
102       error code.  Possible error codes are:
103
104       GD_E_ACCMODE
105               The specified dirfile was opened read-only.
106
107       GD_E_ALLOC
108               The library was unable to allocate memory.
109
110       GD_E_BAD_CODE
111               The  field  specified  by field_code was not found in the data‐
112               base.
113
114       GD_E_BAD_DIRFILE
115               The supplied dirfile was invalid.
116
117       GD_E_BAD_FIELD_TYPE
118               The supplied field_code was not a CONST nor a CARRAY.
119
120       GD_E_BAD_TYPE
121               An invalid data_type was specified.
122
123       GD_E_BOUNDS
124               A request for data beyond the end of the field was made.
125
126       GD_E_INTERNAL_ERROR
127               An internal error occurred in the library while trying to  per‐
128               form  the  task.   This indicates a bug in the library.  Please
129               report the incident to the maintainer.
130
131       GD_E_PROTECTED
132               The fragment containing the constant was protected from change.
133
134       The error code is also stored in the DIRFILE  object  and  may  be  re‐
135       trieved after this function returns by calling gd_error(3).  A descrip‐
136       tive  error  string  for  the  error  may  be   obtained   by   calling
137       gd_error_string(3).
138
139

HISTORY

141       The put_constant() function appeared in GetData-0.4.0.
142
143       In  GetData-0.7.0, this function was renamed to gd_put_constant().  The
144       functions gd_put_carray() and gd_put_carray_slice() functions also  ap‐
145       peared in this release.
146
147       In  GetData-0.10.0, the error return from this function changed from -1
148       to a negative-valued error code.
149
150

SEE ALSO

152       dirfile(5),      gd_array_len(3),      gd_carrays(3),      gd_error(3),
153       gd_error_string(3),         gd_get_carray_slice(3),         gd_open(3),
154       gd_put_constant(3)
155
156
157
158Version 0.10.0                 25 December 2016         gd_put_carray_slice(3)
Impressum