[Commit]
nickle math.5c,1.35,1.36 nickle.1.in,1.15,1.16 prng.5c,1.7,1.8
Bart Massey
commit at keithp.com
Sun Jun 1 21:31:05 PDT 2003
Committed by: bart
Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv2476
Modified Files:
math.5c nickle.1.in prng.5c
Log Message:
added atoi() and atof()
Index: math.5c
===================================================================
RCS file: /local/src/CVS/nickle/math.5c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- math.5c 7 Feb 2003 21:00:33 -0000 1.35
+++ math.5c 2 Jun 2003 03:31:02 -0000 1.36
@@ -870,4 +870,6 @@
}
-import Math;
+/* XXX these shouldn't be here, but it was *convenient* */
+&int(string, int ...) atoi = &string_to_integer;
+&rational(string) atof = &string_to_real;
Index: nickle.1.in
===================================================================
RCS file: /local/src/CVS/nickle/nickle.1.in,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- nickle.1.in 10 Dec 2002 00:34:25 -0000 1.15
+++ nickle.1.in 2 Jun 2003 03:31:02 -0000 1.16
@@ -659,16 +659,17 @@
.IP "real imprecise(rational value, int prec)"
See the discussion of type real above.
.IP "int string_to_integer(string s)"
-Like the C atoi() function.
+.IP "int atoi(string s)"
The argument s is a signed digit string, and
the result is the integer it represents.
-If the string s appears to be a hexadecimal,
-octal, binary, or explicit base-10 constant
-as given above, then assume that it is.
+If the string s is syntactically a hexadecimal,
+octal, binary, or explicit base-10 constant,
+treat it as such.
.IP "int string_to_integer(string s, int base)"
+.IP "int atoi(string s, int base)"
Treat s as a string of digits in the given base.
-A base of 0 tries to pick a sensible
-default base as in the previous paragraph.
+A base of 0 acts as with no base argument.
+Otherwise, base specification syntax in the string is ignored.
.IP "int putchar(int c)"
Place the given character on the standard output
using File::putc(c, stdout), and return its result.
@@ -690,6 +691,7 @@
into storage and return a pointer to
the box.
.IP "rational string_to_real(string s)"
+.IP "rational atof(string s)"
Convert the real constant string s into
its associated real number.
.IP "number abs(real v)"
Index: prng.5c
===================================================================
RCS file: /local/src/CVS/nickle/prng.5c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- prng.5c 11 Apr 2003 20:58:57 -0000 1.7
+++ prng.5c 2 Jun 2003 03:31:02 -0000 1.8
@@ -17,7 +17,7 @@
}
public void dev_srandom(int nbits) {
- twixt(file f = open("/dev/random", "r"); close(f)) {
+ twixt(file f = open("/dev/urandom", "r"); close(f)) {
int seed = 0;
while (nbits >= 8) {
seed = (seed << 8) | getb(f);
More information about the Commit
mailing list