From 8cdabe8914e1d166a997248d7a816aaab31b2f73 Mon Sep 17 00:00:00 2001 From: Kristof Szabados <Kristof.Szabados@ericsson.com> Date: Wed, 23 Nov 2016 13:51:27 +0100 Subject: [PATCH] more consistent boolean usage in the runtime parts Signed-off-by: Kristof Szabados <Kristof.Szabados@ericsson.com> --- compiler2/encdec.c | 2 +- compiler2/enum.c | 12 +-- compiler2/record.c | 112 +++++++++++------------ compiler2/record_of.c | 24 ++--- compiler2/union.c | 36 ++++---- core/ASN_Any.cc | 2 +- core/ASN_CharacterString.cc | 56 ++++++------ core/ASN_EmbeddedPDV.cc | 40 ++++---- core/ASN_External.cc | 40 ++++---- core/ASN_Null.cc | 2 +- core/Addfunc.cc | 14 +-- core/Addfunc.hh | 2 +- core/Array.hh | 10 +- core/Basetype.cc | 28 +++--- core/Basetype.hh | 18 ++-- core/Bitstring.cc | 34 +++---- core/Boolean.cc | 26 +++--- core/Charstring.cc | 28 +++--- core/Communication.cc | 8 +- core/Communication.hh | 6 +- core/Debugger.cc | 162 ++++++++++++++++----------------- core/Debugger.hh | 34 +++---- core/Encdec.cc | 4 +- core/Error.cc | 2 +- core/Fd_And_Timeout_User.hh | 36 ++++---- core/Float.cc | 70 +++++++------- core/Float.hh | 2 +- core/Hexstring.cc | 22 ++--- core/ILoggerPlugin.hh | 28 +++--- core/Integer.cc | 16 ++-- core/JSON.cc | 50 +++++----- core/LegacyLogger.cc | 132 +++++++++++++-------------- core/LegacyLogger.hh | 36 ++++---- core/Logger.cc | 56 ++++++------ core/Logger.hh | 18 ++-- core/LoggerPlugin.cc | 22 ++--- core/LoggerPlugin.hh | 24 ++--- core/LoggerPluginManager.cc | 102 ++++++++++----------- core/LoggerPluginManager.hh | 38 ++++---- core/LoggerPlugin_dynamic.cc | 8 +- core/LoggingBits.cc | 6 +- core/LoggingBits.hh | 6 +- core/Module_list.cc | 2 +- core/Objid.cc | 8 +- core/Octetstring.cc | 32 +++---- core/Optional.hh | 14 +-- core/Param_Types.cc | 42 ++++----- core/Param_Types.hh | 96 +++++++++---------- core/Port.cc | 50 +++++----- core/Port.hh | 6 +- core/Profiler.cc | 8 +- core/ProfilerTools.cc | 2 +- core/RAW.cc | 16 ++-- core/RAW.hh | 10 +- core/RInt.cc | 24 ++--- core/RInt.hh | 36 ++++---- core/Runtime.cc | 14 +-- core/Snapshot.cc | 56 ++++++------ core/Struct_of.cc | 4 +- core/Template.cc | 4 +- core/TitanLoggerControlImpl.cc | 6 +- core/Universal_charstring.cc | 130 +++++++++++++------------- core/Universal_charstring.hh | 8 +- core/Vector.hh | 3 +- core/Verdicttype.cc | 16 ++-- core/Verdicttype.hh | 2 +- core/XER.cc | 8 +- core/XER.hh | 12 +-- core/XmlReader.cc | 8 +- core/config_process.y | 2 +- core2/Basetype2.cc | 110 +++++++++++----------- 71 files changed, 1053 insertions(+), 1050 deletions(-) diff --git a/compiler2/encdec.c b/compiler2/encdec.c index 11a8ffcaa..a666643cb 100644 --- a/compiler2/encdec.c +++ b/compiler2/encdec.c @@ -242,7 +242,7 @@ void def_encdec(const char *p_classname, " TTCN_EncDec_ErrorContext::error_internal\n" " (\"No JSON descriptor available for type '%%s'.\", p_td.name);\n" " JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());\n" - " if(JSON_decode(p_td, tok, false)<0)\n" + " if(JSON_decode(p_td, tok, FALSE)<0)\n" " ec.error(TTCN_EncDec::ET_INCOMPL_MSG," "\"Can not decode type '%%s', because invalid or incomplete" " message was received\", p_td.name);\n" diff --git a/compiler2/enum.c b/compiler2/enum.c index c1d1d006b..761b55e53 100644 --- a/compiler2/enum.c +++ b/compiler2/enum.c @@ -241,7 +241,7 @@ void defEnumClass(const enum_def *edef, output_struct *output) /* Conversion function: enum_to_str */ def = mputprintf(def, "static const char *enum_to_str(%s enum_par%s);\n", enum_type, - edef->xerText ? ", boolean txt = false" : ""); + edef->xerText ? ", boolean txt = FALSE" : ""); src = mputprintf(src, "const char *%s::enum_to_str(%s enum_par%s)\n" "{\n" "switch (enum_par) {\n", name, enum_type, @@ -669,7 +669,7 @@ void defEnumClass(const enum_def *edef, output_struct *output) " int encoded_length=(int)p_buf.get_len();\n" " const boolean e_xer = is_exer(p_flavor);\n" " p_flavor |= (SIMPLE_TYPE | BXER_EMPTY_ELEM);\n" - " if (begin_xml(p_td, p_buf, p_flavor, p_indent, false) == -1) " + " if (begin_xml(p_td, p_buf, p_flavor, p_indent, FALSE) == -1) " "--encoded_length;\n" " if (!e_xer) p_buf.put_c('<');\n" , name @@ -690,7 +690,7 @@ void defEnumClass(const enum_def *edef, output_struct *output) " p_buf.put_s(strlen(enumval), (const unsigned char*)enumval);\n" " }\n" " if (!e_xer) p_buf.put_s(2, (const unsigned char*)\"/>\");\n" - " end_xml(p_td, p_buf, p_flavor, p_indent, false);\n" + " end_xml(p_td, p_buf, p_flavor, p_indent, FALSE);\n" , edef->xerText ? ", e_xer" : "" ); src = mputstr(src, @@ -809,7 +809,7 @@ void defEnumClass(const enum_def *edef, output_struct *output) " json_token_t token = JSON_TOKEN_NONE;\n" " char* value = 0;\n" " size_t value_len = 0;\n" - " boolean error = false;\n" + " boolean error = FALSE;\n" " int dec_len = 0;\n" " boolean use_default = p_td.json->default_value && 0 == p_tok.get_buffer_length();\n" " if (use_default) {\n" @@ -829,10 +829,10 @@ void defEnumClass(const enum_def *edef, output_struct *output) " enum_value = str_to_enum(value + (use_default ? 0 : 1));\n" " if (!use_default) value[value_len - 1] = '\\\"';\n" " if (%s == enum_value) {\n" - " error = true;\n" + " error = TRUE;\n" " }\n" " } else {\n" - " error = true;\n" + " error = TRUE;\n" " }\n" " } else {\n" " enum_value = %s;\n" diff --git a/compiler2/record.c b/compiler2/record.c index 4cf831439..51a23f827 100644 --- a/compiler2/record.c +++ b/compiler2/record.c @@ -568,7 +568,7 @@ char* generate_raw_coding(char* src, " if (!is_bound()) TTCN_EncDec_ErrorContext::error" "(TTCN_EncDec::ET_UNBOUND, \"Encoding an unbound value.\");\n" " int encoded_length = 0;\n" - " myleaf.isleaf = false;\n" + " myleaf.isleaf = FALSE;\n" " myleaf.body.node.num_of_nodes = %lu;\n" " myleaf.body.node.nodes = init_nodes_of_enc_tree(%lu);\n", (unsigned long)sdef->nElements, (unsigned long)sdef->nElements); @@ -579,7 +579,7 @@ char* generate_raw_coding(char* src, " if (field_%s.ispresent()) {\n", sdef->elements[i].name); } src = mputprintf(src, - " myleaf.body.node.nodes[%lu] = new RAW_enc_tree(true, &myleaf, " + " myleaf.body.node.nodes[%lu] = new RAW_enc_tree(TRUE, &myleaf, " "&(myleaf.curr_pos), %lu, %s_descr_.raw);\n", (unsigned long)i, (unsigned long)i, sdef->elements[i].typedescrname); if (sdef->elements[i].isOptional) { @@ -977,7 +977,7 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, " (void)idx_map;\n" " int encoded_length = 0;\n" " int num_fields = get_count();\n" - " myleaf.isleaf = false;\n" + " myleaf.isleaf = FALSE;\n" " myleaf.body.node.num_of_nodes = 0;\n" " for (int field_idx = 0; field_idx < num_fields; ++field_idx) {\n" " if ((p_err_descr->omit_before != -1) &&\n" @@ -1029,7 +1029,7 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, " TTCN_error(\"internal error: erroneous before value missing\");\n" " if (err_vals->before->raw) {\n" " myleaf.body.node.nodes[node_pos] =\n" - " new RAW_enc_tree(true, &myleaf, &(myleaf.curr_pos),\n" + " new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos),\n" " node_pos, err_vals->before->errval" "->get_descriptor()->raw);\n" " } else {\n" @@ -1037,7 +1037,7 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, " TTCN_error(\"internal error: erroneous before typedescriptor " "missing\");\n" " myleaf.body.node.nodes[node_pos] =\n" - " new RAW_enc_tree(true, &myleaf, &(myleaf.curr_pos),\n" + " new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos),\n" " node_pos, err_vals->before->type_descr->raw);\n" " }\n" " ++node_pos;\n" @@ -1047,7 +1047,7 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, " e_c.set_msg(\"'%%s'(erroneous value): \", fld_name(field_idx));\n" " if (err_vals->value->raw) {\n" " myleaf.body.node.nodes[node_pos] =\n" - " new RAW_enc_tree(true, &myleaf, &(myleaf.curr_pos),\n" + " new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos),\n" " node_pos, err_vals->value->errval" "->get_descriptor()->raw);\n" " } else {\n" @@ -1055,7 +1055,7 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, " TTCN_error(\"internal error: erroneous value typedescriptor " "missing\");\n" " myleaf.body.node.nodes[node_pos] =\n" - " new RAW_enc_tree(true, &myleaf, &(myleaf.curr_pos),\n" + " new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos),\n" " node_pos, err_vals->value->type_descr->raw);\n" " }\n" " ++node_pos;\n" @@ -1064,7 +1064,7 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, " e_c.set_msg(\"'%%s': \", fld_name(field_idx));\n" " if (!is_optional_field || get_at(field_idx)->ispresent()) {\n" " myleaf.body.node.nodes[node_pos] =\n" - " new RAW_enc_tree(true, &myleaf, &(myleaf.curr_pos),\n" + " new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos),\n" " node_pos, fld_descr(field_idx)->raw);\n" " } else {\n" " // `omitted' field.\n" @@ -1077,7 +1077,7 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, " TTCN_error(\"internal error: erroneous before value missing\");\n" " if (err_vals->after->raw) {\n" " myleaf.body.node.nodes[node_pos] =\n" - " new RAW_enc_tree(true, &myleaf, &(myleaf.curr_pos),\n" + " new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos),\n" " node_pos, err_vals->after->errval" "->get_descriptor()->raw);\n" " } else {\n" @@ -1085,7 +1085,7 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, " TTCN_error(\"internal error: erroneous after typedescriptor " "missing\");\n" " myleaf.body.node.nodes[node_pos] =\n" - " new RAW_enc_tree(true, &myleaf, &(myleaf.curr_pos),\n" + " new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos),\n" " node_pos, err_vals->after->type_descr->raw);\n" " }\n" " ++node_pos;\n" @@ -1105,10 +1105,10 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, if (sdef->raw.ext_bit_groups[i].ext_bit != XDEFNO) { src = mputprintf(src, " {\n" - " bool in_between_modified = false;\n" + " boolean in_between_modified = FALSE;\n" " for (int idx_map_idx = %d; idx_map_idx <= %d; ++idx_map_idx)\n" " if (idx_map[idx_map_idx] < 0) {\n" - " in_between_modified = true;\n" + " in_between_modified = TRUE;\n" " break;\n" " }\n" " if (idx_map[%d] < 0 || idx_map[%d] < 0 ||\n" @@ -1167,12 +1167,12 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, " \"Conflicting negative testing attributes, LENGTHTO " "attribute will be ignored\");\n" " } else {\n" - " bool negtest_confl_lengthto = false;\n", + " boolean negtest_confl_lengthto = FALSE;\n", (unsigned long)i, sdef->elements[i].name); for (a = 0; a < sdef->elements[i].raw.lengthto_num; a++) { src = mputprintf(src, " if (idx_map[%lu] < 0) {\n" - " negtest_confl_lengthto = true;\n" + " negtest_confl_lengthto = TRUE;\n" " e_c.set_msg(\"Field '%s': \");\n" " TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_NEGTEST_CONFL,\n" " \"Conflicting negative testing attributes, LENGTHTO " @@ -1238,10 +1238,10 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, sdef->elements[sdef->elements[i].raw.pointerto].name); } src = mputprintf(src, - " bool in_between_modified_pointerto_%s = false;\n" + " boolean in_between_modified_pointerto_%s = FALSE;\n" " for (int idx_map_idx = %d; idx_map_idx <= %d; ++idx_map_idx) {\n" " if (idx_map[idx_map_idx] < 0) {\n" - " in_between_modified_pointerto_%s = true;\n" + " in_between_modified_pointerto_%s = TRUE;\n" " break;\n" " }\n" " }\n" @@ -1324,13 +1324,13 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, "attribute will be ignored\");\n" " } else {\n" " if (myleaf.body.node.nodes[idx_map[%lu]]->body.node.nodes[%d]) {\n" - " bool negtest_confl_lengthto = false;\n", + " boolean negtest_confl_lengthto = FALSE;\n", (unsigned long)i, sdef->elements[i].name, (unsigned long)i, sdef->elements[i].raw.lengthindex->nthfield); for (a = 0; a < sdef->elements[i].raw.lengthto_num; a++) { src = mputprintf(src, " if (idx_map[%lu] < 0) {\n" - " negtest_confl_lengthto = true;\n" + " negtest_confl_lengthto = TRUE;\n" " e_c.set_msg(\"Field '%s': \");\n" " TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_NEGTEST_CONFL,\n" " \"Conflicting negative testing attributes, LENGTHTO/LENGTHINDEX " @@ -1412,12 +1412,12 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, " \"Conflicting negative testing attributes, LENGTHTO/LENGTHINDEX " "attribute will be ignored\");\n" " } else {\n" - " bool negtest_confl_lengthto = false;\n", + " boolean negtest_confl_lengthto = FALSE;\n", (unsigned long)i, sdef->elements[i].name); for (a = 0; a < sdef->elements[i].raw.lengthto_num; a++) { src = mputprintf(src, " if (idx_map[%lu] < 0) {\n" - " negtest_confl_lengthto = true;\n" + " negtest_confl_lengthto = TRUE;\n" " e_c.set_msg(\"Field '%s': \");\n" " TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_NEGTEST_CONFL,\n" " \"Conflicting negative testing attributes, LENGTHTO/LENGTHINDEX " @@ -1486,9 +1486,9 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, rawAST_coding_taglist *cur_choice = sdef->raw.taglist.list + raw_options[i].tag_type - 1; src = mputprintf(src, - " bool negtest_confl_tag_%s = false;\n" + " boolean negtest_confl_tag_%s = FALSE;\n" " if (idx_map[%lu] < 0) {\n" - " negtest_confl_tag_%s = true;\n" + " negtest_confl_tag_%s = TRUE;\n" " e_c.set_msg(\"Field '%s': \");\n" " TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_NEGTEST_CONFL,\n" " \"Conflicting negative testing attributes, TAG attribute will " @@ -1512,9 +1512,9 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, int taglist_idx, field_idx; /* The optional field itself. */ src = mputprintf(src, - " bool negtest_confl_presence_%s = false;\n" + " boolean negtest_confl_presence_%s = FALSE;\n" " if (idx_map[%lu] < 0) {\n" - " negtest_confl_presence_%s = true;\n" + " negtest_confl_presence_%s = TRUE;\n" " e_c.set_msg(\"Field '%s': \");\n" " TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_NEGTEST_CONFL,\n" " \"Conflicting negative testing attributes, PRESENCE attribute " @@ -1533,7 +1533,7 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, rawAST_coding_fields *field = fields->fields + field_idx; src = mputprintf(src, " if (idx_map[%d] < 0) {\n" - " negtest_confl_presence_%s = true;\n" + " negtest_confl_presence_%s = TRUE;\n" " e_c.set_msg(\"Field '%s': \");\n" " TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_NEGTEST_CONFL,\n" " \"Conflicting negative testing attributes, PRESENCE attribute " @@ -1585,7 +1585,7 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, int taglist_idx, field_idx; src = mputprintf(src, " case %s%s%s: {\n" - " bool negtest_confl_crosstag = false;\n", + " boolean negtest_confl_crosstag = FALSE;\n", sdef->elements[i].type, "::ALT_", cur_choice->fieldName); for (taglist_idx = 0; @@ -1596,7 +1596,7 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, if (field_idx == 0) { src = mputprintf(src, " if (idx_map[%d] < 0) {\n" - " negtest_confl_crosstag = true;\n" + " negtest_confl_crosstag = TRUE;\n" " e_c.set_msg(\"Field '%s': \");\n" " TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_NEGTEST_CONFL,\n" " \"Conflicting negative testing attributes, CROSSTAG attribute " @@ -1759,7 +1759,7 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, if (sdef->hasRaw && sdef->raw.presence.nElements > 0) { /* Check the referenced fields. */ int taglist_idx, field_idx; - src = mputstr(src, " bool negtest_confl_presence = false;\n"); + src = mputstr(src, " boolean negtest_confl_presence = FALSE;\n"); for (taglist_idx = 0; taglist_idx < sdef->raw.presence.nElements; ++taglist_idx) { rawAST_coding_field_list *fields = sdef->raw.presence.fields + taglist_idx; @@ -1768,7 +1768,7 @@ char *generate_raw_coding_negtest(char *src, const struct_def *sdef, rawAST_coding_fields *field = fields->fields + field_idx; src = mputprintf(src, " if (idx_map[%d] < 0) {\n" - " negtest_confl_presence = true;\n" + " negtest_confl_presence = TRUE;\n" " e_c.set_msg(\"Field '%s': \");\n" " TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_NEGTEST_CONFL,\n" " \"Conflicting negative testing attributes, PRESENCE attribute " @@ -1857,7 +1857,7 @@ void gen_xer(const struct_def *sdef, char **pdef, char **psrc) " try {\n" " char **new_ns;\n" " size_t num_new;\n" - " bool def_ns_1 = false;\n"); + " boolean def_ns_1 = FALSE;\n"); for (i = start_at; i < sdef->nElements; ++i) { src = mputprintf(src, " new_ns = field_%s.collect_ns(%s_xer_, num_new, def_ns);\n" @@ -1901,7 +1901,7 @@ void gen_xer(const struct_def *sdef, char **pdef, char **psrc) ); for (i = start_at; i < sdef->nElements; ++i) { src = mputprintf(src, - " else if (%s::can_start(name, uri, %s_xer_, flavor)) return true;\n" + " else if (%s::can_start(name, uri, %s_xer_, flavor)) return TRUE;\n" /* Here we know for sure it's exer */ , sdef->elements[i].type , sdef->elements[i].typegen @@ -1910,7 +1910,7 @@ void gen_xer(const struct_def *sdef, char **pdef, char **psrc) /* The last component with which it can begin is the first non-optional. * Does that sentence makes sense to you ? */ } - src = mputstr(src, " return false;\n}\n\n"); + src = mputstr(src, " return FALSE;\n}\n\n"); /* * * * * * * * * * XER_encode * * * * * * * * * * * * * * */ src = mputprintf(src, @@ -1936,7 +1936,7 @@ void gen_xer(const struct_def *sdef, char **pdef, char **psrc) src = mputstr(src, " size_t num_collected = 0;\n" " char **collected_ns = NULL;\n" - " bool def_ns = false;\n" + " boolean def_ns = FALSE;\n" " if (e_xer) {\n" " if (p_indent == 0) {\n" /* top-level */ " collected_ns = collect_ns(p_td, num_collected, def_ns);\n" /* our own ns */ @@ -2088,7 +2088,7 @@ void gen_xer(const struct_def *sdef, char **pdef, char **psrc) if (sdef->xerUseNilPossible) { src = mputprintf(src, - " bool nil_attribute = e_xer && (p_td.xer_bits & USE_NIL) && !field_%s.ispresent();\n" + " boolean nil_attribute = e_xer && (p_td.xer_bits & USE_NIL) && !field_%s.ispresent();\n" " if (nil_attribute) {\n" " const namespace_t *control_ns = p_td.my_module->get_controlns();\n" " p_buf.put_c(' ');\n" @@ -2800,7 +2800,7 @@ void gen_xer(const struct_def *sdef, char **pdef, char **psrc) src = mputstr(src, " int last_embval_index = 0;\n"); } src = mputprintf(src, - " bool early_exit = false;\n" + " boolean early_exit = FALSE;\n" " for (int i=0; i < %lu; ++i) {\n" " for (rd_ok=p_reader.Ok(); rd_ok==1; rd_ok=p_reader.Read()) {\n" , (unsigned long)(n_embed)); @@ -2820,7 +2820,7 @@ void gen_xer(const struct_def *sdef, char **pdef, char **psrc) " type = p_reader.NodeType();\n" " if (type==XML_READER_TYPE_ELEMENT) break;\n" " if (type == XML_READER_TYPE_END_ELEMENT) {\n" - " early_exit = true;\n" + " early_exit = TRUE;\n" " break;\n" " }\n" " }\n" @@ -2864,7 +2864,7 @@ void gen_xer(const struct_def *sdef, char **pdef, char **psrc) } src = mputstr(src, " {\n" - " boolean any_found = false;\n" + " boolean any_found = FALSE;\n" " if (!any_found)"); for (i = begin; i < end; ++i) { // Check anyElement fields after all other fields @@ -2874,17 +2874,17 @@ void gen_xer(const struct_def *sdef, char **pdef, char **psrc) " e_val = %s::of_type::%s;\n" , sdef->elements[uo].typegen, sdef->elements[i].name); src = mputprintf(src, - " boolean next_any = false;\n" + " boolean next_any = FALSE;\n" " for (int d_f = 0; d_f < num_seen; ++d_f) {\n" " if (e_val == seen_f[d_f]) {\n" - " next_any = true;\n" + " next_any = TRUE;\n" " }\n" " }\n" " if (!next_any) {\n" " ec_1.set_msg(\"%s': \");\n" " field_%s%s%s%s.XER_decode(%s_xer_, p_reader, p_flavor, p_flavor2, 0);\n" " field_%s[i] = e_val;\n" - " any_found = true;\n" + " any_found = TRUE;\n" " }\n" " }\n" " if (!any_found)" @@ -3090,7 +3090,7 @@ void gen_xer(const struct_def *sdef, char **pdef, char **psrc) " }\n" " delete emb_val;\n" " }\n" - , sdef->elements[0].isOptional ? " bool all_unbound = true;\n" : "" + , sdef->elements[0].isOptional ? " boolean all_unbound = TRUE;\n" : "" , sdef->elements[0].type , sdef->elements[0].name , sdef->elements[0].isOptional ? "()" : "" @@ -3099,7 +3099,7 @@ void gen_xer(const struct_def *sdef, char **pdef, char **psrc) , sdef->elements[0].isOptional ? " else if(field_" : "\n" , sdef->elements[0].isOptional ? sdef->elements[0].name : "" , sdef->elements[0].isOptional ? "()" : "" - , sdef->elements[0].isOptional ? "[j_j] != empty_string) {\n all_unbound = false;\n }\n" : "" + , sdef->elements[0].isOptional ? "[j_j] != empty_string) {\n all_unbound = FALSE;\n }\n" : "" ); if(sdef->elements[0].isOptional) { @@ -3464,7 +3464,7 @@ void defRecordClass1(const struct_def *sdef, output_struct *output) " break;\n" " case Module_Param::MP_Assignment_List: {\n" " Vector<bool> value_used(param.get_size());\n" - " value_used.resize(param.get_size(), false);\n"); + " value_used.resize(param.get_size(), FALSE);\n"); for (i = 0; i < sdef->nElements; ++i) { src = mputprintf(src, " for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {\n" @@ -3473,7 +3473,7 @@ void defRecordClass1(const struct_def *sdef, output_struct *output) " if (curr_param->get_type()!=Module_Param::MP_NotUsed) {\n" " %s().set_param(*curr_param);\n" " }\n" - " value_used[val_idx]=true;\n" + " value_used[val_idx]=TRUE;\n" " }\n" " }\n" , sdef->elements[i].dispname, sdef->elements[i].name); @@ -3834,7 +3834,7 @@ void defRecordClass1(const struct_def *sdef, output_struct *output) " TTCN_Buffer& p_buf) const{\n" " if (!is_bound()) TTCN_EncDec_ErrorContext::error" "(TTCN_EncDec::ET_UNBOUND, \"Encoding an unbound value.\");\n" - " bool need_separator=false;\n" + " boolean need_separator=FALSE;\n" " int encoded_length=0;\n" " if(p_td.text->begin_encode){\n" " p_buf.put_cs(*p_td.text->begin_encode);\n" @@ -3856,7 +3856,7 @@ void defRecordClass1(const struct_def *sdef, output_struct *output) " encoded_length+=p_td.text->separator_encode->lengthof();\n" " }\n" " encoded_length+=field_%s%s.TEXT_encode(%s_descr_,p_buf);\n" - " need_separator=true;\n" + " need_separator=TRUE;\n" ,sdef->elements[i].name ,sdef->elements[i].isOptional?"()":"",sdef->elements[i].typedescrname ); @@ -3959,7 +3959,7 @@ void defRecordClass1(const struct_def *sdef, output_struct *output) " && field_map[%lu]<3) || !field_map[%lu]){\n" " pos=p_buf.get_pos();\n" " decoded_field_length=field_%s%s.TEXT_decode(%s_descr_,p_buf," - "limit,true,!field_map[%lu]);\n" + "limit,TRUE,!field_map[%lu]);\n" " if(decoded_field_length<0){\n" " p_buf.set_pos(pos);\n" ,sdef->elements[i].typedescrname,(unsigned long) i,(unsigned long) i @@ -3993,7 +3993,7 @@ void defRecordClass1(const struct_def *sdef, output_struct *output) " if(!field_map[%lu]){\n" " pos=p_buf.get_pos();\n" " decoded_field_length=field_%s%s.TEXT_decode(%s_descr_,p_buf," - "limit,true);\n" + "limit,TRUE);\n" " if(decoded_field_length<0){\n" " p_buf.set_pos(pos);\n" "%s%s%s" @@ -4441,7 +4441,7 @@ void defRecordClass1(const struct_def *sdef, output_struct *output) } src = mputstr(src, // Read name - value token pairs until we reach some other token - "\n while (true) {\n" + "\n while (TRUE) {\n" " char* fld_name = 0;\n" " size_t name_len = 0;\n" " size_t buf_pos = p_tok.get_buf_pos();\n" @@ -5679,7 +5679,7 @@ void defRecordTemplate1(const struct_def *sdef, output_struct *output) " break;\n" " case Module_Param::MP_Assignment_List: {\n" " Vector<bool> value_used(param.get_size());\n" - " value_used.resize(param.get_size(), false);\n"); + " value_used.resize(param.get_size(), FALSE);\n"); for (i = 0; i < sdef->nElements; ++i) { src = mputprintf(src, " for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {\n" @@ -5688,7 +5688,7 @@ void defRecordTemplate1(const struct_def *sdef, output_struct *output) " if (curr_param->get_type()!=Module_Param::MP_NotUsed) {\n" " %s().set_param(*curr_param);\n" " }\n" - " value_used[val_idx]=true;\n" + " value_used[val_idx]=TRUE;\n" " }\n" " }\n" , sdef->elements[i].dispname, sdef->elements[i].name); @@ -6018,7 +6018,7 @@ static void defEmptyRecordClass(const struct_def *sdef, "boolean %s::can_start(const char *p_name, const char *p_uri, " "const XERdescriptor_t& p_td, unsigned int p_flavor) {\n" " boolean e_xer = is_exer(p_flavor);\n" - " if (e_xer && (p_td.xer_bits & UNTAGGED)) return false;\n" + " if (e_xer && (p_td.xer_bits & UNTAGGED)) return FALSE;\n" " else return check_name(p_name, p_td, e_xer) && (!e_xer || check_namespace(p_uri, p_td));\n" "}\n\n" , name @@ -6046,7 +6046,7 @@ static void defEmptyRecordClass(const struct_def *sdef, "unsigned int p_flavor, unsigned int /*p_flavor2*/, embed_values_dec_struct_t*)\n" "{\n" " int e_xer = is_exer(p_flavor);\n" - " bound_flag = true;\n" + " bound_flag = TRUE;\n" " int rd_ok, depth=-1;\n" " for (rd_ok=p_reader.Ok(); rd_ok==1; rd_ok=p_reader.Read()) {\n" " int type = p_reader.NodeType();\n" @@ -6106,7 +6106,7 @@ static void defEmptyRecordClass(const struct_def *sdef, " JSON_ERROR(TTCN_EncDec::ET_INVAL_MSG, JSON_DEC_STATIC_OBJECT_END_TOKEN_ERROR, \"\");\n" " return JSON_ERROR_FATAL;\n" " }\n\n" - " bound_flag = true;\n\n" + " bound_flag = TRUE;\n\n" " return dec_len;\n" "}\n\n" , name); @@ -6977,11 +6977,11 @@ check_generate_end: , name , name, name); for (i = 0; i < sdef->nElements; i++) { src = mputprintf(src, - " else if (%s::can_start(p_name, p_uri, %s_xer_, p_flavor)) return true;\n" + " else if (%s::can_start(p_name, p_uri, %s_xer_, p_flavor)) return TRUE;\n" , sdef->elements[i].type, sdef->elements[i].typegen); } src = mputstr(src, - " return false;\n" + " return FALSE;\n" "}\n\n"); /* end of antipattern */ diff --git a/compiler2/record_of.c b/compiler2/record_of.c index c98be28c2..8a6e9874c 100644 --- a/compiler2/record_of.c +++ b/compiler2/record_of.c @@ -540,7 +540,7 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output) src = mputprintf(src, "boolean %s::is_value() const\n" "{\n" - "if (val_ptr == NULL) return false;\n" + "if (val_ptr == NULL) return FALSE;\n" "for(int i = 0; i < val_ptr->n_elements; ++i) {\n" "if (val_ptr->value_elements[i] == NULL || " "!val_ptr->value_elements[i]->is_value()) return FALSE;\n" @@ -1093,7 +1093,7 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output) " char **new_ns;\n" " size_t num_new;\n" " for (int i = 0; i < val_ptr->n_elements; ++i) {\n" - " bool def_ns_1 = false;" + " boolean def_ns_1 = FALSE;" " new_ns = (*this)[i].collect_ns(*p_td.oftype_descr, num_new, def_ns_1);\n" " merge_ns(collected_ns, num_collected, new_ns, num_new);\n" " def_ns = def_ns || def_ns_1;\n" /* alas, no ||= */ @@ -1149,7 +1149,7 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output) " {\n" " size_t num_collected = 0;\n" " char **collected_ns = NULL;\n" - " bool def_ns = false;\n" + " boolean def_ns = FALSE;\n" " collected_ns = collect_ns(p_td, num_collected, def_ns);\n" " for (size_t cur_coll = 0; cur_coll < num_collected; ++cur_coll) {\n" " p_buf.put_s(strlen(collected_ns[cur_coll]), (cbyte*)collected_ns[cur_coll]);\n" @@ -1272,7 +1272,7 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output) " {\n" " size_t num_collected = 0;\n" " char **collected_ns = NULL;\n" - " bool def_ns = false;\n" + " boolean def_ns = FALSE;\n" " collected_ns = collect_ns(p_td, num_collected, def_ns);\n" " for (size_t cur_coll = 0; cur_coll < num_collected; ++cur_coll) {\n" " p_buf.put_s(strlen(collected_ns[cur_coll]), (cbyte*)collected_ns[cur_coll]);\n" @@ -1574,7 +1574,7 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output) " return JSON_ERROR_INVALID_TOKEN;\n" " }\n\n" " set_size(0);\n" - " for (int nof_elements = 0; true; ++nof_elements) {\n" + " for (int nof_elements = 0; TRUE; ++nof_elements) {\n" " size_t buf_pos = p_tok.get_buf_pos();\n" " int ret_val;\n" " if (NULL != p_td.json && p_td.json->metainfo_unbound) {\n" @@ -2561,7 +2561,7 @@ void defRecordOfClassMemAllocOptimized(const struct_of_def *sdef, output_struct " char **new_ns;\n" " size_t num_new;\n" " for (int i = 0; i < n_elements; ++i) {\n" - " bool def_ns_1 = false;" + " boolean def_ns_1 = FALSE;" " new_ns = value_elements[i].collect_ns(*p_td.oftype_descr, num_new, def_ns_1);\n" " merge_ns(collected_ns, num_collected, new_ns, num_new);\n" " def_ns = def_ns || def_ns_1;\n" /* alas, no ||= */ @@ -2617,7 +2617,7 @@ void defRecordOfClassMemAllocOptimized(const struct_of_def *sdef, output_struct " {\n" " size_t num_collected = 0;\n" " char **collected_ns = NULL;\n" - " bool def_ns = false;\n" + " boolean def_ns = FALSE;\n" " collected_ns = collect_ns(p_td, num_collected, def_ns);\n" " for (size_t cur_coll = 0; cur_coll < num_collected; ++cur_coll) {\n" " p_buf.put_s(strlen(collected_ns[cur_coll]), (cbyte*)collected_ns[cur_coll]);\n" @@ -2735,7 +2735,7 @@ void defRecordOfClassMemAllocOptimized(const struct_of_def *sdef, output_struct " {\n" " size_t num_collected = 0;\n" " char **collected_ns = NULL;\n" - " bool def_ns = false;\n" + " boolean def_ns = FALSE;\n" " collected_ns = collect_ns(p_td, num_collected, def_ns);\n" " for (size_t cur_coll = 0; cur_coll < num_collected; ++cur_coll) {\n" " p_buf.put_s(strlen(collected_ns[cur_coll]), (cbyte*)collected_ns[cur_coll]);\n" @@ -3026,7 +3026,7 @@ void defRecordOfClassMemAllocOptimized(const struct_of_def *sdef, output_struct " return JSON_ERROR_INVALID_TOKEN;\n" " }\n\n" " set_size(0);\n" - " for (int nof_elements = 0; true; ++nof_elements) {\n" + " for (int nof_elements = 0; TRUE; ++nof_elements) {\n" " size_t buf_pos = p_tok.get_buf_pos();\n" " int ret_val;\n" " if (NULL != p_td.json && p_td.json->metainfo_unbound) {\n" @@ -3977,11 +3977,11 @@ void defRecordOfTemplate1(const struct_of_def *sdef, output_struct *output) src = mputprintf(src, "boolean %s_template::is_value() const\n" "{\n" - "if (template_selection != SPECIFIC_VALUE || is_ifpresent) return false;\n" + "if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;\n" "for (int elem_count = 0; elem_count < single_value.n_elements; " "elem_count++)\n" - "if (!single_value.value_elements[elem_count]->is_value()) return false;\n" - "return true;\n" + "if (!single_value.value_elements[elem_count]->is_value()) return FALSE;\n" + "return TRUE;\n" "}\n\n", name); /* valueof operation */ diff --git a/compiler2/union.c b/compiler2/union.c index b585ed8e5..4cd7e6ed5 100644 --- a/compiler2/union.c +++ b/compiler2/union.c @@ -1105,7 +1105,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) " case %s_%s: {\n", selection_prefix, sdef->elements[i].name); if (t_type && (sdef->raw.taglist.list + t_type - 1)->nElements) { - src = mputstr(src, " bool negtest_confl_tag = false;\n"); + src = mputstr(src, " boolean negtest_confl_tag = FALSE;\n"); } src = mputprintf(src, " err_vals = p_err_descr->get_field_err_values(%d);\n" @@ -1132,7 +1132,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) (unsigned long)i, (unsigned long)i, (unsigned long)i); if (t_type && (sdef->raw.taglist.list + t_type - 1)->nElements) { /* Avoid TAGs. */ - src = mputprintf(src, " negtest_confl_tag = true;\n"); + src = mputprintf(src, " negtest_confl_tag = TRUE;\n"); } src = mputprintf(src, " } else {\n" @@ -1142,7 +1142,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) (unsigned long)i, (unsigned long)i, sdef->elements[i].typedescrname); if (t_type && (sdef->raw.taglist.list + t_type - 1)->nElements) { /* Avoid TAGs. */ - src = mputprintf(src, " negtest_confl_tag = true;\n"); + src = mputprintf(src, " negtest_confl_tag = TRUE;\n"); } src = mputprintf(src, " encoded_length = field_%s->RAW_encode_negtest(emb_descr, %s_descr_, *myleaf.body.node.nodes[%lu]);\n" @@ -1286,14 +1286,14 @@ void defUnionClass(struct_def const *sdef, output_struct *output) " }\n", name, sdef->nElements > 1 ? " size_t pos = p_buf.get_pos();\n" : ""); if (sdef->nElements > 0) { src = mputprintf(src, - " int str_len = %s().TEXT_decode(%s_descr_, p_buf, limit, true);\n" + " int str_len = %s().TEXT_decode(%s_descr_, p_buf, limit, TRUE);\n" " if (str_len >= 0) found = TRUE;\n", sdef->elements[0].name, sdef->elements[0].typedescrname); } for (i = 1; i < sdef->nElements; i++) { src = mputprintf(src, " if (!found) {\n" " p_buf.set_pos(pos);\n" - " str_len = %s().TEXT_decode(%s_descr_, p_buf, limit, true);\n" + " str_len = %s().TEXT_decode(%s_descr_, p_buf, limit, TRUE);\n" " if (str_len >= 0) found = TRUE;\n" " }\n", sdef->elements[i].name, sdef->elements[i].typedescrname); } @@ -1343,11 +1343,11 @@ void defUnionClass(struct_def const *sdef, output_struct *output) /* An untagged union can start with the start tag of any alternative */ for (i = 0; i < sdef->nElements; i++) { src=mputprintf(src, - " if (%s::can_start(name, uri, %s_xer_, flavor)) return true;\n" + " if (%s::can_start(name, uri, %s_xer_, flavor)) return TRUE;\n" , sdef->elements[i].type, sdef->elements[i].typegen ); } - src = mputstr(src, " return false;\n}\n\n"); + src = mputstr(src, " return FALSE;\n}\n\n"); src = mputprintf(src, "char ** %s::collect_ns(const XERdescriptor_t& p_td, size_t& num, bool& def_ns) const {\n" @@ -1358,7 +1358,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) " size_t num_new;\n" " boolean need_type = FALSE;\n" " try {\n" - " bool def_ns_1 = false;\n" + " boolean def_ns_1 = FALSE;\n" " switch (union_selection) {\n" , name ); @@ -1514,7 +1514,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) src = mputprintf(src, " unsigned int flavor_1 = p_flavor;\n" " if (is_exer(p_flavor)) flavor_1 &= ~XER_RECOF;\n" - " bool omit_tag = begin_xml(p_td, p_buf, flavor_1, p_indent, false, " + " boolean omit_tag = begin_xml(p_td, p_buf, flavor_1, p_indent, FALSE, " "(collector_fn)&%s::collect_ns%s);\n" , sdef->name , sdef->xerUseTypeAttr ? ", type_atr" : ""); @@ -1652,7 +1652,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) } /* if UseTypeAttr */ src = mputprintf(src, - " bool omit_tag = begin_xml(p_td, p_buf, p_flavor, p_indent, false, " + " boolean omit_tag = begin_xml(p_td, p_buf, p_flavor, p_indent, FALSE, " "(collector_fn)&%s::collect_ns%s);\n" , sdef->name , sdef->xerUseTypeAttr ? ", type_atr" : ""); @@ -1744,7 +1744,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) " xml_depth = p_reader.Depth();\n" , name , sdef->xerUseTypeAttr ? " char * typeatr = 0;\n" : "" - , sdef->xerUseUnion ? " boolean attribute = (p_td.xer_bits & XER_ATTRIBUTE) ? true : false;\n" : "" + , sdef->xerUseUnion ? " boolean attribute = (p_td.xer_bits & XER_ATTRIBUTE) ? TRUE : FALSE;\n" : "" , sdef->xerUseUnion ? "if (!attribute) " : "" ); if (sdef->xerUseTypeAttr) { @@ -2093,7 +2093,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) if (JSON_NUMBER & sdef->elements[i].jsonValueType) { src = mputprintf(src, " p_tok.set_buf_pos(buf_pos);\n" - " ret_val = %s%s().JSON_decode(%s_descr_, p_tok, true);\n" + " ret_val = %s%s().JSON_decode(%s_descr_, p_tok, TRUE);\n" " if (0 <= ret_val) {\n" " return ret_val;\n" " }\n" @@ -2110,7 +2110,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) if (JSON_STRING & sdef->elements[i].jsonValueType) { src = mputprintf(src, " p_tok.set_buf_pos(buf_pos);\n" - " ret_val = %s%s().JSON_decode(%s_descr_, p_tok, true);\n" + " ret_val = %s%s().JSON_decode(%s_descr_, p_tok, TRUE);\n" " if (0 <= ret_val) {\n" " return ret_val;\n" " }\n" @@ -2128,7 +2128,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) if (JSON_BOOLEAN & sdef->elements[i].jsonValueType) { src = mputprintf(src, " p_tok.set_buf_pos(buf_pos);\n" - " ret_val = %s%s().JSON_decode(%s_descr_, p_tok, true);\n" + " ret_val = %s%s().JSON_decode(%s_descr_, p_tok, TRUE);\n" " if (0 <= ret_val) {\n" " return ret_val;\n" " }\n" @@ -2148,7 +2148,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) if (JSON_ARRAY & sdef->elements[i].jsonValueType) { src = mputprintf(src, " p_tok.set_buf_pos(buf_pos);\n" - " ret_val = %s%s().JSON_decode(%s_descr_, p_tok, true);\n" + " ret_val = %s%s().JSON_decode(%s_descr_, p_tok, TRUE);\n" " if (0 <= ret_val) {\n" " return ret_val;\n" " }\n" @@ -2165,7 +2165,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) if (JSON_OBJECT & sdef->elements[i].jsonValueType) { src = mputprintf(src, " p_tok.set_buf_pos(buf_pos);\n" - " ret_val = %s%s().JSON_decode(%s_descr_, p_tok, true);\n" + " ret_val = %s%s().JSON_decode(%s_descr_, p_tok, TRUE);\n" " if (0 <= ret_val) {\n" " return ret_val;\n" " }\n" @@ -2182,7 +2182,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) if (JSON_NULL & sdef->elements[i].jsonValueType) { src = mputprintf(src, " p_tok.set_buf_pos(buf_pos);\n" - " ret_val = %s%s().JSON_decode(%s_descr_, p_tok, true);\n" + " ret_val = %s%s().JSON_decode(%s_descr_, p_tok, TRUE);\n" " if (0 <= ret_val) {\n" " return ret_val;\n" " }\n" @@ -2573,7 +2573,7 @@ void defUnionTemplate(const struct_def *sdef, output_struct *output) def = mputstr(def, "boolean is_value() const;"); src = mputprintf(src, "boolean %s_template::is_value() const\n" "{\n" - "if (template_selection != SPECIFIC_VALUE || is_ifpresent) return false;\n" + "if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;\n" "switch (single_value.union_selection) {\n" , name); for (i = 0; i < sdef->nElements; i++) { diff --git a/core/ASN_Any.cc b/core/ASN_Any.cc index b02a92dc9..40de8656c 100644 --- a/core/ASN_Any.cc +++ b/core/ASN_Any.cc @@ -72,7 +72,7 @@ void ASN_ANY::decode(const TTCN_Typedescriptor_t& p_td, TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); - if(JSON_decode(p_td, tok, false)<0) + if(JSON_decode(p_td, tok, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG, "Can not decode type '%s', because invalid or incomplete" " message was received" diff --git a/core/ASN_CharacterString.cc b/core/ASN_CharacterString.cc index 4b91fc63a..763a75e93 100644 --- a/core/ASN_CharacterString.cc +++ b/core/ASN_CharacterString.cc @@ -792,7 +792,7 @@ int CHARACTER_STRING_identification::XER_encode(const XERdescriptor_t& p_td, { int encoded_length=(int)p_buf.get_len(); - begin_xml(p_td, p_buf, flavor, indent++, false); + begin_xml(p_td, p_buf, flavor, indent++, FALSE); flavor &= XER_MASK; switch (union_selection) { @@ -819,7 +819,7 @@ int CHARACTER_STRING_identification::XER_encode(const XERdescriptor_t& p_td, break; } - end_xml(p_td, p_buf, flavor, --indent, false); + end_xml(p_td, p_buf, flavor, --indent, FALSE); return (int)p_buf.get_len() - encoded_length; } @@ -1685,19 +1685,19 @@ void CHARACTER_STRING_identification_syntaxes::set_param(Module_Param& param) break; case Module_Param::MP_Assignment_List: { Vector<bool> value_used(mp->get_size()); - value_used.resize(mp->get_size(), false); + value_used.resize(mp->get_size(), FALSE); for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "abstract")) { abstract().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "transfer")) { transfer().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) { @@ -1791,12 +1791,12 @@ int CHARACTER_STRING_identification_syntaxes::XER_encode(const XERdescriptor_t& { int encoded_length=(int)p_buf.get_len(); - begin_xml(p_td, p_buf, flavor, indent++, false); + begin_xml(p_td, p_buf, flavor, indent++, FALSE); field_abstract.XER_encode(CHARACTER_STRING_identification_sxs_abs_xer_, p_buf, flavor, indent, 0); field_transfer.XER_encode(CHARACTER_STRING_identification_sxs_xfr_xer_, p_buf, flavor, indent, 0); - end_xml(p_td, p_buf, flavor, --indent, false); + end_xml(p_td, p_buf, flavor, --indent, FALSE); return p_buf.get_len() - encoded_length; } @@ -1868,19 +1868,19 @@ void CHARACTER_STRING_identification_syntaxes_template::set_param(Module_Param& break; case Module_Param::MP_Assignment_List: { Vector<bool> value_used(mp->get_size()); - value_used.resize(mp->get_size(), false); + value_used.resize(mp->get_size(), FALSE); for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "abstract")) { abstract().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "transfer")) { transfer().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) { @@ -2416,19 +2416,19 @@ void CHARACTER_STRING_identification_context__negotiation::set_param(Module_Para break; case Module_Param::MP_Assignment_List: { Vector<bool> value_used(mp->get_size()); - value_used.resize(mp->get_size(), false); + value_used.resize(mp->get_size(), FALSE); for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "presentation_context_id")) { presentation__context__id().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "transfer_syntax")) { transfer__syntax().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) { @@ -2522,12 +2522,12 @@ int CHARACTER_STRING_identification_context__negotiation::XER_encode(const XERde { int encoded_length=(int)p_buf.get_len(); - begin_xml(p_td, p_buf, flavor, indent++, false); + begin_xml(p_td, p_buf, flavor, indent++, FALSE); field_presentation__context__id.XER_encode(CHARACTER_STRING_identification_pci_xer_, p_buf, flavor, indent, 0); field_transfer__syntax .XER_encode(CHARACTER_STRING_identification_ts_xer_ , p_buf, flavor, indent, 0); - end_xml(p_td, p_buf, flavor, --indent, false); + end_xml(p_td, p_buf, flavor, --indent, FALSE); return p_buf.get_len() - encoded_length; } @@ -2601,19 +2601,19 @@ void CHARACTER_STRING_identification_context__negotiation_template::set_param(Mo break; case Module_Param::MP_Assignment_List: { Vector<bool> value_used(mp->get_size()); - value_used.resize(mp->get_size(), false); + value_used.resize(mp->get_size(), FALSE); for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "presentation_context_id")) { presentation__context__id().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "transfer_syntax")) { transfer__syntax().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) { @@ -3159,26 +3159,26 @@ void CHARACTER_STRING::set_param(Module_Param& param) break; case Module_Param::MP_Assignment_List: { Vector<bool> value_used(mp->get_size()); - value_used.resize(mp->get_size(), false); + value_used.resize(mp->get_size(), FALSE); for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "identification")) { identification().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "data_value_descriptor")) { data__value__descriptor().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "string_value")) { string__value().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) { @@ -3374,14 +3374,14 @@ int CHARACTER_STRING::XER_encode(const XERdescriptor_t& p_td, TTCN_Buffer& p_buf int encoded_length=(int)p_buf.get_len(); flavor &= ~XER_RECOF; // ASN.1 character string doesn't care - begin_xml(p_td, p_buf, flavor, indent++, false); + begin_xml(p_td, p_buf, flavor, indent++, FALSE); field_identification.XER_encode(CHARACTER_STRING_identification_xer_, p_buf, flavor, indent, 0); // data-value-descriptor is OPTIONAL and can never be present. // Its encoding is empty. field_string__value .XER_encode(CHARACTER_STRING_data_value_xer_ , p_buf, flavor, indent, 0); - end_xml(p_td, p_buf, flavor, --indent, false); + end_xml(p_td, p_buf, flavor, --indent, FALSE); return (int)p_buf.get_len() - encoded_length; } @@ -3471,26 +3471,26 @@ void CHARACTER_STRING_template::set_param(Module_Param& param) break; case Module_Param::MP_Assignment_List: { Vector<bool> value_used(mp->get_size()); - value_used.resize(mp->get_size(), false); + value_used.resize(mp->get_size(), FALSE); for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "identification")) { identification().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "data_value_descriptor")) { data__value__descriptor().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "string_value")) { string__value().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) { diff --git a/core/ASN_EmbeddedPDV.cc b/core/ASN_EmbeddedPDV.cc index c5d4e55ae..fc9e344ff 100644 --- a/core/ASN_EmbeddedPDV.cc +++ b/core/ASN_EmbeddedPDV.cc @@ -1680,19 +1680,19 @@ void EMBEDDED_PDV_identification_syntaxes::set_param(Module_Param& param) break; case Module_Param::MP_Assignment_List: { Vector<bool> value_used(mp->get_size()); - value_used.resize(mp->get_size(), false); + value_used.resize(mp->get_size(), FALSE); for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "abstract")) { abstract().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "transfer")) { transfer().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) { @@ -1872,19 +1872,19 @@ void EMBEDDED_PDV_identification_syntaxes_template::set_param(Module_Param& para break; case Module_Param::MP_Assignment_List: { Vector<bool> value_used(mp->get_size()); - value_used.resize(mp->get_size(), false); + value_used.resize(mp->get_size(), FALSE); for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "abstract")) { abstract().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "transfer")) { transfer().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) { @@ -2420,19 +2420,19 @@ void EMBEDDED_PDV_identification_context__negotiation::set_param(Module_Param& p break; case Module_Param::MP_Assignment_List: { Vector<bool> value_used(mp->get_size()); - value_used.resize(mp->get_size(), false); + value_used.resize(mp->get_size(), FALSE); for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "presentation_context_id")) { presentation__context__id().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "transfer_syntax")) { transfer__syntax().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) { @@ -2613,19 +2613,19 @@ void EMBEDDED_PDV_identification_context__negotiation_template::set_param(Module break; case Module_Param::MP_Assignment_List: { Vector<bool> value_used(mp->get_size()); - value_used.resize(mp->get_size(), false); + value_used.resize(mp->get_size(), FALSE); for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "presentation_context_id")) { presentation__context__id().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "transfer_syntax")) { transfer__syntax().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) { @@ -3171,26 +3171,26 @@ void EMBEDDED_PDV::set_param(Module_Param& param) break; case Module_Param::MP_Assignment_List: { Vector<bool> value_used(mp->get_size()); - value_used.resize(mp->get_size(), false); + value_used.resize(mp->get_size(), FALSE); for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "identification")) { identification().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "data_value_descriptor")) { data__value__descriptor().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "data_value")) { data__value().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) { @@ -3488,26 +3488,26 @@ void EMBEDDED_PDV_template::set_param(Module_Param& param) break; case Module_Param::MP_Assignment_List: { Vector<bool> value_used(mp->get_size()); - value_used.resize(mp->get_size(), false); + value_used.resize(mp->get_size(), FALSE); for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "identification")) { identification().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "data_value_descriptor")) { data__value__descriptor().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "data_value")) { data__value().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) { diff --git a/core/ASN_External.cc b/core/ASN_External.cc index 2ba329dc8..6f0b9bbe5 100644 --- a/core/ASN_External.cc +++ b/core/ASN_External.cc @@ -2076,19 +2076,19 @@ void EXTERNAL_identification_syntaxes::set_param(Module_Param& param) break; case Module_Param::MP_Assignment_List: { Vector<bool> value_used(mp->get_size()); - value_used.resize(mp->get_size(), false); + value_used.resize(mp->get_size(), FALSE); for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "abstract")) { abstract().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "transfer")) { transfer().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) { @@ -2174,19 +2174,19 @@ void EXTERNAL_identification_syntaxes_template::set_param(Module_Param& param) break; case Module_Param::MP_Assignment_List: { Vector<bool> value_used(mp->get_size()); - value_used.resize(mp->get_size(), false); + value_used.resize(mp->get_size(), FALSE); for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "abstract")) { abstract().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "transfer")) { transfer().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) { @@ -2722,19 +2722,19 @@ void EXTERNAL_identification_context__negotiation::set_param(Module_Param& param break; case Module_Param::MP_Assignment_List: { Vector<bool> value_used(mp->get_size()); - value_used.resize(mp->get_size(), false); + value_used.resize(mp->get_size(), FALSE); for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "presentation_context_id")) { presentation__context__id().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "transfer_syntax")) { transfer__syntax().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) { @@ -2820,19 +2820,19 @@ void EXTERNAL_identification_context__negotiation_template::set_param(Module_Par break; case Module_Param::MP_Assignment_List: { Vector<bool> value_used(mp->get_size()); - value_used.resize(mp->get_size(), false); + value_used.resize(mp->get_size(), FALSE); for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "presentation_context_id")) { presentation__context__id().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "transfer_syntax")) { transfer__syntax().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) { @@ -3378,26 +3378,26 @@ void EXTERNAL::set_param(Module_Param& param) break; case Module_Param::MP_Assignment_List: { Vector<bool> value_used(mp->get_size()); - value_used.resize(mp->get_size(), false); + value_used.resize(mp->get_size(), FALSE); for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "identification")) { identification().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "data_value_descriptor")) { data__value__descriptor().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "data_value")) { data__value().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) { @@ -3577,26 +3577,26 @@ void EXTERNAL_template::set_param(Module_Param& param) break; case Module_Param::MP_Assignment_List: { Vector<bool> value_used(mp->get_size()); - value_used.resize(mp->get_size(), false); + value_used.resize(mp->get_size(), FALSE); for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "identification")) { identification().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "data_value_descriptor")) { data__value__descriptor().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) { Module_Param* const curr_param = mp->get_elem(val_idx); if (!strcmp(curr_param->get_id()->get_name(), "data_value")) { data__value().set_param(*curr_param); - value_used[val_idx]=true; + value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) { diff --git a/core/ASN_Null.cc b/core/ASN_Null.cc index b85758084..e804d9404 100644 --- a/core/ASN_Null.cc +++ b/core/ASN_Null.cc @@ -189,7 +189,7 @@ void ASN_NULL::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); - if(JSON_decode(p_td, tok, false)<0) + if(JSON_decode(p_td, tok, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG, "Can not decode type '%s', because invalid or incomplete" " message was received" diff --git a/core/Addfunc.cc b/core/Addfunc.cc index 457f79f04..eb965a35b 100644 --- a/core/Addfunc.cc +++ b/core/Addfunc.cc @@ -1007,7 +1007,7 @@ UNIVERSAL_CHARSTRING oct2unichar(const OCTETSTRING& invalue) UNIVERSAL_CHARSTRING ucstr; TTCN_EncDec::error_behavior_t err_behavior = TTCN_EncDec::get_error_behavior(TTCN_EncDec::ET_DEC_UCSTR); TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_DEC_UCSTR, TTCN_EncDec::EB_ERROR); - ucstr.decode_utf8(invalue.lengthof(), (const unsigned char *)invalue, CharCoding::UTF_8, true); + ucstr.decode_utf8(invalue.lengthof(), (const unsigned char *)invalue, CharCoding::UTF_8, TRUE); TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_DEC_UCSTR, err_behavior); return ucstr; } @@ -1019,7 +1019,7 @@ UNIVERSAL_CHARSTRING oct2unichar(const OCTETSTRING& invalue, TTCN_EncDec::error_behavior_t err_behavior = TTCN_EncDec::get_error_behavior(TTCN_EncDec::ET_DEC_UCSTR); TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_DEC_UCSTR, TTCN_EncDec::EB_ERROR); if ("UTF-8" == string_encoding) { - ucstr.decode_utf8(invalue.lengthof(), (const unsigned char *)invalue, CharCoding::UTF_8, true); + ucstr.decode_utf8(invalue.lengthof(), (const unsigned char *)invalue, CharCoding::UTF_8, TRUE); } else if ("UTF-16" == string_encoding) { ucstr.decode_utf16(invalue.lengthof(), (const unsigned char *)invalue, CharCoding::UTF16); @@ -2794,7 +2794,7 @@ HEXSTRING str2hex(const CHARSTRING_ELEMENT& value) CHARSTRING float2str(double value) { - bool f = value == 0.0 + boolean f = value == 0.0 || (value > -MAX_DECIMAL_FLOAT && value <= -MIN_DECIMAL_FLOAT) || (value >= MIN_DECIMAL_FLOAT && value < MAX_DECIMAL_FLOAT); // true if decimal representation possible (use %f format) @@ -2864,10 +2864,10 @@ OCTETSTRING unichar2oct(const UNIVERSAL_CHARSTRING& invalue, const CHARSTRING& s TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_DEC_UCSTR, TTCN_EncDec::EB_ERROR); TTCN_Buffer buf; if ("UTF-8" == string_encoding) { - invalue.encode_utf8(buf, false); + invalue.encode_utf8(buf, FALSE); } else if ("UTF-8 BOM" == string_encoding) { - invalue.encode_utf8(buf, true); + invalue.encode_utf8(buf, TRUE); } else if ("UTF-16" == string_encoding) { invalue.encode_utf16(buf, CharCoding::UTF16); @@ -2901,7 +2901,7 @@ OCTETSTRING unichar2oct(const UNIVERSAL_CHARSTRING& invalue) TTCN_EncDec::error_behavior_t err_behavior = TTCN_EncDec::get_error_behavior(TTCN_EncDec::ET_DEC_UCSTR); TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_DEC_UCSTR, TTCN_EncDec::EB_ERROR); TTCN_Buffer buf; - invalue.encode_utf8(buf, false); + invalue.encode_utf8(buf, FALSE); TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_DEC_UCSTR, err_behavior); return OCTETSTRING (buf.get_len(), buf.get_data()); } @@ -3037,7 +3037,7 @@ CHARSTRING encode_base64(const OCTETSTRING& msg) return ret_val; } -CHARSTRING encode_base64(const OCTETSTRING& msg, bool use_linebreaks) +CHARSTRING encode_base64(const OCTETSTRING& msg, boolean use_linebreaks) { const char *code_table = { "ABCDEFGHIJKLMNOP" diff --git a/core/Addfunc.hh b/core/Addfunc.hh index e10d34ba3..d65b694c4 100644 --- a/core/Addfunc.hh +++ b/core/Addfunc.hh @@ -478,7 +478,7 @@ extern UNIVERSAL_CHARSTRING oct2unichar(const OCTETSTRING& invalue, extern CHARSTRING get_stringencoding(const OCTETSTRING& encoded__value); extern OCTETSTRING remove_bom(const OCTETSTRING& encoded__value); -extern CHARSTRING encode_base64(const OCTETSTRING& msg, bool use_linebreaks); +extern CHARSTRING encode_base64(const OCTETSTRING& msg, boolean use_linebreaks); extern CHARSTRING encode_base64(const OCTETSTRING& msg); extern OCTETSTRING decode_base64(const CHARSTRING& b64); diff --git a/core/Array.hh b/core/Array.hh index 1249e107b..5012c95d8 100644 --- a/core/Array.hh +++ b/core/Array.hh @@ -320,10 +320,10 @@ boolean VALUE_ARRAY<T_type,array_size,index_offset>::is_bound() const { for (unsigned int i = 0; i < array_size; ++i) { if (!array_elements[i].is_bound()) { - return false; + return FALSE; } } - return true; + return TRUE; } template <typename T_type, unsigned int array_size, int index_offset> @@ -331,10 +331,10 @@ boolean VALUE_ARRAY<T_type,array_size,index_offset>::is_value() const { for (unsigned int i = 0; i < array_size; ++i) { if (!array_elements[i].is_value()) { - return false; + return FALSE; } } - return true; + return TRUE; } template <typename T_type, unsigned int array_size, int index_offset> @@ -503,7 +503,7 @@ void VALUE_ARRAY<T_type,array_size,index_offset>::decode( if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); - if(JSON_decode(p_td, tok, false)<0) + if(JSON_decode(p_td, tok, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', " "because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); diff --git a/core/Basetype.cc b/core/Basetype.cc index 6e5b25fed..65767be01 100644 --- a/core/Basetype.cc +++ b/core/Basetype.cc @@ -174,7 +174,7 @@ void Base_Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); - if(JSON_decode(p_td, tok, false)<0) + if(JSON_decode(p_td, tok, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG, "Can not decode type '%s', because invalid or incomplete" " message was received" @@ -231,7 +231,7 @@ void Base_Type::XER_encode_chk_coding(unsigned& p_coding, static const cbyte empty_tag_end[4] = "/>\n"; int Base_Type::begin_xml(const XERdescriptor_t& p_td, TTCN_Buffer& p_buf, - unsigned int& flavor, int indent, bool empty, + unsigned int& flavor, int indent, boolean empty, collector_fn collector, const char *type_atr) const { const int indenting = !is_canonical(flavor); @@ -259,7 +259,7 @@ int Base_Type::begin_xml(const XERdescriptor_t& p_td, TTCN_Buffer& p_buf, if (exer) write_ns_prefix(p_td, p_buf); const namespace_t *ns_info = NULL; - bool namespaces_needed = false; + boolean namespaces_needed = FALSE; if (exer) { if (p_td.my_module != NULL && p_td.ns_index != -1) { ns_info = p_td.my_module->get_ns(p_td.ns_index); @@ -274,7 +274,7 @@ int Base_Type::begin_xml(const XERdescriptor_t& p_td, TTCN_Buffer& p_buf, size_t num_collected = 0; char **collected_ns = NULL; - bool def_ns = false; + boolean def_ns = FALSE; if (namespaces_needed) { collected_ns = (this->*collector)(p_td, num_collected, def_ns); } @@ -331,11 +331,11 @@ int Base_Type::begin_xml(const XERdescriptor_t& p_td, TTCN_Buffer& p_buf, } void Base_Type::end_xml (const XERdescriptor_t& p_td, TTCN_Buffer& p_buf, - unsigned int flavor, int indent, bool empty) const + unsigned int flavor, int indent, boolean empty) const { int exer = is_exer(flavor); int indenting = !is_canonical(flavor); - bool omit_tag = (indent != 0) // can never omit the tag at the toplevel + boolean omit_tag = (indent != 0) // can never omit the tag at the toplevel && ( ((flavor & XER_RECOF) // can remove the tag even if not EXER && !(exer && (flavor & BXER_EMPTY_ELEM))) // except 26.6, 26.7 || (exer /*&& */ @@ -511,20 +511,20 @@ ASN_BER_TLV_t *Base_Type::BER_encode_TLV_INTEGER(unsigned, unsigned char* bn_as_bin = (unsigned char*) Malloc(num_bytes); BN_bn2bin(D, bn_as_bin); - bool pad = false; + boolean pad = FALSE; if (BN_is_negative(D)) { for(size_t i = 0; i < num_bytes; ++i){ bn_as_bin[i] = ~bn_as_bin[i]; } // add one - bool stop = false; + boolean stop = FALSE; for (int i = num_bytes - 1; i >= 0 && !stop; --i) { for (int j = 0; j < 8 && !stop; ++j) { unsigned char mask = (0x1 << j); if (!(bn_as_bin[i] & mask)) { bn_as_bin[i] |= mask; - stop = true; + stop = TRUE; } else { bn_as_bin[i] ^= mask; } @@ -747,20 +747,20 @@ boolean Base_Type::BER_decode_TLV_INTEGER(const ASN_BER_TLV_t& p_tlv, if (Vlen > sizeof(RInt)) { // Bignum - const bool negative = p_tlv.V.str.Vstr[0] & 0x80; + const boolean negative = p_tlv.V.str.Vstr[0] & 0x80; BIGNUM *D = BN_new(); if (negative) { unsigned char* const Vstr = (unsigned char*) Malloc(Vlen); memcpy(Vstr, p_tlv.V.str.Vstr, Vlen); // -1 - bool stop = false; + boolean stop = FALSE; for (int i = Vlen - 1; i >= 0 && !stop; --i) { for(int j = 0; j < 8 && !stop; ++j) { unsigned char mask = (0x1 << j); if (Vstr[i] & mask) { Vstr[i] ^= mask; - stop = true; + stop = TRUE; } else { Vstr[i] |= mask; } @@ -1020,12 +1020,12 @@ boolean Base_Type::can_start(const char *name, const char *uri, char ** Base_Type::collect_ns(const XERdescriptor_t& p_td, size_t& num, bool& def_ns) const { - def_ns = false; + def_ns = FALSE; char *tmp = NULL; if (p_td.my_module != 0 && p_td.ns_index != -1 && !(p_td.xer_bits & FORM_UNQUALIFIED)) { const namespace_t *my_ns = p_td.my_module->get_ns(p_td.ns_index); - if (!*my_ns->px) def_ns = true; + if (!*my_ns->px) def_ns = TRUE; tmp = mprintf(" xmlns%s%s='%s'", ((*my_ns->px) ? ":" : ""), my_ns->px, my_ns->ns diff --git a/core/Basetype.hh b/core/Basetype.hh index 1809b33b1..d7981767d 100644 --- a/core/Basetype.hh +++ b/core/Basetype.hh @@ -79,7 +79,7 @@ struct TTCN_Typedescriptor_t { #ifdef TITAN_RUNTIME_2 struct Erroneous_value_t { - const bool raw; + const boolean raw; const Base_Type * const errval; // NULL if `omit' const TTCN_Typedescriptor_t* type_descr; // NULL if `omit' or raw }; @@ -575,7 +575,7 @@ public: * was shortened by exactly one character. */ VIRTUAL_IF_RUNTIME_2 int begin_xml(const XERdescriptor_t& p_td, TTCN_Buffer& p_buf, - unsigned int& flavor, int indent, bool empty, + unsigned int& flavor, int indent, boolean empty, collector_fn collector = &Base_Type::collect_ns, const char *type_atr = NULL) const; /** Finish the XML representation. * @@ -587,7 +587,7 @@ public: * @param[in] empty true if an empty-element tag is needed */ VIRTUAL_IF_RUNTIME_2 void end_xml (const XERdescriptor_t& p_td, TTCN_Buffer& p_buf, - unsigned int flavor, int indent, bool empty) const; + unsigned int flavor, int indent, boolean empty) const; /** Encode JSON. * @return encoded length @@ -720,14 +720,14 @@ protected: int get_nof_elements() const; /** Returns true if the indexed element is bound */ - bool is_elem_bound(int index) const; + boolean is_elem_bound(int index) const; /** Returns the highest referenced index (uses \a max_refd_index as its cache)*/ int get_max_refd_index(); /** Returns true if the element at the given index is referenced by an 'out' or * 'inout' parameter. */ - bool is_index_refd(int index); + boolean is_index_refd(int index); public: void set_val(null_type other_value); @@ -1065,15 +1065,15 @@ extern boolean operator!=(null_type null_value, const Empty_Record_Type& other_v template <class EXPR_TYPE> class Lazy_Param { protected: - bool expr_evaluated; + boolean expr_evaluated; EXPR_TYPE expr_cache; virtual void eval_expr() {} public: - Lazy_Param(): expr_evaluated(false) {} + Lazy_Param(): expr_evaluated(FALSE) {} enum evaluated_state_t { EXPR_EVALED }; - Lazy_Param(evaluated_state_t /*p_es*/, EXPR_TYPE p_cache): expr_evaluated(true), expr_cache(p_cache) {} + Lazy_Param(evaluated_state_t /*p_es*/, EXPR_TYPE p_cache): expr_evaluated(TRUE), expr_cache(p_cache) {} operator EXPR_TYPE&() { - if (!expr_evaluated) { eval_expr(); expr_evaluated=true; } + if (!expr_evaluated) { eval_expr(); expr_evaluated=TRUE; } return expr_cache; } virtual ~Lazy_Param() {} diff --git a/core/Bitstring.cc b/core/Bitstring.cc index f0e6ce518..ace5b3707 100644 --- a/core/Bitstring.cc +++ b/core/Bitstring.cc @@ -663,7 +663,7 @@ void BITSTRING::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; - RAW_enc_tree root(true,NULL,&rp,1,p_td.raw); + RAW_enc_tree root(TRUE,NULL,&rp,1,p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} @@ -742,7 +742,7 @@ void BITSTRING::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); - if(JSON_decode(p_td, tok, false)<0) + if(JSON_decode(p_td, tok, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG, "Can not decode type '%s', because invalid or incomplete" " message was received" @@ -993,15 +993,15 @@ int BITSTRING::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& mylea } // myleaf.ext_bit=EXT_BIT_NO; if (myleaf.must_free) Free(myleaf.body.leaf.data_ptr); - myleaf.must_free = false; - myleaf.data_ptr_used = true; + myleaf.must_free = FALSE; + myleaf.data_ptr_used = TRUE; myleaf.body.leaf.data_ptr = val_ptr->bits_ptr; - bool orders = false; - if (p_td.raw->byteorder == ORDER_MSB) orders = true; + boolean orders = FALSE; + if (p_td.raw->byteorder == ORDER_MSB) orders = TRUE; if (p_td.raw->bitorderinfield == ORDER_LSB) orders = !orders; myleaf.coding_par.byteorder = orders ? ORDER_MSB : ORDER_LSB; - orders = false; - if (p_td.raw->bitorderinoctet == ORDER_MSB) orders = true; + orders = FALSE; + if (p_td.raw->bitorderinoctet == ORDER_MSB) orders = TRUE; if (p_td.raw->bitorderinfield == ORDER_LSB) orders = !orders; myleaf.coding_par.bitorder = orders ? ORDER_MSB : ORDER_LSB; @@ -1030,12 +1030,12 @@ int BITSTRING::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buff, clean_up(); init_struct(decode_length); RAW_coding_par cp; - bool orders = false; - if (p_td.raw->bitorderinoctet == ORDER_MSB) orders = true; + boolean orders = FALSE; + if (p_td.raw->bitorderinoctet == ORDER_MSB) orders = TRUE; if (p_td.raw->bitorderinfield == ORDER_LSB) orders = !orders; cp.bitorder = orders ? ORDER_MSB : ORDER_LSB; - orders = false; - if (p_td.raw->byteorder == ORDER_MSB) orders = true; + orders = FALSE; + if (p_td.raw->byteorder == ORDER_MSB) orders = TRUE; if (p_td.raw->bitorderinfield == ORDER_LSB) orders = !orders; cp.byteorder = orders ? ORDER_MSB : ORDER_LSB; cp.fieldorder = p_td.raw->fieldorder; @@ -1188,7 +1188,7 @@ int BITSTRING::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_ json_token_t token = JSON_TOKEN_NONE; char* value = 0; size_t value_len = 0; - boolean error = false; + boolean error = FALSE; int dec_len = 0; boolean use_default = p_td.json->default_value && 0 == p_tok.get_buffer_length(); if (use_default) { @@ -1214,12 +1214,12 @@ int BITSTRING::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_ if ('0' <= value[i] && '1' >= value[i]) { set_bit(i, value[i] - '0'); } else { - error = true; + error = TRUE; break; } } } else { - error = true; + error = TRUE; } } else { return JSON_ERROR_INVALID_TOKEN; @@ -2133,8 +2133,8 @@ int BITSTRING::RAW_encode_negtest_raw(RAW_enc_tree& p_myleaf) const { if (p_myleaf.must_free) Free(p_myleaf.body.leaf.data_ptr); - p_myleaf.must_free = false; - p_myleaf.data_ptr_used = true; + p_myleaf.must_free = FALSE; + p_myleaf.data_ptr_used = TRUE; p_myleaf.body.leaf.data_ptr = val_ptr->bits_ptr; return p_myleaf.length = val_ptr->n_bits; } diff --git a/core/Boolean.cc b/core/Boolean.cc index ab6874617..a36cd0df4 100644 --- a/core/Boolean.cc +++ b/core/Boolean.cc @@ -326,7 +326,7 @@ void BOOLEAN::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); - if(JSON_decode(p_td, tok, false)<0) + if(JSON_decode(p_td, tok, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG, "Can not decode type '%s', because invalid or incomplete" " message was received" @@ -623,7 +623,7 @@ int BOOLEAN::XER_encode(const XERdescriptor_t& p_td, int exer = is_exer(flavor); flavor |= (SIMPLE_TYPE | BXER_EMPTY_ELEM); - if (begin_xml(p_td, p_buf, flavor, indent, false) == -1) --encoded_length; + if (begin_xml(p_td, p_buf, flavor, indent, FALSE) == -1) --encoded_length; if (exer) { if (p_td.xer_bits & XER_TEXT) { @@ -639,7 +639,7 @@ int BOOLEAN::XER_encode(const XERdescriptor_t& p_td, else p_buf.put_s(8, (cbyte*)"<false/>"); } - end_xml(p_td, p_buf, flavor, indent, false); + end_xml(p_td, p_buf, flavor, indent, FALSE); return (int)p_buf.get_len() - encoded_length; } @@ -702,16 +702,16 @@ int BOOLEAN::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, // extract the data if (value[1]=='\0' && (*value & 0x3E) == '0') { - bound_flag = true; + bound_flag = TRUE; boolean_value = *value == '1'; } else if (!strcmp(value, "true")) { - boolean_value = true; - bound_flag = true; + boolean_value = TRUE; + bound_flag = TRUE; } else if (!strcmp(value, "false")) { - boolean_value = false; - bound_flag = true; + boolean_value = FALSE; + bound_flag = TRUE; } } @@ -763,15 +763,15 @@ int BOOLEAN::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_to return JSON_ERROR_FATAL; } else if (JSON_TOKEN_LITERAL_TRUE == token) { - bound_flag = true; - boolean_value = true; + bound_flag = TRUE; + boolean_value = TRUE; } else if (JSON_TOKEN_LITERAL_FALSE == token) { - bound_flag = true; - boolean_value = false; + bound_flag = TRUE; + boolean_value = FALSE; } else { - bound_flag = false; + bound_flag = FALSE; return JSON_ERROR_INVALID_TOKEN; } return dec_len; diff --git a/core/Charstring.cc b/core/Charstring.cc index f3f034663..260b9be70 100644 --- a/core/Charstring.cc +++ b/core/Charstring.cc @@ -332,7 +332,7 @@ UNIVERSAL_CHARSTRING CHARSTRING::operator+ "universal charstring value."); if (val_ptr->n_chars == 0) return other_value; if (other_value.charstring) { - UNIVERSAL_CHARSTRING ret_val(val_ptr->n_chars + other_value.cstr.val_ptr->n_chars, true); + UNIVERSAL_CHARSTRING ret_val(val_ptr->n_chars + other_value.cstr.val_ptr->n_chars, TRUE); memcpy(ret_val.cstr.val_ptr->chars_ptr, val_ptr->chars_ptr, val_ptr->n_chars); memcpy(ret_val.cstr.val_ptr->chars_ptr + val_ptr->n_chars, other_value.cstr.val_ptr->chars_ptr, other_value.cstr.val_ptr->n_chars); return ret_val; @@ -360,7 +360,7 @@ UNIVERSAL_CHARSTRING CHARSTRING::operator+ other_value.must_bound("The right operand of concatenation is an unbound " "universal charstring element."); if (other_value.str_val.charstring) { - UNIVERSAL_CHARSTRING ret_val(val_ptr->n_chars + 1, true); + UNIVERSAL_CHARSTRING ret_val(val_ptr->n_chars + 1, TRUE); memcpy(ret_val.cstr.val_ptr->chars_ptr, val_ptr->chars_ptr, val_ptr->n_chars); ret_val.cstr.val_ptr->chars_ptr[val_ptr->n_chars] = other_value.str_val.cstr.val_ptr->chars_ptr[other_value.uchar_pos]; return ret_val; @@ -898,7 +898,7 @@ void CHARSTRING::decode(const TTCN_Typedescriptor_t& p_td, TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); - if(JSON_decode(p_td, tok, false)<0) + if(JSON_decode(p_td, tok, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG, "Can not decode type '%s', because invalid or incomplete" " message was received" @@ -1238,7 +1238,7 @@ int CHARSTRING::XER_encode(const XERdescriptor_t& p_td, int exer = is_exer(flavor |= SIMPLE_TYPE); // SIMPLE_TYPE has no influence on is_exer, we set it for later int encoded_length=(int)p_buf.get_len(); - bool do_empty_element = val_ptr==NULL || val_ptr->n_chars == 0; + boolean do_empty_element = val_ptr==NULL || val_ptr->n_chars == 0; flavor &= ~XER_RECOF; // charstring doesn't care @@ -1368,7 +1368,7 @@ int CHARSTRING::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, // Let the caller do reader.AdvanceAttribute(); } else { - bool omit_tag = exer + boolean omit_tag = exer && (p_td.xer_bits & UNTAGGED || flavor & (EMBED_VALUES|XER_LIST|USE_TYPE_ATTR|USE_NIL)); for (; success == 1; success = reader.Read()) { int type = reader.NodeType(); @@ -1622,23 +1622,23 @@ boolean CHARSTRING::from_JSON_string(const char* p_value, size_t p_value_len, bo start = 1; end = p_value_len - 1; if (p_value[0] != '\"' || p_value[p_value_len - 1] != '\"') { - return false; + return FALSE; } } // The charstring will be shorter than the JSON string, at least by the 2 quotes char* str = (char*)Malloc(end - start); size_t len = 0; - boolean error = false; + boolean error = FALSE; for (size_t i = start; i < end; ++i) { if (0 > p_value[i]) { - error = true; + error = TRUE; break; } if ('\\' == p_value[i]) { if (i == end - 1) { - error = true; + error = TRUE; break; } switch(p_value[i + 1]) { @@ -1677,19 +1677,19 @@ boolean CHARSTRING::from_JSON_string(const char* p_value, size_t p_value_len, bo } else { // error (found something other than hex digits) -> leave the for cycle i = end; - error = true; + error = TRUE; } } else { // error (not enough characters left or the first 2 hex digits are non-null) -> leave the for cycle i = end; - error = true; + error = TRUE; } break; } default: // error (invalid escaped character) -> leave the for cycle i = end; - error = true; + error = TRUE; break; } // skip an extra character (the \) @@ -1700,7 +1700,7 @@ boolean CHARSTRING::from_JSON_string(const char* p_value, size_t p_value_len, bo if (check_quotes && i == p_value_len - 1) { // Special case: the last 2 characters are double escaped quotes ('\\' and '\"') - error = true; + error = TRUE; } } @@ -1908,7 +1908,7 @@ UNIVERSAL_CHARSTRING CHARSTRING_ELEMENT::operator+ other_value.must_bound("The right operand of concatenation is an unbound " "universal charstring value."); if (other_value.charstring) { - UNIVERSAL_CHARSTRING ret_val(other_value.cstr.val_ptr->n_chars + 1, true); + UNIVERSAL_CHARSTRING ret_val(other_value.cstr.val_ptr->n_chars + 1, TRUE); ret_val.cstr.val_ptr->chars_ptr[0] = str_val.val_ptr->chars_ptr[char_pos]; memcpy(ret_val.cstr.val_ptr->chars_ptr + 1, other_value.cstr.val_ptr->chars_ptr, other_value.cstr.val_ptr->n_chars); return ret_val; diff --git a/core/Communication.cc b/core/Communication.cc index 6c4df1c2b..43873351c 100644 --- a/core/Communication.cc +++ b/core/Communication.cc @@ -154,7 +154,7 @@ const IPAddress *TTCN_Communication::get_mc_address() return hcnh.get_mc_addr(); } -bool TTCN_Communication::is_mc_connected() +boolean TTCN_Communication::is_mc_connected() { return is_connected; } @@ -572,7 +572,7 @@ void TTCN_Communication::process_all_messages_hc() process_error(); break; case MSG_CONFIGURE: - process_configure(msg_end, false); + process_configure(msg_end, FALSE); break; case MSG_CREATE_MTC: process_create_mtc(); @@ -705,7 +705,7 @@ void TTCN_Communication::process_all_messages_tc() process_exit_mtc(); break; case MSG_CONFIGURE: - process_configure(msg_end, true); + process_configure(msg_end, TRUE); break; default: process_unsupported_message(msg_type, msg_end); @@ -1266,7 +1266,7 @@ void TTCN_Communication::send_message(Text_Buf& text_buf) } } -void TTCN_Communication::process_configure(int msg_end, bool to_mtc) +void TTCN_Communication::process_configure(int msg_end, boolean to_mtc) { switch (TTCN_Runtime::get_state()) { case TTCN_Runtime::HC_IDLE: diff --git a/core/Communication.hh b/core/Communication.hh index 1cf41e27c..784dd927e 100644 --- a/core/Communication.hh +++ b/core/Communication.hh @@ -45,13 +45,13 @@ class TTCN_Communication { public: static const NetworkFamily& get_network_family() { return hcnh.get_family(); } - static bool has_local_address() { return local_addr_set; } + static boolean has_local_address() { return local_addr_set; } static void set_local_address(const char *host_name); static const IPAddress *get_local_address(); static void set_mc_address(const char *host_name, unsigned short tcp_port); static const IPAddress *get_mc_address(); - static bool is_mc_connected(); + static boolean is_mc_connected(); static void connect_mc(); static void disconnect_mc(); static void close_mc_connection(); @@ -182,7 +182,7 @@ private: /** @name Handlers of various messages * @{ */ - static void process_configure(int msg_end, bool to_mtc); + static void process_configure(int msg_end, boolean to_mtc); static void process_create_mtc(); static void process_create_ptc(); static void process_kill_process(); diff --git a/core/Debugger.cc b/core/Debugger.cc index 7bae62626..69f1c09af 100644 --- a/core/Debugger.cc +++ b/core/Debugger.cc @@ -35,7 +35,7 @@ void TTCN3_Debugger::switch_state(const char* p_state_str) print(DRET_NOTIFICATION, "The debugger is already switched on."); } else { - active = true; + active = TRUE; print(DRET_SETTING_CHANGE, "Debugger switched on."); } } @@ -44,7 +44,7 @@ void TTCN3_Debugger::switch_state(const char* p_state_str) print(DRET_NOTIFICATION, "The debugger is already switched off."); } else { - active = false; + active = FALSE; print(DRET_SETTING_CHANGE, "Debugger switched off."); } } @@ -53,15 +53,15 @@ void TTCN3_Debugger::switch_state(const char* p_state_str) } } -static bool is_numeric(const char* p_str) +static boolean is_numeric(const char* p_str) { size_t len = strlen(p_str); for (size_t i = 0; i < len; ++i) { if (p_str[i] < '0' || p_str[i] > '9') { - return false; + return FALSE; } } - return true; + return TRUE; } void TTCN3_Debugger::set_breakpoint(const char* p_module, const char* p_location, @@ -129,13 +129,13 @@ void TTCN3_Debugger::set_breakpoint(const char* p_module, const char* p_location void TTCN3_Debugger::remove_breakpoint(const char* p_module, const char* p_location) { - bool all_breakpoints = !strcmp(p_module, "all"); + boolean all_breakpoints = !strcmp(p_module, "all"); if (p_location != NULL) { if (!strcmp(p_location, "all")) { - bool found = false; + boolean found = FALSE; for (size_t i = breakpoints.size(); i > 0; --i) { if (!strcmp(breakpoints[i - 1].module, p_module)) { - found = true; + found = TRUE; Free(breakpoints[i - 1].module); Free(breakpoints[i - 1].batch_file); breakpoints.erase_at(i - 1); @@ -208,19 +208,19 @@ void TTCN3_Debugger::set_automatic_breakpoint(const char* p_event_str, const char* p_state_str, const char* p_batch_file) { - bool new_state; + boolean new_state; if (!strcmp(p_state_str, "on")) { - new_state = true; + new_state = TRUE; } else if(!strcmp(p_state_str, "off")) { - new_state = false; + new_state = FALSE; } else { print(DRET_NOTIFICATION, "Argument 2 is invalid. Expected 'on' or 'off'."); return; } const char* sbp_type_str; - bool state_changed; + boolean state_changed; char** old_batch_file_ptr; if (!strcmp(p_event_str, "fail")) { state_changed = (fail_behavior.trigger != new_state); @@ -480,7 +480,7 @@ void TTCN3_Debugger::configure_function_calls(const char* p_config, } FILE* new_fp = NULL; char* final_file_name = NULL; - bool same_setting = false; + boolean same_setting = FALSE; int new_size = 0; switch (cfg) { case CALLS_TO_FILE: @@ -488,7 +488,7 @@ void TTCN3_Debugger::configure_function_calls(const char* p_config, if (function_calls.cfg == CALLS_TO_FILE && strcmp(p_file_name, function_calls.file.name) == 0) { // don't reopen it if it's the same file as before - same_setting = true; + same_setting = TRUE; } else if (!TTCN_Runtime::is_hc()) { // don't open any files on HCs, just store settings for future PTCs @@ -576,21 +576,21 @@ void TTCN3_Debugger::print_function_calls(const char* p_amount) function_calls.buffer.start == (function_calls.buffer.end + 1) % function_calls.buffer.size) ? function_calls.buffer.size : function_calls.buffer.end + 1; - bool invalid_arg = false; + boolean invalid_arg = FALSE; if (p_amount == NULL || strcmp(p_amount, "all") == 0) { amount = limit; } else if (is_numeric(p_amount)) { amount = strtol(p_amount, NULL, 10); if (amount == 0) { - invalid_arg = true; + invalid_arg = TRUE; } else if (amount > limit) { amount = limit; } } else { - invalid_arg = true; + invalid_arg = TRUE; } if (invalid_arg) { print(DRET_NOTIFICATION, "Argument 1 is invalid. Expected 'all' or non-zero " @@ -610,21 +610,21 @@ void TTCN3_Debugger::print_function_calls(const char* p_amount) void TTCN3_Debugger::set_output(const char* p_output_type, const char* p_file_name) { FILE* new_fp = NULL; - bool file, console; - bool same_file = false; + boolean file, console; + boolean same_file = FALSE; char* final_file_name = NULL; // check the command's parameters before actually changing anything if (!strcmp(p_output_type, "console")) { - file = false; - console = true; + file = FALSE; + console = TRUE; } else if (!strcmp(p_output_type, "file")) { - file = true; - console = false; + file = TRUE; + console = FALSE; } else if (!strcmp(p_output_type, "both")) { - file = true; - console = true; + file = TRUE; + console = TRUE; } else { print(DRET_NOTIFICATION, "Argument 1 is invalid. Expected 'console', 'file' or 'both'."); @@ -637,7 +637,7 @@ void TTCN3_Debugger::set_output(const char* p_output_type, const char* p_file_na } if (output_file_name != NULL && !strcmp(p_file_name, output_file_name)) { // don't reopen it if it's the same file as before - same_file = true; + same_file = TRUE; } else if (!TTCN_Runtime::is_hc()) { // don't open any files on HCs, just store settings for future PTCs @@ -675,8 +675,8 @@ void TTCN3_Debugger::set_output(const char* p_output_type, const char* p_file_na void TTCN3_Debugger::set_global_batch_file(const char* p_state_str, const char* p_file_name) { - bool delete_old = false; - bool copy_new = false; + boolean delete_old = FALSE; + boolean copy_new = FALSE; if (!strcmp(p_state_str, "on")) { if (p_file_name != NULL) { if (global_batch_file != NULL) { @@ -687,14 +687,14 @@ void TTCN3_Debugger::set_global_batch_file(const char* p_state_str, else { print(DRET_SETTING_CHANGE, "Global batch file changed from '%s' to '%s'.", global_batch_file, p_file_name); - delete_old = true; - copy_new = true; + delete_old = TRUE; + copy_new = TRUE; } } else { print(DRET_SETTING_CHANGE, "Global batch file switched on and set to '%s'.", p_file_name); - copy_new = true; + copy_new = TRUE; } } else { @@ -704,7 +704,7 @@ void TTCN3_Debugger::set_global_batch_file(const char* p_state_str, else if (!strcmp(p_state_str, "off")) { if (global_batch_file != NULL) { print(DRET_SETTING_CHANGE, "Global batch file switched off."); - delete_old = true; + delete_old = TRUE; } else { print(DRET_NOTIFICATION, "Global batch file was already switched off."); @@ -758,10 +758,10 @@ void TTCN3_Debugger::run_to_cursor(const char* p_module, const char* p_location) resume(); } -void TTCN3_Debugger::halt(const char* p_batch_file, bool p_run_global_batch) +void TTCN3_Debugger::halt(const char* p_batch_file, boolean p_run_global_batch) { if (!halted) { - halted = true; + halted = TRUE; Free(temporary_breakpoint.module); temporary_breakpoint.module = NULL; temporary_breakpoint.line = 0; @@ -808,7 +808,7 @@ void TTCN3_Debugger::halt(const char* p_batch_file, bool p_run_global_batch) void TTCN3_Debugger::resume() { if (halted) { - halted = false; + halted = FALSE; stack_level = -1; print(DRET_NOTIFICATION, "Test execution resumed."); } @@ -820,16 +820,16 @@ void TTCN3_Debugger::resume() void TTCN3_Debugger::exit_(const char* p_what) { if (!strcmp(p_what, "test")) { - exiting = false; + exiting = FALSE; } else if (!strcmp(p_what, "all")) { - exiting = true; + exiting = TRUE; } else { print(DRET_NOTIFICATION, "Argument 1 is invalid. Expected 'test' or 'all'."); return; } - halted = false; + halted = FALSE; if (!TTCN_Runtime::is_hc()) { print((exiting && TTCN_Runtime::is_mtc()) ? DRET_EXIT_ALL : DRET_NOTIFICATION, "Exiting %s.", exiting ? "test execution" : "current test"); @@ -944,17 +944,17 @@ void TTCN3_Debugger::test_execution_started() function_calls.buffer.start = 0; function_calls.buffer.end = -1; } - exiting = false; + exiting = FALSE; if (TTCN_Runtime::is_single()) { TTCN_Debugger_UI::init(); if (initial_batch_file) { - halt(initial_batch_file, false); + halt(initial_batch_file, FALSE); } else if (halt_at_start) { - halt(NULL, false); + halt(NULL, FALSE); } } - halt_at_start = true; + halt_at_start = TRUE; } void TTCN3_Debugger::test_execution_finished() @@ -1002,12 +1002,12 @@ void TTCN3_Debugger::print(int return_type, const char* fmt, ...) const TTCN3_Debugger::TTCN3_Debugger() { - enabled = false; - active = false; - halted = false; + enabled = FALSE; + active = FALSE; + halted = FALSE; output_file = NULL; output_file_name = NULL; - send_to_console = true; + send_to_console = TRUE; function_calls.cfg = CALLS_STORE_ALL; function_calls.buffer.size = 0; function_calls.buffer.start = 0; @@ -1017,9 +1017,9 @@ TTCN3_Debugger::TTCN3_Debugger() last_breakpoint_entry.line = 0; last_breakpoint_entry.stack_size = 0; stack_level = -1; - fail_behavior.trigger = false; + fail_behavior.trigger = FALSE; fail_behavior.batch_file = NULL; - error_behavior.trigger = false; + error_behavior.trigger = FALSE; error_behavior.batch_file = NULL; global_batch_file = NULL; command_result = NULL; @@ -1030,8 +1030,8 @@ TTCN3_Debugger::TTCN3_Debugger() temporary_breakpoint.line = 0; temporary_breakpoint.function = NULL; temporary_breakpoint.batch_file = NULL; // not used - exiting = false; - halt_at_start = false; + exiting = FALSE; + halt_at_start = FALSE; initial_batch_file = NULL; } @@ -1091,7 +1091,7 @@ void TTCN3_Debugger::breakpoint_entry(int p_line) { if (active && !call_stack.empty()) { const char* module_name = call_stack[call_stack.size() - 1].function->get_module_name(); - bool trigger = false; + boolean trigger = FALSE; const char* trigger_type; int actual_line; const char* batch_file = NULL; @@ -1119,7 +1119,7 @@ void TTCN3_Debugger::breakpoint_entry(int p_line) if (stepping_type == STEP_INTO || (stepping_type == STEP_OVER && call_stack.size() <= stepping_stack_size) || (stepping_type == STEP_OUT && call_stack.size() < stepping_stack_size)) { - trigger = true; + trigger = TRUE; trigger_type = "Stepped to"; break; } @@ -1132,7 +1132,7 @@ void TTCN3_Debugger::breakpoint_entry(int p_line) (temporary_breakpoint.function != NULL && last_breakpoint_entry.stack_size == call_stack.size() - 1 && strcmp(temporary_breakpoint.function, function_name) == 0))) { - trigger = true; + trigger = TRUE; trigger_type = "Ran to"; break; } @@ -1145,7 +1145,7 @@ void TTCN3_Debugger::breakpoint_entry(int p_line) pos = find_breakpoint(module_name, 0, function_name); } if (pos != breakpoints.size()) { - trigger = true; + trigger = TRUE; batch_file = breakpoints[pos].batch_file; } trigger_type = "User breakpoint reached at"; @@ -1157,7 +1157,7 @@ void TTCN3_Debugger::breakpoint_entry(int p_line) if (!TTCN_Runtime::is_single()) { TTCN_Communication::send_debug_halt_req(); } - halt(batch_file, true); + halt(batch_file, TRUE); } last_breakpoint_entry.module = module_name; last_breakpoint_entry.line = p_line; @@ -1413,7 +1413,7 @@ void TTCN3_Debugger::add_scope(TTCN3_Debug_Scope* p_scope) void TTCN3_Debugger::remove_function(TTCN3_Debug_Function* p_function) { if (!call_stack.empty() && call_stack[call_stack.size() - 1].function == p_function) { - bool removing_test_case = call_stack[call_stack.size() - 1].function->is_test_case(); + boolean removing_test_case = call_stack[call_stack.size() - 1].function->is_test_case(); int caller_line = call_stack[call_stack.size() - 1].caller_line; call_stack.erase_at(call_stack.size() - 1); if (call_stack.empty()) { @@ -1551,7 +1551,7 @@ void TTCN3_Debugger::store_function_call(char* p_snapshot) fflush(function_calls.file.ptr); break; case CALLS_RING_BUFFER: { - bool first = function_calls.buffer.end == -1; + boolean first = function_calls.buffer.end == -1; function_calls.buffer.end = (function_calls.buffer.end + 1) % function_calls.buffer.size; function_calls.buffer.ptr[function_calls.buffer.end] = p_snapshot; @@ -1665,25 +1665,25 @@ void TTCN3_Debugger::execute_command(int p_command, int p_argument_count, print_settings(); break; case D_PRINT_CALL_STACK: - CHECK_CALL_STACK(true) + CHECK_CALL_STACK(TRUE) CHECK_NOF_ARGUMENTS(0) print_call_stack(); break; case D_SET_STACK_LEVEL: - CHECK_CALL_STACK(true) + CHECK_CALL_STACK(TRUE) CHECK_NOF_ARGUMENTS(1) CHECK_INT_ARGUMENT(0) set_stack_level(str2int(p_arguments[0])); break; case D_LIST_VARIABLES: - CHECK_CALL_STACK(true) + CHECK_CALL_STACK(TRUE) CHECK_NOF_ARGUMENTS_RANGE(0, 2) call_stack[STACK_LEVEL].function->list_variables( (p_argument_count > 0) ? p_arguments[0] : NULL, (p_argument_count == 2) ? p_arguments[1] : NULL); break; case D_PRINT_VARIABLE: - CHECK_CALL_STACK(true) + CHECK_CALL_STACK(TRUE) CHECK_NOF_ARGUMENTS_MIN(1) for (int i = 0; i < p_argument_count; ++i) { if (i != 0) { @@ -1720,7 +1720,7 @@ void TTCN3_Debugger::execute_command(int p_command, int p_argument_count, } break; case D_OVERWRITE_VARIABLE: - CHECK_CALL_STACK(true) + CHECK_CALL_STACK(TRUE) CHECK_NOF_ARGUMENTS_MIN(2) overwrite_variable(p_arguments[0], p_argument_count - 1, p_arguments + 1); break; @@ -1729,17 +1729,17 @@ void TTCN3_Debugger::execute_command(int p_command, int p_argument_count, print_function_calls((p_argument_count > 0) ? p_arguments[0] : NULL); break; case D_STEP_OVER: - CHECK_CALL_STACK(true) + CHECK_CALL_STACK(TRUE) CHECK_NOF_ARGUMENTS(0) step(STEP_OVER); break; case D_STEP_INTO: - CHECK_CALL_STACK(true) + CHECK_CALL_STACK(TRUE) CHECK_NOF_ARGUMENTS(0) step(STEP_INTO); break; case D_STEP_OUT: - CHECK_CALL_STACK(true) + CHECK_CALL_STACK(TRUE) CHECK_NOF_ARGUMENTS(0) step(STEP_OUT); break; @@ -1755,7 +1755,7 @@ void TTCN3_Debugger::execute_command(int p_command, int p_argument_count, CHECK_CALL_STACK(TTCN_Runtime::is_mtc()) } CHECK_NOF_ARGUMENTS(0) - halt(NULL, false); + halt(NULL, FALSE); break; case D_CONTINUE: CHECK_NOF_ARGUMENTS(0) @@ -1910,10 +1910,10 @@ void TTCN3_Debug_Scope::list_variables(regex_t* p_posix_regexp, bool& p_first, for (size_t i = 0; i < variables.size(); ++i) { if (p_posix_regexp == NULL || regexec(p_posix_regexp, variables[i]->name, 0, NULL, 0) == 0) { - bool imported = p_module != NULL && strcmp(p_module, variables[i]->module) != 0; + boolean imported = p_module != NULL && strcmp(p_module, variables[i]->module) != 0; ttcn3_debugger.add_to_result("%s%s%s%s", p_first ? "" : " ", imported ? variables[i]->module : "", imported ? "." : "", variables[i]->name); - p_first = false; + p_first = FALSE; } } } @@ -2104,23 +2104,23 @@ void TTCN3_Debug_Function::print_function() const void TTCN3_Debug_Function::list_variables(const char* p_scope, const char* p_filter) const { - bool first = true; - bool list_local = false; - bool list_global = false; - bool list_comp = false; + boolean first = TRUE; + boolean list_local = FALSE; + boolean list_global = FALSE; + boolean list_comp = FALSE; if (p_scope == NULL || !strcmp(p_scope, "all")) { - list_local = true; - list_global = true; - list_comp = true; + list_local = TRUE; + list_global = TRUE; + list_comp = TRUE; } else if (!strcmp(p_scope, "local")) { - list_local = true; + list_local = TRUE; } else if (!strcmp(p_scope, "global")) { - list_global = true; + list_global = TRUE; } else if (!strcmp(p_scope, "comp")) { - list_comp = true; + list_comp = TRUE; } else { ttcn3_debugger.print(DRET_NOTIFICATION, "Argument 1 is invalid. " @@ -2153,7 +2153,7 @@ void TTCN3_Debug_Function::list_variables(const char* p_scope, const char* p_fil if (posix_regexp == NULL || regexec(posix_regexp, variables[i]->name, 0, NULL, 0) == 0) { ttcn3_debugger.add_to_result("%s%s", first ? "" : " ", variables[i]->name); - first = false; + first = FALSE; } } } @@ -2172,12 +2172,12 @@ void TTCN3_Debug_Function::list_variables(const char* p_scope, const char* p_fil } } -bool TTCN3_Debug_Function::is_control_part() const +boolean TTCN3_Debug_Function::is_control_part() const { return !strcmp(function_type, "control"); } -bool TTCN3_Debug_Function::is_test_case() const +boolean TTCN3_Debug_Function::is_test_case() const { return !strcmp(function_type, "testcase"); } diff --git a/core/Debugger.hh b/core/Debugger.hh index 8abfa0c32..23f90ca8c 100644 --- a/core/Debugger.hh +++ b/core/Debugger.hh @@ -126,7 +126,7 @@ public: /** type for storing the settings of automatic breakpoints */ struct automatic_breakpoint_behavior_t { /** indicates whether the breakpoint should be triggered by the associated event */ - bool trigger; + boolean trigger; /** batch file to be executed if the breakpoint is triggered (optional), owned */ char* batch_file; }; @@ -192,13 +192,13 @@ private: /** indicates whether the debugger has been activated, meaning that the debugger's * command line option (-n) was used during the build (switched automatically * by generated code) */ - bool enabled; + boolean enabled; /** the debugger's on/off switch (switched by the user) */ - bool active; + boolean active; /** true if test execution has been halted (by a breakpoint or by the user) */ - bool halted; + boolean halted; /** the debugger's output file handler (NULL if the debugger's output is only * sent to the console); owned */ @@ -209,7 +209,7 @@ private: char* output_file_name; /** indicates whether the debugger's output should be sent to the console */ - bool send_to_console; + boolean send_to_console; /** list of all global and component variables, elements are owned */ Vector<variable_t*> variables; @@ -266,10 +266,10 @@ private: /** true if an 'exit all' command was issued * switched to false when test execution is restarted */ - bool exiting; + boolean exiting; /** test execution is automatically halted at start if set to true */ - bool halt_at_start; + boolean halt_at_start; /** batch file executed automatically at the start of test execution * if not set to NULL (not owned) */ @@ -375,7 +375,7 @@ private: * @param p_run_global_batch indicates whether the global batch file should * be executed after the halt (only if p_batch_file is NULL) * handles the D_HALT command */ - void halt(const char* p_batch_file, bool p_run_global_batch); + void halt(const char* p_batch_file, boolean p_run_global_batch); /** resumes the halted test execution * handles the D_CONTINUE command */ @@ -417,7 +417,7 @@ public: ////////////////////////////////////////////////////// /** activates the debugger */ - void activate() { enabled = true; } + void activate() { enabled = TRUE; } /** creates, stores and returns a new global scope for the specified module * (this scope contains all global variables visible in the module) */ @@ -519,13 +519,13 @@ public: ////////////////////////////////////////////////////// /** returns true if the debugger is activated (through the compiler switch) */ - bool is_activated() const { return enabled; } + boolean is_activated() const { return enabled; } /** returns true if the debugger is switched on */ - bool is_on() const { return active; } + boolean is_on() const { return active; } /** returns true if test execution has been halted by the debugger */ - bool is_halted() const { return halted; } + boolean is_halted() const { return halted; } /** prints the formatted string to the console and/or output file * (used for printing notifications or error messages) */ @@ -590,10 +590,10 @@ public: /** indicates whether an 'exit all' command has been issued * (this causes the execution of tests in the current queue to stop) */ - bool is_exiting() const { return exiting; } + boolean is_exiting() const { return exiting; } /** sets the debugger to halt test execution at start (only in single mode) */ - void set_halt_at_start() { halt_at_start = true; } + void set_halt_at_start() { halt_at_start = TRUE; } /** sets the specified batch file to be executed at the start of test execution * (only in single mode) */ @@ -656,7 +656,7 @@ public: ////////////////////////////////////////////////////// /** returns true if there is at least one variable in the scope object */ - bool has_variables() const { return !variables.empty(); } + boolean has_variables() const { return !variables.empty(); } /** returns the specified variable, if found, otherwise returns NULL * (the name searched for can also be prefixed with the module name in @@ -800,10 +800,10 @@ public: void list_variables(const char* p_scope, const char* p_filter) const; /** returns true if this instance belongs to a control part */ - bool is_control_part() const; + boolean is_control_part() const; /** returns true if this instance belongs to a test case */ - bool is_test_case() const; + boolean is_test_case() const; }; /** This macro stores a function's return value in the current function. diff --git a/core/Encdec.cc b/core/Encdec.cc index 927123899..52ad6a154 100644 --- a/core/Encdec.cc +++ b/core/Encdec.cc @@ -675,7 +675,7 @@ void TTCN_Buffer::put_b(size_t len, const unsigned char *s, unsigned char* st=NULL; unsigned char* st2=NULL; int loc_align=align<0?-align:align; - bool must_align=false; + boolean must_align=FALSE; raw_order_t local_bitorder=coding_par.bitorder; raw_order_t local_fieldorder=coding_par.fieldorder; if(current_bitorder) { @@ -724,7 +724,7 @@ local_fieldorder==ORDER_MSB?"M":"L" else{ if(coding_par.byteorder==ORDER_MSB) align=-align; if(align<0) put_zero(loc_align,local_fieldorder); - else must_align=true; + else must_align=TRUE; } } if(len==0) { diff --git a/core/Error.cc b/core/Error.cc index 86d3035a0..ff0e050f3 100644 --- a/core/Error.cc +++ b/core/Error.cc @@ -315,7 +315,7 @@ void TTCN_error(const char *err_msg, ...) if (TTCN_Logger::SINFO_NONE == TTCN_Logger::get_source_info_format()) { //Always print some location info in case of dynamic testcase error - char * loc = TTCN_Location::print_location(false, true, false); + char * loc = TTCN_Location::print_location(FALSE, TRUE, FALSE); if (loc) { TTCN_Logger::log_event_str(loc); TTCN_Logger::log_event_str(": "); diff --git a/core/Fd_And_Timeout_User.hh b/core/Fd_And_Timeout_User.hh index 9fca42706..17cd6c6d0 100644 --- a/core/Fd_And_Timeout_User.hh +++ b/core/Fd_And_Timeout_User.hh @@ -68,7 +68,7 @@ public: #else static void initialize(int fdLimit) { nItems = 0; capacity = fdLimit; items2 = 0; pollFds2 = 0; - needUpdate = false; nPollFdsFrozen = 0; + needUpdate = FALSE; nPollFdsFrozen = 0; for (int i = 0; i < ITEM1_CAPACITY; ++i) { items1[i].init(); // for debugging init(pollFds1[i++]); // for debugging @@ -84,7 +84,7 @@ public: #endif // implementation dependent public interface // only for better performance - static inline bool isItems1Used() { return items2 == 0; } + static inline boolean isItems1Used() { return items2 == 0; } #ifdef USE_EPOLL static inline fd_event_type_enum item1atIndex(int i, int * fd, Fd_Event_Handler * * handler) { @@ -151,7 +151,7 @@ private: } while (j - i > 1); return (fd <= items1[i].fd) ? i : j; } - static inline bool findInItems2(int fd) { + static inline boolean findInItems2(int fd) { #ifdef USE_EPOLL return items2[fd].hnd != 0; #else @@ -173,7 +173,7 @@ return items2[fd].hnd != 0; static pollfd * pollFds2; // pollFd2, items2 might be rewritten static inline void init(pollfd & p) { p.fd = -1; p.events = p.revents = 0; } - static bool needUpdate; + static boolean needUpdate; static int nPollFdsFrozen; static void copyItems2ToItems1(); #endif @@ -182,7 +182,7 @@ public: static const int MAX_EPOLL_EVENTS = 64; static int epollFd; static epoll_event epollEvents[MAX_EPOLL_EVENTS]; - static bool epollMarkFds(int nEvents); + static boolean epollMarkFds(int nEvents); static void epollUnmarkFds(int nEvents); static inline __uint32_t eventToEpollEvent(fd_event_type_enum event) { __uint32_t epollEvent = 0; @@ -277,7 +277,7 @@ private: //static const int NOI_MAX = (FD_SETSIZE + NOBPI - 1) / NOBPI; static const int NORB = FD_SETSIZE % NOBPI; // Remaining Bits static const int RBM = (1 << NORB) - 1; // Mask for Remaining Bits - static inline bool fdSetOr (fd_set & fdSet, const fd_set & fdSet2) { + static inline boolean fdSetOr (fd_set & fdSet, const fd_set & fdSet2) { long orV = 0; for (int i = 0; i < NOI; ++i) orV |= ( ((long*)&fdSet)[i] |= ((const long*)&fdSet2)[i] ); @@ -285,7 +285,7 @@ private: orV |= RBM & ( ((long*)&fdSet)[NOI] |= ((const long*)&fdSet2)[NOI]); return orV != 0; } - static inline bool fdSetSubs (fd_set & fdSet, const fd_set & fdSet2) { + static inline boolean fdSetSubs (fd_set & fdSet, const fd_set & fdSet2) { long orV = 0; for (int i = 0; i < NOI; ++i) orV |= ( ((long*)&fdSet)[i] &= ~((const long*)&fdSet2)[i] ); @@ -293,7 +293,7 @@ private: orV |= RBM & (((long*)&fdSet)[NOI] &= ~((const long*)&fdSet2)[NOI]); return orV != 0; } - static inline bool fdSetAnd (fd_set & fdSet, const fd_set & fdSet2) { + static inline boolean fdSetAnd (fd_set & fdSet, const fd_set & fdSet2) { long orV = 0; for (int i = 0; i < NOI; ++i) orV |= ( ((long*)&fdSet)[i] &= ((const long*)&fdSet2)[i] ); @@ -301,7 +301,7 @@ private: orV |= RBM & (((long*)&fdSet)[NOI] &= ((const long*)&fdSet2)[NOI]); return orV != 0; } - static inline bool fdSetAnd (fd_set & fdSet, + static inline boolean fdSetAnd (fd_set & fdSet, const fd_set & fdSet1, const fd_set & fdSet2) { long orV = 0; for (int i = 0; i < NOI; ++i) @@ -354,22 +354,22 @@ private: return i; } public: - inline bool setOr(const FdSets & fdSet) { + inline boolean setOr(const FdSets & fdSet) { return fdSetOr(read_fds, fdSet.read_fds) | fdSetOr(write_fds, fdSet.write_fds) | fdSetOr(error_fds, fdSet.error_fds); } - inline bool setSubstract(const FdSets & fdSet) { + inline boolean setSubstract(const FdSets & fdSet) { return fdSetSubs(read_fds, fdSet.read_fds) | fdSetSubs(write_fds, fdSet.write_fds) | fdSetSubs(error_fds, fdSet.error_fds); } - inline bool setAnd(const FdSets & fdSet) { + inline boolean setAnd(const FdSets & fdSet) { return fdSetAnd(read_fds, fdSet.read_fds) | fdSetAnd(write_fds, fdSet.write_fds) | fdSetAnd(error_fds, fdSet.error_fds); } - inline bool setAnd(const FdSets & fdSet1, const FdSets & fdSet2) { + inline boolean setAnd(const FdSets & fdSet1, const FdSets & fdSet2) { return fdSetAnd(read_fds, fdSet1.read_fds, fdSet2.read_fds) | fdSetAnd(write_fds, fdSet1.write_fds, fdSet2.write_fds) | fdSetAnd(error_fds, fdSet1.error_fds, fdSet2.error_fds); @@ -467,7 +467,7 @@ public: } inline void first() { cur = head.next; } inline void next() { cur = cur->next; } - inline bool finished() const { return cur == &tail; } + inline boolean finished() const { return cur == &tail; } inline Fd_And_Timeout_Event_Handler * current() const { return cur; } inline void add(Fd_And_Timeout_Event_Handler * handler) { if (handler->list != 0 || handler->prev != 0 || handler->next != 0) @@ -503,7 +503,7 @@ class Fd_And_Timeout_User { public: static void initialize() { fdSetsReceived = 0; fdSetsToHnds = 0; - nOldHandlers = 0; is_in_call_handlers = false; curRcvdEvtIx = -1; + nOldHandlers = 0; is_in_call_handlers = FALSE; curRcvdEvtIx = -1; } static void terminate() { if (fdSetsReceived != 0) { delete fdSetsReceived; fdSetsReceived = 0; } @@ -522,7 +522,7 @@ public: const fd_set *error_fds); static void remove_all_fds(Fd_And_Timeout_Event_Handler * handler); - static bool getTimeout(double * timeout); + static boolean getTimeout(double * timeout); static void call_handlers(int nEvents); static int receiveEvents(int pollTimeout); static inline fd_event_type_enum getCurReceivedEvent() { @@ -540,7 +540,7 @@ public: FdMap::pollEventToEvent(FdMap::getPollFds()[curRcvdEvtIx].revents); #endif } - static inline bool get_is_in_call_handlers() { return is_in_call_handlers; } + static inline boolean get_is_in_call_handlers() { return is_in_call_handlers; } #ifdef USE_EPOLL static void reopenEpollFd(); #else @@ -552,7 +552,7 @@ private: static FdSets * fdSetsReceived; // active events for the old event handlers static FdSets * fdSetsToHnds; // temporary storage to pass it to the handler static int nOldHandlers; - static bool is_in_call_handlers; + static boolean is_in_call_handlers; static int curRcvdEvtIx; // Current Received Event Index - see call_handlers }; diff --git a/core/Float.cc b/core/Float.cc index 00883a3f5..b8021cdc9 100644 --- a/core/Float.cc +++ b/core/Float.cc @@ -125,7 +125,7 @@ double FLOAT::operator-() const return -float_value; } -bool FLOAT::is_special(double flt_val) +boolean FLOAT::is_special(double flt_val) { return ( (flt_val!=flt_val) || (flt_val==INFINITY) || (flt_val==-INFINITY) ); } @@ -440,7 +440,7 @@ void FLOAT::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); - if(JSON_decode(p_td, tok, false)<0) + if(JSON_decode(p_td, tok, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG, "Can not decode type '%s', because invalid or incomplete" " message was received" @@ -859,7 +859,7 @@ int FLOAT::XER_encode(const XERdescriptor_t& p_td, int encoded_length=(int)p_buf.get_len(); flavor &= ~XER_RECOF; // float doesn't care - begin_xml(p_td, p_buf, flavor, indent, false); + begin_xml(p_td, p_buf, flavor, indent, FALSE); if (exer && (p_td.xer_bits & XER_DECIMAL)) { char buf[312]; @@ -897,17 +897,17 @@ int FLOAT::XER_encode(const XERdescriptor_t& p_td, p_buf.put_string(value); } - end_xml(p_td, p_buf, flavor, indent, false); + end_xml(p_td, p_buf, flavor, indent, FALSE); return (int)p_buf.get_len() - encoded_length; } boolean FLOAT::is_float(const char* p_str) { - bool first_digit = false; // first digit reached - bool decimal_point = false; // decimal point (.) reached - bool exponent_mark = false; // exponential mark (e or E) reached - bool exponent_sign = false; // sign of the exponential (- or +) reached + boolean first_digit = FALSE; // first digit reached + boolean decimal_point = FALSE; // decimal point (.) reached + boolean exponent_mark = FALSE; // exponential mark (e or E) reached + boolean exponent_sign = FALSE; // sign of the exponential (- or +) reached if ('-' == *p_str || '+' == *p_str) { ++p_str; @@ -917,18 +917,18 @@ boolean FLOAT::is_float(const char* p_str) switch(*p_str) { case '.': if (decimal_point || exponent_mark || !first_digit) { - return false; + return FALSE; } - decimal_point = true; - first_digit = false; + decimal_point = TRUE; + first_digit = FALSE; break; case 'e': case 'E': if (exponent_mark || !first_digit) { - return false; + return FALSE; } - exponent_mark = true; - first_digit = false; + exponent_mark = TRUE; + first_digit = FALSE; break; case '0': case '1': @@ -940,17 +940,17 @@ boolean FLOAT::is_float(const char* p_str) case '7': case '8': case '9': - first_digit = true; + first_digit = TRUE; break; case '-': case '+': if (exponent_sign || !exponent_mark || first_digit) { - return false; + return FALSE; } - exponent_sign = true; + exponent_sign = TRUE; break; default: - return false; + return FALSE; } ++p_str; @@ -961,7 +961,7 @@ boolean FLOAT::is_float(const char* p_str) int FLOAT::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, unsigned int flavor, unsigned int /*flavor2*/, embed_values_dec_struct_t*) { - bound_flag = false; + bound_flag = FALSE; int exer = is_exer(flavor); int success = reader.Ok(), depth = -1; if (success <= 0) return 0; @@ -986,20 +986,20 @@ tagless: } } } - bound_flag = true; + bound_flag = TRUE; sscanf(value, "%lf", &float_value); } else if (strcmp(XER_NAN_STR, value) == 0 ) { - bound_flag = true; + bound_flag = TRUE; #ifdef NAN float_value = NAN; #else float_value = INFINITY + (-INFINITY); #endif } else if (strcmp(XER_POS_INF_STR, value) == 0) { - bound_flag = true; + bound_flag = TRUE; float_value = (double)INFINITY; } else if (strcmp(XER_NEG_INF_STR, value) == 0) { - bound_flag = true; + bound_flag = TRUE; float_value = -(double)INFINITY; } } @@ -1040,20 +1040,20 @@ tagless: } } } - bound_flag = true; + bound_flag = TRUE; sscanf(value, "%lf", &float_value); } else if (strcmp("NaN", value) == 0 ) { - bound_flag = true; + bound_flag = TRUE; #ifdef NAN float_value = NAN; #else float_value = INFINITY + (-INFINITY); #endif } else if (strcmp("INF", value) == 0) { - bound_flag = true; + bound_flag = TRUE; float_value = (double)INFINITY; } else if (strcmp("-INF", value) == 0) { - bound_flag = true; + bound_flag = TRUE; float_value = -(double)INFINITY; } } @@ -1095,7 +1095,7 @@ int FLOAT::JSON_encode(const TTCN_Typedescriptor_t&, JSON_Tokenizer& p_tok) cons } // true if decimal representation possible (use %f format) - bool decimal_repr = (value == 0.0) + boolean decimal_repr = (value == 0.0) || (value > -MAX_DECIMAL_FLOAT && value <= -MIN_DECIMAL_FLOAT) || (value >= MIN_DECIMAL_FLOAT && value < MAX_DECIMAL_FLOAT); @@ -1107,7 +1107,7 @@ int FLOAT::JSON_encode(const TTCN_Typedescriptor_t&, JSON_Tokenizer& p_tok) cons int FLOAT::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_tok, boolean p_silent) { - bound_flag = false; + bound_flag = FALSE; json_token_t token = JSON_TOKEN_NONE; char* value = 0; size_t value_len = 0; @@ -1126,15 +1126,15 @@ int FLOAT::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_tok, } else if (JSON_TOKEN_STRING == token || use_default) { if (0 == strncmp(value, POS_INF_STR + (use_default ? 1 : 0), value_len)) { - bound_flag = true; + bound_flag = TRUE; float_value = INFINITY; } else if (0 == strncmp(value, NEG_INF_STR + (use_default ? 1 : 0), value_len)) { - bound_flag = true; + bound_flag = TRUE; float_value = -INFINITY; } else if (0 == strncmp(value, NAN_STR + (use_default ? 1 : 0), value_len)) { - bound_flag = true; + bound_flag = TRUE; #ifdef NAN float_value = NAN; #else @@ -1145,14 +1145,14 @@ int FLOAT::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_tok, char* spec_val = mprintf("float (%s, %s or %s)", POS_INF_STR, NEG_INF_STR, NAN_STR); JSON_ERROR(TTCN_EncDec::ET_INVAL_MSG, JSON_DEC_FORMAT_ERROR, "string", spec_val); Free(spec_val); - bound_flag = false; + bound_flag = FALSE; return JSON_ERROR_FATAL; } } else if (JSON_TOKEN_NUMBER == token) { char* value2 = mcopystrn(value, value_len); sscanf(value2, "%lf", &float_value); - bound_flag = true; + bound_flag = TRUE; Free(value2); } else { return JSON_ERROR_INVALID_TOKEN; @@ -1162,7 +1162,7 @@ int FLOAT::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_tok, // check for a valid number char* value2 = mcopystrn(value, value_len); sscanf(value2, "%lf", &float_value); - bound_flag = true; + bound_flag = TRUE; Free(value2); } return dec_len; diff --git a/core/Float.hh b/core/Float.hh index 28ae491d7..77a1f434a 100644 --- a/core/Float.hh +++ b/core/Float.hh @@ -105,7 +105,7 @@ public: { if (!bound_flag) TTCN_error("%s", err_msg); } /** special TTCN-3 float values are not_a_number and +/- infinity */ - static bool is_special(double flt_val); + static boolean is_special(double flt_val); static void check_numeric(double flt_val, const char *err_msg_begin); void log() const; diff --git a/core/Hexstring.cc b/core/Hexstring.cc index eb0595d66..d2b3e022d 100644 --- a/core/Hexstring.cc +++ b/core/Hexstring.cc @@ -674,7 +674,7 @@ void HEXSTRING::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, RAW_enc_tr_pos rp; rp.level = 0; rp.pos = NULL; - RAW_enc_tree root(true, NULL, &rp, 1, p_td.raw); + RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} @@ -742,7 +742,7 @@ void HEXSTRING::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); - if(JSON_decode(p_td, tok, false)<0) + if(JSON_decode(p_td, tok, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG, "Can not decode type '%s', because invalid or incomplete" " message was received" @@ -774,8 +774,8 @@ int HEXSTRING::RAW_encode(const TTCN_Typedescriptor_t& p_td, if (myleaf.must_free) Free(myleaf.body.leaf.data_ptr); - myleaf.must_free = false; - myleaf.data_ptr_used = true; + myleaf.must_free = FALSE; + myleaf.data_ptr_used = TRUE; myleaf.body.leaf.data_ptr = val_ptr->nibbles_ptr; if (p_td.raw->endianness == ORDER_MSB) @@ -802,12 +802,12 @@ int HEXSTRING::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buff, ? (int)buff.unread_len_bit() : limit) / 4) * 4; } RAW_coding_par cp; - bool orders = false; - if (p_td.raw->bitorderinoctet == ORDER_MSB) orders = true; + boolean orders = FALSE; + if (p_td.raw->bitorderinoctet == ORDER_MSB) orders = TRUE; if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders; cp.bitorder = orders ? ORDER_MSB : ORDER_LSB; - orders = false; - if (p_td.raw->byteorder == ORDER_MSB) orders = true; + orders = FALSE; + if (p_td.raw->byteorder == ORDER_MSB) orders = TRUE; if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders; cp.byteorder = orders ? ORDER_MSB : ORDER_LSB; cp.fieldorder = p_td.raw->fieldorder; @@ -1078,7 +1078,7 @@ int HEXSTRING::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_ json_token_t token = JSON_TOKEN_NONE; char* value = 0; size_t value_len = 0; - boolean error = false; + boolean error = FALSE; int dec_len = 0; boolean use_default = p_td.json->default_value && 0 == p_tok.get_buffer_length(); if (use_default) { @@ -1105,11 +1105,11 @@ int HEXSTRING::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_ if (nibble <= 0x0F) { set_nibble(i, nibble); } else { - error = true; + error = TRUE; } } } else { - error = true; + error = TRUE; } } else { return JSON_ERROR_INVALID_TOKEN; diff --git a/core/ILoggerPlugin.hh b/core/ILoggerPlugin.hh index a87788cf5..cc164830a 100644 --- a/core/ILoggerPlugin.hh +++ b/core/ILoggerPlugin.hh @@ -31,16 +31,16 @@ class ILoggerPlugin { public: ILoggerPlugin() : - major_version_(0), minor_version_(0), name_(NULL), help_(NULL), is_configured_(false) { } + major_version_(0), minor_version_(0), name_(NULL), help_(NULL), is_configured_(FALSE) { } virtual ~ILoggerPlugin() { } - virtual bool is_static() = 0; + virtual boolean is_static() = 0; virtual void init(const char *options = NULL) = 0; virtual void fini() = 0; virtual void reset() { } virtual void fatal_error(const char */*err_msg*/, ...) { } - virtual bool is_log2str_capable() { return false; } + virtual boolean is_log2str_capable() { return FALSE; } virtual CHARSTRING log2str(const TitanLoggerApi::TitanLogEvent& /*event*/) { return CHARSTRING(); } @@ -48,21 +48,21 @@ public: inline unsigned int minor_version() const { return this->minor_version_; } inline const char *plugin_name() const { return this->name_; } inline const char *plugin_help() const { return this->help_; } - inline bool is_configured() const { return this->is_configured_; } - inline void set_configured(bool configured) { this->is_configured_ = configured; } + inline boolean is_configured() const { return this->is_configured_; } + inline void set_configured(boolean configured) { this->is_configured_ = configured; } - virtual void log(const TitanLoggerApi::TitanLogEvent& event, bool log_buffered, - bool separate_file, bool use_emergency_mask) = 0; + virtual void log(const TitanLoggerApi::TitanLogEvent& event, boolean log_buffered, + boolean separate_file, boolean use_emergency_mask) = 0; /// Backward compatibility functions. - virtual void open_file(bool /*is_first*/) { } + virtual void open_file(boolean /*is_first*/) { } virtual void close_file() { } virtual void set_file_name(const char */*new_filename_skeleton*/, - bool /*from_config*/) { } - virtual void set_append_file(bool /*new_append_file*/) { } - virtual bool set_file_size(int /*size*/) { return false; } - virtual bool set_file_number(int /*number*/) { return false; } - virtual bool set_disk_full_action(TTCN_Logger::disk_full_action_t /*disk_full_action*/) { return false; } + boolean /*from_config*/) { } + virtual void set_append_file(boolean /*new_append_file*/) { } + virtual boolean set_file_size(int /*size*/) { return FALSE; } + virtual boolean set_file_number(int /*number*/) { return FALSE; } + virtual boolean set_disk_full_action(TTCN_Logger::disk_full_action_t /*disk_full_action*/) { return FALSE; } virtual void set_parameter(const char */*parameter_name*/, const char */*parameter_value*/) { } protected: @@ -70,7 +70,7 @@ protected: unsigned int minor_version_; char *name_; char *help_; - bool is_configured_; + boolean is_configured_; }; #endif // ILOGGER_PLUGIN_HH diff --git a/core/Integer.cc b/core/Integer.cc index 7d1826516..dc6442f7d 100644 --- a/core/Integer.cc +++ b/core/Integer.cc @@ -592,7 +592,7 @@ long long int INTEGER::get_long_long_val() const { must_bound("Using the value of an unbound integer variable."); if (likely(native_flag)) return val.native; - bool is_negative = BN_is_negative(val.openssl); + boolean is_negative = BN_is_negative(val.openssl); long long int ret_val = 0; if (unlikely(BN_is_zero(val.openssl))) return 0; // It feels so bad accessing a BIGNUM directly, but faster than string @@ -629,7 +629,7 @@ void INTEGER::set_long_long_val(long long int other_value) val.openssl = BN_new(); // Make it 0. BN_zero(val.openssl); - bool is_negative = other_value < 0; + boolean is_negative = other_value < 0; unsigned long long int tmp = !is_negative ? other_value : -other_value; for (int i = sizeof(long long int) - 1; i >= 0; i--) { BN_add_word(val.openssl, (tmp >> 8 * i) & 0xff); @@ -883,7 +883,7 @@ void INTEGER::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); - if(JSON_decode(p_td, tok, false)<0) + if(JSON_decode(p_td, tok, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG, "Can not decode type '%s', because invalid or incomplete" " message was received" @@ -1602,7 +1602,7 @@ int INTEGER::XER_encode(const XERdescriptor_t& p_td, TTCN_Buffer& p_buf, flavor |= SIMPLE_TYPE; flavor &= ~XER_RECOF; // integer doesn't care - if (begin_xml(p_td, p_buf, flavor, indent, false) == -1) --encoded_length; + if (begin_xml(p_td, p_buf, flavor, indent, FALSE) == -1) --encoded_length; char *tmp_str; if (native_flag) @@ -1616,7 +1616,7 @@ int INTEGER::XER_encode(const XERdescriptor_t& p_td, TTCN_Buffer& p_buf, OPENSSL_free(tmp_str); p_buf.put_string(value); - end_xml(p_td, p_buf, flavor, indent, false); + end_xml(p_td, p_buf, flavor, indent, FALSE); return (int) p_buf.get_len() - encoded_length; } @@ -1754,15 +1754,15 @@ int INTEGER::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_to else if (JSON_TOKEN_NUMBER == token || use_default) { char* number = mcopystrn(value, value_len); if (from_string(number) && (int)value_len == get_nof_digits() + ('-' == value[0] ? 1 : 0)) { - bound_flag = true; + bound_flag = TRUE; } else { JSON_ERROR(TTCN_EncDec::ET_INVAL_MSG, JSON_DEC_FORMAT_ERROR, "number", "integer"); - bound_flag = false; + bound_flag = FALSE; dec_len = JSON_ERROR_FATAL; } Free(number); } else { - bound_flag = false; + bound_flag = FALSE; return JSON_ERROR_INVALID_TOKEN; } return dec_len; diff --git a/core/JSON.cc b/core/JSON.cc index 2af94a9e6..900ece17f 100644 --- a/core/JSON.cc +++ b/core/JSON.cc @@ -14,52 +14,52 @@ #include "JSON.hh" // JSON descriptors for base types -const TTCN_JSONdescriptor_t INTEGER_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t INTEGER_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t FLOAT_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t FLOAT_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t BOOLEAN_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t BOOLEAN_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t BITSTRING_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t BITSTRING_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t HEXSTRING_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t HEXSTRING_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t OCTETSTRING_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t OCTETSTRING_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t CHARSTRING_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t CHARSTRING_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t UNIVERSAL_CHARSTRING_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t UNIVERSAL_CHARSTRING_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t VERDICTTYPE_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t VERDICTTYPE_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t GeneralString_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t GeneralString_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t NumericString_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t NumericString_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t UTF8String_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t UTF8String_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t PrintableString_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t PrintableString_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t UniversalString_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t UniversalString_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t BMPString_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t BMPString_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t GraphicString_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t GraphicString_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t IA5String_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t IA5String_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t TeletexString_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t TeletexString_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t VideotexString_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t VideotexString_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t VisibleString_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t VisibleString_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t ASN_NULL_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t ASN_NULL_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t OBJID_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t OBJID_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t ASN_ROID_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t ASN_ROID_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t ASN_ANY_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t ASN_ANY_json_ = { FALSE, NULL, FALSE, NULL }; -const TTCN_JSONdescriptor_t ENUMERATED_json_ = { false, NULL, false, NULL }; +const TTCN_JSONdescriptor_t ENUMERATED_json_ = { FALSE, NULL, FALSE, NULL }; diff --git a/core/LegacyLogger.cc b/core/LegacyLogger.cc index 35fab2b39..2c5ef3174 100644 --- a/core/LegacyLogger.cc +++ b/core/LegacyLogger.cc @@ -51,7 +51,7 @@ ILoggerPlugin *create_legacy_logger() { return new LegacyLogger(); } static char *event_to_str(const TitanLoggerApi::TitanLogEvent& event, - bool without_header = false); + boolean without_header = FALSE); static char *append_header(char *ret_val, const struct timeval& timestamp, const TTCN_Logger::Severity severity, const char *sourceinfo); @@ -70,16 +70,16 @@ static void statistics_str(char *& ret_val, const TitanLoggerApi::StatisticsType namespace API = TitanLoggerApi; // Defined in Logger.cc. Compares the name or the component identifier. -extern bool operator==(const component_id_t& left, +extern boolean operator==(const component_id_t& left, const component_id_t& right); LegacyLogger* LegacyLogger::myself = 0; LegacyLogger::LegacyLogger() : log_fp_(NULL), er_(NULL), logfile_bytes_(0), logfile_size_(0), logfile_number_(1), - logfile_index_(1), filename_skeleton_(NULL), skeleton_given_(false), - append_file_(false), is_disk_full_(false), format_c_present_(false), - format_t_present_(false), current_filename_(NULL) + logfile_index_(1), filename_skeleton_(NULL), skeleton_given_(FALSE), + append_file_(FALSE), is_disk_full_(FALSE), format_c_present_(FALSE), + format_t_present_(FALSE), current_filename_(NULL) { if (myself != 0) { // Whoa, déjà vu! @@ -120,10 +120,10 @@ void LegacyLogger::reset() this->logfile_number_ = 1; this->logfile_bytes_ = 0; this->logfile_index_ = 1; - this->is_disk_full_ = false; - this->skeleton_given_ = false; - this->append_file_ = false; - this->is_configured_ = false; + this->is_disk_full_ = FALSE; + this->skeleton_given_ = FALSE; + this->append_file_ = FALSE; + this->is_configured_ = FALSE; } void LegacyLogger::init(const char */*options*/) @@ -174,7 +174,7 @@ void LegacyLogger::fatal_error(const char *err_msg, ...) @param [in] log_buffered **/ void LegacyLogger::log(const TitanLoggerApi::TitanLogEvent& event, - bool log_buffered, bool separate_file, bool use_emergency_mask) + boolean log_buffered, boolean separate_file, boolean use_emergency_mask) { const TTCN_Logger::Severity& severity = (const TTCN_Logger::Severity)(int)event.severity(); @@ -203,13 +203,13 @@ void LegacyLogger::log(const TitanLoggerApi::TitanLogEvent& event, } } -bool LegacyLogger::log_file_emerg(const TitanLoggerApi::TitanLogEvent& event) +boolean LegacyLogger::log_file_emerg(const TitanLoggerApi::TitanLogEvent& event) { - bool write_success = true; + boolean write_success = TRUE; char *event_str = event_to_str(event); if (event_str == NULL) { TTCN_warning("No text for event"); - return true; + return TRUE; } size_t bytes_to_log = mstrlen(event_str); @@ -231,10 +231,10 @@ bool LegacyLogger::log_file_emerg(const TitanLoggerApi::TitanLogEvent& event) Free(filename_emergency); } - write_success = true; + write_success = TRUE; if (bytes_to_log > 0 && fwrite(event_str, bytes_to_log, 1, er_) != 1) - write_success = false; + write_success = FALSE; fputc('\n', er_); @@ -256,10 +256,10 @@ bool LegacyLogger::log_file_emerg(const TitanLoggerApi::TitanLogEvent& event) possible recursion of log_to_file() -> open_file() -> log_to_file() -> open_file() -> ... **/ -bool LegacyLogger::log_file(const TitanLoggerApi::TitanLogEvent& event, - bool log_buffered) +boolean LegacyLogger::log_file(const TitanLoggerApi::TitanLogEvent& event, + boolean log_buffered) { - if (!this->log_fp_) return false; + if (!this->log_fp_) return FALSE; struct timeval event_timestamp = { (time_t)event.timestamp().seconds(), (suseconds_t)event.timestamp().microSeconds() }; @@ -278,10 +278,10 @@ bool LegacyLogger::log_file(const TitanLoggerApi::TitanLogEvent& event, this->disk_full_time_.tv_usec; } if ((size_t)diff.tv_sec >= this->disk_full_action_.retry_interval) - this->is_disk_full_ = false; - else return false; + this->is_disk_full_ = FALSE; + else return FALSE; } else { - return false; + return FALSE; } } @@ -294,7 +294,7 @@ bool LegacyLogger::log_file(const TitanLoggerApi::TitanLogEvent& event, char *event_str = event_to_str(event); if (event_str == NULL) { TTCN_warning("No text for event"); - return true; + return TRUE; } size_t bytes_to_log = mstrlen(event_str) + 1; if (this->logfile_size_ != 0 && this->logfile_bytes_ != 0 && !log_buffered) { @@ -311,7 +311,7 @@ bool LegacyLogger::log_file(const TitanLoggerApi::TitanLogEvent& event, Free(filename_to_delete); } } - open_file(false); + open_file(FALSE); } } @@ -337,10 +337,10 @@ bool LegacyLogger::log_file(const TitanLoggerApi::TitanLogEvent& event, switched_event.severity() = (int)TTCN_Logger::EXECUTOR_RUNTIME; switched_event.logEvent().choice().unhandledEvent() = CHARSTRING(switched); - log_file(switched_event, true); + log_file(switched_event, TRUE); Free(switched); close_file(); - open_file(false); // calls get_filename again :( + open_file(FALSE); // calls get_filename again :( } Free(new_filename); break; } @@ -349,16 +349,16 @@ bool LegacyLogger::log_file(const TitanLoggerApi::TitanLogEvent& event, // Write out the event_str, if it failed assume that the disk is full, then // act according to DiskFullAction. - bool print_success = log_to_file(event_str); + boolean print_success = log_to_file(event_str); if (!print_success) { switch (this->disk_full_action_.type) { case TTCN_Logger::DISKFULL_ERROR: fatal_error("Writing to log file failed."); case TTCN_Logger::DISKFULL_STOP: - this->is_disk_full_ = true; + this->is_disk_full_ = TRUE; break; case TTCN_Logger::DISKFULL_RETRY: - this->is_disk_full_ = true; + this->is_disk_full_ = TRUE; // Time of failure. TODO: Find a better way to transfer the timestamp. this->disk_full_time_.tv_sec = event.timestamp().seconds(); this->disk_full_time_.tv_usec = event.timestamp().microSeconds(); @@ -392,16 +392,16 @@ bool LegacyLogger::log_file(const TitanLoggerApi::TitanLogEvent& event, this->logfile_bytes_ += bytes_to_log; } Free(event_str); - return true; + return TRUE; } -bool LegacyLogger::log_console(const TitanLoggerApi::TitanLogEvent& event, +boolean LegacyLogger::log_console(const TitanLoggerApi::TitanLogEvent& event, const TTCN_Logger::Severity& severity) { - char *event_str = event_to_str(event, true); + char *event_str = event_to_str(event, TRUE); if (event_str == NULL) { TTCN_warning("No text for event"); - return false; + return FALSE; } size_t event_str_len = mstrlen(event_str); if (!TTCN_Communication::send_log((time_t)event.timestamp().seconds(), @@ -432,10 +432,10 @@ bool LegacyLogger::log_console(const TitanLoggerApi::TitanLogEvent& event, } Free(event_str); // It's always... - return true; + return TRUE; } -bool LegacyLogger::log_to_file(const char *message_ptr) +boolean LegacyLogger::log_to_file(const char *message_ptr) { // Retry and Delete: To avoid writing partial messages remember the initial // file position to be able to remove partial message if writing failed. @@ -446,12 +446,12 @@ bool LegacyLogger::log_to_file(const char *message_ptr) fgetpos_ret_val = fgetpos(this->log_fp_, &initial_pos); } size_t message_len = strlen(message_ptr); - bool write_success = true; + boolean write_success = TRUE; if (message_len > 0 && fwrite(message_ptr, message_len, 1, this->log_fp_) != 1) - write_success = false; - if (write_success && putc('\n', this->log_fp_) == EOF) write_success = false; - if (write_success && fflush(this->log_fp_)) write_success = false; + write_success = FALSE; + if (write_success && putc('\n', this->log_fp_) == EOF) write_success = FALSE; + if (write_success && fflush(this->log_fp_)) write_success = FALSE; if ((this->disk_full_action_.type == TTCN_Logger::DISKFULL_RETRY || this->disk_full_action_.type == TTCN_Logger::DISKFULL_DELETE) && !write_success && fgetpos_ret_val == 0) { @@ -1760,7 +1760,7 @@ void statistics_str(char *& ret_val, const TitanLoggerApi::StatisticsType_choice } char *event_to_str(const TitanLoggerApi::TitanLogEvent& event, - bool without_header) + boolean without_header) { char *ret_val = NULL; if (!without_header) { @@ -1953,7 +1953,7 @@ char *event_to_str(const TitanLoggerApi::TitanLogEvent& event, #pragma GCC diagnostic pop #endif -void LegacyLogger::open_file(bool is_first) +void LegacyLogger::open_file(boolean is_first) { if (is_first) { chk_logfile_data(); @@ -1961,7 +1961,7 @@ void LegacyLogger::open_file(bool is_first) set_file_name(TTCN_Runtime::is_single() ? (this->logfile_number_ == 1 ? "%e.%s" : "%e-part%i.%s") : (this->logfile_number_ == 1 ? "%e.%h-%r.%s" : "%e.%h-%r-part%i.%s"), - false); + FALSE); } // Logging_Bits have only effect on the actual plug-in. (Filtering is // implemented at higher level.) @@ -1981,7 +1981,7 @@ void LegacyLogger::open_file(bool is_first) } } - this->is_configured_= true; + this->is_configured_= TRUE; this->logfile_bytes_ = 0; } @@ -2007,10 +2007,10 @@ char *LegacyLogger::get_file_name(size_t idx) else if (TTCN_Runtime::is_hc()) whoami = HC; else if (TTCN_Runtime::is_mtc()) whoami = MTC; else whoami = PTC; - bool h_present = false, p_present = false, r_present = false, - i_present = false; - this->format_c_present_ = false; - this->format_t_present_ = false; + boolean h_present = FALSE, p_present = FALSE, r_present = FALSE, + i_present = FALSE; + this->format_c_present_ = FALSE; + this->format_t_present_ = FALSE; char *ret_val = memptystr(); for (size_t i = 0; this->filename_skeleton_[i] != '\0'; i++) { if (this->filename_skeleton_[i] != '%') { @@ -2020,14 +2020,14 @@ char *LegacyLogger::get_file_name(size_t idx) switch (this->filename_skeleton_[++i]) { case 'c': // %c -> name of the current testcase (only on PTCs) ret_val = mputstr(ret_val, TTCN_Runtime::get_testcase_name()); - this->format_c_present_ = true; + this->format_c_present_ = TRUE; break; case 'e': // %e -> name of executable ret_val = mputstr(ret_val, TTCN_Logger::get_executable_name()); break; case 'h': // %h -> hostname ret_val = mputstr(ret_val, TTCN_Runtime::get_host_name()); - h_present = true; + h_present = TRUE; break; case 'l': { // %l -> login name setpwent(); @@ -2052,7 +2052,7 @@ char *LegacyLogger::get_file_name(size_t idx) break; case 'p': // %p -> process id ret_val = mputprintf(ret_val, "%ld", (long)getpid()); - p_present = true; + p_present = TRUE; break; case 'r': // %r -> component reference switch (whoami) { @@ -2070,19 +2070,19 @@ char *LegacyLogger::get_file_name(size_t idx) ret_val = mputprintf(ret_val, "%d", (component)self); break; } - r_present = true; + r_present = TRUE; break; case 's': // %s -> default suffix (currently: always "log") ret_val = mputstr(ret_val, "log"); break; case 't': // %t -> component type (only on PTCs) ret_val = mputstr(ret_val, TTCN_Runtime::get_component_type()); - this->format_t_present_ = true; + this->format_t_present_ = TRUE; break; case 'i': // %i -> log file index if (this->logfile_number_ != 1) ret_val = mputprintf(ret_val, "%lu", (unsigned long)idx); - i_present = true; + i_present = TRUE; break; case '\0': // trailing single %: leave as it is i--; // to avoid over-indexing in next iteration @@ -2097,12 +2097,12 @@ char *LegacyLogger::get_file_name(size_t idx) } } - static bool already_warned = false; + static boolean already_warned = FALSE; if (ret_val[0] == '\0') { // result is empty Free(ret_val); ret_val = NULL; } else if (whoami == HC && !already_warned) { - already_warned = true; + already_warned = TRUE; if (!h_present || (!p_present && !r_present)) TTCN_warning("Skeleton `%s' does not guarantee unique log file name " "for every test system process. It may cause " @@ -2131,7 +2131,7 @@ char *LegacyLogger::get_file_name(size_t idx) void LegacyLogger::create_parent_directories(const char *path_name) { char *path_backup = NULL; - bool umask_saved = false; + boolean umask_saved = FALSE; mode_t old_umask = 0; size_t i = 0; // if path_name is absolute skip the leading '/'(s) @@ -2151,7 +2151,7 @@ void LegacyLogger::create_parent_directories(const char *path_name) errno = 0; if (!umask_saved) { old_umask = umask(0); - umask_saved = true; + umask_saved = TRUE; } if (mkdir(path_backup, 0755) < 0) { fatal_error("Creation of directory `%s' failed when trying to open " @@ -2197,7 +2197,7 @@ void LegacyLogger::chk_logfile_data() TTCN_warning("Invalid combination of LogFileNumber (= %lu) and " "AppendFile (= Yes). AppendFile was reset to No.", (unsigned long)this->logfile_number_); - this->append_file_ = false; + this->append_file_ = FALSE; } } @@ -2206,32 +2206,32 @@ void LegacyLogger::set_file_name(const char *new_filename_skeleton, { Free(this->filename_skeleton_); this->filename_skeleton_ = mcopystr(new_filename_skeleton); - if (from_config) this->skeleton_given_ = true; + if (from_config) this->skeleton_given_ = TRUE; } -bool LegacyLogger::set_file_size(int p_size) +boolean LegacyLogger::set_file_size(int p_size) { this->logfile_size_ = p_size; - return true; + return TRUE; } -bool LegacyLogger::set_file_number(int p_number) +boolean LegacyLogger::set_file_number(int p_number) { this->logfile_number_ = p_number; - return true; + return TRUE; } -bool LegacyLogger::set_disk_full_action( +boolean LegacyLogger::set_disk_full_action( TTCN_Logger::disk_full_action_t p_disk_full_action) { this->disk_full_action_ = p_disk_full_action; - return true; + return TRUE; } // LegacyLogger should be the only provider of log2str(). CHARSTRING LegacyLogger::log2str(const TitanLoggerApi::TitanLogEvent& event) { - char *event_str = event_to_str(event, true); + char *event_str = event_to_str(event, TRUE); // mstrlen can handle NULL; it will result in a bound but empty CHARSTRING CHARSTRING ret_val(mstrlen(event_str), event_str); if (event_str == NULL) { @@ -2241,7 +2241,7 @@ CHARSTRING LegacyLogger::log2str(const TitanLoggerApi::TitanLogEvent& event) return ret_val; } -void LegacyLogger::set_append_file(bool new_append_file) +void LegacyLogger::set_append_file(boolean new_append_file) { this->append_file_ = new_append_file; } diff --git a/core/LegacyLogger.hh b/core/LegacyLogger.hh index 99f3a828c..cdbf16c44 100644 --- a/core/LegacyLogger.hh +++ b/core/LegacyLogger.hh @@ -34,16 +34,16 @@ class LegacyLogger: public ILoggerPlugin public: LegacyLogger(); virtual ~LegacyLogger(); - inline bool is_static() { return true; } - inline bool is_log2str_capable() { return true; } + inline boolean is_static() { return TRUE; } + inline boolean is_log2str_capable() { return TRUE; } CHARSTRING log2str(const TitanLoggerApi::TitanLogEvent& event); void init(const char *options = 0); void fini(); void reset(); void fatal_error(const char *err_msg, ...); - void log(const TitanLoggerApi::TitanLogEvent& event, bool log_buffered, - bool separate_file, bool use_emergency_mask); + void log(const TitanLoggerApi::TitanLogEvent& event, boolean log_buffered, + boolean separate_file, boolean use_emergency_mask); static char * plugin_specific_settings(); protected: @@ -52,17 +52,17 @@ protected: char *get_file_name(size_t idx); void set_file_name(const char *new_filename_skeleton, boolean from_config); - bool set_file_size(int p_size); - void set_append_file(bool new_append_file); - bool set_file_number(int p_number); - bool set_disk_full_action(TTCN_Logger::disk_full_action_t p_disk_full_action); - void open_file(bool is_first = true); + boolean set_file_size(int p_size); + void set_append_file(boolean new_append_file); + boolean set_file_number(int p_number); + boolean set_disk_full_action(TTCN_Logger::disk_full_action_t p_disk_full_action); + void open_file(boolean is_first = TRUE); void close_file(); - bool log_file(const TitanLoggerApi::TitanLogEvent& event, bool log_buffered); - bool log_file_emerg(const TitanLoggerApi::TitanLogEvent& event); - bool log_console(const TitanLoggerApi::TitanLogEvent& event, + boolean log_file(const TitanLoggerApi::TitanLogEvent& event, boolean log_buffered); + boolean log_file_emerg(const TitanLoggerApi::TitanLogEvent& event); + boolean log_console(const TitanLoggerApi::TitanLogEvent& event, const TTCN_Logger::Severity& severity); - bool log_to_file(const char *event_str); + boolean log_to_file(const char *event_str); void create_parent_directories(const char *path_name); /// Checks for invalid combinations of LogFileSize, LogFileNumber and /// DiskFullAction. @@ -93,12 +93,12 @@ protected: struct timeval disk_full_time_; /// True if `filename_skeleton_' was set from the configuration file. - bool skeleton_given_; + boolean skeleton_given_; /// True to open the log file and append to it, false to truncate. - bool append_file_; - bool is_disk_full_; - bool format_c_present_; - bool format_t_present_; + boolean append_file_; + boolean is_disk_full_; + boolean format_c_present_; + boolean format_t_present_; char *current_filename_; static LegacyLogger *myself; }; diff --git a/core/Logger.cc b/core/Logger.cc index 9b7d92657..321ff6610 100644 --- a/core/Logger.cc +++ b/core/Logger.cc @@ -245,7 +245,7 @@ const char* TTCN_Logger::severity_subcategory_names[NUMBER_OF_LOGSEVERITIES] = { char* TTCN_Logger::logmatch_buffer = NULL; size_t TTCN_Logger::logmatch_buffer_len = 0; size_t TTCN_Logger::logmatch_buffer_size = 0; -boolean TTCN_Logger::logmatch_printed = false; +boolean TTCN_Logger::logmatch_printed = FALSE; // TODO: Matching related stuff stays here for now. It just appends the // string to the end of the current (active) event. @@ -267,7 +267,7 @@ void TTCN_Logger::set_logmatch_buffer_len(size_t new_len) void TTCN_Logger::print_logmatch_buffer() { if (logmatch_printed) TTCN_Logger::log_event_str(" , "); - else logmatch_printed = true; + else logmatch_printed = TRUE; if (logmatch_buffer_size > 0) TTCN_Logger::log_event_str(logmatch_buffer); } @@ -331,10 +331,10 @@ the same as component number 3. returns \c true. */ -bool operator==(const component_id_t& left, const component_id_t& right) +boolean operator==(const component_id_t& left, const component_id_t& right) { if (left.id_selector != right.id_selector) - return false; + return FALSE; // The selectors are the same. switch (left.id_selector) { @@ -343,7 +343,7 @@ bool operator==(const component_id_t& left, const component_id_t& right) case COMPONENT_ID_COMPREF: return left.id_compref == right.id_compref; default: // Should be MTC or SYSTEM; identified by the selector. - return true; + return TRUE; } } @@ -562,7 +562,7 @@ void TTCN_Logger::terminate_logger() logmatch_buffer = NULL; } -bool TTCN_Logger::is_logger_up() +boolean TTCN_Logger::is_logger_up() { if (logmatch_buffer == NULL) return FALSE; return get_logger_plugin_manager()->plugins_ready(); @@ -605,7 +605,7 @@ void TTCN_Logger::set_executable_name(const char *argv_0) } else executable_name = NULL; } -bool TTCN_Logger::add_parameter(const logging_setting_t& logging_param) +boolean TTCN_Logger::add_parameter(const logging_setting_t& logging_param) { return get_logger_plugin_manager()->add_parameter(logging_param); } @@ -633,17 +633,17 @@ void TTCN_Logger::set_file_name(const char *new_filename_skeleton, set_file_name(new_filename_skeleton, from_config); } -bool TTCN_Logger::set_file_size(component_id_t const& comp, int p_size) +boolean TTCN_Logger::set_file_size(component_id_t const& comp, int p_size) { return get_logger_plugin_manager()->set_file_size(comp, p_size); } -bool TTCN_Logger::set_file_number(component_id_t const& comp, int p_number) +boolean TTCN_Logger::set_file_number(component_id_t const& comp, int p_number) { return get_logger_plugin_manager()->set_file_number(comp, p_number); } -bool TTCN_Logger::set_disk_full_action(component_id_t const& comp, +boolean TTCN_Logger::set_disk_full_action(component_id_t const& comp, disk_full_action_t p_disk_full_action) { return get_logger_plugin_manager() @@ -799,7 +799,7 @@ char *TTCN_Logger::get_logger_settings_str() return new_log_message; } -void TTCN_Logger::write_logger_settings(bool /*opening*/) +void TTCN_Logger::write_logger_settings(boolean /*opening*/) { expstring_t new_log_message = get_logger_settings_str(); @@ -816,17 +816,17 @@ boolean TTCN_Logger::should_log_to_file(TTCN_Logger::Severity sev) if (sev > 0 && sev < TTCN_Logger::NUMBER_OF_LOGSEVERITIES) { return file_log_mask.mask.bits[sev]; } - return false; + return FALSE; } boolean TTCN_Logger::should_log_to_console(TTCN_Logger::Severity sev) { // CR_TR00015406: Always log external scripts to the console | MCTR. - if (sev == TTCN_Logger::EXECUTOR_EXTCOMMAND) return true; + if (sev == TTCN_Logger::EXECUTOR_EXTCOMMAND) return TRUE; if (sev > 0 && sev < TTCN_Logger::NUMBER_OF_LOGSEVERITIES) { return console_log_mask.mask.bits[sev]; } - return false; + return FALSE; } boolean TTCN_Logger::should_log_to_emergency(TTCN_Logger::Severity sev) @@ -834,7 +834,7 @@ boolean TTCN_Logger::should_log_to_emergency(TTCN_Logger::Severity sev) if (sev > 0 && sev < TTCN_Logger::NUMBER_OF_LOGSEVERITIES) { return emergency_log_mask.mask.bits[sev]; } - return false; + return FALSE; } void TTCN_Logger::set_timestamp_format(timestamp_format_t new_timestamp_format) @@ -872,7 +872,7 @@ void TTCN_Logger::close_file() get_logger_plugin_manager()->close_file(); } -void TTCN_Logger::ring_buffer_dump(bool do_close_file) +void TTCN_Logger::ring_buffer_dump(boolean do_close_file) { get_logger_plugin_manager()->ring_buffer_dump(do_close_file); } @@ -939,14 +939,14 @@ void TTCN_Logger::log_str(TTCN_Logger::Severity msg_severity, str_ptr = "<NULL pointer>"; get_logger_plugin_manager()->log_unhandled_event(msg_severity, str_ptr, strlen(str_ptr)); - logmatch_printed = false; + logmatch_printed = FALSE; } void TTCN_Logger::log_va_list(TTCN_Logger::Severity msg_severity, const char *fmt_str, va_list p_var) { get_logger_plugin_manager()->log_va_list(msg_severity, fmt_str, p_var); - logmatch_printed = false; + logmatch_printed = FALSE; } void TTCN_Logger::begin_event(TTCN_Logger::Severity msg_severity, boolean log2str) @@ -958,13 +958,13 @@ void TTCN_Logger::end_event() { get_logger_plugin_manager()->end_event(); // TODO: Find another place for these... - logmatch_printed = false; + logmatch_printed = FALSE; } CHARSTRING TTCN_Logger::end_event_log2str() { CHARSTRING ret_val = get_logger_plugin_manager()->end_event_log2str(); - logmatch_printed = false; + logmatch_printed = FALSE; return ret_val; } @@ -984,13 +984,13 @@ void TTCN_Logger::log_event(const char *fmt_str, ...) void TTCN_Logger::log_event_str(const char *str_ptr) { get_logger_plugin_manager()->log_event_str(str_ptr); - logmatch_printed = false; + logmatch_printed = FALSE; } void TTCN_Logger::log_event_va_list(const char *fmt_str, va_list p_var) { get_logger_plugin_manager()->log_event_va_list(fmt_str, p_var); - logmatch_printed = false; + logmatch_printed = FALSE; } void TTCN_Logger::log_event_unbound() @@ -1038,7 +1038,7 @@ void TTCN_Logger::log_event_enum(const char* enum_name_str, int enum_value) void TTCN_Logger::log_char(char c) { get_logger_plugin_manager()->log_char(c); - logmatch_printed = false; + logmatch_printed = FALSE; } boolean TTCN_Logger::is_printable(unsigned char c) @@ -1221,7 +1221,7 @@ void TTCN_Logger::log_getverdict(verdicttype verdict) get_logger_plugin_manager()->log_getverdict(verdict); } -void TTCN_Logger::log_final_verdict(bool is_ptc, verdicttype ptc_verdict, +void TTCN_Logger::log_final_verdict(boolean is_ptc, verdicttype ptc_verdict, verdicttype local_verdict, verdicttype new_verdict, const char *verdict_reason, int notification, int ptc_compref, const char *ptc_name) @@ -1288,7 +1288,7 @@ void TTCN_Logger::log_testcase_exec(const char *module, const char *tc) get_logger_plugin_manager()->log_testcase_exec(module, tc); } -void TTCN_Logger::log_module_init(const char *module, bool finish) +void TTCN_Logger::log_module_init(const char *module, boolean finish) { get_logger_plugin_manager()->log_module_init(module, finish); } @@ -1492,14 +1492,14 @@ void TTCN_Location::strip_entity_name(char*& par_str) { if (!par_str) return; char *new_str = NULL; - bool in_paren = false; + boolean in_paren = FALSE; for (char *str_ptr = par_str; *str_ptr != '\0' ; str_ptr++) { switch (*str_ptr) { case '(': - in_paren = true; + in_paren = TRUE; break; case ')': - in_paren = false; + in_paren = FALSE; break; default: if (!in_paren) new_str = mputc(new_str, *str_ptr); diff --git a/core/Logger.hh b/core/Logger.hh index 96d1b2d71..db03a8887 100644 --- a/core/Logger.hh +++ b/core/Logger.hh @@ -263,7 +263,7 @@ public: /// Frees any resources held by the logger. static void terminate_logger(); - static bool is_logger_up(); + static boolean is_logger_up(); /** @brief Initializes the logger configuration. @@ -297,7 +297,7 @@ public: static data_log_format_t get_log_format() { return data_log_format; } static void set_log_format(data_log_format_t p_data_log_format) { data_log_format = p_data_log_format; } - static bool add_parameter(const logging_setting_t& logging_param); + static boolean add_parameter(const logging_setting_t& logging_param); static void set_plugin_parameters(component component_reference, const char* component_name); static void load_plugins(component component_reference, const char* component_name); @@ -378,9 +378,9 @@ public: // configuration file. static void register_plugin(const component_id_t comp, char *identifier, char *filename); - static bool set_file_size(component_id_t const& comp, int p_size); - static bool set_file_number(component_id_t const& comp, int p_number); - static bool set_disk_full_action(component_id_t const& comp, + static boolean set_file_size(component_id_t const& comp, int p_size); + static boolean set_file_number(component_id_t const& comp, int p_number); + static boolean set_disk_full_action(component_id_t const& comp, disk_full_action_t p_disk_full_action); /** @brief Whether a message with the given severity should be logged to the @@ -422,7 +422,7 @@ public: @param opening true if called from TTCN_Logger::open_file() while writing the buffered messages, false otherwise. */ - static void write_logger_settings(bool opening = false); + static void write_logger_settings(boolean opening = false); /** @brief Opens the log file. @@ -436,7 +436,7 @@ public: /** @brief dump all events from ring buffer to log file @param do_close_file if true, close the files afterwards */ - static void ring_buffer_dump(bool do_close_file); + static void ring_buffer_dump(boolean do_close_file); /** @brief Should this event be logged? @@ -653,7 +653,7 @@ public: // - notification: enumeration value for the two fixed notification messages // - ptc_compref: only for detailed PTC statistics // - ptc_name: only for detailed PTC statistics - static void log_final_verdict(bool is_ptc, verdicttype ptc_verdict, + static void log_final_verdict(boolean is_ptc, verdicttype ptc_verdict, verdicttype local_verdict, verdicttype new_verdict, const char *verdict_reason = NULL, int notification = -1, int ptc_compref = UNBOUND_COMPREF, const char *ptc_name = NULL); @@ -681,7 +681,7 @@ public: static void log_HC_start(const char *host); static void log_fd_limits(int fd_limit, long fd_set_size); static void log_testcase_exec(const char *module, const char *tc); - static void log_module_init(const char *module, bool finish = false); + static void log_module_init(const char *module, boolean finish = FALSE); static void log_mtc_created(long pid); /// EXECUTOR_CONFIGDATA diff --git a/core/LoggerPlugin.cc b/core/LoggerPlugin.cc index dcdc31c96..5997b42ad 100644 --- a/core/LoggerPlugin.cc +++ b/core/LoggerPlugin.cc @@ -27,7 +27,7 @@ // constructor for dynamic plug-in LoggerPlugin::LoggerPlugin(const char *path) : ref_(NULL), handle_(NULL), filename_(NULL), create_(NULL), - is_log2str_capable_(false) + is_log2str_capable_(FALSE) { assert(path != NULL); this->filename_ = mcopystr(path); @@ -45,7 +45,7 @@ LoggerPlugin::LoggerPlugin(cb_create_plugin *create) : // We want the create_ member to be cb_create_plugin, to be able to call // this->create_(). Hence the need for this hideous cast. create_((cb_create_plugin)(unsigned long)create), - is_log2str_capable_(false) + is_log2str_capable_(FALSE) { } @@ -63,7 +63,7 @@ void LoggerPlugin::reset() this->ref_->reset(); } -void LoggerPlugin::open_file(bool is_first) +void LoggerPlugin::open_file(boolean is_first) { this->ref_->open_file(is_first); } @@ -74,27 +74,27 @@ void LoggerPlugin::close_file() } void LoggerPlugin::set_file_name(const char *new_filename_skeleton, - bool from_config) + boolean from_config) { this->ref_->set_file_name(new_filename_skeleton, from_config); } -void LoggerPlugin::set_append_file(bool new_append_file) +void LoggerPlugin::set_append_file(boolean new_append_file) { this->ref_->set_append_file(new_append_file); } -bool LoggerPlugin::set_file_size(int p_size) +boolean LoggerPlugin::set_file_size(int p_size) { return this->ref_->set_file_size(p_size); } -bool LoggerPlugin::set_file_number(int p_number) +boolean LoggerPlugin::set_file_number(int p_number) { return this->ref_->set_file_number(p_number); } -bool LoggerPlugin::set_disk_full_action(TTCN_Logger::disk_full_action_t p_disk_full_action) +boolean LoggerPlugin::set_disk_full_action(TTCN_Logger::disk_full_action_t p_disk_full_action) { return this->ref_->set_disk_full_action(p_disk_full_action); } @@ -105,7 +105,7 @@ void LoggerPlugin::set_parameter(const char* param_name, const char* param_value } int LoggerPlugin::log(const TitanLoggerApi::TitanLogEvent& event, - bool log_buffered, bool separate_file, bool use_emergency_mask) + boolean log_buffered, boolean separate_file, boolean use_emergency_mask) { if (!this->ref_) return 1; this->ref_->log(event, log_buffered, separate_file, use_emergency_mask); @@ -125,12 +125,12 @@ const char *LoggerPlugin::plugin_name() const return this->ref_->plugin_name(); } -bool LoggerPlugin::is_configured() const +boolean LoggerPlugin::is_configured() const { return this->ref_ != NULL && this->ref_->is_configured(); } -void LoggerPlugin::set_configured(bool configured) +void LoggerPlugin::set_configured(boolean configured) { if (this->ref_ != NULL) this->ref_->set_configured(configured); diff --git a/core/LoggerPlugin.hh b/core/LoggerPlugin.hh index 43512fd00..f81cf28f7 100644 --- a/core/LoggerPlugin.hh +++ b/core/LoggerPlugin.hh @@ -43,23 +43,23 @@ public: void unload(); void reset(); - void set_file_name(const char *new_filename_skeleton, bool from_config); + void set_file_name(const char *new_filename_skeleton, boolean from_config); void set_component(const component comp, const char *name); - void set_append_file(bool new_append_file); - void open_file(bool is_first); + void set_append_file(boolean new_append_file); + void open_file(boolean is_first); void close_file(); - bool set_file_size(int p_size); - bool set_file_number(int p_number); - bool set_disk_full_action(TTCN_Logger::disk_full_action_t p_disk_full_action); + boolean set_file_size(int p_size); + boolean set_file_number(int p_number); + boolean set_disk_full_action(TTCN_Logger::disk_full_action_t p_disk_full_action); void set_parameter(const char* param_name, const char* param_value); - int log(const TitanLoggerApi::TitanLogEvent& event, bool log_buffered, - bool separate_file, bool use_emergency_mask); - inline bool is_log2str_capable() const { return this->is_log2str_capable_; } + int log(const TitanLoggerApi::TitanLogEvent& event, boolean log_buffered, + boolean separate_file, boolean use_emergency_mask); + inline boolean is_log2str_capable() const { return this->is_log2str_capable_; } CHARSTRING log2str(const TitanLoggerApi::TitanLogEvent& event) const; const char *plugin_name() const; - bool is_configured() const; - void set_configured(bool configured); + boolean is_configured() const; + void set_configured(boolean configured); private: explicit LoggerPlugin(const LoggerPlugin&); @@ -71,7 +71,7 @@ private: void *handle_; // Shared library handle, NULL for static plug-ins. char *filename_; // Linker name of the plug-in, NULL for static plug-ins. cb_create_plugin create_; // Creator of static plug-ins, NULL otherwise. - bool is_log2str_capable_; // True if plugin provides log2str(). + boolean is_log2str_capable_; // True if plugin provides log2str(). }; #endif // LOGGER_PLUGIN_HH diff --git a/core/LoggerPluginManager.cc b/core/LoggerPluginManager.cc index 09c427981..f80a8ccfe 100644 --- a/core/LoggerPluginManager.cc +++ b/core/LoggerPluginManager.cc @@ -49,15 +49,15 @@ RingBuffer::~RingBuffer() } } -bool RingBuffer::get(TitanLoggerApi::TitanLogEvent& data) +boolean RingBuffer::get(TitanLoggerApi::TitanLogEvent& data) { if(tail == head) - return false; + return FALSE; data = buffer[tail]; tail = (tail +1) % (size + 1); - return true; + return TRUE; } void RingBuffer::put(TitanLoggerApi::TitanLogEvent data) @@ -100,7 +100,7 @@ LoggerPluginManager::~LoggerPluginManager() LogEntry *next_entry = this->entry_list_->next_entry_; for (size_t i = 0; i < this->n_plugins_; ++i) { if (this->plugins_[i]->is_configured()) { - this->plugins_[i]->log(this->entry_list_->event_, true, false, false); + this->plugins_[i]->log(this->entry_list_->event_, TRUE, FALSE, FALSE); } } delete this->entry_list_; @@ -128,7 +128,7 @@ LoggerPluginManager::~LoggerPluginManager() } } -void LoggerPluginManager::ring_buffer_dump(bool do_close_file) +void LoggerPluginManager::ring_buffer_dump(boolean do_close_file) { // in case of buffer all, flush the content of the ring buffer if (TTCN_Logger::get_emergency_logging_behaviour() == TTCN_Logger::BUFFER_ALL) { @@ -136,7 +136,7 @@ void LoggerPluginManager::ring_buffer_dump(bool do_close_file) // get all the events from the ring: buffer while (!ring_buffer.isEmpty()) { if (ring_buffer.get(ring_event)) { - internal_log_to_all(ring_event, true, false, false); // buffer all: DO NOT log in separate file + internal_log_to_all(ring_event, TRUE, FALSE, FALSE); // buffer all: DO NOT log in separate file } } } @@ -200,10 +200,10 @@ void LoggerPluginManager::load_plugins(component component_reference, void LoggerPluginManager::load_plugin(const char *identifier, const char *filename) { - bool is_legacylogger = - !strncasecmp(identifier, "LegacyLogger", 12) ? true : false; - static bool legacylogger_needed = false; - if (!legacylogger_needed && is_legacylogger) legacylogger_needed = true; + boolean is_legacylogger = + !strncasecmp(identifier, "LegacyLogger", 12) ? TRUE : FALSE; + static boolean legacylogger_needed = FALSE; + if (!legacylogger_needed && is_legacylogger) legacylogger_needed = TRUE; // LegacyLogger was listed explicitly. Otherwise, it's disabled. It is // always loaded as the first element of the list. this->plugins_[0]->set_configured(legacylogger_needed); @@ -239,19 +239,19 @@ void LoggerPluginManager::load_plugin(const char *identifier, this->plugins_[this->n_plugins_ - 1]->load(); } -extern bool operator==(const component_id_t& left, const component_id_t& right); +extern boolean operator==(const component_id_t& left, const component_id_t& right); -bool LoggerPluginManager::add_parameter(const logging_setting_t& logging_param) +boolean LoggerPluginManager::add_parameter(const logging_setting_t& logging_param) { - bool duplication_warning = false; + boolean duplication_warning = FALSE; for (logging_setting_t *par = logparams_head; par != NULL; par = par->nextparam) { - bool for_all_components = logging_param.component.id_selector == COMPONENT_ID_ALL || par->component.id_selector == COMPONENT_ID_ALL; - bool for_all_plugins = logging_param.plugin_id == NULL || par->plugin_id == NULL || + boolean for_all_components = logging_param.component.id_selector == COMPONENT_ID_ALL || par->component.id_selector == COMPONENT_ID_ALL; + boolean for_all_plugins = logging_param.plugin_id == NULL || par->plugin_id == NULL || !strcmp(logging_param.plugin_id, "*") || !strcmp(par->plugin_id, "*"); - bool component_overlaps = for_all_components || logging_param.component == par->component; - bool plugin_overlaps = for_all_plugins || !strcmp(logging_param.plugin_id, par->plugin_id); - bool parameter_overlaps = logging_param.logparam.log_param_selection == par->logparam.log_param_selection; + boolean component_overlaps = for_all_components || logging_param.component == par->component; + boolean plugin_overlaps = for_all_plugins || !strcmp(logging_param.plugin_id, par->plugin_id); + boolean parameter_overlaps = logging_param.logparam.log_param_selection == par->logparam.log_param_selection; if (parameter_overlaps && logging_param.logparam.log_param_selection == LP_PLUGIN_SPECIFIC) parameter_overlaps = strcmp(logging_param.logparam.param_name, par->logparam.param_name) == 0; duplication_warning = component_overlaps && plugin_overlaps && parameter_overlaps; @@ -333,7 +333,7 @@ void LoggerPluginManager::send_parameter_to_plugin(LoggerPlugin *plugin, plugin->set_disk_full_action(logparam.logparam.disk_full_action_value); break; case LP_LOGFILE: - plugin->set_file_name(logparam.logparam.str_val, true); + plugin->set_file_name(logparam.logparam.str_val, TRUE); break; case LP_TIMESTAMPFORMAT: TTCN_Logger::set_timestamp_format(logparam.logparam.timestamp_value); @@ -413,7 +413,7 @@ void LoggerPluginManager::clear_plugin_list() } void LoggerPluginManager::set_file_name(const char *new_filename_skeleton, - bool from_config) + boolean from_config) { for (size_t i = 0; i < this->n_plugins_; ++i) this->plugins_[i]->set_file_name(new_filename_skeleton, from_config); @@ -425,52 +425,52 @@ void LoggerPluginManager::reset() this->plugins_[i]->reset(); } -void LoggerPluginManager::set_append_file(bool new_append_file) +void LoggerPluginManager::set_append_file(boolean new_append_file) { for (size_t i = 0; i < this->n_plugins_; ++i) this->plugins_[i]->set_append_file(new_append_file); } -bool LoggerPluginManager::set_file_size(component_id_t const& /*comp*/, int p_size) +boolean LoggerPluginManager::set_file_size(component_id_t const& /*comp*/, int p_size) { - bool ret_val = false; + boolean ret_val = FALSE; for (size_t i = 0; i < this->n_plugins_; ++i) if (this->plugins_[i]->set_file_size(p_size)) - ret_val = true; + ret_val = TRUE; return ret_val; } -bool LoggerPluginManager::set_file_number(component_id_t const& /*comp*/, int p_number) +boolean LoggerPluginManager::set_file_number(component_id_t const& /*comp*/, int p_number) { - bool ret_val = false; + boolean ret_val = FALSE; for (size_t i = 0; i < this->n_plugins_; ++i) if (this->plugins_[i]->set_file_number(p_number)) - ret_val = true; + ret_val = TRUE; return ret_val; } -bool LoggerPluginManager::set_disk_full_action(component_id_t const& /*comp*/, +boolean LoggerPluginManager::set_disk_full_action(component_id_t const& /*comp*/, TTCN_Logger::disk_full_action_t p_disk_full_action) { - bool ret_val = false; + boolean ret_val = FALSE; for (size_t i = 0; i < this->n_plugins_; ++i) if (this->plugins_[i]->set_disk_full_action(p_disk_full_action)) - ret_val = true; + ret_val = TRUE; return ret_val; } void LoggerPluginManager::open_file() { - static bool is_first = true; - bool free_entry_list = false; + static boolean is_first = TRUE; + boolean free_entry_list = FALSE; assert(this->n_plugins_ > 0); // In case of `EXECUTOR_LOGOPTIONS' write updated - // `write_logger_settings(true)'. Try to log the buffered events, they not + // `write_logger_settings(TRUE)'. Try to log the buffered events, they not // necessarily be logged otherwise. for (size_t i = 0; i < this->n_plugins_; ++i) { this->plugins_[i]->open_file(is_first); if (this->plugins_[i]->is_configured()) { - free_entry_list = true; + free_entry_list = TRUE; LogEntry *entry = this->entry_list_, *next_entry = NULL; while (entry != NULL) { next_entry = entry->next_entry_; @@ -481,7 +481,7 @@ void LoggerPluginManager::open_file() CHARSTRING(mstrlen(new_log_message), new_log_message); Free(new_log_message); } - this->plugins_[i]->log(entry->event_, true, false, false); + this->plugins_[i]->log(entry->event_, TRUE, FALSE, FALSE); entry = next_entry; } } @@ -494,7 +494,7 @@ void LoggerPluginManager::open_file() } this->entry_list_ = NULL; } - is_first = false; + is_first = FALSE; } void LoggerPluginManager::close_file() @@ -503,7 +503,7 @@ void LoggerPluginManager::close_file() while (this->current_event_ != NULL) finish_event(); - ring_buffer_dump(true); + ring_buffer_dump(TRUE); } void LoggerPluginManager::unload_plugins() @@ -578,7 +578,7 @@ void LoggerPluginManager::internal_log_prebuff_logevent() CHARSTRING(mstrlen(new_log_message), new_log_message); Free(new_log_message); } - internal_log_to_all(entry->event_, true, false, false); + internal_log_to_all(entry->event_, TRUE, FALSE, FALSE); delete entry; entry = next_entry; } @@ -587,7 +587,7 @@ void LoggerPluginManager::internal_log_prebuff_logevent() } void LoggerPluginManager::internal_log_to_all(const TitanLoggerApi::TitanLogEvent& event, - bool log_buffered, bool separate_file, bool use_emergency_mask) + boolean log_buffered, boolean separate_file, boolean use_emergency_mask) { for (size_t i = 0; i < this->n_plugins_; ++i) { if (this->plugins_[i]->is_configured()) { @@ -596,14 +596,14 @@ void LoggerPluginManager::internal_log_to_all(const TitanLoggerApi::TitanLogEven } } -bool LoggerPluginManager::plugins_ready() const +boolean LoggerPluginManager::plugins_ready() const { for (size_t i = 0; i < this->n_plugins_; ++i) { if (this->plugins_[i]->is_configured()) { - return true; + return TRUE; } } - return false; + return FALSE; } void LoggerPluginManager::log(const API::TitanLogEvent& event) @@ -619,7 +619,7 @@ void LoggerPluginManager::log(const API::TitanLogEvent& event) if (TTCN_Logger::get_emergency_logging() == 0) { // If emergency buffering is not needed log the event - internal_log_to_all(event, false, false, false); + internal_log_to_all(event, FALSE, FALSE, FALSE); return; } @@ -630,7 +630,7 @@ void LoggerPluginManager::log(const API::TitanLogEvent& event) if (TTCN_Logger::get_emergency_logging_behaviour() == TTCN_Logger::BUFFER_MASKED) { //ToDo: do it nicer //if(TTCN_Logger::log_this_event((TTCN_Logger::Severity)(int)event.severity())){ - internal_log_to_all(event, true, false, false); + internal_log_to_all(event, TRUE, FALSE, FALSE); if (!TTCN_Logger::should_log_to_file((TTCN_Logger::Severity)(int)event.severity()) && TTCN_Logger::should_log_to_emergency((TTCN_Logger::Severity)(int)event.severity())) { ring_buffer.put(event); @@ -641,7 +641,7 @@ void LoggerPluginManager::log(const API::TitanLogEvent& event) // the ring buffer is full, get the the oldest event // check does the user want this to be logged if (ring_buffer.get(ring_event)) { - internal_log_to_all(ring_event, true, false, false); + internal_log_to_all(ring_event, TRUE, FALSE, FALSE); } else { // it is not wanted by the user, throw it away } @@ -658,9 +658,9 @@ void LoggerPluginManager::log(const API::TitanLogEvent& event) while (!ring_buffer.isEmpty()) { if (ring_buffer.get(ring_event)) { if (TTCN_Logger::get_emergency_logging_behaviour() == TTCN_Logger::BUFFER_MASKED) { - internal_log_to_all(ring_event, true, true, false); // log in separate file + internal_log_to_all(ring_event, TRUE, TRUE, FALSE); // log in separate file } else if (TTCN_Logger::get_emergency_logging_behaviour() == TTCN_Logger::BUFFER_ALL) { - internal_log_to_all(ring_event, true, false, true); // DO NOT log in separate file + internal_log_to_all(ring_event, TRUE, FALSE, TRUE); // DO NOT log in separate file } } } @@ -870,7 +870,7 @@ void LoggerPluginManager::log_getverdict(verdicttype verdict) log(event); } -void LoggerPluginManager::log_final_verdict(bool is_ptc, +void LoggerPluginManager::log_final_verdict(boolean is_ptc, verdicttype ptc_verdict, verdicttype local_verdict, verdicttype new_verdict, const char *verdict__reason, int notification, int ptc_compref, const char *ptc_name) @@ -1045,7 +1045,7 @@ void LoggerPluginManager::log_testcase_exec(const char *tc, const char *module) log(event); } -void LoggerPluginManager::log_module_init(const char *module, bool finish) +void LoggerPluginManager::log_module_init(const char *module, boolean finish) { if (!TTCN_Logger::log_this_event(TTCN_Logger::EXECUTOR_RUNTIME) && (TTCN_Logger::get_emergency_logging()<=0)) return; @@ -1581,7 +1581,7 @@ char* LoggerPluginManager::get_current_event_str() } void LoggerPluginManager::begin_event(TTCN_Logger::Severity msg_severity, - bool log2str) + boolean log2str) { event_destination_t event_dest; if (log2str) event_dest = ED_STRING; @@ -1799,7 +1799,7 @@ LoggerPlugin *LoggerPluginManager::find_plugin(const char *name) #undef new #endif -LoggerPluginManager::ActiveEvent::ActiveEvent(bool fake_event, event_destination_t dest) +LoggerPluginManager::ActiveEvent::ActiveEvent(boolean fake_event, event_destination_t dest) : event_() , event_str_(NULL) , event_str_len_(0) diff --git a/core/LoggerPluginManager.hh b/core/LoggerPluginManager.hh index a527797b5..d48906bb3 100644 --- a/core/LoggerPluginManager.hh +++ b/core/LoggerPluginManager.hh @@ -53,13 +53,13 @@ public: size(TTCN_Logger::get_emergency_logging()) {} ~RingBuffer(); - bool get(TitanLoggerApi::TitanLogEvent& data) MUST_CHECK; + boolean get(TitanLoggerApi::TitanLogEvent& data) MUST_CHECK; void put(TitanLoggerApi::TitanLogEvent data); void clear(); unsigned int get_size() const { return size; } void set_size(unsigned int new_size); - bool isFull() const { return (head + 1) % (size + 1) == tail; } - bool isEmpty() const {return head == tail; } + boolean isFull() const { return (head + 1) % (size + 1) == tail; } + boolean isEmpty() const {return head == tail; } }; class LoggerPluginManager @@ -67,11 +67,11 @@ class LoggerPluginManager friend class ILoggerPlugin; public: - void ring_buffer_dump(bool do_close_file); + void ring_buffer_dump(boolean do_close_file); // Sends a single log event to all logger plugins. void internal_log_to_all(const TitanLoggerApi::TitanLogEvent& event, - bool log_buffered, bool separate_file, bool use_emergency_mask); + boolean log_buffered, boolean separate_file, boolean use_emergency_mask); // If an event appears before any logger is configured we have to pre-buffer it. void internal_prebuff_logevent(const TitanLoggerApi::TitanLogEvent& event); // When the loggers get configured we have to log everything we have buffered so far @@ -85,24 +85,24 @@ public: void unload_plugins(); void reset(); - bool add_parameter(const logging_setting_t& logging_param); + boolean add_parameter(const logging_setting_t& logging_param); void set_parameters(component component_reference, const char *component_name); - bool plugins_ready() const; + boolean plugins_ready() const; /// Backward compatibility functions to handle top level configuration file /// parameters. All logger plug-ins will receive these settings, but they /// can simply ignore them. - bool set_file_mask(component_id_t const& comp, const Logging_Bits& new_file_mask); - bool set_console_mask(component_id_t const& comp, + boolean set_file_mask(component_id_t const& comp, const Logging_Bits& new_file_mask); + boolean set_console_mask(component_id_t const& comp, const Logging_Bits& new_console_mask); - void set_file_name(const char *new_filename_skeleton, bool from_config); - void set_append_file(bool new_append_file); + void set_file_name(const char *new_filename_skeleton, boolean from_config); + void set_append_file(boolean new_append_file); /// Return true if the given configuration file parameter was set multiple /// times. (The return value is used by the configuration file parser.) - bool set_file_size(component_id_t const& comp, int p_size); - bool set_file_number(component_id_t const& cmpt, int p_number); - bool set_disk_full_action(component_id_t const& comp, + boolean set_file_size(component_id_t const& comp, int p_size); + boolean set_file_number(component_id_t const& cmpt, int p_number); + boolean set_disk_full_action(component_id_t const& comp, TTCN_Logger::disk_full_action_t p_disk_full_action); void open_file(); void close_file(); @@ -120,7 +120,7 @@ public: void log_va_list(TTCN_Logger::Severity msg_severity, const char *fmt_str, va_list p_var); void buffer_event(const TitanLoggerApi::TitanLogEvent& event); - void begin_event(TTCN_Logger::Severity msg_severity, bool log2str); + void begin_event(TTCN_Logger::Severity msg_severity, boolean log2str); void end_event(); CHARSTRING end_event_log2str(); void finish_event(); @@ -151,7 +151,7 @@ public: void log_setverdict(verdicttype new_verdict, verdicttype old_verdict, verdicttype local_verdict, const char *old_reason = NULL, const char *new_reason = NULL); void log_getverdict(verdicttype verdict); - void log_final_verdict(bool is_ptc, verdicttype ptc_verdict, + void log_final_verdict(boolean is_ptc, verdicttype ptc_verdict, verdicttype local_verdict, verdicttype new_verdict, const char *verdict_reason = NULL, int notification = -1, int ptc_compref = UNBOUND_COMPREF, const char *ptc_name = NULL); @@ -173,7 +173,7 @@ public: void log_fd_limits(int fd_limit, long fd_set_size); void log_not_overloaded(int pid); void log_testcase_exec(const char *tc, const char *module); - void log_module_init(const char *module, bool finish); + void log_module_init(const char *module, boolean finish); void log_mtc_created(long pid); /// EXECUTOR_CONFIGDATA void log_configdata(int reason, const char *str); @@ -287,7 +287,7 @@ private: // element is at num_pieces_-2. The end of the last piece is event_str_len_ /// True if the event is for log2str, in which case @p event_ is blank. - bool fake_; + boolean fake_; /** Constructor * @@ -295,7 +295,7 @@ private: * @p event_ is not initialized. * @param dest event destination (logfile, string or none) */ - ActiveEvent(bool fake_event, event_destination_t dest); + ActiveEvent(boolean fake_event, event_destination_t dest); ~ActiveEvent(); TitanLoggerApi::TitanLogEvent& get_event() { diff --git a/core/LoggerPlugin_dynamic.cc b/core/LoggerPlugin_dynamic.cc index 0f51a661f..6ee48851e 100644 --- a/core/LoggerPlugin_dynamic.cc +++ b/core/LoggerPlugin_dynamic.cc @@ -17,12 +17,12 @@ #include <assert.h> #include <dlfcn.h> -bool str_ends_with(const char *str, const char *suffix) +boolean str_ends_with(const char *str, const char *suffix) { - if (!str || !suffix) return false; + if (!str || !suffix) return FALSE; size_t lenstr = strlen(str); size_t lensuffix = strlen(suffix); - if (lensuffix > lenstr) return false; + if (lensuffix > lenstr) return FALSE; return strncmp(str + lenstr - lensuffix, suffix, lensuffix) == 0; } @@ -42,7 +42,7 @@ void LoggerPlugin::load() { if (this->filename_) { // determine the required library - bool single_mode = TTCN_Runtime::is_single(); + boolean single_mode = TTCN_Runtime::is_single(); #ifndef TITAN_RUNTIME_2 const SoType required_so_type = single_mode ? RT1_SINGLE : RT1_PARALLEL; const char* required_suffix_str = single_mode ? ".so" : "-parallel.so"; diff --git a/core/LoggingBits.cc b/core/LoggingBits.cc index be216473d..94acff0ff 100644 --- a/core/LoggingBits.cc +++ b/core/LoggingBits.cc @@ -38,12 +38,12 @@ void Logging_Bits::add_sev( TTCN_Logger::Severity sev ) // Note that the assert and the comparison below are different. // 0==LOG_NOTHING which is valid but it means nothing to do. if (sev > 0 && sev < TTCN_Logger::NUMBER_OF_LOGSEVERITIES) { - bits[sev] = true; + bits[sev] = TRUE; } } -bool Logging_Bits::operator==( const Logging_Bits& other ) const +boolean Logging_Bits::operator==( const Logging_Bits& other ) const { return memcmp( bits, other.bits, sizeof(bits) ) == 0; } @@ -72,7 +72,7 @@ expstring_t Logging_Bits::describe() const size_t low_inc = TTCN_Logger::sev_categories[categ-1] + 1; size_t high_inc= TTCN_Logger::sev_categories[categ]; - const bool * first = bits + low_inc; + const boolean * first = bits + low_inc; size_t length= high_inc - low_inc + 1; assert(length < TTCN_Logger::NUMBER_OF_LOGSEVERITIES-1); // Comparing a segment of our bits with the "all 1s" of log_everything diff --git a/core/LoggingBits.hh b/core/LoggingBits.hh index 8336fb021..933358400 100644 --- a/core/LoggingBits.hh +++ b/core/LoggingBits.hh @@ -37,15 +37,15 @@ immediately after constructing. */ struct Logging_Bits { - bool bits[TTCN_Logger::NUMBER_OF_LOGSEVERITIES]; + boolean bits[TTCN_Logger::NUMBER_OF_LOGSEVERITIES]; static const Logging_Bits log_nothing; static const Logging_Bits log_all; static const Logging_Bits log_everything; static const Logging_Bits default_console_mask; - bool operator ==( const Logging_Bits& other ) const; - bool operator !=( const Logging_Bits& other ) const + boolean operator ==( const Logging_Bits& other ) const; + boolean operator !=( const Logging_Bits& other ) const { return ! operator==( other ); } diff --git a/core/Module_list.cc b/core/Module_list.cc index 3c626e187..9f5a7028b 100644 --- a/core/Module_list.cc +++ b/core/Module_list.cc @@ -925,7 +925,7 @@ void TTCN_Module::post_init_module() post_init_called = TRUE; TTCN_Logger::log_module_init(module_name); if (post_init_func != NULL) post_init_func(); - TTCN_Logger::log_module_init(module_name, true); + TTCN_Logger::log_module_init(module_name, TRUE); } void TTCN_Module::add_function(const char *function_name, diff --git a/core/Objid.cc b/core/Objid.cc index fb9f997ef..ee8b4bcb0 100644 --- a/core/Objid.cc +++ b/core/Objid.cc @@ -354,7 +354,7 @@ void OBJID::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); - if(JSON_decode(p_td, tok, false)<0) + if(JSON_decode(p_td, tok, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG, "Can not decode type '%s', because invalid or incomplete" " message was received" @@ -511,7 +511,7 @@ int OBJID::XER_encode(const XERdescriptor_t& p_td, flavor |= SIMPLE_TYPE; flavor &= ~XER_RECOF; // object identifier doesn't care - begin_xml(p_td, p_buf, flavor, indent, false); + begin_xml(p_td, p_buf, flavor, indent, FALSE); static char str_buf[64]; for (int i = 0; i < val_ptr->n_components; ++i ) { @@ -528,7 +528,7 @@ int OBJID::XER_encode(const XERdescriptor_t& p_td, else p_buf.put_s(str_len, (const unsigned char*)str_buf); } - end_xml(p_td, p_buf, flavor, indent, false); + end_xml(p_td, p_buf, flavor, indent, FALSE); return (int)p_buf.get_len() - encoded_length; } @@ -621,7 +621,7 @@ int OBJID::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_tok, json_token_t token = JSON_TOKEN_NONE; char* value = 0; size_t value_len = 0; - boolean error = false; + boolean error = FALSE; int dec_len = 0; boolean use_default = p_td.json->default_value && 0 == p_tok.get_buffer_length(); if (use_default) { diff --git a/core/Octetstring.cc b/core/Octetstring.cc index 1aa836e98..0ee71520f 100644 --- a/core/Octetstring.cc +++ b/core/Octetstring.cc @@ -616,7 +616,7 @@ void OCTETSTRING::encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; - RAW_enc_tree root(true,NULL,&rp,1,p_td.raw); + RAW_enc_tree root(TRUE,NULL,&rp,1,p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} @@ -721,7 +721,7 @@ void OCTETSTRING::decode(const TTCN_Typedescriptor_t& p_td, TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); - if(JSON_decode(p_td, tok, false)<0) + if(JSON_decode(p_td, tok, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG, "Can not decode type '%s', because invalid or incomplete" " message was received" @@ -768,8 +768,8 @@ int OCTETSTRING::RAW_encode_negtest_raw(RAW_enc_tree& p_myleaf) const { if (p_myleaf.must_free) Free(p_myleaf.body.leaf.data_ptr); - p_myleaf.must_free = false; - p_myleaf.data_ptr_used = true; + p_myleaf.must_free = FALSE; + p_myleaf.data_ptr_used = TRUE; p_myleaf.body.leaf.data_ptr = val_ptr->octets_ptr; return p_myleaf.length = val_ptr->n_octets * 8; } @@ -1185,18 +1185,18 @@ int OCTETSTRING::RAW_encode(const TTCN_Typedescriptor_t& p_td, align_length = 0; } if (myleaf.must_free) Free(myleaf.body.leaf.data_ptr); - myleaf.must_free = false; - myleaf.data_ptr_used = true; + myleaf.must_free = FALSE; + myleaf.data_ptr_used = TRUE; if (p_td.raw->extension_bit != EXT_BIT_NO && myleaf.coding_par.bitorder == ORDER_MSB) { if (blength > RAW_INT_ENC_LENGTH) { myleaf.body.leaf.data_ptr = bc = (unsigned char*)Malloc(blength*sizeof(*bc)); - myleaf.must_free = true; - myleaf.data_ptr_used = true; + myleaf.must_free = TRUE; + myleaf.data_ptr_used = TRUE; } else { bc = myleaf.body.leaf.data_array; - myleaf.data_ptr_used = false; + myleaf.data_ptr_used = FALSE; } for (int a = 0; a < blength; a++) bc[a] = val_ptr->octets_ptr[a] << 1; } @@ -1222,12 +1222,12 @@ int OCTETSTRING::RAW_decode(const TTCN_Typedescriptor_t& p_td, ? (int)buff.unread_len_bit() : limit) / 8) * 8; } RAW_coding_par cp; - bool orders = false; - if (p_td.raw->bitorderinoctet == ORDER_MSB) orders = true; + boolean orders = FALSE; + if (p_td.raw->bitorderinoctet == ORDER_MSB) orders = TRUE; if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders; cp.bitorder = orders ? ORDER_MSB : ORDER_LSB; - orders = false; - if (p_td.raw->byteorder == ORDER_MSB) orders = true; + orders = FALSE; + if (p_td.raw->byteorder == ORDER_MSB) orders = TRUE; if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders; cp.byteorder = orders ? ORDER_MSB : ORDER_LSB; cp.fieldorder = p_td.raw->fieldorder; @@ -1301,7 +1301,7 @@ int OCTETSTRING::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& json_token_t token = JSON_TOKEN_NONE; char* value = 0; size_t value_len = 0; - boolean error = false; + boolean error = FALSE; int dec_len = 0; boolean use_default = p_td.json->default_value && 0 == p_tok.get_buffer_length(); if (use_default) { @@ -1331,11 +1331,11 @@ int OCTETSTRING::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& if (upper_nibble <= 0x0F && lower_nibble <= 0x0F) { val_ptr->octets_ptr[i] = (upper_nibble << 4) | lower_nibble; } else { - error = true; + error = TRUE; } } } else { - error = true; + error = TRUE; } } else { return JSON_ERROR_INVALID_TOKEN; diff --git a/core/Optional.hh b/core/Optional.hh index df8a1ac44..2900d5fc8 100644 --- a/core/Optional.hh +++ b/core/Optional.hh @@ -298,7 +298,7 @@ public: * @param reader parses the encoded XML * @param next_field_name name of the next field in the record, or null if this is the last one * @param parent_tag_closed true, if the record's XML tag is closed (is an empty element)*/ - bool XER_check_any_elem(XmlReaderWrap& reader, const char* next_field_name, bool parent_tag_closed); + boolean XER_check_any_elem(XmlReaderWrap& reader, const char* next_field_name, boolean parent_tag_closed); int XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, unsigned int flavor, unsigned int flavor2, embed_values_dec_struct_t* emb_val); @@ -1022,33 +1022,33 @@ OPTIONAL<T_type>::XER_encode_negtest(const Erroneous_descriptor_t* p_err_descr, template<typename T_type> bool -OPTIONAL<T_type>::XER_check_any_elem(XmlReaderWrap& reader, const char* next_field_name, bool parent_tag_closed) +OPTIONAL<T_type>::XER_check_any_elem(XmlReaderWrap& reader, const char* next_field_name, boolean parent_tag_closed) { // If the record has no elements, then it can't have an AnyElement if (parent_tag_closed) { set_to_omit(); - return false; + return FALSE; } while (reader.Ok()) { // Leaving the record before finding an element -> no AnyElement if (XML_READER_TYPE_END_ELEMENT == reader.NodeType()) { set_to_omit(); - return false; + return FALSE; } if (XML_READER_TYPE_ELEMENT == reader.NodeType()) { // The first element found is either the next field's element or the AnyElement if (NULL != next_field_name && 0 == strcmp((const char*)reader.LocalName(), next_field_name)) { set_to_omit(); - return false; + return FALSE; } break; } reader.Read(); } - return true; + return TRUE; } template<typename T_type> @@ -1137,7 +1137,7 @@ char ** OPTIONAL<T_type>::collect_ns(const XERdescriptor_t& p_td, size_t& num, b case OPTIONAL_PRESENT: return optional_value->collect_ns(p_td, num, def_ns); case OPTIONAL_OMIT: - def_ns = false; + def_ns = FALSE; num = 0; return 0; default: diff --git a/core/Param_Types.cc b/core/Param_Types.cc index 0f0f0357c..e99b3fcce 100644 --- a/core/Param_Types.cc +++ b/core/Param_Types.cc @@ -53,9 +53,9 @@ char* Module_Param_Id::get_current_name() const { return NULL; } -bool Module_Param_Id::next_name(int /*offset*/) { +boolean Module_Param_Id::next_name(int /*offset*/) { TTCN_error("Internal error: Module_Param_Id::next_name()"); - return false; + return FALSE; } size_t Module_Param_Id::get_nof_names() const { @@ -66,7 +66,7 @@ size_t Module_Param_Id::get_nof_names() const { char* Module_Param_Name::get_str() const { char* result = NULL; for (size_t i = 0; i < names.size(); ++i) { - bool is_index = names[i][0] >= '0' && names[i][0] <= '9'; + boolean is_index = names[i][0] >= '0' && names[i][0] <= '9'; if (i > 0 && !is_index) { result = mputc(result, '.'); } @@ -133,7 +133,7 @@ void Module_Param::set_length_restriction(Module_Param_Length_Restriction* p_len length_restriction = p_length_restriction; } -void Module_Param::log(bool log_id) const { +void Module_Param::log(boolean log_id) const { if (log_id && id && id->is_explicit()) { char* id_str = id->get_str(); TTCN_Logger::log_event_str(id_str); @@ -150,8 +150,8 @@ void Module_Param::log(bool log_id) const { } void Module_Param::basic_check(int check_bits, const char* what) const { - bool is_template = check_bits & BC_TEMPLATE; - bool is_list = check_bits & BC_LIST; + boolean is_template = check_bits & BC_TEMPLATE; + boolean is_list = check_bits & BC_LIST; if (is_template || !is_list) { if (get_operation_type()!=OT_ASSIGN) error("The %s of %ss is not allowed.", get_operation_type_str(), what); } @@ -206,14 +206,14 @@ int_val_t* Module_Param::get_upper_int() const { return NULL; } -bool Module_Param::get_is_min_exclusive() const { +boolean Module_Param::get_is_min_exclusive() const { TTCN_error("Internal error: Module_Param::get_is_min_exclusive()"); - return false; + return FALSE; } -bool Module_Param::get_is_max_exclusive() const { +boolean Module_Param::get_is_max_exclusive() const { TTCN_error("Internal error: Module_Param::get_is_max_exclusive()"); - return false; + return FALSE; } double Module_Param::get_lower_float() const { @@ -226,14 +226,14 @@ double Module_Param::get_upper_float() const { return 0.0; } -bool Module_Param::has_lower_float() const { +boolean Module_Param::has_lower_float() const { TTCN_error("Internal error: Module_Param::has_lower_float()"); - return false; + return FALSE; } -bool Module_Param::has_upper_float() const { +boolean Module_Param::has_upper_float() const { TTCN_error("Internal error: Module_Param::has_upper_float()"); - return false; + return FALSE; } universal_char Module_Param::get_lower_uchar() const { @@ -527,7 +527,7 @@ void Module_Param_AnyOrNone::log_value() const { TTCN_Logger::log_event_str("*"); } -void Module_Param_IntRange::log_bound(int_val_t* bound, bool is_lower) { +void Module_Param_IntRange::log_bound(int_val_t* bound, boolean is_lower) { if (bound==NULL) { if (is_lower) TTCN_Logger::log_event_str("-"); TTCN_Logger::log_event_str("infinity"); @@ -542,9 +542,9 @@ void Module_Param_IntRange::log_bound(int_val_t* bound, bool is_lower) { void Module_Param_IntRange::log_value() const { TTCN_Logger::log_event_str("("); - log_bound(lower_bound, true); + log_bound(lower_bound, TRUE); TTCN_Logger::log_event_str(".."); - log_bound(upper_bound, false); + log_bound(upper_bound, FALSE); TTCN_Logger::log_event_str(")"); } @@ -623,7 +623,7 @@ void Module_Param_Compound::add_elem(Module_Param* value) { void Module_Param_Compound::add_list_with_implicit_ids(Vector<Module_Param*>* mp_list) { for (size_t i=0; i<mp_list->size(); i++) { Module_Param* mp_current = mp_list->at(i); - mp_current->set_id(new Module_Param_Index(get_size(),false)); + mp_current->set_id(new Module_Param_Index(get_size(),FALSE)); add_elem(mp_current); } } @@ -720,7 +720,7 @@ void Module_Param::error(const char* err_msg, ...) const { case OT_CONCAT: TTCN_Logger::log_event_str(" and '"); break; default: TTCN_Logger::log_event_str("' ??? '"); } - log(false); + log(FALSE); TTCN_Logger::log_event_str("': "); va_list p_var; va_start(p_var, err_msg); @@ -765,5 +765,5 @@ void Module_Param::type_error(const char* expected, const char* type_name /* = N } } -bool Ttcn_String_Parsing::string_parsing = false; -bool Debugger_Value_Parsing::is_happening = false; +boolean Ttcn_String_Parsing::string_parsing = FALSE; +boolean Debugger_Value_Parsing::is_happening = FALSE; diff --git a/core/Param_Types.hh b/core/Param_Types.hh index 934016fde..106d1775e 100644 --- a/core/Param_Types.hh +++ b/core/Param_Types.hh @@ -59,13 +59,13 @@ class Module_Param_Id { public: Module_Param_Id() {} virtual ~Module_Param_Id() {} - virtual bool is_explicit() const = 0; - virtual bool is_index() const { return false; } - virtual bool is_custom() const { return false; } + virtual boolean is_explicit() const = 0; + virtual boolean is_index() const { return FALSE; } + virtual boolean is_custom() const { return FALSE; } virtual size_t get_index() const; virtual char* get_name() const; virtual char* get_current_name() const; - virtual bool next_name(int offset = 1); + virtual boolean next_name(int offset = 1); virtual size_t get_nof_names() const; virtual char* get_str() const = 0; // returns an expstring that must be deallocated }; @@ -81,12 +81,12 @@ class Module_Param_Name : public Module_Param_Id { public: Module_Param_Name(const Vector<char*>& p): names(p), pos(0) {} ~Module_Param_Name() { for (size_t i = 0; i < names.size(); ++i) Free(names[i]); } - bool is_explicit() const { return true; } + boolean is_explicit() const { return TRUE; } char* get_current_name() const { return names[pos]; } - bool next_name(int offset = 1) { - if (static_cast<int>(pos) + offset < 0 || pos + offset >= names.size()) return false; + boolean next_name(int offset = 1) { + if (static_cast<int>(pos) + offset < 0 || pos + offset >= names.size()) return FALSE; pos += offset; - return true; + return TRUE; } void reset() { pos = 0; } size_t get_nof_names() const { return names.size(); } @@ -99,18 +99,18 @@ public: Module_Param_FieldName(char* p): name(p) {} ~Module_Param_FieldName() { Free(name); } char* get_name() const { return name; } - bool is_explicit() const { return true; } + boolean is_explicit() const { return TRUE; } char* get_str() const; }; class Module_Param_Index : public Module_Param_Id { size_t index; - bool is_expl; + boolean is_expl; public: - Module_Param_Index(size_t p_index, bool p_is_expl): index(p_index), is_expl(p_is_expl) {} + Module_Param_Index(size_t p_index, boolean p_is_expl): index(p_index), is_expl(p_is_expl) {} size_t get_index() const { return index; } - bool is_index() const { return true; } - bool is_explicit() const { return is_expl; } + boolean is_index() const { return TRUE; } + boolean is_explicit() const { return is_expl; } char* get_str() const; }; @@ -126,9 +126,9 @@ public: Module_Param_CustomName(char* p): name(p) {} ~Module_Param_CustomName() { Free(name); } char* get_name() const { return name; } - bool is_explicit() const { return true; } + boolean is_explicit() const { return TRUE; } char* get_str() const; - bool is_custom() const { return true; } + boolean is_custom() const { return TRUE; } }; /////////////////////////////////////////////////////////////////////////////// @@ -137,17 +137,17 @@ class Module_Param_Length_Restriction { Module_Param_Length_Restriction(const Module_Param_Length_Restriction& p); // copy constructor disabled Module_Param_Length_Restriction& operator=(const Module_Param_Length_Restriction& p); // assignment disabled size_t min; - bool has_max; + boolean has_max; size_t max; public: - Module_Param_Length_Restriction(): min(0), has_max(false), max(0) {} - void set_single(size_t p_single) { has_max=true; min = max = p_single; } + Module_Param_Length_Restriction(): min(0), has_max(FALSE), max(0) {} + void set_single(size_t p_single) { has_max=TRUE; min = max = p_single; } void set_min(size_t p_min) { min=p_min; } - void set_max(size_t p_max) { has_max=true; max=p_max; } + void set_max(size_t p_max) { has_max=TRUE; max=p_max; } size_t get_min() const { return min; } - bool get_has_max() const { return has_max; } + boolean get_has_max() const { return has_max; } size_t get_max() const { return max; } - bool is_single() const { return has_max && min==max; } + boolean is_single() const { return has_max && min==max; } void log() const; }; @@ -242,7 +242,7 @@ public: const char* get_operation_type_str() const; const char* get_operation_type_sign_str() const; virtual const char* get_type_str() const = 0; - void log(bool log_id = true) const; + void log(boolean log_id = TRUE) const; virtual void log_value() const = 0; char* get_param_context() const; @@ -274,12 +274,12 @@ public: virtual void* get_string_data() const; virtual int_val_t* get_lower_int() const; virtual int_val_t* get_upper_int() const; - virtual bool get_is_min_exclusive() const; - virtual bool get_is_max_exclusive() const; + virtual boolean get_is_min_exclusive() const; + virtual boolean get_is_max_exclusive() const; virtual double get_lower_float() const; virtual double get_upper_float() const; - virtual bool has_lower_float() const; - virtual bool has_upper_float() const; + virtual boolean has_lower_float() const; + virtual boolean has_upper_float() const; virtual universal_char get_lower_uchar() const; virtual universal_char get_upper_uchar() const; virtual int_val_t* get_integer() const; @@ -541,34 +541,34 @@ public: class Module_Param_IntRange : public Module_Param { int_val_t* lower_bound; // NULL == -infinity int_val_t* upper_bound; // NULL == infinity - bool min_exclusive, max_exclusive; + boolean min_exclusive, max_exclusive; public: type_t get_type() const { return MP_IntRange; } - Module_Param_IntRange(int_val_t* p_l, int_val_t* p_u, bool min_is_exclusive, bool max_is_exclusive): + Module_Param_IntRange(int_val_t* p_l, int_val_t* p_u, boolean min_is_exclusive, boolean max_is_exclusive): lower_bound(p_l), upper_bound(p_u), min_exclusive(min_is_exclusive), max_exclusive(max_is_exclusive) {} ~Module_Param_IntRange() { Free(lower_bound); Free(upper_bound); } int_val_t* get_lower_int() const { return lower_bound; } int_val_t* get_upper_int() const { return upper_bound; } const char* get_type_str() const { return "integer range"; } - bool get_is_min_exclusive() const { return min_exclusive; } - bool get_is_max_exclusive() const { return max_exclusive; } + boolean get_is_min_exclusive() const { return min_exclusive; } + boolean get_is_max_exclusive() const { return max_exclusive; } void log_value() const; - static void log_bound(int_val_t* bound, bool is_lower); + static void log_bound(int_val_t* bound, boolean is_lower); }; class Module_Param_FloatRange : public Module_Param { double lower_bound; - bool has_lower; + boolean has_lower; double upper_bound; - bool has_upper; - bool min_exclusive, max_exclusive; + boolean has_upper; + boolean min_exclusive, max_exclusive; public: type_t get_type() const { return MP_FloatRange; } - Module_Param_FloatRange(double p_lb, bool p_hl, double p_ub, bool p_hu, bool min_is_exclusive, bool max_is_exclusive): lower_bound(p_lb), has_lower(p_hl), upper_bound(p_ub), has_upper(p_hu), min_exclusive(min_is_exclusive), max_exclusive(max_is_exclusive) {} + Module_Param_FloatRange(double p_lb, boolean p_hl, double p_ub, boolean p_hu, boolean min_is_exclusive, boolean max_is_exclusive): lower_bound(p_lb), has_lower(p_hl), upper_bound(p_ub), has_upper(p_hu), min_exclusive(min_is_exclusive), max_exclusive(max_is_exclusive) {} double get_lower_float() const { return lower_bound; } double get_upper_float() const { return upper_bound; } - bool has_lower_float() const { return has_lower; } - bool has_upper_float() const { return has_upper; } + boolean has_lower_float() const { return has_lower; } + boolean has_upper_float() const { return has_upper; } const char* get_type_str() const { return "float range"; } boolean get_is_min_exclusive() const { return min_exclusive; } boolean get_is_max_exclusive() const { return max_exclusive; } @@ -578,10 +578,10 @@ public: class Module_Param_StringRange : public Module_Param { universal_char lower_bound; universal_char upper_bound; - bool min_exclusive, max_exclusive; + boolean min_exclusive, max_exclusive; public: type_t get_type() const { return MP_StringRange; } - Module_Param_StringRange(const universal_char& p_lb, const universal_char& p_ub, bool min_is_exclusive, bool max_is_exclusive): lower_bound(p_lb), upper_bound(p_ub), min_exclusive(min_is_exclusive), max_exclusive(max_is_exclusive) {} + Module_Param_StringRange(const universal_char& p_lb, const universal_char& p_ub, boolean min_is_exclusive, boolean max_is_exclusive): lower_bound(p_lb), upper_bound(p_ub), min_exclusive(min_is_exclusive), max_exclusive(max_is_exclusive) {} universal_char get_lower_uchar() const { return lower_bound; } universal_char get_upper_uchar() const { return upper_bound; } const char* get_type_str() const { return "char range"; } @@ -699,20 +699,20 @@ public: class Ttcn_String_Parsing { private: // only instantiation can set it to true and destruction set it back to false - static bool string_parsing; + static boolean string_parsing; public: - Ttcn_String_Parsing() { string_parsing = true; } - ~Ttcn_String_Parsing() { string_parsing = false; } - static bool happening() { return string_parsing; } + Ttcn_String_Parsing() { string_parsing = TRUE; } + ~Ttcn_String_Parsing() { string_parsing = FALSE; } + static boolean happening() { return string_parsing; } }; class Debugger_Value_Parsing { private: // only instantiation can set it to true and destruction set it back to false - static bool is_happening; + static boolean is_happening; public: - Debugger_Value_Parsing() { is_happening = true; } - ~Debugger_Value_Parsing() { is_happening = false; } - static bool happening() { return is_happening; } + Debugger_Value_Parsing() { is_happening = TRUE; } + ~Debugger_Value_Parsing() { is_happening = FALSE; } + static boolean happening() { return is_happening; } }; /** Use the configuration file parser to convert a string into a TTCN-3 value. @@ -723,7 +723,7 @@ public: * @tricky Component names (given with the "start" command) can contain any characters. * This conflicts with several other rules, so certain rules in the parser will only * be applied to components. */ -extern Module_Param* process_config_string2ttcn(const char* mp_str, bool is_component); +extern Module_Param* process_config_string2ttcn(const char* mp_str, boolean is_component); extern Module_Param* process_config_debugger_value(const char* mp_str); diff --git a/core/Port.cc b/core/Port.cc index de87bf3fa..13d16e4a6 100644 --- a/core/Port.cc +++ b/core/Port.cc @@ -474,7 +474,7 @@ alt_status PORT::receive(const COMPONENT_template&, COMPONENT *) TTCN_Logger::log_matching_problem( TitanLoggerApi::MatchingProblemType_reason::no__incoming__types, TitanLoggerApi::MatchingProblemType_operation::receive__, - false, false, port_name); + FALSE, FALSE, port_name); return ALT_NO; } @@ -503,7 +503,7 @@ alt_status PORT::any_receive(const COMPONENT_template& sender_template, TTCN_Logger::log_matching_problem( TitanLoggerApi::MatchingProblemType_reason::component__has__no__ports, TitanLoggerApi::MatchingProblemType_operation::receive__, - true, false); + TRUE, FALSE); return ALT_NO; } } @@ -513,7 +513,7 @@ alt_status PORT::check_receive(const COMPONENT_template&, COMPONENT *) TTCN_Logger::log_matching_problem( TitanLoggerApi::MatchingProblemType_reason::no__incoming__types, TitanLoggerApi::MatchingProblemType_operation::receive__, - false, true, port_name); + FALSE, TRUE, port_name); return ALT_NO; } @@ -542,7 +542,7 @@ alt_status PORT::any_check_receive(const COMPONENT_template& sender_template, TTCN_Logger::log_matching_problem( TitanLoggerApi::MatchingProblemType_reason::component__has__no__ports, TitanLoggerApi::MatchingProblemType_operation::receive__, - true, true); + TRUE, TRUE); return ALT_NO; } } @@ -552,7 +552,7 @@ alt_status PORT::trigger(const COMPONENT_template&, COMPONENT *) TTCN_Logger::log_matching_problem( TitanLoggerApi::MatchingProblemType_reason::no__incoming__types, TitanLoggerApi::MatchingProblemType_operation::trigger__, - false, false, port_name); + FALSE, FALSE, port_name); return ALT_NO; } @@ -583,7 +583,7 @@ alt_status PORT::any_trigger(const COMPONENT_template& sender_template, TTCN_Logger::log_matching_problem( TitanLoggerApi::MatchingProblemType_reason::component__has__no__ports, TitanLoggerApi::MatchingProblemType_operation::trigger__, - true, false); + TRUE, FALSE); return ALT_NO; } } @@ -624,7 +624,7 @@ alt_status PORT::any_getcall(const COMPONENT_template& sender_template, TTCN_Logger::log_matching_problem( TitanLoggerApi::MatchingProblemType_reason::component__has__no__ports, TitanLoggerApi::MatchingProblemType_operation::getcall__, - true, false); + TRUE, FALSE); return ALT_NO; } } @@ -665,7 +665,7 @@ alt_status PORT::any_check_getcall(const COMPONENT_template& sender_template, TTCN_Logger::log_matching_problem( TitanLoggerApi::MatchingProblemType_reason::component__has__no__ports, TitanLoggerApi::MatchingProblemType_operation::getcall__, - true, true); + TRUE, TRUE); return ALT_NO; } } @@ -706,7 +706,7 @@ alt_status PORT::any_getreply(const COMPONENT_template& sender_template, TTCN_Logger::log_matching_problem( TitanLoggerApi::MatchingProblemType_reason::component__has__no__ports, TitanLoggerApi::MatchingProblemType_operation::getreply__, - true, false); + TRUE, FALSE); return ALT_NO; } } @@ -747,7 +747,7 @@ alt_status PORT::any_check_getreply(const COMPONENT_template& sender_template, TTCN_Logger::log_matching_problem( TitanLoggerApi::MatchingProblemType_reason::component__has__no__ports, TitanLoggerApi::MatchingProblemType_operation::getreply__, - true, true); + TRUE, TRUE); return ALT_NO; } } @@ -788,7 +788,7 @@ alt_status PORT::any_catch(const COMPONENT_template& sender_template, TTCN_Logger::log_matching_problem( TitanLoggerApi::MatchingProblemType_reason::component__has__no__ports, TitanLoggerApi::MatchingProblemType_operation::catch__, - true, false); + TRUE, FALSE); return ALT_NO; } } @@ -801,7 +801,7 @@ alt_status PORT::check_catch(const COMPONENT_template& , // TTCN_Logger::log_matching_problem( // TitanLoggerApi::MatchingProblemType_reason::no__outgoing__blocking__signatures__that__support__exceptions, // TitanLoggerApi::MatchingProblemType_operation::catch__, -// false, true, port_name); +// false, TRUE, port_name); return ALT_NO; } @@ -830,7 +830,7 @@ alt_status PORT::any_check_catch(const COMPONENT_template& sender_template, TTCN_Logger::log_matching_problem( TitanLoggerApi::MatchingProblemType_reason::component__has__no__ports, TitanLoggerApi::MatchingProblemType_operation::catch__, - true, true); + TRUE, TRUE); return ALT_NO; } } @@ -924,7 +924,7 @@ alt_status PORT::any_check(const COMPONENT_template& sender_template, TTCN_Logger::log_matching_problem( TitanLoggerApi::MatchingProblemType_reason::component__has__no__ports, TitanLoggerApi::MatchingProblemType_operation::check__, - true, false); + TRUE, FALSE); return ALT_NO; } } @@ -1057,7 +1057,7 @@ void PORT::Install_Handler(const fd_set *read_fds, const fd_set *write_fds, "inactive port %s.", port_name); if ((long) FdMap::getFdLimit() > (long) FD_SETSIZE) { - static bool once = true; + static boolean once = TRUE; if (once) { TTCN_warning("The maximum number of open file descriptors (%i)" " is greater than FD_SETSIZE (%li)." @@ -1068,7 +1068,7 @@ void PORT::Install_Handler(const fd_set *read_fds, const fd_set *write_fds, FdMap::getFdLimit(), (long) FD_SETSIZE, (long) FD_SETSIZE, port_name); } - once = false; + once = FALSE; } Fd_And_Timeout_User::set_fds_with_fd_sets(this, read_fds, write_fds, @@ -1871,7 +1871,7 @@ void PORT::send_data_local(port_connection *conn_ptr, Text_Buf& outgoing_data) boolean PORT::send_data_stream(port_connection *conn_ptr, Text_Buf& outgoing_data, boolean ignore_peer_disconnect) { - bool would_block_warning=false; + boolean would_block_warning=FALSE; outgoing_data.calculate_length(); const char *msg_ptr = outgoing_data.get_data(); size_t msg_len = outgoing_data.get_len(), sent_len = 0; @@ -1906,7 +1906,7 @@ boolean PORT::send_data_stream(port_connection *conn_ptr, "outgoing buffer. Trying to process incoming data to " "avoid deadlock.", conn_ptr->remote_port); TTCN_warning_end(); - would_block_warning=true; + would_block_warning=TRUE; } TTCN_Snapshot::block_for_sending(conn_ptr->stream.comm_fd); } @@ -2428,7 +2428,7 @@ void PORT::unmap_port(const char *component_port, const char *system_port) TTCN_Communication::send_unmapped(component_port, system_port); } -bool PORT::check_port_state(const CHARSTRING& type) const +boolean PORT::check_port_state(const CHARSTRING& type) const { if (type == "Started") { return is_started; @@ -2446,21 +2446,21 @@ bool PORT::check_port_state(const CHARSTRING& type) const TTCN_error("%s is not an allowed parameter of checkstate().", (const char*)type); } -bool PORT::any_check_port_state(const CHARSTRING& type) +boolean PORT::any_check_port_state(const CHARSTRING& type) { - bool result = false; + boolean result = FALSE; for (PORT *port = list_head; port != NULL; port = port->list_next) { result = port->check_port_state(type); if (result) { - return true; + return TRUE; } } - return false; + return FALSE; } -bool PORT::all_check_port_state(const CHARSTRING& type) +boolean PORT::all_check_port_state(const CHARSTRING& type) { - bool result = true; + boolean result = TRUE; for (PORT *port = list_head; port != NULL && result; port = port->list_next) { result = port->check_port_state(type); } diff --git a/core/Port.hh b/core/Port.hh index 9727e1c10..539631518 100644 --- a/core/Port.hh +++ b/core/Port.hh @@ -129,9 +129,9 @@ public: void halt(); static void all_halt(); - bool check_port_state(const CHARSTRING& type) const; - static bool any_check_port_state(const CHARSTRING& type); - static bool all_check_port_state(const CHARSTRING& type); + boolean check_port_state(const CHARSTRING& type) const; + static boolean any_check_port_state(const CHARSTRING& type); + static boolean all_check_port_state(const CHARSTRING& type); virtual alt_status receive(const COMPONENT_template& sender_template = any_compref, COMPONENT *sender_ptr = NULL); diff --git a/core/Profiler.cc b/core/Profiler.cc index ce74222ad..884d24678 100644 --- a/core/Profiler.cc +++ b/core/Profiler.cc @@ -454,22 +454,22 @@ void TTCN3_Stack_Depth::add_stack(int stack_len, const char* caller_file, const item.start_line = start_line; item.elapsed.tv_sec = 0; item.elapsed.tv_usec = 0; - item.first_call = true; - item.recursive_call = false; + item.first_call = TRUE; + item.recursive_call = FALSE; if (!net_line_times || !net_func_times) { // check if it's a recursive function for (int i = current_depth - 1; i >= 0 ; --i) { if (call_stack_timer_db[i].start_line == start_line && 0 == strcmp(call_stack_timer_db[i].func_file, func_file)) { - item.recursive_call = true; + item.recursive_call = TRUE; // check if the caller is new if (call_stack_timer_db[i].caller_line == caller_line && ((NULL == call_stack_timer_db[i].caller_file && NULL == caller_file) || (NULL != call_stack_timer_db[i].caller_file && NULL != caller_file && 0 == strcmp(call_stack_timer_db[i].caller_file, caller_file)))) { - item.first_call = false; + item.first_call = FALSE; break; } } diff --git a/core/ProfilerTools.cc b/core/ProfilerTools.cc index b5c9db6de..3d32dbbf3 100644 --- a/core/ProfilerTools.cc +++ b/core/ProfilerTools.cc @@ -367,7 +367,7 @@ namespace Profiler_Tools { } // use the JSON tokenizer to create a JSON document from the database - JSON_Tokenizer json(true); + JSON_Tokenizer json(TRUE); // main array, contains an element for each file json.put_next_token(JSON_TOKEN_ARRAY_START, NULL); diff --git a/core/RAW.cc b/core/RAW.cc index de81363ef..1c8073282 100644 --- a/core/RAW.cc +++ b/core/RAW.cc @@ -86,11 +86,11 @@ const unsigned char BitMaskTable[9]={ RAW_enc_tree::RAW_enc_tree(boolean is_leaf, RAW_enc_tree *par, RAW_enc_tr_pos *par_pos, int my_pos, const TTCN_RAWdescriptor_t *raw_attr) { - bool orders = false; + boolean orders = FALSE; isleaf = is_leaf; - must_free = false; - data_ptr_used = false; - rec_of = false; + must_free = FALSE; + data_ptr_used = FALSE; + rec_of = FALSE; parent = par; curr_pos.pos = (int*) Malloc((par_pos->level+1)*sizeof(int)); if (par_pos->level) memcpy((void*) curr_pos.pos, (void*) par_pos->pos, @@ -111,11 +111,11 @@ RAW_enc_tree::RAW_enc_tree(boolean is_leaf, RAW_enc_tree *par, ext_bit = raw_attr->extension_bit; top_bit_order = raw_attr->top_bit_order; calc = CALC_NO; - if (raw_attr->byteorder == ORDER_MSB) orders = true; + if (raw_attr->byteorder == ORDER_MSB) orders = TRUE; if (raw_attr->bitorderinfield == ORDER_MSB) orders = !orders; coding_par.byteorder = orders ? ORDER_MSB : ORDER_LSB; - orders = false; - if (raw_attr->bitorderinoctet == ORDER_MSB) orders = true; + orders = FALSE; + if (raw_attr->bitorderinoctet == ORDER_MSB) orders = TRUE; if (raw_attr->bitorderinfield == ORDER_MSB) orders = !orders; coding_par.bitorder = orders ? ORDER_MSB : ORDER_LSB; coding_par.hexorder = raw_attr->hexorder; @@ -361,7 +361,7 @@ int RAW_encode_enum_type(const TTCN_Typedescriptor_t& p_td, // Called from code generated by enum.c (defEnumClass) int RAW_decode_enum_type(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buff, int limit, raw_order_t top_bit_ord, int& value, int min_bits_enum, - bool no_err) + boolean no_err) { int fl = p_td.raw->fieldlength ? p_td.raw->fieldlength : min_bits_enum; TTCN_RAWdescriptor_t my_raw; diff --git a/core/RAW.hh b/core/RAW.hh index 79ae911fe..348ff8bc2 100644 --- a/core/RAW.hh +++ b/core/RAW.hh @@ -131,10 +131,10 @@ class RAW_enc_tree{ public: /** indicates that the node is leaf (contains actual data) or not * (contains pointers to other nodes) */ - bool isleaf; - bool must_free; /**< data_ptr was allocated, must be freed */ - bool data_ptr_used; /**< Whether data_ptr member is used, not data_array */ - bool rec_of; + boolean isleaf; + boolean must_free; /**< data_ptr was allocated, must be freed */ + boolean data_ptr_used; /**< Whether data_ptr member is used, not data_array */ + boolean rec_of; RAW_enc_tree *parent; RAW_enc_tr_pos curr_pos; int length; /**< Encoded length */ @@ -193,7 +193,7 @@ int RAW_encode_enum_type(const TTCN_Typedescriptor_t&, RAW_enc_tree&, int, int); int RAW_decode_enum_type(const TTCN_Typedescriptor_t&, TTCN_Buffer&, int, raw_order_t, int&, - int, bool no_err=false); + int, boolean no_err=FALSE); /// Allocate \p nodes_num pointers RAW_enc_tree** init_nodes_of_enc_tree(int nodes_num); diff --git a/core/RInt.cc b/core/RInt.cc index a81e214e3..47d53a4dd 100644 --- a/core/RInt.cc +++ b/core/RInt.cc @@ -26,7 +26,7 @@ #include <openssl/crypto.h> #include <openssl/bn.h> -int_val_t::int_val_t() : native_flag(true) +int_val_t::int_val_t() : native_flag(TRUE) { val.openssl = NULL; } @@ -44,10 +44,10 @@ int_val_t::int_val_t(const char *s) if (!BN_dec2bn(&n, *s == '+' ? s + 1 : s)) TTCN_error("Unexpected error when converting `%s' to integer", s); if (BN_num_bits(n) > (int)sizeof(int) * 8 - 1) { - native_flag = false; + native_flag = FALSE; val.openssl = n; } else { - native_flag = true; + native_flag = TRUE; val.native = string2RInt(s); BN_free(n); } @@ -89,7 +89,7 @@ char *int_val_t::as_string() const int_val_t& int_val_t::operator=(RInt v) { if (!native_flag) BN_free(val.openssl); - native_flag = true; + native_flag = TRUE; val.native = v; return *this; } @@ -119,7 +119,7 @@ int_val_t& int_val_t::operator<<=(RInt right) BN_lshift(result, result, right); if (BN_num_bits(result) > (int)sizeof(int) * 8 - 1) { val.openssl = result; - native_flag = false; + native_flag = FALSE; } else { val.native <<= right; BN_free(result); @@ -143,7 +143,7 @@ int_val_t& int_val_t::operator>>=(RInt right) char *result_str = BN_bn2dec(val.openssl); RInt result_i = string2RInt(result_str); OPENSSL_free(result_str); - native_flag = true; + native_flag = TRUE; BN_free(val.openssl); val.native = result_i; } @@ -156,7 +156,7 @@ int_val_t& int_val_t::operator+=(RInt right) // Unfortunately we have to check the sign of the "right" operand and // perform addition or subtraction accordingly. if (right == 0) return *this; - bool neg = right < 0; + boolean neg = right < 0; if (native_flag) { BIGNUM *result = BN_new(); BN_set_word(result, (BN_ULONG)val.native); @@ -164,7 +164,7 @@ int_val_t& int_val_t::operator+=(RInt right) else BN_add_word(result, (BN_ULONG)right); if (BN_num_bits(result) > (int)sizeof(int) * 8 - 1) { val.openssl = result; - native_flag = false; + native_flag = FALSE; } else { val.native += right; BN_free(result); @@ -177,13 +177,13 @@ int_val_t& int_val_t::operator+=(RInt right) if (BN_is_negative(val.openssl)) tmp *= -1; BN_free(val.openssl); val.native = tmp; - native_flag = true; + native_flag = TRUE; } } return *this; } -bool int_val_t::operator==(const int_val_t& right) const +boolean int_val_t::operator==(const int_val_t& right) const { if (native_flag) { if (right.is_native()) { @@ -206,7 +206,7 @@ bool int_val_t::operator==(const int_val_t& right) const } } -bool int_val_t::operator<(const int_val_t& v) const +boolean int_val_t::operator<(const int_val_t& v) const { if (native_flag) { if (v.is_native()) { @@ -247,7 +247,7 @@ int_val_t int_val_t::operator&(RInt right) const // Cannot be inline since bignum_st is just a forward declaration in the // header. The compiler must know bignum_st at this point. -bool int_val_t::is_negative() const +boolean int_val_t::is_negative() const { return (native_flag && val.native < 0) || (!native_flag && BN_is_negative(val.openssl)); diff --git a/core/RInt.hh b/core/RInt.hh index bbd0e3132..7f35be0bc 100644 --- a/core/RInt.hh +++ b/core/RInt.hh @@ -14,6 +14,8 @@ #ifndef RInt_HH #define RInt_HH +#include "Types.h" + struct bignum_st; typedef bignum_st BIGNUM; @@ -25,7 +27,7 @@ private: friend class INTEGER; friend class INTEGER_template; - bool native_flag; + boolean native_flag; union { RInt native; BIGNUM *openssl; @@ -35,8 +37,8 @@ public: int_val_t(); int_val_t(const int_val_t& v); explicit int_val_t(const char *s); - explicit int_val_t(RInt v) : native_flag(true) { val.native = v; } - explicit int_val_t(BIGNUM *v) : native_flag(false) { val.openssl = v; } + explicit int_val_t(RInt v) : native_flag(TRUE) { val.native = v; } + explicit int_val_t(BIGNUM *v) : native_flag(FALSE) { val.openssl = v; } ~int_val_t(); /** Returns a newly allocated string. Caller must call Free() */ char *as_string() const; @@ -44,27 +46,27 @@ public: BIGNUM *get_val_openssl() const; double to_real() const; int_val_t operator&(RInt right) const; - bool operator==(const int_val_t& right) const; - bool operator<(const int_val_t& right) const; + boolean operator==(const int_val_t& right) const; + boolean operator<(const int_val_t& right) const; - inline bool operator!=(const int_val_t& right) const { return !(*this == right); } - inline bool operator>(const int_val_t& right) const { return *this != right && !(*this < right); } - inline bool operator>=(const int_val_t& right) const { return *this == right || *this > right; } - inline bool operator<=(const int_val_t& right) const { return *this == right || *this < right; } - inline bool operator==(RInt right) const { return *this == int_val_t(right); } - inline bool operator!=(RInt right) const { return !(*this == right); } - inline bool operator>(RInt right) const { return *this != right && !(*this < right); } - inline bool operator<(RInt right) const { return *this != right && *this < int_val_t(right); } - inline bool operator<=(RInt right) const { return *this == right || *this < right; } - inline bool operator>=(RInt right) const { return *this == right || *this > right; } + inline boolean operator!=(const int_val_t& right) const { return !(*this == right); } + inline boolean operator>(const int_val_t& right) const { return *this != right && !(*this < right); } + inline boolean operator>=(const int_val_t& right) const { return *this == right || *this > right; } + inline boolean operator<=(const int_val_t& right) const { return *this == right || *this < right; } + inline boolean operator==(RInt right) const { return *this == int_val_t(right); } + inline boolean operator!=(RInt right) const { return !(*this == right); } + inline boolean operator>(RInt right) const { return *this != right && !(*this < right); } + inline boolean operator<(RInt right) const { return *this != right && *this < int_val_t(right); } + inline boolean operator<=(RInt right) const { return *this == right || *this < right; } + inline boolean operator>=(RInt right) const { return *this == right || *this > right; } int_val_t& operator=(const int_val_t& right); int_val_t& operator=(RInt right); int_val_t& operator+=(RInt right); int_val_t& operator<<=(RInt right); int_val_t& operator>>=(RInt right); - inline bool is_native() const { return native_flag; } - bool is_negative() const; + inline boolean is_native() const { return native_flag; } + boolean is_negative() const; }; BIGNUM *to_openssl(RInt other_value); diff --git a/core/Runtime.cc b/core/Runtime.cc index 19b053b7e..0858c450a 100644 --- a/core/Runtime.cc +++ b/core/Runtime.cc @@ -555,7 +555,7 @@ int TTCN_Runtime::ptc_main() try { TTCN_Communication::send_killed(local_verdict, (const char *)verdict_reason); } catch (const TC_Error& tc_error) { } - TTCN_Logger::log_final_verdict(true, local_verdict, local_verdict, + TTCN_Logger::log_final_verdict(TRUE, local_verdict, local_verdict, local_verdict, (const char *)verdict_reason); executor_state = PTC_EXIT; } @@ -755,7 +755,7 @@ void TTCN_Runtime::start_function(const char *module_name, terminate_component_type(); // send a STOPPED_KILLED message without return value TTCN_Communication::send_stopped_killed(local_verdict, verdict_reason); - TTCN_Logger::log_final_verdict(true, local_verdict, local_verdict, + TTCN_Logger::log_final_verdict(TRUE, local_verdict, local_verdict, local_verdict, (const char *)verdict_reason); } @@ -797,7 +797,7 @@ void TTCN_Runtime::send_function_finished(Text_Buf& text_buf) // log the final verdict if necessary and update the state variable if (is_alive) executor_state = PTC_STOPPED; else { - TTCN_Logger::log_final_verdict(true, local_verdict, local_verdict, + TTCN_Logger::log_final_verdict(TRUE, local_verdict, local_verdict, local_verdict, (const char *)verdict_reason); executor_state = PTC_EXIT; } @@ -2319,7 +2319,7 @@ void TTCN_Runtime::process_create_mtc() } // clean Emergency log buffer before fork, to avoid duplication - TTCN_Logger::ring_buffer_dump(false); + TTCN_Logger::ring_buffer_dump(FALSE); pid_t mtc_pid = fork(); if (mtc_pid < 0) { @@ -2366,7 +2366,7 @@ void TTCN_Runtime::process_create_ptc(component component_reference, } // clean Emergency log buffer before fork, to avoid duplication - TTCN_Logger::ring_buffer_dump(false); + TTCN_Logger::ring_buffer_dump(FALSE); pid_t ptc_pid = fork(); if (ptc_pid < 0) { @@ -2497,7 +2497,7 @@ void TTCN_Runtime::process_ptc_verdict(Text_Buf& text_buf) if (executor_state != MTC_TERMINATING_TESTCASE) TTCN_error("Internal error: Message PTC_VERDICT arrived in invalid state."); - TTCN_Logger::log_final_verdict(false, local_verdict, local_verdict, + TTCN_Logger::log_final_verdict(FALSE, local_verdict, local_verdict, local_verdict, (const char *)verdict_reason, TitanLoggerApi::FinalVerdictType_choice_notification::setting__final__verdict__of__the__test__case); TTCN_Logger::log_final_verdict(false, local_verdict, local_verdict, @@ -2526,7 +2526,7 @@ void TTCN_Runtime::process_ptc_verdict(Text_Buf& text_buf) local_verdict = new_verdict; } } else { - TTCN_Logger::log_final_verdict(false, local_verdict, local_verdict, + TTCN_Logger::log_final_verdict(FALSE, local_verdict, local_verdict, local_verdict, (const char *)verdict_reason, TitanLoggerApi::FinalVerdictType_choice_notification::no__ptcs__were__created); } diff --git a/core/Snapshot.cc b/core/Snapshot.cc index 3bf4584c2..7cf570f38 100644 --- a/core/Snapshot.cc +++ b/core/Snapshot.cc @@ -58,7 +58,7 @@ FdMap::Data * FdMap::items2; #ifndef USE_EPOLL pollfd FdMap::pollFds1[ITEM1_CAPACITY]; pollfd * FdMap::pollFds2; -bool FdMap::needUpdate; +boolean FdMap::needUpdate; int FdMap::nPollFdsFrozen; #endif #ifdef USE_EPOLL @@ -260,7 +260,7 @@ fd_event_type_enum FdMap::remove(int fd, const Fd_Event_Handler * handler, items1[nItems].init(); // not necessary - for debugging } else { // The item is frozen; removal is postponed. items1[i].d.hnd = 0; - needUpdate = true; + needUpdate = TRUE; } } #endif @@ -324,7 +324,7 @@ fd_event_type_enum FdMap::remove(int fd, const Fd_Event_Handler * handler, } } else { // The item is frozen; removal is postponed. items2[fd].hnd = 0; - needUpdate = true; + needUpdate = TRUE; } } #endif @@ -363,7 +363,7 @@ void FdMap::copyItems2ToItems1() int i = 0; for (int m = n - 1; m != 0; ++i) m >>= 1; Item * d, itemsTmp[ITEM1_CAPACITY_LOW]; - bool f = (i & 1) != 0; + boolean f = (i & 1) != 0; d = (i == 0 || f) ? items1 : itemsTmp; for (int j = 0, k = nItems - 1; j < k; j += 2) { pollFds1[j] = pollFds2[j]; pollFds1[j + 1] = pollFds2[j + 1]; @@ -409,18 +409,18 @@ void FdMap::copyItems2ToItems1() #endif #ifdef USE_EPOLL -bool FdMap::epollMarkFds(int nEvents) +boolean FdMap::epollMarkFds(int nEvents) { - bool all_valid = true; + boolean all_valid = TRUE; for (int i = 0; i < nEvents; ++i) { int fd = epollEvents[i].data.fd; if (items2 == 0) { int j = findInItems1(fd); if (j >= 0) items1[j].d.ixE = i; - else all_valid = false; + else all_valid = FALSE; } else { if (findInItems2(fd)) items2[fd].ixE = i; - else all_valid = false; + else all_valid = FALSE; } } return all_valid; @@ -458,7 +458,7 @@ void FdMap::pollUnfreeze() // item at index i is changed and has to be checked if exists } else ++i; } - needUpdate = false; + needUpdate = FALSE; } fd_event_type_enum FdMap::getPollREvent(int fd) @@ -563,7 +563,7 @@ Handler_List Fd_And_Timeout_User::timedList, FdSets * Fd_And_Timeout_User::fdSetsReceived; FdSets * Fd_And_Timeout_User::fdSetsToHnds; int Fd_And_Timeout_User::nOldHandlers; -bool Fd_And_Timeout_User::is_in_call_handlers; +boolean Fd_And_Timeout_User::is_in_call_handlers; int Fd_And_Timeout_User::curRcvdEvtIx; inline void Fd_And_Timeout_User::checkFd(int fd) @@ -812,10 +812,10 @@ void Fd_And_Timeout_User::remove_all_fds(Fd_And_Timeout_Event_Handler * handler) } } -bool Fd_And_Timeout_User::getTimeout(double * timeout) +boolean Fd_And_Timeout_User::getTimeout(double * timeout) { timedList.first(); - if (timedList.finished()) return false; + if (timedList.finished()) return FALSE; Fd_And_Timeout_Event_Handler * handler = timedList.current(); double earliestTimeout = handler->last_called + handler->callInterval; @@ -828,13 +828,13 @@ bool Fd_And_Timeout_User::getTimeout(double * timeout) if (nextCall < earliestTimeout) earliestTimeout = nextCall; } *timeout = earliestTimeout; - return true; + return TRUE; } void Fd_And_Timeout_User::call_handlers(int nEvents) { try { // To keep consistency in case of exceptions - is_in_call_handlers = true; + is_in_call_handlers = TRUE; if (nOldHandlers != 0) { fdSetsReceived->clear(); } if (nEvents > 0) { // Note: FdMap may be modified during event handler calls @@ -927,7 +927,7 @@ void Fd_And_Timeout_User::call_handlers(int nEvents) if (handler->getIsOldApi()) handler->hasEvent = fdSetsToHnds->setAnd(*fdSetsReceived, *handler->fdSets); - bool callHandler = (handler->hasEvent && handler->isTimeout) ? + boolean callHandler = (handler->hasEvent && handler->isTimeout) ? handler->callAnyway : current_time > (handler->last_called + handler->callInterval); if ( !handler->isPeriodic && @@ -948,8 +948,8 @@ void Fd_And_Timeout_User::call_handlers(int nEvents) current_time = TTCN_Snapshot::time_now(); } } - is_in_call_handlers = false; - } catch (...) { oldApiCallList.clear(); is_in_call_handlers = false; throw; } + is_in_call_handlers = FALSE; + } catch (...) { oldApiCallList.clear(); is_in_call_handlers = FALSE; throw; } } int Fd_And_Timeout_User::receiveEvents(int pollTimeout) @@ -1066,12 +1066,12 @@ void TTCN_Snapshot::take_new(boolean block_execution) // determine the timeout value for epoll()/poll()/select() double timeout = 0.0; int pollTimeout = 0; // timeout for poll/epoll - bool handleTimer = false; + boolean handleTimer = FALSE; if (block_execution) { // find the earliest timeout double timer_timeout, handler_timeout = 0.0; boolean is_timer_timeout = TIMER::get_min_expiration(timer_timeout); - bool is_handler_timeout = + boolean is_handler_timeout = Fd_And_Timeout_User::getTimeout(&handler_timeout); if (is_timer_timeout) { if (is_handler_timeout && handler_timeout < timer_timeout) @@ -1087,7 +1087,7 @@ void TTCN_Snapshot::take_new(boolean block_execution) // filling up tv with appropriate values if (block_time < (double)MAX_BLOCK_TIME) { pollTimeout = static_cast<int>(floor(block_time*1000)); - handleTimer = true; + handleTimer = TRUE; } else { // issue a warning: the user probably does not want such // long waiting @@ -1101,12 +1101,12 @@ void TTCN_Snapshot::take_new(boolean block_execution) // immediately from the while() loop below timeout = current_time + (double)MAX_BLOCK_TIME; pollTimeout = MAX_BLOCK_TIME * 1000; - handleTimer = true; + handleTimer = TRUE; } } else { // first timer is already expired: do not block // pollTimeout is 0 - handleTimer = true; + handleTimer = TRUE; } } else { // no active timers: infinite timeout @@ -1195,22 +1195,22 @@ void TTCN_Snapshot::block_for_sending(int send_fd, Fd_Event_Handler * handler) for ( ; ; ) { int ret_val = Fd_And_Timeout_User::receiveEvents(-1); // epoll / poll if (ret_val >= 0) { - bool writable = false; - bool readable = false; + boolean writable = FALSE; + boolean readable = FALSE; #ifdef USE_EPOLL for (int i = 0; i < ret_val; ++i) { if (FdMap::epollEvents[i].data.fd == send_fd) { - readable = true; + readable = TRUE; if ((FdMap::epollEvents[i].events & EPOLLOUT) != 0){ - writable = true; + writable = TRUE; } break; } } #else - if (FdMap::getPollREvent(send_fd) != 0) {readable = true;} - if ((FdMap::getPollREvent(send_fd) & FD_EVENT_WR) != 0) {writable = true;} + if (FdMap::getPollREvent(send_fd) != 0) {readable = TRUE;} + if ((FdMap::getPollREvent(send_fd) & FD_EVENT_WR) != 0) {writable = TRUE;} #endif if (writable) break; Fd_And_Timeout_User::call_handlers(ret_val); diff --git a/core/Struct_of.cc b/core/Struct_of.cc index 7bdd11c2f..3708b9f8a 100644 --- a/core/Struct_of.cc +++ b/core/Struct_of.cc @@ -1305,7 +1305,7 @@ void log_match_heuristics(const Base_Type *value_ptr, int value_size, boolean value_found = FALSE; int nof_unmatched_values = 0; - bool *unmatched_values = new bool[value_size]; + boolean *unmatched_values = new bool[value_size]; for (int i = 0; i < value_size; i++) { boolean pair_found = FALSE; @@ -1342,7 +1342,7 @@ void log_match_heuristics(const Base_Type *value_ptr, int value_size, boolean template_found = FALSE; int nof_unmatched_templates = 0; - bool *unmatched_templates = new bool[template_size]; + boolean *unmatched_templates = new bool[template_size]; for (int i = 0; i < template_size; i++) { boolean pair_found = FALSE; diff --git a/core/Template.cc b/core/Template.cc index 181bf3681..0558becd0 100644 --- a/core/Template.cc +++ b/core/Template.cc @@ -2889,13 +2889,13 @@ void Record_Template::set_param(Module_Param& param) set_specific(); for (size_t i=0; i<mp->get_size(); ++i) { Module_Param* const current = mp->get_elem(i); - bool found = false; + boolean found = FALSE; for (int j=0; j<single_value.n_elements; ++j) { if (!strcmp(fld_name(j), current->get_id()->get_name())) { if (current->get_type()!=Module_Param::MP_NotUsed) { get_at(j)->set_param(*current); } - found = true; + found = TRUE; break; } } diff --git a/core/TitanLoggerControlImpl.cc b/core/TitanLoggerControlImpl.cc index 67f34173d..b96536b14 100644 --- a/core/TitanLoggerControlImpl.cc +++ b/core/TitanLoggerControlImpl.cc @@ -32,7 +32,7 @@ void set__log__file(CHARSTRING const& plugin, CHARSTRING const& filename) { validate_plugin_name(plugin); - TTCN_Logger::set_file_name(filename, false); + TTCN_Logger::set_file_name(filename, FALSE); TTCN_Logger::open_file(); } @@ -154,7 +154,7 @@ void remove__from__console__mask(CHARSTRING const& plugin, Severities const& mas for (int B = mask.size_of() - 1; B >= 0; B--) { TTCN_Logger::Severity sev = static_cast<TTCN_Logger::Severity>((int)mask[B]); if (sev > 0 && sev < TTCN_Logger::NUMBER_OF_LOGSEVERITIES) { - lb.bits[sev] = false; + lb.bits[sev] = FALSE; } } component_id_t cmpt_id = { COMPONENT_ID_COMPREF, { self } }; @@ -169,7 +169,7 @@ void remove__from__file__mask(CHARSTRING const& plugin, Severities const& mask) for (int B = mask.size_of() - 1; B >= 0; B--) { TTCN_Logger::Severity sev = static_cast<TTCN_Logger::Severity>((int)mask[B]); if (sev > 0 && sev < TTCN_Logger::NUMBER_OF_LOGSEVERITIES) { - lb.bits[sev] = false; + lb.bits[sev] = FALSE; } } component_id_t cmpt_id = { COMPONENT_ID_COMPREF, { self } }; diff --git a/core/Universal_charstring.cc b/core/Universal_charstring.cc index 141c5b297..eefcb9190 100644 --- a/core/Universal_charstring.cc +++ b/core/Universal_charstring.cc @@ -137,7 +137,7 @@ void UNIVERSAL_CHARSTRING::clean_up() cstr.clean_up(); } -UNIVERSAL_CHARSTRING::UNIVERSAL_CHARSTRING(int n_uchars, bool cstring) +UNIVERSAL_CHARSTRING::UNIVERSAL_CHARSTRING(int n_uchars, boolean cstring) : val_ptr(NULL), cstr(cstring ? n_uchars : 0), charstring(cstring) { if (!charstring) @@ -145,12 +145,12 @@ UNIVERSAL_CHARSTRING::UNIVERSAL_CHARSTRING(int n_uchars, bool cstring) } UNIVERSAL_CHARSTRING::UNIVERSAL_CHARSTRING() -: val_ptr(NULL), cstr(0), charstring(false) +: val_ptr(NULL), cstr(0), charstring(FALSE) {} UNIVERSAL_CHARSTRING::UNIVERSAL_CHARSTRING(unsigned char uc_group, unsigned char uc_plane, unsigned char uc_row, unsigned char uc_cell) -: charstring(false) +: charstring(FALSE) { init_struct(1); val_ptr->uchars_ptr[0].uc_group = uc_group; @@ -161,7 +161,7 @@ UNIVERSAL_CHARSTRING::UNIVERSAL_CHARSTRING(unsigned char uc_group, UNIVERSAL_CHARSTRING::UNIVERSAL_CHARSTRING (const universal_char& other_value) -: cstr(0), charstring(false) +: cstr(0), charstring(FALSE) { init_struct(1); val_ptr->uchars_ptr[0] = other_value; @@ -169,31 +169,31 @@ UNIVERSAL_CHARSTRING::UNIVERSAL_CHARSTRING UNIVERSAL_CHARSTRING::UNIVERSAL_CHARSTRING(int n_uchars, const universal_char *uchars_ptr) -: cstr(0), charstring(false) +: cstr(0), charstring(FALSE) { init_struct(n_uchars); memcpy(val_ptr->uchars_ptr, uchars_ptr, n_uchars * sizeof(universal_char)); } UNIVERSAL_CHARSTRING::UNIVERSAL_CHARSTRING(const char *chars_ptr) -: val_ptr(NULL), cstr(chars_ptr), charstring(true) +: val_ptr(NULL), cstr(chars_ptr), charstring(TRUE) { } UNIVERSAL_CHARSTRING::UNIVERSAL_CHARSTRING(int n_chars, const char *chars_ptr) -: val_ptr(NULL), cstr(n_chars, chars_ptr), charstring(true) +: val_ptr(NULL), cstr(n_chars, chars_ptr), charstring(TRUE) { } UNIVERSAL_CHARSTRING::UNIVERSAL_CHARSTRING(const CHARSTRING& other_value) -: val_ptr(NULL), cstr(other_value), charstring(true) +: val_ptr(NULL), cstr(other_value), charstring(TRUE) { } UNIVERSAL_CHARSTRING::UNIVERSAL_CHARSTRING (const CHARSTRING_ELEMENT& other_value) -: val_ptr(NULL), cstr(other_value), charstring(true) +: val_ptr(NULL), cstr(other_value), charstring(TRUE) { } @@ -239,9 +239,9 @@ UNIVERSAL_CHARSTRING& UNIVERSAL_CHARSTRING::operator= clean_up(); if (other_value.is_char()) { cstr = CHARSTRING(other_value.uc_cell); - charstring = true; + charstring = TRUE; } else { - charstring = false; + charstring = FALSE; init_struct(1); val_ptr->uchars_ptr[0] = other_value; cstr.init_struct(0); @@ -254,7 +254,7 @@ UNIVERSAL_CHARSTRING& UNIVERSAL_CHARSTRING::operator= { if (!charstring) { clean_up(); - charstring = true; + charstring = TRUE; } cstr = other_value; return *this; @@ -265,7 +265,7 @@ UNIVERSAL_CHARSTRING& UNIVERSAL_CHARSTRING::operator= { if (!charstring) { clean_up(); - charstring = true; + charstring = TRUE; } cstr = other_value; return *this; @@ -276,7 +276,7 @@ UNIVERSAL_CHARSTRING& UNIVERSAL_CHARSTRING::operator= { if (!charstring) { clean_up(); - charstring = true; + charstring = TRUE; } cstr = other_value; return *this; @@ -311,13 +311,13 @@ UNIVERSAL_CHARSTRING& UNIVERSAL_CHARSTRING::operator= char c = other_value.str_val.cstr.val_ptr->chars_ptr[other_value.uchar_pos]; clean_up(); cstr = CHARSTRING(c); - charstring = true; + charstring = TRUE; } else { universal_char uchar_value = other_value.get_uchar(); clean_up(); init_struct(1); val_ptr->uchars_ptr[0] = uchar_value; - charstring = false; + charstring = FALSE; } return *this; } @@ -432,7 +432,7 @@ UNIVERSAL_CHARSTRING UNIVERSAL_CHARSTRING::operator+ "charstring value."); if (charstring) { if (other_value.is_char()) { - UNIVERSAL_CHARSTRING ret_val(cstr.lengthof() + 1, true); + UNIVERSAL_CHARSTRING ret_val(cstr.lengthof() + 1, TRUE); memcpy(ret_val.cstr.val_ptr->chars_ptr, cstr.val_ptr->chars_ptr, cstr.val_ptr->n_chars); ret_val.cstr.val_ptr->chars_ptr[cstr.val_ptr->n_chars] = @@ -466,7 +466,7 @@ UNIVERSAL_CHARSTRING UNIVERSAL_CHARSTRING::operator+ else other_len = strlen(other_value); if (other_len == 0) return *this; if (charstring) { - UNIVERSAL_CHARSTRING ret_val(cstr.lengthof() + other_len, true); + UNIVERSAL_CHARSTRING ret_val(cstr.lengthof() + other_len, TRUE); memcpy(ret_val.cstr.val_ptr->chars_ptr, cstr.val_ptr->chars_ptr, cstr.val_ptr->n_chars); memcpy(ret_val.cstr.val_ptr->chars_ptr + cstr.val_ptr->n_chars, @@ -495,7 +495,7 @@ UNIVERSAL_CHARSTRING UNIVERSAL_CHARSTRING::operator+ if (other_value.val_ptr->n_chars == 0) return *this; if (charstring) { UNIVERSAL_CHARSTRING ret_val(cstr.lengthof() + other_value.val_ptr->n_chars, - true); + TRUE); memcpy(ret_val.cstr.val_ptr->chars_ptr, cstr.val_ptr->chars_ptr, cstr.val_ptr->n_chars); memcpy(ret_val.cstr.val_ptr->chars_ptr + cstr.val_ptr->n_chars, @@ -524,7 +524,7 @@ UNIVERSAL_CHARSTRING UNIVERSAL_CHARSTRING::operator+ other_value.must_bound("The right operand of concatenation is an unbound " "charstring element."); if (charstring) { - UNIVERSAL_CHARSTRING ret_val(cstr.lengthof() + 1, true); + UNIVERSAL_CHARSTRING ret_val(cstr.lengthof() + 1, TRUE); memcpy(ret_val.cstr.val_ptr->chars_ptr, cstr.val_ptr->chars_ptr, cstr.val_ptr->n_chars); ret_val.cstr.val_ptr->chars_ptr[cstr.val_ptr->n_chars] = @@ -556,7 +556,7 @@ UNIVERSAL_CHARSTRING UNIVERSAL_CHARSTRING::operator+ if (other_value.cstr.val_ptr->n_chars == 0) return *this; UNIVERSAL_CHARSTRING ret_val(cstr.val_ptr->n_chars + - other_value.cstr.val_ptr->n_chars, true); + other_value.cstr.val_ptr->n_chars, TRUE); memcpy(ret_val.cstr.val_ptr->chars_ptr, cstr.val_ptr->chars_ptr, cstr.val_ptr->n_chars); memcpy(ret_val.cstr.val_ptr->chars_ptr + cstr.val_ptr->n_chars, @@ -610,10 +610,10 @@ UNIVERSAL_CHARSTRING UNIVERSAL_CHARSTRING::operator+ "charstring value."); other_value.must_bound("The right operand of concatenation is an unbound " "universal charstring element."); - bool other_ischar = other_value.str_val.charstring; + boolean other_ischar = other_value.str_val.charstring; if (charstring) { if (other_ischar) { - UNIVERSAL_CHARSTRING ret_val(cstr.val_ptr->n_chars + 1, true); + UNIVERSAL_CHARSTRING ret_val(cstr.val_ptr->n_chars + 1, TRUE); memcpy(ret_val.cstr.val_ptr->chars_ptr, cstr.val_ptr->chars_ptr, cstr.val_ptr->n_chars); ret_val.cstr.val_ptr->chars_ptr[cstr.val_ptr->n_chars] = @@ -874,7 +874,7 @@ void UNIVERSAL_CHARSTRING::convert_cstr_to_uni() { val_ptr->uchars_ptr[i].uc_row = 0; val_ptr->uchars_ptr[i].uc_cell = cstr.val_ptr->chars_ptr[i]; } - charstring = false; + charstring = FALSE; cstr.clean_up(); cstr.init_struct(0); } @@ -1082,7 +1082,7 @@ void UNIVERSAL_CHARSTRING::decode_text(Text_Buf& text_buf) if (n_uchars < 0) TTCN_error("Text decoder: Negative length was received " "for a universal charstring."); clean_up(); - charstring = false; + charstring = FALSE; init_struct(n_uchars); for (int i = 0; i < n_uchars; i++) { unsigned char buf[4]; @@ -1228,7 +1228,7 @@ void UNIVERSAL_CHARSTRING::decode(const TTCN_Typedescriptor_t& p_td, TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); - if(JSON_decode(p_td, tok, false)<0) + if(JSON_decode(p_td, tok, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG, "Can not decode type '%s', because invalid or incomplete" " message was received" @@ -1485,7 +1485,7 @@ int UNIVERSAL_CHARSTRING::TEXT_encode(const TTCN_Typedescriptor_t& p_td, return encoded_length; } -void UNIVERSAL_CHARSTRING::encode_utf8(TTCN_Buffer& buf, bool addBOM /*= false*/) const +void UNIVERSAL_CHARSTRING::encode_utf8(TTCN_Buffer& buf, boolean addBOM /*= false*/) const { // Add BOM if (addBOM) { @@ -1554,14 +1554,14 @@ void UNIVERSAL_CHARSTRING::encode_utf16(TTCN_Buffer& buf, CharCoding::CharCodingType expected_coding) const { // add BOM - bool isbig = true; + boolean isbig = TRUE; switch (expected_coding) { case CharCoding::UTF16: case CharCoding::UTF16BE: - isbig = true; + isbig = TRUE; break; case CharCoding::UTF16LE: - isbig = false; + isbig = FALSE; break; default: TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_DEC_UCSTR, @@ -1634,14 +1634,14 @@ void UNIVERSAL_CHARSTRING::encode_utf16(TTCN_Buffer& buf, void UNIVERSAL_CHARSTRING::encode_utf32(TTCN_Buffer& buf, CharCoding::CharCodingType expected_coding) const { - bool isbig = true; + boolean isbig = TRUE; switch (expected_coding) { case CharCoding::UTF32: case CharCoding::UTF32BE: - isbig = true; + isbig = TRUE; break; case CharCoding::UTF32LE: - isbig = false; + isbig = FALSE; break; default: TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_DEC_UCSTR, @@ -1715,7 +1715,7 @@ boolean UNIVERSAL_CHARSTRING::BER_decode_TLV unsigned L_form) { clean_up(); - charstring = false; + charstring = FALSE; TTCN_EncDec_ErrorContext ec("While decoding universal charstring type: "); OCTETSTRING ostr; if(!ostr.BER_decode_TLV(p_td, p_tlv, L_form)) return FALSE; @@ -1789,7 +1789,7 @@ int UNIVERSAL_CHARSTRING::XER_encode(const XERdescriptor_t& p_td, int exer = is_exer(flavor |= SIMPLE_TYPE); // SIMPLE_TYPE has no influence on is_exer, we set it for later int encoded_length=(int)p_buf.get_len(); - bool do_empty_element = val_ptr==NULL || val_ptr->n_uchars == 0; + boolean do_empty_element = val_ptr==NULL || val_ptr->n_uchars == 0; flavor &= ~XER_RECOF; // universal charstring doesn't care if (exer && (p_td.xer_bits & ANY_ELEMENT)) { @@ -2117,7 +2117,7 @@ int UNIVERSAL_CHARSTRING::XER_decode(const XERdescriptor_t& p_td, { int exer = is_exer(flavor); int success = reader.Ok(), depth = -1; - bool omit_tag = exer + boolean omit_tag = exer && ((p_td.xer_bits & UNTAGGED) || (flavor & (EMBED_VALUES|XER_LIST|USE_TYPE_ATTR|ANY_ATTRIBUTES|USE_NIL))); @@ -2129,7 +2129,7 @@ int UNIVERSAL_CHARSTRING::XER_decode(const XERdescriptor_t& p_td, xmlChar * value = reader.ReadOuterXml(); size_t num_chars = strlen((const char*)value); clean_up(); - charstring = false; + charstring = FALSE; decode_utf8(num_chars, value); // does init_struct xmlFree(value); @@ -2155,7 +2155,7 @@ int UNIVERSAL_CHARSTRING::XER_decode(const XERdescriptor_t& p_td, } else { // not ANY-ELEMENT clean_up(); // start with a clean slate - charstring = false; + charstring = FALSE; if (exer && (p_td.xer_bits & XER_ATTRIBUTE)) { // we have it easy (but does decode_utf8 handle &nnn; ?) const char * name = verify_name(reader, p_td, exer); @@ -2370,10 +2370,10 @@ int UNIVERSAL_CHARSTRING::RAW_decode(const TTCN_Typedescriptor_t& p_td, CHARSTRING buff_str; int dec_len = buff_str.RAW_decode(p_td, buff, limit, top_bit_ord, no_err); if (buff_str.is_bound()) { - charstring = true; + charstring = TRUE; for (int i = 0; i < buff_str.val_ptr->n_chars; ++i) { if (buff_str.val_ptr->chars_ptr[i] < 0) { - charstring = false; + charstring = FALSE; break; } } @@ -2417,7 +2417,7 @@ boolean UNIVERSAL_CHARSTRING::from_JSON_string(boolean check_quotes) end = json_len - 1; if (!json_str[0].is_char() || json_str[0].uc_cell != '\"' || !json_str[json_len - 1].is_char() || json_str[json_len - 1].uc_cell != '\"') { - return false; + return FALSE; } } @@ -2425,12 +2425,12 @@ boolean UNIVERSAL_CHARSTRING::from_JSON_string(boolean check_quotes) universal_char* ustr = (universal_char*)Malloc((json_len - 2) * sizeof(universal_char)); memset(ustr, 0, sizeof(universal_char) * (json_len - 2)); int ustr_len = 0; - boolean error = false; + boolean error = FALSE; for (int i = start; i < end; ++i) { if (json_str[i].is_char() && '\\' == json_str[i].uc_cell) { if (i == end - 1 || !json_str[i + 1].is_char()) { - error = true; + error = TRUE; break; } switch(json_str[i + 1].uc_cell) { @@ -2474,19 +2474,19 @@ boolean UNIVERSAL_CHARSTRING::from_JSON_string(boolean check_quotes) } else { // error (encountered something other than a hex digit) -> leave the for cycle i = end; - error = true; + error = TRUE; } } else { // error (not enough characters or the 'hex digits' are not even ascii characters) -> leave the for cycle i = end; - error = true; + error = TRUE; } break; } default: // error (invalid escaped character) -> leave the for cycle i = end; - error = true; + error = TRUE; break; } // skip an extra character (the \) @@ -2497,7 +2497,7 @@ boolean UNIVERSAL_CHARSTRING::from_JSON_string(boolean check_quotes) if (check_quotes && i == json_len - 1) { // Special case: the last 2 characters are double escaped quotes ('\\' and '\"') - error = true; + error = TRUE; } } @@ -2551,10 +2551,10 @@ int UNIVERSAL_CHARSTRING::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_To } else if (JSON_TOKEN_STRING == token || use_default) { if (cstr.from_JSON_string(value, value_len, !use_default)) { - charstring = true; + charstring = TRUE; } else { - charstring = false; + charstring = FALSE; decode_utf8(value_len, (unsigned char*)value); if (!from_JSON_string(!use_default)) { JSON_ERROR(TTCN_EncDec::ET_INVAL_MSG, JSON_DEC_FORMAT_ERROR, "string", "universal charstring"); @@ -2609,7 +2609,7 @@ static void fill_continuing_octets(int n_continuing, void UNIVERSAL_CHARSTRING::decode_utf8(int n_octets, const unsigned char *octets_ptr, CharCoding::CharCodingType /*expected_coding*/ /*= UTF8*/, - bool checkBOM /*= false)*/) + boolean checkBOM /*= false)*/) { // approximate the number of characters int n_uchars = 0; @@ -2619,7 +2619,7 @@ void UNIVERSAL_CHARSTRING::decode_utf8(int n_octets, } // allocate enough memory, start from clean state clean_up(); - charstring=false; + charstring=FALSE; init_struct(n_uchars); n_uchars = 0; @@ -2772,14 +2772,14 @@ void UNIVERSAL_CHARSTRING::decode_utf16(int n_octets, int n_uchars = n_octets/2; init_struct(n_uchars); n_uchars = 0; - bool isbig = true; + boolean isbig = TRUE; switch (expected_coding) { case CharCoding::UTF16: case CharCoding::UTF16BE: - isbig = true; + isbig = TRUE; break; case CharCoding::UTF16LE: - isbig = false; + isbig = FALSE; break; default: TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_DEC_UCSTR, @@ -2860,14 +2860,14 @@ void UNIVERSAL_CHARSTRING::decode_utf32(int n_octets, const unsigned char *octet int n_uchars = n_octets/4; init_struct(n_uchars); n_uchars = 0; - bool isbig = true; + boolean isbig = TRUE; switch (expected_coding) { case CharCoding::UTF32: case CharCoding::UTF32BE: - isbig = true; + isbig = TRUE; break; case CharCoding::UTF32LE: - isbig = false; + isbig = FALSE; break; default: TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_DEC_UCSTR, @@ -3280,7 +3280,7 @@ UNIVERSAL_CHARSTRING UNIVERSAL_CHARSTRING_ELEMENT::operator+ must_bound("The left operand of concatenation is an unbound universal " "charstring element."); if (str_val.charstring && other_value.is_char()) { - UNIVERSAL_CHARSTRING ret_val(2, true); + UNIVERSAL_CHARSTRING ret_val(2, TRUE); ret_val.cstr.val_ptr->chars_ptr[0] = str_val.cstr.val_ptr->chars_ptr[uchar_pos]; ret_val.cstr.val_ptr->chars_ptr[1] = other_value.uc_cell; @@ -3362,7 +3362,7 @@ UNIVERSAL_CHARSTRING UNIVERSAL_CHARSTRING_ELEMENT::operator+ other_value.must_bound("The right operand of concatenation is an unbound " "charstring element."); if (str_val.charstring) { - UNIVERSAL_CHARSTRING ret_val(2, true); + UNIVERSAL_CHARSTRING ret_val(2, TRUE); ret_val.cstr.val_ptr->chars_ptr[0] = str_val.cstr.val_ptr->chars_ptr[uchar_pos]; ret_val.cstr.val_ptr->chars_ptr[1] = other_value.get_char(); @@ -3387,7 +3387,7 @@ UNIVERSAL_CHARSTRING UNIVERSAL_CHARSTRING_ELEMENT::operator+ "universal charstring value."); if (str_val.charstring) { if (other_value.charstring) { - UNIVERSAL_CHARSTRING ret_val(other_value.cstr.val_ptr->n_chars + 1, true); + UNIVERSAL_CHARSTRING ret_val(other_value.cstr.val_ptr->n_chars + 1, TRUE); ret_val.cstr.val_ptr->chars_ptr[0] = str_val.cstr.val_ptr->chars_ptr[uchar_pos]; memcpy(ret_val.cstr.val_ptr->chars_ptr + 1, @@ -3433,7 +3433,7 @@ UNIVERSAL_CHARSTRING UNIVERSAL_CHARSTRING_ELEMENT::operator+ "universal charstring element."); if (str_val.charstring) { if (other_value.str_val.charstring) { - UNIVERSAL_CHARSTRING ret_val(2, true); + UNIVERSAL_CHARSTRING ret_val(2, TRUE); ret_val.cstr.val_ptr->chars_ptr[0] = str_val.cstr.val_ptr->chars_ptr[uchar_pos]; ret_val.cstr.val_ptr->chars_ptr[1] = @@ -3527,7 +3527,7 @@ UNIVERSAL_CHARSTRING operator+(const universal_char& uchar_value, "universal charstring value."); if (other_value.charstring) { if (uchar_value.is_char()) { - UNIVERSAL_CHARSTRING ret_val(other_value.cstr.val_ptr->n_chars + 1, true); + UNIVERSAL_CHARSTRING ret_val(other_value.cstr.val_ptr->n_chars + 1, TRUE); ret_val.cstr.val_ptr->chars_ptr[0] = uchar_value.uc_cell; memcpy(ret_val.cstr.val_ptr->chars_ptr + 1, other_value.cstr.val_ptr->chars_ptr, other_value.cstr.val_ptr->n_chars); @@ -3631,7 +3631,7 @@ UNIVERSAL_CHARSTRING operator+(const char *string_value, else string_len = strlen(string_value); if (other_value.charstring) { UNIVERSAL_CHARSTRING ret_val(string_len + other_value.cstr.val_ptr->n_chars, - true); + TRUE); memcpy(ret_val.cstr.val_ptr->chars_ptr, string_value, string_len); memcpy(ret_val.cstr.val_ptr->chars_ptr + string_len, other_value.cstr.val_ptr->chars_ptr, other_value.cstr.val_ptr->n_chars); @@ -3659,7 +3659,7 @@ UNIVERSAL_CHARSTRING operator+(const char *string_value, if (string_value == NULL) string_len = 0; else string_len = strlen(string_value); if (other_value.str_val.charstring) { - UNIVERSAL_CHARSTRING ret_val(string_len + 1, true); + UNIVERSAL_CHARSTRING ret_val(string_len + 1, TRUE); memcpy(ret_val.cstr.val_ptr->chars_ptr, string_value, string_len); ret_val.cstr.val_ptr->chars_ptr[string_len] = other_value.str_val.cstr.val_ptr->chars_ptr[other_value.uchar_pos]; @@ -4125,7 +4125,7 @@ boolean UNIVERSAL_CHARSTRING_template::match TTCN_Buffer buff; switch (dec_match->coding) { case CharCoding::UTF_8: - other_value.encode_utf8(buff, false); + other_value.encode_utf8(buff, FALSE); break; case CharCoding::UTF16: case CharCoding::UTF16LE: diff --git a/core/Universal_charstring.hh b/core/Universal_charstring.hh index 39f026a5c..6a0940694 100644 --- a/core/Universal_charstring.hh +++ b/core/Universal_charstring.hh @@ -105,11 +105,11 @@ class UNIVERSAL_CHARSTRING : public Base_Type { universal_charstring_struct *val_ptr; /** Character string values are stored in an optimal way */ CHARSTRING cstr; - bool charstring; + boolean charstring; void init_struct(int n_uchars); void copy_value(); - UNIVERSAL_CHARSTRING(int n_uchars, bool cstring = false); + UNIVERSAL_CHARSTRING(int n_uchars, boolean cstring = FALSE); /** An extended version of set_param(), which also accepts string patterns if * the second parameter is set (needed by UNIVERSAL_CHARSTRING_template to @@ -372,7 +372,7 @@ public: * (otherwise memory leak will occur) */ void decode_utf8(int n_octets, const unsigned char *octets_ptr, - CharCoding::CharCodingType expected_coding = CharCoding::UTF_8, bool checkBOM = false); + CharCoding::CharCodingType expected_coding = CharCoding::UTF_8, boolean checkBOM = FALSE); void decode_utf16(int n_octets, const unsigned char *octets_ptr, CharCoding::CharCodingType expected_coding); void decode_utf32(int n_octets, const unsigned char *octets_ptr, @@ -381,7 +381,7 @@ public: * * @param[out] buf buffer to receive the encoded result */ - void encode_utf8(TTCN_Buffer& buf, bool addBOM = false) const; + void encode_utf8(TTCN_Buffer& buf, boolean addBOM = FALSE) const; void encode_utf16(TTCN_Buffer& buf, CharCoding::CharCodingType expected_coding) const; void encode_utf32(TTCN_Buffer& buf, CharCoding::CharCodingType expected_coding) const; diff --git a/core/Vector.hh b/core/Vector.hh index d9cd6cb13..aaf44b14e 100644 --- a/core/Vector.hh +++ b/core/Vector.hh @@ -17,6 +17,7 @@ #ifndef TITANVECTOR_H_ #define TITANVECTOR_H_ +#include "Types.h" #include <stddef.h> #ifndef PROF_MERGE @@ -58,7 +59,7 @@ public: size_t size() const { return nof_elem; } void resize(size_t new_size, T element = T()); size_t capacity() const { return cap; } - bool empty() const { return nof_elem == 0; } + boolean empty() const { return nof_elem == 0; } void reserve(size_t n); void shrink_to_fit(); diff --git a/core/Verdicttype.cc b/core/Verdicttype.cc index fdbb3e3d7..592d8c871 100644 --- a/core/Verdicttype.cc +++ b/core/Verdicttype.cc @@ -268,7 +268,7 @@ void VERDICTTYPE::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); - if(JSON_decode(p_td, tok, false)<0) + if(JSON_decode(p_td, tok, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG, "Can not decode type '%s', because invalid or incomplete" " message was received" @@ -289,14 +289,14 @@ int VERDICTTYPE::XER_encode(const XERdescriptor_t& p_td, TTCN_Buffer& p_buf, int encoded_length=(int)p_buf.get_len(); //const boolean e_xer = is_exer(p_flavor); p_flavor |= (SIMPLE_TYPE | BXER_EMPTY_ELEM); - if (begin_xml(p_td, p_buf, p_flavor, p_indent, false) == -1) --encoded_length; + if (begin_xml(p_td, p_buf, p_flavor, p_indent, FALSE) == -1) --encoded_length; //if (!e_xer) p_buf.put_c('<'); { const char * enumval = verdict_name[verdict_value]; p_buf.put_s(strlen(enumval), (const unsigned char*)enumval); } //if (!e_xer) p_buf.put_s(2, (const unsigned char*)"/>"); - end_xml(p_td, p_buf, p_flavor, p_indent, false); + end_xml(p_td, p_buf, p_flavor, p_indent, FALSE); return (int)p_buf.get_len() - encoded_length; } @@ -325,7 +325,7 @@ int VERDICTTYPE::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& p_reader if ((p_td.xer_bits & XER_ATTRIBUTE)) verify_name(p_reader, p_td, e_xer); const char * value = (const char *)p_reader.Value(); if (value) { - verdict_value = str_to_verdict(value, (p_flavor & EXIT_ON_ERROR) ? true : false); + verdict_value = str_to_verdict(value, (p_flavor & EXIT_ON_ERROR) ? TRUE : FALSE); } } else { @@ -350,7 +350,7 @@ int VERDICTTYPE::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& p_reader const char *local_name = /*e_xer ?*/ (const char *)p_reader.Value() /*: (const char *)p_reader.Name()*/; if (!local_name) ; else { for (; '\t'==*local_name || '\n'==*local_name; ++local_name) ; - verdict_value = str_to_verdict(local_name, (p_flavor & EXIT_ON_ERROR) ? true : false); + verdict_value = str_to_verdict(local_name, (p_flavor & EXIT_ON_ERROR) ? TRUE : FALSE); } if (name_tag) for (rd_ok = p_reader.Read(); rd_ok == 1; rd_ok = p_reader.Read()) { @@ -394,7 +394,7 @@ int VERDICTTYPE::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& } else { dec_len = p_tok.get_next_token(&token, &value, &value_len); } - boolean error = true; + boolean error = TRUE; if (JSON_TOKEN_ERROR == token) { JSON_ERROR(TTCN_EncDec::ET_INVAL_MSG, JSON_DEC_BAD_TOKEN_ERROR, ""); dec_len = JSON_ERROR_FATAL; @@ -409,13 +409,13 @@ int VERDICTTYPE::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& for (int i = NONE; i <= ERROR; ++i) { if (0 == strncmp(value, verdict_name[i], value_len)) { verdict_value = (verdicttype)i; - error = false; + error = FALSE; break; } } } } else { - error = false; + error = FALSE; verdict_value = UNBOUND_VERDICT; dec_len = JSON_ERROR_INVALID_TOKEN; } diff --git a/core/Verdicttype.hh b/core/Verdicttype.hh index c979618c1..67f71f064 100644 --- a/core/Verdicttype.hh +++ b/core/Verdicttype.hh @@ -35,7 +35,7 @@ class VERDICTTYPE: public Base_Type { const VERDICTTYPE& other_value); verdicttype verdict_value; - verdicttype str_to_verdict(const char *v, boolean silent = false); + verdicttype str_to_verdict(const char *v, boolean silent = FALSE); public: /** Default constructor. * Initialises \p verdict_value to UNBOUND_VERDICT, a private macro diff --git a/core/XER.cc b/core/XER.cc index 53fd47ab0..e24cf3406 100644 --- a/core/XER.cc +++ b/core/XER.cc @@ -115,7 +115,7 @@ void verify_end(XmlReaderWrap& reader, const XERdescriptor_t& p_td, const int de } // This should be called for EXER only -bool check_namespace(const char *ns_uri, const XERdescriptor_t& p_td) +boolean check_namespace(const char *ns_uri, const XERdescriptor_t& p_td) { if (p_td.my_module==0 || p_td.ns_index==-1) {// no namespace in XER descriptor return ns_uri==0 || *ns_uri=='\0'; // there should be no ns @@ -123,7 +123,7 @@ bool check_namespace(const char *ns_uri, const XERdescriptor_t& p_td) else { const namespace_t *expected_ns = p_td.my_module->get_ns(p_td.ns_index); if (ns_uri!=0) return strcmp(ns_uri, expected_ns->ns)==0; - else return true; // if no namespace we presume it's the expected one + else return TRUE; // if no namespace we presume it's the expected one } } @@ -156,9 +156,9 @@ void check_namespace_restrictions(const XERdescriptor_t& p_td, const char* p_xml { // In case of "anyElement from ..." matching namespaces is good // in case of "anyElement except ..." matching namespaces is bad - bool ns_match_allowed = (p_td.xer_bits & ANY_FROM) ? true : false; + boolean ns_match_allowed = (p_td.xer_bits & ANY_FROM) ? TRUE : FALSE; - bool ns_error = ns_match_allowed; + boolean ns_error = ns_match_allowed; for (unsigned short idx = 0; idx < p_td.nof_ns_uris; ++idx) { if ((p_xmlns == 0 && strlen(p_td.ns_uris[idx]) == 0) || (p_xmlns != 0 && strcmp(p_td.ns_uris[idx], p_xmlns) == 0)) diff --git a/core/XER.hh b/core/XER.hh index 1d2f6b71a..299ed36fa 100644 --- a/core/XER.hh +++ b/core/XER.hh @@ -173,12 +173,12 @@ typedef enum { } XSD_types; /// Check that \p f has the canonical flavor. -inline bool is_canonical(unsigned int f) +inline boolean is_canonical(unsigned int f) { return (f & XER_CANONICAL) != 0; } -inline bool is_exer(unsigned int f) +inline boolean is_exer(unsigned int f) { return (f & XER_EXTENDED) != 0; } @@ -188,7 +188,7 @@ inline bool is_exer(unsigned int f) * @param f XER flavor * @return \c true if \p contains \c XER_RECOF, \c false otherwise */ -inline bool is_record_of(unsigned int f) +inline boolean is_record_of(unsigned int f) { return (f & XER_RECOF) != 0; } @@ -201,7 +201,7 @@ inline bool is_record_of(unsigned int f) * @param f XER flavor * @return \c true if \c XER_EXTENDED and either \c XER_LIST or \c USE_NIL is set. */ -inline bool is_exerlist(unsigned int f) +inline boolean is_exerlist(unsigned int f) { return (f & XER_EXTENDED) && ((f & (XER_LIST|USE_NIL|USE_TYPE_ATTR)) != 0); } @@ -396,7 +396,7 @@ struct embed_values_dec_struct_t * @param exer \c true if Extended XER decoding, \c false for Basic and Canonical XER * @return \c true if \p name corresponds to the type descriptor, \c false otherwise. */ -inline bool check_name(const char *name, const XERdescriptor_t& p_td, int exer) +inline boolean check_name(const char *name, const XERdescriptor_t& p_td, int exer) { return strncmp(name, p_td.names[exer], p_td.namelens[exer]-2) == 0 && name[p_td.namelens[exer]-2] == '\0'; @@ -414,7 +414,7 @@ inline bool check_name(const char *name, const XERdescriptor_t& p_td, int exer) * by \p p_td. * @return \c false otherwise. */ -bool check_namespace(const char *ns_uri, const XERdescriptor_t& p_td); +boolean check_namespace(const char *ns_uri, const XERdescriptor_t& p_td); /** Check that the current element matches the XER descriptor * diff --git a/core/XmlReader.cc b/core/XmlReader.cc index 5914a7673..f0f871674 100644 --- a/core/XmlReader.cc +++ b/core/XmlReader.cc @@ -121,7 +121,7 @@ int XmlReaderWrap::ReadDbg(const char *where) #ifdef NDEBUG (void)where; #else - static bool d = !!getenv("DEBUG_XMLREADER"); + static boolean d = !!getenv("DEBUG_XMLREADER"); if(d){ last_status = xmlTextReaderRead(my_reader); if (last_status==1) { @@ -291,7 +291,7 @@ int XmlReaderWrap::MoveToFirstAttributeDbg(const char *where) #ifdef NDEBUG (void)where; #else - static bool d = !!getenv("DEBUG_XMLREADER"); + static boolean d = !!getenv("DEBUG_XMLREADER"); if (d) { switch (ret) { case 1: {//OK @@ -325,7 +325,7 @@ int XmlReaderWrap::MoveToNextAttributeDbg(const char *where) #ifdef NDEBUG (void)where; #else - static bool d = !!getenv("DEBUG_XMLREADER"); + static boolean d = !!getenv("DEBUG_XMLREADER"); if (d) { switch (ret) { case 1: {//OK @@ -359,7 +359,7 @@ int XmlReaderWrap::MoveToElementDbg(const char *where) #ifdef NDEBUG (void)where; #else - static bool d = !!getenv("DEBUG_XMLREADER"); + static boolean d = !!getenv("DEBUG_XMLREADER"); if (d) { const xmlChar * name = xmlTextReaderConstLocalName(my_reader); const xmlChar * val = xmlTextReaderConstValue(my_reader); diff --git a/core/config_process.y b/core/config_process.y index 350c870ac..ccc4e90f0 100644 --- a/core/config_process.y +++ b/core/config_process.y @@ -2264,7 +2264,7 @@ static void reset_configuration_options() end_testcase_command_set = FALSE; } -Module_Param* process_config_string2ttcn(const char* mp_str, bool is_component) +Module_Param* process_config_string2ttcn(const char* mp_str, boolean is_component) { if (parsed_module_param!=NULL || parsing_error_messages!=NULL) TTCN_error("Internal error: previously parsed ttcn string was not cleared."); // add the hidden keyword diff --git a/core2/Basetype2.cc b/core2/Basetype2.cc index 86195fc04..86533d1b6 100644 --- a/core2/Basetype2.cc +++ b/core2/Basetype2.cc @@ -321,7 +321,7 @@ int Record_Of_Type::get_nof_elements() const return nof_elements; } -bool Record_Of_Type::is_elem_bound(int index) const +boolean Record_Of_Type::is_elem_bound(int index) const { return val_ptr->value_elements[index] != NULL && val_ptr->value_elements[index]->is_bound(); @@ -342,17 +342,17 @@ int Record_Of_Type::get_max_refd_index() return refd_ind_ptr->max_refd_index; } -bool Record_Of_Type::is_index_refd(int index) +boolean Record_Of_Type::is_index_refd(int index) { if (NULL == refd_ind_ptr) { - return false; + return FALSE; } for (size_t i = 0; i < refd_ind_ptr->refd_indices.size(); ++i) { if (index == refd_ind_ptr->refd_indices[i]) { - return true; + return TRUE; } } - return false; + return FALSE; } void Record_Of_Type::set_val(null_type) @@ -906,7 +906,7 @@ int Record_Of_Type::TEXT_encode(const TTCN_Typedescriptor_t& p_td, int Record_Of_Type::TEXT_encode_negtest(const Erroneous_descriptor_t* p_err_descr, const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buff) const { - bool need_separator=false; + boolean need_separator=FALSE; int encoded_length=0; if(p_td.text->begin_encode) { buff.put_cs(*p_td.text->begin_encode); @@ -945,7 +945,7 @@ int Record_Of_Type::TEXT_encode_negtest(const Erroneous_descriptor_t* p_err_desc encoded_length += err_vals->before->errval->TEXT_encode( *(err_vals->before->type_descr),buff); } - need_separator=true; + need_separator=TRUE; } if (err_vals && err_vals->value) { @@ -962,7 +962,7 @@ int Record_Of_Type::TEXT_encode_negtest(const Erroneous_descriptor_t* p_err_desc encoded_length += err_vals->value->errval->TEXT_encode( *(err_vals->value->type_descr),buff); } - need_separator=true; + need_separator=TRUE; } // else -> omit } else { if (need_separator && p_td.text->separator_encode) { @@ -975,7 +975,7 @@ int Record_Of_Type::TEXT_encode_negtest(const Erroneous_descriptor_t* p_err_desc } else { encoded_length += get_at(a)->TEXT_encode(*p_td.oftype_descr,buff); } - need_separator=true; + need_separator=TRUE; } if (err_vals && err_vals->after) { @@ -993,7 +993,7 @@ int Record_Of_Type::TEXT_encode_negtest(const Erroneous_descriptor_t* p_err_desc encoded_length += err_vals->after->errval->TEXT_encode( *(err_vals->after->type_descr),buff); } - need_separator=true; + need_separator=TRUE; } if ( (p_err_descr->omit_after!=-1) && (a>=p_err_descr->omit_after) ) break; @@ -1377,7 +1377,7 @@ int Record_Of_Type::RAW_encode_negtest(const Erroneous_descriptor_t *p_err_descr if (err_vals->before->errval == NULL) TTCN_error("internal error: erroneous before value missing"); if (err_vals->before->raw) { - myleaf.body.node.nodes[node_pos] = new RAW_enc_tree(true, &myleaf, + myleaf.body.node.nodes[node_pos] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), node_pos, err_vals->before->errval->get_descriptor()->raw); encoded_length += err_vals->before->errval-> @@ -1395,7 +1395,7 @@ int Record_Of_Type::RAW_encode_negtest(const Erroneous_descriptor_t *p_err_descr if (err_vals && err_vals->value) { if (err_vals->value->errval) { if (err_vals->value->raw) { - myleaf.body.node.nodes[node_pos] = new RAW_enc_tree(true, &myleaf, + myleaf.body.node.nodes[node_pos] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), node_pos, err_vals->value->errval->get_descriptor()->raw); encoded_length += err_vals->value->errval-> @@ -1427,7 +1427,7 @@ int Record_Of_Type::RAW_encode_negtest(const Erroneous_descriptor_t *p_err_descr if (err_vals->after->errval == NULL) TTCN_error("internal error: erroneous after value missing"); if (err_vals->after->raw) { - myleaf.body.node.nodes[node_pos] = new RAW_enc_tree(true, &myleaf, + myleaf.body.node.nodes[node_pos] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), node_pos, err_vals->after->errval->get_descriptor()->raw); encoded_length += err_vals->after->errval-> @@ -1584,7 +1584,7 @@ int Record_Of_Type::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenize } set_size(0); - for (int nof_elements = 0; true; ++nof_elements) { + for (int nof_elements = 0; TRUE; ++nof_elements) { // Read value tokens until we reach some other token size_t buf_pos = p_tok.get_buf_pos(); int ret_val; @@ -1764,7 +1764,7 @@ void Record_Of_Type::decode(const TTCN_Typedescriptor_t& p_td, if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); - if(JSON_decode(p_td, tok, false)<0) + if(JSON_decode(p_td, tok, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', " "because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); @@ -1784,7 +1784,7 @@ char **Record_Of_Type::collect_ns(const XERdescriptor_t& p_td, size_t& num, bool // Then the embedded type try { - bool def_ns_1 = false; + boolean def_ns_1 = FALSE; if (val_ptr) for (int i = 0; i < get_nof_elements(); ++i) { size_t num_new = 0; char **new_namespaces = get_at(i)->collect_ns( @@ -2697,13 +2697,13 @@ void Record_Type::set_param(Module_Param& param) { case Module_Param::MP_Assignment_List: for (size_t i=0; i<mp->get_size(); ++i) { Module_Param* const current = mp->get_elem(i); - bool found = false; + boolean found = FALSE; for (int j=0; j<get_count(); ++j) { if (!strcmp(fld_name(j), current->get_id()->get_name())) { if (current->get_type()!=Module_Param::MP_NotUsed) { get_at(j)->set_param(*current); } - found = true; + found = TRUE; break; } } @@ -2958,7 +2958,7 @@ void Record_Type::decode(const TTCN_Typedescriptor_t& p_td, if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); - if(JSON_decode(p_td, tok, false)<0) + if(JSON_decode(p_td, tok, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG, "Can not decode type '%s', because invalid or incomplete" " message was received", p_td.name); @@ -3234,7 +3234,7 @@ int Record_Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, } int encoded_length = 0; int field_cnt = get_count(); - myleaf.isleaf = false; + myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = field_cnt; myleaf.body.node.nodes = init_nodes_of_enc_tree(field_cnt); /* init nodes */ @@ -3244,7 +3244,7 @@ int Record_Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, boolean is_optional_field = optional_indexes && (optional_indexes[next_optional_idx] == i); if (!is_optional_field || get_at(i)->ispresent()) { - myleaf.body.node.nodes[i] = new RAW_enc_tree(true, &myleaf, + myleaf.body.node.nodes[i] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), i, fld_descr(i)->raw); } else { @@ -3281,7 +3281,7 @@ int Record_Type::RAW_encode_negtest(const Erroneous_descriptor_t *p_err_descr, } int encoded_length = 0; int num_fields = get_count(); - myleaf.isleaf = false; + myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 0; for (int field_idx = 0; field_idx < num_fields; ++field_idx) { if ((p_err_descr->omit_before != -1) && @@ -3320,7 +3320,7 @@ int Record_Type::RAW_encode_negtest(const Erroneous_descriptor_t *p_err_descr, TTCN_error("internal error: erroneous before value missing"); if (err_vals->before->raw) { myleaf.body.node.nodes[node_pos] = - new RAW_enc_tree(true, &myleaf, &(myleaf.curr_pos), node_pos, + new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), node_pos, err_vals->before->errval->get_descriptor()->raw); encoded_length += err_vals->before->errval-> RAW_encode_negtest_raw(*myleaf.body.node.nodes[node_pos++]); @@ -3328,7 +3328,7 @@ int Record_Type::RAW_encode_negtest(const Erroneous_descriptor_t *p_err_descr, if (err_vals->before->type_descr == NULL) TTCN_error("internal error: erroneous before typedescriptor missing"); myleaf.body.node.nodes[node_pos] = - new RAW_enc_tree(true, &myleaf, &(myleaf.curr_pos), node_pos, + new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), node_pos, err_vals->before->type_descr->raw); encoded_length += err_vals->before->errval-> RAW_encode(*(err_vals->before->type_descr), @@ -3340,7 +3340,7 @@ int Record_Type::RAW_encode_negtest(const Erroneous_descriptor_t *p_err_descr, ec.set_msg("'%s'(erroneous value): ", fld_name(field_idx)); if (err_vals->value->raw) { myleaf.body.node.nodes[node_pos] = - new RAW_enc_tree(true, &myleaf, &(myleaf.curr_pos), node_pos, + new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), node_pos, err_vals->value->errval->get_descriptor()->raw); encoded_length += err_vals->value->errval-> RAW_encode_negtest_raw(*myleaf.body.node.nodes[node_pos++]); @@ -3348,7 +3348,7 @@ int Record_Type::RAW_encode_negtest(const Erroneous_descriptor_t *p_err_descr, if (err_vals->value->type_descr == NULL) TTCN_error("internal error: erroneous value typedescriptor missing"); myleaf.body.node.nodes[node_pos] = - new RAW_enc_tree(true, &myleaf, &(myleaf.curr_pos), node_pos, + new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), node_pos, err_vals->value->type_descr->raw); encoded_length += err_vals->value->errval-> RAW_encode(*(err_vals->value->type_descr), @@ -3362,7 +3362,7 @@ int Record_Type::RAW_encode_negtest(const Erroneous_descriptor_t *p_err_descr, is_optional_field ? get_at(field_idx)->get_opt_value() : get_at(field_idx); myleaf.body.node.nodes[node_pos] = - new RAW_enc_tree(true, &myleaf, &(myleaf.curr_pos), node_pos, + new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), node_pos, fld_descr(field_idx)->raw); if (emb_descr) { encoded_length += @@ -3383,7 +3383,7 @@ int Record_Type::RAW_encode_negtest(const Erroneous_descriptor_t *p_err_descr, TTCN_error("internal error: erroneous before value missing"); if (err_vals->after->raw) { myleaf.body.node.nodes[node_pos] = - new RAW_enc_tree(true, &myleaf, &(myleaf.curr_pos), node_pos, + new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), node_pos, err_vals->after->errval->get_descriptor()->raw); encoded_length += err_vals->after->errval-> RAW_encode_negtest_raw(*myleaf.body.node.nodes[node_pos++]); @@ -3391,7 +3391,7 @@ int Record_Type::RAW_encode_negtest(const Erroneous_descriptor_t *p_err_descr, if (err_vals->after->type_descr == NULL) TTCN_error("internal error: erroneous after typedescriptor missing"); myleaf.body.node.nodes[node_pos] = - new RAW_enc_tree(true, &myleaf, &(myleaf.curr_pos), node_pos, + new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), node_pos, err_vals->after->type_descr->raw); encoded_length += err_vals->after->errval-> RAW_encode(*(err_vals->after->type_descr), @@ -3539,7 +3539,7 @@ int Record_Type::TEXT_encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buf TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); } - bool need_separator=false; + boolean need_separator=FALSE; int encoded_length=0; if (p_td.text->begin_encode) { buff.put_cs(*p_td.text->begin_encode); @@ -3556,7 +3556,7 @@ int Record_Type::TEXT_encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buf encoded_length+=p_td.text->separator_encode->lengthof(); } encoded_length += get_at(i)->TEXT_encode(*fld_descr(i),buff); - need_separator=true; + need_separator=TRUE; } if (is_optional_field) next_optional_idx++; } @@ -3576,7 +3576,7 @@ int Record_Type::TEXT_encode_negtest(const Erroneous_descriptor_t* p_err_descr, TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); } - bool need_separator=false; + boolean need_separator=FALSE; int encoded_length=0; if (p_td.text->begin_encode) { buff.put_cs(*p_td.text->begin_encode); @@ -3616,7 +3616,7 @@ int Record_Type::TEXT_encode_negtest(const Erroneous_descriptor_t* p_err_descr, encoded_length += err_vals->before->errval->TEXT_encode( *(err_vals->before->type_descr),buff); } - need_separator=true; + need_separator=TRUE; } if (err_vals && err_vals->value) { @@ -3633,7 +3633,7 @@ int Record_Type::TEXT_encode_negtest(const Erroneous_descriptor_t* p_err_descr, encoded_length += err_vals->value->errval->TEXT_encode( *(err_vals->value->type_descr),buff); } - need_separator=true; + need_separator=TRUE; } // else -> omit } else { if (!is_optional_field || get_at(i)->ispresent()) { @@ -3646,7 +3646,7 @@ int Record_Type::TEXT_encode_negtest(const Erroneous_descriptor_t* p_err_descr, } else { encoded_length += get_at(i)->TEXT_encode(*fld_descr(i),buff); } - need_separator=true; + need_separator=TRUE; } } @@ -3665,7 +3665,7 @@ int Record_Type::TEXT_encode_negtest(const Erroneous_descriptor_t* p_err_descr, encoded_length += err_vals->after->errval->TEXT_encode( *(err_vals->after->type_descr),buff); } - need_separator=true; + need_separator=TRUE; } if (is_optional_field) next_optional_idx++; @@ -3752,7 +3752,7 @@ int Record_Type::TEXT_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buf if ( (fld_descr(i)->text->val.parameters->decoding_params.repeatable && field_map[i]<3) || !field_map[i] ) { pos=buff.get_pos(); - decoded_field_length = get_at(i)->TEXT_decode(*fld_descr(i),buff, limit, true,!field_map[i]); + decoded_field_length = get_at(i)->TEXT_decode(*fld_descr(i),buff, limit, TRUE,!field_map[i]); if (decoded_field_length<0) { buff.set_pos(pos); if (is_optional_field && !field_map[i]) get_at(i)->set_to_omit(); @@ -3770,7 +3770,7 @@ int Record_Type::TEXT_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buf } else { // !...->is_seof if (!field_map[i]) { pos=buff.get_pos(); - decoded_field_length = get_at(i)->TEXT_decode(*fld_descr(i),buff,limit,true); + decoded_field_length = get_at(i)->TEXT_decode(*fld_descr(i),buff,limit,TRUE); if (decoded_field_length<0) { buff.set_pos(pos); if (is_optional_field) get_at(i)->set_to_omit(); @@ -4087,7 +4087,7 @@ char ** Record_Type::collect_ns(const XERdescriptor_t& p_td, size_t& num, bool& // (Monty Python - Crunchy Frog sketch). This whole thing is O(n^3). Yuck. for (int a = start_at; a < field_cnt; ++a) { size_t num_new = 0; - bool def_ns_1 = false; + boolean def_ns_1 = FALSE; char **new_namespaces = get_at(a)->collect_ns(*xer_descr(a), num_new, def_ns_1); merge_ns(collected_ns, num_collected, new_namespaces, num_new); def_ns = def_ns || def_ns_1; @@ -4162,7 +4162,7 @@ int Record_Type::XER_encode(const XERdescriptor_t& p_td, TTCN_Buffer& p_buf, size_t num_collected = 0; // we use this to compute delay_close char **collected_ns = NULL; - bool def_ns = false; + boolean def_ns = FALSE; if (exer) { if (indent == 0) { // top-level type collected_ns = collect_ns(p_td, num_collected, def_ns); @@ -4606,7 +4606,7 @@ int Record_Type::XER_encode_negtest(const Erroneous_descriptor_t* p_err_descr, size_t num_collected = 0; // we use this to compute delay_close char **collected_ns = NULL; - bool def_ns = false; + boolean def_ns = FALSE; if (exer) { if (indent == 0) { // top-level type collected_ns = collect_ns(p_td, num_collected, def_ns); @@ -5405,7 +5405,7 @@ int Record_Type::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, /* * * * * * * * Non-attributes (elements) * * * * * * * * * * * */ embed_values_dec_struct_t* emb_val = 0; - bool emb_val_optional = false; + boolean emb_val_optional = FALSE; if (exer && (p_td.xer_bits & EMBED_VALUES)) { emb_val = new embed_values_dec_struct_t; emb_val->embval_array = dynamic_cast<Record_Of_Type*>(get_at(0)); @@ -5413,7 +5413,7 @@ int Record_Type::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, OPTIONAL<PreGenRecordOf::PREGEN__RECORD__OF__UNIVERSAL__CHARSTRING>* embed_value = static_cast<OPTIONAL<PreGenRecordOf::PREGEN__RECORD__OF__UNIVERSAL__CHARSTRING>*>(get_at(0)); embed_value->set_to_present(); emb_val->embval_array = static_cast<Record_Of_Type*>((*embed_value).get_opt_value()); - emb_val_optional = true; + emb_val_optional = TRUE; } emb_val->embval_array->set_size(0); emb_val->embval_index = 0; @@ -5473,7 +5473,7 @@ int Record_Type::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, // (if the field is an untagged record of), in this case the next value should // be ignored, as it's already been handled by the record of int last_embval_index = 0; - bool early_exit = false; + boolean early_exit = FALSE; for (i = begin; i < end; i++) { for (success = reader.Ok(); success == 1; success = reader.Read()) { type = reader.NodeType(); @@ -5484,7 +5484,7 @@ int Record_Type::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, // The non-attribute components must not be UNTAGGED if (type == XML_READER_TYPE_ELEMENT) break; if (type == XML_READER_TYPE_END_ELEMENT) { - early_exit = true; + early_exit = TRUE; break; } } @@ -5496,7 +5496,7 @@ int Record_Type::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, } if (success != 1 || early_exit) break; const char *name = (const char *)reader.LocalName(); - bool field_name_found = false; + boolean field_name_found = FALSE; // Find out which member it is. // FIXME some hashing should be implemented for (int k = begin; k < end; k++) { @@ -5520,7 +5520,7 @@ int Record_Type::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, ->from_int(in_dex); Base_Type *b = jumbled->get_at(k); b->XER_decode(*jumbled->xer_descr(k), reader, flavor, flavor2, emb_val); - field_name_found = true; + field_name_found = TRUE; break; } } @@ -5547,7 +5547,7 @@ int Record_Type::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, Base_Type *b = jumbled->get_at(k); b->XER_decode(*jumbled->xer_descr(k), reader, flavor, flavor2, emb_val); last_any_elem = k; - field_name_found = true; + field_name_found = TRUE; break; } } @@ -5627,7 +5627,7 @@ int Record_Type::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, } else { // In case the field is an optional anyElement -> check if it should be omitted - bool optional_any_elem_check = true; + boolean optional_any_elem_check = TRUE; if (get_at(i)->is_optional() && (xer_descr(i)->xer_bits & ANY_ELEMENT)) { // The "anyElement" coding instruction can only be applied to a universal charstring field OPTIONAL<UNIVERSAL_CHARSTRING>* opt_field = dynamic_cast<OPTIONAL<UNIVERSAL_CHARSTRING>*>(get_at(i)); @@ -5670,13 +5670,13 @@ int Record_Type::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, } // if use-order if (0 != emb_val) { - bool all_unbound = true; + boolean all_unbound = TRUE; static const UNIVERSAL_CHARSTRING emptystring(0, (const char*)NULL); for (int j = 0; j < emb_val->embval_index; ++j) { if (!emb_val->embval_array->get_at(j)->is_bound()) { emb_val->embval_array->get_at(j)->set_value(&emptystring); }else if((static_cast<const UNIVERSAL_CHARSTRING*>(emb_val->embval_array->get_at(j)))->lengthof() !=0) { - all_unbound = false; + all_unbound = FALSE; } } if(emb_val_optional && all_unbound){ @@ -5909,7 +5909,7 @@ int Record_Type::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& JSON_METAINFO_NONE : JSON_METAINFO_NOT_APPLICABLE; } - while (true) { + while (TRUE) { // Read name - value token pairs until we reach some other token char* name = 0; size_t name_len = 0; @@ -6244,7 +6244,7 @@ void Empty_Record_Type::decode(const TTCN_Typedescriptor_t& p_td, if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); - if(JSON_decode(p_td, tok, false)<0) + if(JSON_decode(p_td, tok, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG, "Can not decode type '%s', because invalid or incomplete" " message was received", p_td.name); @@ -6361,7 +6361,7 @@ int Empty_Record_Type::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, unsigned int flavor, unsigned int /*flavor2*/, embed_values_dec_struct_t*) { int exer = is_exer(flavor); - bound_flag = true; + bound_flag = TRUE; int success, depth = -1; for (success=reader.Ok(); success==1; success=reader.Read()) { int type = reader.NodeType(); @@ -6418,7 +6418,7 @@ int Empty_Record_Type::JSON_decode(const TTCN_Typedescriptor_t&, JSON_Tokenizer& return JSON_ERROR_FATAL; } - bound_flag = true; + bound_flag = TRUE; return dec_len; } -- GitLab