home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / apple2 / 17798 < prev    next >
Encoding:
Text File  |  1992-07-23  |  2.2 KB  |  60 lines

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