Handle MusicKit errors.


Functions

void MKSetScorefileParseErrorAbort (int threshholdCount)
 Set the scorefile error threshhold, the number of parser errors to abort on.
void MKSetErrorProc (void(*errProc)(NSString *msg))
 Sets function to be used when MKError() and MKErrorCode() are called.
void MKError (NSString *msg)
 Calls the user's error procedure (aka function, set with MKSetErrorProc), if any, with one argument, the message. Otherwise, writes the message on the MusicKit error stream.
void MKSetErrorStream (NSMutableData *aStream)
 Sets the MusicKit error stream.
NSMutableData * MKErrorStream (void)
 Returns the MusicKit error stream. This is, by default, stderr.

Function Documentation

void MKError ( NSString *  msg  ) 

Calls the user's error procedure (aka function, set with MKSetErrorProc), if any, with one argument, the message. Otherwise, writes the message on the MusicKit error stream.

These functions define the MusicKit's error handling mechanism. MKError() is used to signal an error. It calls the current Music Kit error function, set through MKSetErrorProc(), to which it passes the single argument msg. If the user hasn't declared an error function, then msg is written to the MusicKit error stream, as set through MKSetErrorStream(). The default error stream is open to stderr. MKErrorStream() returns a pointer to the current MusicKit error stream. MKNote that you shouldn't use stderr as the error stream if you're running a separate-threaded performance.

A number of error codes represented by integer constants are provided by the MusicKit and listed in <MusicKit/errors.h>. If the MusicKit itself generates an error, the global system variable errno is set to one of these error codes. If you call MKError() from your application, errno isn't set.

Parameters:
msg is an NSString instance.
See also:
MKSetErrorStream.

NSMutableData* MKErrorStream ( void   ) 

Returns the MusicKit error stream. This is, by default, stderr.

Returns:
Returns an NSMutableData instance.
See also:
MKError().

void MKSetErrorProc ( void(*)(NSString *msg)  errProc  ) 

Sets function to be used when MKError() and MKErrorCode() are called.

These functions define the MusicKit's error handling mechanism. Due to the requirements of real-time, the MusicKit uses a different mechanism from that of the Application Kit to do error handling. The following functions implement that mechanism. MKError() is used to signal an error. It calls the current Music Kit error function, set through MKSetErrorProc(), to which it passes the single argument msg. If the user hasn't declared an error function, then msg is written to the MusicKit error stream, as set through MKSetErrorStream(). The default error stream is open to stderr. MKErrorStream() returns a pointer to the current MusicKit error stream. Note that you shouldn't use stderr as the error stream if you're running a separate-threaded performance.

Note that it is not guaranteed to be safe to NS_RAISE an error in any performance-oriented class.

A number of error codes represented by integer constants are provided by the MusicKit and listed in <MusicKit/errors.h>. If the MusicKit itself generates an error, the global system variable errno is set to one of these error codes. If you call MKError() from your application, errno isn't set.

If errProc is NULL, uses the default error proc, which writes to the MusicKit error NSMutableData (see MKSetErrorStream()). errProc takes one string argument. When the *errProc is called in response to a MusicKit error, errno is set to the MKErrno corresponding to the error. If *errProc is invoked in response to an application-defined error (see MKError), errno is not set; it's up to the application to set it, if desired.

Parameters:
errProc is a pointer to a function taking an NSString instance.

void MKSetErrorStream ( NSMutableData *  aStream  ) 

Sets the MusicKit error stream.

These functions define the MusicKit's error handling mechanism. MKError() is used to signal an error. It calls the current Music Kit error function, set through MKSetErrorProc(), to which it passes the single argument msg. If the user hasn't declared an error function, then msg is written to the MusicKit error stream, as set through MKSetErrorStream(). The default error stream is open to stderr. MKErrorStream() returns a pointer to the current MusicKit error stream. MKNote that you shouldn't use stderr as the error stream if you're running a separate-threaded performance.

A number of error codes represented by integer constants are provided by the MusicKit and listed in <MusicKit/errors.h>. If the MusicKit itself generates an error, the global system variable errno is set to one of these error codes. If you call MKError() from your application, errno isn't set.

The MusicKit initialization sets the error stream to stderr. Note that during a multi-threaded MusicKit performance, errors invoked from the MusicKit thread are not sent to the error stream. Use MKSetErrorProc to see them.

Parameters:
aStream is a NSMutableData instance. nil means stderr.
See also:
MKError().

void MKSetScorefileParseErrorAbort ( int  threshholdCount  ) 

Set the scorefile error threshhold, the number of parser errors to abort on.

As a scorefile is read into an application, errors sometimes occur: Time tags may be out of order; undeclared or mistyped names may pop up in the middle of the file. The MusicKit keeps a count of these errors for each file it reads. If the error count for a particular file exceeds the threshhold set as the threshholdCount argument to this function, the scorefile parsing is aborted and the file is closed (if the MusicKit opened it itself). The default limit is ten errors.

Parameters:
threshholdCount is an int. To abort on the first error, pass 1 as the argument. To never abort, pass MAXINT as the argument.


Generated on Sat Dec 5 17:01:14 2009 for MusicKit by  doxygen 1.5.6