Annotation of hatari/src/includes/log.h, revision 1.1.1.2

1.1       root        1: /*
                      2:   Hatari - log.h
1.1.1.2 ! root        3:   
1.1       root        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: 
1.1.1.2 ! root       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:  */
1.1       root       19: typedef enum
                     20: {
1.1.1.2 ! root       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 */
1.1       root       30: } LOGTYPE;
                     31: 
1.1.1.2 ! root       32: #ifndef __GNUC__
        !            33: /* assuming attributes work only for GCC */
        !            34: #define __attribute__(foo)
        !            35: #endif
        !            36: 
        !            37: extern int Log_Init(void);
1.1       root       38: extern void Log_UnInit(void);
1.1.1.2 ! root       39: extern void Log_Printf(LOGTYPE nType, const char *psFormat, ...)
        !            40:        __attribute__ ((format (printf, 2, 3)));
        !            41: extern void Log_AlertDlg(LOGTYPE nType, const char *psFormat, ...)
        !            42:        __attribute__ ((format (printf, 2, 3)));
        !            43: extern LOGTYPE Log_ParseOptions(const char *OptionStr);
        !            44: extern bool Log_SetTraceOptions(const char *OptionsStr);
        !            45: 
        !            46: #ifndef __GNUC__
        !            47: #undef __attribute__
        !            48: #endif
        !            49: 
        !            50: 
        !            51: 
        !            52: /* Tracing
        !            53:  * -------
        !            54:  * Tracing outputs information about what happens in the emulated
        !            55:  * system and slows down the emulation.  As it's intended mainly
        !            56:  * just for the Hatari developers, tracing support is compiled in
        !            57:  * by default.
        !            58:  * 
        !            59:  * Tracing can be enabled but defining HATARI_TRACE_ACTIVATED
        !            60:  * in the top level config.h
        !            61:  */
        !            62: #include "config.h"
        !            63: 
        !            64: /* Up to 32 levels when using Uint32 for HatariTraceFlags */
        !            65: #define        HATARI_TRACE_VIDEO_SYNC         (1<<0)
        !            66: #define        HATARI_TRACE_VIDEO_RES          (1<<1)
        !            67: #define        HATARI_TRACE_VIDEO_COLOR        (1<<2)
        !            68: #define        HATARI_TRACE_VIDEO_BORDER_V     (1<<3)
        !            69: #define        HATARI_TRACE_VIDEO_BORDER_H     (1<<4)
        !            70: #define        HATARI_TRACE_VIDEO_ADDR         (1<<5)
        !            71: #define        HATARI_TRACE_VIDEO_VBL          (1<<6)
        !            72: #define        HATARI_TRACE_VIDEO_HBL          (1<<7)
        !            73: #define        HATARI_TRACE_VIDEO_STE          (1<<8)
        !            74: 
        !            75: #define        HATARI_TRACE_MFP_EXCEPTION      (1<<9)
        !            76: #define        HATARI_TRACE_MFP_START          (1<<10)
        !            77: #define        HATARI_TRACE_MFP_READ           (1<<11)
        !            78: #define        HATARI_TRACE_MFP_WRITE          (1<<12)
        !            79: 
        !            80: #define        HATARI_TRACE_PSG_WRITE_REG      (1<<13)
        !            81: #define        HATARI_TRACE_PSG_WRITE_DATA     (1<<14)
        !            82: 
        !            83: #define        HATARI_TRACE_CPU_PAIRING        (1<<15)
        !            84: #define        HATARI_TRACE_CPU_DISASM         (1<<16)
        !            85: #define        HATARI_TRACE_CPU_EXCEPTION      (1<<17)
        !            86: 
        !            87: #define        HATARI_TRACE_INT                (1<<18)
        !            88: 
        !            89: #define        HATARI_TRACE_FDC                (1<<19)
        !            90: 
        !            91: #define        HATARI_TRACE_IKBD_CMDS          (1<<20)
        !            92: #define        HATARI_TRACE_IKBD_ACIA          (1<<21)
        !            93: #define        HATARI_TRACE_IKBD_EXEC          (1<<22)
        !            94: 
        !            95: #define HATARI_TRACE_BLITTER           (1<<23)
        !            96: 
        !            97: #define HATARI_TRACE_OS_BIOS           (1<<24)
        !            98: #define HATARI_TRACE_OS_XBIOS          (1<<25)
        !            99: #define HATARI_TRACE_OS_GEMDOS         (1<<26)
        !           100: #define HATARI_TRACE_OS_VDI            (1<<27)
        !           101: 
        !           102: #define        HATARI_TRACE_NONE               (0)
        !           103: #define        HATARI_TRACE_ALL                (~0)
        !           104: 
        !           105: 
        !           106: #define        HATARI_TRACE_VIDEO_ALL          ( HATARI_TRACE_VIDEO_SYNC | HATARI_TRACE_VIDEO_RES | HATARI_TRACE_VIDEO_COLOR \
        !           107:                | HATARI_TRACE_VIDEO_BORDER_V | HATARI_TRACE_VIDEO_BORDER_H | HATARI_TRACE_VIDEO_ADDR \
        !           108:                | HATARI_TRACE_VIDEO_VBL | HATARI_TRACE_VIDEO_HBL | HATARI_TRACE_VIDEO_STE )
        !           109: 
        !           110: #define HATARI_TRACE_MFP_ALL           ( HATARI_TRACE_MFP_EXCEPTION | HATARI_TRACE_MFP_START | HATARI_TRACE_MFP_READ | HATARI_TRACE_MFP_WRITE )
        !           111: 
        !           112: #define        HATARI_TRACE_PSG_ALL            ( HATARI_TRACE_PSG_WRITE_REG | HATARI_TRACE_PSG_WRITE_DATA )
        !           113: 
        !           114: #define        HATARI_TRACE_CPU_ALL            ( HATARI_TRACE_CPU_PAIRING | HATARI_TRACE_CPU_DISASM | HATARI_TRACE_CPU_EXCEPTION )
        !           115: 
        !           116: #define        HATARI_TRACE_IKBD_ALL           ( HATARI_TRACE_IKBD_CMDS | HATARI_TRACE_IKBD_ACIA | HATARI_TRACE_IKBD_EXEC | HATARI_TRACE_OS_VDI )
        !           117: 
        !           118: #define        HATARI_TRACE_OS_ALL             ( HATARI_TRACE_OS_BIOS | HATARI_TRACE_OS_XBIOS | HATARI_TRACE_OS_GEMDOS | HATARI_TRACE_OS_VDI )
        !           119: 
        !           120: 
        !           121: extern FILE *TraceFile;
        !           122: extern Uint32 HatariTraceFlags;
        !           123: 
        !           124: #ifdef HATARI_TRACE_ACTIVATED
        !           125: 
        !           126: #define        HATARI_TRACE( level, args... ) \
        !           127:        if ( HatariTraceFlags & level ) fprintf ( TraceFile , args )
        !           128: #define HATARI_TRACE_LEVEL( level )    (HatariTraceFlags & level)
        !           129: 
        !           130: #else          /* HATARI_TRACE_ACTIVATED */
        !           131: 
        !           132: #define HATARI_TRACE( level, args... ) {}
        !           133: #define HATARI_TRACE_LEVEL( level )    (0)
        !           134: 
        !           135: #endif         /* HATARI_TRACE_ACTIVATED */
        !           136: 
        !           137: /* Always defined in full to avoid compiler warnings about unused variables.
        !           138:  * In code it's used in such a way that it will be optimized away when tracing
        !           139:  * is disabled.
        !           140:  */
        !           141: #define HATARI_TRACE_PRINT( args... )  fprintf ( TraceFile , args )
1.1       root      142: 
1.1.1.2 ! root      143: #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.