Browse Source

Common renamed APIComm to avoid problems with free vision

pierre 25 years ago
parent
commit
6edc2c8a92
7 changed files with 334 additions and 15 deletions
  1. 1 1
      api/inc/Makefile.api
  2. 304 0
      api/inc/apicomm.pas
  3. 6 3
      api/inc/filectrl.pas
  4. 6 3
      api/inc/filesys.pas
  5. 6 3
      api/inc/keyboard.pas
  6. 6 3
      api/inc/mouse.pas
  7. 5 2
      api/inc/video.pas

+ 1 - 1
api/inc/Makefile.api

@@ -1 +1 @@
-APIOBJECTS=common callspec video keyboard mouse filectrl filesys
+APIOBJECTS=apicomm common callspec video keyboard mouse filectrl filesys

+ 304 - 0
api/inc/apicomm.pas

@@ -0,0 +1,304 @@
+{****************************************************************************
+
+   $Id$
+
+   Common types, and definitions
+
+   Copyright (c) 1997 Balazs Scheidler ([email protected])
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with this library; if not, write to the Free
+   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************
+   $Id$
+ ****************************************************************************
+
+ Changelog:
+
+   Common version 0.2.6
+
+   Date       Version  Who     Comments
+   07/12/97   0.1      Bazsi   Initial implementation (bazsi)
+   07/18/97   0.2      Bazsi   Linux specific error codes added
+   07/18/97   0.2.1    Bazsi   Some syntactical errors removed...
+   07/28/97   0.2.2    Bazsi   Base error code for Video registered
+   07/29/97   0.2.3    Bazsi   Some basic types added (PByte, PWord etc)
+   08/08/97   0.2.4    Bazsi   Finalized error handling code (Brad's code added)
+   08/27/97   0.2.5    Bazsi   BP doesn't like function types as return-values
+                               for functions, returning Pointer instead
+   09/06/97   0.2.6    Bazsi   Added base error code for Keyboard
+   11/06/97   0.2.7    Bazsi   Added base error code for FileCtrl
+
+ Todo:
+
+ *  Some types found in the DOS unit should be included here (TextRec maybe
+    renamed to TTextRec, FileRec etc.)
+ *  Other platform specific error codes.
+
+ ****************************************************************************}
+unit ApiComm;
+
+interface
+
+{$i platform.inc}
+
+const
+  { Error codes }
+  errOk                 = 0;
+  errVioBase            = 1000;
+  errKbdBase            = 1010;
+  errFileCtrlBase	= 1020;
+  errMouseBase          = 1030;
+  { The following ranges have been defined for error codes:
+     0      - 1000           OS dependent codes
+     1000   - 10000          API reserved codes
+     10000  -                Add-on unit errors
+    Before anyone adding a unit, contact [email protected] to assign a base
+    error code, to avoid collisions.
+
+    The symbolic names of error codes should be defined in the unit which uses
+    those error codes, except for OS dependent ones, which should be defined here
+    enclosed in IFDEFs. (The reason is that not always you can't always decide
+    which error-code belongs to one unit or the other) }
+
+{$IFDEF OS_Linux}
+  { for a more complete description of each error check /usr/include/asm/errno.h }
+  errNotPermitted         =   1;
+  errFileNotFound         =   2;
+  errNoSuchProcess        =   3;
+  errInterruptedCall      =   4;
+  errIOError              =   5;
+  errNoDevAddr            =   6;
+  errTooManyArguments     =   7;
+  errExecError            =   8;
+  errBadFileHandle        =   9;
+  errNoChild              =  10;
+  errTryAgain             =  11;
+  errWouldBlock           =  errTryAgain;
+  errOutOfMemory          =  12;
+  errNoPermission         =  13;
+  errInvalidAddress       =  14;  { Invalid pointer passed to kernel }
+  errNotBlockDev          =  15;
+  errDeviceBusy           =  16;
+  errFileExists           =  17;
+  errCrossDevice          =  18;
+  errNoSuchDev            =  19;
+  errNotDirectory         =  20;
+  errIsDirectory          =  21;
+  errInvalidArgument      =  22;
+  errFileTableOverflow    =  23;
+  errTooManyOpenFiles     =  24;
+  errNotATTY              =  25;
+  errTextBusy             =  26;
+  errFileTooLarge         =  27;
+  errDiskFull             =  28;
+  errIllegalSeek          =  29;
+  errReadOnlyFS           =  30;
+  errTooManyLinks         =  31;
+  errBrokenPipe		  =  32;
+  errMathDomain           =  33;  { Math domain error, what does this mean? }
+  errMathRange            =  34;  { Math result out of range }
+  errDeadLock             =  35;
+  errFileNameTooLong      =  36;
+  errNoLock               =  37;  { No record locks available }
+  errNotImplemented       =  38;  { Kernel function not implemented }
+  errDirNotEmpty          =  39;
+  errSymlinkLoop          =  40;
+  errNoMessage            =  41;  { ??? maybe the IPC getmsg call returns this }
+  { Here are some errors that are too cryptic for me, I think they are not used
+    under Linux, only on some mainframes (channel errors etc) }
+  errBadFont              =  59;
+  errNotStream            =  60;
+  errNoData               =  61;
+  errTimeOut              =  62;
+  errNoMoreStreams        =  63;
+  errNoNetwork            =  64;
+  errPackageNotInstalled  =  65; { ??? }
+  errRemote               =  66;
+  errSevereLink           =  67;
+  errAdvertise            =  68; { Advertise error??? }
+  errSrMount              =  69;
+  errCommunication        =  70; { Communication error on send? }
+  errProtocol             =  71; { Protocol error }
+  errMuiltiHop            =  72;
+  errDotDot               =  73; { RFS specific error ???}
+  errBadMessage           =  74; { Not a data message }
+  errOverflow             =  75;
+  errNotUnique            =  76; { Network name not unique }
+  errBadFileHandleState   =  77;
+  errRemoteChange         =  78; { Remote address changed }
+  errLibAccess            =  79; { Cannot access the needed shared lib }
+  errLibCorrupt           =  80; { Shared library corrupted }
+  errLibScn               =  81;
+  errLibTooMany           =  82; { Too many shared libraries }
+  errLibExec              =  83; { Attempting to execute a shared lib }
+  errIllegalSequence      =  84; { Illegal byte sequence ??? }
+  errRestart              =  85; { interrupted system call should be restarted }
+  errStreamPipe           =  86;
+  errTooManyUsers         =  87;
+  errNotSocket            =  88;
+  errDestAddrRequired     =  89;
+  errMessageTooLong       =  90;
+  errProtocolType         =  91;
+  errNoSuchProtocol       =  92;
+  errProtocolNotSupported =  93;
+  errSocketTypeNotSupported = 94;
+  errOperationNotSupported=  95;
+  errPFamilyNotSupported  =  96; { Protocol family not supported }
+  errAFamilyNotSupported  =  97; { Address family not supported }
+  errAddressInUse         =  98;
+  errAddressNotAvailable  =  99;
+  errNetDown              = 100;
+  errNetUnreachable       = 101;
+  errNetReset             = 102;
+  errConnAborted          = 103;
+  errConnReset            = 104;
+  errNoBufs               = 105;
+  errAlreadyConn          = 106;
+  errNotConn              = 107;
+  errShutdown             = 108;
+  errTooManyRefs          = 109;
+  errConnTimeOut          = 110;
+  errConnRefused          = 111;
+  errHostDown             = 112;
+  errNoRoute              = 113; { No route to host }
+  errOperationProgress    = 114; { Operation already in progress }
+  errStaleNFSHandle       = 115;
+  errStrucClean           = 116; { Structure needs cleaning ? }
+  { Xenix specific codes left out }
+  errRemoteIO             = 121;
+  errQuotaExceeded        = 122;
+{$ENDIF}
+{$IFDEF OS_DOS}
+  { DOS specific error-codes to be added }
+{$ENDIF}
+
+
+
+type
+{$IFDEF BIT_32}
+  CPUWord = Longint;
+  CPUInt = Longint;
+{$ELSE}
+  CPUWord = Word;
+  CPUInt = Integer;
+{$ENDIF}
+
+  PByte = ^Byte;
+  PWord = ^Word;
+  PLongint = ^Longint;
+
+{ This code is taken from Brad Williams code, with some modifications }
+type
+  TErrorHandlerReturnValue = (errRetry, errAbort, errContinue);
+  { errRetry = retry the operation,
+    errAbort = abort, return error code,
+    errContinue = abort, without returning errorcode }
+
+  TErrorHandler = function (Code: Longint; Info: Pointer): TErrorHandlerReturnValue;
+    { ErrorHandler is the standard procedural interface for all error functions.
+      Info may contain any data type specific to the error code passed to the
+      function. }
+
+function GetErrorCode: Longint;
+{ Returns the last error code, and resets it to 0 (errOK) }
+function GetErrorInfo: Pointer;
+{ Returns the info assigned to the previous error, doesn't reset the value to nil }
+{$IFDEF PPC_BP}
+function SetErrorHandler(AErrorHandler: TErrorHandler): Pointer;
+{$ELSE}
+function SetErrorHandler(AErrorHandler: TErrorHandler): TErrorHandler;
+{$ENDIF}
+{ Sets ErrorHandler to AErrorHandler, and returns the old one }
+function DefaultErrorHandler(AErrorCode: Longint; AErrorInfo: Pointer): TErrorHandlerReturnValue;
+{ Default error handler, simply sets error code, and returns errContinue }
+
+const
+  ErrorCode: Longint = errOk;
+  ErrorInfo: Pointer = nil;
+  ErrorHandler: TErrorHandler = DefaultErrorHandler;
+
+implementation
+
+function GetErrorCode: Longint;
+begin
+  GetErrorCode := ErrorCode;
+  ErrorCode := 0;
+end;
+
+function GetErrorInfo: Pointer;
+begin
+  GetErrorInfo := ErrorInfo;
+end;
+
+{$IFDEF PPC_BP}
+function SetErrorHandler(AErrorHandler: TErrorHandler): Pointer;
+begin
+  SetErrorHandler := @ErrorHandler;
+  ErrorHandler := AErrorHandler;
+end;
+{$ELSE}
+function SetErrorHandler(AErrorHandler: TErrorHandler): TErrorHandler;
+begin
+  SetErrorHandler := ErrorHandler;
+  ErrorHandler := AErrorHandler;
+end;
+{$ENDIF}
+
+function DefaultErrorHandler(AErrorCode: Longint; AErrorInfo: Pointer): TErrorHandlerReturnValue;
+begin
+  ErrorCode := AErrorCode;
+  ErrorInfo := AErrorInfo;
+  DefaultErrorHandler := errAbort; { return error code }
+end;
+
+end.
+{
+  $Log$
+  Revision 1.1  2000-02-29 11:43:16  pierre
+    Common renamed APIComm to avoid problems with free vision
+
+  Revision 1.1  2000/01/06 01:20:31  peter
+    * moved out of packages/ back to topdir
+
+  Revision 1.1  1999/12/23 19:36:47  peter
+    * place unitfiles in target dirs
+
+  Revision 1.1  1999/11/24 23:36:37  peter
+    * moved to packages dir
+
+  Revision 1.1  1998/12/04 12:48:24  peter
+    * moved some dirs
+
+  Revision 1.5  1998/10/28 00:02:05  peter
+    + mouse
+    + video.clearscreen, video.videobufsize
+
+  Revision 1.4  1998/10/26 11:22:48  peter
+    * updates
+
+
+   Date       Version  Who     Comments
+   07/12/97   0.1      Bazsi   Initial implementation (bazsi)
+   07/18/97   0.2      Bazsi   Linux specific error codes added
+   07/18/97   0.2.1    Bazsi   Some syntactical errors removed...
+   07/28/97   0.2.2    Bazsi   Base error code for Video registered
+   07/29/97   0.2.3    Bazsi   Some basic types added (PByte, PWord etc)
+   08/08/97   0.2.4    Bazsi   Finalized error handling code (Brad's code added)
+   08/27/97   0.2.5    Bazsi   BP doesn't like function types as return-values
+                               for functions, returning Pointer instead
+   09/06/97   0.2.6    Bazsi   Added base error code for Keyboard
+   11/06/97   0.2.7    Bazsi   Added base error code for FileCtrl
+}

+ 6 - 3
api/inc/filectrl.pas

@@ -32,7 +32,7 @@ interface
 {$I platform.inc}
 {$I platform.inc}
 
 
 uses
 uses
-  Common, FileSys;
+  ApiComm, FileSys;
 
 
 { The following platforms are supported
 { The following platforms are supported
     OS/2 either 1.x, or 2.x
     OS/2 either 1.x, or 2.x
@@ -159,7 +159,10 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.1  2000-01-06 01:20:31  peter
+  Revision 1.2  2000-02-29 11:43:16  pierre
+    Common renamed APIComm to avoid problems with free vision
+
+  Revision 1.1  2000/01/06 01:20:31  peter
     * moved out of packages/ back to topdir
     * moved out of packages/ back to topdir
 
 
   Revision 1.1  1999/12/23 19:36:47  peter
   Revision 1.1  1999/12/23 19:36:47  peter
@@ -177,7 +180,7 @@ end.
   Revision 1.6  1998/10/26 11:22:49  peter
   Revision 1.6  1998/10/26 11:22:49  peter
     * updates
     * updates
 
 
-  
+
    Date       Version  Who     Comments
    Date       Version  Who     Comments
    07/06/97   0.1      bazsi   Initial implementation
    07/06/97   0.1      bazsi   Initial implementation
                                many of the platforms implemented, but not
                                many of the platforms implemented, but not

+ 6 - 3
api/inc/filesys.pas

@@ -30,7 +30,7 @@ interface
                     compiler, operating system }
                     compiler, operating system }
 
 
 uses
 uses
-  Common          { Error handling }
+  ApiComm          { Error handling }
 
 
 {$IFDEF PPC_FPC}
 {$IFDEF PPC_FPC}
   , Strings
   , Strings
@@ -1060,7 +1060,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.1  2000-01-06 01:20:31  peter
+  Revision 1.2  2000-02-29 11:43:16  pierre
+    Common renamed APIComm to avoid problems with free vision
+
+  Revision 1.1  2000/01/06 01:20:31  peter
     * moved out of packages/ back to topdir
     * moved out of packages/ back to topdir
 
 
   Revision 1.1  1999/12/23 19:36:47  peter
   Revision 1.1  1999/12/23 19:36:47  peter
@@ -1090,4 +1093,4 @@ end.
   09/20/1997   0.5.1    marco   Added LastAccessed/Created to Linux part of
   09/20/1997   0.5.1    marco   Added LastAccessed/Created to Linux part of
                                 file descriptor
                                 file descriptor
   04/15/1998   0.5.2    michael Updated linux part.
   04/15/1998   0.5.2    michael Updated linux part.
-}
+}

+ 6 - 3
api/inc/keyboard.pas

@@ -33,7 +33,7 @@ uses
 {$endif win32}
 {$endif win32}
 {$endif DEBUG}
 {$endif DEBUG}
 
 
-  Common;
+  ApiComm;
 
 
 const
 const
   { We have an errorcode base of 1010 }
   { We have an errorcode base of 1010 }
@@ -231,7 +231,10 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.1  2000-01-06 01:20:31  peter
+  Revision 1.2  2000-02-29 11:43:16  pierre
+    Common renamed APIComm to avoid problems with free vision
+
+  Revision 1.1  2000/01/06 01:20:31  peter
     * moved out of packages/ back to topdir
     * moved out of packages/ back to topdir
 
 
   Revision 1.1  1999/12/23 19:36:47  peter
   Revision 1.1  1999/12/23 19:36:47  peter
@@ -262,4 +265,4 @@ end.
 
 
    Date       Version   Who     Comments
    Date       Version   Who     Comments
    07/28/98   0.2       Bazsi   Added some constants
    07/28/98   0.2       Bazsi   Added some constants
-}
+}

+ 6 - 3
api/inc/mouse.pas

@@ -27,7 +27,7 @@ interface
 {$i platform.inc}
 {$i platform.inc}
 
 
 uses
 uses
-  Common;
+  ApiComm;
 
 
 const
 const
   { We have an errorcode base of 1010 }
   { We have an errorcode base of 1010 }
@@ -141,7 +141,10 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.3  2000-02-07 22:54:44  florian
+  Revision 1.4  2000-02-29 11:43:16  pierre
+    Common renamed APIComm to avoid problems with free vision
+
+  Revision 1.3  2000/02/07 22:54:44  florian
     * custommouse define removed, i.e. code is always active
     * custommouse define removed, i.e. code is always active
     * the xor value for the mouse cursor must be $7f instead of $ff
     * the xor value for the mouse cursor must be $7f instead of $ff
 
 
@@ -155,7 +158,7 @@ end.
   Revision 1.2  1999/12/31 17:25:24  marco
   Revision 1.2  1999/12/31 17:25:24  marco
 
 
 
 
-  Added {$G+}, TP version required it.
+  Added $G+, TP version required it.
 
 
   Revision 1.1  1999/12/23 19:36:47  peter
   Revision 1.1  1999/12/23 19:36:47  peter
     * place unitfiles in target dirs
     * place unitfiles in target dirs

+ 5 - 2
api/inc/video.pas

@@ -32,7 +32,7 @@ unit Video;
 interface
 interface
 
 
 uses
 uses
-  Common;
+  ApiComm;
 
 
 {$i platform.inc}
 {$i platform.inc}
 
 
@@ -223,7 +223,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2000-02-06 14:28:19  florian
+  Revision 1.3  2000-02-29 11:43:16  pierre
+    Common renamed APIComm to avoid problems with free vision
+
+  Revision 1.2  2000/02/06 14:28:19  florian
     * mouse support for vesa resolutions under go32v2, needs currently the define
     * mouse support for vesa resolutions under go32v2, needs currently the define
       custommouse
       custommouse