size_t len = strlen (path);
path = canonicalize_header_name (NULL, loc, true, path, len);
auto packet = mapper->IncludeTranslate (path, Cody::Flags::None, len);
- int xlate = false;
+
+ enum class xlate_kind {
+ unknown, text, import,
+ } translate = xlate_kind::unknown;
+
if (packet.GetCode () == Cody::Client::PC_BOOL)
- xlate = -int (packet.GetInteger ());
+ translate = packet.GetInteger () ? xlate_kind::text : xlate_kind::unknown;
else if (packet.GetCode () == Cody::Client::PC_PATHNAME)
{
/* Record the CMI name for when we do the import. */
module_state *import = get_module (build_string (len, path));
import->set_filename (packet);
- xlate = +1;
+ translate = xlate_kind::import;
}
else
{
}
bool note = false;
- if (note_include_translate_yes && xlate > 1)
+ if (note_include_translate_yes && translate == xlate_kind::import)
note = true;
- else if (note_include_translate_no && xlate == 0)
+ else if (note_include_translate_no && translate == xlate_kind::unknown)
note = true;
else if (note_includes)
/* We do not expect the note_includes vector to be large, so O(N)
note = true;
if (note)
- inform (loc, xlate
+ inform (loc, translate == xlate_kind::import
? G_("include %qs translated to import")
- : G_("include %qs processed textually") , path);
+ : G_("include %qs processed textually"), path);
- dump () && dump (xlate ? "Translating include to import"
+ dump () && dump (translate == xlate_kind::import
+ ? "Translating include to import"
: "Keeping include as include");
dump.pop (0);
- if (!(xlate > 0))
+ if (translate != xlate_kind::import)
return nullptr;
/* Create the translation text. */