fixed a few bugs in awk

- improved input console file and ARGV handling.
- fixed bugs in the builtin rand() function.
- added a new option to rex.
- fixed a control flow handling bug in for(x in y) of awk.
This commit is contained in:
2009-06-11 07:18:25 +00:00
parent a326e5f17f
commit fd1c529c46
20 changed files with 295 additions and 284 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: StdAwk.cpp 182 2009-06-03 21:50:32Z hyunghwan.chung $
* $Id: StdAwk.cpp 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -217,7 +217,7 @@ int StdAwk::fnint (Run& run, Return& ret, const Argument* args, size_t nargs,
int StdAwk::rand (Run& run, Return& ret, const Argument* args, size_t nargs,
const char_t* name, size_t len)
{
return ret.set ((long_t)::rand());
return ret.set ((real_t)(::rand() % RAND_MAX) / RAND_MAX);
}
int StdAwk::srand (Run& run, Return& ret, const Argument* args, size_t nargs,