signal()
--------
NEW : v2.11 Beta #2

Declaration:
  void (*signal(int sig, void (*func) (int sig) ))(int);

Notes:
  Assigns a new exception handler for 'sig' exception.
  Warning, most exceptions execute during an 'CPU Exception handler' and
    therefore are using a small locked stack provided by the DPMI host.
    Try to keep your code to a minimal or switch to your own stack (but you
    must switch back before returning).


 Signal   Meaning                            Default Action

 SIGABRT  Abnormal termination               = to calling _exit(3)
 SIGFPE   Bad floating-point operation       = to calling _exit(1)
          Arithmetic error caused by        
          division by 0, invalid operation, 
          etc.                              
 SIGILL   Illegal operation                  = to calling _exit(1)
 SIGINT   Control-C interrupt                = to calling _exit(1)
 SIGSEGV  Invalid access to storage          = to calling _exit(1)
 SIGTERM *Request for program termination    = to calling _exit(1)

  * - can only be triggered thru raise()

  All exceptions by default are assigned a simply exception handler that
will either pass the exception down the chain or terminate the program
immediately.  In either case the program will terminate, either by QLIB
or by the DOS extender (or DPMI host).

  If 'func' is any of the following then signal() performs a special task.

 func     Meaning

 SIG_DFL  Restore exception handler with default handler
 SIG_IGN  Ignores exception from this point on.  This is not advised as
          the instruction that caused the exception will be executed again.
          This will cause the CPU to go into an unbreakable loop.

  Return value:
    if successful : returns old exception handler
    if not successful : returns SIG_ERR

ANSI-C:
  - When the exception handler is called it is passed one parameter that
    is the signal # (SIGABRT, SIGFPE, etc.).
    ANSI-C declaration:
      func(int sig);
Borland C++ extensions:
  Borland has created some 'extensions' to the ANSI-C exception handler
  parameters passed.  QLIB supports them with some modification.
  - All exception are called with one extra parameter (subcode)
    QLIB Declaration:
      func(int sig, int subcode);
  - If the exception is SIGSEGV, SEGILL or SIGFPE (only FPE_INTDIV0 or
    FPE_INTOVFLOW) it is also passed a reglist.
    QLIB Declaration:
      func(int sig, int subcode, int *reglist)
  Where:
    sig - the usually sig #
    subcode - exact cause of signal (see tables below)
    reglist - a pointer to a list of registers that the func may modify
              These regs are used when the exception returns to the
              interrupted code.
    NOTE : When modifying the values in the reglist you MUST do so thru
           the stack.  Therefore you must insert ASM {} into your C code
           to do so.  See \test\signal.c for an example.
    The reglist looks like this:
      EBP, EDI, ESI, DS, ES, EDX, ECX, EBX, EAX, EIP, CS, EFLAGS,
      ESP, SS, FS ,GS
    Everything from ESP to GS is a QLIB extension and is not supported by BC.
  Notes:
    The sig # is given to the func so that you could create one function
    to handle many exceptions.  The subcode is provided to further indicate
    the cause of the exception.

  SIGFPE Type Signals (subcodes)
 
These SIGFPE-type signals can occur (or be generated).

They correspond to the exceptions that the 8087 family is capable of
detecting, as well as the

  "INTEGER DIVIDE BY ZERO"
and
  "INTERRUPT ON OVERFLOW"

exceptions on the main CPU.

The declarations for these signals are in FLOAT.H.

  SIGFPE signal   Meaning
 
  FPE_EXPLICITGEN User program executed raise(SIGFPE)
                 
  FPE_INEXACT     Precision
  FPE_INTDIV0     Integer divide by zero
  FPE_INTOVFLOW   INTO executed with OF flag set
  FPE_INVALID     Invalid operation
  FPE_OVERFLOW    Numeric overflow
  FPE_UNDERFLOW   Numeric underflow
  FPE_ZERODIVIDE  Division by zero
  FPE_NOFPU       No Floating Point Unit available  (QLIB only)

The FPE_INTOVFLOW and FPE_INTDIV0 signals are generated by integer
operations, and the others are generated by floating-point operations.


  SIGSEGV Type Signals (subcodes)
 
These SIGSEGV-type signals can occur:

  SIGSEGV Signal    Meaning
 
  SEGV_EXPLICITGEN  User program executed raise(SIGSEGV)
                   
  SEGV_BOUND        Bound constraint exception
  SEGV_PAGEFAULT    Page fault exception  (QLIB only)

  SIGILL Type Signals (subcodes)
 
These SIGILL-type signals can occur:

  SIGSEGV Signal   Meaning
 
  ILL_EXPLICITGEN  User program executed raise(SIGILL)
                  
  ILL_EXECUTION    Illegal operation attempted
