Skip to content

Commit 27d1067

Browse files
committed
Update build.yml to add a rnglib test build.
Add a test for --enable-rnglibs
1 parent 185979e commit 27d1067

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ jobs:
200200
- { os: ubuntu-latest, name: 'Heap Test', opt: '--enable-debugheap --enable-verifyheap --enable-werror' }
201201
- { os: ubuntu-latest, name: 'Thin Build', opt: '--enable-thin --enable-werror' }
202202
- { os: ubuntu-latest, name: 'Dev Mode', opt: '--enable-devmode' }
203+
- { os: ubuntu-latest, name: 'Rng Libraries', opt: '--enable-rnglibs' }
203204
steps:
204205
- name: Checkout
205206
uses: actions/checkout@v4

src/h/cpuconf.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@
5555

5656
#ifndef F_Typecode
5757
#define F_Typecode 0x2000000000000000 /* set if dword incls typecode*/
58-
#endif /* F_Typecode */
58+
#endif /* F_Typecode */
5959

6060
#ifdef RngLibrary
6161
#define F_RngState 0x0800000000000000 /* set if RNG state */
62-
#endif /* RngLibrary */
63-
#endif /* WordBits == 64 */
62+
#endif /* RngLibrary */
63+
#endif /* WordBits == 64 */
6464

6565
/*
6666
* 32-bit words.
@@ -73,15 +73,15 @@
7373

7474
#define MaxNegInt "-2147483648"
7575

76-
#define MaxStrLen 0777777777 /* maximum string length */
76+
#define MaxStrLen 0777777777 /* maximum string length */
7777

78-
#define F_Nqual 0x80000000 /* set if NOT string qualifier */
79-
#define F_Var 0x40000000 /* set if variable */
80-
#define F_Ptr 0x10000000 /* set if value field is pointer */
81-
#define F_Typecode 0x20000000 /* set if dword includes type code */
78+
#define F_Nqual 0x80000000 /* set if NOT string qualifier */
79+
#define F_Var 0x40000000 /* set if variable */
80+
#define F_Ptr 0x10000000 /* set if value field is pointer */
81+
#define F_Typecode 0x20000000 /* set if dword includes type code */
8282
#ifdef RngLibrary
83-
#define F_RngState 0x08000000 /* set if RNG state */
84-
#endif /*RngLibrary */
83+
#define F_RngState 0x08000000 /* set if RNG state */
84+
#endif /*RngLibrary */
8585

8686
#define MaxNegInt "-2147483648"
8787

@@ -134,7 +134,7 @@
134134
#define MaxInt 077777 /* largest int */
135135

136136
#ifndef MaxListSlots
137-
#define MaxListSlots 8000 /* largest list-element block */
137+
#define MaxListSlots 8000 /* largest list-element block */
138138
#endif /* MaxListSlots */
139139

140140
/*

src/runtime/data.r

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,6 @@ struct descrip rngIconName;
271271
struct b_cons *rngLibs; /* chain of loaded libraries */
272272
#endif /* RngLibrary */
273273
274-
275-
276274
/*
277275
* Run-time error numbers and text.
278276
*/
@@ -424,12 +422,12 @@ struct errtab errtab[] = {
424422
* for anything else. If any RNG wants more than 5 error messages,
425423
* add some more boilerplate messages to the above.
426424
*/
427-
425+
428426
750, "Library not loaded",
429427
751, "Function not found in PRNG library",
430428
752, "startRng() failed",
431429

432-
#endif /* RngLibrary */
430+
#endif /* RngLibrary */
433431

434432
#ifdef PosixFns
435433
1040, "socket error",

src/runtime/fmisc.r

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,13 +2706,14 @@ function{0,1} rngbits(n)
27062706
if (n == 0 ) n = curtstate->rng->info.property.blockBits;
27072707
27082708
elems = (((n+7)/8 + sizeof(word) - 1)/sizeof(word));
2709-
Protect(ap = (struct b_intarray *) alcintarray(elems), runerr(0));
2709+
reserve(Blocks, sizeof(struct b_list) + sizeof(struct b_intarray) + (elems - 1)* sizeof(word));
2710+
Protect(ap = (struct b_intarray *) alcintarray(elems), runerr(307));
27102711
if (0 > curtstate->rng->info.api.getRandomBits(n, &(ap->a[0]))) {
27112712
fail;
27122713
}
27132714
27142715
result.dword = D_List;
2715-
result.vword.bptr = (union block *)alclisthdr(elems, (union block *) ap);
2716+
Protect(result.vword.bptr = (union block *)alclisthdr(elems, (union block *) ap),runerr(307));
27162717
return result;
27172718
}
27182719
}
@@ -2760,7 +2761,7 @@ function{0,1} rngbitstring(n)
27602761
27612762
if ( 0 < curtstate->rng->info.api.getRandomBits(n, bitbuff)) {
27622763
/* Allocate a string of the required size for the answer */
2763-
Protect(StrLoc(result) = alcstr(NULL, n), runerr(0));
2764+
Protect(StrLoc(result) = alcstr(NULL, n), runerr(306));
27642765
27652766
/* Populate result with '0' and '1' characters.
27662767
* The bits are in the natural left to right reading order,

src/runtime/oasgn.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ int rngAsgnState(struct threadstate *ts, struct descrip v)
1515
* if v is an intArray and the first element is the RNG id and the size
1616
* is right, assign the rest of the array to the Rng State, otherwise refuse.
1717
*/
18-
if ((Type(v) == T_List) &&
18+
if ((is:list(v)) &&
1919
(v.vword.bptr->List.size == elems) &&
2020
(v.vword.bptr->List.listhead->Intarray.title == T_Intarray) &&
2121
(v.vword.bptr->List.listhead->Intarray.a[0] == ts->rng->info.id))

0 commit comments

Comments
 (0)