[futurebasic] Strings limited to 256 Chars

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 1999 : Group Archive : Group : All Groups

From: Sean -G3- <mclaughlin@...>
Date: Sun, 16 May 99 16:46:16 -0400
I have to use more than 256 bytes of string data. I have made a routine 
for handling this, sort of.

The routine I made accepts a string (up to 256 bytes), and adds it to an 
array of strings. You can store up to 50 * 256 bytes of string data. 
Then, another routine takes all the data in the array of strings and puts 
it into a pointer (60,000 bytes is already cleared for this pointer).

That routine moves the data from the array into the pointer in a FOR loop 
which does:
- Increments count from 1 to the depth of the array

- Get a pointer to the array sub count, by simply using @
- Get the length of the array sub count
- Do a blockmove from the array pointer, to (large pointer + 
(256*count)-256)

Then, since its just a test program, it prints PSTR$(myPointer&). It 
freezes me up when I run it. Heres the source:


DIM gStringArrayLength, gStringArrayDepth
DIM gStringArray$(50)
END GLOBALS
'------------------------------------------
CLEAR LOCAL
LOCAL FN buildTransString(x$)
  DIM length, totalLength, lengthLeft, temp$
  
  length = LEN(x$)
  totalLength = length + gStringArrayLength
  lengthLeft = 256 - gStringArrayLength
  
  LONG IF totalLength>256
    temp$ = gStringArray$(gStringArrayDepth) + LEFT$(x$,lengthLeft)
    gStringArray$(gStringArrayDepth) = temp$
    
    INC(gStringArrayDepth)
    gStringArrayLength = length-lengthLeft
    temp$ = RIGHT$(x$,gStringArrayLength)
    gStringArray$(gStringArrayDepth) = temp$
    
  XELSE
    
    temp$ = gStringArray$(gStringArrayDepth) + x$
    gStringArray$(gStringArrayDepth) = temp$
    gStringArrayLength = totalLength
    
  END IF
END FN
'------------------------------------------
LOCAL FN displayArray
  DIM length, offset
  
  FOR count = 1 TO gStringArrayDepth
    offset = (count*256) - 256
    length = LEN(gStringArray$(count))
    BLOCKMOVE @gStringArray$(count), myPointer&+offset, length
  NEXT
  
  PRINT PSTR$(myPointer&)
  
END FN
'------------------------------------------
WINDOW 1
myPointer& = FN NEWPTR _Clear(60000)
gStringArrayDepth = 1
temp$ = "abcdefghijklmnopqrstuvwxyz"

FN buildTransString(temp$)
FN buildTransString(temp$)
FN buildTransString(temp$)
FN buildTransString(temp$)
FN buildTransString(temp$)
FN buildTransString(temp$)
FN buildTransString(temp$)
FN buildTransString(temp$)
FN buildTransString(temp$)
FN buildTransString(temp$)
FN buildTransString(temp$)
FN buildTransString(temp$)

FN displayArray


'------------------------------------------
DO
  HANDLEEVENTS
UNTIL gProgramEnds

All the program *should* do is display "abcdef....." like 12 times. Thats 
over 256 characters....