Debian Codegraph @

terps/alan2/glkstart.c

raw symbols SCIP
1 /* glkstart.c: Unix-specific startup code
2 Adapted for Alan by Joe Mason <[email protected]>
3 Based on the sample file designed by
4 Andrew Plotkin <[email protected]>
5 http://www.eblong.com/zarf/glk/index.html
6
7 Original release note follows:
8
9 This is Unix startup code for the simplest possible kind of Glk
10 program -- no command-line arguments; no startup files; no nothing.
11
12 Remember, this is a sample file. You should copy it into the Glk
13 program you are compiling, and modify it to your needs. This should
14 *not* be compiled into the Glk library itself.
15 */
16
17 #include "glk.h"
18 #include "glkstart.h"
19 #include "glkio.h"
20 #include "args.h"
21
22 #include "alan.version.h"
23
24 glkunix_argumentlist_t glkunix_arguments[] = {
25 { "-v", glkunix_arg_NoValue, "-v: verbose mode" },
26 { "-l", glkunix_arg_NoValue, "-l: log player command and game output" },
27 { "-i", glkunix_arg_NoValue, "-i: ignore version and checksum errors" },
28 { "-d", glkunix_arg_NoValue, "-d: enter debug mode" },
29 { "-t", glkunix_arg_NoValue, "-t: trace game execution" },
30 { "-s", glkunix_arg_NoValue, "-s: single instruction trace" },
31 { "", glkunix_arg_ValueFollows, "filename: The game file to load." },
32 { NULL, glkunix_arg_End, NULL }
33 };
34
35 int glkunix_startup_code(glkunix_startup_t *data)
36 {
37 /* first, open a window for error output */
38 glkMainWin = glk_window_open(0, 0, 0, wintype_TextBuffer, 0);
39 if (NULL == glkMainWin)
40 {
41 printf("FATAL ERROR: Cannot open initial window");
42 glk_exit();
43 }
44 glk_stylehint_set (wintype_TextGrid, style_User1, stylehint_ReverseColor, 1);
45 glkStatusWin = glk_window_open(glkMainWin, winmethod_Above |
46 winmethod_Fixed, 1, wintype_TextGrid, 0);
47 glk_set_window(glkMainWin);
48
49 /* now process the command line arguments */
50 args(data->argc, data->argv);
51
52 #ifdef GARGLK
53 garglk_set_program_name(alan.shortHeader);
54 garglk_set_program_info("Alan Interpreter 2.8.6 by Thomas Nilsson\n");
55 #endif
56
57 return TRUE;
58 }
59