src/pmc/exception.pmc - Exception PMC
This is the exception base class.
For now,
this class is based on ResziablePMCArray
.
This will change when the full PMC PDD is implemented.
An exception object has these attributes:
- 0
_message
- Textual representation of the exception.
- 1
_type
- The exception type,
(see include/parrot/exceptions.h,
except_type.pasm).
- 2
_severity
- The severity of the exception,
(see src/exceptions.h,
except_severity.pasm).
- 3
payload
- Additional data for the exception.
- 4
unused
Optional:
- 5
_C_file
- The C code file in which the exception was raised.
- 6
_C_line
- The line of C code on which the exception was raised.
- 7
_P_file
- The PASM/PIR/Perl file in which the exception was raised.
- 8
_P_line
- The line of PASM/PIR/Perl code on which the exception was raised.
- 9,
10
unused
- Any information attached by the HL.
This shouldn't start with an underscore (that is reserved for Parrot's internal usage.
These are stored as properties.
- Note: currently,
HLL information must be indexed by number.
Slots 9 and 10 are available for the HLL - This is subject to change.
When an exception handler is called,
the exception object is passed as as the first argument,
the message as the second argument of the call.
These arguments can be retrieved with the get_results
opcode.
void init()
- Initializes the exception with default values.
STRING *get_string_keyed(PMC *key)
- Returns the Parrot string value for
*key
.
The only current recognized key
is "_message".
STRING *get_string()
- Return the exception message.
INTVAL get_integer_keyed(PMC *key)
- Returns the integer value for
*key
.
PMC *get_pmc_keyed(PMC *key)
- Returns the PMC value for
*key
.
PMC *get_pmc_keyed_int(INTVAL key)
- Returns the PMC value of the element at index
key
,
but ignores too big negative keys.
void set_string_keyed(PMC *key, STRING *value)
- Sets the Parrot string value for
*key
.
void set_integer_keyed(PMC *key, INTVAL value)
- Sets the integer value for
*key
.
void set_pmc_keyed(PMC *key, PMC *value)
- Sets the PMC value for
*key
.
INTVAL is_equal(PMC *value)
- Compare the passed in Exception with SELF.
Returns True if
SELF
isa value
get_attr_str
- Retrieve an attribute value for the exception object.
set_attr_str
- Set an attribute value for the exception object.
shift_*
,
unshift_*
,
pop_*
,
push_*
- These methods are silently ignored.
Initial revision by leo 2003.07.10.