From: Enoch <ix...@ho...> - 2012-11-08 22:04:10
|
Hi, When cleaning up my code to make it uploadable through the minicom plugin as well I noted that commented #include's are not recognized by the shell (though promised). Below is a patch that straightens things up. Also, I seek confirmation that amforth will not change it's single line only ( comment ) behavior to make the following uploadable both by amforth and by shell (which recognizes multiple line comments). Example: ( \ PORTE &46 constant PORTE \ Data Register, Port E &45 constant DDRE \ Data Direction Register, Port E &44 constant PINE \ Input Pins, Port E ) Thank you, Enoch. Index: tools/amforth-shell.py =================================================================== --- tools/amforth-shell.py (revision 1300) +++ tools/amforth-shell.py (working copy) @@ -711,18 +711,20 @@ result[-1] += " " + w[:i+1] result[-1] = result[-1][1:] # remove extra initial space w = w[i+1:] + if in_delim_comment: try: - i = w.index(")") + i = w.index(")") except ValueError: - continue - in_delim_comment = False - w = w[i+1:] + pass + else: + in_delim_comment = False + w = w[i+1:] if not w: continue if w in self._amforth_regs: - w = self._amforth_regs[w] + w = self._amforth_regs[w] if char_quote: result.append(w) @@ -739,7 +741,7 @@ if not in_delim_comment and not in_line_comment: if w == "\\": in_line_comment = True - break + continue elif w in self._config.current_behavior.start_string_words: in_string = True |
From: Jan K. <kro...@ho...> - 2018-12-07 13:24:14
|
Hello, After running for several weeks amforth-shell.py, this afternoon it is stopped with an Unexpected exception. Even after resetting the mac or install a new amforth-shell.py this is not working. Can someone help me with this Cheers Jan Last login: Fri Dec 7 14:17:07 on console MacBook-Pro-van-Jan-10:~ jankromhout$ cd /Users/jankromhout/Documents/amforth-6.7/tools MacBook-Pro-van-Jan-10:tools jankromhout$ ./amforth-shell.py -p /dev/tty.usbmodem1411 -s 38400 -i --rtscts |I=appl_defs: 0 loaded |I=Entering amforth interactive interpreter ---- Unexpected exception ---- Traceback (most recent call last): File "./amforth-shell.py", line 591, in main self.interact() File "./amforth-shell.py", line 1137, in interact self._init_readline() File "./amforth-shell.py", line 1222, in _init_readline self._update_words() File "./amforth-shell.py", line 1234, in _update_words dp = int(dp[:-3]) ValueError: invalid literal for int() with base 10: '\x10``` ' MacBook-Pro-van-Jan-10:tools jankromhout$ |
From: Jan K. <kro...@ho...> - 2018-12-07 13:48:02
|
Hello, Problem found, when loading something went wrong which amforth was not correct anymore! cheers, Jan > Op 7 dec. 2018, om 14:24 heeft Jan Kromhout <kro...@ho...> het volgende geschreven: > > Hello, > > > After running for several weeks amforth-shell.py, this afternoon it is stopped with an Unexpected exception. > Even after resetting the mac or install a new amforth-shell.py this is not working. > > Can someone help me with this > > Cheers > > Jan > > > Last login: Fri Dec 7 14:17:07 on console > MacBook-Pro-van-Jan-10:~ jankromhout$ cd /Users/jankromhout/Documents/amforth-6.7/tools > MacBook-Pro-van-Jan-10:tools jankromhout$ ./amforth-shell.py -p /dev/tty.usbmodem1411 -s 38400 -i --rtscts > |I=appl_defs: 0 loaded > |I=Entering amforth interactive interpreter > > ---- Unexpected exception ---- > Traceback (most recent call last): > File "./amforth-shell.py", line 591, in main > self.interact() > File "./amforth-shell.py", line 1137, in interact > self._init_readline() > File "./amforth-shell.py", line 1222, in _init_readline > self._update_words() > File "./amforth-shell.py", line 1234, in _update_words > dp = int(dp[:-3]) > ValueError: invalid literal for int() with base 10: '\x10``` ' > MacBook-Pro-van-Jan-10:tools jankromhout$ > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Matthias T. <mt...@we...> - 2012-11-09 19:49:04
|
Hi Enoch, > When cleaning up my code to make it uploadable through the minicom > plugin as well I noted that commented #include's are not recognized by > the shell (though promised). Below is a patch that straightens things > up. Many thanks for it. > > Also, I seek confirmation that amforth will not change it's single line > only ( comment ) behavior As I understand the forth standard, a multiline ( ) comment is only available for file content (section 11 of the standard text). Otherwise a "parse area" is used to detect the closing ). If the parsing area is exhausted, a refill is not requested, leaving a somewhat strange state IMHO. A small test with gforth gave me the following mt@ayla:~$ gforth Gforth 0.7.0, Copyright (C) 1995-2008 Free Software Foundation, Inc. Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license' Type `bye' to exit ( foo ok bar ) :2: Undefined word >>>bar<<< ) Backtrace: $7F7DAC7B4A68 throw $7F7DAC7CACE0 no.extensions $7F7DAC7B4D28 interpreter-notfound1 The same "program" from a file works fine mt@ayla:~$ cat test.fs ( foo bar ) mt@ayla:~$ gforth test.fs Gforth 0.7.0, Copyright (C) 1995-2008 Free Software Foundation, Inc. Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license' Type `bye' to exit bye mt@ayla:~$ I'd recommend using ( comments ) on a single line basis only. That seems to be a save bet for all systems. Its not impossible that amforth gets the multiline comments on the commmand prompt, I'd not hold my breath waiting however ;) Matthias |