02-20-2004, 08:51 AM
Code:
DIM name.length AS LONG
DIM name.segment.amount AS LONG
DIM name.amount AS LONG
DIM name.segment.length AS LONG
name.segment.length = 1024
name.segment.amount = (name_length - 1) \ name.segment.length + 1
name.amount = 0
DIM name.string(name.length) AS INTEGER
DIM name.segStart(name.segment.amount) AS LONG
DIM name.segEnd(name.segment.amount) AS LONG
DIM name.recStart(name.amount) AS LONG
DIM name.recEnd(name.amount) AS LONG
This is a structure for a global string in a program I am desperately trying to make. I want it to be designed for easy deletion/creation/size modificaton for each sub-string. This is not just for a global string: I intend to make this structure for a few other uses as well (INTEGER, etc).
The entire string is inside the name.string() array.
Each individual string "record" is made up of a set of string segments.
Each string segment refers to a part of the name.string() array.
Thus, to access an entire string record, this is done:
Code:
'for record 5:
record = 5
FOR i% = name.recStart(record) TO name.recEnd(record)
FOR j% = name.segStart(i%) TO name.segEnd(i%)
PRINT CHR$(name.segStart(i%));
NEXT j%, i%
Thus, it's possible to change the segment lengths and the record lengths too without redefining the entire array each time.
And, here are my names for creating and changing the size of the records:
Code:
FUNCTION create.flex.string
END FUNCTION
FUNCTION paste.flex.string
END FUNCTION
FUNCTION cut.flex.string
END FUNCTION
FUNCTION delete.flex.string
END FUNCTION
FUNCTION defrag.flex.string
END FUNCTION
I haven't figured out all the details yet, but I was just wondering whether anyone had any better naming ideas. Perhaps a naming convention for this sort of thing?
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Visit www.neobasic.net to see rubbish in all its finest.