-
Notifications
You must be signed in to change notification settings - Fork 1
/
heheader.h
1267 lines (1004 loc) · 30.1 KB
/
heheader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
HEHEADER.H
contains definitions and prototypes
for the Hugo Engine
Copyright (c) 1995-2006 by Kent Tessman
*/
#define HEVERSION 3
#define HEREVISION 1
#if !defined (COMPILE_V25)
#define HEINTERIM ".03"
#else
#define HEINTERIM ".03 (2.5)"
#endif
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
/* The Hugo token set and their respective values are contained
separately in htokens.h
*/
#include "htokens.h"
extern char *token[];
/* Define the compiler being used (or library) as one of:
ACORN
AMIGA
BEOS
DJGPP
GCC_OS2
GCC_UNIX
GCC_BEOS
GLK (Glk portable interface)
PALMOS (Palm OS built with CodeWarrior)
QUICKC
RISCOS
WIN32 (Microsoft Visual C++)
WXWINDOWS (wxWindows for Mac or Gtk)
(although this is typically done in the makefile)
*/
/*
Definitions for Emscripten
*/
#if defined (__EMSCRIPTEN__)
#include <unistd.h>
#define PORT_NAME "Emscripten"
#define PORTER_NAME "Juhana Leinonen"
#define PROMPTMORE_REPLACED
#define NO_TERMINAL_LINEFEED
#define EXTRA_STRING_FUNCTIONS
#define NO_STDIO_WINDOWS
#define FRONT_END
#define MAXPATH 256
#define MAXFILENAME 256
#define MAXDRIVE 256
#define MAXDIR 256
#define MAXEXT 256
#define DEF_PRN "/dev/lp"
#define DEF_FCOLOR 7 // white
#define DEF_BGCOLOR 0 // black
#define DEF_SLFCOLOR 15 // bright white
#define DEF_SLBGCOLOR 1 // blue
#define MAXBUFFER 1280
int hugojs_get_linelength(void);
#define ACTUAL_LINELENGTH() hugojs_get_linelength()
int hugojs_get_screenheight(void);
#define ACTUAL_SCREENHEIGHT() hugojs_get_screenheight()
#define HUGO_INLINE static inline
#define OPCODE_CONTROL_FILE "./HrCtlAPI"
extern char autosave_filename[];
int hugo_restore_autosave(char *filename);
#endif
/*---------------------------------------------------------------------------
Definitions for the Acorn Archimedes & RPC
using Acorn C Compiler (v4)
by Colin Turnbull
---------------------------------------------------------------------------*/
#if defined (ACORN)
#define PORT_NAME "Acorn"
#define PORTER_NAME "ct"
#define HUGO_FOPEN arc_fopen
#define MAXPATH 256
#define MAXFILENAME 64 /* We _could_ be using LongFilenames */
#define MAXDRIVE 32 /* arcfs#SCSIFS::harddisc4 ? */
#define MAXDIR 256
#define MAXEXT 32
#define isascii(c) ((unsigned int)(c)<0x80)
#define toascii(c) ((c)&0x7f)
#define DEF_PRN ""
#define DEF_FCOLOR 7
#define DEF_BGCOLOR 0
#define DEF_SLFCOLOR 15
#define DEF_SLBGCOLOR 1
#define MAXBUFFER 255
/* Added these functions for the Acorn port: */
FILE *arc_fopen(const char *, const char *);
void arc_colour(unsigned char n, unsigned int c);
#endif /* defined (ACORN) */
/*---------------------------------------------------------------------------
Definitions for the djgpp/Allegro build(s)
by Kent Tessman
---------------------------------------------------------------------------*/
#if defined (DJGPP) && !defined (GCC_UNIX)
#include <unistd.h>
#include <dir.h>
#define PORT_NAME "32-bit"
#define PORTER_NAME "Kent Tessman"
#define EXTRA_STRING_FUNCTIONS
#define DEF_PRN "LPT1"
/* MAXPATH, MAXDRIVE, MAXDIR, MAXEXT defined in <dir.h> */
#define MAXFILENAME MAXFILE
#define DEF_FCOLOR 7
#define DEF_BGCOLOR 0
#define DEF_SLFCOLOR 15
#define DEF_SLBGCOLOR 1
#define MAXBUFFER 255
#define HUGO_INLINE static __inline
#if defined (ALLEGRO)
#define FRONT_END
#define GRAPHICS_SUPPORTED
#define SOUND_SUPPORTED
#undef PORT_NAME
#define PORT_NAME "32-bit Allegro"
#if !defined (PROGRAM_NAME) && !defined (DEBUGGER)
#define PROGRAM_NAME "hegr"
#elif defined (DEBUGGER)
#define PROGRAM_NAME "hdgr"
#endif
#endif /* defined (ALLEGRO) */
#endif /* defined (DJGPP) */
/*---------------------------------------------------------------------------
Definitions for the Amiga port
by David Kinder
---------------------------------------------------------------------------*/
#if defined (AMIGA)
#define PORT_NAME "Amiga"
#define PORTER_NAME "David Kinder"
#define MAXPATH 256
#define MAXFILENAME 256
#define MAXDRIVE 256
#define MAXDIR 256
#define MAXEXT 256
#define DEF_PRN "PRT:"
#define DEF_FCOLOR 7
#define DEF_BGCOLOR 0
#define DEF_SLFCOLOR 15
#define DEF_SLBGCOLOR 1
#define MAXBUFFER 255
#endif /* defined (AMIGA) */
/*---------------------------------------------------------------------------
Definitions for the GCC Unix port
Originally by Bill Lash
---------------------------------------------------------------------------*/
#if defined (GCC_UNIX) || defined (GCC_BEOS)
#include <unistd.h>
#ifndef GCC_BEOS
#define PORT_NAME "Unix"
#ifndef DEBUGGER
#define PORTER_NAME "Bill Lash"
#else
#define PORTER_NAME "Kent Tessman"
#endif /* DEBUGGER */
#else
#define PORT_NAME "BeOS"
#define PORTER_NAME "Kent Tessman"
#endif /* GCC_BEOS */
#define EXTRA_STRING_FUNCTIONS
#define MAXPATH 256
#define MAXFILENAME 256
#define MAXDRIVE 256
#define MAXDIR 256
#define MAXEXT 256
#define DEF_PRN "/dev/lp" /* Bill suggests this is perhaps
a less-than-ideal choice for
the default printer */
#define DEF_FCOLOR 7
#define DEF_BGCOLOR 0
#define DEF_SLFCOLOR 15
#define DEF_SLBGCOLOR 1
#define MAXBUFFER 255
#define HUGO_INLINE static __inline
#endif /* defined (GCC_UNIX) */
/*---------------------------------------------------------------------------
Definitions for the GCC OS/2 port
by Gerald Bostock
---------------------------------------------------------------------------*/
#if defined (GCC_OS2)
#define PORT_NAME "OS/2"
#define PORTER_NAME "Gerald Bostock"
#define EXTRA_STRING_FUNCTIONS
#define MAXPATH 256
#define MAXFILENAME 256
#define MAXDRIVE 256
#define MAXDIR 256
#define MAXEXT 256
#define DEF_PRN "LPT1"
#define DEF_FCOLOR 7
#define DEF_BGCOLOR 0
#define DEF_SLFCOLOR 15
#define DEF_SLBGCOLOR 1
#define MAXBUFFER 255
#define HUGO_INLINE static __inline
#endif /* defined (GCC_OS2) */
/*---------------------------------------------------------------------------
Definitions for the MacOS Glk port
by Andrew Plotkin
---------------------------------------------------------------------------*/
#if defined (GLK) && defined (__MACOS__)
#define BUILD_RANDOM
#define RANDOM random
#define SRANDOM srandom
/* Some symbol redefinitions necessary on the Mac, due to conflicts
with Mac Toolbox names
*/
#define GetString HugoGetString
#define FindWord HugoFindWord
#endif /* Mac Glk */
/*---------------------------------------------------------------------------
Definitions for the Glk port
by Kent Tessman and Andrew Plotkin
---------------------------------------------------------------------------*/
#if defined (GLK)
#include "glk.h"
#define PORT_NAME "Glk"
#define PORTER_NAME "Kent Tessman and Andrew Plotkin"
#define HUGO_FILE strid_t
#define MAXPATH 256
#define MAXFILENAME 256
#define MAXDRIVE 256
#define MAXDIR 256
#define MAXEXT 256
#define DEF_PRN ""
#define DEF_FCOLOR 0
#define DEF_BGCOLOR 15
#define DEF_SLFCOLOR 15
#define DEF_SLBGCOLOR 1
#define MAXBUFFER 1280 /* larger than normal since Glk doesn't
break up paragraphs (1024+256)*/
#ifndef HUGO_INLINE
#define HUGO_INLINE __inline
#endif
#define FRONT_END
#define MINIMAL_INTERFACE
int heglk_get_linelength(void);
#define ACTUAL_LINELENGTH() heglk_get_linelength()
int heglk_get_screenheight(void);
#define ACTUAL_SCREENHEIGHT() heglk_get_screenheight()
void heglk_printfatalerror(char *err);
#define PRINTFATALERROR(a) heglk_printfatalerror(a)
#define EXTRA_STRING_FUNCTIONS
#ifndef isascii
#define isascii(c) (1)
#endif
#define tolower(c) (glk_char_to_lower((unsigned char)c))
#define toupper(c) (glk_char_to_upper((unsigned char)c))
/* Must always close Glk via glk_exit() */
#define exit(n) (glk_exit())
/* Glk doesn't use stdio; mapping these will cut radically down on
#ifdef sections in the source:
*/
#undef fclose
#define fclose(f) (glk_stream_close(f, NULL), 0)
#undef ferror
#define ferror(f) (0) /* No ferror() equivalent */
#undef fgetc
#define fgetc(f) (glk_get_char_stream(f))
#undef fgets
#define fgets(a, n, f) (glk_get_line_stream(f, a, n))
#undef fread
#define fread(a,s,n,f) (glk_get_buffer_stream(f, (char *)a, n))
#undef fprintf
#define fprintf(f,s,a) (glk_put_string_stream(f, a), 0)
#undef fputc
#define fputc(c, f) (glk_put_char_stream(f, (unsigned char)(c)), 0)
#undef fputs
#define fputs(s, f) (glk_put_buffer_stream(f, s, strlen(s)), 0)
#undef ftell
#define ftell(f) (glk_stream_get_position(f))
#undef fseek
#define fseek(f, p, m) (glk_stream_set_position(f, p, m), 0)
#undef SEEK_SET
#define SEEK_SET seekmode_Start
#undef SEEK_END
#define SEEK_END seekmode_End
#if defined (_WINDOWS)
#define SETTITLE_SUPPORTED
#define PRINTFATALERROR_SUPPLIED
#endif
#endif /* defined (GLK) */
/*---------------------------------------------------------------------------
Definitions for Palm OS (built with CodeWarrior)
by Kent Tessman
---------------------------------------------------------------------------*/
#if defined (PALMOS)
#include "palm_stdio.h"
#include "palm_ctype.h"
#include "palm_stdlib.h"
#include "palm_string.h"
#include "palm_time.h"
#define PORT_NAME "Palm OS"
#define PORTER_NAME "Kent Tessman"
#define HUGO_FILE PH_FILE*
#define HUGO_FOPEN ph_fopen
#define MAXFILENAME MAXPATH
/* No such thing as drive, directory, or extension in Palm OS */
#define MAXDRIVE 1
#define MAXDIR 1
#define MAXEXT 1
#define DEF_PRN ""
#define DEF_FCOLOR 16
#define DEF_BGCOLOR 17
#define DEF_SLFCOLOR 18
#define DEF_SLBGCOLOR 19
#define MAXBUFFER 256 /* max. input/output line length */
#define HUGO_INLINE __inline
#define NO_TERMINAL_LINEFEED
#define MINIMAL_WINDOWING
#define FRONT_END
#define SCROLLBACK_DEFINED
#define USE_TEXTBUFFER
#define TEXTBUFFER_FORMATTING
#define MAX_TEXTBUFFER_COUNT 100
#define USE_SMARTFORMATTING
extern void PopupMessage(char *title, char *msg);
extern char ph_debug;
#define PRINTFATALERROR PrintFatalError
#define PROMPTMORE_REPLACED
#define LOADGAMEDATA_REPLACED
#define RESTOREGAMEDATA_REPLACED
#define SAVEGAMEDATA_REPLACED
#define MEM(addr) GetMemValue(addr)
#define SETMEM(addr, n) SetMemValue(addr, n)
unsigned char GetMemValue(long addr);
void SetMemValue(long addr, unsigned char n);
#endif /* defined (PALMOS) */
/*---------------------------------------------------------------------------
Definitions for the RISC OS port
by Julian Arnold
---------------------------------------------------------------------------*/
#if defined (RISCOS)
#define PORT_NAME "RISC OS"
#define PORTER_NAME "Julian Arnold"
#define MAXPATH 256
#define MAXFILENAME 256
#define MAXDRIVE 256
#define MAXDIR 256
#define MAXEXT 256
#define DEF_PRN ""
#define DEF_FCOLOR 7
#define DEF_BGCOLOR 0
#define DEF_SLFCOLOR 0
#define DEF_SLBGCOLOR 7
#define MAXBUFFER 255
#define isascii(c) ((unsigned int)(c)<0x80)
extern FILE *hugo_fopen (char *filename, char *mode);
#define HUGO_FOPEN hugo_fopen
#endif /* defined (RISCOS) */
/*---------------------------------------------------------------------------
MS-DOS specific definitions for Microsoft QuickC
by Kent Tessman
---------------------------------------------------------------------------*/
#if defined (QUICKC)
#include <conio.h>
#define PORT_NAME "16-bit"
#define PORTER_NAME "Kent Tessman"
#define MATH_16BIT
#define MAXPATH _MAX_PATH /* maximum allowable lengths */
#define MAXFILENAME _MAX_FNAME
#define MAXDRIVE _MAX_DRIVE
#define MAXDIR _MAX_DIR
#define MAXEXT _MAX_EXT
#define DEF_PRN "LPT1" /* default printer */
#define DEF_FCOLOR 7 /* default colors, fore and back */
#define DEF_BGCOLOR 0
#define DEF_SLFCOLOR 15 /* statusline */
#define DEF_SLBGCOLOR 1
#define OMIT_EXTRA_STRING_FUNCTIONS
#define MAXBUFFER 255 /* max. input/output line length */
#endif /* defined (QUICKC) */
/*---------------------------------------------------------------------------
Definitions for Win32 (Microsoft Visual C++)
and WinCE (eVC++ 4.0/WCE SDK)
by Kent Tessman
---------------------------------------------------------------------------*/
#if defined (WIN32) && !defined (WXWINDOWS)
#ifdef UNDER_CE
#define PORT_NAME "WinCE"
#else
#define PORT_NAME "Win32"
#endif
#define PORTER_NAME "Kent Tessman"
#define DEF_PRN ""
#ifdef UNDER_CE
#define MAXPATH 260
#define MAXFILENAME 256
#define MAXDRIVE 3
#define MAXDIR 256
#define MAXEXT 256
#define getenv(a) ""
#else
#define MAXPATH _MAX_PATH
#define MAXFILENAME _MAX_FNAME
#define MAXDRIVE _MAX_DRIVE
#define MAXDIR _MAX_DIR
#define MAXEXT _MAX_EXT
#endif
#ifdef UNDER_CE
#define DEF_FCOLOR 0
#define DEF_BGCOLOR 15
#define DEF_SLFCOLOR 15
#define DEF_SLBGCOLOR 1
#else
#define DEF_FCOLOR 7
#define DEF_BGCOLOR 1
#define DEF_SLFCOLOR 15
#define DEF_SLBGCOLOR 0
#endif
#define MAXBUFFER 255
#define MAXUNDO 1024
#define HUGO_INLINE __inline
#define NO_TERMINAL_LINEFEED
#define BUILD_RANDOM
#define FRONT_END
#define USE_TEXTBUFFER
#define SCROLLBACK_DEFINED
#ifndef UNDER_CE
#ifndef USE_NT_SOUND_ONLY
#define SPEECH_ENABLED
#endif
#define USE_SMARTFORMATTING
#else
#define MINIMAL_WINDOWING
#endif // UNDER_CE
#undef FindResource
void PrintFatalError(char *a);
#define PRINTFATALERROR(a) PrintFatalError(a);
#endif /* defined (WIN32) */
/*---------------------------------------------------------------------------
Definitions for the wxWindows builds (wxGTK, wxMac, etc.)
and BeOS
by Kent Tessman
---------------------------------------------------------------------------*/
/* Metrowerks compiler shortcomings */
#if defined (__POWERPC__) && defined (__MWERKS__) && !defined (__MACOS__)
#define BEOS
#define isascii(c) (((c) & ~0x7f) == 0) /* If c is a 7 bit value */
#define resource_type hugo_resource_type
#endif
#if defined (WXWINDOWS) || (defined (BEOS) && !defined (GCC_UNIX) && !defined(GCC_BEOS))
#ifdef __MACOS__
#define GetString HugoGetString
#define FindWord HugoFindWord
#endif
#if defined (__MACOS__) || defined (BEOS)
#define USE_SMARTFORMATTING
#endif
#define PORTER_NAME "Kent Tessman"
#if defined (WXWINDOWS)
#define PORT_NAME "wxWindows"
#define PROGRAM_NAME "hewx"
#else
#define PORT_NAME "BeOS"
#define PROGRAM_NAME "BeHugo"
void exit_he_thread(int n);
#define exit(n) exit_he_thread(n)
#undef DEBUGGER
#endif
#define DEF_PRN ""
#define MAXPATH 256
#define MAXDRIVE 256
#define MAXDIR 256
#define MAXFILENAME 256
#define MAXEXT 256
#define DEF_FCOLOR 0
#define DEF_BGCOLOR 15
#define DEF_SLFCOLOR 15
#define DEF_SLBGCOLOR 1
#define MAXBUFFER 255
#define MAXUNDO 1024
#define HUGO_INLINE static __inline
#define NO_TERMINAL_LINEFEED
#define FRONT_END
#define USE_TEXTBUFFER
#ifndef __WXMAC__
#define SCROLLBACK_DEFINED
#endif
extern void PrintFatalError(char *a);
#define PRINTFATALERROR(a) PrintFatalError(a);
#endif /* defined (WXWINDOWS) || defined (BEOS) */
/*-------------------------------------------------------------------------*/
#if !defined (PROGRAM_NAME) && !defined (DEBUGGER)
#define PROGRAM_NAME "he"
#endif
#if !defined (MEM)
#define MEM(addr) (mem[addr])
#endif
#if !defined (SETMEM)
#define SETMEM(addr, n) (mem[addr] = n)
#endif
#if !defined (GETMEMADDR)
#define GETMEMADDR(addr) (&mem[addr])
#endif
#if !defined (HUGO_PTR)
#define HUGO_PTR
#endif
#if !defined (HUGO_FILE)
#define HUGO_FILE FILE*
#endif
#if !defined (HUGO_FOPEN)
#define HUGO_FOPEN fopen
#endif
#ifndef HUGO_INLINE
#define NO_INLINE_MEM_FUNCTIONS
#define HUGO_INLINE static
#endif
#if defined (BUILD_RANDOM)
extern int random(void);
extern void srandom(int);
#endif
#if !defined (PRINTFATALERROR)
#define PRINTFATALERROR(a) fprintf(stderr, "%s", a)
#endif
#ifndef OMIT_EXTRA_STRING_FUNCTIONS
#define EXTRA_STRING_FUNCTIONS
#endif
#ifdef LOADGAMEDATA_REPLACED
/* If LOADGAMEDATA_REPLACED is #defined, LoadGameData() is called by
both LoadGame() and RunRestart(). RunRestart() sets the reload flag
to true.
*/
int LoadGameData(char reload);
#endif
/* To be used with caution; obviously, not all non-zero values are "true"
in this usage.
*/
#define true 1
#define false 0
/* These static values are not changeable--they depend largely on internals
of the Engine.
*/
#define MAXATTRIBUTES 128
#define MAXGLOBALS 240
#define MAXLOCALS 16
#define MAXPOBJECTS 256 /* contenders for disambiguation */
#define MAXWORDS 32 /* in an input line */
#define MAXSTACKDEPTH 256 /* for nesting {...} */
#if !defined (MAXUNDO)
#define MAXUNDO 256 /* number of undoable operations */
#endif
#if !defined (COMPILE_V25)
#define MAX_CONTEXT_COMMANDS 32
#endif
enum ERROR_TYPE /* fatal errors */
{
MEMORY_E = 1, /* out of memory */
OPEN_E, /* error opening file */
READ_E, /* error reading from file */
WRITE_E, /* error writing to file */
EXPECT_VAL_E, /* expecting value */
UNKNOWN_OP_E, /* unknown operation */
ILLEGAL_OP_E, /* illegal operation */
OVERFLOW_E, /* overflow */
DIVIDE_E /* divide by zero */
};
/* The positions of various data in the header: */
#define H_GAMEVERSION 0x00
#define H_ID 0x01
#define H_SERIAL 0x03
#define H_CODESTART 0x0B
#define H_OBJTABLE 0x0D /* data tables */
#define H_PROPTABLE 0x0F
#define H_EVENTTABLE 0x11
#define H_ARRAYTABLE 0x13
#define H_DICTTABLE 0x15
#define H_SYNTABLE 0x17
#define H_INIT 0x19 /* junction routines */
#define H_MAIN 0x1B
#define H_PARSE 0x1D
#define H_PARSEERROR 0x1F
#define H_FINDOBJECT 0x21
#define H_ENDGAME 0x23
#define H_SPEAKTO 0x25
#define H_PERFORM 0x27
#define H_TEXTBANK 0x29
/* additional debugger header information */
#define H_DEBUGGABLE 0x3A
#define H_DEBUGDATA 0x3B
#define H_DEBUGWORKSPACE 0x3E
/* Printing control codes--embedded in strings printed by AP(). */
#define FONT_CHANGE 1
#define COLOR_CHANGE 2
#define NO_CONTROLCHAR 3
#define NO_NEWLINE 30
#define FORCED_SPACE 31 /* Can't be <= # colors/font codes + 1
(See AP() for the reason) */
/* Font control codes--these bitmasks follow FONT_CHANGE codes. */
#define NORMAL_FONT 0
#define BOLD_FONT 1
#define ITALIC_FONT 2
#define UNDERLINE_FONT 4
#define PROP_FONT 8
/* CHAR_TRANSLATION is simply a value that is added to an ASCII character
in order to encode the text, i.e., make it unreadable to casual
browsing.
*/
#define CHAR_TRANSLATION 0x14
/* Passed to GetWord() */
#define PARSE_STRING_VAL 0xFFF0
#define SERIAL_STRING_VAL 0xFFF1
/* Returned by FindWord() */
#define UNKNOWN_WORD 0xFFFF
/* Bitmasks for certain qualities of properties */
#define ADDITIVE_FLAG 1
#define COMPLEX_FLAG 2
/* Property-table indicators */
#define PROP_END 255
#define PROP_ROUTINE 255
enum RESOURCE_TYPE
{
JPEG_R, /* JPEG image */
WAVE_R, /* RIFF WAVE audio sample */
MOD_R, /* MOD music module */
S3M_R, /* S3M music module */
XM_R, /* XM music module */
MIDI_R, /* MIDI music */
MP3_R, /* MP3 audio layer */
AVI_R, /* Video for Windows */
MPEG_R, /* MPEG video */
UNKNOWN_R
};
/* A structure used for disambiguation in MatchObject(): */
struct pobject_structure
{
int obj; /* the actual object number */
char type; /* referred to by noun or adjective */
};
/* Structure used for navigating {...} blocks: */
struct CODE_BLOCK
{
int type; /* see #defines, below */
long brk; /* break address, or 0 to indicate NOP */
long returnaddr; /* used only for do-while loops */
#if defined (DEBUGGER)
int dbnest; /* for recovering from 'break' */
#endif
};
#define RESET_STACK_DEPTH (-1)
#define RUNROUTINE_BLOCK 1
#define CONDITIONAL_BLOCK 2
#define DOWHILE_BLOCK 3
#define TAIL_RECURSION_ROUTINE (-1)
#define TAIL_RECURSION_PROPERTY (-2)
/*-------------------------------------------------------------------------*/
/* (The following values are defined in he.c:) */
/* Library/engine globals */
extern const int object;
extern const int xobject;
extern const int self;
extern const int wordcount;
extern const int player;
extern const int actor;
extern const int location;
extern const int verbroutine;
extern const int endflag;
extern const int prompt;
extern const int objectcount;
extern const int system_status;
/* Library/engine properties */
extern const int before;
extern const int after;
extern const int noun;
extern const int adjective;
extern const int article;
/* "display" object properties */
extern const int screenwidth;
extern const int screenheight;
extern const int linelength;
extern const int windowlines;
extern const int cursor_column;
extern const int cursor_row;
extern const int hasgraphics;
extern const int title_caption;
extern const int hasvideo;
extern const int needs_repaint;
extern const int pointer_x;
extern const int pointer_y;
void *hugo_blockalloc(long num);
void hugo_blockfree(void *block);
int hugo_hasgraphics(void);
int hugo_charwidth(char a);
void hugo_cleanup_screen(void);
void hugo_clearfullscreen(void);
void hugo_clearwindow(void);
void hugo_closefiles(void);
void hugo_font(int f);
void hugo_getfilename(char *a, char *b);
int hugo_getkey(void);
void hugo_getline(char *p);
void hugo_init_screen(void);
void hugo_makepath(char *path, char *drive, char *dir, char *fname, char *ext);
int hugo_overwrite(char *f);
void hugo_print(char *a);
void hugo_scrollwindowup(void);
void hugo_setbackcolor(int c);
void hugo_setgametitle(char *t);
void hugo_settextcolor(int c);
void hugo_settextmode(void);
void hugo_settextpos(int x, int y);
void hugo_settextwindow(int left, int top, int right, int bottom);
void hugo_splitpath(char *path, char *drive, char *dir, char *fname, char *ext);
int hugo_strlen(char *a);
int hugo_textwidth(char *a);
int hugo_waitforkey(void);
int hugo_iskeywaiting(void);
int hugo_timewait(int n);
#if defined (SCROLLBACK_DEFINED)
void hugo_sendtoscrollback(char *a);
#endif
#if !defined (COMPILE_V25)
int hugo_hasvideo(void);
#endif
void hugo_set_window_width(int width);
/* he.c */
#if !defined (FRONT_END)
int main(int argc, char *argv[]);
#else
int he_main(int argc, char *argv[]);
#endif
void Banner(void);
extern int address_scale;
extern char program_path[];
/* hebuffer.c */
#ifdef USE_TEXTBUFFER
void TB_Init(void);
int TB_AddWord(char *w, int, int, int, int);
void TB_Remove(int n);
void TB_Scroll();
void TB_Clear(int, int, int, int);
char *TB_FindWord(int x, int y);
int TB_FirstCell(void);
#ifdef TEXTBUFFER_SAVEALL
int TB_AddWin(int, int, int, int);
#endif
extern int tb_selected;
extern char allow_text_selection;
#endif
/* heexpr.c */
int EvalExpr(int ptr);
int GetValue(void);
int Increment(int v, char inctype);
char IsIncrement(long addr);
void SetupExpr(void);
extern int var[];
extern int incdec;
extern char getaddress;
extern char inexpr;
extern char inobj;
/* hemisc.c */
void AP(char *a);
int CallRoutine(unsigned int addr);
void ContextCommand(void);
unsigned int Dict(void);
void FatalError(int e);
void FileIO(void);
void Flushpbuffer(void);
void GetCommand(void);
char *GetString(long addr);