1putdata(3)                          GETDATA                         putdata(3)
2
3
4

NAME

6       putdata — write data to a dirfile database
7

SYNOPSIS

9       #include <getdata.h>
10
11       size_t putdata(DIRFILE *dirfile, const char *field_code, off_t
12              first_frame, off_t first_sample, size_t num_frames, size_t
13              num_samples, gd_type_t data_type, const void *data_in);
14

DESCRIPTION

16       The  putdata()  function writes data to a dirfile(5) database specified
17       by dirfile for the field field_code, which may not contain a  represen‐
18       tation suffix.  It writes num_frames frames plus num_samples samples to
19       this field, starting first_sample samples past frame first_frame.   The
20       data is read from the user-supplied buffer data_in, which is has a data
21       type specified by data_type.  This interface cannot write to field rep‐
22       resentations.
23
24       The  dirfile  argument  must point to a valid DIRFILE object previously
25       created by a call to dirfile_open(3).
26
27       The first sample written will be
28              first_frame * samples_per_frame + first_sample
29       as measured from the start of the dirfile, where  samples_per_frame  is
30       the  number of samples per frame as returned by get_spf(3).  The number
31       of samples which putdata() attempts to write is, similarly,
32              num_frames * samples_per_frame + num_samples.
33       Although calling putdata() using both samples and frames  is  possible,
34       the function is typically called with either num_samples and first_sam‐
35       ple, or num_frames and first_frames, equal to zero.
36
37       The data_type argument should be one of the  following  symbols,  which
38       indicates the type of the input data:
39
40              GD_UINT8   unsigned 8-bit integer
41
42              GD_INT8    signed (two's complement) 8-bit integer
43
44              GD_UINT16  unsigned 16-bit integer
45
46              GD_INT16   signed (two's complement) 16-bit integer
47
48              GD_UINT32  unsigned 32-bit integer
49
50              GD_INT32   signed (two's complement) 32-bit integer
51
52              GD_UINT64  unsigned 64-bit integer
53
54              GD_INT64   signed (two's complement) 64-bit integer
55
56              GD_FLOAT32 or GD_FLOAT
57                         IEEE-754  standard  32-bit  single precision floating
58                         point number
59
60              GD_FLOAT64 or GD_DOUBLE
61                         IEEE-754 standard 64-bit  double  precision  floating
62                         point number
63
64       The type of the input data need not be the same as the type of the data
65       stored in the database.  Type conversion will be performed as necessary
66       to  write  the  appropriate type.  The argument data_in must point to a
67       valid memory location of containing all the data to be written.
68

RETURN VALUE

70       In all cases, putdata() returns the number of samples (not bytes)  suc‐
71       cessfully  written  to  the database, which may be zero if an error has
72       occurred.
73
74       If an error has occurred, the dirfile error will be set to  a  non-zero
75       value.  Possible error values are:
76
77       GD_E_ACCMODE
78               The specified dirfile was opened read-only.
79
80       GD_E_ALLOC
81               The library was unable to allocate memory.
82
83       GD_E_BAD_CODE
84               The field specified by field_code, or one of the fields it uses
85               for input, was not found in the database.
86
87       GD_E_BAD_DIRFILE
88               An invalid dirfile was supplied.
89
90       GD_E_BAD_FIELD_TYPE
91               Either the field specified by field_code, or one of the  fields
92               it  uses  for  input, was of MULTIPLY type, or LINCOM type with
93               more than one input fields.  In this  case,  putdata()  has  no
94               knowledge on how to partition the input data.  Alternately, the
95               caller may have attempted to write to the implicit INDEX field,
96               which is not possible.
97
98       GD_E_BAD_REPR
99               The  representation  suffix  specified  in  field_code  was not
100               recognised, or an attempt was made to write to a  field  repre‐
101               sentation, instead of the underlying field.
102
103       GD_E_BAD_TYPE
104               An invalid data_type was specified.
105
106       GD_E_INTERNAL_ERROR
107               An  internal error occurred in the library while trying to per‐
108               form the task.  This indicates a bug in  the  library.   Please
109               report the incident to the maintainer.
110
111       GD_E_OPEN_LINFILE
112               An  error  occurred  while  trying to read a LINTERP table from
113               disk.
114
115       GD_E_PROTECTED
116               The data of the RAW field backing field_code was protected from
117               change by a PROTECT directive.
118
119       GD_E_RANGE
120               An attempt was made to write data before the beginning-of-frame
121               marker for field_code, or the raw field it depends on.
122
123       GD_E_RAW_IO
124               An error occurred while trying to open, read from, or write  to
125               a file on disk containing a raw field.
126
127       GD_E_RECURSE_LEVEL
128               Too  many  levels of recursion were encountered while trying to
129               resolve field_code.  This usually indicates a  circular  depen‐
130               dency in field specification in the dirfile.
131
132       GD_E_UNSUPPORTED
133               Reading from dirfiles with the encoding scheme of the specified
134               dirfile is not supported by the  library.   See  dirfile-encod‐
135               ing(5) for details on dirfile encoding schemes.
136
137       The dirfile error may be retrieved by calling get_error(3).  A descrip‐
138       tive error string for the last error encountered can be obtained from a
139       call to get_error_string(3).
140

SEE ALSO

142       dirfile(5), dirfile-encoding(5), dirfile_open(3), get_error(3), get_er‐
143       ror_string(3), get_spf(3)
144
145
146
147Version 0.6.0                   19 October 2009                     putdata(3)
Impressum