[futurebasic] Re: [FB] FB^3 - Need function help

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

From: Robin <robinc@...>
Date: Tue, 14 Mar 2000 09:16:29 +1000
Mel, re:

> After 2 weeks of many hours of converting my simplest project to FB3,
> I finally have it working. In 68K mode. Which was a total and utter
> waste of time in my opinion since the goal of my whole exercise was
> to make a PPC app.

Hang in there. I've now done a lot of converting and FB^3 handles it all in
PPC.

> The following function can't seem to count the filenames in a folder
> the way 68K mode can. All I get is a zero count. Anyone have a
> solution that works in both worlds without the programmer having to
> remember if the generated code is going to be 68K or PPC?

This will do it in PPC code:

LOCAL FN Warning (txt$,icon)
    'alert user...
END FN

CLEAR LOCAL MODE: DEFINT a-z
DIM pBlock.128
DIM 63 dirName$
DIM 255 pathName$
DIM osErr
LOCAL FN GetFilePath$ (filename$,volRef%)
    'to just get folder path (including if don't know any file names),
    'call with filename$ = ""
    pathName$ = filename$
    IF volRef%=0 THEN EXIT FN
    pBlock.ioNamePtr&      = @dirName$'put pointer to dirName$
    pBlock.ioVRefNum%      = volRef%'set vRefNun
    pBlock.ioDrParID&      = [_curDirStore]'get currect directory ID
    pBlock.ioFDirIndex%    = -1'get info on folder
    DO
        osErr% = FN GETCATINFO (@pBlock)'get catalog info
        LONG IF osErr% = _noErr'no error then...
            LONG IF LEN(pathName$)+LEN(dirName$)>254
                pathName$="File "+filename$+" in too many nested"
                pathName$=pathName$+" folders (path exceeds 255 characters)"
                FN Warning (pathName$,_stopIcon)
                pathName$ = ""
                EXIT FN
            XELSE
                pathName$ =  dirName$ + ":" + pathName$'add dirName to path
                pBlock.ioDrDirID& = pBlock.ioDrParID&'get folder's parent ID
            END IF
        XELSE
            FN Warning("Disk error tracing directory path",_stopIcon)
            pathName$ = ""
            EXIT FN
        END IF
    UNTIL pBlock.ioDirID& = _fsRtParID'volume root ID
END FN = pathName$'will end in ":" if folders only


CLEAR LOCAL MODE: DEFINT a-z
DIM index,count,ftype&,oldnum,increment,placed,fixedvol,doCount,ftime&,valid
DIM newsize&,err,through,tmp&
DIM 255 path$,31 f$, filename$
XREF@ flist.filelistrec(_maxint)
LOCAL FN GetFilesList (volref,initflags,fstatus,hFlist&,mask&,cmptime&)
    'Function to generate a list, count or detection of matching files
    'volref is of the folder you want checked; mask& is long int of file
    path$ = FN GetFilePath$ ("",volref)
    DO
        INC(index)
        f$ = FILES$(-index,"",path$,volref)
        LONG IF f$>"" AND RIGHT$(f$,1)<>":"'is one, & not a folder
            filename$ = f$
            inc(count)
            'add it to a list
            '... you can also screen for file type, creator,
            'creation date etc here for a finer screen
        XELSE
            IF f$="" THEN through = 1
        END IF
    UNTIL through=1 OR count=_maxint
END FN = count

> Also, has anyone written a decent routine that converts FBII source
> to FB3 and "fixes" all these anomalies between the versions? Wading
> through 3000+ FB3 errors takes a LONG time...and if conversion in
> source can't be done smoother and less time intensive, FB3 is of no
> use to me.

Check out my FBII^3 Converter (www.thoughtware.com.au/software/) It's saved
me weeks (shameless plug!)

-- 
Robin
====================================================
Genesearch Pty Ltd
E-mail: robinc@...
WWW:    http://www.genesearch.com.au
====================================================