X-Git-Url: https://git.stderr.nl/gitweb?p=projects%2Fchimara%2Fchimara.git;a=blobdiff_plain;f=interpreters%2Fbocfel%2Funicode.h;fp=interpreters%2Fbocfel%2Funicode.h;h=b421fefcd6cad8e1d46b0cbc96804602d4436350;hp=0000000000000000000000000000000000000000;hb=aa30979369091c96bca34499c28cb01bc16efb1d;hpb=61180dab8f5c29f5a29b83fcb7d62942f7a741d1 diff --git a/interpreters/bocfel/unicode.h b/interpreters/bocfel/unicode.h new file mode 100644 index 0000000..b421fef --- /dev/null +++ b/interpreters/bocfel/unicode.h @@ -0,0 +1,44 @@ +#ifndef ZTERP_TABLES_H +#define ZTERP_TABLES_H + +#include + +#ifdef ZTERP_GLK +#include +#endif + +#define UNICODE_LINEFEED 10 +#define UNICODE_SPACE 32 +#define UNICODE_QUESTIONMARK 63 + +#define ZSCII_NEWLINE 13 +#define ZSCII_SPACE 32 +#define ZSCII_QUESTIONMARK 63 + +/* This variable controls whether Unicode is used for screen + * output. This affects @check_unicode as well as the ZSCII to + * Unicode table. With Glk it is set based on whether the Glk + * implementation supports Unicode (checked with the Unicode + * gestalt), and determines whether Unicode IO functions should + * be used; otherwise, it is kept in parallel with use_utf8_io. + */ +extern int have_unicode; + +extern uint16_t zscii_to_unicode[]; +extern uint8_t unicode_to_zscii[]; +extern uint8_t unicode_to_zscii_q[]; +extern uint8_t unicode_to_latin1[]; +extern uint16_t zscii_to_font3[]; +extern int atable_pos[]; + +void parse_unicode_table(uint16_t); +void setup_tables(void); + +uint16_t unicode_tolower(uint16_t); + +/* Standard 1.1 notes that Unicode characters 0–31 and 127–159 + * are invalid due to the fact that they’re control codes. + */ +static inline int valid_unicode(uint16_t c) { return (c >= 32 && c <= 126) || c >= 160; } + +#endif