unit be_errors;
interface

{$PACKRECORDS C}

{------------------------------------------------------------- }
{----- Error baselines --------------------------------------- }

const
  B_GENERAL_ERROR_BASE = LONG_MIN;
  B_OS_ERROR_BASE = B_GENERAL_ERROR_BASE + $1000;
  B_APP_ERROR_BASE = B_GENERAL_ERROR_BASE + $2000;
  B_INTERFACE_ERROR_BASE	= B_GENERAL_ERROR_BASE + $3000;
  B_MEDIA_ERROR_BASE = B_GENERAL_ERROR_BASE + $4000; //* - $41ff */
  B_TRANSLATION_ERROR_BASE = B_GENERAL_ERROR_BASE + $4800 //* - $48ff */
  B_MIDI_ERROR_BASE = B_GENERAL_ERROR_BASE + $5000;
  B_STORAGE_ERROR_BASE = B_GENERAL_ERROR_BASE + $6000;
  B_POSIX_ERROR_BASE = B_GENERAL_ERROR_BASE + $7000;
  B_MAIL_ERROR_BASE = B_GENERAL_ERROR_BASE + $8000;
  B_PRINT_ERROR_BASE = B_GENERAL_ERROR_BASE + $9000;
  B_DEVICE_ERROR_BASE = B_GENERAL_ERROR_BASE + $a000;
  B_WWW_ERROR_BASE = B_GENERAL_ERROR_BASE + $b000;
  B_DIALER_ERROR_BASE = B_GENERAL_ERROR_BASE + $c000;
  B_REGEXP_ERROR_BASE = B_GENERAL_ERROR_BASE + $d000;
  B_BINDER_ERROR_BASE = B_GENERAL_ERROR_BASE + $e000;


{--- Developer-defined errors start at (B_ERRORS_END+1)---- }

  B_ERRORS_END = B_GENERAL_ERROR_BASE + $ffff;

{------------------------------------------------------------- }
{----- General Errors ---------------------------------------- }
  B_NO_MEMORY = B_GENERAL_ERROR_BASE;
  B_IO_ERROR = B_GENERAL_ERROR_BASE + 1					
  B_PERMISSION_DENIED = B_GENERAL_ERROR_BASE + 2;		
  B_BAD_INDEX = B_GENERAL_ERROR_BASE + 3;				
  B_BAD_TYPE = B_GENERAL_ERROR_BASE + 4;					
  B_BAD_VALUE = B_GENERAL_ERROR_BASE + 5;				
  B_MISMATCHED_VALUES  = B_GENERAL_ERROR_BASE + 6;		
  B_NAME_NOT_FOUND  = B_GENERAL_ERROR_BASE + 7;		
  B_NAME_IN_USE = B_GENERAL_ERROR_BASE + 8;
  B_TIMED_OUT  = B_GENERAL_ERROR_BASE + 9;			
  B_INTERRUPTED = B_GENERAL_ERROR_BASE + 10;           
  B_WOULD_BLOCK = B_GENERAL_ERROR_BASE + 11;
  B_CANCELED = B_GENERAL_ERROR_BASE + 12;          
  B_NO_INIT = B_GENERAL_ERROR_BASE + 13;
  B_BUSY = B_GENERAL_ERROR_BASE + 14;
  B_NOT_ALLOWED = B_GENERAL_ERROR_BASE + 15;
  B_BAD_DATA = B_GENERAL_ERROR_BASE + 16;
  B_DATA_TRUNCATED = B_GENERAL_ERROR_BASE + 17;
  B_DONT_DO_THAT = B_GENERAL_ERROR_BASE + 18;

  B_ERROR = -1;			
  B_OK = 0;
  B_NO_ERROR = 0;

{------------------------------------------------------------- }
{----- Kernel Kit Errors ------------------------------------- }

  B_BAD_SEM_ID = B_OS_ERROR_BASE;
  B_NO_MORE_SEMS  = B_OS_ERROR_BASE + 1;				

  B_BAD_THREAD_ID = B_OS_ERROR_BASE + $100;
  B_NO_MORE_THREADS = B_OS_ERROR_BASE + $101;
  B_BAD_THREAD_STATE = B_OS_ERROR_BASE + $102;
  B_BAD_TEAM_ID = B_OS_ERROR_BASE + $103;
  B_NO_MORE_TEAMS = B_OS_ERROR_BASE + $104;

  B_BAD_PORT_ID = B_OS_ERROR_BASE + $200;
  B_NO_MORE_PORTS = B_OS_ERROR_BASE + $201;

  B_BAD_IMAGE_ID = B_OS_ERROR_BASE + $300;
  B_BAD_ADDRESS = B_OS_ERROR_BASE + $301;
  B_NOT_AN_EXECUTABLE = B_OS_ERROR_BASE + $302;
  B_MISSING_LIBRARY = B_OS_ERROR_BASE + $303;
  B_MISSING_SYMBOL = B_OS_ERROR_BASE + $304;

  B_DEBUGGER_ALREADY_INSTALLED = B_OS_ERROR_BASE + $400;

{------------------------------------------------------------- }
{----- Application Kit Errors -------------------------------- }

  B_BAD_REPLY = B_APP_ERROR_BASE;
  B_DUPLICATE_REPLY = B_APP_ERROR_BASE + 1;
  B_MESSAGE_TO_SELF = B_APP_ERROR_BASE + 2;
  B_BAD_HANDLER = B_APP_ERROR_BASE + 3;
  B_ALREADY_RUNNING = B_APP_ERROR_BASE + 4;
  B_LAUNCH_FAILED = B_APP_ERROR_BASE + 5;
  B_AMBIGUOUS_APP_LAUNCH = B_APP_ERROR_BASE + 6;
  B_UNKNOWN_MIME_TYPE = B_APP_ERROR_BASE + 7;
  B_BAD_SCRIPT_SYNTAX = B_APP_ERROR_BASE + 8;
  B_LAUNCH_FAILED_NO_RESOLVE_LINK = B_APP_ERROR_BASE + 9;
  B_LAUNCH_FAILED_EXECUTABLE = B_APP_ERROR_BASE + 10;
  B_LAUNCH_FAILED_APP_NOT_FOUND = B_APP_ERROR_BASE + 11;
  B_LAUNCH_FAILED_APP_IN_TRASH = B_APP_ERROR_BASE + 12;
  B_LAUNCH_FAILED_NO_PREFERRED_APP = B_APP_ERROR_BASE + 13;
  B_LAUNCH_FAILED_FILES_APP_NOT_FOUND = B_APP_ERROR_BASE + 14;
  B_BAD_MIME_SNIFFER_RULE = B_APP_ERROR_BASE + 15;
  B_NOT_A_MESSAGE = B_APP_ERROR_BASE + 16;

{------------------------------------------------------------- }
{----- Storage Kit/File System Errors ------------------------ }

  B_FILE_ERROR = B_STORAGE_ERROR_BASE;
  B_FILE_NOT_FOUND = B_STORAGE_ERROR_BASE + 1;	//* discouraged; use B_ENTRY_NOT_FOUND in new code*/
  B_FILE_EXISTS = B_STORAGE_ERROR_BASE + 2;
  B_ENTRY_NOT_FOUND = B_STORAGE_ERROR_BASE + 3;
  B_NAME_TOO_LONG = B_STORAGE_ERROR_BASE + 4;
  B_NOT_A_DIRECTORY = B_STORAGE_ERROR_BASE + 5;
  B_DIRECTORY_NOT_EMPTY = B_STORAGE_ERROR_BASE + 6;
  B_DEVICE_FULL = B_STORAGE_ERROR_BASE + 7;
  B_READ_ONLY_DEVICE = B_STORAGE_ERROR_BASE + 8;
  B_IS_A_DIRECTORY = B_STORAGE_ERROR_BASE + 9;
  B_NO_MORE_FDS = B_STORAGE_ERROR_BASE + 10;
  B_CROSS_DEVICE_LINK = B_STORAGE_ERROR_BASE + 11;
  B_LINK_LIMIT = B_STORAGE_ERROR_BASE + 12;
  B_BUSTED_PIPE = B_STORAGE_ERROR_BASE + 13;
  B_UNSUPPORTED = B_STORAGE_ERROR_BASE + 14;
  B_PARTITION_TOO_SMALL = B_STORAGE_ERROR_BASE + 15;

{------------------------------------------------------------- }
{----- POSIX Errors ------------------------------------------ }
  E2BIG = B_POSIX_ERROR_BASE + 1;
  ECHILD = B_POSIX_ERROR_BASE + 2;
  EDEADLK = B_POSIX_ERROR_BASE + 3;
  EFBIG = B_POSIX_ERROR_BASE + 4;
  EMLINK = B_POSIX_ERROR_BASE + 5;
  ENFILE = B_POSIX_ERROR_BASE + 6;
  ENODEV = B_POSIX_ERROR_BASE + 7;
  ENOLCK = B_POSIX_ERROR_BASE + 8;
  ENOSYS = B_POSIX_ERROR_BASE + 9;
  ENOTTY = B_POSIX_ERROR_BASE + 10;
  ENXIO = B_POSIX_ERROR_BASE + 11;
  ESPIPE = B_POSIX_ERROR_BASE + 12;
  ESRCH = B_POSIX_ERROR_BASE + 13;
  EFPOS = B_POSIX_ERROR_BASE + 14;
  ESIGPARM = B_POSIX_ERROR_BASE + 15;
  EDOM = B_POSIX_ERROR_BASE + 16;
  ERANGE = B_POSIX_ERROR_BASE + 17;
  EPROTOTYPE = B_POSIX_ERROR_BASE + 18;
  EPROTONOSUPPORT = B_POSIX_ERROR_BASE + 19;
  EPFNOSUPPORT = B_POSIX_ERROR_BASE + 20;
  EAFNOSUPPORT = B_POSIX_ERROR_BASE + 21;
  EADDRINUSE = B_POSIX_ERROR_BASE + 22;
  EADDRNOTAVAIL = B_POSIX_ERROR_BASE + 23;
  ENETDOWN = B_POSIX_ERROR_BASE + 24;
  ENETUNREACH = B_POSIX_ERROR_BASE + 25;
  ENETRESET = B_POSIX_ERROR_BASE + 26;
  ECONNABORTED = B_POSIX_ERROR_BASE + 27;
  ECONNRESET = B_POSIX_ERROR_BASE + 28;
  EISCONN = B_POSIX_ERROR_BASE + 29;
  ENOTCONN = B_POSIX_ERROR_BASE + 30;
  ESHUTDOWN = B_POSIX_ERROR_BASE + 31;
  ECONNREFUSED = B_POSIX_ERROR_BASE + 32;
  EHOSTUNREACH = B_POSIX_ERROR_BASE + 33;
  ENOPROTOOPT = B_POSIX_ERROR_BASE + 34;
  ENOBUFS = B_POSIX_ERROR_BASE + 35;
  EINPROGRESS = B_POSIX_ERROR_BASE + 36;
  EALREADY = B_POSIX_ERROR_BASE + 37;
  EILSEQ = B_POSIX_ERROR_BASE + 38;
  ENOMSG = B_POSIX_ERROR_BASE + 39;
  ESTALE = B_POSIX_ERROR_BASE + 40;
  EOVERFLOW = B_POSIX_ERROR_BASE + 41;
  EMSGSIZE = B_POSIX_ERROR_BASE + 42;
  EOPNOTSUPP = B_POSIX_ERROR_BASE + 43;
  ENOTSOCK = B_POSIX_ERROR_BASE + 44;
  ENOMEM = B_NO_MEMORY;
  EACCES = B_PERMISSION_DENIED;
  EINTR = B_INTERRUPTED;
  EIO = B_IO_ERROR;
  EBUSY = B_BUSY;
  EFAULT = B_BAD_ADDRESS;
  ETIMEDOUT = B_TIMED_OUT;

  { SysV compatibility  }
  EAGAIN = B_WOULD_BLOCK;
 
  { BSD compatibility  }
  EWOULDBLOCK = B_WOULD_BLOCK;
  EBADF = B_FILE_ERROR;
  EEXIST = B_FILE_EXISTS;
  EINVAL = B_BAD_VALUE;
  ENAMETOOLONG = B_NAME_TOO_LONG;
  ENOENT = B_ENTRY_NOT_FOUND;
  EPERM = B_NOT_ALLOWED;
  ENOTDIR = B_NOT_A_DIRECTORY;
  EISDIR = B_IS_A_DIRECTORY;
  ENOTEMPTY = B_DIRECTORY_NOT_EMPTY;
  ENOSPC = B_DEVICE_FULL;
  EROFS = B_READ_ONLY_DEVICE;
  EMFILE = B_NO_MORE_FDS;
  EXDEV = B_CROSS_DEVICE_LINK;
  ELOOP = B_LINK_LIMIT;
  ENOEXEC = B_NOT_AN_EXECUTABLE;  
  EPIPE = B_BUSTED_PIPE;
    
{------------------------------------------------------------- }
{----- Media Kit Errors -------------------------------------- }

  B_STREAM_NOT_FOUND = B_MEDIA_ERROR_BASE;
  B_SERVER_NOT_FOUND = B_MEDIA_ERROR_BASE + 1;
  B_RESOURCE_NOT_FOUND = B_MEDIA_ERROR_BASE + 2;
  B_RESOURCE_UNAVAILABLE = B_MEDIA_ERROR_BASE + 3;
  B_BAD_SUBSCRIBER = B_MEDIA_ERROR_BASE + 4;
  B_SUBSCRIBER_NOT_ENTERED = B_MEDIA_ERROR_BASE + 5;
  B_BUFFER_NOT_AVAILABLE = B_MEDIA_ERROR_BASE + 6;
  B_LAST_BUFFER_ERROR = B_MEDIA_ERROR_BASE + 7;

{------------------------------------------------------------- }
{----- Mail Kit Errors --------------------------------------- }

  B_MAIL_NO_DAEMON = B_MAIL_ERROR_BASE;
  B_MAIL_UNKNOWN_USER = B_MAIL_ERROR_BASE + 1;
  B_MAIL_WRONG_PASSWORD = B_MAIL_ERROR_BASE + 2;
  B_MAIL_UNKNOWN_HOST = B_MAIL_ERROR_BASE + 3;
  B_MAIL_ACCESS_ERROR = B_MAIL_ERROR_BASE + 4;
  B_MAIL_UNKNOWN_FIELD = B_MAIL_ERROR_BASE + 5;
  B_MAIL_NO_RECIPIENT = B_MAIL_ERROR_BASE + 6;
  B_MAIL_INVALID_MAIL = B_MAIL_ERROR_BASE + 7;

{------------------------------------------------------------- }
{----- Printing Errors -------------------------------------- }

  B_NO_PRINT_SERVER = B_PRINT_ERROR_BASE;
  B_PAPER_JAM = B_PRINT_ERROR_BASE + 1;
  B_NO_PAPER = B_PRINT_ERROR_BASE + 2;
  B_NO_INK = B_PRINT_ERROR_BASE + 3;
  B_NO_TRANSPORT = B_PRINT_ERROR_BASE + 4;
  B_BAD_TRANSPORT = B_PRINT_ERROR_BASE + 5;
  B_TRANSPORT_INIT_ERROR = B_PRINT_ERROR_BASE + 6;
  B_PRINTER_BUSY = B_PRINT_ERROR_BASE + 7;
  B_NO_PRINTER = B_PRINT_ERROR_BASE + 8;
  B_INVALID_PRINT_SETTINGS = B_PRINT_ERROR_BASE + 9;
  B_INVALID_PRINTER = B_PRINT_ERROR_BASE + 10;
  B_NO_SPOOL_FILE = B_PRINT_ERROR_BASE + 11;
  B_BAD_SPOOL_FILE = B_PRINT_ERROR_BASE + 12;
  B_NO_DRIVER = B_PRINT_ERROR_BASE + 13;
  B_BAD_DRIVER = B_PRINT_ERROR_BASE + 14;

{------------------------------------------------------------- }
{----- Device Kit Errors ------------------------------------- }

  B_DEV_INVALID_IOCTL = B_DEVICE_ERROR_BASE;
  B_DEV_NO_MEMORY = B_DEVICE_ERROR_BASE + 1;
  B_DEV_BAD_DRIVE_NUM = B_DEVICE_ERROR_BASE + 2;
  B_DEV_NO_MEDIA = B_DEVICE_ERROR_BASE + 3;
  B_DEV_UNREADABLE = B_DEVICE_ERROR_BASE + 4;
  B_DEV_FORMAT_ERROR = B_DEVICE_ERROR_BASE + 5;
  B_DEV_TIMEOUT = B_DEVICE_ERROR_BASE + 6;
  B_DEV_RECALIBRATE_ERROR = B_DEVICE_ERROR_BASE + 7;
  B_DEV_SEEK_ERROR = B_DEVICE_ERROR_BASE + 8;
  B_DEV_ID_ERROR = B_DEVICE_ERROR_BASE + 9;
  B_DEV_READ_ERROR = B_DEVICE_ERROR_BASE + 10;
  B_DEV_WRITE_ERROR = B_DEVICE_ERROR_BASE + 11;
  B_DEV_NOT_READY = B_DEVICE_ERROR_BASE + 12;
  B_DEV_MEDIA_CHANGED = B_DEVICE_ERROR_BASE + 13;
  B_DEV_MEDIA_CHANGE_REQUESTED = B_DEVICE_ERROR_BASE + 14;
  B_DEV_RESOURCE_CONFLICT = B_DEVICE_ERROR_BASE + 15;
  B_DEV_CONFIGURATION_ERROR = B_DEVICE_ERROR_BASE + 16;
  B_DEV_DISABLED_BY_USER = B_DEVICE_ERROR_BASE + 17;
  B_DEV_DOOR_OPEN = B_DEVICE_ERROR_BASE + 18;
  //	
  B_DEV_INVALID_PIPE = B_DEVICE_ERROR_BASE + 19;
  B_DEV_CRC_ERROR = B_DEVICE_ERROR_BASE + 20;
  B_DEV_STALLED = B_DEVICE_ERROR_BASE + 21;
  B_DEV_BAD_PID = B_DEVICE_ERROR_BASE + 22;
  B_DEV_UNEXPECTED_PID = B_DEVICE_ERROR_BASE + 23;
  B_DEV_DATA_OVERRUN = B_DEVICE_ERROR_BASE + 24;
  B_DEV_DATA_UNDERRUN = B_DEVICE_ERROR_BASE + 25;
  B_DEV_FIFO_OVERRUN = B_DEVICE_ERROR_BASE + 26;
  B_DEV_FIFO_UNDERRUN = B_DEVICE_ERROR_BASE + 27;
  B_DEV_PENDING = B_DEVICE_ERROR_BASE + 28;
  B_DEV_MULTIPLE_ERRORS = B_DEVICE_ERROR_BASE + 29;
  B_DEV_TOO_LATE = B_DEVICE_ERROR_BASE + 30;

{------------------------------------------------------------- }
{----- WWW Kit Errors ------------------------------------- }

  B_AUTHENTICATION_ERROR = B_WWW_ERROR_BASE;
  B_FINISH_STREAM = B_WWW_ERROR_BASE + 1;
  B_NO_RANDOM_ACCESS = B_WWW_ERROR_BASE + 2;
  B_NO_CONTENT = B_WWW_ERROR_BASE + 3;
  //* compatibility for RealPlayer.  Remove after next version */
  FINISH_STREAM = B_FINISH_STREAM;
  
{------------------------------------------------------------- }
{-----Dialer Errors (typically returned from modems)---------- }

  B_MODEM_NO_CARRIER = B_DIALER_ERROR_BASE;
  B_MODEM_BUSY = B_DIALER_ERROR_BASE + 1;
  B_MODEM_NO_DIALTONE = B_DIALER_ERROR_BASE + 2;
  B_MODEM_NO_ANSWER = B_DIALER_ERROR_BASE + 3;
  B_MODEM_ERROR = B_DIALER_ERROR_BASE + 4;
  B_MODEM_RINGING = B_DIALER_ERROR_BASE + 5;
  B_MODEM_UNKNOWN = B_DIALER_ERROR_BASE + 6;
  B_MODEM_BAD_LOGIN = B_DIALER_ERROR_BASE + 7;
  B_MODEM_TIMEOUT = B_DIALER_ERROR_BASE + 8;

{------------------------------------------------------------- }
{-----RegExp Errors ------------------------------------------ }

  B_REGEXP_UNMATCHED_PARENTHESIS = B_REGEXP_ERROR_BASE;
  B_REGEXP_TOO_BIG = B_REGEXP_ERROR_BASE + 1;
  B_REGEXP_TOO_MANY_PARENTHESIS = B_REGEXP_ERROR_BASE + 2;
  B_REGEXP_JUNK_ON_END = B_REGEXP_ERROR_BASE + 3;
  B_REGEXP_STAR_PLUS_OPERAND_EMPTY = B_REGEXP_ERROR_BASE + 4;
  B_REGEXP_NESTED_STAR_QUESTION_PLUS = B_REGEXP_ERROR_BASE + 5;
  B_REGEXP_INVALID_BRACKET_RANGE = B_REGEXP_ERROR_BASE + 6;
  B_REGEXP_UNMATCHED_BRACKET = B_REGEXP_ERROR_BASE + 7;
  B_REGEXP_INTERNAL_ERROR = B_REGEXP_ERROR_BASE + 8;
  B_REGEXP_QUESTION_PLUS_STAR_FOLLOWS_NOTHING = B_REGEXP_ERROR_BASE + 9;
  B_REGEXP_TRAILING_BACKSLASH = B_REGEXP_ERROR_BASE + 10;
  B_REGEXP_CORRUPTED_PROGRAM = B_REGEXP_ERROR_BASE + 11;
  B_REGEXP_MEMORY_CORRUPTION = B_REGEXP_ERROR_BASE + 12;
  B_REGEXP_CORRUPTED_POINTERS = B_REGEXP_ERROR_BASE + 13;
  B_REGEXP_CORRUPTED_OPCODE = B_REGEXP_ERROR_BASE + 14;

{------------------------------------------------------------- }
{-----Binder Errors ------------------------------------------ }

  B_BINDER_MISSING_ARG = B_BINDER_ERROR_BASE;
  B_BINDER_BAD_TYPE = B_BINDER_ERROR_BASE + 1;
  B_BINDER_DEAD = B_BINDER_ERROR_BASE + 2;
  B_BINDER_UNKNOWN_TRANSACT = B_BINDER_ERROR_BASE + 3;
  B_BINDER_BAD_TRANSACT = B_BINDER_ERROR_BASE + 4;

{------------------------------------------------------------- }
{------------------------------------------------------------- }
  ENOERR = 0;
  { some code assumes EOK exists  }
  EOK = ENOERR;
  
implementation
end.
