~ubuntu-branches/ubuntu/saucy/jzip/saucy

« back to all changes in this revision

Viewing changes to .pc/compiler-warnings/osdepend.c

  • Committer: Package Import Robot
  • Author(s): Niko Tyni
  • Date: 2012-03-25 22:42:35 UTC
  • Revision ID: package-import@ubuntu.com-20120325224235-aq5xki4sm298evr3
Tags: 210r20001005d-2
Adapt to zlib gzFile changes. (Closes: #664931)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/* $Id: osdepend.c,v 1.2 2000/05/25 22:28:56 jholder Exp $   
 
3
 * --------------------------------------------------------------------
 
4
 * see doc/License.txt for License Information   
 
5
 * --------------------------------------------------------------------
 
6
 * 
 
7
 * File name: $Id: osdepend.c,v 1.2 2000/05/25 22:28:56 jholder Exp $  
 
8
 *   
 
9
 * Description:    
 
10
 *    
 
11
 * Modification history:      
 
12
 * $Log: osdepend.c,v $
 
13
 * Revision 1.2  2000/05/25 22:28:56  jholder
 
14
 * changes routine names to reflect zmachine opcode names per spec 1.0
 
15
 *
 
16
 * Revision 1.1.1.1  2000/05/10 14:21:34  jholder
 
17
 *
 
18
 * imported
 
19
 *
 
20
 *
 
21
 * --------------------------------------------------------------------
 
22
 */
 
23
 
 
24
/*
 
25
 * osdepend.c
 
26
 *
 
27
 * All non screen specific operating system dependent routines.
 
28
 *
 
29
 * Olaf Barthel 28-Jul-1992
 
30
 * Modified John Holder(j-holder@home.com) 25-July-1995
 
31
 * Support for standalone storyfiles by Magnu Olsson (mol@df.lth.se) Nov.1995
 
32
 *
 
33
 */
 
34
 
 
35
#include "ztypes.h"
 
36
#include "jzexe.h"
 
37
 
 
38
/* File names will be O/S dependent */
 
39
 
 
40
#if defined(AMIGA)
 
41
#define SAVE_NAME     "Story.Save" /* Default save name */
 
42
#define SCRIPT_NAME   "PRT:"    /* Default script name */
 
43
#define RECORD_NAME   "Story.Record" /* Default record name */
 
44
#define AUXILARY_NAME "Story.Aux" /* Default auxilary name */
 
45
#else /* defined(AMIGA) */
 
46
#define SAVE_NAME     "story.sav" /* Default save name */
 
47
#define SCRIPT_NAME   "story.scr" /* Default script name */
 
48
#define RECORD_NAME   "story.rec" /* Default record name */
 
49
#define AUXILARY_NAME "story.aux" /* Default auxilary name */
 
50
#endif /* defined(AMIGA) */
 
51
 
 
52
 
 
53
#ifdef STRICTZ
 
54
 
 
55
/* Define stuff for stricter Z-code error checking, for the generic
 
56
 * Unix/DOS/etc terminal-window interface. Feel free to change the way
 
57
 * player prefs are specified, or replace report_zstrict_error()
 
58
 * completely if you want to change the way errors are reported. 
 
59
 */
 
60
 
 
61
/* There are four error reporting modes: never report errors;
 
62
 * report only the first time a given error type occurs; report
 
63
 * every time an error occurs; or treat all errors as fatal
 
64
 * errors, killing the interpreter. I strongly recommend
 
65
 * "report once" as the default. But you can compile in a
 
66
 * different default by changing the definition of
 
67
 * STRICTZ_DEFAULT_REPORT_MODE. In any case, the player can
 
68
 * specify a report mode on the command line by typing "-s 0"
 
69
 * through "-s 3". 
 
70
 */
 
71
 
 
72
#define STRICTZ_REPORT_NEVER  (0)
 
73
#define STRICTZ_REPORT_ONCE   (1)
 
74
#define STRICTZ_REPORT_ALWAYS (2)
 
75
#define STRICTZ_REPORT_FATAL  (3)
 
76
 
 
77
#define STRICTZ_DEFAULT_REPORT_MODE STRICTZ_REPORT_NEVER
 
78
 
 
79
static int strictz_report_mode;
 
80
static int strictz_error_count[STRICTZ_NUM_ERRORS];
 
81
 
 
82
#endif /* STRICTZ */
 
83
 
 
84
 
 
85
#if !defined(AMIGA)
 
86
 
 
87
/* getopt linkages */
 
88
 
 
89
extern int optind;
 
90
extern const char *optarg;
 
91
extern ZINT16 default_fg, default_bg;
 
92
 
 
93
#endif /* !defined(AMIGA) */
 
94
 
 
95
 
 
96
#if defined OS2 || defined __MSDOS__ 
 
97
int iPalette;                   
 
98
#endif 
 
99
 
 
100
 
 
101
 
 
102
#if !defined(AMIGA)
 
103
 
 
104
/*
 
105
 * process_arguments
 
106
 *
 
107
 * Do any argument preprocessing necessary before the game is
 
108
 * started. This may include selecting a specific game file or
 
109
 * setting interface-specific options.
 
110
 *
 
111
 */
 
112
 
 
113
void process_arguments( int argc, char *argv[] )
 
114
{
 
115
   int c, errflg = 0;
 
116
   int infoflag = 0;
 
117
   int size;
 
118
   int expected_args;
 
119
   int num;
 
120
 
 
121
#ifdef STRICTZ
 
122
   /* Initialize the STRICTZ variables. */
 
123
 
 
124
   strictz_report_mode = STRICTZ_DEFAULT_REPORT_MODE;
 
125
 
 
126
   for ( num = 0; num < STRICTZ_NUM_ERRORS; num++ )
 
127
   {
 
128
      strictz_error_count[num] = 0;
 
129
   }
 
130
#endif /* STRICTZ */
 
131
 
 
132
   /* Parse the options */
 
133
 
 
134
   monochrome = 0;
 
135
   hist_buf_size = 1024;
 
136
   bigscreen = 0;
 
137
 
 
138
#ifdef STRICTZ                  
 
139
#if defined OS2 || defined __MSDOS__ 
 
140
#define GETOPT_SET "gbomvzhy?l:c:k:r:t:s:" 
 
141
#elif defined TURBOC            
 
142
#define GETOPT_SET   "bmvzhy?l:c:k:r:t:s:" 
 
143
#elif defined HARD_COLORS       
 
144
#define GETOPT_SET    "mvzhy?l:c:k:r:t:s:f:b:" 
 
145
#else 
 
146
#define GETOPT_SET    "mvzhy?l:c:k:r:t:s:" 
 
147
#endif 
 
148
#else 
 
149
#if defined OS2 || defined __MSDOS__ 
 
150
#define GETOPT_SET "gbomvzhy?l:c:k:r:t:" 
 
151
#elif defined TURBOC            
 
152
#define GETOPT_SET   "bmvzhy?l:c:k:r:t:" 
 
153
#elif defined HARD_COLORS       
 
154
#define GETOPT_SET    "mvzhy?l:c:k:r:t:f:b:" 
 
155
#else 
 
156
#define GETOPT_SET    "mvzhy?l:c:k:r:t:" 
 
157
#endif 
 
158
#endif 
 
159
   while ( ( c = getopt( argc, argv, GETOPT_SET ) ) != EOF )
 
160
   {                            
 
161
      switch ( c )
 
162
      {
 
163
         case 'l':             /* lines */
 
164
            screen_rows = atoi( optarg );
 
165
            break;
 
166
         case 'c':             /* columns */
 
167
            screen_cols = atoi( optarg );
 
168
            break;
 
169
         case 'r':             /* right margin */
 
170
            right_margin = atoi( optarg );
 
171
            break;
 
172
         case 't':             /* top margin */
 
173
            top_margin = atoi( optarg );
 
174
            break;
 
175
         case 'k':             /* number of K for hist_buf_size */
 
176
            size = atoi( optarg );
 
177
            hist_buf_size = ( hist_buf_size > size ) ? hist_buf_size : size;
 
178
            if ( hist_buf_size > 16384 )
 
179
               hist_buf_size = 16384;
 
180
            break;
 
181
         case 'y':             /* Tandy */
 
182
            fTandy = 1;         
 
183
            break;              
 
184
#if defined OS2 || defined __MSDOS__ 
 
185
         case 'g':             /* Beyond Zork or other games using IBM graphics */
 
186
            fIBMGraphics = 1;   
 
187
            break;              
 
188
#endif 
 
189
         case 'v':             /* version information */
 
190
 
 
191
            fprintf( stdout, "\nJZIP - An Infocom Z-code Interpreter Program \n" );
 
192
            fprintf( stdout, "       %s %s\n", JZIPVER, JZIPRELDATE );
 
193
            if ( STANDALONE_FLAG )
 
194
            {
 
195
               fprintf( stdout, "       Standalone game: %s\n", argv[0] );
 
196
            }
 
197
            fprintf( stdout, "---------------------------------------------------------\n" );
 
198
            fprintf( stdout, "Author          :  %s\n", JZIPAUTHOR );
 
199
            fprintf( stdout, "Official Webpage: %s\n", JZIPURL );
 
200
            fprintf( stdout, "IF Archive      : ftp://ifarchive.org/infocom/interpreters/zip/\n" );
 
201
            fprintf( stdout, "         Based on ZIP 2.0 source code by Mark Howell\n\n" );
 
202
            fprintf( stdout,
 
203
                     "Bugs:    Please report bugs and portability bugs to the maintainer." );
 
204
            fprintf( stdout, "\n\nInterpreter:\n\n" );
 
205
            fprintf( stdout, "\tThis interpreter will run all Infocom V1 to V5 and V8 games.\n" );
 
206
            fprintf( stdout,
 
207
                     "\tThis is a Z-machine standard 1.0 interpreter, including support for\n" );
 
208
            fprintf( stdout, "\tthe Quetzal portable save file format, ISO 8859-1 (Latin-1)\n" );
 
209
            fprintf( stdout,
 
210
                     "\tinternational character support, and the extended save and load opcodes.\n" );
 
211
            fprintf( stdout, "\t\n" );
 
212
            infoflag++;
 
213
            break;
 
214
#if defined (HARD_COLORS)
 
215
         case 'f':
 
216
            default_fg = atoi( optarg );
 
217
            break;
 
218
         case 'b':
 
219
            default_bg = atoi( optarg );
 
220
            break;
 
221
#endif
 
222
#if defined OS2 || defined __MSDOS__ 
 
223
         case 'm':             /* monochrome */
 
224
            iPalette = 2;       
 
225
            break;              
 
226
         case 'b':             /* black-and-white */
 
227
            iPalette = 1;       
 
228
            break;              
 
229
         case 'o':             /* color */
 
230
            iPalette = 0;       
 
231
            break;              
 
232
#else 
 
233
         case 'm':
 
234
            monochrome = 1;
 
235
            break;
 
236
#endif 
 
237
#if defined TURBOC              
 
238
         case 'b':
 
239
            bigscreen = 1;
 
240
            break;
 
241
#endif 
 
242
#ifdef STRICTZ
 
243
         case 's':             /* strictz reporting mode */
 
244
            strictz_report_mode = atoi( optarg );
 
245
            if ( strictz_report_mode < STRICTZ_REPORT_NEVER ||
 
246
                 strictz_report_mode > STRICTZ_REPORT_FATAL )
 
247
            {
 
248
               errflg++;
 
249
            }
 
250
            break;
 
251
#endif /* STRICTZ */
 
252
 
 
253
         case 'z':
 
254
            print_license(  );
 
255
            infoflag++;
 
256
            break;
 
257
 
 
258
         case 'h':
 
259
         case '?':
 
260
         default:
 
261
            errflg++;
 
262
      }
 
263
   }
 
264
 
 
265
   if ( infoflag )
 
266
      exit( EXIT_SUCCESS );
 
267
 
 
268
   if ( STANDALONE_FLAG )
 
269
      expected_args = 0;
 
270
   else
 
271
      expected_args = 1;
 
272
 
 
273
   /* Display usage */
 
274
 
 
275
   if ( errflg || optind + expected_args != argc )
 
276
   {
 
277
 
 
278
      if ( STANDALONE_FLAG )
 
279
         fprintf( stdout, "usage: %s [options...]\n", argv[0] ); 
 
280
      else
 
281
         fprintf( stdout, "usage: %s [options...] story-file\n", argv[0] ); 
 
282
 
 
283
      fprintf( stdout, "JZIP - an Infocom story file interpreter.\n" );
 
284
      fprintf( stdout, "      Version %s by %s.\n", JZIPVER, JZIPAUTHOR );
 
285
      fprintf( stdout, "      Release %s.\n", JZIPRELDATE );
 
286
      fprintf( stdout, "      Based on ZIP V2.0 source by Mark Howell\n" );
 
287
      fprintf( stdout, "      Plays types 1-5 and 8 Infocom and Inform games.\n\n" );
 
288
      fprintf( stdout, "\t-l n lines in display\n" );
 
289
      fprintf( stdout, "\t-c n columns in display\n" );
 
290
      fprintf( stdout, "\t-r n text right margin (default = %d)\n", DEFAULT_RIGHT_MARGIN );
 
291
      fprintf( stdout, "\t-t n text top margin (default = %d)\n", DEFAULT_TOP_MARGIN );
 
292
      fprintf( stdout, "\t-k n set the size of the command history buffer to n bytes\n" );
 
293
      fprintf( stdout, "\t     (Default is 1024 bytes.  Maximum is 16384 bytes.)\n" );
 
294
      fprintf( stdout, "\t-y   turn on the legendary \"Tandy\" bit\n" ); 
 
295
      fprintf( stdout, "\t-v   display version information\n" );
 
296
      fprintf( stdout, "\t-h   display this usage information\n" );
 
297
 
 
298
#if defined (HARD_COLORS)
 
299
      fprintf( stdout, "\t-f n foreground color\n" );
 
300
      fprintf( stdout, "\t-b n background color (-1 to ignore bg color (try it on an Eterm))\n" );
 
301
      fprintf( stdout, "\t     Black=0 Red=1 Green=2 Yellow=3 Blue=4 Magenta=5 Cyan=6 White=7\n" );
 
302
#endif
 
303
      fprintf( stdout, "\t-m   force monochrome mode\n" ); 
 
304
#if defined __MSDOS__ || defined OS2 
 
305
      fprintf( stdout, "\t-b   force black-and-white mode\n" ); 
 
306
      fprintf( stdout, "\t-o   force color mode\n" ); 
 
307
      fprintf( stdout, "\t-g   use \"Beyond Zork\" graphics, rather than standard international\n" ); 
 
308
#elif defined TURBOC            
 
309
      fprintf( stdout, "\t-b   run in 43/50 line EGA/VGA mode\n" ); 
 
310
#endif 
 
311
 
 
312
#ifdef STRICTZ
 
313
      fprintf( stdout, "\t-s n stricter error checking (default = %d) (0: none; 1: report 1st\n",
 
314
               STRICTZ_DEFAULT_REPORT_MODE );
 
315
      fprintf( stdout, "\t     error; 2: report all errors; 3: exit after any error)\n" );
 
316
#endif /* STRICTZ */
 
317
 
 
318
      fprintf( stdout, "\t-z   display license information.\n" );
 
319
      exit( EXIT_FAILURE );
 
320
   }
 
321
 
 
322
   /* Open the story file */
 
323
 
 
324
   if ( !STANDALONE_FLAG )      /* mol 951115 */
 
325
      open_story( argv[optind] );
 
326
   else
 
327
   {
 
328
      /* standalone, ie. the .exe file _is_ the story file. */
 
329
      if ( argv[0][0] == 0 )
 
330
      {
 
331
         /* some OS's (ie DOS prior to v.3.0) don't supply the path to */
 
332
         /* the .exe file in argv[0]; in that case, we give up. (mol) */
 
333
         fatal( "process_arguments(): Sorry, this program will not run on this platform." );
 
334
      }
 
335
      open_story( argv[0] );
 
336
   }
 
337
 
 
338
}                               /* process_arguments */
 
339
 
 
340
#endif /* !defined(AMIGA) */
 
341
 
 
342
#if !defined(AMIGA)
 
343
 
 
344
/*
 
345
 * file_cleanup
 
346
 *
 
347
 * Perform actions when a file is successfully closed. Flag can be one of:
 
348
 * GAME_SAVE, GAME_RESTORE, GAME_SCRIPT.
 
349
 *
 
350
 */
 
351
 
 
352
void file_cleanup( const char *file_name, int flag )
 
353
{
 
354
   UNUSEDVAR( file_name );
 
355
   UNUSEDVAR( flag );
 
356
}                               /* file_cleanup */
 
357
 
 
358
#endif /* !defined(AMIGA) */
 
359
 
 
360
#if !defined(AMIGA)
 
361
 
 
362
/*
 
363
 * sound
 
364
 *
 
365
 * Play a sound file or a note.
 
366
 *
 
367
 * argc = 1: argv[0] = note# (range 1 - 3)
 
368
 *
 
369
 *           Play note.
 
370
 *
 
371
 * argc = 2: argv[0] = 0
 
372
 *           argv[1] = 3
 
373
 *
 
374
 *           Stop playing current sound.
 
375
 *
 
376
 * argc = 2: argv[0] = 0
 
377
 *           argv[1] = 4
 
378
 *
 
379
 *           Free allocated resources.
 
380
 *
 
381
 * argc = 3: argv[0] = ID# of sound file to replay.
 
382
 *           argv[1] = 2
 
383
 *           argv[2] = Volume to replay sound with, this value
 
384
 *                     can range between 1 and 8.
 
385
 *
 
386
 * argc = 4: argv[0] = ID# of sound file to replay.
 
387
 *           argv[1] = 2
 
388
 *           argv[2] = Control information
 
389
 *           argv[3] = Volume information
 
390
 *
 
391
 *           Volume information:
 
392
 *
 
393
 *               0x34FB -> Fade sound in
 
394
 *               0x3507 -> Fade sound out
 
395
 *               other  -> Replay sound at maximum volume
 
396
 *
 
397
 *           Control information:
 
398
 *
 
399
 *               This word is divided into two bytes,
 
400
 *               the upper byte determines the number of
 
401
 *               cycles to play the sound (e.g. how many
 
402
 *               times a clock chimes or a dog barks).
 
403
 *               The meaning of the lower byte is yet to
 
404
 *               be discovered :)
 
405
 *
 
406
 */
 
407
 
 
408
void sound( int argc, zword_t * argv )
 
409
{
 
410
 
 
411
   /* Supply default parameters */
 
412
 
 
413
   if ( argc < 4 )
 
414
      argv[3] = 0;
 
415
   if ( argc < 3 )
 
416
      argv[2] = 0xff;
 
417
   if ( argc < 2 )
 
418
      argv[1] = 2;
 
419
 
 
420
   /* Generic bell sounder */
 
421
 
 
422
   if ( argc == 1 || argv[1] == 2 )
 
423
      display_char( '\007' );
 
424
 
 
425
}                               /* sound */
 
426
 
 
427
#endif /* !defined(AMIGA) */
 
428
 
 
429
/*
 
430
 * get_file_name
 
431
 *
 
432
 * Return the name of a file. Flag can be one of:
 
433
 *    GAME_SAVE     - Save file (write only)
 
434
 *    GAME_RESTORE  - Save file (read only)
 
435
 *    GAME_SCRIPT   - Script file (write only)
 
436
 *    GAME_RECORD   - Keystroke record file (write only)
 
437
 *    GAME_PLABACK  - Keystroke record file (read only)
 
438
 *    GAME_SAVE_AUX - Auxilary (preferred settings) file (write only)
 
439
 *    GAME_LOAD_AUX - Auxilary (preferred settings) file (read only)
 
440
 */
 
441
 
 
442
int get_file_name( char *file_name, char *default_name, int flag )
 
443
{
 
444
   char buffer[127 + 2];        /* 127 is the biggest positive char */
 
445
   int status = 0;
 
446
 
 
447
   /* If no default file name then supply the standard name */
 
448
 
 
449
   if ( default_name[0] == '\0' )
 
450
   {
 
451
      if ( flag == GAME_SCRIPT )
 
452
         strcpy( default_name, SCRIPT_NAME );
 
453
      else if ( flag == GAME_RECORD || flag == GAME_PLAYBACK )
 
454
         strcpy( default_name, RECORD_NAME );
 
455
      else if ( flag == GAME_SAVE_AUX || GAME_LOAD_AUX )
 
456
         strcpy( default_name, AUXILARY_NAME );
 
457
      else                      /* (flag == GAME_SAVE || flag == GAME_RESTORE) */
 
458
         strcpy( default_name, SAVE_NAME );
 
459
   }
 
460
 
 
461
   /* Prompt for the file name */
 
462
 
 
463
   output_line( "Enter a file name." );
 
464
   output_string( "(Default is \"" );
 
465
   output_string( default_name );
 
466
   output_string( "\"): " );
 
467
 
 
468
   buffer[0] = 127;
 
469
   buffer[1] = 0;
 
470
   ( void ) get_line( buffer, 0, 0 );
 
471
 
 
472
   /* Copy file name from the input buffer */
 
473
 
 
474
   if ( h_type > V4 )
 
475
   {
 
476
      unsigned char len = buffer[1];
 
477
 
 
478
      memcpy( file_name, &buffer[2], len );
 
479
      file_name[len] = '\0';
 
480
   }
 
481
   else
 
482
      strcpy( file_name, &buffer[1] );
 
483
 
 
484
   /* If nothing typed then use the default name */
 
485
 
 
486
   if ( file_name[0] == '\0' )
 
487
      strcpy( file_name, default_name );
 
488
 
 
489
#if !defined(VMS)               /* VMS has file version numbers, so cannot overwrite */
 
490
 
 
491
   /* Check if we are going to overwrite the file */
 
492
 
 
493
   if ( flag == GAME_SAVE || flag == GAME_SCRIPT || flag == GAME_RECORD || flag == GAME_SAVE_AUX )
 
494
   {
 
495
      FILE *tfp;
 
496
 
 
497
#if defined BUFFER_FILES        
 
498
      char tfpbuffer[BUFSIZ];   
 
499
#endif 
 
500
      char c;
 
501
 
 
502
      /* Try to access the file */
 
503
 
 
504
      tfp = fopen( file_name, "r" );
 
505
      if ( tfp != NULL )
 
506
      {
 
507
         /* If it succeeded then prompt to overwrite */
 
508
 
 
509
#if defined BUFFER_FILES        
 
510
         setbuf( tfp, tfpbuffer ); 
 
511
#endif 
 
512
 
 
513
         output_line( "You are about to write over an existing file." );
 
514
         output_string( "Proceed? (Y/N) " );
 
515
 
 
516
         do
 
517
         {
 
518
            c = ( char ) input_character( 0 );
 
519
            c = ( char ) toupper( c );
 
520
         }
 
521
         while ( c != 'Y' && c != 'N' );
 
522
 
 
523
         output_char( c );
 
524
         output_new_line(  );
 
525
 
 
526
         /* If no overwrite then fail the routine */
 
527
 
 
528
         if ( c == 'N' )
 
529
            status = 1;
 
530
 
 
531
         fclose( tfp );
 
532
      }
 
533
   }
 
534
#endif /* !defined(VMS) */
 
535
 
 
536
   /* Record the file name if it was OK */
 
537
 
 
538
   if ( status == 0 )
 
539
      record_line( file_name );
 
540
 
 
541
   return ( status );
 
542
 
 
543
}                               /* get_file_name */
 
544
 
 
545
#if !defined(AMIGA)
 
546
 
 
547
/*
 
548
 * fatal
 
549
 *
 
550
 * Display message and stop interpreter.
 
551
 *
 
552
 */
 
553
 
 
554
void fatal( const char *s )
 
555
{
 
556
 
 
557
   reset_screen(  );
 
558
   fprintf( stderr, "\nFatal error: %s (PC = 0x%08lX)\n", s, pc );
 
559
#ifdef DEBUG_TERPRE
 
560
   fprintf( stdout, "\nFatal error: %s (PC = 0x%08lX)\n", s, pc );
 
561
#endif
 
562
   exit( 1 );
 
563
 
 
564
}                               /* fatal */
 
565
 
 
566
#endif /* !defined(AMIGA) */
 
567
 
 
568
/*
 
569
 * report_strictz_error
 
570
 *
 
571
 * This handles Z-code error conditions which ought to be fatal errors,
 
572
 * but which players might want to ignore for the sake of finishing the
 
573
 * game.
 
574
 *
 
575
 * The error is provided as both a numeric code and a string. This allows
 
576
 * us to print a warning the first time a particular error occurs, and
 
577
 * ignore it thereafter.
 
578
 *
 
579
 * errnum : Numeric code for error (0 to STRICTZ_NUM_ERRORS-1)
 
580
 * errstr : Text description of error
 
581
 *
 
582
 */
 
583
 
 
584
#ifdef STRICTZ
 
585
 
 
586
void report_strictz_error( int errnum, const char *errstr )
 
587
{
 
588
   int wasfirst;
 
589
   char buf[256] = { 0 };
 
590
 
 
591
   if ( errnum <= 0 || errnum >= STRICTZ_NUM_ERRORS )
 
592
      return;
 
593
 
 
594
   if ( strictz_report_mode == STRICTZ_REPORT_FATAL )
 
595
   {
 
596
      sprintf( buf, "STRICTZ: %s (PC = %lx)", errstr, pc );
 
597
      fatal( buf );
 
598
      return;
 
599
   }
 
600
 
 
601
   wasfirst = ( strictz_error_count[errnum] == 0 );
 
602
   strictz_error_count[errnum]++;
 
603
 
 
604
   if ( ( strictz_report_mode == STRICTZ_REPORT_ALWAYS ) ||
 
605
        ( strictz_report_mode == STRICTZ_REPORT_ONCE && wasfirst ) )
 
606
   {
 
607
      sprintf( buf, "STRICTZ Warning: %s (PC = %lx)", errstr, pc );
 
608
      write_string( buf );
 
609
 
 
610
      if ( strictz_report_mode == STRICTZ_REPORT_ONCE )
 
611
      {
 
612
         write_string( " (will ignore further occurrences)" );
 
613
      }
 
614
      else
 
615
      {
 
616
         sprintf( buf, " (occurrence %d)", strictz_error_count[errnum] );
 
617
         write_string( buf );
 
618
      }
 
619
      z_new_line(  );
 
620
   }
 
621
 
 
622
}                               /* report_strictz_error */
 
623
 
 
624
#endif /* STRICTZ */
 
625
 
 
626
 
 
627
#if !defined(AMIGA)
 
628
 
 
629
/*
 
630
 * fit_line
 
631
 *
 
632
 * This routine determines whether a line of text will still fit
 
633
 * on the screen.
 
634
 *
 
635
 * line : Line of text to test.
 
636
 * pos  : Length of text line (in characters).
 
637
 * max  : Maximum number of characters to fit on the screen.
 
638
 *
 
639
 */
 
640
int fit_line( const char *line_buffer, int pos, int max )
 
641
{
 
642
   UNUSEDVAR( line_buffer );
 
643
 
 
644
   return ( pos < max );
 
645
}                               /* fit_line */
 
646
 
 
647
#endif /* !defined(AMIGA) */
 
648
 
 
649
#if !defined(AMIGA)
 
650
 
 
651
/*
 
652
 * print_status
 
653
 *
 
654
 * Print the status line (type 3 games only).
 
655
 *
 
656
 * argv[0] : Location name
 
657
 * argv[1] : Moves/Time
 
658
 * argv[2] : Score
 
659
 *
 
660
 * Depending on how many arguments are passed to this routine
 
661
 * it is to print the status line. The rendering attributes
 
662
 * and the status line window will be have been activated
 
663
 * when this routine is called. It is to return FALSE if it
 
664
 * cannot render the status line in which case the interpreter
 
665
 * will use display_char() to render it on its own.
 
666
 *
 
667
 * This routine has been provided in order to support
 
668
 * proportional-spaced fonts.
 
669
 *
 
670
 */
 
671
 
 
672
int print_status( int argc, char *argv[] )
 
673
{
 
674
   UNUSEDVAR( argc );
 
675
   UNUSEDVAR( argv );
 
676
 
 
677
   return ( FALSE );
 
678
}                               /* print_status */
 
679
 
 
680
#endif /* !defined(AMIGA) */
 
681
 
 
682
#if !defined(AMIGA)
 
683
 
 
684
/*
 
685
 * set_font
 
686
 *
 
687
 * Set a new character font. Font can be either be:
 
688
 *
 
689
 *    TEXT_FONT (1)     = normal text character font
 
690
 *    GRAPHICS_FONT (3) = graphical character font
 
691
 *
 
692
 */
 
693
 
 
694
void set_font( int font_type )
 
695
{
 
696
   UNUSEDVAR( font_type );
 
697
}                               /* set_font */
 
698
 
 
699
#endif /* !defined(AMIGA) */
 
700
 
 
701
#if !defined MSDOS && !defined OS2 && !defined AMIGA && !defined HARD_COLORS && !defined ATARIST 
 
702
 
 
703
/*
 
704
 * set_colours
 
705
 *
 
706
 * Sets screen foreground and background colours.
 
707
 *
 
708
 */
 
709
 
 
710
void set_colours( zword_t foreground, zword_t background )
 
711
{
 
712
 
 
713
}                               /* set_colours */
 
714
 
 
715
#endif  /* !defined MSDOS && !defined OS2 && !defined AMIGA !defined HARD_COLORS && !defined ATARIST */ 
 
716
 
 
717
#if !defined VMS && !defined MSDOS && !defined OS2 && !defined POSIX 
 
718
 
 
719
/*
 
720
 * codes_to_text
 
721
 *
 
722
 * Translate Z-code characters to machine specific characters. These characters
 
723
 * include line drawing characters and international characters.
 
724
 *
 
725
 * The routine takes one of the Z-code characters from the following table and
 
726
 * writes the machine specific text replacement. The target replacement buffer
 
727
 * is defined by MAX_TEXT_SIZE in ztypes.h. The replacement text should be in a
 
728
 * normal C, zero terminated, string.
 
729
 *
 
730
 * Return 0 if a translation was available, otherwise 1.
 
731
 *
 
732
 *  Arrow characters (0x18 - 0x1b):
 
733
 *
 
734
 *  0x18 Up arrow
 
735
 *  0x19 Down arrow
 
736
 *  0x1a Right arrow
 
737
 *  0x1b Left arrow
 
738
 *
 
739
 *  International characters (0x9b - 0xa3):
 
740
 *
 
741
 *  0x9b a umlaut (ae)
 
742
 *  0x9c o umlaut (oe)
 
743
 *  0x9d u umlaut (ue)
 
744
 *  0x9e A umlaut (Ae)
 
745
 *  0x9f O umlaut (Oe)
 
746
 *  0xa0 U umlaut (Ue)
 
747
 *  0xa1 sz (ss)
 
748
 *  0xa2 open quote (>>)
 
749
 *  0xa3 close quota (<<)
 
750
 *
 
751
 *  Line drawing characters (0xb3 - 0xda):
 
752
 *
 
753
 *  0xb3 vertical line (|)
 
754
 *  0xba double vertical line (#)
 
755
 *  0xc4 horizontal line (-)
 
756
 *  0xcd double horizontal line (=)
 
757
 *  all other are corner pieces (+)
 
758
 *
 
759
 */
 
760
 
 
761
int codes_to_text( int c, char *s )
 
762
{
 
763
   return 1;
 
764
}                               /* codes_to_text */
 
765
 
 
766
#endif  /* !defined VMS && !defined MSDOS && !defined OS2 && !defined POSIX */