Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Happybobjr on January 16, 2011, 05:07:43 pm

Title: Variable scanner
Post by: Happybobjr on January 16, 2011, 05:07:43 pm
Here is a quick variable scanner i made today.
The code for choosing what program you want to scan was completely done by Builderboy.

Black means the variable was used.
Gray means that the variable was inside an axe comment.
Regular means unused


axscan3= not compiled
Varscan = compiled for ion

Note: I know there are still tons of problems.
Title: Re: Variable scanner
Post by: squidgetx on January 16, 2011, 05:23:05 pm
I remember you said it checks for strings, but does it check for hex data? Otherwise, most users will probably almost always have A,B,C,D,E, and F marked as "used" :P

Nice job though anyway, this is still going to be definitely very useful :)
Title: Re: Variable scanner
Post by: Happybobjr on January 16, 2011, 05:25:59 pm
I am currently having an error where commented variables don't turn gray... :P
Next is checking for labels.
Then I will probably split into two progs. 1 for axe then one for basic. ( actually, i probably wn't do for basic)
Then its pictures [....]
then tiny E



Am i missing anything?

Oh and Tiny T (matrix, right, 2) then variable is ignored.
Title: Re: Variable scanner
Post by: squidgetx on January 16, 2011, 05:35:19 pm
Don't forget Axiom() and Asm(). Good luck :)
Title: Re: Variable scanner
Post by: shmibs on January 16, 2011, 05:52:54 pm
this is a wonderful idea and shall be exceedingly useful!
thanks
Title: Re: Variable scanner
Post by: Happybobjr on January 16, 2011, 06:03:06 pm
I am having too many unnecessary errors.
I am removing ti-basic compatibilities.


Thanks for reminding me about asm( and axiom
Title: Re: Variable scanner
Post by: Binder News on January 16, 2011, 06:05:08 pm
I think it should be integrated with Axe so as to allow for axe to use less space for vars, and thus more space in L1
Title: Re: Variable scanner
Post by: Ashbad on January 16, 2011, 06:11:32 pm
not bad, I could find a ton of use in this, even though TaNF only has like 5 vars declared, I still would need this.  A ton :D

An idea: not nessicary, but it would be sooo cool if this were to be made part of it.  Let's say you declare a variable, and then have a comment below/above it that describes it.  Maybe the scanner could read this and show it as the description?
Title: Re: Variable scanner
Post by: Happybobjr on January 16, 2011, 06:17:31 pm
not bad, I could find a ton of use in this, even though TaNF only has like 5 vars declared, I still would need this.  A ton :D

An idea: not nessicary, but it would be sooo cool if this were to be made part of it.  Let's say you declare a variable, and then have a comment below/above it that describes it.  Maybe the scanner could read this and show it as the description?
I would like to have this working fully before i try anything else.
Title: Re: Variable scanner
Post by: Happybobjr on January 16, 2011, 08:29:02 pm
Errors are worked out.
The first line .AXPROG  is now considered as basic variables.
Also earlier i had used pt-change.  If a var was used an even # of times it would be normal :P



Up next is  Checking Labels and pictures []

It is really easy to program now I know what variables i have used :P
Title: Re: Variable scanner
Post by: Builderboy on January 17, 2011, 02:18:47 am
Nice work!  This is definitely going to come in handy! ^^
Title: Re: Variable scanner
Post by: Happybobjr on January 17, 2011, 07:44:03 am
Update:
*Now checks LBL and GOTO.  Also checks anything in [  ]
*Sub( is misbehaving...  is it a two bye token?
I'll upload screeny when i get home.


E is next.
Then Asm(  (that will be annoying)
The  axiom(
Incuded programs. (prgmEXAMPLE)

Then i think that will be everything.

Polishing up will include:
* larger distance between numbers.
* large font numbers probably
* Inversed color on SELECT PROGRAM :)
Title: Re: Variable scanner
Post by: Munchor on January 17, 2011, 07:45:41 am
Great, someone did what I asked for ;D

Also, I was wondering if it could return all the Variables used and all the Variables that are not-used? If yes, that would be really cool, but this is great as well, congratulations both of you ;D
Title: Re: Variable scanner
Post by: Happybobjr on January 17, 2011, 07:49:33 am
Great, someone did what I asked for ;D

Also, I was wondering if it could return all the Variables used and all the Variables that are not-used? If yes, that would be really cool, but this is great as well, congratulations both of you ;D

that's all it does ???

The used variables are highlighted.
The variables in a comment are greyed.
Title: Re: Variable scanner
Post by: Munchor on January 17, 2011, 09:41:49 am
Great, someone did what I asked for ;D

Also, I was wondering if it could return all the Variables used and all the Variables that are not-used? If yes, that would be really cool, but this is great as well, congratulations both of you ;D

that's all it does ???

The used variables are highlighted.
The variables in a comment are greyed.

I thought it returned if a certain variable was used or not, but if not, noice! (nice with british accent)
Title: Re: Variable scanner
Post by: Happybobjr on January 17, 2011, 10:47:03 am
oh, i see, ya it does
Title: Re: Variable scanner
Post by: DJ Omnimaga on January 19, 2011, 01:46:41 pm
Nice program Happybobjr :D
Title: Re: Variable scanner
Post by: Happybobjr on February 19, 2011, 11:12:58 am
update:

If the result is gray-  The variable was stored to.
If black-  The variable was called.
Tricks-  If it is only gray,  the variable is not being used, so you can find it and delete it.

http://www.omnimaga.org/index.php?action=dlattach;topic=6129.0;attach=6234
Title: Re: Variable scanner
Post by: Deep Toaster on February 19, 2011, 11:17:37 am
Yay, it's here!

Tested it out on Wabbit, and I'm definitely gonna be using this once I download it:
Title: Re: Variable scanner
Post by: Happybobjr on February 19, 2011, 11:19:19 am
thank you.
Is there anything else you wish to see on it?

I am trying to have it fast, but i can still have many more features.

Edit:thanks for the screeny
Title: Re: Variable scanner
Post by: Deep Toaster on February 19, 2011, 11:20:28 am
Awesome, it even tests to see if it's a BASIC prog. Nice!
Title: Re: Variable scanner
Post by: Happybobjr on February 19, 2011, 11:22:33 am
That's actually Builderboy's code :P  from his auto optimization program.  I just switched the truth of an if statement =D
Title: Re: Variable scanner
Post by: Deep Toaster on February 19, 2011, 12:05:48 pm
Multi-line comments don't work:
Title: Re: Variable scanner
Post by: Happybobjr on February 19, 2011, 01:35:40 pm
How do multi line comments work?
I forgot about them

I have this made for axe 0.4.8
Title: Re: Variable scanner
Post by: Munchor on February 19, 2011, 02:05:28 pm
How do multi line comments work?
I forgot about them

I have this made for axe 0.4.8

Code: [Select]
...
This is a comment
This is still a comment
This is the last line
Maybe yet another
...
Disp "NOT COMMENT
Title: Re: Variable scanner
Post by: Happybobjr on February 19, 2011, 02:11:21 pm
Thanks.

I shall eat before implementing that.
Title: Re: Variable scanner
Post by: Builderboy on February 19, 2011, 06:06:48 pm
Good luck! :D This is already epic awesome and useful ^^
Title: Re: Variable scanner
Post by: Munchor on February 21, 2011, 07:43:42 am
I think it'd be easier for Axe writing if there was a difference for starting and finishing multiline comments, but happybojr, what about for writing this kind of software, is it any harder/easier?
Title: Re: Variable scanner
Post by: Happybobjr on February 21, 2011, 08:05:38 am
Oh, writing the code for this was extremly simple and unoptimised,
Unfortunatly, I am having trouble with multi line comments.
Title: Re: Variable scanner
Post by: Deep Toaster on February 21, 2011, 09:14:23 am
Oh, writing the code for this was extremly simple and unoptimised,
Unfortunatly, I am having trouble with multi line comments.

I think you should test to see if there's three periods in a row, then set a flag that lets the program skip all the way until it finds another set. Absolutely nothing between the ellipses matters.
Title: Re: Variable scanner
Post by: Happybobjr on February 21, 2011, 09:59:21 am
I tried that.  Something in my code is conflicting with it though :/

<s>Remember, I have to ignore...</s>  you know what, nvm.  I will just add a bunch of (If N=0) for now.
Title: Re: Variable scanner
Post by: Deep Toaster on February 21, 2011, 11:11:20 am
!If N is a lot more optimized :)
Title: Re: Variable scanner
Post by: Happybobjr on February 21, 2011, 03:08:21 pm
WOW! I am stupid.

I had
{L+G}=3F
It shou;d have been
{L+G}=E3F

Little E
Title: Re: Variable scanner
Post by: Happybobjr on February 21, 2011, 08:30:02 pm
Ok here is version 0.6

Change log.
* Added support for multi-line comments.
* Added support for E
* Fixed something that I can't remember... :P
* Some speed and size optimizations.

Things for 1.0
* Fix Sub(
* Fix .Blab:new line isn't part of comment :/
Title: Re: Variable scanner
Post by: Darl181 on February 22, 2011, 03:06:36 am
Bug report: in the newest version, the letters don't turn black/gray until a key is pressed, then the program quits instantly.
Title: Re: Variable scanner
Post by: Happybobjr on February 22, 2011, 06:53:38 am
That doesn't seem right??? 
I just tried it and it worked.
Title: Re: Variable scanner
Post by: DJ Omnimaga on February 23, 2011, 08:08:19 pm
I'll give this a try with one of my old game like Axe Tunnel, even though it's ancient.

EDIT It seems to work fine for me. Could you add a feature showing how many times each var is used?
Title: Re: Variable scanner
Post by: Happybobjr on February 23, 2011, 09:42:34 pm
That would be easy.  I have rewritten how the variables and stuff is displayed.  Now it is easy for me to adjust ;)

What would the use of knowing the number of times a variable has been used?


Also:  when you say used, do you mean called and/or stored?
Title: Re: Variable scanner
Post by: DJ Omnimaga on February 23, 2011, 09:47:10 pm
When we know the number of time then we know how many to change if we ever decide to stop using that variable or we can detect possible variable conflicts. As for used it would be nice maybe to know when they're used and when they're stored. In fact it would be cool to know where in the code too, but when a variable is used 20 times it would be hard to read. X.x
Title: Re: Variable scanner
Post by: Happybobjr on February 23, 2011, 10:06:53 pm
Here is what I was thinking.

<u>|Var  |Used|Str'd|</u>
| A    | 4    | 1    |
| B    | 1    | 4    |
| C    | 0    | 1    |
| D    | 0    | 0    |
| E    | ...   | ...   |


This will have 2 or 3 columns.
Title: Re: Variable scanner
Post by: Deep Toaster on February 24, 2011, 09:51:53 am
Here is what I was thinking.

<u>|Var  |Used|Str'd|</u>
| A    | 4    | 1    |
| B    | 1    | 4    |
| C    | 0    | 1    |
| D    | 0    | 0    |
| E    | ...   | ...   |


This will have 2 or 3 columns.


That would be great! Not sure the uses of that, but it would look awesome ;D
Title: Re: Variable scanner
Post by: Happybobjr on February 24, 2011, 03:03:49 pm
Ok, I'll upload when I get home.

I am using 3 columns with 9 variables per.
It works out perfectly :)

Edit:  fixed Sub(

Edit 2: Yes scout. (I am adding edit because I don't want to double post in a few min.)
Edit 3: Just making things look pretty now.
Title: Re: Variable scanner
Post by: Munchor on February 24, 2011, 03:05:24 pm
Ok, I'll upload when I get home.

I am using 3 columns with 9 variables per.
It works out perfectly :)

Edit:  fixed Sub(

Great, so it won't count variables inside multiline comments like this:

Code: [Select]
...
A this is not a variable
B
C
None of these is
...
Title: Re: Variable scanner
Post by: Happybobjr on February 24, 2011, 09:04:28 pm
Here is 1.0

Change Log
*Fixed Sub(
*Added support for multi-line comments.
*Put in full speed mode ;)
*Added the number of times the var was used/-> (stored)
*Rewrote display. A few hundreds of bytes saved (not relative to previous update)
*Made this change log :P


*better screeny plz?*
Title: Re: Variable scanner
Post by: Deep Toaster on February 24, 2011, 11:36:02 pm
Here is 1.0

Change Log
*Fixed Sub(
*Added support for multi-line comments.
*Put in full speed mode ;)
*Added the number of times the var was used/-> (stored)
*Rewrote display. A few hundreds of bytes saved (not relative to previous update)
*Made this change log :P


*better screeny plz?*

By the way, you can get the store arrow by doing something like Text(X,Y,28►Char). I'd suggest changing that from -> and maybe putting the heading in each column, but otherwise it looks great!
Title: Re: Variable scanner
Post by: Happybobjr on February 25, 2011, 10:02:49 am
By the way, you can get the store arrow by doing something like Text(X,Y,28►Char).
Thanks, I will get right on that  :)
Title: Re: Variable scanner
Post by: Darl181 on February 26, 2011, 12:44:04 am
I just tried this earlier, and have some ideas/requests.

Can there be a progress bar/run indicator turned on during reading?  That way it's clear something's actually going on.
In a token like Str1A or Pic0B the letter is counted in.

Other than that, it's great ;D
Title: Re: Variable scanner
Post by: Happybobjr on February 26, 2011, 09:06:55 am
Can there be a progress bar/run indicator turned on during reading?  That way it's clear something's actually going on.
Opps ok :)

In a token like Str1A or Pic0B the letter is counted in.
That never crossed my mind. Thank you for telling me.



Note: Grounded from computer for a week because i have a B+ in English :/
so when ever my parents aren't around, I will update it.
Title: Re: Variable scanner
Post by: aeTIos on February 28, 2011, 02:56:11 am
This is just epic! Downloaded it immediately!
Title: Re: Variable scanner
Post by: DJ Omnimaga on March 02, 2011, 01:43:14 am
That looks nice so far :D
Title: Re: Variable scanner
Post by: Happybobjr on March 02, 2011, 12:10:49 pm
That looks nice so far :D

Thanks.  In the rare moments of spare time I get, I have been messing around with 4lvl. gray for better viewing.