X-Git-Url: https://jxself.org/git/?p=inform.git;a=blobdiff_plain;f=src%2Fobjects.c;fp=src%2Fobjects.c;h=9d54ec21a30e3537100aa49ffdddc6571fc7556a;hp=8dad7c34d0e0ecc1bb1a4ece45be344d63f527ce;hb=8760c1ba6442153afe76bcac742e086f90c59fe8;hpb=46cb3ffad9e3ed318a9109ff96421882f6642b2b diff --git a/src/objects.c b/src/objects.c index 8dad7c3..9d54ec2 100644 --- a/src/objects.c +++ b/src/objects.c @@ -6,9 +6,8 @@ /* checks syntax and translates such directives into */ /* specifications for the object-maker. */ /* */ -/* Copyright (c) Graham Nelson 1993 - 2020 */ -/* */ -/* This file is part of Inform. */ +/* Part of Inform 6.35 */ +/* copyright (c) Graham Nelson 1993 - 2020 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ @@ -21,7 +20,7 @@ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ -/* along with Inform. If not, see https://gnu.org/licenses/ */ +/* along with Inform. If not, see https://gnu.org/licenses/ * /* */ /* ------------------------------------------------------------------------- */ @@ -135,13 +134,20 @@ more than", get_next_token(); i = token_value; name = token_text; - if ((token_type != SYMBOL_TT) || (!(sflags[i] & UNKNOWN_SFLAG))) + if (token_type != SYMBOL_TT) { discard_token_location(beginning_debug_location); ebf_error("new attribute name", token_text); panic_mode_error_recovery(); put_token_back(); return; } + if (!(sflags[i] & UNKNOWN_SFLAG)) + { discard_token_location(beginning_debug_location); + ebf_symbol_error("new attribute name", token_text, typename(stypes[i]), slines[i]); + panic_mode_error_recovery(); + put_token_back(); + return; + } directive_keywords.enabled = TRUE; get_next_token(); @@ -226,13 +232,20 @@ Advanced game to get an extra 62)"); get_next_token(); i = token_value; name = token_text; - if ((token_type != SYMBOL_TT) || (!(sflags[i] & UNKNOWN_SFLAG))) + if (token_type != SYMBOL_TT) { discard_token_location(beginning_debug_location); ebf_error("new property name", token_text); panic_mode_error_recovery(); put_token_back(); return; } + if (!(sflags[i] & UNKNOWN_SFLAG)) + { discard_token_location(beginning_debug_location); + ebf_symbol_error("new property name", token_text, typename(stypes[i]), slines[i]); + panic_mode_error_recovery(); + put_token_back(); + return; + } directive_keywords.enabled = TRUE; get_next_token(); @@ -1081,12 +1094,7 @@ static void properties_segment_z(int this_segment) { if (stypes[token_value]==INDIVIDUAL_PROPERTY_T) this_identifier_number = svals[token_value]; else - { char already_error[128]; - sprintf(already_error, - "\"%s\" is a name already in use (with type %s) \ -and may not be used as a property name too", - token_text, typename(stypes[token_value])); - error(already_error); + { ebf_symbol_error("property name", token_text, typename(stypes[token_value]), slines[token_value]); return; } } @@ -1350,12 +1358,7 @@ static void properties_segment_g(int this_segment) { if (stypes[token_value]==INDIVIDUAL_PROPERTY_T) this_identifier_number = svals[token_value]; else - { char already_error[128]; - sprintf(already_error, - "\"%s\" is a name already in use (with type %s) \ -and may not be used as a property name too", - token_text, typename(stypes[token_value])); - error(already_error); + { ebf_symbol_error("property name", token_text, typename(stypes[token_value]), slines[token_value]); return; } } @@ -1776,13 +1779,18 @@ inconvenience, please contact the maintainers."); } else { get_next_token(); - if ((token_type != SYMBOL_TT) - || (!(sflags[token_value] & UNKNOWN_SFLAG))) + if (token_type != SYMBOL_TT) { discard_token_location(beginning_debug_location); ebf_error("new class name", token_text); panic_mode_error_recovery(); return; } + if (!(sflags[token_value] & UNKNOWN_SFLAG)) + { discard_token_location(beginning_debug_location); + ebf_symbol_error("new class name", token_text, typename(stypes[token_value]), slines[token_value]); + panic_mode_error_recovery(); + return; + } } /* Each class also creates a modest object representing itself: */ @@ -1976,10 +1984,13 @@ extern void make_object(int nearby_flag, if (token_type == DQ_TT) textual_name = token_text; else - { if ((token_type != SYMBOL_TT) - || (!(sflags[token_value] & UNKNOWN_SFLAG))) + { if (token_type != SYMBOL_TT) { ebf_error("name for new object or its textual short name", token_text); + } + else if (!(sflags[token_value] & UNKNOWN_SFLAG)) { + ebf_symbol_error("new object", token_text, typename(stypes[token_value]), slines[token_value]); + } else { internal_name_symbol = token_value; strcpy(internal_name, token_text);