home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pasos2c1.zip / include / os2.inc < prev    next >
Text File  |  1993-11-03  |  7KB  |  174 lines

  1. (*
  2.  * FileName:   os2.inc
  3.  * $Source: $
  4.  * $Author: wjw $
  5.  * $Date: 1993/09/24 11:05:01 $
  6.  * $Locker: wjw $
  7.  * $State: Exp $
  8.  * $Revision: $
  9.  * Description:
  10.  *      Part of the runtime library which comes with PASCAL for OS/2
  11.  *      
  12.  *
  13.  * History:
  14.  *      First created by Willem Jan Withagen ( wjw@eb.ele.tue.nl ),
  15.  *                    on Mon July 26 23:30:03 MET 1993
  16.  * Copyright:
  17.  *      Copyright (c) 1993 by Willem Jan Withagen and 
  18.  *                      Digital Information Systems group, TUE
  19.  *      For copying and distribution information see the file COPYRIGHT.
  20.  *
  21.  *)
  22. (* Used parts of OS/2 
  23. (* To be include in modules which want to interface with the OS/2 library
  24. (* functions.
  25. (* Or to the few functions coded in Assembler in the main assembler module.
  26.  *)
  27. const 
  28.           (* Response resulttypes for the DosOpen call *)
  29.           FILE_EXISTED      = 1;
  30.           FILE_CREATED      = 2;
  31.           FILE_TRUNCATED    = 3;
  32.           (* Attributes for a file *)
  33.           FILE_NORMAL       = 0;
  34.           FILE_READONLY     = 1;
  35.           FILE_HIDDEN       = 2;
  36.           FILE_SYSTEM       = 4;
  37.           FILE_DIRECTORY    = 16;
  38.           FILE_ARCHIVED     = 32;
  39.           (* Open FLAG options *)
  40.           OPEN_ACTION_FAIL_IF_NEW       = 0;
  41.           OPEN_ACTION_CREATE_IF_NEW     = 16;
  42.           OPEN_ACTION_FAIL_IF_EXISTS    = 0;
  43.           OPEN_ACTION_OPEN_IF_EXISTS    = 1;
  44.           OPEN_ACTION_REPLACE_IF_EXISTS = 2;
  45.           (* Open modes *)
  46.           OPEN_ACCESS_READONLY     = 0;
  47.           OPEN_ACCESS_WRITEONLY    = 1;
  48.           OPEN_ACCESS_READWRITE    = 2;
  49.           OPEN_SHARE_DENYREADWRITE = 16;
  50.           OPEN_SHARE_DENYWRITE     = 32;
  51.           OPEN_SHARE_DENYREAD      = 48;
  52.           OPEN_SHARE_DENYNONE      = 64;
  53.           OPEN_FLAGS_NOINHERIT     = 128;        (* Handle is private *)
  54.           OPEN_FLAGS_NO_LOCALITY   = 0;
  55.           OPEN_FLAGS_SEQUENTIAL    = 256;
  56.           OPEN_FLAGS_RANDOM        = 512;
  57.           OPEN_FLAGS_RANDOMSEQUENTIAL = 768;     (* Mostly random *)
  58.           OPEN_FLAGS_NO_CACHE      = 4096;       (* Don''t go through system cache *)
  59.           OPEN_FLAGS_FAIL_ON_ERROR = 8192;       (* no Error handler *)
  60.           OPEN_FLAGS_WRITE_THROUGH = 16384;
  61.           OPEN_FLAGS_DASD          = 32768;      (* when opening a "drive" *)
  62.           
  63.           (* What is connected to the handle? *)
  64.           HANDLE_TYPE_FILE         = 0;
  65.           HANDLE_TYPE_CHAR_DEV     = 1;
  66.           HANDLE_TYPE_PIPE         = 2;
  67.           HANDLE_TYPE_DEV_MASK     = 255;
  68.           HANDLE_TYPE_PROTECTED    = 16384;
  69.           HANDLE_TYPE_LOCAL        = 0;
  70.           HANDLE_TYPE_REMOTE       = 32768;
  71.           
  72.           (* Possible setting for extended attributes *)
  73.           OPEN_NO_EA_BUF           = 0;
  74.           
  75.           (* Flags for the memory allocation space *)
  76.           PAG_READ          = 1;
  77.           PAG_WRITE         = 2;
  78.           PAG_EXECUTE       = 4;
  79.           PAG_GUARD         = 8;
  80.           PAG_COMMIT        = 16;
  81.           OBJ_TILE          = 64;
  82.         
  83.           (* Flags for the creation of heap space *)
  84.           DOSSUB_INIT       = 1;
  85.           DOSSUB_GROW       = 2;
  86.           DOSSUB_SPARSE_OBJ = 4;
  87.           DOSSUB_SERIALIZE  = 8;
  88.         
  89.           (* specific return values *)
  90.           ERROR_DOSSUB_OVERLAP   = 312;
  91.           ERROR_DOSSUB_CORRUPTED = 532;
  92.           
  93.           (* The maximum size of a file name *)
  94.           MAX_PATH = 256;
  95.  
  96. (*  We need some defines since the current PASCAL version doesn''t allow for
  97. (*  Constant expressions to be assigned to constants.
  98. (*  So this way the get include as full computed functions
  99.  *)
  100. #define CR                    chr(13)
  101. #define LF                    chr(10)
  102.  
  103.  
  104. type
  105.     _word     = integer;
  106.     _str      = array[1..8] of char;
  107.     _filename = array[1..MAX_PATH] of char;
  108.     
  109. FUNCTION  Dos32Open (path: _str;        (* The name to give to the file *)
  110.                      VAR fhdl: _word;   (* Where to leave the handle *)
  111.                      VAR result: _word; (* What was actually done *)
  112.                      newsize: _word;    (* when creating/replacing a file *)
  113.                      attribs: _word;    (* what attributs are set on the file *)
  114.                      openflag: _word;   (* What when file (does)not exist? *)
  115.                      openmode: _word;   
  116.                      EA_buf: _word      (* Address of extended attribute buffer *)
  117.                     ):_word; external;
  118.  
  119. FUNCTION  Dos32Close(fhdl :_word        (* handle to close *)
  120.                      ):_word; external;
  121.                      
  122. FUNCTION  Dos32Write( fhdl: _word;      (* Handle to write to *)
  123.                       str: _str;        (* String to write *)
  124.                       cnt: _word;       (* Number of bytes to write *)
  125.                       VAR  rcnt: _word  (* Actual number written *)
  126.                       ):_word; external;
  127.                     
  128. FUNCTION  Dos32Read ( fhdl: _word;      (* Handle to read from *)
  129.                       str: _str;        (* String to read into *)
  130.                       cnt: _word;       (* Number of bytes to read *)
  131.                       VAR  rcnt: _word  (* Actual number read *)
  132.                       ):_word; external;
  133.  
  134. FUNCTION  Dos32QueryHType( fhdl         :_word;
  135.                            VAR state    :_word;
  136.                            VAR flag_word :_word
  137.                          ): _word;external;
  138.                          
  139. FUNCTION  Dos32exit(  w1 :_word;        (* 0=current thread, 1=ALL threads *)
  140.                       w2 :_word         (* Exit code *)
  141.                      ): _word; external;
  142.  
  143. FUNCTION  Dos32AllocMem (VAR Start :_word; Size :_word; Flags :_word
  144.                         ):_word; external;
  145. FUNCTION  Dos32FreeMem  (Start :_word
  146.                         ):_word; external;
  147. FUNCTION  Dos32SubSet   (Start :_word; Flags :_word; Size :_word
  148.                         ):_word; external;
  149. FUNCTION  Dos32SubUnset (Start :_word
  150.                         ):_word; external;
  151. FUNCTION  Dos32SubAlloc (Start :_word; VAR offset:_word; Size :_word
  152.                         ):_word; external;
  153. FUNCTION  Dos32SubFree  (Start :_word; offset:_word; Size :_word
  154.                         ):_word; external;
  155.  
  156. (* And somethings coded in assembler *)
  157.           (* Copy a piece of memory, but it should not overlap *)
  158. procedure $memcopy(VAR source, dest :_str; size :_word );   external;
  159.           
  160.           (* Return the address of a string *)
  161. function  $StrAddr(Var src:_str):_word;                     external;
  162.           (* Logic operations *)
  163. function  $shl(v,s :_word): _word;                          external;
  164. function  $Andword(a,b :_word): _word;                      external;
  165. function  $Orword(a,b :_word): _word;                       external;
  166. function  $Invword(a :_word): _word;                        external;
  167.  
  168. (*
  169.  * $Log: $
  170.  *
  171.  *      First created by Willem Jan Withagen ( wjw@eb.ele.tue.nl ),
  172.  *                    on Mon July 26 23:30:03 MET 1993
  173.  *)
  174.