Debian Codegraph @

external/gsl/gsl_combination__file.c

raw symbols SCIP
1 /* combination/file.c
2 * based on permutation/file.c by Brian Gough
3 *
4 * Copyright (C) 2001 Szymon Jaroszewicz
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or (at
9 * your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21 #include "gsl__config.h"cxx . . $ `<file>/external/gsl/gsl__config.h`/
22 #include <stdio.h>
23 #include "gsl_errno.h"cxx . . $ `<file>/external/gsl/gsl_errno.h`/
24 #include "gsl_combination.h"cxx . . $ `<file>/external/gsl/gsl_combination.h`/
25
26 #define IN_FORMATcxx . . $ `external/gsl/gsl_combination__file.c:26:9`! "%lu"
27
28 int
29 gsl_combination_freadcxx . . $ gsl_combination_fread(9e42499e7bf363da). (FILEcxx . . $ FILE# * stream, gsl_combinationcxx . . $ gsl_combination# * c)
30 {
31 size_t k = c->kcxx . . $ gsl_combination_struct#k. ;
32
33 size_t * data = c->datacxx . . $ gsl_combination_struct#data. ;
34
35 size_t items = freadcxx . . $ fread(738fc8ac1d711e58). (data, sizeof (size_t), k, stream);
36
37 if (items != k)
38 {
39 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("fread failed", GSL_EFAILED);
40 }
41
42 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
43 }
44
45 int
46 gsl_combination_fwritecxx . . $ gsl_combination_fwrite(ee242fa2f9e118f2). (FILEcxx . . $ FILE# * stream, const gsl_combinationcxx . . $ gsl_combination# * c)
47 {
48 size_t k = c->kcxx . . $ gsl_combination_struct#k. ;
49
50 size_t * data = c->datacxx . . $ gsl_combination_struct#data. ;
51
52 size_t items = fwritecxx . . $ fwrite(ab0609fa07c47d6e). (data, sizeof (size_t), k, stream);
53
54 if (items != k)
55 {
56 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("fwrite failed", GSL_EFAILED);
57 }
58
59 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
60 }
61
62 int
63 gsl_combination_fprintfcxx . . $ gsl_combination_fprintf(1734ba4eef349dd3). (FILEcxx . . $ FILE# * stream, const gsl_combinationcxx . . $ gsl_combination# * c, const char *format)
64 {
65 size_t k = c->kcxx . . $ gsl_combination_struct#k. ;
66
67 size_t * data = c->datacxx . . $ gsl_combination_struct#data. ;
68
69 size_t i;
70
71 for (i = 0; i < k; i++)
72 {
73 int status = fprintfcxx . . $ fprintf(bc216f8e5b1ebeac). (stream, format, data[i]);
74
75 if (status < 0)
76 {
77 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("fprintf failed", GSL_EFAILED);
78 }
79 }
80
81 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
82 }
83
84 int
85 gsl_combination_fscanfcxx . . $ gsl_combination_fscanf(9e42499e7bf363da). (FILEcxx . . $ FILE# * stream, gsl_combinationcxx . . $ gsl_combination# * c)
86 {
87 size_t k = c->kcxx . . $ gsl_combination_struct#k. ;
88
89 size_t * data = c->datacxx . . $ gsl_combination_struct#data. ;
90
91 size_t i;
92
93 for (i = 0; i < k; i++)
94 {
95 unsigned long j ;
96
97 /* FIXME: what if size_t != unsigned long ???
98
99 want read in size_t but have to read in unsigned long to avoid
100 error from compiler */
101
102 int status = fscanfcxx . . $ fscanf(bc216f8e5b1ebeac). (stream, IN_FORMATcxx . . $ `external/gsl/gsl_combination__file.c:26:9`!, &j);
103
104 if (status != 1)
105 {
106 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("fscanf failed", GSL_EFAILED);
107 }
108
109 data[i] = j;
110 }
111
112 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
113 }
114