[futurebasic] Re: [FB] Passing Record References

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2009 : Group Archive : Group : All Groups

From: Max Taylor <maxclass@...>
Date: Wed, 8 Jul 2009 17:21:40 -0700
The following code snippets show the record definition and the  
initialization of the record with a throughly test input value that  
produces the correct results with all of the settings except the  
second and third fields.

I have absolutely no idea why the errors occur but if I "rem" out  
those two lines the entire program compiles perfectly.

Any thoughts?


begin record GenericFileRec
//dim SizeofSuperClassOfIMxFile as IMxObject

// File Class Definitions
dim as str255 fileNameStr
dim as FSRef  fileFolderRef
dim as FSRef  fileFSRef
dim as UInt8  fileID
dim as long  fileHeaderLen
dim as long  fileIsOpen
dim as OSStatus returnedErr

// Sub Class Definitions
dim as pointer fileDataPtr
dim as long  fileMark
dim as long  fileRecLen
dim as long  fileLength
dim as long  fileEof
end record

[snip code]

local fn MxFileInitialize( self as ^GenericFileRec )
//——————————————————————

// MxFile Class Definitions

self.fileNameStr = ""
self.fileFolderRef = 0//_nil
self.fileFSRef = 0//_nil
self.fileID = _nil
self.fileHeaderLen = _nil
self.fileIsOpen = _false
self.returnedErr = _noErr

// Sub Class Definitions

self.fileDataPtr = _nil
self.fileMark = _nil
self.fileRecLen = 24//_nil
self.fileLength = _nil
self.fileEof = _nil
end fn

The second and third assignment in "MxFileInitialize" above produces  
the following errors with or without the _nil. The error arrows point  
to the assignment value (in this case zero or _nil).

They are the only errors in the entire file and the only ones dim'd as  
"FSRef". FBtoC does not like them.


Error:•• Assignment requires record or pointer to record in line 329  
of NewMxFile: 0
  329:  self.fileFolderRef = 0//_nil
                                  ^
Error:•• Records must be same type in line 329 of NewMxFile: FSRef =  
ptr to long
  329:  self.fileFolderRef = 0//_nil
                                  ^


Error:•• Assignment requires record or pointer to record in line 330  
of NewMxFile: 0
  330:  self.fileFSRef = 0//_nil
                              ^
Error:•• Records must be same type in line 330 of NewMxFile: FSRef =  
ptr to long
  330:  self.fileFSRef = 0//_nil
                              ^

Max Taylor
The MaxClass Guy