1 /* gi_dispa.c: Dispatch layer for Glk API, version 0.7.2.
2 Designed by Andrew Plotkin <erkyrath@eblong.com>
3 http://eblong.com/zarf/glk/
5 This file is copyright 1998-2011 by Andrew Plotkin. You may copy,
6 distribute, and incorporate it into your own programs, by any means
7 and under any conditions, as long as you do not modify it. You may
8 also modify this file, incorporate it into your own programs,
9 and distribute the modified version, as long as you retain a notice
10 in your program or documentation which mentions my name and the URL
14 /* This code should be linked into every Glk library, without change.
15 Get the latest version from the URL above. */
25 (sizeof(class_table) / sizeof(gidispatch_intconst_t))
27 #define NUMINTCONSTANTS \
28 (sizeof(intconstant_table) / sizeof(gidispatch_intconst_t))
30 #define NUMFUNCTIONS \
31 (sizeof(function_table) / sizeof(gidispatch_function_t))
33 /* The constants in this table must be ordered alphabetically. */
34 static gidispatch_intconst_t class_table[] = {
35 { "fileref", (2) }, /* "Qc" */
36 { "schannel", (3) }, /* "Qd" */
37 { "stream", (1) }, /* "Qb" */
38 { "window", (0) }, /* "Qa" */
41 /* The constants in this table must be ordered alphabetically. */
42 static gidispatch_intconst_t intconstant_table[] = {
43 { "evtype_Arrange", (5) },
44 { "evtype_CharInput", (2) },
45 { "evtype_Hyperlink", (8) },
46 { "evtype_LineInput", (3) },
47 { "evtype_MouseInput", (4) },
48 { "evtype_None", (0) },
49 { "evtype_Redraw", (6) },
50 { "evtype_SoundNotify", (7) },
51 { "evtype_Timer", (1) },
53 { "filemode_Read", (0x02) },
54 { "filemode_ReadWrite", (0x03) },
55 { "filemode_Write", (0x01) },
56 { "filemode_WriteAppend", (0x05) },
58 { "fileusage_BinaryMode", (0x000) },
59 { "fileusage_Data", (0x00) },
60 { "fileusage_InputRecord", (0x03) },
61 { "fileusage_SavedGame", (0x01) },
62 { "fileusage_TextMode", (0x100) },
63 { "fileusage_Transcript", (0x02) },
64 { "fileusage_TypeMask", (0x0f) },
66 { "gestalt_CharInput", (1) },
67 { "gestalt_CharOutput", (3) },
68 { "gestalt_CharOutput_ApproxPrint", (1) },
69 { "gestalt_CharOutput_CannotPrint", (0) },
70 { "gestalt_CharOutput_ExactPrint", (2) },
71 { "gestalt_DateTime", (20) },
72 { "gestalt_DrawImage", (7) },
73 { "gestalt_Graphics", (6) },
74 { "gestalt_GraphicsTransparency", (14) },
75 { "gestalt_HyperlinkInput", (12) },
76 { "gestalt_Hyperlinks", (11) },
77 { "gestalt_LineInput", (2) },
78 { "gestalt_LineInputEcho", (17) },
79 { "gestalt_LineTerminatorKey", (19) },
80 { "gestalt_LineTerminators", (18) },
81 { "gestalt_MouseInput", (4) },
82 { "gestalt_Sound", (8) },
83 { "gestalt_SoundMusic", (13) },
84 { "gestalt_SoundNotify", (10) },
85 { "gestalt_SoundVolume", (9) },
86 { "gestalt_Timer", (5) },
87 { "gestalt_Unicode", (15) },
88 { "gestalt_UnicodeNorm", (16) },
89 { "gestalt_Version", (0) },
91 { "imagealign_InlineCenter", (0x03) },
92 { "imagealign_InlineDown", (0x02) },
93 { "imagealign_MarginLeft", (0x04) },
94 { "imagealign_MarginRight", (0x05) },
95 { "imagealign_InlineUp", (0x01) },
97 { "keycode_Delete", (0xfffffff9) },
98 { "keycode_Down", (0xfffffffb) },
99 { "keycode_End", (0xfffffff3) },
100 { "keycode_Escape", (0xfffffff8) },
101 { "keycode_Func1", (0xffffffef) },
102 { "keycode_Func10", (0xffffffe6) },
103 { "keycode_Func11", (0xffffffe5) },
104 { "keycode_Func12", (0xffffffe4) },
105 { "keycode_Func2", (0xffffffee) },
106 { "keycode_Func3", (0xffffffed) },
107 { "keycode_Func4", (0xffffffec) },
108 { "keycode_Func5", (0xffffffeb) },
109 { "keycode_Func6", (0xffffffea) },
110 { "keycode_Func7", (0xffffffe9) },
111 { "keycode_Func8", (0xffffffe8) },
112 { "keycode_Func9", (0xffffffe7) },
113 { "keycode_Home", (0xfffffff4) },
114 { "keycode_Left", (0xfffffffe) },
115 { "keycode_MAXVAL", (28) },
116 { "keycode_PageDown", (0xfffffff5) },
117 { "keycode_PageUp", (0xfffffff6) },
118 { "keycode_Return", (0xfffffffa) },
119 { "keycode_Right", (0xfffffffd) },
120 { "keycode_Tab", (0xfffffff7) },
121 { "keycode_Unknown", (0xffffffff) },
122 { "keycode_Up", (0xfffffffc) },
124 { "seekmode_Current", (1) },
125 { "seekmode_End", (2) },
126 { "seekmode_Start", (0) },
128 { "style_Alert", (5) },
129 { "style_BlockQuote", (7) },
130 { "style_Emphasized", (1) },
131 { "style_Header", (3) },
132 { "style_Input", (8) },
133 { "style_NUMSTYLES", (11) },
134 { "style_Normal", (0) },
135 { "style_Note", (6) },
136 { "style_Preformatted", (2) },
137 { "style_Subheader", (4) },
138 { "style_User1", (9) },
139 { "style_User2", (10) },
140 { "stylehint_BackColor", (8) },
141 { "stylehint_Indentation", (0) },
142 { "stylehint_Justification", (2) },
143 { "stylehint_NUMHINTS", (10) },
144 { "stylehint_Oblique", (5) },
145 { "stylehint_ParaIndentation", (1) },
146 { "stylehint_Proportional", (6) },
147 { "stylehint_ReverseColor", (9) },
148 { "stylehint_Size", (3) },
149 { "stylehint_TextColor", (7) },
150 { "stylehint_Weight", (4) },
151 { "stylehint_just_Centered", (2) },
152 { "stylehint_just_LeftFlush", (0) },
153 { "stylehint_just_LeftRight", (1) },
154 { "stylehint_just_RightFlush", (3) },
156 { "winmethod_Above", (0x02) },
157 { "winmethod_Below", (0x03) },
158 { "winmethod_Border", (0x000) },
159 { "winmethod_BorderMask", (0x100) },
160 { "winmethod_DirMask", (0x0f) },
161 { "winmethod_DivisionMask", (0xf0) },
162 { "winmethod_Fixed", (0x10) },
163 { "winmethod_Left", (0x00) },
164 { "winmethod_NoBorder", (0x100) },
165 { "winmethod_Proportional", (0x20) },
166 { "winmethod_Right", (0x01) },
168 { "wintype_AllTypes", (0) },
169 { "wintype_Blank", (2) },
170 { "wintype_Graphics", (5) },
171 { "wintype_Pair", (1) },
172 { "wintype_TextBuffer", (3) },
173 { "wintype_TextGrid", (4) },
176 /* The functions in this table must be ordered by id. */
177 static gidispatch_function_t function_table[] = {
178 { 0x0001, glk_exit, "exit" },
179 { 0x0002, glk_set_interrupt_handler, "set_interrupt_handler" },
180 { 0x0003, glk_tick, "tick" },
181 { 0x0004, glk_gestalt, "gestalt" },
182 { 0x0005, glk_gestalt_ext, "gestalt_ext" },
183 { 0x0020, glk_window_iterate, "window_iterate" },
184 { 0x0021, glk_window_get_rock, "window_get_rock" },
185 { 0x0022, glk_window_get_root, "window_get_root" },
186 { 0x0023, glk_window_open, "window_open" },
187 { 0x0024, glk_window_close, "window_close" },
188 { 0x0025, glk_window_get_size, "window_get_size" },
189 { 0x0026, glk_window_set_arrangement, "window_set_arrangement" },
190 { 0x0027, glk_window_get_arrangement, "window_get_arrangement" },
191 { 0x0028, glk_window_get_type, "window_get_type" },
192 { 0x0029, glk_window_get_parent, "window_get_parent" },
193 { 0x002A, glk_window_clear, "window_clear" },
194 { 0x002B, glk_window_move_cursor, "window_move_cursor" },
195 { 0x002C, glk_window_get_stream, "window_get_stream" },
196 { 0x002D, glk_window_set_echo_stream, "window_set_echo_stream" },
197 { 0x002E, glk_window_get_echo_stream, "window_get_echo_stream" },
198 { 0x002F, glk_set_window, "set_window" },
199 { 0x0030, glk_window_get_sibling, "window_get_sibling" },
200 { 0x0040, glk_stream_iterate, "stream_iterate" },
201 { 0x0041, glk_stream_get_rock, "stream_get_rock" },
202 { 0x0042, glk_stream_open_file, "stream_open_file" },
203 { 0x0043, glk_stream_open_memory, "stream_open_memory" },
204 { 0x0044, glk_stream_close, "stream_close" },
205 { 0x0045, glk_stream_set_position, "stream_set_position" },
206 { 0x0046, glk_stream_get_position, "stream_get_position" },
207 { 0x0047, glk_stream_set_current, "stream_set_current" },
208 { 0x0048, glk_stream_get_current, "stream_get_current" },
209 { 0x0060, glk_fileref_create_temp, "fileref_create_temp" },
210 { 0x0061, glk_fileref_create_by_name, "fileref_create_by_name" },
211 { 0x0062, glk_fileref_create_by_prompt, "fileref_create_by_prompt" },
212 { 0x0063, glk_fileref_destroy, "fileref_destroy" },
213 { 0x0064, glk_fileref_iterate, "fileref_iterate" },
214 { 0x0065, glk_fileref_get_rock, "fileref_get_rock" },
215 { 0x0066, glk_fileref_delete_file, "fileref_delete_file" },
216 { 0x0067, glk_fileref_does_file_exist, "fileref_does_file_exist" },
217 { 0x0068, glk_fileref_create_from_fileref, "fileref_create_from_fileref" },
218 { 0x0080, glk_put_char, "put_char" },
219 { 0x0081, glk_put_char_stream, "put_char_stream" },
220 { 0x0082, glk_put_string, "put_string" },
221 { 0x0083, glk_put_string_stream, "put_string_stream" },
222 { 0x0084, glk_put_buffer, "put_buffer" },
223 { 0x0085, glk_put_buffer_stream, "put_buffer_stream" },
224 { 0x0086, glk_set_style, "set_style" },
225 { 0x0087, glk_set_style_stream, "set_style_stream" },
226 { 0x0090, glk_get_char_stream, "get_char_stream" },
227 { 0x0091, glk_get_line_stream, "get_line_stream" },
228 { 0x0092, glk_get_buffer_stream, "get_buffer_stream" },
229 { 0x00A0, glk_char_to_lower, "char_to_lower" },
230 { 0x00A1, glk_char_to_upper, "char_to_upper" },
231 { 0x00B0, glk_stylehint_set, "stylehint_set" },
232 { 0x00B1, glk_stylehint_clear, "stylehint_clear" },
233 { 0x00B2, glk_style_distinguish, "style_distinguish" },
234 { 0x00B3, glk_style_measure, "style_measure" },
235 { 0x00C0, glk_select, "select" },
236 { 0x00C1, glk_select_poll, "select_poll" },
237 { 0x00D0, glk_request_line_event, "request_line_event" },
238 { 0x00D1, glk_cancel_line_event, "cancel_line_event" },
239 { 0x00D2, glk_request_char_event, "request_char_event" },
240 { 0x00D3, glk_cancel_char_event, "cancel_char_event" },
241 { 0x00D4, glk_request_mouse_event, "request_mouse_event" },
242 { 0x00D5, glk_cancel_mouse_event, "cancel_mouse_event" },
243 { 0x00D6, glk_request_timer_events, "request_timer_events" },
244 #ifdef GLK_MODULE_IMAGE
245 { 0x00E0, glk_image_get_info, "image_get_info" },
246 { 0x00E1, glk_image_draw, "image_draw" },
247 { 0x00E2, glk_image_draw_scaled, "image_draw_scaled" },
248 { 0x00E8, glk_window_flow_break, "window_flow_break" },
249 { 0x00E9, glk_window_erase_rect, "window_erase_rect" },
250 { 0x00EA, glk_window_fill_rect, "window_fill_rect" },
251 { 0x00EB, glk_window_set_background_color, "window_set_background_color" },
252 #endif /* GLK_MODULE_IMAGE */
253 #ifdef GLK_MODULE_SOUND
254 { 0x00F0, glk_schannel_iterate, "schannel_iterate" },
255 { 0x00F1, glk_schannel_get_rock, "schannel_get_rock" },
256 { 0x00F2, glk_schannel_create, "schannel_create" },
257 { 0x00F3, glk_schannel_destroy, "schannel_destroy" },
258 { 0x00F8, glk_schannel_play, "schannel_play" },
259 { 0x00F9, glk_schannel_play_ext, "schannel_play_ext" },
260 { 0x00FA, glk_schannel_stop, "schannel_stop" },
261 { 0x00FB, glk_schannel_set_volume, "schannel_set_volume" },
262 { 0x00FC, glk_sound_load_hint, "sound_load_hint" },
263 #endif /* GLK_MODULE_SOUND */
264 #ifdef GLK_MODULE_HYPERLINKS
265 { 0x0100, glk_set_hyperlink, "set_hyperlink" },
266 { 0x0101, glk_set_hyperlink_stream, "set_hyperlink_stream" },
267 { 0x0102, glk_request_hyperlink_event, "request_hyperlink_event" },
268 { 0x0103, glk_cancel_hyperlink_event, "cancel_hyperlink_event" },
269 #endif /* GLK_MODULE_HYPERLINKS */
270 #ifdef GLK_MODULE_UNICODE
271 { 0x0120, glk_buffer_to_lower_case_uni, "buffer_to_lower_case_uni" },
272 { 0x0121, glk_buffer_to_upper_case_uni, "buffer_to_upper_case_uni" },
273 { 0x0122, glk_buffer_to_title_case_uni, "buffer_to_title_case_uni" },
274 { 0x0128, glk_put_char_uni, "put_char_uni" },
275 { 0x0129, glk_put_string_uni, "put_string_uni" },
276 { 0x012A, glk_put_buffer_uni, "put_buffer_uni" },
277 { 0x012B, glk_put_char_stream_uni, "put_char_stream_uni" },
278 { 0x012C, glk_put_string_stream_uni, "put_string_stream_uni" },
279 { 0x012D, glk_put_buffer_stream_uni, "put_buffer_stream_uni" },
280 { 0x0130, glk_get_char_stream_uni, "get_char_stream_uni" },
281 { 0x0131, glk_get_buffer_stream_uni, "get_buffer_stream_uni" },
282 { 0x0132, glk_get_line_stream_uni, "get_line_stream_uni" },
283 { 0x0138, glk_stream_open_file_uni, "stream_open_file_uni" },
284 { 0x0139, glk_stream_open_memory_uni, "stream_open_memory_uni" },
285 { 0x0140, glk_request_char_event_uni, "request_char_event_uni" },
286 { 0x0141, glk_request_line_event_uni, "request_line_event_uni" },
287 #endif /* GLK_MODULE_UNICODE */
288 #ifdef GLK_MODULE_UNICODE_NORM
289 { 0x0123, glk_buffer_canon_decompose_uni, "buffer_canon_decompose_uni" },
290 { 0x0124, glk_buffer_canon_normalize_uni, "buffer_canon_normalize_uni" },
291 #endif /* GLK_MODULE_UNICODE_NORM */
292 #ifdef GLK_MODULE_LINE_ECHO
293 { 0x0150, glk_set_echo_line_event, "set_echo_line_event" },
294 #endif /* GLK_MODULE_LINE_ECHO */
295 #ifdef GLK_MODULE_LINE_TERMINATORS
296 { 0x0151, glk_set_terminators_line_event, "set_terminators_line_event" },
297 #endif /* GLK_MODULE_LINE_TERMINATORS */
298 #ifdef GLK_MODULE_DATETIME
299 { 0x0160, glk_current_time, "current_time" },
300 { 0x0161, glk_current_simple_time, "current_simple_time" },
301 { 0x0168, glk_time_to_date_utc, "time_to_date_utc" },
302 { 0x0169, glk_time_to_date_local, "time_to_date_local" },
303 { 0x016A, glk_simple_time_to_date_utc, "simple_time_to_date_utc" },
304 { 0x016B, glk_simple_time_to_date_local, "simple_time_to_date_local" },
305 { 0x016C, glk_date_to_time_utc, "date_to_time_utc" },
306 { 0x016D, glk_date_to_time_local, "date_to_time_local" },
307 { 0x016E, glk_date_to_simple_time_utc, "date_to_simple_time_utc" },
308 { 0x016F, glk_date_to_simple_time_local, "date_to_simple_time_local" },
309 #endif /* GLK_MODULE_DATETIME */
312 glui32 gidispatch_count_classes()
317 gidispatch_intconst_t *gidispatch_get_class(glui32 index)
319 if (index < 0 || index >= NUMCLASSES)
321 return &(class_table[index]);
324 glui32 gidispatch_count_intconst()
326 return NUMINTCONSTANTS;
329 gidispatch_intconst_t *gidispatch_get_intconst(glui32 index)
331 if (index < 0 || index >= NUMINTCONSTANTS)
333 return &(intconstant_table[index]);
336 glui32 gidispatch_count_functions()
341 gidispatch_function_t *gidispatch_get_function(glui32 index)
343 if (index < 0 || index >= NUMFUNCTIONS)
345 return &(function_table[index]);
348 gidispatch_function_t *gidispatch_get_function_by_id(glui32 id)
351 gidispatch_function_t *func;
358 func = &(function_table[val]);
374 char *gidispatch_prototype(glui32 funcnum)
377 case 0x0001: /* exit */
379 case 0x0002: /* set_interrupt_handler */
380 /* cannot be invoked through dispatch layer */
382 case 0x0003: /* tick */
384 case 0x0004: /* gestalt */
386 case 0x0005: /* gestalt_ext */
387 return "4IuIu&#Iu:Iu";
388 case 0x0020: /* window_iterate */
390 case 0x0021: /* window_get_rock */
392 case 0x0022: /* window_get_root */
394 case 0x0023: /* window_open */
395 return "6QaIuIuIuIu:Qa";
396 case 0x0024: /* window_close */
397 return "2Qa<[2IuIu]:";
398 case 0x0025: /* window_get_size */
400 case 0x0026: /* window_set_arrangement */
402 case 0x0027: /* window_get_arrangement */
403 return "4Qa<Iu<Iu<Qa:";
404 case 0x0028: /* window_get_type */
406 case 0x0029: /* window_get_parent */
408 case 0x002A: /* window_clear */
410 case 0x002B: /* window_move_cursor */
412 case 0x002C: /* window_get_stream */
414 case 0x002D: /* window_set_echo_stream */
416 case 0x002E: /* window_get_echo_stream */
418 case 0x002F: /* set_window */
420 case 0x0030: /* window_get_sibling */
422 case 0x0040: /* stream_iterate */
424 case 0x0041: /* stream_get_rock */
426 case 0x0042: /* stream_open_file */
428 case 0x0043: /* stream_open_memory */
429 return "4&+#!CnIuIu:Qb";
430 case 0x0044: /* stream_close */
431 return "2Qb<[2IuIu]:";
432 case 0x0045: /* stream_set_position */
434 case 0x0046: /* stream_get_position */
436 case 0x0047: /* stream_set_current */
438 case 0x0048: /* stream_get_current */
440 case 0x0060: /* fileref_create_temp */
442 case 0x0061: /* fileref_create_by_name */
444 case 0x0062: /* fileref_create_by_prompt */
446 case 0x0063: /* fileref_destroy */
448 case 0x0064: /* fileref_iterate */
450 case 0x0065: /* fileref_get_rock */
452 case 0x0066: /* fileref_delete_file */
454 case 0x0067: /* fileref_does_file_exist */
456 case 0x0068: /* fileref_create_from_fileref */
458 case 0x0080: /* put_char */
460 case 0x0081: /* put_char_stream */
462 case 0x0082: /* put_string */
464 case 0x0083: /* put_string_stream */
466 case 0x0084: /* put_buffer */
468 case 0x0085: /* put_buffer_stream */
470 case 0x0086: /* set_style */
472 case 0x0087: /* set_style_stream */
474 case 0x0090: /* get_char_stream */
476 case 0x0091: /* get_line_stream */
477 return "3Qb<+#Cn:Iu";
478 case 0x0092: /* get_buffer_stream */
479 return "3Qb<+#Cn:Iu";
480 case 0x00A0: /* char_to_lower */
482 case 0x00A1: /* char_to_upper */
484 case 0x00B0: /* stylehint_set */
486 case 0x00B1: /* stylehint_clear */
488 case 0x00B2: /* style_distinguish */
490 case 0x00B3: /* style_measure */
491 return "5QaIuIu<Iu:Iu";
492 case 0x00C0: /* select */
493 return "1<+[4IuQaIuIu]:";
494 case 0x00C1: /* select_poll */
495 return "1<+[4IuQaIuIu]:";
496 case 0x00D0: /* request_line_event */
497 return "3Qa&+#!CnIu:";
498 case 0x00D1: /* cancel_line_event */
499 return "2Qa<[4IuQaIuIu]:";
500 case 0x00D2: /* request_char_event */
502 case 0x00D3: /* cancel_char_event */
504 case 0x00D4: /* request_mouse_event */
506 case 0x00D5: /* cancel_mouse_event */
508 case 0x00D6: /* request_timer_events */
511 #ifdef GLK_MODULE_IMAGE
512 case 0x00E0: /* image_get_info */
513 return "4Iu<Iu<Iu:Iu";
514 case 0x00E1: /* image_draw */
515 return "5QaIuIsIs:Iu";
516 case 0x00E2: /* image_draw_scaled */
517 return "7QaIuIsIsIuIu:Iu";
518 case 0x00E8: /* window_flow_break */
520 case 0x00E9: /* window_erase_rect */
521 return "5QaIsIsIuIu:";
522 case 0x00EA: /* window_fill_rect */
523 return "6QaIuIsIsIuIu:";
524 case 0x00EB: /* window_set_background_color */
526 #endif /* GLK_MODULE_IMAGE */
528 #ifdef GLK_MODULE_SOUND
529 case 0x00F0: /* schannel_iterate */
531 case 0x00F1: /* schannel_get_rock */
533 case 0x00F2: /* schannel_create */
535 case 0x00F3: /* schannel_destroy */
537 case 0x00F8: /* schannel_play */
539 case 0x00F9: /* schannel_play_ext */
540 return "5QdIuIuIu:Iu";
541 case 0x00FA: /* schannel_stop */
543 case 0x00FB: /* schannel_set_volume */
545 case 0x00FC: /* sound_load_hint */
547 #endif /* GLK_MODULE_SOUND */
549 #ifdef GLK_MODULE_HYPERLINKS
550 case 0x0100: /* set_hyperlink */
552 case 0x0101: /* set_hyperlink_stream */
554 case 0x0102: /* request_hyperlink_event */
556 case 0x0103: /* cancel_hyperlink_event */
558 #endif /* GLK_MODULE_HYPERLINKS */
560 #ifdef GLK_MODULE_UNICODE
561 case 0x0120: /* buffer_to_lower_case_uni */
562 return "3&+#IuIu:Iu";
563 case 0x0121: /* buffer_to_upper_case_uni */
564 return "3&+#IuIu:Iu";
565 case 0x0122: /* buffer_to_title_case_uni */
566 return "4&+#IuIuIu:Iu";
567 case 0x0128: /* put_char_uni */
569 case 0x0129: /* put_string_uni */
571 case 0x012A: /* put_buffer_uni */
573 case 0x012B: /* put_char_stream_uni */
575 case 0x012C: /* put_string_stream_uni */
577 case 0x012D: /* put_buffer_stream_uni */
579 case 0x0130: /* get_char_stream_uni */
581 case 0x0131: /* get_buffer_stream_uni */
582 return "3Qb<+#Iu:Iu";
583 case 0x0132: /* get_line_stream_uni */
584 return "3Qb<+#Iu:Iu";
585 case 0x0138: /* stream_open_file_uni */
587 case 0x0139: /* stream_open_memory_uni */
588 return "4&+#!IuIuIu:Qb";
589 case 0x0140: /* request_char_event_uni */
591 case 0x0141: /* request_line_event_uni */
592 return "3Qa&+#!IuIu:";
593 #endif /* GLK_MODULE_UNICODE */
595 #ifdef GLK_MODULE_UNICODE_NORM
596 case 0x0123: /* buffer_canon_decompose_uni */
597 return "3&+#IuIu:Iu";
598 case 0x0124: /* buffer_canon_normalize_uni */
599 return "3&+#IuIu:Iu";
600 #endif /* GLK_MODULE_UNICODE_NORM */
602 #ifdef GLK_MODULE_LINE_ECHO
603 case 0x0150: /* set_echo_line_event */
605 #endif /* GLK_MODULE_LINE_ECHO */
607 #ifdef GLK_MODULE_LINE_TERMINATORS
608 case 0x0151: /* set_terminators_line_event */
610 #endif /* GLK_MODULE_LINE_TERMINATORS */
612 #ifdef GLK_MODULE_DATETIME
613 case 0x0160: /* current_time */
614 return "1<+[3IsIuIs]:";
615 case 0x0161: /* current_simple_time */
617 case 0x0168: /* time_to_date_utc */
618 return "2>+[3IsIuIs]<+[8IsIsIsIsIsIsIsIs]:";
619 case 0x0169: /* time_to_date_local */
620 return "2>+[3IsIuIs]<+[8IsIsIsIsIsIsIsIs]:";
621 case 0x016A: /* simple_time_to_date_utc */
622 return "3IsIu<+[8IsIsIsIsIsIsIsIs]:";
623 case 0x016B: /* simple_time_to_date_local */
624 return "3IsIu<+[8IsIsIsIsIsIsIsIs]:";
625 case 0x016C: /* date_to_time_utc */
626 return "2>+[8IsIsIsIsIsIsIsIs]<+[3IsIuIs]:";
627 case 0x016D: /* date_to_time_local */
628 return "2>+[8IsIsIsIsIsIsIsIs]<+[3IsIuIs]:";
629 case 0x016E: /* date_to_simple_time_utc */
630 return "3>+[8IsIsIsIsIsIsIsIs]Iu:Is";
631 case 0x016F: /* date_to_simple_time_local */
632 return "3>+[8IsIsIsIsIsIsIsIs]Iu:Is";
633 #endif /* GLK_MODULE_DATETIME */
640 void gidispatch_call(glui32 funcnum, glui32 numargs, gluniversal_t *arglist)
643 case 0x0001: /* exit */
646 case 0x0002: /* set_interrupt_handler */
647 /* cannot be invoked through dispatch layer */
649 case 0x0003: /* tick */
652 case 0x0004: /* gestalt */
653 arglist[3].uint = glk_gestalt(arglist[0].uint, arglist[1].uint);
655 case 0x0005: /* gestalt_ext */
656 if (arglist[2].ptrflag) {
657 arglist[6].uint = glk_gestalt_ext(arglist[0].uint, arglist[1].uint,
658 arglist[3].array, arglist[4].uint);
661 arglist[4].uint = glk_gestalt_ext(arglist[0].uint, arglist[1].uint,
665 case 0x0020: /* window_iterate */
666 if (arglist[1].ptrflag)
667 arglist[4].opaqueref = glk_window_iterate(arglist[0].opaqueref, &arglist[2].uint);
669 arglist[3].opaqueref = glk_window_iterate(arglist[0].opaqueref, NULL);
671 case 0x0021: /* window_get_rock */
672 arglist[2].uint = glk_window_get_rock(arglist[0].opaqueref);
674 case 0x0022: /* window_get_root */
675 arglist[1].opaqueref = glk_window_get_root();
677 case 0x0023: /* window_open */
678 arglist[6].opaqueref = glk_window_open(arglist[0].opaqueref, arglist[1].uint,
679 arglist[2].uint, arglist[3].uint, arglist[4].uint);
681 case 0x0024: /* window_close */
682 if (arglist[1].ptrflag) {
684 glk_window_close(arglist[0].opaqueref, &dat);
685 arglist[2].uint = dat.readcount;
686 arglist[3].uint = dat.writecount;
689 glk_window_close(arglist[0].opaqueref, NULL);
692 case 0x0025: /* window_get_size */
696 if (!arglist[ix].ptrflag) {
701 ptr1 = &(arglist[ix].uint);
704 if (!arglist[ix].ptrflag) {
709 ptr2 = &(arglist[ix].uint);
712 glk_window_get_size(arglist[0].opaqueref, ptr1, ptr2);
715 case 0x0026: /* window_set_arrangement */
716 glk_window_set_arrangement(arglist[0].opaqueref, arglist[1].uint,
717 arglist[2].uint, arglist[3].opaqueref);
719 case 0x0027: /* window_get_arrangement */
724 if (!arglist[ix].ptrflag) {
729 ptr1 = &(arglist[ix].uint);
732 if (!arglist[ix].ptrflag) {
737 ptr2 = &(arglist[ix].uint);
740 if (!arglist[ix].ptrflag) {
745 ptr3 = (winid_t *)(&(arglist[ix].opaqueref));
748 glk_window_get_arrangement(arglist[0].opaqueref, ptr1, ptr2, ptr3);
751 case 0x0028: /* window_get_type */
752 arglist[2].uint = glk_window_get_type(arglist[0].opaqueref);
754 case 0x0029: /* window_get_parent */
755 arglist[2].opaqueref = glk_window_get_parent(arglist[0].opaqueref);
757 case 0x002A: /* window_clear */
758 glk_window_clear(arglist[0].opaqueref);
760 case 0x002B: /* window_move_cursor */
761 glk_window_move_cursor(arglist[0].opaqueref, arglist[1].uint,
764 case 0x002C: /* window_get_stream */
765 arglist[2].opaqueref = glk_window_get_stream(arglist[0].opaqueref);
767 case 0x002D: /* window_set_echo_stream */
768 glk_window_set_echo_stream(arglist[0].opaqueref, arglist[1].opaqueref);
770 case 0x002E: /* window_get_echo_stream */
771 arglist[2].opaqueref = glk_window_get_echo_stream(arglist[0].opaqueref);
773 case 0x002F: /* set_window */
774 glk_set_window(arglist[0].opaqueref);
776 case 0x0030: /* window_get_sibling */
777 arglist[2].opaqueref = glk_window_get_sibling(arglist[0].opaqueref);
779 case 0x0040: /* stream_iterate */
780 if (arglist[1].ptrflag)
781 arglist[4].opaqueref = glk_stream_iterate(arglist[0].opaqueref, &arglist[2].uint);
783 arglist[3].opaqueref = glk_stream_iterate(arglist[0].opaqueref, NULL);
785 case 0x0041: /* stream_get_rock */
786 arglist[2].uint = glk_stream_get_rock(arglist[0].opaqueref);
788 case 0x0042: /* stream_open_file */
789 arglist[4].opaqueref = glk_stream_open_file(arglist[0].opaqueref, arglist[1].uint,
792 case 0x0043: /* stream_open_memory */
793 if (arglist[0].ptrflag)
794 arglist[6].opaqueref = glk_stream_open_memory(arglist[1].array,
795 arglist[2].uint, arglist[3].uint, arglist[4].uint);
797 arglist[4].opaqueref = glk_stream_open_memory(NULL,
798 0, arglist[1].uint, arglist[2].uint);
800 case 0x0044: /* stream_close */
801 if (arglist[1].ptrflag) {
803 glk_stream_close(arglist[0].opaqueref, &dat);
804 arglist[2].uint = dat.readcount;
805 arglist[3].uint = dat.writecount;
808 glk_stream_close(arglist[0].opaqueref, NULL);
811 case 0x0045: /* stream_set_position */
812 glk_stream_set_position(arglist[0].opaqueref, arglist[1].sint,
815 case 0x0046: /* stream_get_position */
816 arglist[2].uint = glk_stream_get_position(arglist[0].opaqueref);
818 case 0x0047: /* stream_set_current */
819 glk_stream_set_current(arglist[0].opaqueref);
821 case 0x0048: /* stream_get_current */
822 arglist[1].opaqueref = glk_stream_get_current();
824 case 0x0060: /* fileref_create_temp */
825 arglist[3].opaqueref = glk_fileref_create_temp(arglist[0].uint,
828 case 0x0061: /* fileref_create_by_name */
829 arglist[4].opaqueref = glk_fileref_create_by_name(arglist[0].uint,
830 arglist[1].charstr, arglist[2].uint);
832 case 0x0062: /* fileref_create_by_prompt */
833 arglist[4].opaqueref = glk_fileref_create_by_prompt(arglist[0].uint,
834 arglist[1].uint, arglist[2].uint);
836 case 0x0063: /* fileref_destroy */
837 glk_fileref_destroy(arglist[0].opaqueref);
839 case 0x0064: /* fileref_iterate */
840 if (arglist[1].ptrflag)
841 arglist[4].opaqueref = glk_fileref_iterate(arglist[0].opaqueref, &arglist[2].uint);
843 arglist[3].opaqueref = glk_fileref_iterate(arglist[0].opaqueref, NULL);
845 case 0x0065: /* fileref_get_rock */
846 arglist[2].uint = glk_fileref_get_rock(arglist[0].opaqueref);
848 case 0x0066: /* fileref_delete_file */
849 glk_fileref_delete_file(arglist[0].opaqueref);
851 case 0x0067: /* fileref_does_file_exist */
852 arglist[2].uint = glk_fileref_does_file_exist(arglist[0].opaqueref);
854 case 0x0068: /* fileref_create_from_fileref */
855 arglist[4].opaqueref = glk_fileref_create_from_fileref(arglist[0].uint,
856 arglist[1].opaqueref, arglist[2].uint);
858 case 0x0080: /* put_char */
859 glk_put_char(arglist[0].uch);
861 case 0x0081: /* put_char_stream */
862 glk_put_char_stream(arglist[0].opaqueref, arglist[1].uch);
864 case 0x0082: /* put_string */
865 glk_put_string(arglist[0].charstr);
867 case 0x0083: /* put_string_stream */
868 glk_put_string_stream(arglist[0].opaqueref, arglist[1].charstr);
870 case 0x0084: /* put_buffer */
871 if (arglist[0].ptrflag)
872 glk_put_buffer(arglist[1].array, arglist[2].uint);
874 glk_put_buffer(NULL, 0);
876 case 0x0085: /* put_buffer_stream */
877 if (arglist[1].ptrflag)
878 glk_put_buffer_stream(arglist[0].opaqueref,
879 arglist[2].array, arglist[3].uint);
881 glk_put_buffer_stream(arglist[0].opaqueref,
884 case 0x0086: /* set_style */
885 glk_set_style(arglist[0].uint);
887 case 0x0087: /* set_style_stream */
888 glk_set_style_stream(arglist[0].opaqueref, arglist[1].uint);
890 case 0x0090: /* get_char_stream */
891 arglist[2].sint = glk_get_char_stream(arglist[0].opaqueref);
893 case 0x0091: /* get_line_stream */
894 if (arglist[1].ptrflag)
895 arglist[5].uint = glk_get_line_stream(arglist[0].opaqueref,
896 arglist[2].array, arglist[3].uint);
898 arglist[3].uint = glk_get_line_stream(arglist[0].opaqueref,
901 case 0x0092: /* get_buffer_stream */
902 if (arglist[1].ptrflag)
903 arglist[5].uint = glk_get_buffer_stream(arglist[0].opaqueref,
904 arglist[2].array, arglist[3].uint);
906 arglist[3].uint = glk_get_buffer_stream(arglist[0].opaqueref,
909 case 0x00A0: /* char_to_lower */
910 arglist[2].uch = glk_char_to_lower(arglist[0].uch);
912 case 0x00A1: /* char_to_upper */
913 arglist[2].uch = glk_char_to_upper(arglist[0].uch);
915 case 0x00B0: /* stylehint_set */
916 glk_stylehint_set(arglist[0].uint, arglist[1].uint,
917 arglist[2].uint, arglist[3].sint);
919 case 0x00B1: /* stylehint_clear */
920 glk_stylehint_clear(arglist[0].uint, arglist[1].uint,
923 case 0x00B2: /* style_distinguish */
924 arglist[4].uint = glk_style_distinguish(arglist[0].opaqueref, arglist[1].uint,
927 case 0x00B3: /* style_measure */
928 if (arglist[3].ptrflag)
929 arglist[6].uint = glk_style_measure(arglist[0].opaqueref, arglist[1].uint,
930 arglist[2].uint, &(arglist[4].uint));
932 arglist[5].uint = glk_style_measure(arglist[0].opaqueref, arglist[1].uint,
933 arglist[2].uint, NULL);
935 case 0x00C0: /* select */
936 if (arglist[0].ptrflag) {
939 arglist[1].uint = dat.type;
940 arglist[2].opaqueref = dat.win;
941 arglist[3].uint = dat.val1;
942 arglist[4].uint = dat.val2;
948 case 0x00C1: /* select_poll */
949 if (arglist[0].ptrflag) {
951 glk_select_poll(&dat);
952 arglist[1].uint = dat.type;
953 arglist[2].opaqueref = dat.win;
954 arglist[3].uint = dat.val1;
955 arglist[4].uint = dat.val2;
958 glk_select_poll(NULL);
961 case 0x00D0: /* request_line_event */
962 if (arglist[1].ptrflag)
963 glk_request_line_event(arglist[0].opaqueref, arglist[2].array,
964 arglist[3].uint, arglist[4].uint);
966 glk_request_line_event(arglist[0].opaqueref, NULL,
969 case 0x00D1: /* cancel_line_event */
970 if (arglist[1].ptrflag) {
972 glk_cancel_line_event(arglist[0].opaqueref, &dat);
973 arglist[2].uint = dat.type;
974 arglist[3].opaqueref = dat.win;
975 arglist[4].uint = dat.val1;
976 arglist[5].uint = dat.val2;
979 glk_cancel_line_event(arglist[0].opaqueref, NULL);
982 case 0x00D2: /* request_char_event */
983 glk_request_char_event(arglist[0].opaqueref);
985 case 0x00D3: /* cancel_char_event */
986 glk_cancel_char_event(arglist[0].opaqueref);
988 case 0x00D4: /* request_mouse_event */
989 glk_request_mouse_event(arglist[0].opaqueref);
991 case 0x00D5: /* cancel_mouse_event */
992 glk_cancel_mouse_event(arglist[0].opaqueref);
994 case 0x00D6: /* request_timer_events */
995 glk_request_timer_events(arglist[0].uint);
998 #ifdef GLK_MODULE_IMAGE
999 case 0x00E0: /* image_get_info */
1002 glui32 *ptr1, *ptr2;
1003 if (!arglist[ix].ptrflag) {
1008 ptr1 = &(arglist[ix].uint);
1011 if (!arglist[ix].ptrflag) {
1016 ptr2 = &(arglist[ix].uint);
1020 arglist[ix].uint = glk_image_get_info(arglist[0].uint, ptr1, ptr2);
1023 case 0x00E1: /* image_draw */
1024 arglist[5].uint = glk_image_draw(arglist[0].opaqueref,
1026 arglist[2].sint, arglist[3].sint);
1028 case 0x00E2: /* image_draw_scaled */
1029 arglist[7].uint = glk_image_draw_scaled(arglist[0].opaqueref,
1031 arglist[2].sint, arglist[3].sint,
1032 arglist[4].uint, arglist[5].uint);
1034 case 0x00E8: /* window_flow_break */
1035 glk_window_flow_break(arglist[0].opaqueref);
1037 case 0x00E9: /* window_erase_rect */
1038 glk_window_erase_rect(arglist[0].opaqueref,
1039 arglist[1].sint, arglist[2].sint,
1040 arglist[3].uint, arglist[4].uint);
1042 case 0x00EA: /* window_fill_rect */
1043 glk_window_fill_rect(arglist[0].opaqueref, arglist[1].uint,
1044 arglist[2].sint, arglist[3].sint,
1045 arglist[4].uint, arglist[5].uint);
1047 case 0x00EB: /* window_set_background_color */
1048 glk_window_set_background_color(arglist[0].opaqueref, arglist[1].uint);
1050 #endif /* GLK_MODULE_IMAGE */
1052 #ifdef GLK_MODULE_SOUND
1053 case 0x00F0: /* schannel_iterate */
1054 if (arglist[1].ptrflag)
1055 arglist[4].opaqueref = glk_schannel_iterate(arglist[0].opaqueref, &arglist[2].uint);
1057 arglist[3].opaqueref = glk_schannel_iterate(arglist[0].opaqueref, NULL);
1059 case 0x00F1: /* schannel_get_rock */
1060 arglist[2].uint = glk_schannel_get_rock(arglist[0].opaqueref);
1062 case 0x00F2: /* schannel_create */
1063 arglist[2].opaqueref = glk_schannel_create(arglist[0].uint);
1065 case 0x00F3: /* schannel_destroy */
1066 glk_schannel_destroy(arglist[0].opaqueref);
1068 case 0x00F8: /* schannel_play */
1069 arglist[3].uint = glk_schannel_play(arglist[0].opaqueref, arglist[1].uint);
1071 case 0x00F9: /* schannel_play_ext */
1072 arglist[5].uint = glk_schannel_play_ext(arglist[0].opaqueref,
1073 arglist[1].uint, arglist[2].uint, arglist[3].uint);
1075 case 0x00FA: /* schannel_stop */
1076 glk_schannel_stop(arglist[0].opaqueref);
1078 case 0x00FB: /* schannel_set_volume */
1079 glk_schannel_set_volume(arglist[0].opaqueref, arglist[1].uint);
1081 case 0x00FC: /* sound_load_hint */
1082 glk_sound_load_hint(arglist[0].uint, arglist[1].uint);
1084 #endif /* GLK_MODULE_SOUND */
1086 #ifdef GLK_MODULE_HYPERLINKS
1087 case 0x0100: /* set_hyperlink */
1088 glk_set_hyperlink(arglist[0].uint);
1090 case 0x0101: /* set_hyperlink_stream */
1091 glk_set_hyperlink_stream(arglist[0].opaqueref, arglist[1].uint);
1093 case 0x0102: /* request_hyperlink_event */
1094 glk_request_hyperlink_event(arglist[0].opaqueref);
1096 case 0x0103: /* cancel_hyperlink_event */
1097 glk_cancel_hyperlink_event(arglist[0].opaqueref);
1099 #endif /* GLK_MODULE_HYPERLINKS */
1101 #ifdef GLK_MODULE_UNICODE
1102 case 0x0120: /* buffer_to_lower_case_uni */
1103 if (arglist[0].ptrflag)
1104 arglist[5].uint = glk_buffer_to_lower_case_uni(arglist[1].array, arglist[2].uint, arglist[3].uint);
1106 arglist[3].uint = glk_buffer_to_lower_case_uni(NULL, 0, arglist[1].uint);
1108 case 0x0121: /* buffer_to_upper_case_uni */
1109 if (arglist[0].ptrflag)
1110 arglist[5].uint = glk_buffer_to_upper_case_uni(arglist[1].array, arglist[2].uint, arglist[3].uint);
1112 arglist[3].uint = glk_buffer_to_upper_case_uni(NULL, 0, arglist[1].uint);
1114 case 0x0122: /* buffer_to_title_case_uni */
1115 if (arglist[0].ptrflag)
1116 arglist[6].uint = glk_buffer_to_title_case_uni(arglist[1].array, arglist[2].uint, arglist[3].uint, arglist[4].uint);
1118 arglist[4].uint = glk_buffer_to_title_case_uni(NULL, 0, arglist[1].uint, arglist[2].uint);
1120 case 0x0128: /* put_char_uni */
1121 glk_put_char_uni(arglist[0].uint);
1123 case 0x0129: /* put_string_uni */
1124 glk_put_string_uni(arglist[0].unicharstr);
1126 case 0x012A: /* put_buffer_uni */
1127 if (arglist[0].ptrflag)
1128 glk_put_buffer_uni(arglist[1].array, arglist[2].uint);
1130 glk_put_buffer_uni(NULL, 0);
1132 case 0x012B: /* put_char_stream_uni */
1133 glk_put_char_stream_uni(arglist[0].opaqueref, arglist[1].uint);
1135 case 0x012C: /* put_string_stream_uni */
1136 glk_put_string_stream_uni(arglist[0].opaqueref, arglist[1].unicharstr);
1138 case 0x012D: /* put_buffer_stream_uni */
1139 if (arglist[1].ptrflag)
1140 glk_put_buffer_stream_uni(arglist[0].opaqueref,
1141 arglist[2].array, arglist[3].uint);
1143 glk_put_buffer_stream_uni(arglist[0].opaqueref,
1146 case 0x0130: /* get_char_stream_uni */
1147 arglist[2].sint = glk_get_char_stream_uni(arglist[0].opaqueref);
1149 case 0x0131: /* get_buffer_stream_uni */
1150 if (arglist[1].ptrflag)
1151 arglist[5].uint = glk_get_buffer_stream_uni(arglist[0].opaqueref,
1152 arglist[2].array, arglist[3].uint);
1154 arglist[3].uint = glk_get_buffer_stream_uni(arglist[0].opaqueref,
1157 case 0x0132: /* get_line_stream_uni */
1158 if (arglist[1].ptrflag)
1159 arglist[5].uint = glk_get_line_stream_uni(arglist[0].opaqueref,
1160 arglist[2].array, arglist[3].uint);
1162 arglist[3].uint = glk_get_line_stream_uni(arglist[0].opaqueref,
1165 case 0x0138: /* stream_open_file_uni */
1166 arglist[4].opaqueref = glk_stream_open_file_uni(arglist[0].opaqueref, arglist[1].uint,
1169 case 0x0139: /* stream_open_memory_uni */
1170 if (arglist[0].ptrflag)
1171 arglist[6].opaqueref = glk_stream_open_memory_uni(arglist[1].array,
1172 arglist[2].uint, arglist[3].uint, arglist[4].uint);
1174 arglist[4].opaqueref = glk_stream_open_memory_uni(NULL,
1175 0, arglist[1].uint, arglist[2].uint);
1177 case 0x0140: /* request_char_event_uni */
1178 glk_request_char_event_uni(arglist[0].opaqueref);
1180 case 0x0141: /* request_line_event_uni */
1181 if (arglist[1].ptrflag)
1182 glk_request_line_event_uni(arglist[0].opaqueref, arglist[2].array,
1183 arglist[3].uint, arglist[4].uint);
1185 glk_request_line_event_uni(arglist[0].opaqueref, NULL,
1186 0, arglist[2].uint);
1188 #endif /* GLK_MODULE_UNICODE */
1190 #ifdef GLK_MODULE_UNICODE_NORM
1191 case 0x0123: /* buffer_canon_decompose_uni */
1192 if (arglist[0].ptrflag)
1193 arglist[5].uint = glk_buffer_canon_decompose_uni(arglist[1].array, arglist[2].uint, arglist[3].uint);
1195 arglist[3].uint = glk_buffer_canon_decompose_uni(NULL, 0, arglist[1].uint);
1197 case 0x0124: /* buffer_canon_normalize_uni */
1198 if (arglist[0].ptrflag)
1199 arglist[5].uint = glk_buffer_canon_normalize_uni(arglist[1].array, arglist[2].uint, arglist[3].uint);
1201 arglist[3].uint = glk_buffer_canon_normalize_uni(NULL, 0, arglist[1].uint);
1203 #endif /* GLK_MODULE_UNICODE_NORM */
1205 #ifdef GLK_MODULE_LINE_ECHO
1206 case 0x0150: /* set_echo_line_event */
1207 glk_set_echo_line_event(arglist[0].opaqueref, arglist[1].uint);
1209 #endif /* GLK_MODULE_LINE_ECHO */
1211 #ifdef GLK_MODULE_LINE_TERMINATORS
1212 case 0x0151: /* set_terminators_line_event */
1213 if (arglist[1].ptrflag)
1214 glk_set_terminators_line_event(arglist[0].opaqueref,
1215 arglist[2].array, arglist[3].uint);
1217 glk_set_terminators_line_event(arglist[0].opaqueref,
1220 #endif /* GLK_MODULE_LINE_TERMINATORS */
1222 #ifdef GLK_MODULE_DATETIME
1223 case 0x0160: /* current_time */
1224 if (arglist[0].ptrflag) {
1226 glk_current_time(&dat);
1227 arglist[1].sint = dat.high_sec;
1228 arglist[2].uint = dat.low_sec;
1229 arglist[3].sint = dat.microsec;
1232 glk_current_time(NULL);
1235 case 0x0161: /* current_simple_time */
1236 arglist[2].sint = glk_current_simple_time(arglist[0].uint);
1238 case 0x0168: /* time_to_date_utc */ {
1239 glktimeval_t timeval;
1240 glktimeval_t *timeptr = NULL;
1242 glkdate_t *dateptr = NULL;
1244 if (arglist[ix++].ptrflag) {
1246 timeval.high_sec = arglist[ix++].sint;
1247 timeval.low_sec = arglist[ix++].uint;
1248 timeval.microsec = arglist[ix++].sint;
1250 if (arglist[ix++].ptrflag) {
1253 glk_time_to_date_utc(timeptr, dateptr);
1255 arglist[ix++].sint = date.year;
1256 arglist[ix++].sint = date.month;
1257 arglist[ix++].sint = date.day;
1258 arglist[ix++].sint = date.weekday;
1259 arglist[ix++].sint = date.hour;
1260 arglist[ix++].sint = date.minute;
1261 arglist[ix++].sint = date.second;
1262 arglist[ix++].sint = date.microsec;
1266 case 0x0169: /* time_to_date_local */ {
1267 glktimeval_t timeval;
1268 glktimeval_t *timeptr = NULL;
1270 glkdate_t *dateptr = NULL;
1272 if (arglist[ix++].ptrflag) {
1274 timeval.high_sec = arglist[ix++].sint;
1275 timeval.low_sec = arglist[ix++].uint;
1276 timeval.microsec = arglist[ix++].sint;
1278 if (arglist[ix++].ptrflag) {
1281 glk_time_to_date_local(timeptr, dateptr);
1283 arglist[ix++].sint = date.year;
1284 arglist[ix++].sint = date.month;
1285 arglist[ix++].sint = date.day;
1286 arglist[ix++].sint = date.weekday;
1287 arglist[ix++].sint = date.hour;
1288 arglist[ix++].sint = date.minute;
1289 arglist[ix++].sint = date.second;
1290 arglist[ix++].sint = date.microsec;
1294 case 0x016A: /* simple_time_to_date_utc */ {
1296 glkdate_t *dateptr = NULL;
1298 if (arglist[ix++].ptrflag) {
1301 glk_simple_time_to_date_utc(arglist[0].sint, arglist[1].uint, dateptr);
1303 arglist[ix++].sint = date.year;
1304 arglist[ix++].sint = date.month;
1305 arglist[ix++].sint = date.day;
1306 arglist[ix++].sint = date.weekday;
1307 arglist[ix++].sint = date.hour;
1308 arglist[ix++].sint = date.minute;
1309 arglist[ix++].sint = date.second;
1310 arglist[ix++].sint = date.microsec;
1314 case 0x016B: /* simple_time_to_date_local */ {
1316 glkdate_t *dateptr = NULL;
1318 if (arglist[ix++].ptrflag) {
1321 glk_simple_time_to_date_local(arglist[0].sint, arglist[1].uint, dateptr);
1323 arglist[ix++].sint = date.year;
1324 arglist[ix++].sint = date.month;
1325 arglist[ix++].sint = date.day;
1326 arglist[ix++].sint = date.weekday;
1327 arglist[ix++].sint = date.hour;
1328 arglist[ix++].sint = date.minute;
1329 arglist[ix++].sint = date.second;
1330 arglist[ix++].sint = date.microsec;
1334 case 0x016C: /* date_to_time_utc */ {
1336 glkdate_t *dateptr = NULL;
1337 glktimeval_t timeval;
1338 glktimeval_t *timeptr = NULL;
1340 if (arglist[ix++].ptrflag) {
1342 date.year = arglist[ix++].sint;
1343 date.month = arglist[ix++].sint;
1344 date.day = arglist[ix++].sint;
1345 date.weekday = arglist[ix++].sint;
1346 date.hour = arglist[ix++].sint;
1347 date.minute = arglist[ix++].sint;
1348 date.second = arglist[ix++].sint;
1349 date.microsec = arglist[ix++].sint;
1351 if (arglist[ix++].ptrflag) {
1354 glk_date_to_time_utc(dateptr, timeptr);
1356 arglist[ix++].sint = timeval.high_sec;
1357 arglist[ix++].uint = timeval.low_sec;
1358 arglist[ix++].sint = timeval.microsec;
1362 case 0x016D: /* date_to_time_local */ {
1364 glkdate_t *dateptr = NULL;
1365 glktimeval_t timeval;
1366 glktimeval_t *timeptr = NULL;
1368 if (arglist[ix++].ptrflag) {
1370 date.year = arglist[ix++].sint;
1371 date.month = arglist[ix++].sint;
1372 date.day = arglist[ix++].sint;
1373 date.weekday = arglist[ix++].sint;
1374 date.hour = arglist[ix++].sint;
1375 date.minute = arglist[ix++].sint;
1376 date.second = arglist[ix++].sint;
1377 date.microsec = arglist[ix++].sint;
1379 if (arglist[ix++].ptrflag) {
1382 glk_date_to_time_local(dateptr, timeptr);
1384 arglist[ix++].sint = timeval.high_sec;
1385 arglist[ix++].uint = timeval.low_sec;
1386 arglist[ix++].sint = timeval.microsec;
1390 case 0x016E: /* date_to_simple_time_utc */ {
1392 glkdate_t *dateptr = NULL;
1394 if (arglist[ix++].ptrflag) {
1396 date.year = arglist[ix++].sint;
1397 date.month = arglist[ix++].sint;
1398 date.day = arglist[ix++].sint;
1399 date.weekday = arglist[ix++].sint;
1400 date.hour = arglist[ix++].sint;
1401 date.minute = arglist[ix++].sint;
1402 date.second = arglist[ix++].sint;
1403 date.microsec = arglist[ix++].sint;
1405 arglist[ix+2].sint = glk_date_to_simple_time_utc(dateptr, arglist[ix].uint);
1408 case 0x016F: /* date_to_simple_time_local */ {
1410 glkdate_t *dateptr = NULL;
1412 if (arglist[ix++].ptrflag) {
1414 date.year = arglist[ix++].sint;
1415 date.month = arglist[ix++].sint;
1416 date.day = arglist[ix++].sint;
1417 date.weekday = arglist[ix++].sint;
1418 date.hour = arglist[ix++].sint;
1419 date.minute = arglist[ix++].sint;
1420 date.second = arglist[ix++].sint;
1421 date.microsec = arglist[ix++].sint;
1423 arglist[ix+2].sint = glk_date_to_simple_time_local(dateptr, arglist[ix].uint);
1426 #endif /* GLK_MODULE_DATETIME */