Debian Codegraph @

external/gsl/gsl_permutation__file.c

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