In a message dated 7/30/01 7:57:37 PM, futurebasic-digest-help@...
writes:
<< I too had repeated problems with the STR# filter. I had to create my own
and
not use the filter because I could not find out what needed "fixing" in the
filter. Could you post what and how you "fixed" the filter? I would much
appreciate your help. For others info, the problem I had was an unexplained
corruption of resources which I did not write to after just reading the STR#
resources and in some cases doing a replace of one STR# resource and then
after quitting the app, resedit reported a corruption of a different STR#
resource.
George Wood >>
I'm on vacation now and I forgot to move my modified str#.incl onto my iMac.
But I don't know that I corrected any errors, I just wanted to sort
differently and scroll a list differently.
as far as your resource errors, yes I have had some of these too and I am
concerened about the way I open, move and close resorse files. I recently
learned from this list that I should flush the files that I have written
resources to, after closng them. This may help both of us. I have not
incorporated this technique enough to know if my corrupt resource problem is
over (it never happened much anyway).
Here are a couple of modifed routines I uses with str#:
'=========================================
LOCAL FN PQapndElement(theID,theTxt$)
'---------------------------------------
' Add an element to the end of a STR#
' resource.
'---------------------------------------
DIM resHndl&,err,OSErr
resHndl& = FN GETRESOURCE(_"STR#",theID)
err = _noErr
LONG IF resHndl&
FN HNOPURGE(resHndl&)
DEF APNDSTR(theTxt$,resHndl&)
'CALL CHANGEDRESOURCE(resHndl&) this line commented out!
err = FN chkResErr
END IF
END FN = err
'=========================================
LOCAL FN jobSortStrRes(theID,thenum%)
'---------------------------------------
' Sort elements of STR# resource
' alphabetically. Case is ignored.
'---------------------------------------
DIM err,OSErr,elemCnt,ptr&,l,resHndl&
DIM pLoop,gap,switch,loop
DIM test,theSize&,newRes&,refill
XREF @sHndl&(32000)
currentcursor=13001
err = _zTrue
resHndl& = FN GETRESOURCE(_"STR#",theID)
LONG IF resHndl&
theSize& = FN GETHANDLESIZE(resHndl&)
LONG IF theSize&
FN HLOCK(resHndl&)
elemCnt = {[resHndl&]}
LONG IF elemCnt > 1
sHndl& = FN NEWHANDLE _clear((elemCnt + 1)*4)
ptr& = [resHndl&] + 2
FOR pLoop = 1 TO elemCnt
sHndl&(pLoop) = ptr&
ptr& = ptr& + PEEK(ptr&) + 1
NEXT pLoop
'-----------------------------------
gap = elemCnt
DO
gap = gap/1.3
IF gap < 1 THEN gap = 1
switch = _false
FOR loop = 1 TO elemCnt - gap
test = loop + gap
'-------------------------------
' This is the sort's conditional.
' Change the next line if you
' want to change the order or
' type of sort.
'-------------------------------
' LONG IF PSTR$(sHndl&(loop)) > PSTR$(sHndl&(test))
' SWAP sHndl&(loop),sHndl&(test)
' switch = _zTrue
' END IF
LONG IF everyforth>800
currentcursor=FN animatecursor (currentcursor)
everyforth=1
END IF
INC (everyforth)
t1$=PSTR$(sHndl&(loop))
t2$=PSTR$(sHndl&(test))
long if thenum%=2
LONG IF VAL(t1$)<VAL(t2$)
SWAP sHndl&(loop),sHndl&(test)
switch = _zTrue
END IF
xelse
LONG IF VAL(t1$)>VAL(t2$)
SWAP sHndl&(loop),sHndl&(test)
switch = _zTrue
END IF
end if
NEXT loop
UNTIL switch = _false AND gap = 1
'-----------------------------------
newRes& = FN NEWHANDLE(theSize&)
LONG IF newRes&
FN HLOCK(newRes&)
% [newRes&],elemCnt
ptr& = [newRes&] + 2
FOR refill = 1 TO elemCnt
l = PEEK(sHndl&(refill)) + 1
BLOCKMOVE sHndl&(refill),ptr&,l
ptr& = ptr& + l
LONG IF everyforth>80
currentcursor=FN animatecursor (currentcursor)
everyforth=1
END IF
INC (everyforth)
NEXT
BLOCKMOVE [newRes&],[resHndl&],theSize&
CALL CHANGEDRESOURCE(resHndl&)
FN HUNLOCK(resHndl&)
FN HNOPURGE(resHndl&)
err = FN chkResErr
DEF DISPOSEH(newRes&)
END IF
DEF DISPOSEH(sHndl&)
END IF
END IF
END IF
END FN = err
Bruce Moore