Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
22 May, 2013, 15:43:29 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1]   Go Down
  Print  
Author Topic: HBJ needs some string help. - HBJ needs some string help.  (Read 312 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Happybobjr
James Oldiges
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 01:59:20
Date Registered: 01 June, 2010, 00:52:05
Location: IN, United States
Posts: 2273


Topic starter
Total Post Ratings: +100

View Profile
« on: 11 January, 2012, 00:43:50 »
0

Ok, so i have 152 strings in an appvar, and each is 10 characters (1-byte) long.
Well the names in them are between 3 and 10 characters long, but i only know how to call on them if their length is uniform.
for example... "natham____" (_ = space)

Is there any more efficient ways to do this?
Logged

School: East Central High School

Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Non-Cas |||  OS: 1.1 |||  Build: Old  |||  84+ keypad.   Being lent out
____________________________________________________________
Quigibo
The Executioner
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Yesterday at 02:03:21
Date Registered: 22 January, 2010, 05:02:37
Location: Los Angeles
Posts: 2022


Total Post Ratings: +1019

View Profile
« Reply #1 on: 11 January, 2012, 01:57:48 »
0

Since I've seen this asked several times, I decided to add a command for it to the next version Smiley

But for now, you can do this using the fact that each string is zero terminated.  All you have to do is start at the pointer and then increase it until you pass N zeros to get the Nth string.
« Last Edit: 11 January, 2012, 01:58:34 by Quigibo » Logged

___Axe_Parser___
Today the calculator, tomorrow the world!
Happybobjr
James Oldiges
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 01:59:20
Date Registered: 01 June, 2010, 00:52:05
Location: IN, United States
Posts: 2273


Topic starter
Total Post Ratings: +100

View Profile
« Reply #2 on: 11 January, 2012, 01:59:15 »
0

Thanks Cheesy
Logged

School: East Central High School

Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Non-Cas |||  OS: 1.1 |||  Build: Old  |||  84+ keypad.   Being lent out
____________________________________________________________
Runer112
Anti-Riot Squad
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 05:42:54
Date Registered: 02 July, 2009, 06:38:05
Posts: 1679


Total Post Ratings: +492

View Profile
« Reply #3 on: 11 January, 2012, 02:04:39 »
0

Why add a whole new command for it? Just make Data() not barf when you put static data inside of it, and making speedy data LUTs with anonymous entries would be a piece of cake. Wink

Data("Hello"r,"there!"r,"I"r,"am"r,"a"r,"LUT"r,"of"r,"strings."r)→Str0
« Last Edit: 11 January, 2012, 02:07:55 by Runer112 » Logged
Quigibo
The Executioner
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Yesterday at 02:03:21
Date Registered: 22 January, 2010, 05:02:37
Location: Los Angeles
Posts: 2022


Total Post Ratings: +1019

View Profile
« Reply #4 on: 11 January, 2012, 02:16:26 »
0

@Runer, that wasn't what I was referring to... the actual lookup table is easy enough to generate already: "Hello"[00]"World"[00]"GoodBye"[00] etc.  I was referring to a command that takes the table and an index and the returns the pointer to that string.

EDIT: Also, I just realized you were talking about something entirely different.  That type of command is difficult with Axe's limited memory because you can't determine where to put the static data until the size of the Data() command is known.
« Last Edit: 11 January, 2012, 02:23:22 by Quigibo » Logged

___Axe_Parser___
Today the calculator, tomorrow the world!
Runer112
Anti-Riot Squad
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 05:42:54
Date Registered: 02 July, 2009, 06:38:05
Posts: 1679


Total Post Ratings: +492

View Profile
« Reply #5 on: 11 January, 2012, 02:23:40 »
0

I figured that you weren't referring to the method I was. Your method is the size-optimized method, mine is the speed-optimized method. Tongue Your method would take n+1 bytes of storage for each entry and lookups would run in linear time, whereas my method would take n+2 bytes of storage for each entry and lookups would run in constant time. Unfortunately, my method doesn't work because Axe won't let me put static data inside of Data(). Sad

EDIT: Just read your edit, and I guess that's true. Unless there's some way to get around it by determining the Data() pointer in the first pass and the anonymous data entry pointers in the second pass, but if there was, you would know better than I.
« Last Edit: 11 January, 2012, 02:25:56 by Runer112 » Logged
Quigibo
The Executioner
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Yesterday at 02:03:21
Date Registered: 22 January, 2010, 05:02:37
Location: Los Angeles
Posts: 2022


Total Post Ratings: +1019

View Profile
« Reply #6 on: 11 January, 2012, 02:26:15 »
0

But you can always store the data to static pointers first and then put them in the Data() after. Smiley
« Last Edit: 11 January, 2012, 02:27:00 by Quigibo » Logged

___Axe_Parser___
Today the calculator, tomorrow the world!
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.283 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.