8000 Introduce loadable pseudo-random number generators. by Don-Ward · Pull Request #200 · uniconproject/unicon · GitHub
[go: up one dir, main page]

Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0e71b65
Preparation for loadable Random Number Generators (rnglibs).
Don-Ward Mar 22, 2022
1613ad4
Add rnglib <-> runtime API and new standard functions.
Don-Ward Mar 22, 2022
5ce511e
Add rnglib definitions to &features and the Unicon preprocessor
Don-Ward Mar 22, 2022
64f9d5f
Modify &random and the ? operator to use rnglibs.
Don-Ward Mar 22, 2022
ad7dbc3
Add prnglib failure codes and boilerplate error messages.
Don-Ward Mar 22, 2022
dd0c602
Make GC aware of (and collect) rnglib structures.
Don-Ward Mar 22, 2022
b834443
Add the rngIconEx loadable library.
Don-Ward Mar 22, 2022
e1a126d
Add the rngRbt loadable library.
Don-Ward Mar 22, 2022
adc3c32
Add the rngRlx++ loadable library.
Don-Ward Mar 22, 2022
f88615d
Add the rngGSL loadable library.
Don-Ward Mar 22, 2022
9c7fedf
Modify the Unicon build process to include rng loadable libraries.
Don-Ward Mar 22, 2022
12ff379
Add rnglib test programs.
Don-Ward Mar 22, 2022
27720cf
Document the new rnglib features in Appendix G of the Unicon book.
Don-Ward Mar 22, 2022
7c2fa58
Initial draft of a utr that describes the rnglib changes.
Don-Ward Mar 22, 2022
a76dbd8
Fix typo in the name of the rngRbt directory.
Don-Ward Mar 22, 2022
2e060f1
Update build.yml to add a rnglib test build.
Don-Ward Mar 15, 2022
c3ff9b3
runtime: avoid name collision with getrandom() from libc [Jafar Al-Gh…
Don-Ward Jul 1, 2024
0e430d8
Accomodate differences between 32-bit and 64-bit builds of rngRbt
Don-Ward Jul 30, 2024
0580ac8
Update endianness tests when building rngRbt.
Don-Ward May 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
runtime: avoid name collision with getrandom() from libc [Jafar Al-Gh…
…araibeh]

This is a slight rework of commit 27b385c. It is needed because the
PRNG code uses unicon_getrandom() in fmisc.r as well as init.r
  • Loading branch information
Don-Ward committed May 11, 2025
commit c3ff9b3e38bf1ac80c86b542f8b3686780de6d4b
1 change: 1 addition & 0 deletions src/h/rproto.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ int fldlookup (struct b_record *rec, const char * const fld);
void fpetrap (void);

int getenv_r (const char *name, char *buf, size_t len);
word unicon_getrandom(void);
int getvar (char *s,dptr vp);

int getkeyword (char *s, dptr vp);
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/fmisc.r
Original file line number Diff line number Diff line change
Expand Up @@ -2842,7 +2842,7 @@ body {
/* Revert to built-in rngIcon */
curtstate->rng = NULL;
curtstate->Kywd_ran = zerodesc;
IntVal(curtstate->Kywd_ran) = getrandom(); /* Reinitialize */
IntVal(curtstate->Kywd_ran) = unicon_getrandom(); /* Reinitialize */
} else {
#ifndef Arrays
/* The rng state is stored as an array of integers */
Expand Down Expand Up @@ -2965,7 +2965,7 @@ body {
/* Call startRng */
{
struct rng_rt_api api;
api.getInitialBits = getrandom;
api.getInitialBits = unicon_getrandom;
api.getRngState = getRngState;
api.putErrorCode = putErrorCode;

Expand Down
3 changes: 1 addition & 2 deletions src/runtime/init.r
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ static FILE * readhdr (char *name, struct header *hdr);
/*
* Prototypes.
*/
static word unicon_getrandom(void);
static void env_err (char *msg, char *name, char *val);
FILE *pathOpen (char *fname, char *mode);

Expand Down Expand Up @@ -1675,7 +1674,7 @@ int err()
return strcmp(a->pstrep, b->pstrep);
}

static word unicon_getrandom(void)
word unicon_getrandom()
{
#ifndef NoRandomize
/*
Expand Down
0