[futurebasic] Re: Question about Records...

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

From: Mars Saxman <marssaxman@...>
Date: Fri, 27 Mar 98 04:12:37 -0800
>I can read the Manual/Online help as far as creating them goes, but how do
>I pass an entire record to an FN? Or, can I make a record global? Or should
>I give up on records and just make a parameter block? (What's the
>difference between a record and a parameter block?)

You can pass integers, strings, and floats to a function as parameters, 
but FB does not let you pass the entire record.

So you have to resort to a little trick called "pass by reference." 
Instead of passing the entire record to the function, just tell the 
function where to find the record by passing its pointer:

LOCAL FN processThisRecord(theRecordPtr&)
  theRecordPtr&.field% = somevalue&
  othervalue& = theRecordPtr&.otherfield&
END FN

DIM myRec.myType
FN processThisRecord(@myRec)

"Parameter block" is a Mac toolbox term. It is a record that refers to 
one entity - a serial port, a file, a folder. You can pass the same 
record to a series of Toolbox calls; they use the record to communicate 
with each other and to store the current information about the file.

Parameter blocks are often _variant records_, a structure FB doesn't 
support directly. It's a record that can have different sets of fields, 
depending on what the block represents.

-Mars