[futurebasic] FB3 Pointer Constant Concatenation Confusion

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2000 : Group Archive : Group : All Groups

From: Ian Mann <i.mann@...>
Date: Sat, 29 Jan 2000 15:52:19 +0000
Hi all,

I am using the function below in an FB^3 program I am having trouble
figuring out the correct FB^3 syntax for the line :

h&         = {pmPtr&_bounds_bottom} - {pmPtr&_bounds_top}

any Suggestions ??

Thanks in advance

Ian





' FN plotCicn plots a color OR black and white 'cicn' in the destination

' port or GWorld of your choice.

' INPUTS:      resID%    -    INTEGER: the resource ID number of the
'cicn'
'              dPtr&     -    LONGINT: a pointer to the destination
rect.
'                             (just pass rect name, FB will get the
pointer)
'              dPort&    -    LONGINT: destination port or GWorld
'              inColor%  -    INTEGER: true to use the color icon
' OUTPUT:      none
' GLOBALS:     none

LOCAL MODE
DIM sRect as rect
dim cH&, cicn&, icnMsk&, icnBMap&
dim icnData&, mskData&, bmpData&
dim pmPtr&, maskPtr&, bMapPtr&, h&, maskOS&, bMapOS&, pmOS&
dim hState%, ht%, rowBytes%, osErr%
LOCAL FN plotCicn(resID%,dPtr&,dPort&,inColor%)
cH& = FN GETRESOURCE(_"cicn",resID%)
LONG IF cH& <> _nil                             ' ck for nil handle
hState%    = FN HGETSTATE(cH&)                ' save old handle status
FN HLOCK(cH&)                    ' lock it
cicn&      = [cH&]                            ' deref pointer to cicn
data
  '---------- These offsets from Inside Mac V, pp. 80-81
icnMsk&    = cicn&+_pmReserved+4              ' get ptr to mask
sRect;8    = icnMsk&+_pmBounds                ' extract size
ht%        = sRect.bottom% - sRect.top%         ' calc ht

rowBytes%  = {icnMsk& + _rowBytes}            ' find rowbytes
icnBMap&   = icnMsk&+_bounds+8
icnData&   = icnBMap&+_bounds+8
mskData&   = icnData&+4
bmpData&   = mskData& + rowBytes% * ht%

POKE LONG icnMsk&,mskData&                    ' setup mask bitmap
CALL SETPORT(dPort&)
CALL COPYBITS(#icnMsk&,#dPort&+2,sRect,#dPtr&,_srcBIC,0)' punch mask

pmPtr&     = cicn& + _iconPMap
maskPtr&   = cicn& + _iconMask
bMapPtr&   = cicn& + _iconBMap

h&         = {pmPtr&_bounds_bottom} - {pmPtr&_bounds_top}


maskOS&    = {maskPtr& + _rowBytes} * h&
LONG IF inColor%
bMapOS&  = {bMapPtr& + _rowBytes} * h&
POKE LONG(cicn& + _iconData),(cicn& + 82& + maskOS& + bMapOS&)
POKE LONG(pmPtr& + _pmTable),(cicn& + _iconData)
pmOS&    = 8 + ({[pmPtr&.pmTable&] + _ctSize} + 1) * 8
pmPtr&.baseAddr& = cH&..iconData& + pmOS&
CALL COPYBITS(#(pmPtr& + _baseAddr),#dPort&+2,#(pmPtr& +
_bounds),#dPtr&,_srcXOR,0)
XELSE
bMapPtr&.baseAddr& = cicn& + 82 + maskOS&
CALL COPYBITS(#(bMapPtr& + _baseAddr),#dPort&+2,#(bMapPtr& +
_bounds),#dPtr&,_srcXOR,0)
END IF
FN HSETSTATE(cH&,hState%)            ' restore handle's state
END IF
END FN