home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / python / maclibnx.lha / intercept.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-14  |  1.3 KB  |  44 lines

  1. /* The structure of the 'device switch' used by the standard I/O library.
  2.    It is possible to install your own versions of selected routines
  3.    by storing function pointers into this table.  The structure of
  4.    the control block for the dev_write function is also given.
  5.  
  6.    Careful! this information was gathered by disassembling parts
  7.    of the library.  There are no guarantees that the same code will
  8.    work in future versions of MPW.
  9.    Part of it has been tested with versions 1.0B1 trough 2.01.
  10.    
  11.    Public domain by Guido van Rossum, CWI, Amsterdam (July 1987).
  12. */
  13.  
  14. typedef int (*funcptr)();    /* Pointer to integer function */
  15.  
  16. struct device {
  17.     long    dev_name;    /* 'FSYS', 'CONS' or 'SYST' */
  18.     funcptr    dev_faccess;
  19.     funcptr dev_close;
  20.     funcptr dev_read;
  21.     funcptr dev_write;
  22.     funcptr dev_ioctl;
  23. };
  24.  
  25. extern struct device _StdDevs[];
  26.  
  27. #define DEV_FSYS 0
  28. #define DEV_CONS 1
  29. #define DEV_SYST 2
  30.  
  31. /* Control block for dev_write (arg 1 is a pointer to this).
  32.    You might guess that dev_read is similar. */
  33.  
  34. struct controlblock {
  35.     long io_filler1;    /* Flags? */
  36.     long io_filler2;    /* Some pointer */
  37.     long io_filler3;    /* Zero */
  38.     long io_nbytes;        /* Number of bytes to write */
  39.                 /* (Reset this to zero after writing) */
  40.     char *io_data;        /* Start of data buffer */
  41. };
  42.  
  43. #define IO_OK 0            /* Return value from dev_write */
  44.