home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pasos2c1.zip / include / os2.hp < prev    next >
Text File  |  1993-12-17  |  4KB  |  120 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.  * History:
  13.  *      First created by Willem Jan Withagen ( wjw@eb.ele.tue.nl ),
  14.  *                    on Mon July 26 23:30:03 MET 1993
  15.  * Copyright:
  16.  *      Copyright (c) 1993 by Willem Jan Withagen and 
  17.  *                      Digital Information Systems group, TUE
  18.  *      For copying and distribution information see the file COPYRIGHT.
  19.  *
  20.  *)
  21. (* Used parts of OS/2 EMX/C
  22. (* To be include in modules which want to interface with the EMX/C library
  23. (* functions.
  24. (* Or to the few functions coded in Assembler in the main assembler module.
  25.  *)
  26. const
  27.         (* File modes *)
  28.         O_RDONLY  =   0;
  29.         O_WRONLY  =   1;
  30.         O_RDWR    =   2;
  31.         O_ACCMODE =   3;
  32.         O_NDELAY  =   4;
  33.         O_APPEND  =   8;
  34.         O_TEXT    =   16;
  35.         F_EOF     =   32;
  36.         F_TERMIO  =   64;
  37.         F_DEV     =   128;
  38.         O_BINARY  =   256;
  39.         O_CREAT   =   512;
  40.         O_TRUNC   =   1024;
  41.         O_EXCL    =   2048;
  42.         F_NPIPE   =   4096;
  43.  
  44.         (* ioctl parameters and results *)
  45.         FIONREAD  =   16;
  46.         FGETHTYPE =   32;
  47.         
  48.         HT_FILE      =   0;
  49.         HT_UPIPE     =   1;
  50.         HT_NPIPE     =   2;
  51.         HT_DEV_OTHER =   3;
  52.         HT_DEV_NUL   =   4;
  53.         HT_DEV_CON   =   5;
  54.         HT_DEV_CLK   =   7;
  55.         (* HT_ISDEV(n)     ((n) >= HT_DEV_OTHER && (n) <= HT_DEV_CLK) *)
  56.         
  57.         (* The maximum size of a file name *)
  58.         MAX_PATH = 256;
  59.  
  60. (*  We need some defines since the current PASCAL version doesn''t allow for
  61. (*  Constant expressions to be assigned to constants.
  62. (*  So this way the get include as full computed functions
  63.  *)
  64. #define CR                    chr(13)
  65. #define LF                    chr(10)
  66.  
  67. type
  68.     _word     = integer;
  69.     _str      = array[1..8] of char;
  70.     _filename = array[1..MAX_PATH] of char;
  71.     
  72. FUNCTION  Copen (path: _str;        (* The name to give to the file *)
  73.                  openflag: _word
  74.                  ):_word; external; (* return the handle *)
  75.              
  76. FUNCTION  Cclose(fhdl :_word        (* handle to close *)
  77.                  ):_word; external;
  78.                      
  79. FUNCTION Cwrite( fhdl: _word;       (* Handle to write to *)
  80.                  str: _str;         (* String to write *)
  81.                  cnt: _word         (* Number of bytes to write *)
  82.                  ):_word; external;
  83.                       
  84. FUNCTION Cread(  fhdl: _word;       (* Handle to read from *)
  85.                  str: _str;         (* String to read into *)
  86.                  cnt: _word         (* Number of bytes to read *)
  87.                  ):_word; external;
  88.                 
  89.                 (* ioctl has two incarnations in C, only using one *)      
  90. FUNCTION Cioctl(  fhdl: _word;       (* Handle to work on *)
  91.                   req: _word;        (* what to do *)
  92.                   VAR res: _word     (* The result *)
  93.                  ):_word; external;
  94. FUNCTION  Cisatty( fhdl: _word 
  95.                  ):_word; external;                
  96. PROCEDURE Cexit( val :_word        (* Exit code *)
  97.                  ); external;
  98.  
  99. FUNCTION  Cmalloc( Size  :_word ):_word; external;
  100. PROCEDURE Cfree  ( Start :_word ); external;
  101.  
  102. (* And somethings coded in assembler *)
  103.           (* Copy a piece of memory, but it should not overlap *)
  104. procedure $memcopy(VAR source, dest :_str; size :_word );   external;
  105.           
  106.           (* Return the address of a string *)
  107. function  $StrAddr(Var src:_str):_word;                     external;
  108.           (* Logic operations *)
  109. function  $shl(v,s :_word): _word;                          external;
  110. function  $Andword(a,b :_word): _word;                      external;
  111. function  $Orword(a,b :_word): _word;                       external;
  112. function  $Invword(a :_word): _word;                        external;
  113.  
  114. (*
  115.  * $Log: $
  116.  *
  117.  *      First created by Willem Jan Withagen ( wjw@eb.ele.tue.nl ),
  118.  *                    on Mon July 26 23:30:03 MET 1993
  119.  *)
  120.