From 2da183ac47f1157560dcd2c417f7f6a24ae72352 Mon Sep 17 00:00:00 2001 From: "P. F. Chimento" Date: Thu, 14 Apr 2011 23:30:40 +0200 Subject: [PATCH] Update to new Glk 0.7.2 code Andrew Plotkin released new versions of glk.h, gi_dispa.c, and gi_dispa.h. --- libchimara/gi_dispa.c | 325 +++++++++++++++++++++++++++++++++++++++++- libchimara/gi_dispa.h | 4 +- libchimara/glk.h | 151 ++++++++++++++------ 3 files changed, 431 insertions(+), 49 deletions(-) diff --git a/libchimara/gi_dispa.c b/libchimara/gi_dispa.c index b3ac0bc..4c4b553 100644 --- a/libchimara/gi_dispa.c +++ b/libchimara/gi_dispa.c @@ -1,8 +1,8 @@ -/* gi_dispa.c: Dispatch layer for Glk API, version 0.7.0. +/* gi_dispa.c: Dispatch layer for Glk API, version 0.7.2. Designed by Andrew Plotkin - http://www.eblong.com/zarf/glk/index.html + http://eblong.com/zarf/glk/ - This file is copyright 1998-2004 by Andrew Plotkin. You may copy, + This file is copyright 1998-2011 by Andrew Plotkin. You may copy, distribute, and incorporate it into your own programs, by any means and under any conditions, as long as you do not modify it. You may also modify this file, incorporate it into your own programs, @@ -49,10 +49,12 @@ static gidispatch_intconst_t intconstant_table[] = { { "evtype_Redraw", (6) }, { "evtype_SoundNotify", (7) }, { "evtype_Timer", (1) }, + { "filemode_Read", (0x02) }, { "filemode_ReadWrite", (0x03) }, { "filemode_Write", (0x01) }, { "filemode_WriteAppend", (0x05) }, + { "fileusage_BinaryMode", (0x000) }, { "fileusage_Data", (0x00) }, { "fileusage_InputRecord", (0x03) }, @@ -60,17 +62,22 @@ static gidispatch_intconst_t intconstant_table[] = { { "fileusage_TextMode", (0x100) }, { "fileusage_Transcript", (0x02) }, { "fileusage_TypeMask", (0x0f) }, + { "gestalt_CharInput", (1) }, { "gestalt_CharOutput", (3) }, { "gestalt_CharOutput_ApproxPrint", (1) }, { "gestalt_CharOutput_CannotPrint", (0) }, { "gestalt_CharOutput_ExactPrint", (2) }, + { "gestalt_DateTime", (20) }, { "gestalt_DrawImage", (7) }, { "gestalt_Graphics", (6) }, { "gestalt_GraphicsTransparency", (14) }, { "gestalt_HyperlinkInput", (12) }, { "gestalt_Hyperlinks", (11) }, { "gestalt_LineInput", (2) }, + { "gestalt_LineInputEcho", (17) }, + { "gestalt_LineTerminatorKey", (19) }, + { "gestalt_LineTerminators", (18) }, { "gestalt_MouseInput", (4) }, { "gestalt_Sound", (8) }, { "gestalt_SoundMusic", (13) }, @@ -78,14 +85,15 @@ static gidispatch_intconst_t intconstant_table[] = { { "gestalt_SoundVolume", (9) }, { "gestalt_Timer", (5) }, { "gestalt_Unicode", (15) }, + { "gestalt_UnicodeNorm", (16) }, { "gestalt_Version", (0) }, -#ifdef GLK_MODULE_IMAGE + { "imagealign_InlineCenter", (0x03) }, { "imagealign_InlineDown", (0x02) }, { "imagealign_MarginLeft", (0x04) }, { "imagealign_MarginRight", (0x05) }, { "imagealign_InlineUp", (0x01) }, -#endif /* GLK_MODULE_IMAGE */ + { "keycode_Delete", (0xfffffff9) }, { "keycode_Down", (0xfffffffb) }, { "keycode_End", (0xfffffff3) }, @@ -112,9 +120,11 @@ static gidispatch_intconst_t intconstant_table[] = { { "keycode_Tab", (0xfffffff7) }, { "keycode_Unknown", (0xffffffff) }, { "keycode_Up", (0xfffffffc) }, + { "seekmode_Current", (1) }, { "seekmode_End", (2) }, { "seekmode_Start", (0) }, + { "style_Alert", (5) }, { "style_BlockQuote", (7) }, { "style_Emphasized", (1) }, @@ -142,14 +152,19 @@ static gidispatch_intconst_t intconstant_table[] = { { "stylehint_just_LeftFlush", (0) }, { "stylehint_just_LeftRight", (1) }, { "stylehint_just_RightFlush", (3) }, + { "winmethod_Above", (0x02) }, { "winmethod_Below", (0x03) }, + { "winmethod_Border", (0x000) }, + { "winmethod_BorderMask", (0x100) }, { "winmethod_DirMask", (0x0f) }, { "winmethod_DivisionMask", (0xf0) }, { "winmethod_Fixed", (0x10) }, { "winmethod_Left", (0x00) }, + { "winmethod_NoBorder", (0x100) }, { "winmethod_Proportional", (0x20) }, { "winmethod_Right", (0x01) }, + { "wintype_AllTypes", (0) }, { "wintype_Blank", (2) }, { "wintype_Graphics", (5) }, @@ -270,6 +285,28 @@ static gidispatch_function_t function_table[] = { { 0x0140, glk_request_char_event_uni, "request_char_event_uni" }, { 0x0141, glk_request_line_event_uni, "request_line_event_uni" }, #endif /* GLK_MODULE_UNICODE */ +#ifdef GLK_MODULE_UNICODE_NORM + { 0x0123, glk_buffer_canon_decompose_uni, "buffer_canon_decompose_uni" }, + { 0x0124, glk_buffer_canon_normalize_uni, "buffer_canon_normalize_uni" }, +#endif /* GLK_MODULE_UNICODE_NORM */ +#ifdef GLK_MODULE_LINE_ECHO + { 0x0150, glk_set_echo_line_event, "set_echo_line_event" }, +#endif /* GLK_MODULE_LINE_ECHO */ +#ifdef GLK_MODULE_LINE_TERMINATORS + { 0x0151, glk_set_terminators_line_event, "set_terminators_line_event" }, +#endif /* GLK_MODULE_LINE_TERMINATORS */ +#ifdef GLK_MODULE_DATETIME + { 0x0160, glk_current_time, "current_time" }, + { 0x0161, glk_current_simple_time, "current_simple_time" }, + { 0x0168, glk_time_to_date_utc, "time_to_date_utc" }, + { 0x0169, glk_time_to_date_local, "time_to_date_local" }, + { 0x016A, glk_simple_time_to_date_utc, "simple_time_to_date_utc" }, + { 0x016B, glk_simple_time_to_date_local, "simple_time_to_date_local" }, + { 0x016C, glk_date_to_time_utc, "date_to_time_utc" }, + { 0x016D, glk_date_to_time_local, "date_to_time_local" }, + { 0x016E, glk_date_to_simple_time_utc, "date_to_simple_time_utc" }, + { 0x016F, glk_date_to_simple_time_local, "date_to_simple_time_local" }, +#endif /* GLK_MODULE_DATETIME */ }; glui32 gidispatch_count_classes() @@ -555,6 +592,46 @@ char *gidispatch_prototype(glui32 funcnum) return "3Qa&+#!IuIu:"; #endif /* GLK_MODULE_UNICODE */ +#ifdef GLK_MODULE_UNICODE_NORM + case 0x0123: /* buffer_canon_decompose_uni */ + return "3&+#IuIu:Iu"; + case 0x0124: /* buffer_canon_normalize_uni */ + return "3&+#IuIu:Iu"; +#endif /* GLK_MODULE_UNICODE_NORM */ + +#ifdef GLK_MODULE_LINE_ECHO + case 0x0150: /* set_echo_line_event */ + return "2QaIu:"; +#endif /* GLK_MODULE_LINE_ECHO */ + +#ifdef GLK_MODULE_LINE_TERMINATORS + case 0x0151: /* set_terminators_line_event */ + return "2Qa>#Iu:"; +#endif /* GLK_MODULE_LINE_TERMINATORS */ + +#ifdef GLK_MODULE_DATETIME + case 0x0160: /* current_time */ + return "1<+[3IsIuIs]:"; + case 0x0161: /* current_simple_time */ + return "2Iu:Is"; + case 0x0168: /* time_to_date_utc */ + return "2>+[3IsIuIs]<+[8IsIsIsIsIsIsIsIs]:"; + case 0x0169: /* time_to_date_local */ + return "2>+[3IsIuIs]<+[8IsIsIsIsIsIsIsIs]:"; + case 0x016A: /* simple_time_to_date_utc */ + return "3IsIu<+[8IsIsIsIsIsIsIsIs]:"; + case 0x016B: /* simple_time_to_date_local */ + return "3IsIu<+[8IsIsIsIsIsIsIsIs]:"; + case 0x016C: /* date_to_time_utc */ + return "2>+[8IsIsIsIsIsIsIsIs]<+[3IsIuIs]:"; + case 0x016D: /* date_to_time_local */ + return "2>+[8IsIsIsIsIsIsIsIs]<+[3IsIuIs]:"; + case 0x016E: /* date_to_simple_time_utc */ + return "3>+[8IsIsIsIsIsIsIsIs]Iu:Is"; + case 0x016F: /* date_to_simple_time_local */ + return "3>+[8IsIsIsIsIsIsIsIs]Iu:Is"; +#endif /* GLK_MODULE_DATETIME */ + default: return NULL; } @@ -1109,7 +1186,245 @@ void gidispatch_call(glui32 funcnum, glui32 numargs, gluniversal_t *arglist) 0, arglist[2].uint); break; #endif /* GLK_MODULE_UNICODE */ + +#ifdef GLK_MODULE_UNICODE_NORM + case 0x0123: /* buffer_canon_decompose_uni */ + if (arglist[0].ptrflag) + arglist[5].uint = glk_buffer_canon_decompose_uni(arglist[1].array, arglist[2].uint, arglist[3].uint); + else + arglist[3].uint = glk_buffer_canon_decompose_uni(NULL, 0, arglist[1].uint); + break; + case 0x0124: /* buffer_canon_normalize_uni */ + if (arglist[0].ptrflag) + arglist[5].uint = glk_buffer_canon_normalize_uni(arglist[1].array, arglist[2].uint, arglist[3].uint); + else + arglist[3].uint = glk_buffer_canon_normalize_uni(NULL, 0, arglist[1].uint); + break; +#endif /* GLK_MODULE_UNICODE_NORM */ + +#ifdef GLK_MODULE_LINE_ECHO + case 0x0150: /* set_echo_line_event */ + glk_set_echo_line_event(arglist[0].opaqueref, arglist[1].uint); + break; +#endif /* GLK_MODULE_LINE_ECHO */ + +#ifdef GLK_MODULE_LINE_TERMINATORS + case 0x0151: /* set_terminators_line_event */ + if (arglist[1].ptrflag) + glk_set_terminators_line_event(arglist[0].opaqueref, + arglist[2].array, arglist[3].uint); + else + glk_set_terminators_line_event(arglist[0].opaqueref, + NULL, 0); + break; +#endif /* GLK_MODULE_LINE_TERMINATORS */ +#ifdef GLK_MODULE_DATETIME + case 0x0160: /* current_time */ + if (arglist[0].ptrflag) { + glktimeval_t dat; + glk_current_time(&dat); + arglist[1].sint = dat.high_sec; + arglist[2].uint = dat.low_sec; + arglist[3].sint = dat.microsec; + } + else { + glk_current_time(NULL); + } + break; + case 0x0161: /* current_simple_time */ + arglist[2].sint = glk_current_simple_time(arglist[0].uint); + break; + case 0x0168: /* time_to_date_utc */ { + glktimeval_t timeval; + glktimeval_t *timeptr = NULL; + glkdate_t date; + glkdate_t *dateptr = NULL; + int ix = 0; + if (arglist[ix++].ptrflag) { + timeptr = &timeval; + timeval.high_sec = arglist[ix++].sint; + timeval.low_sec = arglist[ix++].uint; + timeval.microsec = arglist[ix++].sint; + } + if (arglist[ix++].ptrflag) { + dateptr = &date; + } + glk_time_to_date_utc(timeptr, dateptr); + if (dateptr) { + arglist[ix++].sint = date.year; + arglist[ix++].sint = date.month; + arglist[ix++].sint = date.day; + arglist[ix++].sint = date.weekday; + arglist[ix++].sint = date.hour; + arglist[ix++].sint = date.minute; + arglist[ix++].sint = date.second; + arglist[ix++].sint = date.microsec; + } + } + break; + case 0x0169: /* time_to_date_local */ { + glktimeval_t timeval; + glktimeval_t *timeptr = NULL; + glkdate_t date; + glkdate_t *dateptr = NULL; + int ix = 0; + if (arglist[ix++].ptrflag) { + timeptr = &timeval; + timeval.high_sec = arglist[ix++].sint; + timeval.low_sec = arglist[ix++].uint; + timeval.microsec = arglist[ix++].sint; + } + if (arglist[ix++].ptrflag) { + dateptr = &date; + } + glk_time_to_date_local(timeptr, dateptr); + if (dateptr) { + arglist[ix++].sint = date.year; + arglist[ix++].sint = date.month; + arglist[ix++].sint = date.day; + arglist[ix++].sint = date.weekday; + arglist[ix++].sint = date.hour; + arglist[ix++].sint = date.minute; + arglist[ix++].sint = date.second; + arglist[ix++].sint = date.microsec; + } + } + break; + case 0x016A: /* simple_time_to_date_utc */ { + glkdate_t date; + glkdate_t *dateptr = NULL; + int ix = 2; + if (arglist[ix++].ptrflag) { + dateptr = &date; + } + glk_simple_time_to_date_utc(arglist[0].sint, arglist[1].uint, dateptr); + if (dateptr) { + arglist[ix++].sint = date.year; + arglist[ix++].sint = date.month; + arglist[ix++].sint = date.day; + arglist[ix++].sint = date.weekday; + arglist[ix++].sint = date.hour; + arglist[ix++].sint = date.minute; + arglist[ix++].sint = date.second; + arglist[ix++].sint = date.microsec; + } + } + break; + case 0x016B: /* simple_time_to_date_local */ { + glkdate_t date; + glkdate_t *dateptr = NULL; + int ix = 2; + if (arglist[ix++].ptrflag) { + dateptr = &date; + } + glk_simple_time_to_date_local(arglist[0].sint, arglist[1].uint, dateptr); + if (dateptr) { + arglist[ix++].sint = date.year; + arglist[ix++].sint = date.month; + arglist[ix++].sint = date.day; + arglist[ix++].sint = date.weekday; + arglist[ix++].sint = date.hour; + arglist[ix++].sint = date.minute; + arglist[ix++].sint = date.second; + arglist[ix++].sint = date.microsec; + } + } + break; + case 0x016C: /* date_to_time_utc */ { + glkdate_t date; + glkdate_t *dateptr = NULL; + glktimeval_t timeval; + glktimeval_t *timeptr = NULL; + int ix = 0; + if (arglist[ix++].ptrflag) { + dateptr = &date; + date.year = arglist[ix++].sint; + date.month = arglist[ix++].sint; + date.day = arglist[ix++].sint; + date.weekday = arglist[ix++].sint; + date.hour = arglist[ix++].sint; + date.minute = arglist[ix++].sint; + date.second = arglist[ix++].sint; + date.microsec = arglist[ix++].sint; + } + if (arglist[ix++].ptrflag) { + timeptr = &timeval; + } + glk_date_to_time_utc(dateptr, timeptr); + if (timeptr) { + arglist[ix++].sint = timeval.high_sec; + arglist[ix++].uint = timeval.low_sec; + arglist[ix++].sint = timeval.microsec; + } + } + break; + case 0x016D: /* date_to_time_local */ { + glkdate_t date; + glkdate_t *dateptr = NULL; + glktimeval_t timeval; + glktimeval_t *timeptr = NULL; + int ix = 0; + if (arglist[ix++].ptrflag) { + dateptr = &date; + date.year = arglist[ix++].sint; + date.month = arglist[ix++].sint; + date.day = arglist[ix++].sint; + date.weekday = arglist[ix++].sint; + date.hour = arglist[ix++].sint; + date.minute = arglist[ix++].sint; + date.second = arglist[ix++].sint; + date.microsec = arglist[ix++].sint; + } + if (arglist[ix++].ptrflag) { + timeptr = &timeval; + } + glk_date_to_time_local(dateptr, timeptr); + if (timeptr) { + arglist[ix++].sint = timeval.high_sec; + arglist[ix++].uint = timeval.low_sec; + arglist[ix++].sint = timeval.microsec; + } + } + break; + case 0x016E: /* date_to_simple_time_utc */ { + glkdate_t date; + glkdate_t *dateptr = NULL; + int ix = 0; + if (arglist[ix++].ptrflag) { + dateptr = &date; + date.year = arglist[ix++].sint; + date.month = arglist[ix++].sint; + date.day = arglist[ix++].sint; + date.weekday = arglist[ix++].sint; + date.hour = arglist[ix++].sint; + date.minute = arglist[ix++].sint; + date.second = arglist[ix++].sint; + date.microsec = arglist[ix++].sint; + } + arglist[ix+2].sint = glk_date_to_simple_time_utc(dateptr, arglist[ix].uint); + } + break; + case 0x016F: /* date_to_simple_time_local */ { + glkdate_t date; + glkdate_t *dateptr = NULL; + int ix = 0; + if (arglist[ix++].ptrflag) { + dateptr = &date; + date.year = arglist[ix++].sint; + date.month = arglist[ix++].sint; + date.day = arglist[ix++].sint; + date.weekday = arglist[ix++].sint; + date.hour = arglist[ix++].sint; + date.minute = arglist[ix++].sint; + date.second = arglist[ix++].sint; + date.microsec = arglist[ix++].sint; + } + arglist[ix+2].sint = glk_date_to_simple_time_local(dateptr, arglist[ix].uint); + } + break; +#endif /* GLK_MODULE_DATETIME */ + default: /* do nothing */ break; diff --git a/libchimara/gi_dispa.h b/libchimara/gi_dispa.h index e4ac428..6ea045c 100644 --- a/libchimara/gi_dispa.h +++ b/libchimara/gi_dispa.h @@ -1,11 +1,11 @@ #ifndef _GI_DISPA_H #define _GI_DISPA_H -/* gi_dispa.h: Header file for dispatch layer of Glk API, version 0.7.0. +/* gi_dispa.h: Header file for dispatch layer of Glk API, version 0.7.2. Designed by Andrew Plotkin http://www.eblong.com/zarf/glk/index.html - This file is copyright 1998-2004 by Andrew Plotkin. You may copy, + This file is copyright 1998-2011 by Andrew Plotkin. You may copy, distribute, and incorporate it into your own programs, by any means and under any conditions, as long as you do not modify it. You may also modify this file, incorporate it into your own programs, diff --git a/libchimara/glk.h b/libchimara/glk.h index 6b64f88..d6ca327 100644 --- a/libchimara/glk.h +++ b/libchimara/glk.h @@ -1,35 +1,41 @@ #ifndef GLK_H #define GLK_H -/* glk.h: Header file for Glk API, version 0.7.0. - Designed by Andrew Plotkin - http://www.eblong.com/zarf/glk/index.html - - This file is copyright 1998-2004 by Andrew Plotkin. You may copy, - distribute, and incorporate it into your own programs, by any means - and under any conditions, as long as you do not modify it. You may - also modify this file, incorporate it into your own programs, - and distribute the modified version, as long as you retain a notice - in your program or documentation which mentions my name and the URL - shown above. -*/ - -/* You may have to edit the definition of glui32 to make sure it's really a - 32-bit unsigned integer type, and glsi32 to make sure it's really a - 32-bit signed integer type. If they're not, horrible things will happen. */ +/* glk.h: Header file for Glk API, version 0.7.2. + Designed by Andrew Plotkin + http://eblong.com/zarf/glk/ + + This file is copyright 1998-2011 by Andrew Plotkin. You may copy, + distribute, and incorporate it into your own programs, by any means + and under any conditions, as long as you do not modify it. You may + also modify this file, incorporate it into your own programs, + and distribute the modified version, as long as you retain a notice + in your program or documentation which mentions my name and the URL + shown above. + */ + +/* If your system does not have , you'll have to remove this + include line. Then edit the definition of glui32 to make sure it's + really a 32-bit unsigned integer type, and glsi32 to make sure + it's really a 32-bit signed integer type. If they're not, horrible + things will happen. */ #include typedef uint32_t glui32; typedef int32_t glsi32; /* These are the compile-time conditionals that reveal various Glk optional - modules. */ + modules. */ +#define GLK_MODULE_LINE_ECHO +#define GLK_MODULE_LINE_TERMINATORS #define GLK_MODULE_UNICODE +#define GLK_MODULE_UNICODE_NORM #define GLK_MODULE_IMAGE #define GLK_MODULE_SOUND #define GLK_MODULE_HYPERLINKS +#define GLK_MODULE_DATETIME /* These types are opaque object identifiers. They're pointers to opaque - C structures, which are defined differently by each library. */ + C structures, which are defined differently by each library. */ typedef struct glk_window_struct *winid_t; typedef struct glk_stream_struct *strid_t; typedef struct glk_fileref_struct *frefid_t; @@ -54,6 +60,11 @@ typedef struct glk_schannel_struct *schanid_t; #define gestalt_SoundMusic (13) #define gestalt_GraphicsTransparency (14) #define gestalt_Unicode (15) +#define gestalt_UnicodeNorm (16) +#define gestalt_LineInputEcho (17) +#define gestalt_LineTerminators (18) +#define gestalt_LineTerminatorKey (19) +#define gestalt_DateTime (20) #define evtype_None (0) #define evtype_Timer (1) @@ -134,6 +145,10 @@ typedef struct stream_result_struct { #define winmethod_Proportional (0x20) #define winmethod_DivisionMask (0xf0) +#define winmethod_Border (0x000) +#define winmethod_NoBorder (0x100) +#define winmethod_BorderMask (0x100) + #define fileusage_Data (0x00) #define fileusage_SavedGame (0x01) #define fileusage_Transcript (0x02) @@ -170,7 +185,7 @@ typedef struct stream_result_struct { #define stylehint_just_RightFlush (3) /* glk_main() is the top-level function which you define. The Glk library - calls it. */ + calls it. */ extern void glk_main(void); extern void glk_exit(void); @@ -179,21 +194,21 @@ extern void glk_tick(void); extern glui32 glk_gestalt(glui32 sel, glui32 val); extern glui32 glk_gestalt_ext(glui32 sel, glui32 val, glui32 *arr, - glui32 arrlen); + glui32 arrlen); extern unsigned char glk_char_to_lower(unsigned char ch); extern unsigned char glk_char_to_upper(unsigned char ch); extern winid_t glk_window_get_root(void); extern winid_t glk_window_open(winid_t split, glui32 method, glui32 size, - glui32 wintype, glui32 rock); + glui32 wintype, glui32 rock); extern void glk_window_close(winid_t win, stream_result_t *result); extern void glk_window_get_size(winid_t win, glui32 *widthptr, - glui32 *heightptr); + glui32 *heightptr); extern void glk_window_set_arrangement(winid_t win, glui32 method, - glui32 size, winid_t keywin); + glui32 size, winid_t keywin); extern void glk_window_get_arrangement(winid_t win, glui32 *methodptr, - glui32 *sizeptr, winid_t *keywinptr); + glui32 *sizeptr, winid_t *keywinptr); extern winid_t glk_window_iterate(winid_t win, glui32 *rockptr); extern glui32 glk_window_get_rock(winid_t win); extern glui32 glk_window_get_type(winid_t win); @@ -208,9 +223,9 @@ extern strid_t glk_window_get_echo_stream(winid_t win); extern void glk_set_window(winid_t win); extern strid_t glk_stream_open_file(frefid_t fileref, glui32 fmode, - glui32 rock); + glui32 rock); extern strid_t glk_stream_open_memory(char *buf, glui32 buflen, glui32 fmode, - glui32 rock); + glui32 rock); extern void glk_stream_close(strid_t str, stream_result_t *result); extern strid_t glk_stream_iterate(strid_t str, glui32 *rockptr); extern glui32 glk_stream_get_rock(strid_t str); @@ -233,19 +248,19 @@ extern glui32 glk_get_line_stream(strid_t str, char *buf, glui32 len); extern glui32 glk_get_buffer_stream(strid_t str, char *buf, glui32 len); extern void glk_stylehint_set(glui32 wintype, glui32 styl, glui32 hint, - glsi32 val); + glsi32 val); extern void glk_stylehint_clear(glui32 wintype, glui32 styl, glui32 hint); extern glui32 glk_style_distinguish(winid_t win, glui32 styl1, glui32 styl2); extern glui32 glk_style_measure(winid_t win, glui32 styl, glui32 hint, - glui32 *result); + glui32 *result); extern frefid_t glk_fileref_create_temp(glui32 usage, glui32 rock); extern frefid_t glk_fileref_create_by_name(glui32 usage, char *name, - glui32 rock); + glui32 rock); extern frefid_t glk_fileref_create_by_prompt(glui32 usage, glui32 fmode, - glui32 rock); + glui32 rock); extern frefid_t glk_fileref_create_from_fileref(glui32 usage, frefid_t fref, - glui32 rock); + glui32 rock); extern void glk_fileref_destroy(frefid_t fref); extern frefid_t glk_fileref_iterate(frefid_t fref, glui32 *rockptr); extern glui32 glk_fileref_get_rock(frefid_t fref); @@ -258,7 +273,7 @@ extern void glk_select_poll(event_t *event); extern void glk_request_timer_events(glui32 millisecs); extern void glk_request_line_event(winid_t win, char *buf, glui32 maxlen, - glui32 initlen); + glui32 initlen); extern void glk_request_char_event(winid_t win); extern void glk_request_mouse_event(winid_t win); @@ -266,14 +281,23 @@ extern void glk_cancel_line_event(winid_t win, event_t *event); extern void glk_cancel_char_event(winid_t win); extern void glk_cancel_mouse_event(winid_t win); +#ifdef GLK_MODULE_LINE_ECHO +extern void glk_set_echo_line_event(winid_t win, glui32 val); +#endif /* GLK_MODULE_LINE_ECHO */ + +#ifdef GLK_MODULE_LINE_TERMINATORS +extern void glk_set_terminators_line_event(winid_t win, glui32 *keycodes, + glui32 count); +#endif /* GLK_MODULE_LINE_TERMINATORS */ + #ifdef GLK_MODULE_UNICODE extern glui32 glk_buffer_to_lower_case_uni(glui32 *buf, glui32 len, - glui32 numchars); + glui32 numchars); extern glui32 glk_buffer_to_upper_case_uni(glui32 *buf, glui32 len, - glui32 numchars); + glui32 numchars); extern glui32 glk_buffer_to_title_case_uni(glui32 *buf, glui32 len, - glui32 numchars, glui32 lowerrest); + glui32 numchars, glui32 lowerrest); extern void glk_put_char_uni(glui32 ch); extern void glk_put_string_uni(glui32 *s); @@ -287,16 +311,25 @@ extern glui32 glk_get_buffer_stream_uni(strid_t str, glui32 *buf, glui32 len); extern glui32 glk_get_line_stream_uni(strid_t str, glui32 *buf, glui32 len); extern strid_t glk_stream_open_file_uni(frefid_t fileref, glui32 fmode, - glui32 rock); + glui32 rock); extern strid_t glk_stream_open_memory_uni(glui32 *buf, glui32 buflen, - glui32 fmode, glui32 rock); + glui32 fmode, glui32 rock); extern void glk_request_char_event_uni(winid_t win); extern void glk_request_line_event_uni(winid_t win, glui32 *buf, - glui32 maxlen, glui32 initlen); + glui32 maxlen, glui32 initlen); #endif /* GLK_MODULE_UNICODE */ +#ifdef GLK_MODULE_UNICODE_NORM + +extern glui32 glk_buffer_canon_decompose_uni(glui32 *buf, glui32 len, + glui32 numchars); +extern glui32 glk_buffer_canon_normalize_uni(glui32 *buf, glui32 len, + glui32 numchars); + +#endif /* GLK_MODULE_UNICODE_NORM */ + #ifdef GLK_MODULE_IMAGE #define imagealign_InlineUp (0x01) @@ -307,15 +340,15 @@ extern void glk_request_line_event_uni(winid_t win, glui32 *buf, extern glui32 glk_image_draw(winid_t win, glui32 image, glsi32 val1, glsi32 val2); extern glui32 glk_image_draw_scaled(winid_t win, glui32 image, - glsi32 val1, glsi32 val2, glui32 width, glui32 height); + glsi32 val1, glsi32 val2, glui32 width, glui32 height); extern glui32 glk_image_get_info(glui32 image, glui32 *width, glui32 *height); extern void glk_window_flow_break(winid_t win); extern void glk_window_erase_rect(winid_t win, - glsi32 left, glsi32 top, glui32 width, glui32 height); + glsi32 left, glsi32 top, glui32 width, glui32 height); extern void glk_window_fill_rect(winid_t win, glui32 color, - glsi32 left, glsi32 top, glui32 width, glui32 height); + glsi32 left, glsi32 top, glui32 width, glui32 height); extern void glk_window_set_background_color(winid_t win, glui32 color); #endif /* GLK_MODULE_IMAGE */ @@ -329,7 +362,7 @@ extern glui32 glk_schannel_get_rock(schanid_t chan); extern glui32 glk_schannel_play(schanid_t chan, glui32 snd); extern glui32 glk_schannel_play_ext(schanid_t chan, glui32 snd, glui32 repeats, - glui32 notify); + glui32 notify); extern void glk_schannel_stop(schanid_t chan); extern void glk_schannel_set_volume(schanid_t chan, glui32 vol); @@ -346,4 +379,38 @@ extern void glk_cancel_hyperlink_event(winid_t win); #endif /* GLK_MODULE_HYPERLINKS */ +#ifdef GLK_MODULE_DATETIME + +typedef struct glktimeval_struct { + glsi32 high_sec; + glui32 low_sec; + glsi32 microsec; +} glktimeval_t; + +typedef struct glkdate_struct { + glsi32 year; /* full (four-digit) year */ + glsi32 month; /* 1-12, 1 is January */ + glsi32 day; /* 1-31 */ + glsi32 weekday; /* 0-6, 0 is Sunday */ + glsi32 hour; /* 0-23 */ + glsi32 minute; /* 0-59 */ + glsi32 second; /* 0-59, maybe 60 during a leap second */ + glsi32 microsec; /* 0-999999 */ +} glkdate_t; + +extern void glk_current_time(glktimeval_t *time); +extern glsi32 glk_current_simple_time(glui32 factor); +extern void glk_time_to_date_utc(glktimeval_t *time, glkdate_t *date); +extern void glk_time_to_date_local(glktimeval_t *time, glkdate_t *date); +extern void glk_simple_time_to_date_utc(glsi32 time, glui32 factor, + glkdate_t *date); +extern void glk_simple_time_to_date_local(glsi32 time, glui32 factor, + glkdate_t *date); +extern void glk_date_to_time_utc(glkdate_t *date, glktimeval_t *time); +extern void glk_date_to_time_local(glkdate_t *date, glktimeval_t *time); +extern glsi32 glk_date_to_simple_time_utc(glkdate_t *date, glui32 factor); +extern glsi32 glk_date_to_simple_time_local(glkdate_t *date, glui32 factor); + +#endif /* GLK_MODULE_DATETIME */ + #endif /* GLK_H */ -- 2.30.2