[futurebasic] Re: [FB] Blockmove

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

From: Rich Love <richlove@...>
Date: Sun, 30 May 2004 15:31:51 -0500
Those are great suggestions. I will try each and see which is best for 
me.
The purpose for doing this is to shift a character array used as a 
scroll buffer.
XREF@ Array% (960, 207).....  960 is the number of rows in the buffer 
and 207 is the number of columns.
I want to shift the rows back one row.



Rich Love - Carnation Software
MacWise Terminal emulation for Macintosh
richlove@...
http://www.carnation-software.com
512 858-9234

On May 30, 2004, at 1:33 PM, Jay Reeve wrote:

> On Sunday, May 30, 2004, at 09:39  AM, Rich Love wrote:
>
>> I am block moving an array. It does work but I want to know if it is 
>> memory safe.
>> I am moving a block of memory from location 2 in the array to 
>> location 1.
>> What worries me is that I am moving the max number of bytes (397490) 
>> that the array is XREF'd.
>>
>> Is FB kind enough to let me do this or should I worry that I am 
>> corrupting some memory that is out of the bounds of my array?
>>
>> Here is the sample:
>>
>> XREF@ Array% (960, 207)
>> Array& = FN NEWHANDLE(397490)
>>
>> BLOCKMOVE @ Array%(2,0),@ Array%(1,0), 397490
>
> Rich,
>
> You can probably get away with this in PPC. I think it would be very 
> dangerous in OSX, although because of the exact numbers you are using, 
> it will probably let you get away with it.
>
> Let me suggest 3 alternatives, though:
>
> 1. Why not move only the bytes that are in the array to start with--
>
> BLOCKMOVE @ Array%(2,0),@ Array%(1,0), 397490 - (@ Array%(2,0) - @ 
> Array%(1,0))
>
> 2.   You could also deref the handle and use another XREF to access it 
> without moving any  memory--
>
> XREF shiftedArray%(960, 207)
> shiftedArray = [Array]
>
> 3. Switch to Dynamic arrays, and move only the part of the array 
> actually in use--
>
> DYNAMIC Array%(960, 207)
> BLOCKMOVE @ Array%(2,0),@ Array%(1,0), 397490 - (([[@Array] + 
> _AutoXREFCurr]-2) *207* sizeof(int))
>
> I'm not sure why you want to shift the entire array, including the 
> garbage bytes beyond the end of it, but I imagine one of these 
> approaches will be cleaner and safer.
>
> HTH
>  e-e
>  =J= a  y
>   "
>
> --
> To unsubscribe, send ANY message to: 
> futurebasic-unsubscribe@...

--
To unsubscribe, send ANY message to: futurebasic-unsubscribe@...