+ #ifdef STRICTZ
+ if (obj == 0) {
+ report_strictz_error(STRZERR_REMOVE_OBJECT,
+ "@remove_object called with object 0");
+ return;
+ }
+ #endif
+
/* Get address of object to be removed */
assert (O3_ATTRIBUTES == O4_ATTRIBUTES);
+
+ #ifdef STRICTZ
+ if (obj == 0) {
+ report_strictz_error(STRZERR_CLEAR_ATTR,
+ "@clear_attr called with object 0");
+ return;
+ }
+ #endif
/* Get attribute address */
diff -c zip/osdepend.c zip_zs/osdepend.c
*** zip/osdepend.c Fri Jan 2 13:49:22 1998
--- zip_zs/osdepend.c Fri Jan 2 15:40:43 1998
***************
*** 21,26 ****
--- 21,56 ----
#define RECORD_NAME "record.lis" /* Default record name */
#endif /* defined(AMIGA) */
+ #ifdef STRICTZ
+
+ /* Define stuff for stricter Z-code error checking, for the generic
+ Unix/DOS/etc terminal-window interface. Feel free to change the way
+ player prefs are specified, or replace report_zstrict_error()
+ completely if you want to change the way errors are reported. */
+
+ /* There are four error reporting modes: never report errors;
+ report only the first time a given error type occurs; report
+ every time an error occurs; or treat all errors as fatal
+ errors, killing the interpreter. I strongly recommend
+ "report once" as the default. But you can compile in a
+ different default by changing the definition of
+ STRICTZ_DEFAULT_REPORT_MODE. In any case, the player can
+ specify a report mode on the command line by typing "-s 0"
+ through "-s 3". */
+
+ #define STRICTZ_REPORT_NEVER (0)
+ #define STRICTZ_REPORT_ONCE (1)
+ #define STRICTZ_REPORT_ALWAYS (2)
+ #define STRICTZ_REPORT_FATAL (3)
+
+ #define STRICTZ_DEFAULT_REPORT_MODE STRICTZ_REPORT_ONCE
+
+ static int strictz_report_mode;
+ static int strictz_error_count[STRICTZ_NUM_ERRORS];
+
+ #endif /* STRICTZ */
+
+
#if !defined(AMIGA)
diff -c zip/ztypes.h zip_zs/ztypes.h
*** zip/ztypes.h Fri Jan 2 13:49:24 1998
--- zip_zs/ztypes.h Fri Jan 2 15:48:11 1998
***************
*** 27,32 ****
--- 27,48 ----
#define DEFAULT_RIGHT_MARGIN 0 /* # of characters in right margin */
#define DEFAULT_TOP_MARGIN 0 /* # of lines left on screen before [MORE] message */
+ /* Perform stricter z-code error checking. If STRICTZ is #defined,
+ the interpreter will check for common opcode errors, such as reading
+ or writing properties of the "nothing" (0) object. When such an
+ error occurs, the opcode will call report_zstrict_error() and
+ then continue in some safe manner. This may mean doing nothing,
+ returning 0, or something like that.
+ See osdepend.c for the definition of report_zstrict_error(). Note that
+ this function may call fatal() to shut down the interpreter.
+ If STRICTZ is not #defined, the STRICTZ patch has no effect at all.
+ It does not even check to continue safely when an error occurs;
+ it just behaves the way ZIP has always behaved. This typically
+ means calling get_property_addr(0) or get_object_address(0),
+ which will return a meaningless value, and continuing on with
+ that. */
+ #define STRICTZ
+
/* Global defines */