gnupic: gpsim status


Previous by date: 13 Nov 2004 20:45:16 +0000 Re: gpsim status, Scott Dattalo
Next by date: 13 Nov 2004 20:45:16 +0000 gputils MPLAB plugin, Craig Franklin
Previous in thread: 13 Nov 2004 20:45:16 +0000 Re: gpsim status, Scott Dattalo
Next in thread:

Subject: Re: gpsim status
From: "Peter L. Peres" ####@####.####
Date: 13 Nov 2004 20:45:16 +0000
Message-Id: <Pine.LNX.4.60.0411132230300.9885@cyc.cyc.ubzr.bet>

On Sat, 13 Nov 2004, Scott Dattalo wrote:

> On Sat, 13 Nov 2004, Peter L. Peres wrote:
>
>> On Fri, 12 Nov 2004, Scott Dattalo wrote:
>> 
>>> With command line expressions, you can examine a register simply by 
>>> typing it's name. E.g. to view the contents of the variable named 
>>> 'failures'
>>> 
>>> gpsim> failures
>>> failures [0x0c] = 0x84 = 0b10000100
>>> 
>>> If you want to change its value, you simply write:
>>> 
>>> gpsim> failures = 0;
>> 
>> And if you have a variable called quit ?
>
> It's kind of like having a variable named 'if' in C; it's an error - almost. 
> In general, the command name will get resolved before the symbol. However, if 
> you wrote something like:
>
>  temp1 = quit
>
> Then that would cause a parse error. The quit command is especially bad since 
> it's 'parsed' by the lexer.
>
>
> I have thought about this issue though. At the moment, variables all go into 
> a symbol table with 'global' scoping. Attributes go in with 'local' scoping. 
> The module name is used somewhat like a namespace name. So for attributes, 
> you'd write:
>
>  U1.xpos
>
> where U1 is the module name and xpos is the attribute name. But for symbols, 
> you just write the symbol name. What I should do is prefix symbols with their 
> module name and then provide something like C++'s 'using' command to select a 
> default module from which symbol names can be resolved. That way, you could 
> explicitly write:
>
>  U1.temp1 = U1.quit
>
> to display the contents of the variable 'quit'. And then after:
>
>  using namespace U1
>
> (or maybe a simpler 'using U1')
>
> you could either write:
>
>  temp1
>
> or
>
>  U1.temp1
>
> to display the symbol named temp1 located in module U1.
>
> With this approach, you'll only be constrained with module names.
>
> Thanks for pointing this kink out to my attention - I'll fix this sooner 
> rather than later.

You are the author, I'm sure you'll find a way and make it work. Fyi I 
often have varnames like exit, reset, flags, status etc in C programs, 
where they do not collide with anything. However, when source level 
debugging problems will occur. I think that allowing direct symbol name 
typing into the environment will cause trouble. I propose some ways to fix 
it (beyond what you suggested, which is valid):

1.) use rpn.

? varname 		prints var
= varname value		sets var

2.) use what you proposed but prepend a simple dot for the 'global' 
namesapce:

exit			really exit
.exit			show variable exit
.exit = 5		set variable exit = 5
global.exit		show same exit as above (global will be a reserved
 			... name but not collide with anything
 			... it is self qualified by position)
foo.exit		show varname in module foo

3.) stick to an established convention (that of gdb f. ex.):

p varname 		print the variable contents (with some qualifier
 			flags to control casting and formatting)
set varname = value	as above

2 and 3 do not conflict imho. 2. is essentially your idea, with the global 
qualifier added.

thanks, and thanks for the great contribution,

Peter

Previous by date: 13 Nov 2004 20:45:16 +0000 Re: gpsim status, Scott Dattalo
Next by date: 13 Nov 2004 20:45:16 +0000 gputils MPLAB plugin, Craig Franklin
Previous in thread: 13 Nov 2004 20:45:16 +0000 Re: gpsim status, Scott Dattalo
Next in thread:


Powered by ezmlm-browse 0.20.