Home

Awesome

Bitlash Release Notes

Questions / Bug Reports / Pull Requests welcome! https://github.com/billroy/bitlash/issues

March 19, 2013: Type checking for string arguments

Bitlash supports string constants in function argument lists, but until now there hasn't been a way to distinguish such string arguments from numeric arguments once you're inside the called function, making it easy to reference forbidden memory by mistake.

The new isstr() Bitlash function helps handle this problem by letting you check the type of a specified argument to the function it's called in:

> function stringy {i=1;while (i<=arg(0)) {print i,arg(i),isstr(i);i++}}
saved
> stringy("foo",1,2,3,"bar","baz")
1 541 1
2 1 0
3 2 0
4 3 0
5 545 1
6 549 1

There is a corresponding C api for C User Functions:

numvar isstringarg(numvar);

And a companion to getarg() that fetches an argument but throws an error if the argument is not a string:

numvar getstringarg(numvar);

Here is an example sketch with a User Function called echo() that uses isstringarg() and getstringarg() to print string arguments separately from numeric ones. The echo() function echoes back its arguments, with proper handling for strings:

#include "Arduino.h"
#include "bitlash.h"
#include "src/bitlash.h"  // for sp() and printInteger()

numvar func_echo(void) {
	for (int i=1; i <= getarg(0); i++) {
		if (isstringarg(i)) sp((const char *) getstringarg(i));
		else printInteger(getarg(i), 0, ' ');
		speol();
	}
}

void setup(void) {
	initBitlash(57600);	
	addBitlashFunction("echo", (bitlash_function) func_echo);	
}

void loop(void) {
	runBitlash();
}

NOTE: The changes consume a little space on the expression evaluation stack, so some complex expressions that formerly worked may see an expression overflow. Please report this if you see it.

March 18, 2013: Bitlash running on Due

Feb 2013

November 10, 2012

November 3, 2012

Recent Bitlash changes of note:

Bitlash Due Version compiles under Arduino 1.5

September 10, 2012

2.0 RC5 Release Notes -- April 3, 2012

2.0 RC4 Release Notes -- September 29, 2011

2.0 RC3d Release Notes -- June 4, 2011

Quick Start for SD Card Support:

Quick Start without SD Card Support:

Summary for this version:

Running Bitlash scripts from sd card

- put your multi-line script on an SD card and run it from the command line
	- example: bitlashcode/memdump
	- example: bitlashcode/vars

- //comments work (comment to end of line)

- functions are looked up in this priority / order:
	- internal function table
	- user C function table (addBitlashFunction(...))
	- Bitlash functions in EEPROM
	- Bitlash functions in files on SD card

- beware name conflicts: a script on SD card can't override a function in EEPROM

- BUG: the run command only works with EEPROM functions
	- it does not work with file functions
	- for now, to use run with a file function, use this workaround:
		- make a small EEPROM function to call your file function
		- run the the EEPROM function

- startup and prompt functions on sd card are honored, if they exist

- you can upload files using bitlashcode/bloader.py
	- python bloader.py memdump md
		... uploads memdump as "md"

2.0 RC2 -- 06 March 2011

This release fixes a bug in RC1 which broke function definition in some cases.

Please report bugs to bill@bitlash.net

BUG: Function definition was broken if the line contained ; or additionalcommands

If the command defining the function was the last thing on a line, RC1 worked correctly:

function hello {print "Hello, world!"}		<-- worked

If there were characters after the closing } of the function definition, the bug caused the function text to be mismeasured and spurious text would be appended to the function definition, causing it to fail in use:

> function hello { print "Hello, world!"};	<-- this is legal but it triggered bug in RC1
saved
> ls
function hello { print "Hello, world"}};	<-- BUG: extra } saved at the end

The function text is measured more accurately in RC2.

Users are encouraged to upgrade to fix this bug.

Existing functions may need to be fixed, as well. Make sure the {} balance.

Defining a function within a function fails. That's ok, for now.

Noting a behavior that may change in a future release: an attempt to define a function from within a function will fail silently or worse. Don't do that.

function foo {function bar{print "bar"};bar};	<-- don't do this!
> foo
saved
> ls
function foo {function bar{print "bar"};bar};
function bar {};	<-- sorry, doesn't work in 2.0
> bar
> 

This isn't new: Bitlash 1.1 has the same internal implementation limitation, but it was nearly impossible for a human to get the backslash-quote combinations right to attempt the test.

2.0 RC1 -- 05 Feb 2011

1.1 -- 04 Feb 2010

1.0 -- 17 Jan 2010

1.0rc2 -- 22 Jun 2009

1.0rc1 -- 01 Jun 2009

0.9 -- 23 Nov 2008

0.8 -- 31 Oct 2008