home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / mac / programm / 22099 < prev    next >
Encoding:
Internet Message Format  |  1993-01-24  |  1.6 KB

  1. Path: sparky!uunet!wupost!crcnis1.unl.edu!crcnis1.unl.edu!manager
  2. From: mgleason@cse.unl.edu (Mike Gleason)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Think C & #pragma parameter (was: help calling assembly from C)
  5. Date: 25 Jan 1993 03:10:51 GMT
  6. Organization: NCEMRSoft
  7. Lines: 26
  8. Distribution: usa
  9. Message-ID: <1jvlnrINNst4@crcnis1.unl.edu>
  10. References: <2B6198C1.22487@news.service.uci.edu> <keith-240193173019@kip-50.taligent.com>
  11. NNTP-Posting-Host: cse.unl.edu
  12.  
  13. keith@taligent.com (Keith Rollin) writes:
  14.  
  15. |You came really close to answering your own question. You know that there
  16. |are Mac OS functions that work like this, so why don't you declare your
  17. |function the same way they are? For instance:
  18.  
  19. |#pragma parameter DisposePtr(__A0)
  20. |pascal void DisposePtr(Ptr p); 
  21.  
  22. |This is an example of a function that simply takes a parameter in A0.
  23. |Here's a more complex example:
  24.  
  25. |#pragma parameter __D0 HoldMemory(__A0,__A1)
  26. |pascal OSErr HoldMemory(void *address,unsigned long count); 
  27.  
  28. Well, I found out the hard way awhile back that this doesn't work like one
  29. would expect in Think C 5.  Think C's #pragma parameter only works on "sub-
  30. sequent inline function definitions" (p. 194 of the manual).  So in Think C,
  31. you can't really use this for your own functions unless you bother with crap
  32. like "void foo(void) = { 0x4e71, 0x4e71, etc... };"  I wouldn't mind if Think
  33. C required the whole function to be in gazzembly, but accepting only raw hex
  34. is unacceptable.
  35.  
  36. --
  37. ______________________________________________________________________________
  38. mike gleason                 mgleason@cse.unl.edu             NCEMRSoft, baby!
  39.