1 /** D bindings for GSL.
2     Authors:    Chibisi Chima-Okereke
3     Copyright:  Copyright (c) 2016, Chibisi Chima-Okereke. All rights reserved.
4     License:    Boost License 1.0
5 */
6 
7 module gsl.block;
8 import core.stdc.stdio : FILE;
9 import core.stdc.config : c_long, c_ulong;
10 import gsl.errno;
11 
12 
13 extern (C):
14 
15 extern __gshared int gsl_check_range;
16 
17 // gsl_block_char
18 alias gsl_block_char_struct gsl_block_char;
19 
20 struct gsl_block_char_struct
21 {
22     size_t size;
23     char* data;
24 }
25 
26 gsl_block_char* gsl_block_char_alloc (const size_t n);
27 gsl_block_char* gsl_block_char_calloc (const size_t n);
28 void gsl_block_char_free (gsl_block_char* b);
29 int gsl_block_char_fread (FILE* stream, gsl_block_char* b);
30 int gsl_block_char_fwrite (FILE* stream, const(gsl_block_char)* b);
31 int gsl_block_char_fscanf (FILE* stream, gsl_block_char* b);
32 int gsl_block_char_fprintf (FILE* stream, const(gsl_block_char)* b, const(char)* format);
33 int gsl_block_char_raw_fread (FILE* stream, char* b, const size_t n, const size_t stride);
34 int gsl_block_char_raw_fwrite (FILE* stream, const(char)* b, const size_t n, const size_t stride);
35 int gsl_block_char_raw_fscanf (FILE* stream, char* b, const size_t n, const size_t stride);
36 int gsl_block_char_raw_fprintf (FILE* stream, const(char)* b, const size_t n, const size_t stride, const(char)* format);
37 size_t gsl_block_char_size (const(gsl_block_char)* b);
38 char* gsl_block_char_data (const(gsl_block_char)* b);
39 
40 // gsl_block_complex_float
41 alias gsl_block_complex_float_struct gsl_block_complex_float;
42 
43 struct gsl_block_complex_float_struct
44 {
45     size_t size;
46     float* data;
47 }
48 
49 gsl_block_complex_float* gsl_block_complex_float_alloc (const size_t n);
50 gsl_block_complex_float* gsl_block_complex_float_calloc (const size_t n);
51 void gsl_block_complex_float_free (gsl_block_complex_float* b);
52 int gsl_block_complex_float_fread (FILE* stream, gsl_block_complex_float* b);
53 int gsl_block_complex_float_fwrite (FILE* stream, const(gsl_block_complex_float)* b);
54 int gsl_block_complex_float_fscanf (FILE* stream, gsl_block_complex_float* b);
55 int gsl_block_complex_float_fprintf (FILE* stream, const(gsl_block_complex_float)* b, const(char)* format);
56 int gsl_block_complex_float_raw_fread (FILE* stream, float* b, const size_t n, const size_t stride);
57 int gsl_block_complex_float_raw_fwrite (FILE* stream, const(float)* b, const size_t n, const size_t stride);
58 int gsl_block_complex_float_raw_fscanf (FILE* stream, float* b, const size_t n, const size_t stride);
59 int gsl_block_complex_float_raw_fprintf (FILE* stream, const(float)* b, const size_t n, const size_t stride, const(char)* format);
60 size_t gsl_block_complex_float_size (const(gsl_block_complex_float)* b);
61 float* gsl_block_complex_float_data (const(gsl_block_complex_float)* b);
62 
63 
64 //gsl_block_complex
65 alias gsl_block_complex_struct gsl_block_complex;
66 
67 struct gsl_block_complex_struct
68 {
69     size_t size;
70     double* data;
71 }
72 
73 gsl_block_complex* gsl_block_complex_alloc (const size_t n);
74 gsl_block_complex* gsl_block_complex_calloc (const size_t n);
75 void gsl_block_complex_free (gsl_block_complex* b);
76 int gsl_block_complex_fread (FILE* stream, gsl_block_complex* b);
77 int gsl_block_complex_fwrite (FILE* stream, const(gsl_block_complex)* b);
78 int gsl_block_complex_fscanf (FILE* stream, gsl_block_complex* b);
79 int gsl_block_complex_fprintf (FILE* stream, const(gsl_block_complex)* b, const(char)* format);
80 int gsl_block_complex_raw_fread (FILE* stream, double* b, const size_t n, const size_t stride);
81 int gsl_block_complex_raw_fwrite (FILE* stream, const(double)* b, const size_t n, const size_t stride);
82 int gsl_block_complex_raw_fscanf (FILE* stream, double* b, const size_t n, const size_t stride);
83 int gsl_block_complex_raw_fprintf (FILE* stream, const(double)* b, const size_t n, const size_t stride, const(char)* format);
84 size_t gsl_block_complex_size (const(gsl_block_complex)* b);
85 double* gsl_block_complex_data (const(gsl_block_complex)* b);
86 
87 
88 // gsl_block_complex_long_double
89 alias gsl_block_complex_long_double_struct gsl_block_complex_long_double;
90 
91 struct gsl_block_complex_long_double_struct
92 {
93     size_t size;
94     real* data;
95 }
96 
97 gsl_block_complex_long_double* gsl_block_complex_long_double_alloc (const size_t n);
98 gsl_block_complex_long_double* gsl_block_complex_long_double_calloc (const size_t n);
99 void gsl_block_complex_long_double_free (gsl_block_complex_long_double* b);
100 int gsl_block_complex_long_double_fread (FILE* stream, gsl_block_complex_long_double* b);
101 int gsl_block_complex_long_double_fwrite (FILE* stream, const(gsl_block_complex_long_double)* b);
102 int gsl_block_complex_long_double_fscanf (FILE* stream, gsl_block_complex_long_double* b);
103 int gsl_block_complex_long_double_fprintf (FILE* stream, const(gsl_block_complex_long_double)* b, const(char)* format);
104 int gsl_block_complex_long_double_raw_fread (FILE* stream, real* b, const size_t n, const size_t stride);
105 int gsl_block_complex_long_double_raw_fwrite (FILE* stream, const(real)* b, const size_t n, const size_t stride);
106 int gsl_block_complex_long_double_raw_fscanf (FILE* stream, real* b, const size_t n, const size_t stride);
107 int gsl_block_complex_long_double_raw_fprintf (FILE* stream, const(real)* b, const size_t n, const size_t stride, const(char)* format);
108 size_t gsl_block_complex_long_double_size (const(gsl_block_complex_long_double)* b);
109 real* gsl_block_complex_long_double_data (const(gsl_block_complex_long_double)* b);
110 
111 
112 // gsl_block_double
113 alias gsl_block_struct gsl_block;
114 
115 struct gsl_block_struct
116 {
117     size_t size;
118     double* data;
119 }
120 
121 gsl_block* gsl_block_alloc (const size_t n);
122 gsl_block* gsl_block_calloc (const size_t n);
123 void gsl_block_free (gsl_block* b);
124 int gsl_block_fread (FILE* stream, gsl_block* b);
125 int gsl_block_fwrite (FILE* stream, const(gsl_block)* b);
126 int gsl_block_fscanf (FILE* stream, gsl_block* b);
127 int gsl_block_fprintf (FILE* stream, const(gsl_block)* b, const(char)* format);
128 int gsl_block_raw_fread (FILE* stream, double* b, const size_t n, const size_t stride);
129 int gsl_block_raw_fwrite (FILE* stream, const(double)* b, const size_t n, const size_t stride);
130 int gsl_block_raw_fscanf (FILE* stream, double* b, const size_t n, const size_t stride);
131 int gsl_block_raw_fprintf (FILE* stream, const(double)* b, const size_t n, const size_t stride, const(char)* format);
132 size_t gsl_block_size (const(gsl_block)* b);
133 double* gsl_block_data (const(gsl_block)* b);
134 
135 
136 // gsl_block_float
137 alias gsl_block_float_struct gsl_block_float;
138 
139 struct gsl_block_float_struct
140 {
141     size_t size;
142     float* data;
143 }
144 
145 gsl_block_float* gsl_block_float_alloc (const size_t n);
146 gsl_block_float* gsl_block_float_calloc (const size_t n);
147 void gsl_block_float_free (gsl_block_float* b);
148 int gsl_block_float_fread (FILE* stream, gsl_block_float* b);
149 int gsl_block_float_fwrite (FILE* stream, const(gsl_block_float)* b);
150 int gsl_block_float_fscanf (FILE* stream, gsl_block_float* b);
151 int gsl_block_float_fprintf (FILE* stream, const(gsl_block_float)* b, const(char)* format);
152 int gsl_block_float_raw_fread (FILE* stream, float* b, const size_t n, const size_t stride);
153 int gsl_block_float_raw_fwrite (FILE* stream, const(float)* b, const size_t n, const size_t stride);
154 int gsl_block_float_raw_fscanf (FILE* stream, float* b, const size_t n, const size_t stride);
155 int gsl_block_float_raw_fprintf (FILE* stream, const(float)* b, const size_t n, const size_t stride, const(char)* format);
156 size_t gsl_block_float_size (const(gsl_block_float)* b);
157 float* gsl_block_float_data (const(gsl_block_float)* b);
158 
159 // gsl_block_int
160 alias gsl_block_int_struct gsl_block_int;
161 
162 struct gsl_block_int_struct
163 {
164     size_t size;
165     int* data;
166 }
167 
168 gsl_block_int* gsl_block_int_alloc (const size_t n);
169 gsl_block_int* gsl_block_int_calloc (const size_t n);
170 void gsl_block_int_free (gsl_block_int* b);
171 int gsl_block_int_fread (FILE* stream, gsl_block_int* b);
172 int gsl_block_int_fwrite (FILE* stream, const(gsl_block_int)* b);
173 int gsl_block_int_fscanf (FILE* stream, gsl_block_int* b);
174 int gsl_block_int_fprintf (FILE* stream, const(gsl_block_int)* b, const(char)* format);
175 int gsl_block_int_raw_fread (FILE* stream, int* b, const size_t n, const size_t stride);
176 int gsl_block_int_raw_fwrite (FILE* stream, const(int)* b, const size_t n, const size_t stride);
177 int gsl_block_int_raw_fscanf (FILE* stream, int* b, const size_t n, const size_t stride);
178 int gsl_block_int_raw_fprintf (FILE* stream, const(int)* b, const size_t n, const size_t stride, const(char)* format);
179 size_t gsl_block_int_size (const(gsl_block_int)* b);
180 int* gsl_block_int_data (const(gsl_block_int)* b);
181 
182 
183 // gsl_block_long
184 alias gsl_block_long_struct gsl_block_long;
185 
186 struct gsl_block_long_struct
187 {
188     size_t size;
189     c_long* data;
190 }
191 
192 gsl_block_long* gsl_block_long_alloc (const size_t n);
193 gsl_block_long* gsl_block_long_calloc (const size_t n);
194 void gsl_block_long_free (gsl_block_long* b);
195 int gsl_block_long_fread (FILE* stream, gsl_block_long* b);
196 int gsl_block_long_fwrite (FILE* stream, const(gsl_block_long)* b);
197 int gsl_block_long_fscanf (FILE* stream, gsl_block_long* b);
198 int gsl_block_long_fprintf (FILE* stream, const(gsl_block_long)* b, const(char)* format);
199 int gsl_block_long_raw_fread (FILE* stream, c_long* b, const size_t n, const size_t stride);
200 int gsl_block_long_raw_fwrite (FILE* stream, const(c_long)* b, const size_t n, const size_t stride);
201 int gsl_block_long_raw_fscanf (FILE* stream, c_long* b, const size_t n, const size_t stride);
202 int gsl_block_long_raw_fprintf (FILE* stream, const(c_long)* b, const size_t n, const size_t stride, const(char)* format);
203 size_t gsl_block_long_size (const(gsl_block_long)* b);
204 c_long* gsl_block_long_data (const(gsl_block_long)* b);
205 
206 
207 // gsl_block_long_double
208 alias gsl_block_long_double_struct gsl_block_long_double;
209 
210 struct gsl_block_long_double_struct
211 {
212     size_t size;
213     real* data;
214 }
215 
216 gsl_block_long_double* gsl_block_long_double_alloc (const size_t n);
217 gsl_block_long_double* gsl_block_long_double_calloc (const size_t n);
218 void gsl_block_long_double_free (gsl_block_long_double* b);
219 int gsl_block_long_double_fread (FILE* stream, gsl_block_long_double* b);
220 int gsl_block_long_double_fwrite (FILE* stream, const(gsl_block_long_double)* b);
221 int gsl_block_long_double_fscanf (FILE* stream, gsl_block_long_double* b);
222 int gsl_block_long_double_fprintf (FILE* stream, const(gsl_block_long_double)* b, const(char)* format);
223 int gsl_block_long_double_raw_fread (FILE* stream, real* b, const size_t n, const size_t stride);
224 int gsl_block_long_double_raw_fwrite (FILE* stream, const(real)* b, const size_t n, const size_t stride);
225 int gsl_block_long_double_raw_fscanf (FILE* stream, real* b, const size_t n, const size_t stride);
226 int gsl_block_long_double_raw_fprintf (FILE* stream, const(real)* b, const size_t n, const size_t stride, const(char)* format);
227 size_t gsl_block_long_double_size (const(gsl_block_long_double)* b);
228 real* gsl_block_long_double_data (const(gsl_block_long_double)* b);
229 
230 
231 // gsl_block_short
232 alias gsl_block_short_struct gsl_block_short;
233 
234 struct gsl_block_short_struct
235 {
236     size_t size;
237     short* data;
238 }
239 
240 gsl_block_short* gsl_block_short_alloc (const size_t n);
241 gsl_block_short* gsl_block_short_calloc (const size_t n);
242 void gsl_block_short_free (gsl_block_short* b);
243 int gsl_block_short_fread (FILE* stream, gsl_block_short* b);
244 int gsl_block_short_fwrite (FILE* stream, const(gsl_block_short)* b);
245 int gsl_block_short_fscanf (FILE* stream, gsl_block_short* b);
246 int gsl_block_short_fprintf (FILE* stream, const(gsl_block_short)* b, const(char)* format);
247 int gsl_block_short_raw_fread (FILE* stream, short* b, const size_t n, const size_t stride);
248 int gsl_block_short_raw_fwrite (FILE* stream, const(short)* b, const size_t n, const size_t stride);
249 int gsl_block_short_raw_fscanf (FILE* stream, short* b, const size_t n, const size_t stride);
250 int gsl_block_short_raw_fprintf (FILE* stream, const(short)* b, const size_t n, const size_t stride, const(char)* format);
251 size_t gsl_block_short_size (const(gsl_block_short)* b);
252 short* gsl_block_short_data (const(gsl_block_short)* b);
253 
254 
255 // gsl_block_uchar
256 alias gsl_block_uchar_struct gsl_block_uchar;
257 
258 struct gsl_block_uchar_struct
259 {
260     size_t size;
261     ubyte* data;
262 }
263 
264 gsl_block_uchar* gsl_block_uchar_alloc (const size_t n);
265 gsl_block_uchar* gsl_block_uchar_calloc (const size_t n);
266 void gsl_block_uchar_free (gsl_block_uchar* b);
267 int gsl_block_uchar_fread (FILE* stream, gsl_block_uchar* b);
268 int gsl_block_uchar_fwrite (FILE* stream, const(gsl_block_uchar)* b);
269 int gsl_block_uchar_fscanf (FILE* stream, gsl_block_uchar* b);
270 int gsl_block_uchar_fprintf (FILE* stream, const(gsl_block_uchar)* b, const(char)* format);
271 int gsl_block_uchar_raw_fread (FILE* stream, ubyte* b, const size_t n, const size_t stride);
272 int gsl_block_uchar_raw_fwrite (FILE* stream, const(ubyte)* b, const size_t n, const size_t stride);
273 int gsl_block_uchar_raw_fscanf (FILE* stream, ubyte* b, const size_t n, const size_t stride);
274 int gsl_block_uchar_raw_fprintf (FILE* stream, const(ubyte)* b, const size_t n, const size_t stride, const(char)* format);
275 size_t gsl_block_uchar_size (const(gsl_block_uchar)* b);
276 ubyte* gsl_block_uchar_data (const(gsl_block_uchar)* b);
277 
278 
279 // gsl_block_uint
280 alias gsl_block_uint_struct gsl_block_uint;
281 
282 struct gsl_block_uint_struct
283 {
284     size_t size;
285     uint* data;
286 }
287 
288 gsl_block_uint* gsl_block_uint_alloc (const size_t n);
289 gsl_block_uint* gsl_block_uint_calloc (const size_t n);
290 void gsl_block_uint_free (gsl_block_uint* b);
291 int gsl_block_uint_fread (FILE* stream, gsl_block_uint* b);
292 int gsl_block_uint_fwrite (FILE* stream, const(gsl_block_uint)* b);
293 int gsl_block_uint_fscanf (FILE* stream, gsl_block_uint* b);
294 int gsl_block_uint_fprintf (FILE* stream, const(gsl_block_uint)* b, const(char)* format);
295 int gsl_block_uint_raw_fread (FILE* stream, uint* b, const size_t n, const size_t stride);
296 int gsl_block_uint_raw_fwrite (FILE* stream, const(uint)* b, const size_t n, const size_t stride);
297 int gsl_block_uint_raw_fscanf (FILE* stream, uint* b, const size_t n, const size_t stride);
298 int gsl_block_uint_raw_fprintf (FILE* stream, const(uint)* b, const size_t n, const size_t stride, const(char)* format);
299 size_t gsl_block_uint_size (const(gsl_block_uint)* b);
300 uint* gsl_block_uint_data (const(gsl_block_uint)* b);
301 
302 
303 // gsl_block_ulong
304 alias gsl_block_ulong_struct gsl_block_ulong;
305 
306 struct gsl_block_ulong_struct
307 {
308     size_t size;
309     c_ulong* data;
310 }
311 
312 gsl_block_ulong* gsl_block_ulong_alloc (const size_t n);
313 gsl_block_ulong* gsl_block_ulong_calloc (const size_t n);
314 void gsl_block_ulong_free (gsl_block_ulong* b);
315 int gsl_block_ulong_fread (FILE* stream, gsl_block_ulong* b);
316 int gsl_block_ulong_fwrite (FILE* stream, const(gsl_block_ulong)* b);
317 int gsl_block_ulong_fscanf (FILE* stream, gsl_block_ulong* b);
318 int gsl_block_ulong_fprintf (FILE* stream, const(gsl_block_ulong)* b, const(char)* format);
319 int gsl_block_ulong_raw_fread (FILE* stream, c_ulong* b, const size_t n, const size_t stride);
320 int gsl_block_ulong_raw_fwrite (FILE* stream, const(c_ulong)* b, const size_t n, const size_t stride);
321 int gsl_block_ulong_raw_fscanf (FILE* stream, c_ulong* b, const size_t n, const size_t stride);
322 int gsl_block_ulong_raw_fprintf (FILE* stream, const(c_ulong)* b, const size_t n, const size_t stride, const(char)* format);
323 size_t gsl_block_ulong_size (const(gsl_block_ulong)* b);
324 c_ulong* gsl_block_ulong_data (const(gsl_block_ulong)* b);
325 
326 
327 // gsl_block_ushort
328 alias gsl_block_ushort_struct gsl_block_ushort;
329 
330 struct gsl_block_ushort_struct
331 {
332     size_t size;
333     ushort* data;
334 }
335 
336 gsl_block_ushort* gsl_block_ushort_alloc (const size_t n);
337 gsl_block_ushort* gsl_block_ushort_calloc (const size_t n);
338 void gsl_block_ushort_free (gsl_block_ushort* b);
339 int gsl_block_ushort_fread (FILE* stream, gsl_block_ushort* b);
340 int gsl_block_ushort_fwrite (FILE* stream, const(gsl_block_ushort)* b);
341 int gsl_block_ushort_fscanf (FILE* stream, gsl_block_ushort* b);
342 int gsl_block_ushort_fprintf (FILE* stream, const(gsl_block_ushort)* b, const(char)* format);
343 int gsl_block_ushort_raw_fread (FILE* stream, ushort* b, const size_t n, const size_t stride);
344 int gsl_block_ushort_raw_fwrite (FILE* stream, const(ushort)* b, const size_t n, const size_t stride);
345 int gsl_block_ushort_raw_fscanf (FILE* stream, ushort* b, const size_t n, const size_t stride);
346 int gsl_block_ushort_raw_fprintf (FILE* stream, const(ushort)* b, const size_t n, const size_t stride, const(char)* format);
347 size_t gsl_block_ushort_size (const(gsl_block_ushort)* b);
348 ushort* gsl_block_ushort_data (const(gsl_block_ushort)* b);
349