home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / spdos2.zip / LIBSRC / API.PAS next >
Pascal/Delphi Source File  |  1994-06-14  |  9KB  |  244 lines

  1. UNIT API;
  2.  
  3.  
  4. {****************************************************************************
  5. *                                                                           *
  6. *                                                                           *
  7. *                     Speed-386 Compiler für OS/2 V 1.0                     *
  8. *                                                                           *
  9. *                      Basic API functions für OS/2 2.1                     *
  10. *                                                                           *
  11. *                                                                           *
  12. *  Dieses File enthälz die Deklaration von wichtigen OS/2 API's aus den     *
  13. *  entsprechenden OS/2 DLL's.                                               *
  14. *                                                                           *
  15. *  Die Angaben sind nicht überprüft und könnten Fehler enthalten !          *
  16. *                                                                           *
  17. *                                                                           *
  18. ****************************************************************************}
  19.  
  20. INTERFACE
  21.  
  22. {************************COMMON FUNCTIONS********************************}
  23.  
  24. {Common types}
  25. TYPE PFNThread =POINTER;  {Pointer to a procedure}
  26.      TID       =LONGWORD; {Thread information handle}
  27.      PID       =LONGWORD; {Process information handle}
  28.  
  29.      PRESULTCODES=^RESULTCODES;
  30.      RESULTCODES=RECORD
  31.                        CodeTerminate:LONGWORD;
  32.                        CodeResult:LONGWORD;
  33.                  END;
  34.  
  35.  
  36. {DosExit codes}
  37. CONST
  38.      EXIT_THREAD       =0;
  39.      EXIT_PROCESS      =1;
  40.  
  41. {DosExit Action code values}
  42. CONST
  43.      DCWA_PROCESS      =0;
  44.      DCWA_PROCESSTREE  =1;
  45.  
  46. {Wait option values}
  47. CONST
  48.      DCWW_WAIT         =0;
  49.      DCWW_NOWAIT       =1;
  50.  
  51. {DosCreateThread values}
  52. CONST
  53.      CREATE_READY         =0;
  54.      CREATE_SUSPENDED     =1;
  55.      STACK_SPARSE         =0;
  56.      STACK_COMMITTED      =2;
  57.  
  58. IMPORTS  {Import all functions with IBM _System calling convention}
  59.    FUNCTION DosBeep(dur,freq:LONGWORD):LONGWORD:        'DOSCALLS' index 286;
  60.    PROCEDURE DosExit(result,action:LONGWORD):           'DOSCALLS' index 234;
  61.    FUNCTION DosCreateThread(cbStack:LONGWORD;
  62.                             flag:LONGWORD;
  63.                             param:LONGWORD;
  64.                             pfn:PFNTHREAD;
  65.                             VAR _Tid:TID):LONGWORD:     'DOSCALLS' index 311;
  66.    FUNCTION DosResumeThread(_tid:TID):LONGWORD:         'DOSCALLS' index 237;
  67.    FUNCTION DosSuspendThread(_tid:TID):LONGWORD:        'DOSCALLS' index 238;
  68.    FUNCTION DosKillThread(_tid:TID):LONGWORD:           'DOSCALLS' index 111;
  69.    FUNCTION DosWaitChild(_pid:PID;
  70.                          VAR ppid:PID;
  71.                          pres:PResultCodes;
  72.                          Options:LONGWORD;
  73.                          Action:LONGWORD):LONGWORD:     'DOSCALLS' index 280;
  74.    FUNCTION DosWaitThread(Options:LONGWORD;
  75.                           VAR _ptid:TID):LONGWORD:      'DOSCALLS' index 349;
  76.    FUNCTION DosSleep(msec:LONGWORD):LONGWORD:           'DOSCALLS' index 229;
  77.    FUNCTION DosEnterCritSec:LONGWORD:                   'DOSCALLS' index 232;
  78.    FUNCTION DosExitCritSec:LONGWORD:                    'DOSCALLS' index 233;
  79.    FUNCTION DosExecPgm(PName:PSZ;
  80.                        pres:PResultCodes;
  81.                        penv:PSZ;
  82.                        PArg:PSZ;
  83.                        ExeFlags:LONGWORD;
  84.                        cbObjName:LONGINT;
  85.                        pObjName:PSZ):LONGWORD:          'DOSCALLS' index 283;
  86.    FUNCTION DosSetPriority(PorTid:LONGWORD;
  87.                            delta:LONGINT;
  88.                            class:LONGWORD;
  89.                            Scope:LONGWORD):LONGWORD:    'DOSCALLS' index 236;
  90.    FUNCTION DosKillProcess(_pid:PID;
  91.                            Action:LONGWORD):LONGWORD:   'DOSCALLS' index 235;
  92. END;
  93.  
  94.  
  95. {************************MEMORY MANAGEMENT********************************}
  96.  
  97. {Access protection}
  98. CONST
  99.      PAG_READ         =$00000001;
  100.      PAG_WRITE        =$00000002;
  101.      PAG_EXECUTE      =$00000004;
  102.      PAG_GUARD        =$00000008;
  103.      PAG_DEFAULT      =$00000400;
  104.  
  105. {Commitment}
  106. CONST
  107.      PAG_COMMIT       =$00000010;
  108.      PAG_DECOMMIT     =$00000020;
  109.  
  110. {Allocation attributes}
  111.  
  112. CONST
  113.      OBJ_TILE         =$00000040;
  114.      OBJ_PROTECTED    =$00000080;
  115.      OBJ_GETTABLE     =$00000100;
  116.      OBJ_GIVEABLE     =$00000200;
  117.  
  118. CONST
  119.      fPERM            =$00000007;
  120.      fSHARE           =$00000300;
  121.  
  122. {DosAllocMem flags}
  123. CONST
  124.      fALLOC           =$00000057;
  125.  
  126. {DosAllocSharedMem flags}
  127.  
  128. CONST
  129.      fALLOCSHR        =$00000357;
  130.  
  131. {DosGetNamedSharedMem flags}
  132.  
  133. CONST
  134.      fGETNMSHR        =$00000007;
  135.  
  136. {DosGetSharedMem flags}
  137.  
  138. CONST
  139.      fGETSHR          =$00000007;
  140.  
  141. {DosGiveSharedMem flags}
  142.  
  143. CONST
  144.      fGIVESHR         =$00000007;
  145.  
  146. {DosSetMem flags}
  147.  
  148. CONST
  149.      fSET             =$00000437;
  150.  
  151. {Dos32SubSet flags}
  152.  
  153. CONST
  154.      DOSSUB_INIT       =$0000001;
  155.      DOSSUB_GROW       =$0000002;
  156.      DOSSUB_SPARSE_OBJ =$0000004;
  157.      DOSSUB_SERIALIZE  =$0000008;
  158.  
  159.  
  160. {Allocation type (returned from DosQueryMem)}
  161.  
  162. CONST
  163.      PAG_SHARED        =$00002000;
  164.      PAG_FREE          =$00004000;
  165.      PAG_BASE          =$00010000;
  166.  
  167.  
  168. IMPORTS {All IMPORTS use IBM _System Calling Convention}
  169.  
  170.    FUNCTION DosAllocMem(flag:LONGWORD;
  171.                         cb:LONGWORD;
  172.                         VAR ppb:POINTER):LONGWORD:    'DOSCALLS' index 299;
  173.    FUNCTION DosFreeMem(pb:POINTER):LONGWORD:          'DOSCALLS' index 304;
  174.    FUNCTION DosSetMem(Flag:LONGWORD;
  175.                       cb:LONGWORD;
  176.                       pb:POINTER):LONGWORD:           'DOSCALLS' index 305;
  177.    FUNCTION DosGiveSharedMem(flag:LONGWORD;
  178.                              _pid:PID;
  179.                              pb:POINTER):LONGWORD:    'DOSCALLS' index 303;
  180.    FUNCTION DosGetSharedMem(Flag:LONGWORD;
  181.                             pb:POINTER):LONGWORD:     'DOSCALLS' index 302;
  182.    FUNCTION DosGetNamedSharedMem(Flag:LONGWORD;
  183.                                  pszName:PSZ;
  184.                                  VAR ppb:POINTER):
  185.                                  LONGWORD:            'DOSCALLS' index 301;
  186.    FUNCTION DosAllocSharedMem(Flag:LONGWORD;
  187.                               cb:LONGWORD;
  188.                               pszName:PSZ;
  189.                               VAR ppb:POINTER):
  190.                               LONGWORD:               'DOSCALLS' index 300;
  191.    FUNCTION DosQueryMem(VAR pFlag:LONGWORD;
  192.                         VAR pcb:LONGWORD;
  193.                         pb:POINTER):LONGWORD:         'DOSCALLS' index 306;
  194.    FUNCTION DosSubAllocMem(cb:LONGWORD;
  195.                            VAR ppb:POINTER;
  196.                            pbBase:POINTER):LONGWORD:  'DOSCALLS' index 345;
  197.    FUNCTION DosSubFreeMem(cb:LONGWORD;
  198.                           pb:POINTER;
  199.                           pbBase:POINTER):LONGWORD:   'DOSCALLS' index 346;
  200.    FUNCTION DosSubSetMem(cb:LONGWORD;
  201.                          Flags:LONGWORD;
  202.                          pbBase:POINTER):LONGWORD:    'DOSCALLS' index 344;
  203.    FUNCTION DosSubUnsetMem(pbBase:POINTER):LONGWORD:  'DOSCALLS' index 347;
  204. END;
  205.  
  206. {**********************MODULE MANAGEMENT**********************************}
  207.  
  208. CONST
  209.     PT_16BIT=0;
  210.     PT_32BIT=1;
  211.  
  212. IMPORTS {All IMPORTS use IBM _System Calling Convention}
  213.  
  214.    FUNCTION DosLoadModule(VAR phmod:HMODULE;
  215.                           pszModName:PSZ;
  216.                           cbname:LONGWORD;
  217.                           pszName:PSZ):LONGWORD:     'DOSCALLS' index 318;
  218.  
  219.    FUNCTION  DosFreeModule(hmod:HMODULE):LONGWORD:   'DOSCALLS' index 322;
  220.  
  221.    FUNCTION DosQueryProcAddr(VAR ppfn:POINTER;
  222.                              pszName:PSZ;
  223.                              ordinal:LONGWORD;
  224.                              hmod:HMODULE):LONGWORD: 'DOSCALLS' index 321;
  225.    FUNCTION DosQueryModuleHandle(VAR phmod:HMODULE;
  226.                                  pszmodName:PSZ):
  227.                                  LONGWORD:           'DOSCALLS' index 319;
  228.    FUNCTION DosQueryModuleName(pch:PSTRING;
  229.                                cbname:LONGWORD;
  230.                                hmod:HMODULE):
  231.                                LONGWORD:             'DOSCALLS' index 320;
  232.    FUNCTION DosQueryProcType(VAR pulproctype:LONGWORD;
  233.                              pszname:PSZ;
  234.                              ordinal:LONGWORD;
  235.                              hmod:HMODULE):LONGWORD: 'DOSCALLS' index 586;
  236. END;
  237.  
  238.  
  239. IMPLEMENTATION
  240.  
  241. {We dont need to implement anything !}
  242.  
  243. BEGIN
  244. END.