home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 6 / Sonderheft_6-96.iso / pd / libraries / patchlib / include / patch.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-04  |  6.0 KB  |  151 lines

  1. #ifndef LIBRARIES_PATCH_H
  2. #define LIBRARIES_PATCH_H
  3. /*****************************************************************************/
  4. /*
  5. **    Filename:    libraries/patch.h
  6. **    Release:    5.0 BETA
  7. **    Date:        20.08.96
  8. **
  9. **    definition of patch.library public structures and returncodes
  10. **
  11. **    (C) Copyright 1993-96 Stefan Fuchs
  12. **    All Rights Reserved
  13. */
  14. /*****************************************************************************/
  15.  
  16. #ifndef    EXEC_TYPES_H
  17. #include <exec/types.h>
  18. #endif
  19.  
  20. #ifndef    EXEC_LISTS_H
  21. #include    <exec/lists.h>
  22. #endif    /* EXEC_LISTS_H */
  23.  
  24. #ifndef    EXEC_LIBRARIES_H
  25. #include    <exec/libraries.h>
  26. #endif    /* EXEC_LIBRARIES_H */
  27.  
  28. #ifndef    EXEC_SEMAPHORES_H
  29. #include    <exec/semaphores.h>
  30. #endif    /* EXEC_SEMAPHORES_H */
  31.  
  32.  
  33. /*----------------------------------------------------------------------------*/
  34. /* ErrorCodes */
  35. #define PATERR_Ok        0    /* Everything Ok                */
  36. #define PATERR_PatchInUse    1    /* Patch Usecount <> 0                */
  37. #define PATERR_InvalidHandle    2    /* Pointer to patch is not (no longer) valid    */
  38. #define PATERR_OutOfMem        3    /* Out of memory                */
  39. #define PATERR_OpenLib        4    /* Failed to open requested library        */
  40. #define PATERR_FuncNotStd    5    /* Function to patch is not in the standard format */
  41. #define PATERR_PatchInstalled    6    /* Can't remove patch because another program has  */
  42.                     /* installed a non-patch.library patch later       */
  43. #define PATERR_InvalidTags    7    /* There was an error in the combination of the specified Tags */
  44. #define PATERR_OpenDev        8    /* Failed to open requested device */
  45. #define PATERR_NoTaskList    9    /* PATT_AddTask... or PATT_RemTask... was specified for a patch, */
  46.                     /* which had no PATT_CreateTaskList set */
  47. #define PATERR_TaskListExists    10    /* PATT_CreateTaskList was specified, but there already exists a TaskList */
  48. #define PATERR_InvalidTaskList    11    /* PATT_CreateTaskList was specified with a wrong parameter */
  49. #define PATERR_PatchUnnamed    12    /* PATT_PatchName with GetPatch was specified, for a patch without an IDString */
  50. #define PATERR_NoSemaphore    13    /* Could not allocate semaphore */
  51.  
  52. #define PATERR_KickTooOld    14    /* Kickstart version is too old for this function */
  53. #define PATERR_InvalidPattern    15    /* Pattern passed via PATT_AddTaskPattern is not valid */
  54. #define PATERR_Restricted    16    /* Certain tags/features may not be used when patching certain functions */
  55.  
  56. /*----------------------------------------------------------------------------*/
  57. struct PatchNotifyMessage {
  58.     struct Message pnm_ExecMessage;
  59.     ULONG  pnm_Class;
  60.     UWORD  pnm_Code;
  61.     APTR   pnm_Object;
  62. };
  63.  
  64. /*----------------------------------------------------------------------------*/
  65. #define PATCHNOTIFY_CLASS    0x50000000
  66. /*----------------------------------------------------------------------------*/
  67. /*Notification codes (pnm_Code) (ignore messages with other codes): */
  68. #define PATCOD_PatchInstalled    1    /* new patch has been added */
  69. #define PATCOD_PatchRemoved    2    /* a patch has been removed */
  70. #define PATCOD_PatchChanged    3    /* attributes of a patch have been changed */
  71.  
  72. ;-------------------------------------------------------------------------
  73. #define    PatchName "patch.library"
  74.  
  75. /*----------------------------------------------------------------------------*/
  76.  
  77.  
  78.  
  79.  
  80. /*------------------------------------------------------------------------------*/
  81. /*------------------------------------------------------------------------------*/
  82. /* The following structures are not needed by normal patch.library applications */
  83. /*------------------------------------------------------------------------------*/
  84. /*------------------------------------------------------------------------------*/
  85. struct PatchBase
  86. {
  87.     struct Library LibNode;
  88.     UBYTE PB_Flags;                    /* see below */
  89.     UBYTE PB_reserved1;
  90.     ULONG PB_private1;
  91.     struct SignalSemaphore    PB_Semaphore;        /* Semaphore to protect MasterPatchList */
  92.     struct List        PB_MasterPatchHeader;    /* Listheader Structure for MasterPatch */
  93.  
  94.     /* ... */
  95.  
  96. };
  97. /* PB_Flags: */
  98.  
  99. #define PBF_CheckPC    (1<<0)            /* If TRUE: Enable safe removal of patches! */
  100.                     /* Patch.library will use a hack, which */
  101.                     /* is highly dependent on OS versions and installed */
  102.                     /* processors and may therefore not work with */
  103.                     /* certain configurations */
  104.                     /* It's unlikely to crash the machine though */
  105.                     /* New with V5, default: FALSE */
  106.  
  107. /*----------------------------------------------------------------------------*/
  108. /* Before accessing this structure, make sure MPS_Node.ln_Type is PS_TYPE_MASTER */
  109.  
  110. struct MasterPatch            /* This structure is READONLY */
  111. {
  112. struct    Node    MPS_Node;        /* ln_Name may contain a pointer to the name of the patched library */
  113.                     /* To compensate the loss of a valid librarybase */
  114.                     /* ln_Name is now (V4) guaranteed to contain a valid name */
  115.                     /* This may however be a library, device or resource name */
  116.     UWORD    MPS_Flags;        /* no public flags defined */
  117. struct    MinList    MPS_PatchHeader;    /* Listheader Structure for Patch structures */
  118.     APTR    MPS_Private01;        /* This pointer, up to V3 known as MPS_PatchedLibraryBase */
  119.                     /* has been renamed, because with the introduction of the */
  120.                     /* PatchSupervisor it may or may not contain a valid */
  121.                     /* librarybase, it may even contain 0. */
  122.     UWORD    MPS_PatchedLVO;        /* Library Vector Offset in patched library */
  123.  
  124.     /* ... */
  125.  
  126. };
  127.  
  128. /*----------------------------------------------------------------------------*/
  129. /* Before accessing this structure, make sure PS_Node.ln_Type is either PS_TYPE_USER or PS_TYPE_SYSTEM */
  130. /* Make sure your program can handle lists, that do not contain any nodes of */
  131. /* PS_TYPE_USER or PS_TYPE_SYSTEM */
  132.  
  133. struct    Patch            /* This structure is READONLY */
  134. {
  135. struct    Node    PS_Node;    /* ln_Name may contain a pointer to the name of the patch */
  136.     UWORD    PS_Flags;    /* no public flags defined */
  137.  
  138.     /* ... */
  139.  
  140. };
  141.  
  142. /*----------------------------------------------------------------------------*/
  143. /* public types for patch and masterpatch structures: */
  144. #define PS_TYPE_MASTER    1    /* node is MasterPatch structure */
  145. #define PS_TYPE_USER    2    /* node was installed by an Application using the library interface */
  146. #define PS_TYPE_SYSTEM    3    /* node was installed by the support program PatchSetFunc */
  147.  
  148.  
  149.  
  150. #endif    /* LIBRARIES_PATCH_H */
  151.