Author Topic: Custom lists  (Read 6188 times)

0 Members and 1 Guest are viewing this topic.

Offline scottywz

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
Custom lists
« on: September 30, 2010, 11:38:02 pm »
I'm trying to save a return code to a one element list with a custom name in a subroutine that's called right before exiting.  Simply using GetCalc("LAVLIB",1) doesn't seem to do anything, so I've been manually coding the token name (thanks to the 83+ SDK docs).  [01]"LAVLIB" (coded using Data() and the transpose symbol with a null byte at the end) screws up the symbol table and crashes the calculator, but [015D]"AVLIB" works--the first time. Then I get "ERR:SYNTAX".

Deleting it first didn't seem to work until I added an extra null byte to the end, and even then it acts weird:  it works the first time, then ERR:SYNTAX (but the list got deleted), and then it works again, then it just saves 0 to the only element (even though the correct value, 2, is displayed).

But what's really strange is starting the 4th time(?), as I run it over and over, the free RAM displayed in the Memory menu goes UP, even with the same result, but the list gives an ERR:MEMORY when I try to open it.  Calcsys shows a size of 2080.

This is the code that I'm using:
Code: [Select]
Lbl RET
 Disp r1>Dec
 [015D]->Str0RV
 "AVLIB"
 [00]
 DelVar Srt0RV
 [015D]->Str1RV
 "AVLIB"
 GetCalc(Str1RV,1)->Z
 If Z
  r1->float{Z}
 End
Return

I tried adding the extra null byte when I made the new list and the first time that will work (as in the List menu loads right), but the second time the List menu looks like this:
Code: [Select]
NAMES OPS MATH
1:L1
2:
3:!



and then it's not too hard to do a RAM clear :)

Is this an Axe bug or my error?

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Custom lists
« Reply #1 on: September 30, 2010, 11:41:58 pm »
This is what Asm in 28 days has to say about how lists are structured:
Quote
Lists
Spelled with object type (ListObj or CListObj), followed by token tVarLst, and either:
    * A list name token and a null. or
    * Up to five tokens and a null.

OP1     +1     +2     +3     +4     +5     +6     +7     +8     
RealObj     tVarLst     tL1     $00     ??     ??     ??     ??     ??     List L1
CListObj     tVarLst     tD     tI     tS     tT     $00     ??     ??     Complex list LDIST

I hope you can get the code working soon. :)  Good luck! ;D
Welcome to Omnimaga, by the way. :)

Offline scottywz

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
Re: Custom lists
« Reply #2 on: October 01, 2010, 12:34:59 am »
Well the SDK docs said the same thing and my code seems to be using the format correctly (save for the extra null when deleting the variable).  Tried removing the extra null and the variable won't delete.

I hope you can get the code working soon. :)  Good luck! ;D
Welcome to Omnimaga, by the way. :)
Thank you! :)

Edit:  Using L1 ([015D0000]) works twice without a syntax error, then starts writing the wrong value, and then a memory error after around 6-8 times, just like the custom name.
« Last Edit: October 01, 2010, 01:18:20 am by scottywz »

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Custom lists
« Reply #3 on: October 01, 2010, 08:37:56 am »
Enjoy :)

Code: [Select]
Lbl RET
 Disp r₁►Dec
 [015D]→Str1RV
 "AVLIB"
 [00]
 If GetCalc(Str1RV,9)→Z
  1→{Z-2}ʳ
  r₁→float{Z}
 End
Return
« Last Edit: October 01, 2010, 08:38:38 am by Runer112 »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Custom lists
« Reply #4 on: October 01, 2010, 09:36:07 am »
Oh hi and welcome here scottywz. :)

I'll need to study this code for a bit I think because I don't get most parts of it, especially what [015D]->Str1RV is for.

Offline scottywz

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
Re: Custom lists
« Reply #5 on: October 01, 2010, 11:13:55 am »
Thanks Runer12, that worked.

[015D] is ListObj and the list token because Axe Parser won't insert ListObj otherwise (this wasn't in the documentation I think), and typing the list token didn't work.  Str1RV ended up being redundant because I was trying different things trying to get it to work.
« Last Edit: October 01, 2010, 11:15:38 am by scottywz »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Custom lists
« Reply #6 on: October 01, 2010, 05:17:12 pm »
Ah ok. I noticed that certain tokens in particular won't get parsed correctly in Axe. For example, I typed the Omnimaga logo made of the greek calculator characters a while ago and used Disp, and after parsing, when I tried the program, certain did not show up properly. I think it had to do with the fact some were 2-byte tokens, though.