[Ohrrpgce] thoughts about slice handles

James Paige Bob at HamsterRepublic.com
Wed Jan 14 10:12:14 PST 2009


So I am thinking about slice handles.

As I have implemented them so far, slice handles are >0 indexes into the 
plotslices() array.

I was thinking about the conversion of floating plotstrings to string 
slices. String handles are currently static numbers from 0-31

What if I make it so that slice handles start at some higher number like 
say 100000. now, slice handle 100000 would actually be plotslices(0) and 
100001 would be plotslices(1)

So suppose you pass a static string handle of 31 to "append ascii"

That slice handle would be pulled from a static unfreeable list of 
string slice handles created when the program starts.

But if you pass 100004 which happens to be the return result of "new 
string slice" as the handle for "append ascii", then it will know to 
pull that string slice handle from plotslices(4).

Even though plotslices() and staticstringslices() would be separate 
tables, they would still be populated with pointers to slices in the 
same slice tree, so old static strings would be fully interchangeable 
with other slices for string operation purposes.

That would NOT give you the ability to use old static string handles for 
things like anchor & alignment changes or tree-heirachy-relocation, but 
that would be okay.

The same approach could be used later also for other handles that get 
converted into slices (for example, maybe custom menu handles).

This seems like the best approach to enable slices while maintaining 
backwards compatability with existing code, and with the right wrapper 
functions it would not be to rough to code.

Any thoughts?

---
James Paige



More information about the Ohrrpgce mailing list