Re: [Amforth] A very, very minor suggestion for amforth-shell.py

2020-05-10 Thread Tristan Williams
Hello John,

> Can you provide a unified diff of your proposed changes?

Yes. A good idea. Output of diff -u below, with amforth-shell.py taken from a 
fresh amforth-6.8.tar.gz


--- amforth-shell.py2020-05-10 08:06:14.0 +0100
+++ new-shell.py2020-05-10 08:08:46.0 +0100
@@ -750,6 +750,7 @@
 raise AMForthException("file " + filename + " not found in search 
path")
   if len(self._filedirs[filename])!=1:
 # oops, too many files or no one at all found?
+self.progress_callback("Error", None,  "Wrong # of file "+ 
filename+" found in search path") # add this line above the one below 
 raise AMForthException("Wrong # of file occurances: " + filename + 
" 
("+str(len(self._filedirs[filename]))+")\n\t"+"\n\t".join(self._filedirs[filename]))
   self.progress_callback("Information", None,  "using "+ filename+" 
from"+ self._filedirs[filename][0])
   fpath = os.path.join(self._filedirs[filename][0], filename)


Best wishes,
Tristan

On 08May20 15:44, John Verne wrote:
> Can you provide a unified diff of your proposed changes?
> 
> On Fri, 8 May 2020 at 15:42, Tristan Williams  wrote:
> >
> > A very, very, minor suggestion for amforth-shell.py in the next
> > release.
> >
> > If amforth-shell.py finds multiple matches for a filename whilst
> > executing a #include directive then it exits silently. It really has
> > no choice but to exit (which one to load?). Adding a
> > self.progress_callback line (as per the other filename related tests)
> > gives a hint that things are going awry.
> >
> > I think this would work
> >
> > self.progress_callback("Error", None,  "Wrong # of file "+ filename+" found 
> > in search path") # add this line above the one below
> > raise AMForthException("Wrong # of file occurances: " + filename + " 
> > ("+str(len(self._filedirs[filename]))+")\n\t"+"\n\t".join(self._filedirs[filename]))
> >
> > An easy way to demonstrate this is to defeat amforth-shell.py inbuilt
> > intelligence and knowledge of mcu type by
> >
> > export AMFORTH_LIB=/path-to/amforth-6.8
> >
> > and create a file with the line
> >
> > #include marker.frt
> >
> > and send it to the mcu with amforth-shell.py
> >
> > In the standard distribution there are two marker.frt files
> >
> > ../amforth-6.8/avr8/lib/forth2012/core-ext/marker.frt
> > ../amforth-6.8/msp430/lib/forth-2012/core-ext/marker.frt
> >
> > so amforth-shell.py will silently exit after the #include marker.frt
> > line.
> >
> > Best wishes,
> > Tristan
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > ___
> > Amforth-devel mailing list for http://amforth.sf.net/
> > Amforth-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/amforth-devel
> 
> 
> 
> -- 
> 
> 
> John Verne
> about.me/jverne
> 
> 
> ___
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel
> 


___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


Re: [Amforth] A very, very minor suggestion for amforth-shell.py

2020-05-08 Thread John Verne
Can you provide a unified diff of your proposed changes?

On Fri, 8 May 2020 at 15:42, Tristan Williams  wrote:
>
> A very, very, minor suggestion for amforth-shell.py in the next
> release.
>
> If amforth-shell.py finds multiple matches for a filename whilst
> executing a #include directive then it exits silently. It really has
> no choice but to exit (which one to load?). Adding a
> self.progress_callback line (as per the other filename related tests)
> gives a hint that things are going awry.
>
> I think this would work
>
> self.progress_callback("Error", None,  "Wrong # of file "+ filename+" found 
> in search path") # add this line above the one below
> raise AMForthException("Wrong # of file occurances: " + filename + " 
> ("+str(len(self._filedirs[filename]))+")\n\t"+"\n\t".join(self._filedirs[filename]))
>
> An easy way to demonstrate this is to defeat amforth-shell.py inbuilt
> intelligence and knowledge of mcu type by
>
> export AMFORTH_LIB=/path-to/amforth-6.8
>
> and create a file with the line
>
> #include marker.frt
>
> and send it to the mcu with amforth-shell.py
>
> In the standard distribution there are two marker.frt files
>
> ../amforth-6.8/avr8/lib/forth2012/core-ext/marker.frt
> ../amforth-6.8/msp430/lib/forth-2012/core-ext/marker.frt
>
> so amforth-shell.py will silently exit after the #include marker.frt
> line.
>
> Best wishes,
> Tristan
>
>
>
>
>
>
>
>
>
>
>
>
> ___
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel



-- 


John Verne
about.me/jverne


___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


[Amforth] A very, very minor suggestion for amforth-shell.py

2020-05-08 Thread Tristan Williams
A very, very, minor suggestion for amforth-shell.py in the next
release.

If amforth-shell.py finds multiple matches for a filename whilst
executing a #include directive then it exits silently. It really has
no choice but to exit (which one to load?). Adding a
self.progress_callback line (as per the other filename related tests)
gives a hint that things are going awry. 

I think this would work

self.progress_callback("Error", None,  "Wrong # of file "+ filename+" found in 
search path") # add this line above the one below 
raise AMForthException("Wrong # of file occurances: " + filename + " 
("+str(len(self._filedirs[filename]))+")\n\t"+"\n\t".join(self._filedirs[filename]))

An easy way to demonstrate this is to defeat amforth-shell.py inbuilt
intelligence and knowledge of mcu type by 

export AMFORTH_LIB=/path-to/amforth-6.8

and create a file with the line

#include marker.frt

and send it to the mcu with amforth-shell.py

In the standard distribution there are two marker.frt files

../amforth-6.8/avr8/lib/forth2012/core-ext/marker.frt
../amforth-6.8/msp430/lib/forth-2012/core-ext/marker.frt

so amforth-shell.py will silently exit after the #include marker.frt
line.

Best wishes,
Tristan

 










___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel