home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / be.zip / bememext.h < prev    next >
C/C++ Source or Header  |  2000-01-07  |  4KB  |  100 lines

  1. //
  2. // bememext.h - Interface needed by implementors of BE memory extensions
  3. //
  4. // Despite both BE and the helpers being implemented in C++, I use a C
  5. // style interface. This avoids name mangling problems.
  6. //
  7. // The bemem_init entrypoint will be called before any other entrypoint.
  8. // If bemem_init fails, then it should set err to point to some meaningful
  9. // static error string, and return FALSE.
  10. // bemem_init can be omitted if there is no initialisation required.
  11. //
  12. // For every non-0 bemem_create, BE will later call bemem_delete.
  13. // If bemem_create fails, then it should set err to point to some meaningful
  14. // static error string, and return (void *) 0.
  15. //
  16. // After all bemem_deletes, bemem_term will be called (last).
  17. // bemem_term can be omitted if there is no termination required.
  18. //
  19. // If the memory extension helper is caching data (presumably for speed),
  20. // then it should discard this cache if bemem_refresh is called.
  21. // If a memory extension helper does not cache any data, it need not
  22. // implement a bemem_refresh routine.
  23. //
  24. // A memory extension helper can optionally provide the bemem_write and
  25. // bemem_flush routines, if the data it provides access to is in some way
  26. // modifiable. bemem_write changes a byte in the data, and before the
  27. // Binary Editor shuts down, it will call bemem_flush to make any changes
  28. // made using bemem_write 'final'. If data is modified via bemem_write,
  29. // the modified data should immediately be accessible via bemem_read.
  30. //
  31. // bemem_options is an optional mechanism whereby arbitrary commands may
  32. // be passed through to the memory extension, for a specific instance.
  33. //
  34. // If 64 bit address space entrypoints are implemented, then BE will use
  35. // these, otherwise it will call the older 32 bit entrypoints.
  36. //
  37.  
  38. #ifndef BEMEM_H
  39. #define    BEMEM_H
  40.  
  41. #ifndef Boolean_DEFINED
  42. #define    Boolean_DEFINED
  43. typedef int Boolean;
  44. #define    TRUE  1
  45. #define FALSE 0
  46. #endif
  47.  
  48. #if   defined(OS2)
  49. #define    BEMEMEXPORT
  50. #define    BEMEMENTRY _System
  51. #define BEMEMADDR32 unsigned
  52. #define BEMEMADDR64 unsigned_long_long
  53. #elif defined(WIN32)
  54. #define    BEMEMEXPORT __declspec(dllexport)
  55. #define    BEMEMENTRY __stdcall
  56. #define BEMEMADDR32 unsigned
  57. #define BEMEMADDR64 unsigned __int64
  58. #elif defined(DOS32)
  59. #define    BEMEMEXPORT 
  60. #define    BEMEMENTRY __export _cdecl
  61. #define BEMEMADDR32 unsigned
  62. #define BEMEMADDR64 unsigned __int64
  63. #elif defined(NW)
  64. #define    BEMEMEXPORT
  65. #define    BEMEMENTRY
  66. #define BEMEMADDR32 unsigned
  67. #define BEMEMADDR64 unsigned __int64
  68. #else
  69. #define    BEMEMEXPORT
  70. #define    BEMEMENTRY
  71. #define BEMEMADDR32 unsigned
  72. #define BEMEMADDR64 unsigned long long
  73. #endif
  74.  
  75. #ifdef AIX
  76. typedef void (*BEMEM_EP)(void);
  77. typedef struct { BEMEM_EP ep; const char *name; } BEMEM_EXPORT;
  78. #endif
  79.  
  80. extern "C" {
  81.  
  82. BEMEMEXPORT Boolean BEMEMENTRY bemem_init(const char *(&err));
  83. BEMEMEXPORT void *  BEMEMENTRY bemem_create(const char *args, BEMEMADDR32 addr, const char *(&err));
  84. BEMEMEXPORT Boolean BEMEMENTRY bemem_read(void * ptr, BEMEMADDR32 addr, unsigned char & b);
  85. BEMEMEXPORT Boolean BEMEMENTRY bemem_write(void * ptr, BEMEMADDR32 addr, unsigned char b);
  86. #ifdef BE64
  87. BEMEMEXPORT void *  BEMEMENTRY bemem_create_64(const char *args, BEMEMADDR64 addr, const char *(&err));
  88. BEMEMEXPORT Boolean BEMEMENTRY bemem_read_64(void * ptr, BEMEMADDR64 addr, unsigned char & b);
  89. BEMEMEXPORT Boolean BEMEMENTRY bemem_write_64(void * ptr, BEMEMADDR64 addr, unsigned char b);
  90. #endif
  91. BEMEMEXPORT void    BEMEMENTRY bemem_refresh(void * ptr);
  92. BEMEMEXPORT Boolean BEMEMENTRY bemem_flush(void * ptr);
  93. BEMEMEXPORT Boolean BEMEMENTRY bemem_options(void * ptr, const char *options, const char *(&err));
  94. BEMEMEXPORT void    BEMEMENTRY bemem_delete(void * ptr);
  95. BEMEMEXPORT void    BEMEMENTRY bemem_term();
  96.  
  97. }
  98.  
  99. #endif
  100.