Add support for glob -directory

Implement support for the -directory option to the [glob]
command. The -tails option is accepted for Tcl compatibility,
but ignored; the command always behaves as if -tails were given.
Allow abbreviations to glob options

Signed-off-by: Steve Bennett <steveb@workware.net.au>
Add tests for the glob command

Signed-off-by: Steve Bennett <steveb@workware.net.au>
Fix the check of readline library.
Fix binary scan for too-few bytes.

According to the Tcl manual, in this case "binary scan returns immediately
with the number of variables that were set".

(Tests added by Steve Bennett)

Signed-off-by: Steve Bennett <steveb@workware.net.au>
Fix bug that was causing the system "environ" variable to be freed, which caused mayhem in stdio etc.
Fix a linenoise bug when moving off the left

If the buffer is too big to fit in the window and the cursor
would move off the left edge of the windows, the display
is not shown correctly.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
bug in sqlite module (array index out of bounds)

Invalid array indexing in error message (array index out of bounds).
Fix linenoise serial console window size for vt102

This includes minicom, which doesn't support hpa (CHA), only cuf.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
Use sqlite3_prepare_v2()

When I'm working with SQLite3 databases in Jim, I find that I occasionally
get a 'schema has changed' error so I end up using catch to detect the
error and try the query again.

Here's a quick patch to change the SQLite3 extension to use the
sqlite3_prepare_v2() API function instead of sqlite3_prepare() - trivial
but the _v2() function has a number of benefits and everyone should have a
new enough SQLite3 library to support it. Please can you consider it for
inclusion?

See - http://www.sqlite.org/c3ref/prepare.html

The benefit I'm specifically interested in is:

With the _v2() variant, "If the database schema changes, instead of
returning SQLITE_SCHEMA as it always used to do, sqlite3_step() will
automatically recompile the SQL statement and try to run it again."
Update linenoise.c to match recent github

From git://github.com/msteveb/linenoise.git

Allow tab-completion only at the end of line
Replace magic number 9 with '\t' in linenoisePrompt()
Fix several warnings from gcc.
Fix first-chance exceptions in Windows - WriteConsoleOutputCharacter() didn't have its final parameter set
Add MSVC support - Test for _WIN32 to check for building for Windows.
Fix [string replace] replacing single char

Also added some additional tests

Signed-off-by: Steve Bennett <steveb@workware.net.au>
Precompute operator length for JimParseExprOperator, optimize logic

No regressions, no changes in bench.tcl.

JimParseExprOperator was shockingly inefficient, to the point of taking 63% of cpu
in my own app.

It did a linear search over >60 structs, re-computing the string length each time, and
doing a string comparison for each.

This patch pre-computes the operator string length, speeding the function up by two.

Adding the first-letter fast path and evaluating length before strncmp make for
another 2x speedup, making the total speedup 4x.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Shuffle Jim_Obj to shrink it on 64bit (72 -> 64), removing holes

No perf difference measured using bench.tcl.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Make expr array more compact

Signed-off-by: Steve Bennett <steveb@workware.net.au>
Shuffle ExprByteCode to reduce size on 64-bit (24->16)

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Trivial optimisation

Signed-off-by: Steve Bennett <steveb@workware.net.au>
Shuffle ScanFmtPartDescr to reduce size (40 -> 32)

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Put short-lived hash iterator allocations on the stack

No reason to have these on the heap for such short whiles.
They are small (32 bytes) and only used within the same function.

v2: The external interface is preserved.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Avoid list allocations under four pointers (16/32 bytes)

It's more overhead than usable space to get space for two pointers.

Signed-off-by: Lauri Kasanen <cand@gmx.com>