1 /*
2  * ztypes.h
3  *
4  * Any global stuff required by the C modules.
5  *
6  */
7 
8 #if !defined(__ZTYPES_INCLUDED)
9 #define __ZTYPES_INCLUDED
10 
11 #include <assert.h>
12 #include <ctype.h>
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <string.h>
16 #include <time.h>
17 
18 #if defined(MSDOS)
19 #include <malloc.h>
20 #endif /* MSDOS */
21 
22 #include <machine/endian.h>
23 
24 /* Try the endianness auto-detect. */
25 
26 #ifdef AUTO_END_MODE
27 #ifdef BYTE_ORDER
28 
29 #if BYTE_ORDER == BIG_ENDIAN
30 #define BIG_END_MODE
31 #endif
32 
33 #if BYTE_ORDER == LITTLE_ENDIAN
34 #define LITTLE_END_MODE
35 #endif
36 
37 #endif /* BYTE_ORDER */
38 #endif /* AUTO_END_MODE */
39 
40 /* Define bcopy() if necessary. */
41 
42 #ifdef NO_BCOPY
43 #define bcopy(s1,s2,l) (memcpy((s2),(s1),(l)))
44 #endif /* NO_BCOPY */
45 
46 /* Define which random functions we're gonna use. */
47 #ifdef LOUSY_RANDOM
48 #define RANDOM_FUNC rand
49 #define SRANDOM_FUNC srand
50 #else
51 #define RANDOM_FUNC random
52 #define SRANDOM_FUNC srandom
53 #endif
54 
55 /* Configuration options */
56 
57 #define DEFAULT_ROWS 24 /* Default screen height */
58 #define DEFAULT_COLS 80 /* Deafult screen width */
59 
60 /* Use the Quetzal save file format. This format is portable to other
61    interpreters, and is much smaller than standard save files.
62    However, it is not compatible with standard save files. So if
63    you start using a version of XZip with USE_QUETZAL compiled in,
64    all your old save files will stop working. */
65 #define USE_QUETZAL
66 
67 /* Perform stricter z-code error checking. If STRICTZ is #defined,
68    the interpreter will check for common opcode errors, such as reading
69    or writing properties of the "nothing" (0) object. When such an
70    error occurs, the opcode will call report_zstrict_error() and
71    then continue in some safe manner. This may mean doing nothing,
72    returning 0, or something like that.
73  See osdepend.c for the definition of report_zstrict_error(). Note that
74    this function may call fatal() to shut down the interpreter.
75  If STRICTZ is not #defined, the STRICTZ patch has no effect at all.
76    It does not even check to continue safely when an error occurs;
77    it just behaves the way ZIP has always behaved. This typically
78    means calling get_property_addr(0) or get_object_address(0),
79    which will return a meaningless value, and continuing on with
80    that. */
81 #define STRICTZ
82 
83 /* Global defines */
84 
85 #ifndef TRUE
86 #define TRUE 1
87 #endif
88 
89 #ifndef FALSE
90 #define FALSE 0
91 #endif
92 
93 #ifndef FILENAME_MAX
94 #define FILENAME_MAX 255
95 #endif
96 
97 #ifndef EXIT_SUCCESS
98 #define EXIT_SUCCESS 0
99 #endif
100 
101 #ifndef EXIT_FAILURE
102 #define EXIT_FAILURE 1
103 #endif
104 
105 #ifndef SEEK_SET
106 #define SEEK_SET 0
107 #endif
108 
109 #ifndef SEEK_END
110 #define SEEK_END 2
111 #endif
112 
113 #ifdef unix
114 
115 #define strchr(a, b) index (a, b)
116 #define memmove(a, b, c) bcopy (b, a, c)
117 
118 #define const
119 
120 #endif /* unix */
121 
122 /* Z types */
123 
124 typedef unsigned char zbyte_t;  /* unsigned 1 byte quantity */
125 typedef unsigned short zword_t; /* unsigned 2 byte quantity */
126 
127 /* Data file header format */
128 
129 typedef struct zheader {
130     zbyte_t type;
131     zbyte_t config;
132     zword_t version;
133     zword_t data_size;
134     zword_t start_pc;
135     zword_t words_offset;
136     zword_t objects_offset;
137     zword_t globals_offset;
138     zword_t restart_size;
139     zword_t flags;
140     zbyte_t release_date[6];
141     zword_t synonyms_offset;
142     zword_t file_size;
143     zword_t checksum;
144     zbyte_t interpreter;
145     zbyte_t interpreter_version;
146     zbyte_t screen_rows;
147     zbyte_t screen_columns;
148     zbyte_t screen_left;
149     zbyte_t screen_right;
150     zbyte_t screen_top;
151     zbyte_t screen_bottom;
152     zbyte_t max_char_width;
153     zbyte_t max_char_height;
154     zword_t filler1[3];
155     zword_t function_keys_offset;
156     zword_t filler2[2];
157     zword_t alternate_alphabet_offset;
158     zword_t mouse_position_offset;
159     zword_t filler3[4];
160 } zheader_t;
161 
162 #define H_TYPE 0
163 #define H_CONFIG 1
164 
165 #define CONFIG_BYTE_SWAPPED 0x01 /* Game data is byte swapped          - V3/V4 */
166 #define CONFIG_COLOUR       0x01 /* Game supports colour               - V5+   */
167 #define CONFIG_TIME         0x02 /* Status line displays time          - V3    */
168 #define CONFIG_MAX_DATA     0x04 /* Data area should 64K if possible   - V4+   */
169 #define CONFIG_TANDY        0x08 /* Tandy licensed game                - V3    */
170 #define CONFIG_EMPHASIS     0x08 /* Interpreter supports text emphasis - V4+   */
171 #define CONFIG_NOSTATUSLINE 0x10 /* Interpreter cannot support a status line   */
172 #define CONFIG_WINDOWS      0x20 /* Interpreter supports split screen mode     */
173 #define CONFIG_TIMEDINPUT   0x80 /* Interpreter supports timed input   - V5    */
174 
175 #define H_VERSION 2
176 #define H_DATA_SIZE 4
177 #define H_START_PC 6
178 #define H_WORDS_OFFSET 8
179 #define H_OBJECTS_OFFSET 10
180 #define H_GLOBALS_OFFSET 12
181 #define H_RESTART_SIZE 14
182 #define H_FLAGS 16
183 
184 #define SCRIPTING_FLAG 0x01
185 #define FIXED_FONT_FLAG 0x02
186 #define REFRESH_FLAG 0x04
187 #define GRAPHICS_FLAG 0x08
188 #define SOUND_FLAG 0x10          /* V4 */
189 #define UNDO_AVAILABLE_FLAG 0x10 /* V5 */
190 #define COLOUR_FLAG 0x40
191 #define NEW_SOUND_FLAG 0x80
192 
193 #define H_RELEASE_DATE 18
194 #define H_SYNONYMS_OFFSET 24
195 #define H_FILE_SIZE 26
196 #define H_CHECKSUM 28
197 #define H_INTERPRETER 30
198 
199 #define INTERP_GENERIC 0
200 #define INTERP_DEC_20 1
201 #define INTERP_APPLE_IIE 2
202 #define INTERP_MACINTOSH 3
203 #define INTERP_AMIGA 4
204 #define INTERP_ATARI_ST 5
205 #define INTERP_MSDOS 6
206 #define INTERP_CBM_128 7
207 #define INTERP_CBM_64 8
208 #define INTERP_APPLE_IIC 9
209 #define INTERP_APPLE_IIGS 10
210 #define INTERP_TANDY 11
211 
212 #define H_INTERPRETER_VERSION 31
213 #define H_SCREEN_ROWS 32
214 #define H_SCREEN_COLUMNS 33
215 #define H_SCREEN_LEFT 34
216 #define H_SCREEN_RIGHT 35
217 #define H_SCREEN_TOP 36
218 #define H_SCREEN_BOTTOM 37
219 #define H_MAX_CHAR_WIDTH 38
220 #define H_MAX_CHAR_HEIGHT 39
221 #define H_FILLER1 40
222 
223 #define H_FUNCTION_KEYS_OFFSET 46
224 #define H_FILLER2 48
225 
226 #define H_ALTERNATE_ALPHABET_OFFSET 52
227 #define H_MOUSE_POSITION_OFFSET 54
228 #define H_FILLER3 56
229 
230 #define V1 1
231 
232 #define V2 2
233 
234 /* Version 3 object format */
235 
236 #define V3 3
237 
238 typedef struct zobjectv3 {
239     zword_t attributes[2];
240     zbyte_t parent;
241     zbyte_t next;
242     zbyte_t child;
243     zword_t property_offset;
244 } zobjectv3_t;
245 
246 #define O3_ATTRIBUTES 0
247 #define O3_PARENT 4
248 #define O3_NEXT 5
249 #define O3_CHILD 6
250 #define O3_PROPERTY_OFFSET 7
251 
252 #define O3_SIZE 9
253 
254 #define PARENT3(offset) (offset + O3_PARENT)
255 #define NEXT3(offset) (offset + O3_NEXT)
256 #define CHILD3(offset) (offset + O3_CHILD)
257 
258 #define P3_MAX_PROPERTIES 0x20
259 
260 /* Version 4 object format */
261 
262 #define V4 4
263 
264 typedef struct zobjectv4 {
265     zword_t attributes[3];
266     zword_t parent;
267     zword_t next;
268     zword_t child;
269     zword_t property_offset;
270 } zobjectv4_t;
271 
272 #define O4_ATTRIBUTES 0
273 #define O4_PARENT 6
274 #define O4_NEXT 8
275 #define O4_CHILD 10
276 #define O4_PROPERTY_OFFSET 12
277 
278 #define O4_SIZE 14
279 
280 #define PARENT4(offset) (offset + O4_PARENT)
281 #define NEXT4(offset) (offset + O4_NEXT)
282 #define CHILD4(offset) (offset + O4_CHILD)
283 
284 #define P4_MAX_PROPERTIES 0x40
285 
286 #define V5 5
287 #define V8 8
288 
289 /* Interpreter states */
290 
291 #define STOP 0
292 #define RUN 1
293 
294 /* Call types */
295 
296 #define FUNCTION 0x0000
297 #define PROCEDURE 0x1000
298 #define ASYNC 0x2000
299 
300 #define ARGS_MASK 0x00FF
301 #define VARS_MASK 0x0F00
302 #define TYPE_MASK 0xF000
303 #define VAR_SHIFT 8
304 
305 /* Local defines */
306 
307 #ifdef PAGE_SIZE /* some systems have PAGE_SIZE defined in sys/limits.h */
308 #undef PAGE_SIZE
309 #endif
310 #define PAGE_SIZE 0x200
311 #define PAGE_MASK 0x1FF
312 #define PAGE_SHIFT 9
313 
314 #define STACK_SIZE 1024
315 
316 #define ON 1
317 #define OFF 0
318 #define RESET -1
319 
320 #define SCREEN 255
321 #define TEXT_WINDOW 0
322 #define STATUS_WINDOW 1
323 
324 #define NO_CHANGE_ATTRIBUTE (-1)
325 #define MIN_ATTRIBUTE 0
326 #define NORMAL 0
327 #define REVERSE 1
328 #define BOLD 2
329 #define EMPHASIS 4
330 #define FIXED_FONT 8
331 #define MAX_ATTRIBUTE 8
332 #define NUMFONTS (16) /* convenient --zarf */
333 
334 #define TEXT_FONT 1
335 #define GRAPHICS_FONT 3
336 
337 #define FOREGROUND 0
338 #define BACKGROUND 1
339 
340 #define GAME_RESTORE 0
341 #define GAME_SAVE 1
342 #define GAME_SCRIPT 2
343 #define GAME_RECORD 3
344 #define GAME_PLAYBACK 4
345 #define UNDO_SAVE 5
346 #define UNDO_RESTORE 6
347 #define GAME_SAVEDATA 7
348 #define GAME_RESTOREDATA 8
349 
350 #define MAX_TEXT_SIZE 8
351 
352 /* Data access macros */
353 
354 #define get_byte(offset) ((zbyte_t) datap[offset])
355 #define get_word(offset) ((zword_t) (((zword_t) datap[offset] << 8) + (zword_t) datap[offset + 1]))
356 #define set_byte(offset,value) datap[offset] = (zbyte_t) (value)
357 #define set_word(offset,value) datap[offset] = (zbyte_t) ((zword_t) (value) >> 8), datap[offset + 1] = (zbyte_t) ((zword_t) (value) & 0xff)
358 
359 /* External data */
360 
361 extern zbyte_t h_type;
362 extern zbyte_t h_config;
363 extern zword_t h_version;
364 extern zword_t h_data_size;
365 extern zword_t h_start_pc;
366 extern zword_t h_words_offset;
367 extern zword_t h_objects_offset;
368 extern zword_t h_globals_offset;
369 extern zword_t h_restart_size;
370 extern zword_t h_flags;
371 extern zword_t h_synonyms_offset;
372 extern zword_t h_file_size;
373 extern zword_t h_checksum;
374 extern zbyte_t h_interpreter;
375 extern zbyte_t h_interpreter_version;
376 extern zword_t h_alternate_alphabet_offset;
377 
378 extern int story_scaler;
379 extern int story_shift;
380 extern int property_mask;
381 extern int property_size_mask;
382 
383 extern zword_t stack[STACK_SIZE];
384 extern zword_t sp;
385 extern zword_t fp;
386 extern zword_t frame_count;
387 extern unsigned long pc;
388 extern int interpreter_state;
389 extern int interpreter_status;
390 
391 extern unsigned int data_size;
392 extern zbyte_t *datap;
393 extern zbyte_t *undo_datap;
394 
395 extern int screen_rows;
396 extern int screen_cols;
397 
398 extern int screen_window;
399 
400 extern int formatting;
401 extern int outputting;
402 extern int redirect_depth;
403 extern int scripting;
404 extern int scripting_disable;
405 extern int recording;
406 extern int replaying;
407 extern int font;
408 
409 extern int status_active;
410 extern int status_size;
411 
412 extern int lines_written;
413 extern int status_pos;
414 
415 /*extern char *line;
416  output buffering is now in xtext.c --zarf */
417 extern char *status_line;
418 
419 extern char lookup_table[3][26];
420 
421 extern int strictz_declare_spec;
422 
423 #ifdef STRICTZ
424 
425 /* Definitions for STRICTZ functions and error codes. */
426 
427 #ifdef __STDC__
428 void report_strictz_error (int, const char *);
429 #else /* __STDC__ */
430 void report_strictz_error ();
431 #endif /* __STDC__ */
432 
433 /* Reporting modes */
434 extern int strictz_report_mode;
435 #define STRICTZ_REPORT_NEVER (0)
436 #define STRICTZ_REPORT_ONCE (1)
437 #define STRICTZ_REPORT_ALWAYS (2)
438 #define STRICTZ_REPORT_FATAL (3)
439 #define STRICTZ_DEFAULT_REPORT_MODE STRICTZ_REPORT_ONCE
440 
441 /* Error codes */
442 #define STRZERR_NO_ERROR (0)
443 #define STRZERR_JIN (1)
444 #define STRZERR_GET_CHILD (2)
445 #define STRZERR_GET_PARENT (3)
446 #define STRZERR_GET_SIBLING (4)
447 #define STRZERR_GET_PROP_ADDR (5)
448 #define STRZERR_GET_PROP (6)
449 #define STRZERR_PUT_PROP (7)
450 #define STRZERR_CLEAR_ATTR (8)
451 #define STRZERR_SET_ATTR (9)
452 #define STRZERR_TEST_ATTR (10)
453 #define STRZERR_MOVE_OBJECT (11)
454 #define STRZERR_MOVE_OBJECT_2 (12)
455 #define STRZERR_REMOVE_OBJECT (13)
456 #define STRZERR_GET_NEXT_PROP (14)
457 #define STRICTZ_NUM_ERRORS (15)
458 
459 #endif /* STRICTZ */
460 
461 /* Global routines */
462 
463 /* control.c */
464 
465 #ifdef __STDC__
466 void check_argument (zword_t);
467 int call (int, zword_t *, int);
468 void get_fp (void);
469 void jump (zword_t);
470 void restart (void);
471 void restart_interp (int scripton_flag);
472 void ret (zword_t);
473 void unwind (zword_t, zword_t);
474 #else
475 void check_argument ();
476 int call ();
477 void get_fp ();
478 void jump ();
479 void restart ();
480 void restart_interp ();
481 void ret ();
482 void unwind ();
483 #endif
484 
485 /* fileio.c */
486 
487 #ifdef __STDC__
488 void close_record (void);
489 void close_script (void);
490 void close_story (void);
491 unsigned int get_story_size (void);
492 void open_playback (int);
493 void open_record (void);
494 void open_script (void);
495 void open_story (const char *);
496 int playback_key (void);
497 int playback_line (int, char *, int *);
498 void read_page (int, void *);
499 void record_key (int);
500 void record_line (const char *, int);
501 int restore (int, zword_t *);
502 int save (int, zword_t *);
503 void script_char (int);
504 void script_string (const char *);
505 void script_line (const char *, int);
506 void script_new_line (void);
507 void undo_restore (void);
508 void undo_save (void);
509 void verify (void);
510 #else
511 void close_record ();
512 void close_script ();
513 void close_story ();
514 unsigned int get_story_size ();
515 void open_playback ();
516 void open_record ();
517 void open_script ();
518 void open_story ();
519 int playback_key ();
520 int playback_line ();
521 void read_page ();
522 void record_key ();
523 void record_line ();
524 int restore ();
525 int save ();
526 void script_char ();
527 void script_string ();
528 void script_line ();
529 void script_new_line ();
530 void undo_restore ();
531 void undo_save ();
532 void verify ();
533 #endif
534 
535 /* getopt.c */
536 /* deleted --zarf */
537 
538 /* input.c */
539 
540 #ifdef __STDC__
541 int get_line (char *, zword_t, zword_t);
542 void read_character (int, zword_t *);
543 void read_line (int, zword_t *);
544 void tokenise (int, zword_t *);
545 #else
546 int get_line ();
547 void read_character ();
548 void read_line ();
549 void tokenise ();
550 #endif
551 
552 /* interpre.c */
553 
554 #ifdef __STDC__
555 int interpret (void);
556 #else
557 int interpret ();
558 #endif
559 
560 /* math.c */
561 
562 #ifdef __STDC__
563 void add (zword_t, zword_t);
564 void and (zword_t, zword_t);
565 void arith_shift (zword_t, zword_t);
566 void compare_je (int, zword_t *);
567 void compare_jg (zword_t, zword_t);
568 void compare_jl (zword_t, zword_t);
569 void compare_zero (zword_t);
570 void divide (zword_t, zword_t);
571 void multiply (zword_t, zword_t);
572 void not (zword_t);
573 void or (zword_t, zword_t);
574 void ziprandom (zword_t);
575 void remainder (zword_t, zword_t);
576 void shift (zword_t, zword_t);
577 void subtract (zword_t, zword_t);
578 void test (zword_t, zword_t);
579 #else
580 void add ();
581 void and ();
582 void arith_shift ();
583 void compare_je ();
584 void compare_jg ();
585 void compare_jl ();
586 void compare_zero ();
587 void divide ();
588 void multiply ();
589 void not ();
590 void or ();
591 void ziprandom ();
592 void remainder ();
593 void shift ();
594 void subtract ();
595 void test ();
596 #endif
597 
598 /* memory.c */
599 
600 #ifdef __STDC__
601 void load_cache (void);
602 void unload_cache (void);
603 zbyte_t read_code_byte (void);
604 zbyte_t read_data_byte (unsigned long *);
605 zword_t read_code_word (void);
606 zword_t read_data_word (unsigned long *);
607 #else
608 void load_cache ();
609 void unload_cache ();
610 zbyte_t read_code_byte ();
611 zbyte_t read_data_byte ();
612 zword_t read_code_word ();
613 zword_t read_data_word ();
614 #endif
615 
616 /* object.c */
617 
618 #ifdef __STDC__
619 void clear_attr (zword_t, zword_t);
620 void compare_parent_object (zword_t, zword_t);
621 void insert_object (zword_t, zword_t);
622 void load_child_object (zword_t);
623 void load_next_object (zword_t);
624 void load_parent_object (zword_t);
625 void remove_object (zword_t);
626 void set_attr (zword_t, zword_t);
627 void test_attr (zword_t, zword_t);
628 zword_t get_object_address (zword_t);
629 #else
630 void clear_attr ();
631 void compare_parent_object ();
632 void insert_object ();
633 void load_child_object ();
634 void load_next_object ();
635 void load_parent_object ();
636 void remove_object ();
637 void set_attr ();
638 void test_attr ();
639 zword_t get_object_address ();
640 #endif
641 
642 /* operand.c */
643 
644 #ifdef __STDC__
645 void conditional_jump (int);
646 void store_operand (zword_t);
647 void store_variable (int, zword_t);
648 zword_t load_operand (int);
649 zword_t load_variable (int);
650 #else
651 void conditional_jump ();
652 void store_operand ();
653 void store_variable ();
654 zword_t load_operand ();
655 zword_t load_variable ();
656 #endif
657 
658 /* osdepend.c */
659 
660 #ifdef __STDC__
661 int codes_to_text (int, char *);
662 void fatal (const char *);
663 void file_cleanup (const char *, int);
664 int fit_line (const char *, int, int);
665 int get_file_name (char *, char *, int);
666 int print_status (int, char *[]);
667 void process_arguments (int, char *[]);
668 void set_colours (int, int);
669 int set_font (int);
670 void sound (int, zword_t *);
671 #else
672 int codes_to_text ();
673 void fatal ();
674 void file_cleanup ();
675 int fit_line ();
676 int get_file_name ();
677 int print_status ();
678 void process_arguments ();
679 void set_colours ();
680 int set_font ();
681 void sound ();
682 #endif
683 
684 /* property.c */
685 
686 #ifdef __STDC__
687 void load_byte (zword_t, zword_t);
688 void load_next_property (zword_t, zword_t);
689 void load_property (zword_t, zword_t);
690 void load_property_address (zword_t, zword_t);
691 void load_property_length (zword_t);
692 void load_word (zword_t, zword_t);
693 void move_data (zword_t, zword_t, zword_t);
694 void scan_data (int, zword_t *);
695 void store_byte (zword_t, zword_t, zword_t);
696 void store_property (zword_t, zword_t, zword_t);
697 void store_word (zword_t, zword_t, zword_t);
698 #else
699 void load_byte ();
700 void load_next_property ();
701 void load_property ();
702 void load_property_address ();
703 void load_property_length ();
704 void load_word ();
705 void move_data ();
706 void scan_data ();
707 void store_byte ();
708 void store_property ();
709 void store_word ();
710 #endif
711 
712 /* quetzal.c */
713 
714 #ifdef __STDC__
715 int save_quetzal (FILE *, FILE *, long);
716 int restore_quetzal (FILE *, FILE *, long);
717 #else
718 int save_quetzal ();
719 int restore_quetzal ();
720 #endif
721 
722 /* screen.c */
723 
724 #ifdef __STDC__
725 void blank_status_line (void);
726 void display_status_line (void);
727 void erase_line (zword_t);
728 void erase_window (zword_t);
729 void output_char (int);
730 void output_new_line (void);
731 void output_string (const char *);
732 void output_line (const char *);
733 void print_window (int, zword_t *);
734 void select_window (zword_t);
735 void set_cursor_position (zword_t, zword_t);
736 void set_colour_attribute (zword_t, zword_t);
737 void set_font_attribute (zword_t);
738 void set_status_size (zword_t);
739 #else
740 void blank_status_line ();
741 void display_status_line ();
742 void erase_line ();
743 void erase_window ();
744 void output_char ();
745 void output_new_line ();
746 void output_string ();
747 void output_line ();
748 void print_window ();
749 void select_window ();
750 void set_cursor_position ();
751 void set_colour_attribute ();
752 void set_font_attribute ();
753 void set_status_size ();
754 #endif
755 
756 /* screenio.c */
757 
758 #ifdef __STDC__
759 int input_character (int);
760 void clear_line (void);
761 void clear_screen (void);
762 void clear_status_window (void);
763 void clear_text_window (void);
764 void create_status_window (int);
765 void delete_status_window (void);
766 void display_char (int);
767 int fit_line (const char *, int, int);
768 void get_cursor_position (int *, int *);
769 void initialize_screen (void);
770 int input_line (int, char *, int, int *, int);
771 void move_cursor (int, int);
772 int print_status (int, char *[]);
773 void reset_screen (void);
774 void restart_screen (void);
775 void restore_cursor_position (void);
776 void save_cursor_position (void);
777 void scroll_line (void);
778 void select_status_window (void);
779 void select_text_window (void);
780 void set_attribute (int);
781 #else
782 int input_character ();
783 void clear_line ();
784 void clear_screen ();
785 void clear_status_window ();
786 void clear_text_window ();
787 void create_status_window ();
788 void delete_status_window ();
789 void display_char ();
790 int fit_line ();
791 void get_cursor_position ();
792 void initialize_screen ();
793 int input_line ();
794 void move_cursor ();
795 int print_status ();
796 void reset_screen ();
797 void restart_screen ();
798 void restore_cursor_position ();
799 void save_cursor_position ();
800 void scroll_line ();
801 void select_status_window ();
802 void select_text_window ();
803 void set_attribute ();
804 #endif
805 
806 /* text.c */
807 
808 #ifdef __STDC__
809 void decode_text (unsigned long *);
810 void encode (zword_t, zword_t, zword_t, zword_t);
811 void encode_text (int, const char *, short *);
812 void flush_buffer (int);
813 void new_line (void);
814 void print_address (zword_t);
815 void print_character (zword_t);
816 void print_literal (void);
817 void print_number (zword_t);
818 void print_object (zword_t);
819 void print_offset (zword_t);
820 void print_time (int, int);
821 void println_return (void);
822 void command_opcode (zword_t);
823 void set_format_mode (zword_t);
824 void set_print_modes (zword_t, zword_t);
825 void set_video_attribute (zword_t);
826 void write_char (int);
827 void write_string (const char *);
828 void write_zchar (int);
829 #else
830 void decode_text ();
831 void encode ();
832 void encode_text ();
833 void flush_buffer ();
834 void new_line ();
835 void print_address ();
836 void print_character ();
837 void print_literal ();
838 void print_number ();
839 void print_object ();
840 void print_offset ();
841 void print_time ();
842 void println_return ();
843 void command_opcode ();
844 void set_format_mode ();
845 void set_print_modes ();
846 void set_video_attribute ();
847 void write_char ();
848 void write_string ();
849 void write_zchar ();
850 #endif
851 
852 /* variable.c */
853 
854 #ifdef __STDC__
855 void decrement (zword_t);
856 void decrement_check (zword_t, zword_t);
857 void increment (zword_t);
858 void increment_check (zword_t, zword_t);
859 void load (zword_t);
860 void pop_var (zword_t);
861 void push_var (zword_t);
862 #else
863 void decrement ();
864 void decrement_check ();
865 void increment ();
866 void increment_check ();
867 void load ();
868 void pop_var ();
869 void push_var ();
870 #endif
871 
872 #endif /* !defined(__ZTYPES_INCLUDED) */
873