msteveb/jimtcl — pull request #6 by vadim-z (2012-07-14 13:16:09+00:00)
Title: Support for floating-point numbers to binary format/scan. 

I have added the (experimental) support for floating-point numbers to binary format/scan. Please review it and commit to the mainline.

The following major changes are made:
1. pack/unpack support the floating-point numbers. The handing is done through conversion of FP numbers to/from jim_wide and then dealing with them using existing functions.
2. binary format/scan support the floating-point specifiers (f/r/R/d/q/Q). The code is basically duplicated from integer branch with some unnecessary checks removed.
3. Test suite for binary command is changed. binary-scan.test and binary-format.test are merged together and tests for floating-point numbers are included (see below).
4. The changes above are documented and Tcl_shipped.html is regenerated.

The following other changes were introduced:
1. binary scan now returns immediately if the source string isn't long enough for the current argument. This behaviour is compliant with Tcl. Technically, couple of 'contunue' were replaced with 'break'. I've added the test binary-66.1 to check that.
2. Jim_DoubleToString now produces 'NaN', not 'Nan'.
3. Regexp to parse the format string in binary is changed. No tests fail with the new regexp, but some additional checks would be useful.
4. Misc changes (bundle fresh linenoise, fix auto.def for readline a bit).

Almost all tests from Tcl test suite are passed as is. Notable differences are the following:
1. Floating-point overflow in binary format leads to Infinity, not to FLT_MAX as in Tcl.
2. Jim_DoubleToString uses other textual representation for numbers compared to Tcl. Some tests were modified, some are skipped.
3. Fancy NaN(some_hex_stuff) are not supported. These tests are skipped.

I have done tests under amd64 Linux. Other platforms were not tested. I can test under 32-bit Windows later.