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

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);
1.1.1.4 ! root       44: extern const char* Log_SetTraceOptions(const char *OptionsStr);
1.1.1.2   root       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:  * 
1.1.1.4 ! root       59:  * Tracing can be enabled by defining ENABLE_TRACING
1.1.1.2   root       60:  * in the top level config.h
                     61:  */
                     62: #include "config.h"
                     63: 
                     64: /* Up to 32 levels when using Uint32 for HatariTraceFlags */
1.1.1.4 ! root       65: #define        TRACE_VIDEO_SYNC         (1<<0)
        !            66: #define        TRACE_VIDEO_RES          (1<<1)
        !            67: #define        TRACE_VIDEO_COLOR        (1<<2)
        !            68: #define        TRACE_VIDEO_BORDER_V     (1<<3)
        !            69: #define        TRACE_VIDEO_BORDER_H     (1<<4)
        !            70: #define        TRACE_VIDEO_ADDR         (1<<5)
        !            71: #define        TRACE_VIDEO_VBL          (1<<6)
        !            72: #define        TRACE_VIDEO_HBL          (1<<7)
        !            73: #define        TRACE_VIDEO_STE          (1<<8)
1.1.1.2   root       74: 
1.1.1.4 ! root       75: #define        TRACE_MFP_EXCEPTION      (1<<9)
        !            76: #define        TRACE_MFP_START          (1<<10)
        !            77: #define        TRACE_MFP_READ           (1<<11)
        !            78: #define        TRACE_MFP_WRITE          (1<<12)
1.1.1.2   root       79: 
1.1.1.4 ! root       80: #define        TRACE_PSG_READ           (1<<13)
        !            81: #define        TRACE_PSG_WRITE          (1<<14)
1.1.1.2   root       82: 
1.1.1.4 ! root       83: #define        TRACE_CPU_PAIRING        (1<<15)
        !            84: #define        TRACE_CPU_DISASM         (1<<16)
        !            85: #define        TRACE_CPU_EXCEPTION      (1<<17)
1.1.1.2   root       86: 
1.1.1.4 ! root       87: #define        TRACE_INT                (1<<18)
1.1.1.2   root       88: 
1.1.1.4 ! root       89: #define        TRACE_FDC                (1<<19)
1.1.1.2   root       90: 
1.1.1.4 ! root       91: #define        TRACE_IKBD_CMDS          (1<<20)
        !            92: #define        TRACE_IKBD_ACIA          (1<<21)
        !            93: #define        TRACE_IKBD_EXEC          (1<<22)
1.1.1.2   root       94: 
1.1.1.4 ! root       95: #define TRACE_BLITTER           (1<<23)
1.1.1.2   root       96: 
1.1.1.4 ! root       97: #define TRACE_OS_BIOS           (1<<24)
        !            98: #define TRACE_OS_XBIOS          (1<<25)
        !            99: #define TRACE_OS_GEMDOS         (1<<26)
        !           100: #define TRACE_OS_VDI            (1<<27)
1.1.1.2   root      101: 
1.1.1.4 ! root      102: #define TRACE_IOMEM_RD          (1<<28)
        !           103: #define TRACE_IOMEM_WR          (1<<29)
1.1.1.3   root      104: 
1.1.1.4 ! root      105: #define TRACE_DMASND            (1<<30)
1.1.1.2   root      106: 
1.1.1.4 ! root      107: #define        TRACE_NONE               (0)
        !           108: #define        TRACE_ALL                (~0)
1.1.1.2   root      109: 
                    110: 
1.1.1.4 ! root      111: #define        TRACE_VIDEO_ALL         ( TRACE_VIDEO_SYNC | TRACE_VIDEO_RES | TRACE_VIDEO_COLOR \
        !           112:                | TRACE_VIDEO_BORDER_V | TRACE_VIDEO_BORDER_H | TRACE_VIDEO_ADDR \
        !           113:                | TRACE_VIDEO_VBL | TRACE_VIDEO_HBL | TRACE_VIDEO_STE )
1.1.1.2   root      114: 
1.1.1.4 ! root      115: #define TRACE_MFP_ALL          ( TRACE_MFP_EXCEPTION | TRACE_MFP_START | TRACE_MFP_READ | TRACE_MFP_WRITE )
1.1.1.2   root      116: 
1.1.1.4 ! root      117: #define        TRACE_PSG_ALL           ( TRACE_PSG_READ | TRACE_PSG_WRITE )
1.1.1.2   root      118: 
1.1.1.4 ! root      119: #define        TRACE_CPU_ALL           ( TRACE_CPU_PAIRING | TRACE_CPU_DISASM | TRACE_CPU_EXCEPTION )
1.1.1.2   root      120: 
1.1.1.4 ! root      121: #define        TRACE_IKBD_ALL          ( TRACE_IKBD_CMDS | TRACE_IKBD_ACIA | TRACE_IKBD_EXEC | TRACE_OS_VDI )
        !           122: 
        !           123: #define        TRACE_OS_ALL            ( TRACE_OS_BIOS | TRACE_OS_XBIOS | TRACE_OS_GEMDOS | TRACE_OS_VDI )
        !           124: 
        !           125: #define        TRACE_IOMEM_ALL         ( TRACE_IOMEM_RD | TRACE_IOMEM_WR )
1.1.1.2   root      126: 
                    127: 
                    128: extern FILE *TraceFile;
1.1.1.4 ! root      129: extern Uint32 LogTraceFlags;
1.1.1.2   root      130: 
1.1.1.4 ! root      131: #if ENABLE_TRACING
1.1.1.2   root      132: 
1.1.1.4 ! root      133: #ifndef _VCWIN_
        !           134: #define        LOG_TRACE(level, args...) \
        !           135:        if (LogTraceFlags & level) fprintf(TraceFile, args)
        !           136: #endif
        !           137: #define LOG_TRACE_LEVEL( level )       (LogTraceFlags & level)
1.1.1.2   root      138: 
1.1.1.4 ! root      139: #else          /* ENABLE_TRACING */
1.1.1.2   root      140: 
1.1.1.4 ! root      141: #ifndef _VCWIN_
        !           142: #define LOG_TRACE(level, args...)      {}
        !           143: #endif
        !           144: #define LOG_TRACE_LEVEL( level )       (0)
1.1.1.2   root      145: 
1.1.1.4 ! root      146: #endif         /* ENABLE_TRACING */
1.1.1.2   root      147: 
                    148: /* Always defined in full to avoid compiler warnings about unused variables.
                    149:  * In code it's used in such a way that it will be optimized away when tracing
                    150:  * is disabled.
                    151:  */
1.1.1.4 ! root      152: #ifndef _VCWIN_
        !           153: #define LOG_TRACE_PRINT(args...)       fprintf(TraceFile , args)
        !           154: #endif
        !           155: 
1.1       root      156: 
1.1.1.2   root      157: #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.