/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * The contents of this file are subject to the Netscape Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/NPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is Netscape * Communications Corporation. Portions created by Netscape are * Copyright (C) 1998 Netscape Communications Corporation. All * Rights Reserved. * * Contributor(s): */ #ifndef READER_H #define READER_H #include "NativeDefs.h" struct VerifyError { enum Cause { unknown, // Unknown cause notImplemented, // Functionality not implemented yet noClassDefFound, // Error in reading class file: file not found, or has errors badClassFormat, // Badly formatted class file illegalAccess, // Class does not have permissions to access a particular field/method noSuchField, // Field not found in class noSuchMethod, // Method not found in class noBytecodes, // No bytecodes in a function badBytecode, // Bad bytecode opcode badBytecodeOffset, // Bad offset to a bytecode instruction badNewArrayType, // Bad type passed to newarray instruction badConstantPoolIndex, // Constant pool index out of range badReturn, // Wrong return instruction used in this function writeToConst, // Attempt to write to a constant (final) field classNotFound, // Given class not found in class file nonThrowableCatch, // Catch filter class not a subclass of Throwable classCircularity, // Class can be its own superclass resourceExhausted, // Compiler internal limits reached abstractMethod, // Attempt to invoke abstract method incompatibleClassChange // Binary incompatibility }; const Cause cause; VerifyError(Cause cause): cause(cause) {} }; NS_EXTERN void verifyError(VerifyError::Cause cause); struct RuntimeError { enum Cause { unknown, // Unknown cause internal, // Internal error notImplemented, // Functionality not implemented yet illegalArgument, // incorrect argument to a method illegalAccess, // prohibited operation securityViolation, // Security violation IOError, // IO Error fileNotFound, linkError, // Unable to link method nullPointer, // Null Pointer argument notInstantiable, // Attempt to instantiate an abstract class outOfMemory }; const Cause cause; RuntimeError(Cause cause): cause(cause) {} }; NS_EXTERN void runtimeError(RuntimeError::Cause cause); #endif