DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
include/dosbox.h
00001 /*
00002  *  Copyright (C) 2002-2015  The DOSBox Team
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00019 
00020 #ifndef DOSBOX_DOSBOX_H
00021 #define DOSBOX_DOSBOX_H
00022 
00023 #include "config.h"
00024 #include "logging.h"
00025 
00026 #if defined(_MSC_VER)
00027 # include <sys/types.h>
00028 # include <sys/stat.h>
00029 
00030 /* Microsoft has their own stat/stat64 scheme */
00031 # define pref_stat                      _stati64
00032 # define pref_struct_stat       struct _stat64
00033 #else
00034 /* As long as FILE_OFFSET_BITS==64 Linux is quite good at allowing stat to work with 64-bit sizes */
00035 # define pref_stat                      stat
00036 # define pref_struct_stat       struct stat
00037 #endif
00038 
00039 // TODO: The autoconf script should test the size of long double
00040 #if defined(_MSC_VER)
00041 // Microsoft C++ sizeof(long double) == sizeof(double)
00042 #else
00043 // GCC, other compilers, have sizeof(long double) == 10 80-bit IEEE
00044 # define HAS_LONG_DOUBLE                1
00045 #endif
00046 
00047 GCC_ATTRIBUTE(noreturn) void            E_Exit(const char * message,...) GCC_ATTRIBUTE( __format__(__printf__, 1, 2));
00048 
00049 typedef Bits cpu_cycles_count_t;
00050 typedef Bitu cpu_cycles_countu_t;
00051 
00052 #include "clockdomain.h"
00053 
00054 class Config;
00055 class Section;
00056 
00057 enum MachineType {
00058         MCH_HERC,
00059         MCH_CGA,
00060         MCH_TANDY,
00061         MCH_PCJR,
00062         MCH_EGA,
00063         MCH_VGA,
00064         MCH_AMSTRAD,
00065         MCH_PC98,
00066 
00067     MCH_FM_TOWNS                    // STUB!!
00068 };
00069 
00070 enum SVGACards {
00071         SVGA_None,
00072         SVGA_S3Trio,
00073         SVGA_TsengET4K,
00074         SVGA_TsengET3K,
00075         SVGA_ParadisePVGA1A
00076 };
00077 
00078 typedef Bitu                            (LoopHandler)(void);
00079 
00080 extern Config*                          control;
00081 extern SVGACards                        svgaCard;
00082 extern MachineType                      machine;
00083 extern bool                             SDLNetInited;
00084 extern bool                             mono_cga;
00085 extern bool                             mainline_compatible_mapping;
00086 extern bool                             mainline_compatible_bios_mapping;
00087 
00088 #ifdef __SSE__
00089 extern bool                             sse1_available;
00090 extern bool                             sse2_available;
00091 #endif
00092 
00093 void                                    MSG_Add(const char*,const char*); //add messages to the internal languagefile
00094 const char*                             MSG_Get(char const *);     //get messages from the internal languagefile
00095 
00096 void                                    DOSBOX_RunMachine();
00097 void                                    DOSBOX_SetLoop(LoopHandler * handler);
00098 void                                    DOSBOX_SetNormalLoop();
00099 void                                    DOSBOX_Init(void);
00100 
00101 /* machine tests for use with if() statements */
00102 #define IS_TANDY_ARCH                   ((machine==MCH_TANDY) || (machine==MCH_PCJR))
00103 #define IS_EGAVGA_ARCH                  ((machine==MCH_EGA) || (machine==MCH_VGA))
00104 #define IS_EGA_ARCH             (machine==MCH_EGA)
00105 #define IS_VGA_ARCH             (machine==MCH_VGA)
00106 #define IS_PC98_ARCH            (machine==MCH_PC98)
00107 
00108 #define IS_FM_TOWNS             (machine==MCH_FM_TOWNS)
00109 
00110 /* machine tests for use with switch() statements */
00111 #define TANDY_ARCH_CASE                 MCH_TANDY: case MCH_PCJR
00112 #define EGAVGA_ARCH_CASE                MCH_EGA: case MCH_VGA
00113 #define VGA_ARCH_CASE                   MCH_VGA
00114 #define PC98_ARCH_CASE                  MCH_PC98
00115 
00116 #define FM_TOWNS_ARCH_CASE      MCH_FM_TOWNS
00117 
00118 #ifndef DOSBOX_LOGGING_H
00119 #include "logging.h"
00120 #endif // the logging system.
00121 
00122 extern ClockDomain                      clockdom_PCI_BCLK;
00123 extern ClockDomain                      clockdom_ISA_OSC;
00124 extern ClockDomain                      clockdom_ISA_BCLK;
00125 extern ClockDomain                      clockdom_8254_PIT;
00126 extern ClockDomain                      clockdom_8250_UART;
00127 
00128 signed long long time_to_clockdom(ClockDomain &src,double t);
00129 unsigned long long update_clockdom_from_now(ClockDomain &dst);
00130 unsigned long long update_ISA_OSC_clock();
00131 unsigned long long update_8254_PIT_clock();
00132 unsigned long long update_ISA_BCLK_clock();
00133 unsigned long long update_PCI_BCLK_clock();
00134 
00135 extern bool enable_pc98_jump;
00136 
00137 enum {
00138         UTF8ERR_INVALID=-1,
00139         UTF8ERR_NO_ROOM=-2
00140 };
00141 
00142 #ifndef UNICODE_BOM
00143 #define UNICODE_BOM 0xFEFF
00144 #endif
00145 
00146 int utf8_encode(char **ptr,char *fence,uint32_t code);
00147 int utf8_decode(const char **ptr,const char *fence);
00148 int utf16le_encode(char **ptr,char *fence,uint32_t code);
00149 int utf16le_decode(const char **ptr,const char *fence);
00150 
00151 typedef char utf8_t;
00152 typedef uint16_t utf16_t;
00153 
00154 /* for DOS filename handling we want a toupper that uses the MS-DOS code page within not the locale of the host */
00155 int ascii_toupper(int c);
00156 
00157 #endif /* DOSBOX_DOSBOX_H */