Xemu [doxygen]  hyppo 0a42be3a057156924bc1b626a687bd6e27349c45 @ Sat 19 Mar 02:15:11 CET 2022
xep128.h
Go to the documentation of this file.
1 /* Xep128: Minimalistic Enterprise-128 emulator with focus on "exotic" hardware
2  Copyright (C)2015-2020 LGB (Gábor Lénárt) <lgblgblgb@gmail.com>
3  http://xep128.lgb.hu/
4 
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
18 
19 #ifndef XEMU_EP128_XEP128_H_INCLUDED
20 #define XEMU_EP128_XEP128_H_INCLUDED
21 
23 
24 #define VARALIGN MAXALIGNED
25 #define XEPEXIT(n) XEMUEXIT(n)
26 
27 #define DIRSEP DIRSEP_STR
28 
29 
30 /* Ugly hack: now override DATADIR to the old Xep128 defaults for legacy Xep128 users.
31  This must be changed some time though ... */
32 #ifdef DATADIR
33 #undef DATADIR
34 #endif
35 #ifndef _WIN32
36 #define DATADIR "/usr/local/lib/xep128"
37 #endif
38 
39 /* the old: */
40 
41 #include <stdio.h>
42 #include <SDL_types.h>
43 #include <SDL_messagebox.h>
44 #include <limits.h>
45 #include <errno.h>
46 #include <string.h>
47 #include <stdlib.h>
48 
49 #define DESCRIPTION "Enterprise-128 Emulator"
50 #define WINDOW_TITLE "Xep128"
51 #define VERSION "0.4"
52 #define COPYRIGHT "(C)2015,2016,2020 LGB Gabor Lenart"
53 #define PROJECT_PAGE "http://xep128.lgb.hu/"
54 
55 #define CONFIG_USE_LODEPNG
56 #define CONFIG_EXDOS_SUPPORT
57 #ifdef XEMU_HAS_SOCKET_API
58 # define CONFIG_EPNET_SUPPORT
59 # define EPNET_IO_BASE 0x90
60 #endif
61 #define DEFAULT_CPU_CLOCK 4000000
62 
63 #define COMBINED_ROM_FN "combined.rom"
64 #define SDCARD_IMG_FN "sdcard.img"
65 #define PRINT_OUT_FN "@print.out"
66 #define DEFAULT_CONFIG_FILE "@config"
67 #define DEFAULT_CONFIG_SAMPLE_FILE "@config-sample"
68 
69 //#define ERRSTR() sys_errlist[errno]
70 #define ERRSTR() strerror(errno)
71 
72 
73 extern FILE *debug_fp;
74 #if 0
75 #ifdef DISABLE_DEBUG
76 #define DEBUG(...)
77 #define DEBUGPRINT(...) printf(__VA_ARGS__)
78 #else
79 #define DEBUG(...) do { \
80  if (debug_fp) \
81  fprintf(debug_fp, __VA_ARGS__); \
82 } while(0)
83 #define DEBUGPRINT(...) do { \
84  printf(__VA_ARGS__); \
85  DEBUG(__VA_ARGS__); \
86 } while(0)
87 #endif
88 #endif
89 
90 static inline int CHECK_SNPRINTF( int ret, int limit )
91 {
92  if (ret < 0 || ret >= limit - 1) {
93  fprintf(stderr, "SNPRINTF-ERROR: too long string or other error (ret=%d) ..." NL, ret);
94  return -1;
95  }
96  return 0;
97 }
98 
99 extern void osd_notification ( const char *s );
100 #define OSD(...) do { \
101  char _buf_for_win_msg_[4096]; \
102  CHECK_SNPRINTF(snprintf(_buf_for_win_msg_, sizeof _buf_for_win_msg_, __VA_ARGS__), sizeof _buf_for_win_msg_); \
103  DEBUGPRINT("OSD: %s" NL, _buf_for_win_msg_); \
104  osd_notification(_buf_for_win_msg_); \
105 } while(0)
106 
107 extern int _sdl_emu_secured_message_box_ ( Uint32 sdlflag, const char *msg );
108 #define _REPORT_WINDOW_(sdlflag, str, ...) do { \
109  char _buf_for_win_msg_[4096]; \
110  CHECK_SNPRINTF(snprintf(_buf_for_win_msg_, sizeof _buf_for_win_msg_, __VA_ARGS__), sizeof _buf_for_win_msg_); \
111  DEBUGPRINT(str ": %s" NL, _buf_for_win_msg_); \
112  _sdl_emu_secured_message_box_(sdlflag, _buf_for_win_msg_); \
113 } while(0)
114 #define INFO_WINDOW(...) _REPORT_WINDOW_(SDL_MESSAGEBOX_INFORMATION, "INFO", __VA_ARGS__)
115 #define WARNING_WINDOW(...) _REPORT_WINDOW_(SDL_MESSAGEBOX_WARNING, "WARNING", __VA_ARGS__)
116 #define ERROR_WINDOW(...) _REPORT_WINDOW_(SDL_MESSAGEBOX_ERROR, "ERROR", __VA_ARGS__)
117 #define FATAL(...) do { ERROR_WINDOW(__VA_ARGS__); XEPEXIT(1); } while(0)
118 
119 #define CHECK_MALLOC(p) do { \
120  if (!p) FATAL("Memory allocation error. Not enough memory?"); \
121 } while(0)
122 
123 extern int _sdl_emu_secured_modal_box_ ( const char *items_in, const char *msg );
124 #define QUESTION_WINDOW(items, msg) _sdl_emu_secured_modal_box_(items, msg)
125 
126 //#define ERRSTR() sys_errlist[errno]
127 #define ERRSTR() strerror(errno)
128 
129 #endif
osd_notification
void osd_notification(const char *s)
Definition: screen.c:136
_sdl_emu_secured_message_box_
int _sdl_emu_secured_message_box_(Uint32 sdlflag, const char *msg)
Definition: screen.c:448
Uint32
uint32_t Uint32
Definition: fat32.c:49
_sdl_emu_secured_modal_box_
int _sdl_emu_secured_modal_box_(const char *items_in, const char *msg)
Definition: screen.c:469
emutools_basicdefs.h
debug_fp
FILE * debug_fp
Definition: configuration.c:87
NL
#define NL
Definition: fat32.c:37