Simplify putchar_x() definition

Introduce an inline helper xlate_char() to isolate the character translation code.

This halves the permutations of putchar_x() required.
This commit is contained in:
Kevin Easton
2017-11-28 14:40:19 +11:00
parent 863263aa07
commit b458082800

View File

@@ -62,32 +62,25 @@ void avio_refresh_screen(void);
#ifdef TRANSLATE #ifdef TRANSLATE
#include "translat.h" #include "translat.h"
static inline int xlate_char(int c)
{
return translation ? transToClient[c] : c;
}
#else
static inline int xlate_char(int c)
{
return c;
}
#endif
static inline int putchar_x (int c) static inline int putchar_x (int c)
{ {
#ifdef GUI #ifdef GUI
#if 1 return gui_putc(xlate_char(c));
return gui_putc((int) (translation ? transToClient[c] : c));
#else #else
return gui_putc((int) c); return fputc(xlate_char(c), current_ftarget);
#endif
#else
#if 1
return fputc((int) (translation ? transToClient[c] : c), current_ftarget);
#else
return fputc((int) c, current_ftarget);
#endif
#endif #endif
} }
#else
static inline int putchar_x (int c)
{
#ifdef GUI
return gui_putc((int) c);
#else
return fputc((unsigned int) c, current_ftarget);
#endif
}
#endif
static inline void term_flush (void) static inline void term_flush (void)
{ {