Skip to content

Commit

Permalink
Update build.yml to add a rnglib test build.
Browse files Browse the repository at this point in the history
Add a test for --enable-rnglibs
  • Loading branch information
Don-Ward committed Nov 14, 2024
1 parent 19a0de0 commit 3de3a0c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ jobs:
- { os: ubuntu-latest, name: 'Heap Test', opt: '--enable-debugheap --enable-verifyheap --enable-werror' }
- { os: ubuntu-latest, name: 'Thin Build', opt: '--enable-thin --enable-werror' }
- { os: ubuntu-latest, name: 'Dev Mode', opt: '--enable-devmode' }
- { os: ubuntu-latest, name: 'Rng Libraries', opt: '--enable-rnglibs' }
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
22 changes: 11 additions & 11 deletions src/h/cpuconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@

#ifndef F_Typecode
#define F_Typecode 0x2000000000000000 /* set if dword incls typecode*/
#endif /* F_Typecode */
#endif /* F_Typecode */

#ifdef RngLibrary
#define F_RngState 0x0800000000000000 /* set if RNG state */
#endif /* RngLibrary */
#endif /* WordBits == 64 */
#endif /* RngLibrary */
#endif /* WordBits == 64 */

/*
* 32-bit words.
Expand All @@ -73,15 +73,15 @@

#define MaxNegInt "-2147483648"

#define MaxStrLen 0777777777 /* maximum string length */
#define MaxStrLen 0777777777 /* maximum string length */

#define F_Nqual 0x80000000 /* set if NOT string qualifier */
#define F_Var 0x40000000 /* set if variable */
#define F_Ptr 0x10000000 /* set if value field is pointer */
#define F_Typecode 0x20000000 /* set if dword includes type code */
#define F_Nqual 0x80000000 /* set if NOT string qualifier */
#define F_Var 0x40000000 /* set if variable */
#define F_Ptr 0x10000000 /* set if value field is pointer */
#define F_Typecode 0x20000000 /* set if dword includes type code */
#ifdef RngLibrary
#define F_RngState 0x08000000 /* set if RNG state */
#endif /*RngLibrary */
#define F_RngState 0x08000000 /* set if RNG state */
#endif /*RngLibrary */

#define MaxNegInt "-2147483648"

Expand Down Expand Up @@ -134,7 +134,7 @@
#define MaxInt 077777 /* largest int */

#ifndef MaxListSlots
#define MaxListSlots 8000 /* largest list-element block */
#define MaxListSlots 8000 /* largest list-element block */
#endif /* MaxListSlots */

/*
Expand Down
6 changes: 2 additions & 4 deletions src/runtime/data.r
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,6 @@ struct descrip rngIconName;
struct b_cons *rngLibs; /* chain of loaded libraries */
#endif /* RngLibrary */
/*
* Run-time error numbers and text.
*/
Expand Down Expand Up @@ -424,12 +422,12 @@ struct errtab errtab[] = {
* for anything else. If any RNG wants more than 5 error messages,
* add some more boilerplate messages to the above.
*/

750, "Library not loaded",
751, "Function not found in PRNG library",
752, "startRng() failed",

#endif /* RngLibrary */
#endif /* RngLibrary */

#ifdef PosixFns
1040, "socket error",
Expand Down
7 changes: 4 additions & 3 deletions src/runtime/fmisc.r
Original file line number Diff line number Diff line change
Expand Up @@ -2706,13 +2706,14 @@ function{0,1} rngbits(n)
if (n == 0 ) n = curtstate->rng->info.property.blockBits;
elems = (((n+7)/8 + sizeof(word) - 1)/sizeof(word));
Protect(ap = (struct b_intarray *) alcintarray(elems), runerr(0));
reserve(Blocks, sizeof(struct b_list) + sizeof(struct b_intarray) + (elems - 1)* sizeof(word));
Protect(ap = (struct b_intarray *) alcintarray(elems), runerr(307));
if (0 > curtstate->rng->info.api.getRandomBits(n, &(ap->a[0]))) {
fail;
}
result.dword = D_List;
result.vword.bptr = (union block *)alclisthdr(elems, (union block *) ap);
Protect(result.vword.bptr = (union block *)alclisthdr(elems, (union block *) ap),runerr(307));
return result;
}
}
Expand Down Expand Up @@ -2760,7 +2761,7 @@ function{0,1} rngbitstring(n)
if ( 0 < curtstate->rng->info.api.getRandomBits(n, bitbuff)) {
/* Allocate a string of the required size for the answer */
Protect(StrLoc(result) = alcstr(NULL, n), runerr(0));
Protect(StrLoc(result) = alcstr(NULL, n), runerr(306));
/* Populate result with '0' and '1' characters.
* The bits are in the natural left to right reading order,
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/oasgn.r
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ int rngAsgnState(struct threadstate *ts, struct descrip v)
* if v is an intArray and the first element is the RNG id and the size
* is right, assign the rest of the array to the Rng State, otherwise refuse.
*/
if ((Type(v) == T_List) &&
if ((is:list(v)) &&
(v.vword.bptr->List.size == elems) &&
(v.vword.bptr->List.listhead->Intarray.title == T_Intarray) &&
(v.vword.bptr->List.listhead->Intarray.a[0] == ts->rng->info.id))
Expand Down

0 comments on commit 3de3a0c

Please sign in to comment.