[futurebasic] Re: HANDANDHAND failure

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 1998 : Group Archive : Group : All Groups

From: Chris.Young@...
Date: Fri, 27 Mar 1998 16:14:18 -0600
Alain

I don't know Alain--I built your code into a little sample and stepped thru it 
with the debugger, where it correctly added both the separator and the second 
data handle. What version of FB are you using? I know in the past that certain 
versions had FN HANDANDHAND defined as hndl2& = FN HANDANDHAND(hndl1&), instead 
of the IM-correct OSErr = FN HANDANDHAND(hndl1&, hndl2&).

You can substitute the IM correct call by using:

LOCAL MODE
LOCAL FN PascalHandAndHand(srcHandle&,@dstPtr&)
`     move.l    ^srcHandle&,A0
`     move.l    ^dstPtr&,A2
`     move.l    (A2),A1
`     _HandAndHand
`     move.l     A0,(A2)
`     move.w   D0,^OsErr
END FN = OsErr

If this clears up the problem, then FB's HANDANDHAND definition on your system 
would be suspect.

As far as a TMPL resource goes, I don't know of a TMPL def parameter for strings
shorter than 256 bytes, so that may be a problem. You could try defining a 
ResEdit TMPL with the following Types:

DLNG    ' RubHndl&
DWRD    ' coupuretiret%
DWRD    ' retourchariot%
DWRD    ' abreviation%
PSTR    ' 50 tagdebut$
PSTR    ' 50 tagfin$

LOL means Lots of Laughs <g>

Chris Young


______________________________ Reply Separator _________________________________
Subject: [FB] HANDANDHAND failure
Author:  apastor@...
Date:    3/27/98 3:01 PM


Hi everybody,

I try to join two pieces of data pointed by handles with a separator in 
between, following is the piece of code that attempts to do it 

'========================================= 
CLEAR LOCAL FN accrocherub(r1,r2)
  DIM 3 sep$
  DIM OSErr
  DIM HandleRub1&,HandleRub2&,strHndl&
        LONG IF r1>0 AND r2>0                'just in case of invalid params
      HandleRub1&=glafiche.RubHndl&(r1) 'get first locked data handle 
      HandleRub2&=glafiche.RubHndl&(r2) 'get second locked data handle
'test first param and if there is something to add
      LONG IF r1=1 AND FN GETHANDLESIZE(HandleRub2&)>1
        strHndl&=FN NEWHANDLE(3)            'ask for a tiny handle 
        LONG IF strHndl& AND FN HLOCK(strHndl&)=_noerr
          sep$=" - "                      'separator string 
          BLOCKMOVE @sep$+1,[strHndl&],3  'fill newly created handle
          OSErr= FN HANDANDHAND(strHndl&,HandleRub1&)'add it to first
data handle
          OSErr=FN HUNLOCK(strHndl&)
          DEF DISPOSEH(strHndl&)           'get rid of the tiny handle
        END IF
     END IF
'now try to add the second data handle to the first one
    OSErr= FN HANDANDHAND(HandleRub2&,HandleRub1&)
  END IF
END FN
'=========================================

The problem is that FN HANDANDHAND seems to work ok if it is called only 
once.
I mean that when I can add the string separator I cannot add the second 
data handle
and if I don't need to add a string separtor the second data handle is 
correctly added to the first.
Can someone tell me what's going wrong here ?
How can I fix this or is there an easiest way to do the same thing ?

Another question, I dimmed a record in my global file like the one below 
:

DIM RECORD rubrique
  DIM RubHndl&
  DIM coupuretiret%
  DIM retourchariot%
  DIM abreviation%
  DIM 50 tagdebut$
  DIM 50 tagfin$
DIM END RECORD.rubrique

then an array of records

DIM glafiche.rubrique(_nbRubriques)

I stored the original values in a custom resource (my app will load it 
when it fires up), but right now, I would like to know if it s possible 
to build a TMPL resource so that I could edit easily in ResEdit the two 
last fields that hold strings. My trials failed until now.

Optionnaly, what does LOL mean ?

Thanks in advance

Alain

--
To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>