Debian Codegraph @

external/gsl/gsl_rng__default.c

raw symbols SCIP
1 /* rng/default.c
2 *
3 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 James Theiler, 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 <stdlib.h>
22 #include <stdio.h>
23 #include <string.h>
24 #include "gsl_rng.h"cxx . . $ `<file>/external/gsl/gsl_rng.h`/
25 #include "gsl_errno.h"cxx . . $ `<file>/external/gsl/gsl_errno.h`/
26
27 /* The initial defaults are defined in the file mt.c, so we can get
28 access to the static parts of the default generator. */
29
30 const gsl_rng_typecxx . . $ gsl_rng_type# *
31 gsl_rng_env_setupcxx . . $ gsl_rng_env_setup(cc9611cc9accb805). (void)
32 {
33 unsigned long int seed = 0;
34 const char *p = getenvcxx . . $ getenv(a8b8e32347182212). ("GSL_RNG_TYPE");
35
36 if (p)
37 {
38 const gsl_rng_typecxx . . $ gsl_rng_type# **t, **t0 = gsl_rng_types_setupcxx . . $ gsl_rng_types_setup(dab25953a2071cd3). ();
39
40 gsl_rng_defaultcxx . . $ gsl_rng_default. = 0;
41
42 /* check GSL_RNG_TYPE against the names of all the generators */
43
44 for (t = t0; *t != 0; t++)
45 {
46 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88). (p, (*t)->namecxx . . $ $anonymous_type_ec10d0a94d738359_0#name.) == 0)
47 {
48 gsl_rng_defaultcxx . . $ gsl_rng_default. = *t;
49 break;
50 }
51 }
52
53 if (gsl_rng_defaultcxx . . $ gsl_rng_default. == 0)
54 {
55 int i = 0;
56
57 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac). (stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "GSL_RNG_TYPE=%s not recognized\n", p);
58 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac). (stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Valid generator types are:\n");
59
60 for (t = t0; *t != 0; t++)
61 {
62 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac). (stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, " %18s", (*t)->namecxx . . $ $anonymous_type_ec10d0a94d738359_0#name.);
63
64 if ((++i) % 4 == 0)
65 {
66 fputccxx . . $ fputc(b1cd03d6c470d1bd). ('\n', stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!);
67 }
68 }
69
70 fputccxx . . $ fputc(b1cd03d6c470d1bd). ('\n', stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!);
71
72 GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("unknown generator", GSL_EINVAL, 0);
73 }
74
75 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac). (stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "GSL_RNG_TYPE=%s\n", gsl_rng_defaultcxx . . $ gsl_rng_default.->namecxx . . $ $anonymous_type_ec10d0a94d738359_0#name.);
76 }
77 else
78 {
79 gsl_rng_defaultcxx . . $ gsl_rng_default. = gsl_rng_mt19937cxx . . $ gsl_rng_mt19937.;
80 }
81
82 p = getenvcxx . . $ getenv(a8b8e32347182212). ("GSL_RNG_SEED");
83
84 if (p)
85 {
86 seed = strtoulcxx . . $ strtoul(31746e8d6ec49860). (p, 0, 0);
87 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac). (stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "GSL_RNG_SEED=%lu\n", seed);
88 };
89
90 gsl_rng_default_seedcxx . . $ gsl_rng_default_seed. = seed;
91
92 return gsl_rng_defaultcxx . . $ gsl_rng_default.;
93 }