/* * UPIWIN - Micro Pi Windowing Framework Kernel * Copyright (C) 2019 Amy Bowersox/Erbosoft Metaverse Design Solutions * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *------------------------------------------------------------------------- */ #ifndef __SCODE_H_INCLUDED #define __SCODE_H_INCLUDED #include "wintype.h" /*------------------------------------------------------------------- * Status codes are defined as follows: * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |S| Facility | Code | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 9 8 7 6 5 4 3 2 1 0 * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 * * S = Severity: 0 = success, 1 = error * Facility = Facility code * Code = Specific error code *------------------------------------------------------------------- */ /* Severity codes */ #define SEVERITY_SUCCESS 0x00000000 #define SEVERITY_ERROR 0x80000000 /* Facility codes - compatible with M$ */ #define FACILITY_NULL 0 #define FACILITY_RPC 1 #define FACILITY_STORAGE 3 #define FACILITY_ITF 4 #define FACILITY_UNIX 5 #define FACILITY_UPIWIN 6 #define SUCCEEDED(s) (((s) & SEVERITY_ERROR) == 0) #define FAILED(s) (((s) & SEVERITY_ERROR) != 0) #define SCODE_FACILITY(s) (((s) >> 16) & 0x7FFF) #define SCODE_CODE(s) ((s) & 0xFFFF) #define MAKE_SCODE(sev, fac, err) ((SCODE)((sev) | (((fac) & 0x7FFF) << 16) | ((err) & 0xFFFF))) #define SCODE_FROM_ERRNO(x) MAKE_SCODE(SEVERITY_ERROR, FACILITY_UNIX, (x)) #define ERRNO_AS_SCODE SCODE_FROM_ERRNO(errno) #define SCODE_CAST(x) ((SCODE)(x)) /* Basic success codes */ #define S_OK SCODE_CAST(0x00000000) /* OK return */ #define S_FALSE SCODE_CAST(0x00000001) /* "False" return */ /* Basic error codes */ #define E_NOTIMPL SCODE_CAST(0x80000001) /* not implemented */ #define E_OUTOFMEMORY SCODE_CAST(0x80000002) /* out of memory */ #define E_INVALIDARG SCODE_CAST(0x80000003) /* invalid argument */ #define E_NOINTERFACE SCODE_CAST(0x80000004) /* no such interface */ #define E_POINTER SCODE_CAST(0x80000005) /* invalid pointer */ #define E_HANDLE SCODE_CAST(0x80000006) /* invalid handle */ #define E_ABORT SCODE_CAST(0x80000007) /* aborted operation */ #define E_FAIL SCODE_CAST(0x80000008) /* unspecified failure */ #define E_ACCESSDENIED SCODE_CAST(0x80000009) /* access denied */ #define E_PENDING SCODE_CAST(0x8000000A) /* data not yet available */ #define E_BOUNDS SCODE_CAST(0x8000000B) /* access outside valid range */ #define E_CHANGED_STATE SCODE_CAST(0x8000000C) /* object changed state, result now invalid */ #define E_ILLEGAL_STATE_CHANGE SCODE_CAST(0x8000000D) /* illegal state change */ #define E_ILLEGAL_METHOD_CALL SCODE_CAST(0x8000000E) /* illegal method call */ #define E_UNEXPECTED SCODE_CAST(0x8000FFFF) /* unexpected error */ /* UPIWIN-specific errorcodes */ #define UPIWIN_E_INVALIDSCRIPT SCODE_CAST(0x80060000) /* invalid script file */ #define UPIWIN_E_NOSCRIPT SCODE_CAST(0x80060001) /* no script specified */ #endif /* __SCODE_H_INCLUDED */