Comments (16)
Thanks for the report. I believe the same fix that addresses issue #3 may address this one. I tested on Ubuntu, Screen version 4.00.03jw4. Code is in commit b612b7 for src/bitlash-cmdline.c. I'll leave this issue open in the hope you'll update it once you get a chance to test. Thanks,
-br
from bitlash.
the issue persists both when I type and when I ctrl-v.
Also, if for example (by mistake) you put a html link the same happens (pointing at the : )
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345line overflow
e �
( �
( �
( �
( �
( �
( �
(
as
---^
unexpected number
-------^
unexpected number
t �
( �
( �
( �
(
from bitlash.
Thanks for the update. Well that is odd. With the patch applied, there is no code anywhere in Bitlash to generate a Line overflow. Could you please post the contents of your copy of src/bitlash-cmdline.c?
from bitlash.
you still have overflow on:
bitlash-parser.c:58: "expected \0unexpected \0missing \0string\0 underflow\0 overflow\0^C\0^B\0^U\0exp\0op\0:xby+-*/\0eof\0var\0number\0)\0saved\0eeprom\0:="\0> \0line\0char\0stack\0startup\0id\0prompt\0\r\nFunctions:\0oops\0arg\0function\0"
#include "bitlash.h"
// Serial command line buffer
char *lbufptr;
char lbuf[LBUFLEN];
// Help text
//
#ifdef ARDUINO_BUILD
const prog_char helptext[] PROGMEM = { "http://bitlash.net\r\nSee LICENSE for license\r\nPins: d0-22,a0-22 Variables: a-z, 32 bit long integers\r\nOperators: + - * / ( ) < <= > >= == != << >> ! ^ & | ++ -- :=\r\nCommands: \0" };
#else
const prog_char helptext[] PROGMEM = { "http://bitlash.net\r\n\0" };
#endif
void showdict(const prog_char *addr) {
byte c;
for (;;) {
c = pgm_read_byte(addr++);
if (c == 255) return;
else if (c == 0) {
if (pgm_read_byte(addr) == 0) return;
else spb(' ');
}
else if (c != '`') spb(c);
}
}
void displayBanner(void);
void cmd_help(void) {
displayBanner();
showdict(helptext);
showdict(reservedwords);
msgp(M_functions);
#ifdef LONG_ALIASES
showdict(aliasdict);
speol();
#endif
showdict(functiondict);
speol();
show_user_functions();
speol();
void cmd_ls(void);
cmd_ls();
}
void prompt(void) {
char buf[IDLEN+1];
// Run the script named "prompt" if there is one else print "> "
strncpy_P(buf, getmsg(M_promptid), IDLEN); // get the name "prompt" in our cmd buf
if (findscript(buf)) doCommand(buf);
else msgp(M_prompt); // else print default prompt
}
void initlbuf(void) {
lbufptr = lbuf;
#if defined(SERIAL_OVERRIDE) && 0
// don't do the prompt in serialIsOverridden mode
if (serialIsOverridden()) return;
#endif
prompt();
// flush any pending serial input
while (serialAvailable()) serialRead();
}
// Add a character to the input line buffer; overflow if needed
byte putlbuf(char c) {
if (lbufptr < lbuf + LBUFLEN - 2) {
*lbufptr++ = c;
spb(c);
return 1;
}
else {
spb(7); // beep
return 0;
}
}
void pointToError(void) {
if (fetchtype == SCRIPT_RAM) {
int i = (char *) fetchptr - lbuf;
if ((i < 0) || (i >= LBUFLEN)) return;
speol();
while (i-- >= 0) spb('-');
spb('^'); speol();
}
}
// run the bitlash command line editor and hand off commands to the interpreter
//
// call frequently, e.g. from loop(), or risk losing serial input
// note that doCommand blocks until it returns, so looping in a while() will delay other tasks
//
///////////////////////
// handle a character from the input stream
// may execute the command, etc.
//
void doCharacter(char c) {
if ((c == '\r') || (c == '\n') || (c == '`')) {
speol();
*lbufptr = 0;
doCommand(lbuf);
initlbuf();
}
else if (c == 3) { // ^C break/stop
msgpl(M_ctrlc);
initTaskList();
initlbuf();
}
else if (c == 2) { // ^B suspend Background macros
suspendBackground = !suspendBackground;
}
else if ((c == 8) || (c == 0x7f)) {
if (lbufptr == lbuf) spb(7); // bell
else {
spb(8); spb(' '); spb(8);
*(--lbufptr) = 0;
}
}
#ifdef PARSER_TRACE
else if (c == 20) { // ^T toggle trace
trace = !trace;
//spb(7);
}
#endif
else if (c == 21) { // ^U to get last line
msgpl(M_ctrlu);
prompt();
sp(lbuf);
lbufptr = lbuf + strlen(lbuf);
}
else putlbuf(c);
}
/////////////////////////////
//
// runBitlash
//
// This is the main entry point where the main loop gives Bitlash cycles
// Call this frequently from loop()
//
void runBitlash(void) {
// Pipe the serial input into the command handler
if (serialAvailable()) doCharacter(serialRead());
// Background macro handler: feed it one call each time through
runBackgroundTasks();
}
from bitlash.
Thanks for the quick reply. That is the correct code, so we still have a puzzle.
It's true that the strings "overflow" and "line" are still in place, but at least here I cannot find any remaining calls to "overflow(M_line)" after the changes I just made to bitlash-cmdline.c. You might grep the src/ directory to double-check me. So the patched version of Bitlash should not be able to emit that line overflow that you are observing. Other overflows, of course.
I hate to theorize like this but one has to ask: Is it possible that you somehow have a stale binary on the Arduino? Because I can't figure out how else Bitlash can say "line overflow". It doesn't do that any more, with the patch.
If not that, I'm short of theories. Any ideas at your end? I should add this all works happily here:
bitlash here! v2.0 RC5pre (c) 2011 Bill Roy -type HELP- 973 bytes free
print 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
1
One random thought that is worth a quick check: does it help if you comment out the call to traceback() at line 47 in src/bitlash-error.c?
Any further thoughts/data/ideas welcome.
-br
from bitlash.
You are completely correct. After shutting down arduino and re-compiling now there's no error anymore.
Perfect!
Congratulations and Thanks
In the same line, is it possible to have a multi line command?
Also,
if I put an weird command such as a link:
#2 (comment)
I get the result:
-------^
unexpected number
tBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
from bitlash.
Glad we could corner and eliminate that one. Whew.
The parser is actually capable of handling multi line input text - though the SD card example shows it sometimes takes great lengths. But you can't type such commands in using the built-in line editor. I am guessing you want a multi line input editor, which would indeed be nice. And I accept code contributions...
I'm still puzzled by the character spew you are seeing after the error message text is printed. It is happening right where the traceback is supposed to be printed, and I suspect the bug is there. If you haven't already done so, comment out the call to traceback() at line 47-ish in src/bitlash-error.c to prevent the traceback from being printed, and let me know if the behavior is any better. Thanks.
-br
from bitlash.
yes. no traceback.
any guidance on where could i implement the multiline?
although not 100% fluent in c++ (i work mostly with python and perl), I think I can help.
from bitlash.
If traceback is off then I'm very puzzled again about the runaway printing after the error. Could it be a free ram issue, I wonder? How much free ram do you have at startup? I will give this a further think.
Regarding multiline: The current single-line editor is in the file we're looking at now: bitlash-cmdline.c; that's where you might start to think about multiline, perhaps replacing doCharacter() with something smarter. The editor's job is to assemble a null-terminated buffer of text and pass it to doCommand(). It currently uses one fixed-length buffer, linebuf, to do that. You could make linebuf bigger, for starters, but do mind your free ram.
You won't find much C++ in Bitlash; it's mostly C for space reasons. I don't think it will be difficult if you already are comfortable in Python and Perl.
-br
from bitlash.
Just a thought: Do you have a "prompt" function? That's the next thing after the traceback.
from bitlash.
created by myself overriding the system's one?
no
from bitlash.
I've had no new inspirations overnight about a possible cause for the runaway output.
Maybe the "const prog_char" changes have an impact somehow? Anyway, could you post your bitlash directory to github so I can pull it down and try to reproduce the problem here?
from bitlash.
I've deleted it all and pull from your site. no mods
from bitlash.
I believe this is fixed in commit 5cfc04b. Please let me know.
from bitlash.
problem fixed.
now if I type a wrong command, only a warning appears. No need to reset anymore.
Thanks
from bitlash.
Glad to see it's fixed; closing this issue.
from bitlash.
Related Issues (20)
- Talk to arduino without >command HOT 6
- run bitlash code stored in flash HOT 5
- eeprom overflow error with bitlash run command for a user defined function HOT 3
- Blank user function causes following functions not to appear HOT 2
- Port to spark-core or esp-8266 HOT 7
- Not working on new Arduino.. HOT 9
- Can't save user functions to startup? HOT 27
- Deleted-cant add user functions to memory
- Cant add more then 9 commands inside startup functions
- No support for bypass serial
- Serial flash support? HOT 2
- No need to wait after Wire.requestFrom().
- LED was very dim when using bitlash HOT 1
- bitlash demo - blink does not blink HOT 5
- Problem of output buffer when using bitlash
- ========^ unexpected number error for functions HOT 5
- Run code from eeprom HOT 2
- Make SdCard example code use IDE's inbuilt SD API
- Maintained fork?
- update library for support lastet arduino ide version
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bitlash.