diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9d4e7952a..b69698b2e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -190,6 +190,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@v3 diff --git a/src/h/cpuconf.h b/src/h/cpuconf.h index 53605cf08..beeabf4c1 100644 --- a/src/h/cpuconf.h +++ b/src/h/cpuconf.h @@ -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. @@ -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" @@ -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 */ /* diff --git a/src/runtime/data.r b/src/runtime/data.r index accc01a8d..edde7fc58 100644 --- a/src/runtime/data.r +++ b/src/runtime/data.r @@ -271,8 +271,6 @@ struct descrip rngIconName; struct b_cons *rngLibs; /* chain of loaded libraries */ #endif /* RngLibrary */ - - /* * Run-time error numbers and text. */ @@ -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", diff --git a/src/runtime/fmisc.r b/src/runtime/fmisc.r index 88c3ac9c3..c738b4e1d 100644 --- a/src/runtime/fmisc.r +++ b/src/runtime/fmisc.r @@ -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; } } @@ -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, diff --git a/src/runtime/oasgn.r b/src/runtime/oasgn.r index e9e909e0c..a32fac84a 100644 --- a/src/runtime/oasgn.r +++ b/src/runtime/oasgn.r @@ -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))