home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.apple2
- Path: sparky!uunet!comp.vuw.ac.nz!actrix!David.Empson
- From: David.Empson@bbs.actrix.gen.nz
- Subject: Re: need help with SFGetFile
- Organization: Actrix Information Exchange
- Date: Thu, 23 Jul 1992 13:15:57 GMT
- Message-ID: <1992Jul23.131557.11143@actrix.gen.nz>
- References: <1992Jul21.221425.12406@oakhill.sps.mot.com>
- Sender: David.Empson@actrix.gen.nz (David Empson)
- Lines: 48
-
- In article <1992Jul21.221425.12406@oakhill.sps.mot.com> jasonp@fantasia.UUCP (Jason Perez) writes:
- >
- > [using SFGetFile with ORCA/C 1.3, having trouble with filter procedure]
- >
- > pascal int OpenFilter(ptr DirEntry)
- > {
- > return noSelect; <this should simple not let me select ANY file>
- > }
- >
- > what happens is that SFGetFile is called, the open file dialog box comes up,
- > and ALL files are displayed and selectable. i can accept a file and the dialog
- > box goes away. so it looks like the filter function is NOT being called.
-
- The problem is that ORCA/C uses a different calling convention from
- the toolbox: return values are passed in registers, rather than on the
- stack, which is where the toolbox expects them.
-
- For any function called by the toolbox, including Standard File filter
- procedures, Window Manager 'update' routines, etc., you need to tell
- ORCA/C that the function should use toolbox-style return values. You
- do this using the '#pragma toolparms' directive.
- ORCA/C also needs to be told to set up the data bank register on entry
- to the function, by using the '#pragma databank' directive.
-
- Replace your filter procedure with the following:
-
- /*----- C fragment starts here -----*/
- #pragma toolparms 1
- #pragma databank 1
-
- pascal int OpenFilter(ptr DirEntry)
- {
- return noSelect; <this should simple not let me select ANY file>
- }
-
- #pragma databank 0
- #pragma toolparms 0
- /*----- C fragment ends here -----*/
-
- These directives are documented in chapter 11 of the ORCA/C manual
- ("The Preprocessor"), on pages 203 and 210 of the second edition manual.
- See also chapter 3 "Compiler Directives", section titled "Procedures
- called from the Toolbox" (about pages 18-19).
- --
- David Empson
-
- Internet: David.Empson@bbs.actrix.gen.nz EMPSON_D@kosmos.wcc.govt.nz
- Snail mail: P.O. Box 27-103, Wellington, New Zealand
-