Annotation of hatari/src/debug/log.h, revision 1.1

1.1     ! root        1: /*
        !             2:   Hatari - log.h
        !             3:   
        !             4:   This file is distributed under the GNU Public License, version 2 or at
        !             5:   your option any later version. Read the file gpl.txt for details.
        !             6: */
        !             7: #ifndef HATARI_LOG_H
        !             8: #define HATARI_LOG_H
        !             9: 
        !            10: #include <stdbool.h>
        !            11: #include <SDL_types.h>
        !            12: 
        !            13: 
        !            14: /* Logging
        !            15:  * -------
        !            16:  * Is always enabled as it's information that can be useful
        !            17:  * to the Hatari users
        !            18:  */
        !            19: typedef enum
        !            20: {
        !            21: /* these present user with a dialog and log the issue */
        !            22:        LOG_FATAL,      /* Hatari can't continue unless user resolves issue */
        !            23:        LOG_ERROR,      /* something user did directly failed (e.g. save) */
        !            24: /* these just log the issue */
        !            25:        LOG_WARN,       /* something failed, but it's less serious */
        !            26:        LOG_INFO,       /* user action success (e.g. TOS file load) */
        !            27:        LOG_TODO,       /* functionality not yet being emulated */
        !            28:        LOG_DEBUG,      /* information about internal Hatari working */
        !            29:        LOG_NONE        /* invalid LOG level */
        !            30: } LOGTYPE;
        !            31: 
        !            32: #ifndef __GNUC__
        !            33: /* assuming attributes work only for GCC */
        !            34: #define __attribute__(foo)
        !            35: #endif
        !            36: 
        !            37: extern int Log_Init(void);
        !            38: extern int Log_SetAlertLevel(int level);
        !            39: extern void Log_UnInit(void);
        !            40: extern void Log_Printf(LOGTYPE nType, const char *psFormat, ...)
        !            41:        __attribute__ ((format (printf, 2, 3)));
        !            42: extern void Log_AlertDlg(LOGTYPE nType, const char *psFormat, ...)
        !            43:        __attribute__ ((format (printf, 2, 3)));
        !            44: extern LOGTYPE Log_ParseOptions(const char *OptionStr);
        !            45: extern const char* Log_SetTraceOptions(const char *OptionsStr);
        !            46: extern char *Log_MatchTrace(const char *text, int state);
        !            47: 
        !            48: #ifndef __GNUC__
        !            49: #undef __attribute__
        !            50: #endif
        !            51: 
        !            52: 
        !            53: 
        !            54: /* Tracing
        !            55:  * -------
        !            56:  * Tracing outputs information about what happens in the emulated
        !            57:  * system and slows down the emulation.  As it's intended mainly
        !            58:  * just for the Hatari developers, tracing support is compiled in
        !            59:  * by default.
        !            60:  * 
        !            61:  * Tracing can be enabled by defining ENABLE_TRACING
        !            62:  * in the top level config.h
        !            63:  */
        !            64: #include "config.h"
        !            65: 
        !            66: /* Up to 32 levels when using Uint32 for HatariTraceFlags */
        !            67: #define        TRACE_VIDEO_SYNC         (1<<0)
        !            68: #define        TRACE_VIDEO_RES          (1<<1)
        !            69: #define        TRACE_VIDEO_COLOR        (1<<2)
        !            70: #define        TRACE_VIDEO_BORDER_V     (1<<3)
        !            71: #define        TRACE_VIDEO_BORDER_H     (1<<4)
        !            72: #define        TRACE_VIDEO_ADDR         (1<<5)
        !            73: #define        TRACE_VIDEO_VBL          (1<<6)
        !            74: #define        TRACE_VIDEO_HBL          (1<<7)
        !            75: #define        TRACE_VIDEO_STE          (1<<8)
        !            76: 
        !            77: #define        TRACE_MFP_EXCEPTION      (1<<9)
        !            78: #define        TRACE_MFP_START          (1<<10)
        !            79: #define        TRACE_MFP_READ           (1<<11)
        !            80: #define        TRACE_MFP_WRITE          (1<<12)
        !            81: 
        !            82: #define        TRACE_PSG_READ           (1<<13)
        !            83: #define        TRACE_PSG_WRITE          (1<<14)
        !            84: 
        !            85: #define        TRACE_CPU_PAIRING        (1<<15)
        !            86: #define        TRACE_CPU_DISASM         (1<<16)
        !            87: #define        TRACE_CPU_EXCEPTION      (1<<17)
        !            88: 
        !            89: #define        TRACE_INT                (1<<18)
        !            90: 
        !            91: #define        TRACE_FDC                (1<<19)
        !            92: 
        !            93: #define        TRACE_IKBD_CMDS          (1<<20)
        !            94: #define        TRACE_IKBD_ACIA          (1<<21)
        !            95: #define        TRACE_IKBD_EXEC          (1<<22)
        !            96: 
        !            97: #define TRACE_BLITTER           (1<<23)
        !            98: 
        !            99: #define TRACE_OS_BIOS           (1<<24)
        !           100: #define TRACE_OS_XBIOS          (1<<25)
        !           101: #define TRACE_OS_GEMDOS         (1<<26)
        !           102: #define TRACE_OS_VDI            (1<<27)
        !           103: 
        !           104: #define TRACE_IOMEM_RD          (1<<28)
        !           105: #define TRACE_IOMEM_WR          (1<<29)
        !           106: 
        !           107: #define TRACE_DMASND            (1<<30)
        !           108: 
        !           109: #define TRACE_CROSSBAR          (1<<31)
        !           110: 
        !           111: #define        TRACE_NONE               (0)
        !           112: #define        TRACE_ALL                (~0)
        !           113: 
        !           114: 
        !           115: #define        TRACE_VIDEO_ALL         ( TRACE_VIDEO_SYNC | TRACE_VIDEO_RES | TRACE_VIDEO_COLOR \
        !           116:                | TRACE_VIDEO_BORDER_V | TRACE_VIDEO_BORDER_H | TRACE_VIDEO_ADDR \
        !           117:                | TRACE_VIDEO_VBL | TRACE_VIDEO_HBL | TRACE_VIDEO_STE )
        !           118: 
        !           119: #define TRACE_MFP_ALL          ( TRACE_MFP_EXCEPTION | TRACE_MFP_START | TRACE_MFP_READ | TRACE_MFP_WRITE )
        !           120: 
        !           121: #define        TRACE_PSG_ALL           ( TRACE_PSG_READ | TRACE_PSG_WRITE )
        !           122: 
        !           123: #define        TRACE_CPU_ALL           ( TRACE_CPU_PAIRING | TRACE_CPU_DISASM | TRACE_CPU_EXCEPTION )
        !           124: 
        !           125: #define        TRACE_IKBD_ALL          ( TRACE_IKBD_CMDS | TRACE_IKBD_ACIA | TRACE_IKBD_EXEC | TRACE_OS_VDI )
        !           126: 
        !           127: #define        TRACE_OS_ALL            ( TRACE_OS_BIOS | TRACE_OS_XBIOS | TRACE_OS_GEMDOS | TRACE_OS_VDI )
        !           128: 
        !           129: #define        TRACE_IOMEM_ALL         ( TRACE_IOMEM_RD | TRACE_IOMEM_WR )
        !           130: 
        !           131: 
        !           132: extern FILE *TraceFile;
        !           133: extern Uint32 LogTraceFlags;
        !           134: 
        !           135: #if ENABLE_TRACING
        !           136: 
        !           137: #ifndef _VCWIN_
        !           138: #define        LOG_TRACE(level, args...) \
        !           139:        if (unlikely(LogTraceFlags & level)) fprintf(TraceFile, args)
        !           140: #endif
        !           141: #define LOG_TRACE_LEVEL( level )       (LogTraceFlags & level)
        !           142: 
        !           143: #else          /* ENABLE_TRACING */
        !           144: 
        !           145: #ifndef _VCWIN_
        !           146: #define LOG_TRACE(level, args...)      {}
        !           147: #endif
        !           148: #define LOG_TRACE_LEVEL( level )       (0)
        !           149: 
        !           150: #endif         /* ENABLE_TRACING */
        !           151: 
        !           152: /* Always defined in full to avoid compiler warnings about unused variables.
        !           153:  * In code it's used in such a way that it will be optimized away when tracing
        !           154:  * is disabled.
        !           155:  */
        !           156: #ifndef _VCWIN_
        !           157: #define LOG_TRACE_PRINT(args...)       fprintf(TraceFile , args)
        !           158: #endif
        !           159: 
        !           160: 
        !           161: #endif         /* HATARI_LOG_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.