Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!mips!apple!bbn!metasoft!ivan From: ivan@metasoft.UUCP (Ivan Hajadi) Newsgroups: comp.sys.mac.programmer Subject: How can we catch signals using MacOS ? Keywords: signals, unix, trap Message-ID: <1033@metasoft.UUCP> Date: 2 Jan 90 20:28:52 GMT Organization: Meta Software Corporation, Cambridge MA Lines: 35 I am porting an application from SunOS to MacOS. I use Think C 4.0 on Mac SE/30. I need to be able to catch a trap on minus condition. I am able to do this in unix using signal system call to install my handler (see enclosed codes). The signal function available in the unix library of Think C seems to be bogus. As far as I know if trapmi is executed, then MacOS will simply draw a bomb with id=12(?). Is there anyway I can tell the MacOS to call my routine, when trapmi instruction is executed by the processor and avoid the bomb ? This is how I do it on unix: When the program starts, it calls setupsignals(). setupsignals() { signal(SIGFPE, ghandle); ... } When trapmi instruction encountered, my ghandle function will be called. ghandle(int signal,......) { if (signal == SIGFPE) { } .... } I appreciate any suggestion. Thank you. -- ivan