Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Camdenmil on November 13, 2010, 12:49:37 am

Title: Append to appvar
Post by: Camdenmil on November 13, 2010, 12:49:37 am
How do you append data to an appvar? If I have appvar A which is 500 bytes, how do I add 100 bytes to the end of it?
Title: Re: Append to appvar
Post by: squidgetx on November 13, 2010, 11:00:36 am
AFAIK you can't do this with anything simple :(

The best way to do it would be something like...

Code: [Select]
"appvTemp"⇒Str1
"appvName"⇒Str2
GetCalc(Str1, new size)⇒A
GetCalc(Str2)⇒B
Copy(B,A,old size)
<data>⇒GDB1
Copy(GDB1,A+oldsize, Δsize)
DelVar Str2
GetCalc(Str2, new size)⇒B
Copy(A,B, new size)
DelVar Str1

where appvTemp is a temporary appvar, appvName is whatever appvar you're using and <data> is whatever data you want to add

if there's any easier way to do this, I'd be interested as well ;)
Title: Re: Append to appvar
Post by: Deep Toaster on November 13, 2010, 11:01:57 am
AFAIK you can't do this with anything simple :(

The best way to do it would be something like...

Code: [Select]
"appvTemp"⇒Str1
"appvName"⇒Str2
GetCalc(Str1, new size)⇒A
GetCalc(Str2)⇒B
Copy(B,A,old size)
<data>⇒GDB1
Copy(GDB1,A+oldsize, Δsize)
DelVar Str2
GetCalc(Str2, new size)⇒B
Copy(A,B, new size)
DelVar Str1

where appvTemp is a temporary appvar, appvName is whatever appvar you're using and <data> is whatever data you want to add

if there's any easier way to do this, I'd be interested as well ;)

That's about it, unless Quigibo adds the InsertMem/DeleteMem functions (feature request bump ;D).
Title: Re: Append to appvar
Post by: Camdenmil on November 13, 2010, 04:22:14 pm
That's how I was doing it. At least I wasn't missing an obvious command  :)