diff options
| -rw-r--r-- | engines/glk/archetype/archetype.cpp | 47 | ||||
| -rw-r--r-- | engines/glk/archetype/interpreter.cpp | 18 | ||||
| -rw-r--r-- | engines/glk/archetype/misc.cpp | 9 | ||||
| -rw-r--r-- | engines/glk/archetype/sys_object.cpp | 5 | 
4 files changed, 38 insertions, 41 deletions
| diff --git a/engines/glk/archetype/archetype.cpp b/engines/glk/archetype/archetype.cpp index d17f0c753c..572aea4012 100644 --- a/engines/glk/archetype/archetype.cpp +++ b/engines/glk/archetype/archetype.cpp @@ -283,26 +283,27 @@ bool Archetype::send_message(int transport, int message_sent, int recipient,  		r._kind = IDENT;  		r._data._ident.ident_kind = OBJECT_ID;  		r._data._ident.ident_int = context.self; -		wrapout(" : ", false); +		 +		debugN(" : ");  		display_result(r);  		if (transport == OP_SEND) -			wrapout(" sending ", false); +			debugN(" sending ");  		else -			wrapout(" passing ", false); +			debugN(" passing ");  		if (index_xarray(Vocabulary, message_sent, p)) {  			String str = String::format("'%s'", ((StringPtr)p)->c_str()); -			wrapout(str, false); +			debugN(str.c_str());  		}  		if (transport == OP_SEND_TO_TYPE)  			r._data._ident.ident_kind = TYPE_ID; -		wrapout(" to ", false); +		debugN(" to ");  		r._data._ident.ident_int = recipient;  		display_result(r); -		wrapout("", true); +		debug("");  	}  	// Trying to send a message to a destroyed object results in UNDEFINED @@ -680,11 +681,11 @@ void Archetype::eval_expr(ExprTree the_expr, ResultType &result, ContextType &co  		cleanup(r2);  		if (DebugMan.isDebugChannelEnabled(DEBUG_EXPR)) { -			wrapout(" -- ", false); +			debugN(" -- ");  			display_expr(the_expr); -			wrapout("  ==>  ", false); +			debugN("  ==>  ");  			display_result(result); -			wrapout("", true); +			debug("");  		}  	} else {  		switch (desired) { @@ -732,7 +733,7 @@ void Archetype::exec_stmt(StatementPtr the_stmt, ResultType &result, ContextType  	verbose = DebugMan.isDebugChannelEnabled(DEBUG_STMT);  	if (verbose) -		wrapout(" == ", false); +		debugN(" == ");  	switch (the_stmt->_kind) {  	case COMPOUND: @@ -774,27 +775,27 @@ void Archetype::exec_stmt(StatementPtr the_stmt, ResultType &result, ContextType  		if (verbose) {  			switch (the_stmt->_kind) {  			case ST_WRITE: -				wrapout("write ", false); +				debugN("write ");  				break;  			case ST_WRITES: -				wrapout("writes ", false); +				debugN("writes ");  				break;  			case ST_STOP: -				wrapout("stop ", false); +				debugN("stop ");  				break;  			default:  				break;  			} -			wrapout(" ", false); +			debugN(" ");  			np = nullptr;  			while (iterate_list(the_stmt->_data._write.print_list, np)) {  				display_expr((ExprTree)np->data);  				if (np->next != the_stmt->_data._write.print_list) -					wrapout(", ", false); +					debugN(", ");  			} -			wrapout("", true); +			debug("");  		}  		np = nullptr; @@ -816,28 +817,28 @@ void Archetype::exec_stmt(StatementPtr the_stmt, ResultType &result, ContextType  	case ST_IF:  		if (verbose) { -			wrapout("if: Testing ", false); +			debugN("if: Testing ");  			display_expr(the_stmt->_data._if.condition);  		}  		if (eval_condition(the_stmt->_data._if.condition, context)) {  			if (verbose) -				wrapout(" Evaluated true; executing then branch", true); +				debug(" Evaluated true; executing then branch");  			exec_stmt(the_stmt->_data._if.then_branch, result, context);  		}  		else if (the_stmt->_data._if.else_branch != nullptr) {  			if (verbose) -				wrapout(" Evaluated false; executing else branch", true); +				debug(" Evaluated false; executing else branch");  			exec_stmt(the_stmt->_data._if.else_branch, result, context);  		}  		break;  	case ST_CASE:  		if (verbose) { -			wrapout("case ", false); +			debugN("case ");  			display_expr(the_stmt->_data._case.test_expr); -			wrapout(" of", false); -			wrapout("", true); +			debugN(" of"); +			debug("");  		}  		eval_expr(the_stmt->_data._case.test_expr, r1, context, RVALUE); @@ -957,7 +958,7 @@ void Archetype::exec_stmt(StatementPtr the_stmt, ResultType &result, ContextType  	}  	if (verbose) -		wrapout("", true);		// finish off dangling lines +		debug("");		// finish off dangling lines  }  } // End of namespace Archetype diff --git a/engines/glk/archetype/interpreter.cpp b/engines/glk/archetype/interpreter.cpp index c88f584b3f..0ace84e58a 100644 --- a/engines/glk/archetype/interpreter.cpp +++ b/engines/glk/archetype/interpreter.cpp @@ -352,16 +352,16 @@ void write_result(ResultType &result) {  	undefine(r1);  	if (result._kind == STR_PTR) -		wrapout(*result._data._str.acl_str, false); +		debugN(result._data._str.acl_str->c_str());  	else if (result._kind == RESERVED) -		wrapout(Reserved_Wds[result._data._reserved.keyword], false); +		debugN(Reserved_Wds[result._data._reserved.keyword]);  	else {  		if (result._kind == ATTR_PTR)  			copy_result(r1, *(ResultType *)result._data._attr.acl_attr->data);  		else  			copy_result(r1, result);  		if (convert_to(STR_PTR, r1)) -			wrapout(*r1._data._str.acl_str, false); +			debugN(r1._data._str.acl_str->c_str());  		cleanup(r1);  	}  } @@ -385,10 +385,10 @@ void display_result(ResultType &result) {  	}  	if (enclose != " ") -		wrapout(enclose, false); +		debugN(enclose.c_str());  	write_result(result);  	if (enclose != " ") -		wrapout(enclose, false); +		debugN(enclose.c_str());  }  void display_expr(ExprTree the_tree) { @@ -396,15 +396,15 @@ void display_expr(ExprTree the_tree) {  		display_result(*the_tree);  	} else {  		if (Binary[the_tree->_data._oper.op_name]) { -			wrapout(" (", false); +			debugN(" (");  			display_expr(the_tree->_data._oper.left); -			wrapout(") ", false); +			debugN(") ");  		}  		wrapout(Operators[the_tree->_data._oper.op_name], false); -		wrapout(" (", false); +		debugN(" (");  		display_expr(the_tree->_data._oper.right); -		wrapout(") ", false); +		debugN(") ");  	}  } diff --git a/engines/glk/archetype/misc.cpp b/engines/glk/archetype/misc.cpp index 3818e3107b..066c6c9225 100644 --- a/engines/glk/archetype/misc.cpp +++ b/engines/glk/archetype/misc.cpp @@ -126,12 +126,9 @@ void add_bytes(int delta) {  	Bytes += delta;  	if (DebugMan.isDebugChannelEnabled(DEBUG_BYTES)) { -		if (delta >= 0) -			g_vm->write("Allocated   "); -		else -			g_vm->write("Deallocated "); - -		g_vm->writeln("%.3d bytes.  Current consumed memory: %.6d", ABS(delta), Bytes); +		String line = (delta >= 0) ? "Allocated   " : "Deallocated "; +		line += String::format("%.3d bytes.  Current consumed memory: %.6d", ABS(delta), Bytes); +		debug(line.c_str());  	}  } diff --git a/engines/glk/archetype/sys_object.cpp b/engines/glk/archetype/sys_object.cpp index 761d14ef60..955067196d 100644 --- a/engines/glk/archetype/sys_object.cpp +++ b/engines/glk/archetype/sys_object.cpp @@ -254,9 +254,8 @@ void send_to_system(int transport, String &strmsg, ResultType &result, ContextTy  			break;  		case DEBUG_MEMORY: -			wrapout("", true);			// get to beginning of line -			//g_vm->writeln("Maximum memory request: %d bytes", MaxAvail); -			//g_vm->writeln("Actual free memory:     %d bytes", MemAvail); +			//debug("Maximum memory request: %d bytes", MaxAvail); +			//debug("Actual free memory:     %d bytes", MemAvail);  			sys_state = IDLING;  			break; | 
