Peter,

I had pondered doing something like you suggested.  I also thought about making 
everything separated by commas so it would import into Excel.   I finally 
settled with keeping it simple and doing spaces.   To keep the line width 
reasonable, rather than just repeating the line number each time the variable 
appears on the same line, I tallied the count and put counts greater than 1 in 
parenthesis. 

 

I even thought about trying to determine which variables are arrays.    That 
gets a bit messy because now I would need to look for the DIM keyword.    As 
far as identifying the type, you can get thrown off if DEFSNG, DEFSTR,DEFDBL, 
or DEFINT have been used.   I suppose one could make the program smart enough 
to recognize these and type the variables accordingly, but then it gets even 
more complicated.

 

And as far as the comment of distinguishing between a variable being defined 
versus being used, that would certainly be useful.    There would need to be 
some code for determining which side of the equal sign the variable is found 
on.   This would require a bit more work because the program currently turns 
equal signs and colons (and most other symbols) into spaces.   I have a few 
ideas on how to approach this, but it will probably go on the back burner.     
Perhaps others may want to try tackle these things using the code I provided or 
starting from scratch.

 

I did do an update on MTVarConcor to handle files that have the last line 
beginning with a control Z followed by garbage. 

 

The updated source and executable is at www.github.com/lej-projects/MTVarConcor 
<http://www.github.com/lej-projects/MTVarConcor> .  It is version 1.1.

 

Thanks for the comments.

Lloyd   

 

From: M100 <m100-boun...@lists.bitchin100.com> On Behalf Of Peter Noeth
Sent: Wednesday, May 3, 2023 4:59 PM
To: Model 100 Discussion <m100@lists.bitchin100.com>
Subject: Re: [M100] Variable Concordance

 

A good idea, but since the program runs under Windows, why such a cryptic 
output?

 

Wouldn't it be easier to use with more verbose column headers:

 

Variable       Type          Defined in Line             Used in Lines          
        Comments

---------------------------------------------------------------------------------------------------------------------------------------------------------

B%               Integer        0                                  1, 7(2)

C                  Double        1                                  2(3), 4, 
5(2)

E                  Double        1                                  7(5)

.

.

.

 

The Comments column label would be generated, but used later when the output 
file is edited to add notes about the variable usage, etc. This would make a 
good start to proper program documentation.

 

Of course, since the source was provided, changes could easily be made :-)

 

Regards,

Peter 

 

 

On Tue, May 2, 2023 at 1:15 PM <m100-requ...@lists.bitchin100.com 
<mailto:m100-requ...@lists.bitchin100.com> > wrote:

----------------------------------------------------------------------

Message: 1
Date: Mon, 1 May 2023 15:31:48 -0500
From: <lloydel...@comcast.net <mailto:lloydel...@comcast.net> >
To: <m...@bitchin100.com <mailto:m...@bitchin100.com> >
Subject: [M100] Variable Concordance - MTVarConcor
Message-ID: <000401d97c6b$f4e9acc0$debd0640$@comcast.net <http://comcast.net> >
Content-Type: text/plain; charset="utf-8"

Hello all,



I?ve written a variable concordance program for Windows that will take a TRS-80 
Model 100 BASIC program and will list the variables in alphabetical order with 
the line numbers where they appear.    The name of this program is MTVarConcor. 
  The executable, source and a pdf file describing it can be found at 
www.GitHub.com/LEJ-Projects/MTVarConcor 
<http://www.GitHub.com/LEJ-Projects/MTVarConcor>  
<http://www.GitHub.com/LEJ-Projects/MTVarConcor> .



As an example, the 10 line program, drop (written by David Plass) is as follows:



0 
CLS:POKE-902,PEEK(63795):F=.25+RND(1)/4:W=-.25+RND(1)/2:X=0:Y=1:B%=5+25*RND(1) 

1 
C=0:PRINT@280+B%,CHR$(27)"V?"SPACE$(9-E)"?":PRINT@200,"S:"S:PRINT"L:"5-L:PRINTUSING"W:#.#";W

2 C=C+F:PRINT@C," ??":IFX<>0THENPRINT@OX+40*OY%," 
":OX=X:OY%=Y:Y=Y+.3:X=X+W:GOTO6 

4 IFINKEY$=" "THENX=C+2:F=F*2:OX=0:OY%=0 

5 IFC>=37THENPRINT@37," ":C=0:GOTO2ELSE2 

6 IFY<7.01THENPRINT@X+40*FIX(Y), 
<mailto:7.01THENPRINT@X+40*FIX(Y),%22?%22:GOTO4%20%0b%0b7%20IFX> "?":GOTO4 

7 
IFX>=B%+1ANDX<=B%+10-ETHENPRINT@97,"Hit!":CALL4811:S=S+10*(E+1):E=E-(E<8):GOTO0 

8 L=L+1:IFL<5THENPRINT@97,"MISS!":CALL4811:GOTO0ELSEPRINT@55,"Game over":END



The output from MTVarConcor when the above program is the input is:



B% 0 1 7(2) 

C 1 2(3) 4 5(2) 

E 1 7(5) 

F 0 2 4(2) 

L 1 8(3) 

OX 2(2) 4 

OY% 2(2) 4 

S 1 7(2) 

W 0 1 2 

X 0 2(4) 4 6 7(2) 

Y 0 2(3) 6(2)



I hope someone will find this program useful.

Lloyd

Reply via email to