diff options
-rw-r--r-- | packages/base/hmatrix.cabal | 6 | ||||
-rw-r--r-- | packages/base/src/Internal/C/windows_random_r.c | 4 | ||||
-rw-r--r-- | packages/base/src/Internal/C/windows_random_r.h | 20 |
3 files changed, 17 insertions, 13 deletions
diff --git a/packages/base/hmatrix.cabal b/packages/base/hmatrix.cabal index e248886..9b8b108 100644 --- a/packages/base/hmatrix.cabal +++ b/packages/base/hmatrix.cabal | |||
@@ -25,7 +25,7 @@ build-type: Simple | |||
25 | extra-source-files: THANKS.md CHANGELOG | 25 | extra-source-files: THANKS.md CHANGELOG |
26 | 26 | ||
27 | extra-source-files: src/Internal/C/lapack-aux.h | 27 | extra-source-files: src/Internal/C/lapack-aux.h |
28 | src/Internal/C/windows_random_r.h | 28 | src/C/windows_random_r.h |
29 | 29 | ||
30 | flag openblas | 30 | flag openblas |
31 | description: Link with OpenBLAS (https://github.com/xianyi/OpenBLAS) optimized libraries. | 31 | description: Link with OpenBLAS (https://github.com/xianyi/OpenBLAS) optimized libraries. |
@@ -75,10 +75,10 @@ library | |||
75 | Internal.Util | 75 | Internal.Util |
76 | Internal.Modular | 76 | Internal.Modular |
77 | Internal.Static | 77 | Internal.Static |
78 | 78 | ||
79 | C-sources: src/Internal/C/lapack-aux.c | 79 | C-sources: src/Internal/C/lapack-aux.c |
80 | src/Internal/C/vector-aux.c | 80 | src/Internal/C/vector-aux.c |
81 | src/Internal/C/windows_random_r.c | 81 | src/C/windows_random_r.c |
82 | 82 | ||
83 | 83 | ||
84 | extensions: ForeignFunctionInterface, | 84 | extensions: ForeignFunctionInterface, |
diff --git a/packages/base/src/Internal/C/windows_random_r.c b/packages/base/src/Internal/C/windows_random_r.c index 872cb2e..c16d96f 100644 --- a/packages/base/src/Internal/C/windows_random_r.c +++ b/packages/base/src/Internal/C/windows_random_r.c | |||
@@ -53,7 +53,7 @@ | |||
53 | * Rewritten to be reentrant by Ulrich Drepper, 1995 | 53 | * Rewritten to be reentrant by Ulrich Drepper, 1995 |
54 | */ | 54 | */ |
55 | 55 | ||
56 | #include "windows_random_r.h" | 56 | #include "myrandom.h" |
57 | 57 | ||
58 | /* An improved random number generation package. In addition to the standard | 58 | /* An improved random number generation package. In addition to the standard |
59 | rand()/srand() like interface, this package also has a special state info | 59 | rand()/srand() like interface, this package also has a special state info |
@@ -388,5 +388,5 @@ int random_r (struct random_data *buf, int32_t *result) | |||
388 | return -1; | 388 | return -1; |
389 | } | 389 | } |
390 | 390 | ||
391 | int windows_random_r; | 391 | int my_errno; |
392 | #endif \ No newline at end of file | 392 | #endif \ No newline at end of file |
diff --git a/packages/base/src/Internal/C/windows_random_r.h b/packages/base/src/Internal/C/windows_random_r.h index 4f4d32f..c05caa7 100644 --- a/packages/base/src/Internal/C/windows_random_r.h +++ b/packages/base/src/Internal/C/windows_random_r.h | |||
@@ -1,28 +1,32 @@ | |||
1 | #if defined(_WIN32) || defined(WIN32) | 1 | #if defined(_WIN32) || defined(WIN32) |
2 | 2 | ||
3 | #ifndef WINDOWS_RANDOM_R_H | 3 | #ifndef MYRANDOM_H |
4 | #define WINDOWS_RANDOM_R_H | 4 | #define MYRANDOM_H |
5 | 5 | ||
6 | #include <stddef.h> | 6 | #include <stddef.h> |
7 | 7 | ||
8 | #define NULL 0 | ||
9 | |||
8 | #define EINVAL 23 | 10 | #define EINVAL 23 |
9 | 11 | ||
10 | typedef int int32_t; | 12 | typedef int int32_t; |
11 | 13 | ||
12 | struct random_data | 14 | struct random_data |
13 | { | 15 | { |
14 | int *fptr; /* Front pointer. */ | 16 | int32_t *fptr; /* Front pointer. */ |
15 | int *rptr; /* Rear pointer. */ | 17 | int32_t *rptr; /* Rear pointer. */ |
16 | int *state; /* Array of state values. */ | 18 | int32_t *state; /* Array of state values. */ |
17 | int rand_type; /* Type of random number generator. */ | 19 | int rand_type; /* Type of random number generator. */ |
18 | int rand_deg; /* Degree of random number generator. */ | 20 | int rand_deg; /* Degree of random number generator. */ |
19 | int rand_sep; /* Distance between front and rear. */ | 21 | int rand_sep; /* Distance between front and rear. */ |
20 | int *end_ptr; /* Pointer behind state table. */ | 22 | int32_t *end_ptr; /* Pointer behind state table. */ |
21 | }; | 23 | }; |
22 | 24 | ||
23 | extern int windows_random_r_errno; | ||
24 | 25 | ||
25 | static inline void __set_errno(int err) { windows_random_r_errno = err; }; | 26 | #define errno my_errno |
27 | extern int my_errno; | ||
28 | |||
29 | static inline void __set_errno(int err) { my_errno = err; }; | ||
26 | 30 | ||
27 | int random_r (struct random_data *buf, int32_t *result); | 31 | int random_r (struct random_data *buf, int32_t *result); |
28 | 32 | ||