Debian Codegraph @

terps/alan3/arun.c

raw symbols SCIP
1 /*----------------------------------------------------------------------* \
2
3 arun.c
4
5 Main program for interpreter for ALAN Adventure Language
6
7 \*----------------------------------------------------------------------*/
8 #include <locale.h>
9
10 #include "main.h"
11 #include "term.h"
12 #include "options.h"
13 #include "utils.h"
14 #include "memory.h"
15 #include "output.h"
16 #include "args.h"
17
18 #include "alan.version.h"
19
20 #ifdef HAVE_GLK
21 #include "glkio.h"
22 #ifdef HAVE_WINGLK
23 #include "WinGlk.h"
24 #else
25 #include "glk.h"
26 #endif
27 #endif
28
29
30 /*======================================================================
31
32 main()
33
34 Main program of main unit in Alan interpreter module, ARUN
35
36 */
37
38 #ifdef HAVE_GLK
39 void glk_main(void)
40 #else
41 int main(int argc, char *argv[])
42 #endif
43 {
44 /* Pick up any locale settings */
45 setlocale(LC_ALL, "");
46
47 /* Set up page format in case we get a system error */
48 lin = col = 1;
49 header->pageLength = 24;
50 header->pageWidth = 70;
51
52 getPageSize();
53
54 #ifdef HAVE_GLK
55 /* args() is then called from glkstart.c */
56 #else
57 args(argc, argv);
58
59 if (adventureFileName == NULL || strcmp(adventureFileName, "") == 0) {
60 printf("You should supply a game file to play.\n");
61 usage(PROGNAME);
62 free(adventureFileName);
63 terminate(1);
64 }
65 #endif
66
67 if ((debugOption || verboseOption) && !regressionTestOption) {
68 if (debugOption) printf("<");
69 #if (BUILD+0) != 0
70 printVersion(BUILD);
71 #else
72 printVersion(0);
73 #endif
74 if (debugOption) printf(">");
75 newline();
76 }
77
78 #ifdef HAVE_GARGLK
79 garglk_set_story_name(adventureName);
80 #endif
81
82 run();
83
84 #ifdef HAVE_GLK
85 return;
86 #else
87 return(EXIT_SUCCESS);
88 #endif
89 }