- Add getline.c for Windows (msys) build
- Add man page, configure script, Makefile.in
- Update Makefile
- Replace random number generator (not for toybox)
- Change monosrc/mono.c to onefile/wak.c
- New improved makefile and a set of tests
- Fix bug assigning NF=0; add toybox test for it
- Fix bug assigning NF negative
- Add long options --help, --version
- Mute clang warnings
- Add tests for awk split() on empty regex (toybox)
- Fix out-of-bounds memory access in splitter()
- Rewrite record-reading routines
- Add tests (toybox)
- Fix field split bug when RS="" and FS is one char
- Add CHANGELOG.md, updated README.md
- Mod to permit RS="()" to work as it does in gawk, nawk, goawk
- Clean up compile code
- Fix field splitting and split() bugs
- Make srand() compliant with POSIX.2024 spec.
- Add test titled "getline var numeric string bug fixed 20240514" to test the "getline var" bug fixed 20240514.
- Fix implementation of nextfile statement. Was picking up "leftover" records in buffer from previous file.
- Add test for nextfile fix
- Add awk_exit() function to allow toybox to clean up on exit -- fixed ASAN mem leak complaint
- Fix "interactive" input behavior (see comments in issue #7)
-
Fix 'getline var' bug
'getline var' was not setting var as numeric string when needed. Found when running https://github.com/patsie75/awk-mandelbrot/raw/master/mandelbrot.awk
echo 5.0 | wak 'BEGIN { getline var; print (var < 10.0) }'
should print 1. Older versions of wak printed 0.
-
Update awk.test
Fix 64 bit rshift test; remove trailing spaces; a few other tweaks
-
clean up pass on run.c
Inline set_string(); rename val_to_str to to_str and val_to_num to to_num; replace str_to_num with atof; other cleanups
- Fix printf "%c" bug; fsprintf() cleanup; add tests
- printf "%c", "ú" printed wrong UTF-8; fixed. Still have printf/sprintf() bugs.
- Added toybox awk tests.
-
Improve printf/sprintf() format handling
Research help from @oliverkwebb
-
Implement \u escape for Unicode in scan.c
Authored by Oliver Webb
-
Implement -b in bytesinutf8() (fixes substr())
Also fixes mono.c that didn't get updated in prev. commit
Credit to Oliver Webb
-
Group Rob Landley's code together; add his copyright
Need a few functions from Landley's toybox when making standalone wak versions
-
Mod UTF-8 support to obviate most dynamic allocation
Mostly need to count codepoints in UTF-8 strings, so no need to allocate / free space for converted wide chars etc. Also allow for expansion in toupper() / tolower()
-
Add -b option (use bytes, not characters)
Authored by @oliverkwebb
-
Initial UTF-8 support
Research and initial implementation by @oliverkwebb
-
Merge rx_escape_str() into escape_str(), remove new_zstring_cap()
Cleanup to remove/combine code
Authored by @oliverkwebb
-
Move math builtin code into main interp loop
Inlined the math builtins into the main interpreter loop (thanks Oliver Webb), updated toybox test file with bitwise ops tests
-
Add bitwise operations
From Oliver Webb, add some bitwise functions from gawk.
-
Handle array deletions better
Hash insert to first vacant or first marked-deleted slot
-
Move setlocale(LC_NUMERIC, "") call
Do not do setlocale() on every conversion; just once at startup
-
Fix WEXITSTATUS() usage
-
Use random() / srandom() for toybox
-
Add toybox awk test file
Included original from toybox mailing list 2015: http://lists.landley.net/pipermail/toybox-landley.net/2015-March/015201.html. Had a couple bad tests.
-
Make file_or_pipe be 1/0 not 'f'/'p'
-
Tweak run.c format; move mathfunc[] into math_builtin(); rename time_ms() -> millinow()
-
Replace rx_compile(rx, pat) with xregcomp(rx, pat, REG_EXTENDED)
-
Remove unneeded inits of TT.scs elements
TT.scs points to a struct already inited to zero where it's allocated in awk().
-
Update Makefile: Use -f to ignore missing files on rm
-
Change exprn(n) to expr(n); expr() to expr(0)
- Remove debug code; replace envp with environ
-
Allow nul bytes in data files (not in source code yet). Still cannot have nul in multiline record (RS="") data. Work in progress.
-
Remove declarations for dev-only debugging build
Minor code cleanup of some code needed only for dev debugging build (not in repo).
-
Replace top of stack index with pointer
Profiling showed push_val() taking a lot of time. These changes make it several percent faster on many tests. Now test for stack getting close to overflow only at function call. Still possible if a source construct uses an absurd number of stack slots. Possible to test for that in compile phase but not yet worth the effort (and code space).
-
Fix memory leak in assign_global()
awk -v n=x 'BEGIN{f(n)};function f(n){}' caused a mem leak; see comment in assign_global(). Also tweak push_val(), zlist_append_zvalue(); change an exit(42) to exit(2).
-
Fix previous fix for comma flag in printf
Fixed (again) the regex for printf format. "-" needs to go first or else be escaped (to not be a range indicator). Moved "'" to end of "flags" bracket expression.
-
Match toybox error_exit() (puts newline at end); fix up error messages
-
Allow "'" in printf format for comma thousands separators; make ENVIRON init not modify program environment
- Update README.md
-
Mod Makefile to keep mono.c and toybox/awk.c after 'make clean'; add those sources to repo
-
Update scripts to make cleaner mono.c and toybox awk.c files with copyright etc.
-
For toybox awk, change -r opt to -c, fix up usage message
-
Minor code cleanup: Remove unref'd opt_print_source (common.h) and a few commented-out lines (compile.c)
-
Update run.c: Remove unneeded force_maybemap_to_scalar() calls
-
Update main.c: Drop bogus -p option; change -r opt to -c (compile only); avoid warning on ?: operator missing middle term
- bug fixes and cleanup: Fixed some problems with maybemap objects; allow newlines before 'while' in 'do{}while()'; some code cleanup
-
Close files at end of run, except stdin stdout stderr
-
Cleanup, incl upcasing #define's
toybox preferred style is uppercase #define names
-
Prelim handling of regex RS
RS can be a regex in most awks, though not in current POSIX spec. This may not be the best way but seems to work OK.
-
Simplify print, printf parsing
-
Minor code cleanup: Fixed a few comments; tweaked code in print_stmt() for compiling output modes.
-
Fix setup_lvalue() bug
setup_lvalue() can get a scalar in an array context and was leaving stack in a bad state. Fix to issue fatal diagnostic. Also tweak to keep ip always pointing to allocated space.
-
Clean up messages, message functions and exit code
Try to conform better to toybox conventions; merge some message code
-
Change option arg handling
Changed arrays of -f and -v options into linked lists (arg_list) as used in toybox
-
Update file handling
Change zfile array to linked list to reduce global space and remove limit on open files. Also format tweaks and minor fix to Makefile
-
Code format cleanup: Remove extra spaces, tweak comments, rename an enum.
-
Reformat lbp_table[], add a few comments, rename a couple of enums.
-
Updated top and bottom toybox_awk_parts
Mod to move globals into GLOBALS, use toybuf for pbuf (number formatting buffer), remove 'p' option flag (unused in toybox awk).
-
Update make_mono.awk
Fixed up to accommodate 0BSD license line.
-
Clean up scan.c
Move tokstr and prevtok into global TT; removed scan_div_ok() and scan_regex_ok(). Change MAX() to maxof() (for toybox).
-
Move pbuf[] (buffer for formatting number to string) into global TT struct. Set up in main(), uses toybuf in toybox.
-
Moved global variables into a struct named TT to conform with toybox design.
-
Merge: 25706ea 0bfd5db
-
Merge branch 'main' of https://github.com/raygard/wak
-
typedef removal
Toybox owner does not like typedefs.
-
Update LICENSE
Word-wrapped now.
-
Create LICENSE (0BSD)
-
Create README.md - Initial commit.
-
Add makefile and associated files
Initial commit. Makefile and files needed to make monolithic (one file) and toybox versions.
-
Skip missing ARGV elements in nextfilearg()
Was failing delargv.awk test. ARGV elements can be deleted, but should then be skipped when going to next file.
-
Set scalar or map (array) type on special variables, to catch type errors in compile phase.
- Code style cleanup pass
- Fix memory leak and type bug in setup_lvalue() (run.c)
-
Rewrite printf handling in run.c
-
Get compile error count as exit code
-
Setup locale in main.c (a la toybox)
- Clean up compile.c -- error messages, function names
-
Style -- remove space after '!'
-
Improve random number gen default seeding
-
Style -- replace most NULLs
-
First modularized version