home *** CD-ROM | disk | FTP | other *** search
/ MacGames Sampler / PHT MacGames Bundle.iso / MacSource Folder / Samples from the CD / Editors / emacs / Emacs-1.14b1-sources / sources / mac-emacs-src / PPC-traps.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-25  |  1.2 KB  |  44 lines  |  [TEXT/EMAC]

  1. /*
  2.  * Copyright (C) 1994 Marc Parmet.
  3.  * This file is part of the Macintosh port of GNU Emacs.
  4.  *
  5.  * GNU Emacs is distributed in the hope that it will be useful,
  6.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  7.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  8.  * GNU General Public License for more details.
  9.  */
  10.  
  11. #if defined(THINK_C)
  12. #include <MacHeaders>
  13. #else
  14. #include <Types.h>
  15. #include <Memory.h>
  16. #include <Resources.h>
  17. #include <MixedMode.h>
  18. #include <FragLoad.h>
  19. #endif
  20.  
  21. #include "68k-traps.h"
  22.  
  23. /* This is the PPC glue to the code resource mentioned in 68k-traps.c. */
  24.  
  25. void
  26. execute_68k_trap(int (*code)(),char *stack_data,int stack_size,
  27.                  struct regs_for_68k_traps *regs)
  28. {
  29.     Handle execute_68k_trap_Handle;
  30.     static UniversalProcPtr execute_68k_trap_upp = 0L;
  31.  
  32.     if (execute_68k_trap_upp == 0L) {
  33.         execute_68k_trap_Handle = GetResource('CODE',128);
  34.         if (execute_68k_trap_Handle == 0L) ExitToShell();
  35.         HNoPurge(execute_68k_trap_Handle);
  36.         HLock(execute_68k_trap_Handle);
  37.         execute_68k_trap_upp = NewRoutineDescriptor((long (*)())*execute_68k_trap_Handle,
  38.             execute_68k_trap_ProcInfo,kM68kISA);
  39.     }
  40.     
  41.     CallUniversalProc(execute_68k_trap_upp,execute_68k_trap_ProcInfo,
  42.         code,stack_data,stack_size,regs);
  43. }
  44.