5 #include <libchimara/glk.h>
16 mainwin = glk_window_open(0, 0, 0, wintype_TextBuffer, 0);
20 glk_set_window(mainwin);
22 char *buffer = calloc(256, sizeof(char));
25 glk_put_string("Welcome to the style test\n");
27 glk_request_line_event(mainwin, buffer, 255, 0);
28 while(strncmp(buffer, "quit", 4))
31 if(ev.type == evtype_LineInput)
33 if( !strncmp(buffer, "help", 4) ) {
36 else if( !strncmp(buffer, "style", 4) ) {
39 else if( !strncmp(buffer, "link", 4) ) {
43 glk_put_string("Huh?\n");
45 glk_request_line_event(mainwin, buffer, 255, 0);
47 else if(ev.type == evtype_Hyperlink)
49 glk_cancel_line_event(mainwin, NULL);
51 glk_put_string("Link 1 was clicked\n");
53 glk_put_string("Link 2 was clicked\n");
54 glk_request_line_event(mainwin, buffer, 255, 0);
58 glk_cancel_line_event(mainwin, NULL);
59 glk_window_clear(mainwin);
65 glk_set_style(style_Normal);
66 glk_put_string("Normal\n");
68 glk_set_style(style_Emphasized);
69 glk_put_string("Emphasized\n");
71 glk_set_style(style_Preformatted);
72 glk_put_string("Preformatted\n");
74 glk_set_style(style_Header);
75 glk_put_string("Header\n");
77 glk_set_style(style_Subheader);
78 glk_put_string("Subheader\n");
80 glk_set_style(style_Alert);
81 glk_put_string("Alert\n");
83 glk_set_style(style_Note);
84 glk_put_string("Note\n");
86 glk_set_style(style_BlockQuote);
87 glk_put_string("BlockQuote\n");
89 glk_set_style(style_Input);
90 glk_put_string("Input\n");
92 glk_set_style(style_User1);
93 glk_put_string("User1\n");
95 glk_set_style(style_User2);
96 glk_put_string("User2\n");
98 glk_set_style(style_Normal);
103 glk_set_hyperlink(1);
104 glk_put_string("This is link 1\n");
105 glk_set_hyperlink(2);
106 glk_put_string("This is link 2\n");
107 glk_set_hyperlink(0);
108 glk_request_hyperlink_event(mainwin);
113 glk_put_string("The following commands are supported:\n - help (this help text)\n - style (perform style test)\n - link (perform hyperlink test)\n - quit (quit the program)\n");