home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Graphics / Graphics.zip / os2apipm.zip / OS2API / OS2-MEM.ADS < prev    next >
Text File  |  1996-07-18  |  7KB  |  137 lines

  1.  
  2. -- ╔═══════════════════════════════════════════════════════════════════╗
  3. -- ║       D E S I G N   E N G I N E R I N G              ║D║S║        ║
  4. -- ║            S O F T W A R E                           ╚═╩═╝        ║
  5. -- ║                                                                   ║
  6. -- ║        Package     OS2.MEM                                        ║
  7. -- ║                                                                   ║
  8. -- ║        Author :  Leonid Dulman     1995                           ║
  9. -- ║                                                                   ║
  10. -- ║             GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS            ║
  11. -- ║                                                                   ║
  12. -- ║             Memory  part of os/2 api functions                    ║
  13. -- ║                                                                   ║
  14. -- ╚═══════════════════════════════════════════════════════════════════╝
  15.  
  16.  
  17. with Interfaces.C;         use Interfaces.C;
  18. with Interfaces.C.Strings; use Interfaces.C.Strings;
  19.  
  20. package Os2.Mem is
  21. pragma Preelaborate (Mem);
  22.  
  23.    --** Memory management --
  24. subtype PPVOID is PVOID;
  25.  -- Access protection                                                          */
  26.   PAG_READ    :constant ushort:=16#00000001#; -- read access                      */
  27.   PAG_WRITE   :constant ushort:=16#00000002#; -- write access                     */
  28.   PAG_EXECUTE :constant ushort:=16#00000004#; -- execute access                   */
  29.   PAG_GUARD   :constant ushort:=16#00000008#; -- guard protection                 */
  30.   PAG_DEFAULT :constant ushort:=16#00000400#; -- default (initial) access         */
  31.  -- Commit
  32.   PAG_COMMIT  :constant ushort:=16#00000010#; -- commit storage                   */
  33.   PAG_DECOMMIT:constant ushort:=16#00000020#; -- decommit storage                 */
  34.  -- Allocation attributes                                                      */
  35.   OBJ_TILE     :constant ushort:=16#00000040#; -- tile object                      */
  36.   OBJ_PROTECTED:constant ushort:=16#00000080#; -- protect object
  37.   OBJ_GETTABLE :constant ushort:=16#00000100#; -- gettable by other processes      */
  38.   OBJ_GIVEABLE :constant ushort:=16#00000200#; -- giveable to other processes      */
  39.  --      fPERM             (PAG_EXECUTE | PAG_READ | PAG_WRITE)
  40.  --      fSHARE            (OBJ_GETTABLE | OBJ_GIVEABLE)
  41.  -- DosAllocMem flags                                                          */
  42.  --      fALLOC            (OBJ_TILE | PAG_COMMIT | fPERM)
  43.  -- DosAllocSharedMem flags                                                    */
  44.  --      fALLOCSHR         (OBJ_TILE | PAG_COMMIT | fSHARE | fPERM)
  45.  -- DosGetNamedSharedMem flags                                                 */
  46.  --      fGETNMSHR         (fPERM)
  47.  -- DosGetSharedMem flags                                                      */
  48.  --      fGETSHR           (fPERM)
  49.  -- DosGiveSharedMem flags                                                     */
  50.  --      fGIVESHR          (fPERM)
  51.  -- DosSetMem flags                                                            */
  52.  --      fSET         (PAG_COMMIT + PAG_DECOMMIT + PAG_DEFAULT + fPERM)
  53.  -- Dos32SubSet flags                                                          */
  54.   DOSSUB_INIT       :constant ushort:=16#01#; -- initialize memory object for     */
  55.   DOSSUB_GROW       :constant ushort:=16#02#; -- increase size of memory pool     */
  56.   DOSSUB_SPARSE_OBJ :constant ushort:=16#04#; -- indicator for DosSub to          */
  57.   DOSSUB_SERIALIZE  :constant ushort:=16#08#; -- indicates that access to the     */
  58.  -- Allocation type (returned from DosQueryMem)                                */
  59.   PAG_SHARED        :constant ulong :=16#00002000#; -- shared object                    */
  60.   PAG_FREE          :constant ulong :=16#00004000#; -- pages are free                   */
  61.   PAG_BASE          :constant ulong :=16#00010000#; -- first page in object             */
  62.  
  63. function DosAllocMem(ppb :PPVOID ;
  64.                      cb  :ULONG ;
  65.                      flag:ULONG ) return apiret;
  66. pragma Import(c,DosAllocMem, Link_name=>"_DosAllocMem");
  67.  
  68. function   DosFreeMem(pb:PVOID ) return apiret;
  69. pragma Import(c,DosFreeMem, Link_name=>"_DosFreeMem");
  70.  
  71. function DosSetMem(pb  :PVOID ;
  72.                    cb  :ULONG ;
  73.                    flag:ULONG ) return apiret;
  74. pragma Import(c,DosSetMem, Link_name=>"_DosSetMem");
  75.  
  76. function DosGiveSharedMem(pb  :PVOID ;
  77.                           pd  :PID   ;
  78.                           flag:ULONG ) return apiret;
  79. pragma Import(c,DosGiveSharedMem, Link_name=>"_DosGiveSharedMem");
  80.  
  81. function  DosGetSharedMem(pb  :PVOID ;
  82.                           flag:ULONG ) return apiret;
  83. pragma Import(c,DosGetSharedMem, Link_name=>"_DosGetSharedMem");
  84.  
  85. function DosGetNamedSharedMem(ppb    :PPVOID ;
  86.                               pszName:PSZ    ;
  87.                               flag   :ULONG  ) return apiret;
  88. pragma Import(c,DosGetNamedSharedMem, Link_name=>"_DosGetNamedSharedMem");
  89.  
  90. function DosAllocSharedMem(ppb    :PPVOID ;
  91.                            pszName:PSZ    ;
  92.                            cb     :ULONG  ;
  93.                            flag   :ULONG  ) return apiret;
  94. pragma Import(c,DosAllocSharedMem, Link_name=>"_DosAllocSharedMem");
  95.  
  96. function DosQueryMem(pb   :PVOID  ;
  97.                      pcb  :PULONG ;
  98.                      pFlag:PULONG ) return apiret;
  99. pragma Import(c,DosQueryMem, Link_name=>"_DosQueryMem");
  100.  
  101. --   ╔═════════════════════════════════════════╗
  102. --   ║ #define DosSubAlloc     DosSubAllocMem  ║
  103. --   ║ #define DOSSUBALLOC     DosSubAllocMem  ║
  104. --   ╚═════════════════════════════════════════╝
  105.  
  106. function  DosSubAllocMem(pbBase:PVOID  ;
  107.                          ppb   :PPVOID ;
  108.                          cb    :ULONG  ) return apiret;
  109. pragma Import(c,DosSubAllocMem, Link_name=>"_DosSubAllocMem");
  110.  
  111. --    ╔══════════════════════════════════════╗
  112. --    ║#define DosSubFree      DosSubFreeMem ║
  113. --    ║#define DOSSUBFREE      DosSubFreeMem ║
  114. --    ╚══════════════════════════════════════╝
  115.  
  116. function  DosSubFreeMem(pbBase:PVOID ;
  117.                         pb    :PVOID ;
  118.                         cb    :ULONG ) return apiret;
  119. pragma Import(c,DosSubFreeMem, Link_name=>"_DosSubFreeMem");
  120. --    ╔═════════════════════════════════════╗
  121. --    ║#define DosSubSet       DosSubSetMem ║
  122. --    ║#define DOSSUBSET       DosSubSetMem ║
  123. --    ╚═════════════════════════════════════╝
  124.  
  125. function  DosSubSetMem(pbBase:PVOID ;
  126.                        flag  :ULONG ;
  127.                        cb    :ULONG ) return apiret;
  128. pragma Import(c,DosSubSetMem, Link_name=>"_DosSubSetMem");
  129. --    ╔════════════════════════════════════════╗
  130. --    ║#define DosSubUnset     DosSubUnsetMem  ║
  131. --    ║#define DOSSUBUNSET     DosSubUnsetMem  ║
  132. --    ╚════════════════════════════════════════╝
  133.  
  134. function  DosSubUnsetMem(pbBase:PVOID ) return apiret;
  135. pragma Import(c,DosSubUnsetMem, Link_name=>"_DosSubUnsetMem");
  136. end os2.Mem;
  137.