--- /dev/null
+/*
+** Insired by code from Martin Pool.
+*/
+
+#ifndef COMMON_UNUSED_H
+#define COMMON_UNUSED_H
+
+#ifdef UNUSED
+#elif defined (__GNUC__)
+# define UNUSED(x) UNUSED_ ## x __attribute__ ((unused))
+#elif defined (__LCLINT__)
+# define UNUSED(x) /*@unused@*/ x
+#else
+# define UNUSED(x) x
+#endif
+
+#ifdef __GNUC__
+# define WARN_UNUSED __attribute__ ((warn_unused_result))
+#else
+# define WARN_UNUSED
+#endif
+
+#endif
*/
void os_display_char (zchar c)
{
- if (c >= ZC_LATIN1_MIN && c <= ZC_LATIN1_MAX) {
+ if (c >= ZC_LATIN1_MIN) {
if (u_setup.plain_ascii) {
char *ptr = latin1_to_ascii + 3 * (c - ZC_LATIN1_MIN);
*/
int os_char_width (zchar c)
{
- if (c >= ZC_LATIN1_MIN && c <= ZC_LATIN1_MAX && u_setup.plain_ascii) {
+ if (c >= ZC_LATIN1_MIN && u_setup.plain_ascii) {
int width = 0;
const char *ptr = latin1_to_ascii + 3 * (c - ZC_LATIN1_MIN);
*/
#include "dumb_frotz.h"
+#include "../common/unused.h"
f_setup_t f_setup;
else return user_random_seed;
}
-void os_restart_game (int stage) {}
+void os_restart_game (int UNUSED (stage)) {}
void os_fatal (const char *s, ...)
{
*/
#include "dumb_frotz.h"
+#include "../common/unused.h"
+
f_setup_t f_setup;
static char runtime_usage[] =
if (type != INPUT_LINE_CONTINUED)
fprintf(stderr, "DUMB-FROTZ: No input to discard\n");
else {
- dumb_discard_old_input(strlen(continued_line_chars));
+ dumb_discard_old_input(strlen((char*) continued_line_chars));
continued_line_chars[0] = '\0';
type = INPUT_LINE;
}
for (i = 0; (i < h_screen_rows - 2) && *next_page; i++)
next_page = strchr(next_page, '\n') + 1;
/* next_page - current_page is width */
- printf("%.*s", next_page - current_page, current_page);
+ printf("%.*s", (int) (next_page - current_page), current_page);
current_page = next_page;
if (!*current_page)
break;
return c;
}
-zchar os_read_line (int max, zchar *buf, int timeout, int width, int continued)
+zchar os_read_line (int UNUSED (max), zchar *buf, int timeout, int UNUSED(width), int continued)
{
char *p;
int terminator;
dumb_display_user_input(read_line_buffer);
/* copy to the buffer and save the rest for next time. */
- strcat(buf, read_line_buffer);
+ strcat((char*) buf, read_line_buffer);
p = read_line_buffer + strlen(read_line_buffer) + 1;
memmove(read_line_buffer, p, strlen(p) + 1);
*/
#include "dumb_frotz.h"
+#include "../common/unused.h"
f_setup_t f_setup;
int os_char_width (zchar z)
{
- if (plain_ascii && z >= ZC_LATIN1_MIN && z <= ZC_LATIN1_MAX) {
+ if (plain_ascii && z >= ZC_LATIN1_MIN) {
char *p = latin1_to_ascii + 4 * (z - ZC_LATIN1_MIN);
return strchr(p, ' ') - p;
}
void os_display_char (zchar c)
{
- if (c >= ZC_LATIN1_MIN && c <= ZC_LATIN1_MAX) {
+ if (c >= ZC_LATIN1_MIN) {
if (plain_ascii) {
char *ptr = latin1_to_ascii + 4 * (c - ZC_LATIN1_MIN);
do
}
}
-void os_erase_area (int top, int left, int bottom, int right, int win)
+void os_erase_area (int top, int left, int bottom, int right, int UNUSED (win))
{
int row, col;
top--; left--; bottom--; right--;
return 0;
}
-void os_set_colour (int x, int y) {}
-void os_set_font (int x) {}
+void os_set_colour (int UNUSED (x), int UNUSED (y)) {}
+void os_set_font (int UNUSED (x)) {}
/* Print a cell to stdout. */
static void show_cell(cell cel)
/* To make the common code happy */
void os_init_sound(void) {}
-void os_prepare_sample (int a) {}
-void os_finish_with_sample (int a) {}
-void os_start_sample (int a, int b, int c, zword d) {}
-void os_stop_sample (int a) {}
+void os_prepare_sample (int UNUSED (a)) {}
+void os_finish_with_sample (int UNUSED (a)) {}
+void os_start_sample (int UNUSED (a), int UNUSED (b), int UNUSED (c), zword UNUSED (d)) {}
+void os_stop_sample (int UNUSED (a)) {}
/* if val is '0' or '1', set *var accordingly, else toggle it. */