(.. This section of documentation is only a start.)
// // EventType -- report of some condition occurring during program execution // @deftype EventType- (void) raiseEvent; - (void) raiseEvent: (void *)eventData, ...; @end // // Warning -- a condition of possible concern to a program developer // @deftype Warning - (void) setMessageString: (char *)messageString; - (char *) getMessageString; @end // // Error -- a condition which prevents further execution // @deftype Error @end
Warning and Event also inherit from Symbol, so that each type of warning or error may be given a unique global name. Any library may publish its own warning and event names as part of its documented library interface (see module definition conventions for standard methods of declaring interface symbols in a library header file.)
These predefined warning and event types are typically used not directly by the messages defined above, but by the following macro defined in defobj.h:
#define raiseEvent( eventType, formatString, args... )This macro raises an event of the type identified by the first argument. Default handling of the event is to print a formatted message including standard header and trailer lines, and then either to continue (in the case of a Warning) or to terminate the program in the case of Error). The standard header lines include the file, function, and line number where the macro that raised the event was executed.
If the formatString argument is nil, a default message string already established as part of the warning or event type is used to report the error. Otherwise, the formatString argument must be a null-terminated C character string that overrides the default string.
Either the default or replacement message string may contain printf-style formatted field definitions. For each formatted field definition, an argument value must be supplied in the args... section of the macro. (The support of the GNU C compiler for macros with variable argument lists is used by the macro.)
(.. Methods for defining new event types as part of a library implementation are not currently documented. Instead, just use the raiseEvent macro on one of the predefined Warning or Event Types if you want to raise an event using this standard mechanism. Eventually, this standard mechanism will be used to handle warnings and errors under various forms of logging exception handling support.)
// // standard errors // extern idSourceMessage, // message in the source defines error NotImplemented, // requested behavior not implemented by object SubclassMustImplement, // requested behavior must be implemented by subclass InvalidCombination, // invalid combination of set messages for create InvalidArgument, // argument value not valid CreateSubclassing, // improper use of Create subclassing framework CreateUsage, // incorrect sequence of Create protocol messages OutOfMemory, // no more memory available for allocation InvalidAllocSize, // no more memory available for allocation InternalError; // unexpected condition encountered in program // // standard warnings // extern id WarningMessage, // message in the source defines warning LibraryUsage, // invalid usage of library interface DefaultAssumed, // non-silent use of default ObsoleteMessage, // using feature which could be removed in future ObsoleteFeature, // using feature which could be removed in future ResourceAvailability; // resource from runtime environment not available