Changeset 2254 for trunk/src/emx/include/InnoTekLIBC/logstrict.h
- Timestamp:
- Jul 17, 2005, 2:25:44 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/include/InnoTekLIBC/logstrict.h
-
Property cvs2svn:cvs-rev
changed from
1.13
to1.14
r2253 r2254 7 7 * 8 8 * Copyright (c) 2004 InnoTek Systemberatung GmbH 9 * Copyright (c) 2004-2005 knut st. osmundsen <bird-srcspam@anduin.net> 9 10 * Author: knut st. osmundsen <bird-srcspam@anduin.net> 10 11 * … … 76 77 unsigned __libclog_uEnterTS__ = __libc_LogEnter(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__) 77 78 #else 78 #define LIBCLOG_ENTER(...) //hmm79 #define LIBCLOG_ENTER(...) //... 79 80 #endif 80 81 … … 84 85 __libc_LogMsg(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__) 85 86 #else 86 #define LIBCLOG_MSG(...) do {} while (0)87 #endif 88 89 /** Macro to log a generic message within a function w. */87 #define LIBCLOG_MSG(...) ((void)0) 88 #endif 89 90 /** Macro to log a generic message within a function. */ 90 91 #ifdef DEBUG_LOGGING 91 92 #define LIBCLOG_MSG2(...) \ 92 93 __libc_LogMsg(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__) 93 94 #else 94 #define LIBCLOG_MSG2(...) do {} while (0) 95 #define LIBCLOG_MSG2(...) ((void)0) 96 #endif 97 98 /** Macro to log an user error within a function entered by LIBCLOG_ENTER(). */ 99 #ifdef DEBUG_LOGGING 100 #define LIBCLOG_ERROR(...) \ 101 __libc_LogError(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) 102 #else 103 #define LIBCLOG_ERROR(...) ((void)0) 104 #endif 105 106 /** Macro to log an user error within a function. */ 107 #ifdef DEBUG_LOGGING 108 #define LIBCLOG_ERROR2(...) \ 109 __libc_LogError(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) 110 #else 111 #define LIBCLOG_ERROR2(...) ((void)0) 112 #endif 113 114 /** Macro to check for and log an user error within a function entered by LIBCLOG_ENTER(). */ 115 #ifdef DEBUG_LOGGING 116 #define LIBCLOG_ERROR_CHECK(expr, ...) \ 117 (!(expr) ? __libc_LogError(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) : ((void)0) ) 118 #else 119 #define LIBCLOG_ERROR_CHECK(expr, ...) ((void)0) 120 #endif 121 122 /** Macro to check for and log an user error within a function. */ 123 #ifdef DEBUG_LOGGING 124 #define LIBCLOG_ERROR2_CHECK(expr, ...) \ 125 (!(expr) ? __libc_LogError(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) : ((void)0) ) 126 #else 127 #define LIBCLOG_ERROR2_CHECK(expr, ...) ((void)0) 95 128 #endif 96 129 … … 100 133 __libc_LogRaw(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, string, maxlen) 101 134 #else 102 #define LIBCLOG_RAW(...) do {} while (0)103 #endif 104 105 /** Macro to l og a function exit. */135 #define LIBCLOG_RAW(...) ((void)0) 136 #endif 137 138 /** Macro to leave a function entered by LIBCLOG_ENTER(). */ 106 139 #ifdef DEBUG_LOGGING 107 140 #define LIBCLOG_LEAVE(...) \ 108 141 __libc_LogLeave(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__) 109 142 #else 110 #define LIBCLOG_LEAVE(...) do {} while (0)143 #define LIBCLOG_LEAVE(...) ((void)0) 111 144 #endif 112 145 113 146 /** Macro to log a custom message and return. */ 114 #define LIBCLOG_RETURN_MSG(rc,...) do { LIBCLOG_LEAVE(__VA_ARGS__); 147 #define LIBCLOG_RETURN_MSG(rc,...) do { LIBCLOG_LEAVE(__VA_ARGS__); return (rc); } while (0) 115 148 /** Macro to log a custom message and return. */ 116 #define LIBCLOG_RETURN_MSG_VOID(...) do { LIBCLOG_LEAVE(__VA_ARGS__); 149 #define LIBCLOG_RETURN_MSG_VOID(...) do { LIBCLOG_LEAVE(__VA_ARGS__); return; } while (0) 117 150 118 151 /** Macro to log a void return and do the return. */ … … 128 161 /** Macro to log a pointer return and do the return. */ 129 162 #define LIBCLOG_RETURN_P(rc) LIBCLOG_RETURN_MSG((rc), "ret %p\n", (void*)(rc)); 163 164 165 /** Macro to leave a function entered by LIBCLOG_ENTER() on user error. */ 166 #ifdef DEBUG_LOGGING 167 #define LIBCLOG_ERROR_LEAVE(...) \ 168 __libc_LogErrorLeave(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) 169 #else 170 #define LIBCLOG_ERROR_LEAVE(...) ((void)0) 171 #endif 172 173 /** Macro to log a user error and return. */ 174 #define LIBCLOG_ERROR_RETURN(rc,...) do { LIBCLOG_ERROR_LEAVE(__VA_ARGS__); return (rc); } while (0) 175 #define LIBCLOG_ERROR_RETURN_MSG LIBCLOG_ERROR_RETURN 176 /** Macro to log a user error and return. */ 177 #define LIBCLOG_ERROR_RETURN_MSG_VOID(...) do { LIBCLOG_ERROR_LEAVE(__VA_ARGS__); return; } while (0) 178 179 /** Macro to log a void return user error and do the return. */ 180 #define LIBCLOG_ERROR_RETURN_VOID() LIBCLOG_ERROR_RETURN_MSG_VOID( "ret void\n") 181 /** Macro to log an int return user error and do the return. */ 182 #define LIBCLOG_ERROR_RETURN_INT(rc) LIBCLOG_ERROR_RETURN_MSG((rc), "ret %d (%#x)\n", (rc), (rc)) 183 /** Macro to log an unsigned int return user error and do the return. */ 184 #define LIBCLOG_ERROR_RETURN_UINT(rc) LIBCLOG_ERROR_RETURN_MSG((rc), "ret %u (%#x)\n", (rc), (rc)); 185 /** Macro to log an long int return user error and do the return. */ 186 #define LIBCLOG_ERROR_RETURN_LONG(rc) LIBCLOG_ERROR_RETURN_MSG((rc), "ret %ld (%#lx)\n", (rc), (rc)); 187 /** Macro to log an unsigned long int return user error and do the return. */ 188 #define LIBCLOG_ERROR_RETURN_ULONG(rc) LIBCLOG_ERROR_RETURN_MSG((rc), "ret %lu (%#lx)\n", (rc), (rc)); 189 /** Macro to log a pointer return user error and do the return. */ 190 #define LIBCLOG_ERROR_RETURN_P(rc) LIBCLOG_ERROR_RETURN_MSG((rc), "ret %p\n", (void*)(rc)); 191 130 192 131 193 /** @defgroup __libc_log_flags Message Flags (to be combined with group) … … 183 245 /** Memory Manager APIs. */ 184 246 #define __LIBC_LOG_GRP_MMAN 16 247 /** Load APIs. */ 248 #define __LIBC_LOG_GRP_LDR 1 /** @todo fix me */ 185 249 186 250 /** Backend SysV IPC APIs. */ … … 467 531 /** 468 532 * Output a leave function log message. 533 * 469 534 * A leave message is considered to be one line and is appended a newline if 470 535 * none was given. … … 481 546 482 547 /** 548 * Output a leave function log message upon a user error. 549 * 550 * The function may breakpoint if configured to do so. A leave message is 551 * considered to be one line and is appended a newline if none was given. 552 * 553 * @param uEnterTS The timestamp returned by LogEnter. 554 * @param pvInstance Logger instance. If NULL the message goes to the 555 * default log instance. 556 * @param fGroupAndFlags Logging group and logging flags. 557 * @param pszFunction Name of the function which was entered. 558 * @param pszFile Source filename. 559 * @param uLine Line number. 560 * @param pszFormat Format string to display the result. 561 * @param ... Arguments to the format string. 562 */ 563 extern void __libc_LogErrorLeave(unsigned uEnterTS, void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, const char *pszFile, unsigned uLine, const char *pszFormat, ...) __printflike(7, 8); 564 565 /** 483 566 * Output a log message. 567 * 484 568 * A log message is considered to be one line and is appended a newline if 485 569 * none was given. … … 494 578 */ 495 579 extern void __libc_LogMsg(unsigned uEnterTS, void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, const char *pszFormat, ...) __printflike(5, 6); 580 581 /** 582 * Output a log user error message. 583 * 584 * This may raise a breakpoint exception if configured so. A log message is 585 * considered to be one line and is appended a newline if none was given. 586 * 587 * @param uEnterTS The timestamp returned by LogEnter. 588 * @param pvInstance Logger instance. If NULL the message goes to the 589 * default log instance. 590 * @param fGroupAndFlags Logging group and logging flags. 591 * @param pszFunction Name of the function which was entered. 592 * @param pszFile Source filename. 593 * @param uLine Line number. 594 * @param pszFormat Format string for the message to log. 595 * @param ... Arguments to the format string. 596 */ 597 extern void __libc_LogError(unsigned uEnterTS, void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, const char *pszFile, unsigned uLine, const char *pszFormat, ...) __printflike(7, 8); 496 598 497 599 /** -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.