Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:34

0001 /* 
0002 ** formatError.C
0003 ** 
0004 ** Author: $Author: purschke $  
0005 **   Date: $Date: 2000/07/21 01:51:13 $ 
0006 ** 
0007 ** $Log: formatError.C,v $
0008 ** Revision 1.1.1.1  2000/07/21 01:51:13  purschke
0009 ** mlp -- adding the new automakified "basic" module to CVS.
0010 **
0011 **
0012 ** Revision 1.3  1998/12/11 22:02:02  markacs
0013 ** (stephen markacs) adding log into cvs tags
0014 ** 
0015 */
0016 /*
0017 **  formatError.C
0018 **
0019 **      Contains error-handling routines for "raw format" library
0020 */
0021 
0022 #include "formatError.h"
0023 
0024 /*
0025 **  For now the error data will be kept in a statically 
0026 **    allocated structure. The actual allocation is done here.
0027 */
0028 #define ERROR_PACKAGE_RAWFMT 1
0029 
0030 typedef struct formatError {
0031     UINT subType ;
0032     ERRORVALUE errorNumber;
0033 
0034     PHDWORD* frameOrPacket_ptr;
0035     PHDWORD  additionalData;
0036 } FORMATERROR;
0037 
0038 FORMATERROR rawfmtLastError;
0039 
0040 /*
0041 **  Set an error status from a "frame" routine
0042 */
0043 void setFrameError(ERRORVALUE errorNumber, PHDWORD* pointer, PHDWORD additionalData) {
0044     rawfmtLastError.subType = errorTypeFrame; 
0045     rawfmtLastError.errorNumber = errorNumber ;
0046     rawfmtLastError.frameOrPacket_ptr = pointer; 
0047     rawfmtLastError.additionalData = additionalData;
0048 }
0049 
0050 /*
0051 **  Set an error status from a "packet" routine
0052 */
0053 void setPacketError(ERRORVALUE errorNumber, PHDWORD* pointer, PHDWORD additionalData) {
0054     rawfmtLastError.subType = errorTypePacket;
0055     rawfmtLastError.errorNumber = errorNumber;
0056     rawfmtLastError.frameOrPacket_ptr = pointer;
0057     rawfmtLastError.additionalData = additionalData;
0058 }
0059 
0060 /*
0061 **  Set a "user" error status 
0062 */
0063 void setUserError(ERRORVALUE errorNumber, PHDWORD additionalData) {
0064     rawfmtLastError.subType = errorTypeUser;
0065     rawfmtLastError.errorNumber = errorNumber;
0066     rawfmtLastError.additionalData = additionalData;
0067 }
0068 
0069 /*
0070 ** Set success status for a "frame" routine.
0071 */
0072 void setFrameSuccess () {
0073     rawfmtLastError.errorNumber = 0;
0074 }
0075 
0076 /*
0077 **  Set success for a "packet" routine.
0078 */
0079 void setPacketSuccess () {
0080     rawfmtLastError.errorNumber = 0;
0081 }
0082 
0083 /*
0084 //  Returns the error code for the "last" recorded error
0085 */
0086 ERRORVALUE formatGetErrorNumber ( ) {
0087     return rawfmtLastError.errorNumber;
0088 }
0089 
0090 /*
0091 **  Returns the error number and unpacks error data for the last recorded error
0092 */
0093 ERRORVALUE formatGetError (UINT* subType, PHDWORD** errorPointer, PHDWORD* additionalData) {
0094     *subType = rawfmtLastError.subType;
0095     *errorPointer = rawfmtLastError.frameOrPacket_ptr;
0096     *additionalData = rawfmtLastError.additionalData;
0097 
0098     return rawfmtLastError.errorNumber;
0099 }
0100 
0101 /*
0102 **  Returns the pointer to the last failed frame or packet
0103 */
0104 PHDWORD* formatGetErrorPointer () {
0105     if (rawfmtLastError.errorNumber == 0) 
0106         return 0;
0107     else 
0108         return rawfmtLastError.frameOrPacket_ptr;
0109 }
0110 
0111 /*
0112 ** Returns additional data about the last error
0113 */
0114 PHDWORD formatGetErrorAdditionalData () {
0115     if (rawfmtLastError.errorNumber == 0) 
0116         return 0;
0117     else 
0118         return rawfmtLastError.additionalData;
0119 }