Author Topic: [Project] Auto-Organize Program  (Read 12199 times)

0 Members and 2 Guests are viewing this topic.

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
[Project] Auto-Organize Program
« on: November 13, 2010, 09:06:44 pm »
AutOrganize Version: 0.6  ;D
Description: this program will organize your axe programs by block method.

Features:
* Organizes your axe program. (see screeny)
* Ignores spaces in your code for better organization. (see screeny)
* Exact size on output program that is needed. (see screeny Cool )
* copies notes evend if they have if or while etc. in it.
* Does not add spaces to notes.
* Spaces within notes are not deleted

Wishlist:
* Choose the program to organize (it currently must be called a1xtest)
* Reject nonAxe programs.
* Warn you if not enough ram.  Will also inform you of the amount of ram needed. (about to finish)
* Have the new program replace the old unorganized one.
*if/while etc. statements in a string are ignored

Warning: this is still an early version so bugs may occur although only one has been found.
Bugs:
* Example Output(1,1,"hi i am james")
-will become Output(1,1,"hiiamjames")



Credits:
DJ Omnimaga: For hosting this wonderful site.
Builderboy: Assistance in program size. Also inspired this project with his auto-optimization program.
FinaleTI: Linking me to code for free ram left.

Note:  sorry i have been a little short tempered latly. I have been on a ton of deadlines between my computer and school work.

Organize=compiled
a1xtest=test program




V Old V
Spoiler For Spoiler:
Remember Auto-optimize prog?

I was thinking as many of us are quite bad at code organization.... that someone could make an auto-organiser prog.

Basically it would do this.

Before V

:.Axample
:While 1
:If Getkey=15
:Return
:End
:For(A,0,50)
:Output(A^16,A^7,A>Dec)
:End
:End


After V

:.Axample
:While 1
: If Getkey=15
:  Return
: End
: For(A,0,50)
:  Output(A^16,A^7,A>Dec)
: End
:End



A cool feature would also be to reconize ax programs from ti-basic programs.
That way it would know how to deal with the "Then" comand.
« Last Edit: November 16, 2010, 10:36:55 pm by DJ Omnimaga »
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: [Request]
« Reply #1 on: November 13, 2010, 09:08:34 pm »
this would have to be done in ASM then, i guess? since Axe can't write to programs

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: [Request]
« Reply #2 on: November 13, 2010, 09:09:58 pm »
this would have to be done in ASM then, i guess? since Axe can't write to programs

nope,  auto optimization was written in axe. (i think)
Anyways, go find my "drawing to basic"  it writes to programs.

Edit: might have seemed rude depending where you live.
« Last Edit: November 13, 2010, 09:12:02 pm by happybobjr »
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: [Request]
« Reply #3 on: November 13, 2010, 09:15:44 pm »
My question is how are you going to run the program after you add in the spaces?  And the only reason the AutoOptimization program is able to edit programs is because it never *increases* the file size, which is incredibly difficult.

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: [Request]
« Reply #4 on: November 13, 2010, 09:18:03 pm »
My question is how are you going to run the program after you add in the spaces?  And the only reason the AutoOptimization program is able to edit programs is because it never *increases* the file size, which is incredibly difficult.

as the program runs, count the number of spaces you add in.
after you're done, create a temporary appvar. copy all the data from the program you edit to the appvar.
then, create the same program variable that you edited with its original size, plus the amount of spaces you added in.
copy appvar data to the program variable.


Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: [Request]
« Reply #5 on: November 13, 2010, 09:26:37 pm »
But with that, i need at least half of my ram free, and so programs that take up more than half of RAM (excluding the organization program) won't work

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: [Request]
« Reply #6 on: November 13, 2010, 09:42:15 pm »
hmmm.. do it in segments?

do 1/5 of the program, make an Appv TEMP1, copy 1/5 of the new program's data to TEMP1, archive it.
repeat for TEMP2, TEMP3, TEMP4, TEMP5.
copy each appvar to the new Program variable separately.. you get the idea.

the problem with that is it 1) it'll take forever due to the archiving and 2) frequent use will wear out the archive.

so, another suggestion, loop through the program data calculating how many spaces you need to add in.
create a temp appvar with enough space to compensate for the extra bytes.
loop through again, this time copying the program data to L3, adding in spaces as necessary. once you reach 768 bytes, copy the L3 data to the new appvar
repeat until all the data is copied.
transfer the appvar to the program var
delete the appvar.

i know, it doesn't solve the  memory problem. but cmon. just put a note in the readme to have:
2 * [program_size] + [autoOp_program_size] +[arbitrary_number_like_1000] bytes available in ram.


Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: [Request]
« Reply #7 on: November 13, 2010, 09:50:43 pm »
But with that, i need at least half of my ram free, and so programs that take up more than half of RAM (excluding the organization program) won't work

true.
But USPRES only takes up 11k bytes of ram.  And that is one of the largest ti-basic programs.
As long as your program doesn't go over 10k bytes, everything should be fine.
You could check the ammount of free ram left and give an Error: Not Enough Memory  if it would require to much.

I would think it would be worth making.  I will try in a couple of weeks if i can ever hook my calc to a computer again. (and steal you code for detecting programs ;) )

But overall I would think if you took a few parts of auto-optimisation program, It would be very simple to make.

Ninja'd
@nemo:  Most people if making a large program, won't have all the code in the one prog.  Most will have large parts seperated such as a menu, game, help
« Last Edit: November 13, 2010, 09:53:18 pm by happybobjr »
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: [Request]
« Reply #8 on: November 14, 2010, 12:28:12 am »
So are you planning to use spaces or some other token for the indent?  Colons i think would work the best because then the program would still execute, while any other would cause errors.

Also, there is an alternative method for allocating memory using numerous OS BCALLS that would move the program around and extend free memory so that the program could grow normally, but i would not be the one to ask on how to use that D:

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: [Request]
« Reply #9 on: November 14, 2010, 10:31:14 am »
So are you planning to use spaces or some other token for the indent?  Colons i think would work the best because then the program would still execute, while any other would cause errors.


Aren't spaces ignored by the parser?

Offline FinaleTI

  • Believe in the pony that believes in you!
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1830
  • Rating: +121/-2
  • Believe in the pony that believes in you!
    • View Profile
    • dmuckerman.tumblr.com
Re: [Request]
« Reply #10 on: November 14, 2010, 10:42:12 am »
So are you planning to use spaces or some other token for the indent?  Colons i think would work the best because then the program would still execute, while any other would cause errors.


Aren't spaces ignored by the parser?
What would be cool is if it detected it was an Axe source program, it used spaces, but if it was a BASIC program, it would use colons.


Spoiler For Projects:

My projects haven't been worked on in a while, so they're all on hiatus for the time being. I do hope to eventually return to them in some form or another...

Spoiler For Pokemon TI:
Axe port of Pokemon Red/Blue to the 83+/84+ family. On hold.

Spoiler For Nostalgia:
My big personal project, an original RPG about dimensional travel and a few heroes tasked with saving the world.
Coding-wise, on hold, but I am re-working the story.

Spoiler For Finale's Super Insane Tunnel Pack of Doom:
I will be combining Blur and Collision Course into a single gamepack. On hold.

Spoiler For Nostalgia Origins: Sky's Story:
Prequel to Nostalgia. On hold, especially while the story is re-worked.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: [Request]
« Reply #11 on: November 14, 2010, 11:14:34 am »
So are you planning to use spaces or some other token for the indent?  Colons i think would work the best because then the program would still execute, while any other would cause errors.

Also, there is an alternative method for allocating memory using numerous OS BCALLS that would move the program around and extend free memory so that the program could grow normally, but i would not be the one to ask on how to use that D:

Actually, InsertMem and DeleteMem don't need the edit buffer and rearrange everything for you, except the size bytes for some reason. They's really convenient for this, just a bit slow.

Just thought of a way to do this with pure Axe, though: allocate however many bytes the program is for a temporary program (since the spaces/colons can only add to the size), then when it's filled up, archive it, create a program with 1000 more bytes than before, copy it from archive, delete the archived copy, and repeat. It should be pretty simple since it's not too complicated to check for loops. I think colons should be used for BASIC and spaces for Axe, though. It adds to the difference between the two, which would be convenient.




Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: [Request]
« Reply #12 on: November 14, 2010, 12:31:24 pm »
except i would still like to steal builderboys auto optimize source ;).  and with no connection from calc to pc....
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: [Request]
« Reply #13 on: November 14, 2010, 02:32:01 pm »
Go ahead and use it as you will, i have no problem with it ^^ open it up in sourcecoder if you want to see how it works

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: [Request]
« Reply #14 on: November 15, 2010, 07:51:46 am »
I don't have connection to my pc with the issues its having......

might be a couple weeks before i can do anything...
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________