From 3adfdad66db8bdbc326dafb6b16a7de06479307b Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Mon, 13 Apr 2015 18:46:43 -0400 Subject: [PATCH 1/5] Comment out search term not found WARNING Returning empty result should be sufficient for detecting a no-match condition. See forum discussion http://forum.openscad.org/Suppressing-quot-search-term-not-found-quot-warning-in-search-td12359.html --- src/func.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/func.cc b/src/func.cc index fbece878..9caa1b9b 100644 --- a/src/func.cc +++ b/src/func.cc @@ -740,7 +740,7 @@ static Value::VectorType search(const std::string &find, const std::string &tabl if (matchCount == 0) { gchar utf8_of_cp[6] = ""; //A buffer for a single unicode character to be copied into if (ptr_ft) g_utf8_strncpy(utf8_of_cp, ptr_ft, 1); - PRINTB(" WARNING: search term not found: \"%s\"", utf8_of_cp); + // PRINTB(" WARNING: search term not found: \"%s\"", utf8_of_cp); } if (num_returns_per_match == 0 || num_returns_per_match > 1) { returnvec.push_back(Value(resultvec)); From bb183558ae1efdba3bf64bd4f807f63a5d12061d Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Wed, 15 Apr 2015 14:47:30 -0400 Subject: [PATCH 2/5] Removing instead of just commenting out line. --- src/func.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/func.cc b/src/func.cc index 9caa1b9b..c7fbba51 100644 --- a/src/func.cc +++ b/src/func.cc @@ -740,7 +740,6 @@ static Value::VectorType search(const std::string &find, const std::string &tabl if (matchCount == 0) { gchar utf8_of_cp[6] = ""; //A buffer for a single unicode character to be copied into if (ptr_ft) g_utf8_strncpy(utf8_of_cp, ptr_ft, 1); - // PRINTB(" WARNING: search term not found: \"%s\"", utf8_of_cp); } if (num_returns_per_match == 0 || num_returns_per_match > 1) { returnvec.push_back(Value(resultvec)); From dee5885d9f00d663963d11fc1818470bf16dd867 Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Wed, 15 Apr 2015 14:49:02 -0400 Subject: [PATCH 3/5] Manually removing WARNING echos. --- tests/regression/echotest/search-tests-expected.echo | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/regression/echotest/search-tests-expected.echo b/tests/regression/echotest/search-tests-expected.echo index 280a5bc7..cec6152c 100644 --- a/tests/regression/echotest/search-tests-expected.echo +++ b/tests/regression/echotest/search-tests-expected.echo @@ -1,9 +1,3 @@ - WARNING: search term not found: "q" - WARNING: search term not found: 1000 - WARNING: search term not found: "zzz" - WARNING: search term not found: "zzz" - WARNING: search term not found: 500 - WARNING: search term not found: "" ECHO: "Characters in string ("a"): [0]" ECHO: "Characters in string ("adeq"): [[0, 5], [3, 8], [4], []]" ECHO: "Default string search ("abe"): [0, 1, 8]" From e8c8bda674e043258b39dcf1f405b63a2124ce83 Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Wed, 15 Apr 2015 14:50:44 -0400 Subject: [PATCH 4/5] Manually removing WARNING echos. --- .../search-tests-unicode-expected.echo | 38 ------------------- 1 file changed, 38 deletions(-) diff --git a/tests/regression/echotest/search-tests-unicode-expected.echo b/tests/regression/echotest/search-tests-unicode-expected.echo index 801bc8c8..e4d81a26 100644 --- a/tests/regression/echotest/search-tests-unicode-expected.echo +++ b/tests/regression/echotest/search-tests-unicode-expected.echo @@ -8,61 +8,31 @@ ECHO: "Expect [[0, 1]] for search(a, aaaa, 2)=[[0, 1]]. OK" ECHO: "Expect [[0, 1, 2]] for search(a, aaaa, 3)=[[0, 1, 2]]. OK" ECHO: "Expect [[0, 1, 2, 3]] for search(a, aaaa, 4)=[[0, 1, 2, 3]]. OK" ECHO: "Expect [[0, 1, 2, 3], [0, 1, 2, 3]] for search(aa, aaaa, 0)=[[0, 1, 2, 3], [0, 1, 2, 3]]. OK" - WARNING: search term not found: "b" ECHO: "Expect [] for search(b, aaaa)=[]. OK" - WARNING: search term not found: "b" ECHO: "Expect [] for search(b, aaaa, 1)=[]. OK" - WARNING: search term not found: "b" ECHO: "Expect [[]] for search(b, aaaa, 0)=[[]]. OK" - WARNING: search term not found: "b" ECHO: "Expect [[]] for search(b, aaaa, 2)=[[]]. OK" - WARNING: search term not found: "b" - WARNING: search term not found: "b" ECHO: "Expect [] for search(bb, aaaa)=[]. OK" - WARNING: search term not found: "b" - WARNING: search term not found: "b" ECHO: "Expect [] for search(bb, aaaa, 1)=[]. OK" - WARNING: search term not found: "b" - WARNING: search term not found: "b" ECHO: "Expect [[], []] for search(bb, aaaa, 0)=[[], []]. OK" - WARNING: search term not found: "b" - WARNING: search term not found: "b" ECHO: "Expect [[], []] for search(bb, aaaa, 2)=[[], []]. OK" ECHO: "Expect [] for search(, aaaa)=[]. OK" ECHO: "Expect [] for search(, )=[]. OK" - WARNING: search term not found: "a" ECHO: "Expect [] for search(a, )=[]. OK" ECHO: "----- Lookup of multi-byte into 1 byte" - WARNING: search term not found: "Л" ECHO: "Expect [] for search(Л, aaaa)=[]. OK" - WARNING: search term not found: "🂡" ECHO: "Expect [] for search(🂡, aaaa)=[]. OK" - WARNING: search term not found: "Л" ECHO: "Expect [[]] for search(Л, aaaa, 0)=[[]]. OK" - WARNING: search term not found: "🂡" ECHO: "Expect [[]] for search(🂡, aaaa, 0)=[[]]. OK" - WARNING: search term not found: "Л" - WARNING: search term not found: "Л" ECHO: "Expect [] for search(ЛЛ, aaaa)=[]. OK" - WARNING: search term not found: "🂡" - WARNING: search term not found: "🂡" ECHO: "Expect [] for search(🂡🂡, aaaa)=[]. OK" - WARNING: search term not found: "Л" - WARNING: search term not found: "Л" ECHO: "Expect [[], []] for search(ЛЛ, aaaa, 0)=[[], []]. OK" - WARNING: search term not found: "🂡" - WARNING: search term not found: "🂡" ECHO: "Expect [[], []] for search(🂡🂡, aaaa, 0)=[[], []]. OK" ECHO: "----- Lookup of 1-byte into multi-byte" - WARNING: search term not found: "a" ECHO: "Expect [] for search(a, ЛЛЛЛ)=[]. OK" - WARNING: search term not found: "a" ECHO: "Expect [] for search(a, 🂡🂡🂡🂡)=[]. OK" - WARNING: search term not found: "a" ECHO: "Expect [] for search(a, ЛЛЛЛ, 1)=[]. OK" - WARNING: search term not found: "a" ECHO: "Expect [[]] for search(a, 🂡🂡🂡🂡, 0)=[[]]. OK" - WARNING: search term not found: "a" ECHO: "Expect [[]] for search(a, 🂡🂡🂡🂡, 2)=[[]]. OK" ECHO: "----- Lookup of 1-byte into mixed multi-byte" ECHO: "Expect [0] for search(a, aЛaЛaЛaЛa)=[0]. OK" @@ -75,35 +45,27 @@ ECHO: "----- Lookup of 2-byte into 2-byte" ECHO: "Expect [0] for search(Л, ЛЛЛЛ)=[0]. OK" ECHO: "Expect [[0, 1, 2, 3]] for search(Л, ЛЛЛЛ, 0)=[[0, 1, 2, 3]]. OK" ECHO: "----- Lookup of 2-byte into 4-byte" - WARNING: search term not found: "Л" ECHO: "Expect [] for search(Л, 🂡🂡🂡🂡)=[]. OK" ECHO: "----- Lookup of 4-byte into 4-byte" ECHO: "Expect [0] for search(🂡, 🂡🂡🂡🂡)=[0]. OK" ECHO: "Expect [[0, 1, 2, 3]] for search(🂡, 🂡🂡🂡🂡, 0)=[[0, 1, 2, 3]]. OK" ECHO: "----- Lookup of 4-byte into 2-byte" - WARNING: search term not found: "🂡" ECHO: "Expect [] for search(🂡, ЛЛЛЛ)=[]. OK" ECHO: "----- Lookup of 2-byte into mixed multi-byte" ECHO: "Expect [1] for search(Л, aЛaЛaЛaЛa, 1)=[1]. OK" - WARNING: search term not found: "Л" ECHO: "Expect [] for search(Л, a🂡a🂡a🂡a🂡a, 1)=[]. OK" ECHO: "Expect [2] for search(Л, a🂡Л🂡a🂡Л🂡a, 1)=[2]. OK" ECHO: "Expect [[1, 3, 5, 7]] for search(Л, aЛaЛaЛaЛa, 0)=[[1, 3, 5, 7]]. OK" - WARNING: search term not found: "Л" ECHO: "Expect [[]] for search(Л, a🂡a🂡a🂡a🂡a, 0)=[[]]. OK" ECHO: "Expect [[2, 6]] for search(Л, a🂡Л🂡a🂡Л🂡a, 0)=[[2, 6]]. OK" ECHO: "----- Lookup of 4-byte into mixed multi-byte" - WARNING: search term not found: "🂡" ECHO: "Expect [] for search(🂡, aЛaЛaЛaЛa, 1)=[]. OK" ECHO: "Expect [1] for search(🂡, a🂡a🂡a🂡a🂡a, 1)=[1]. OK" - WARNING: search term not found: "🂡" ECHO: "Expect [[]] for search(🂡, aЛaЛaЛaЛa, 0)=[[]]. OK" ECHO: "Expect [[1, 3, 5, 7]] for search(🂡, a🂡a🂡a🂡a🂡a, 0)=[[1, 3, 5, 7]]. OK" ECHO: "Expect [[1, 3, 5, 7]] for search(🂡, a🂡Л🂡a🂡Л🂡a, 0)=[[1, 3, 5, 7]]. OK" ECHO: "----- Lookup of mixed multi-byte into mixed multi-byte" - WARNING: search term not found: "🂡" ECHO: "Expect [[0, 2, 4, 6, 8], [1, 3, 5, 7], []] for search(aЛ🂡, aЛaЛaЛaЛa, 0)=[[0, 2, 4, 6, 8], [1, 3, 5, 7], []]. OK" - WARNING: search term not found: "Л" ECHO: "Expect [[0, 2, 4, 6, 8], [], [1, 3, 5, 7]] for search(aЛ🂡, a🂡a🂡a🂡a🂡a, 0)=[[0, 2, 4, 6, 8], [], [1, 3, 5, 7]]. OK" ECHO: "Expect [[0, 4, 8], [2, 6], [1, 3, 5, 7]] for search(aЛ🂡, a🂡Л🂡a🂡Л🂡a, 0)=[[0, 4, 8], [2, 6], [1, 3, 5, 7]]. OK" ECHO: "Expect [[1, 3, 5, 7], [0, 4, 8], [2, 6]] for search(🂡aЛ, a🂡Л🂡a🂡Л🂡a, 0)=[[1, 3, 5, 7], [0, 4, 8], [2, 6]]. OK" From 9897174a03f18855b96b00d8e1202a293d666c30 Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Wed, 15 Apr 2015 18:29:05 -0400 Subject: [PATCH 5/5] Found more search PRINTB warnings to remove --- src/func.cc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/func.cc b/src/func.cc index c7fbba51..e6dfbccc 100644 --- a/src/func.cc +++ b/src/func.cc @@ -849,12 +849,6 @@ ValuePtr builtin_search(const Context *, const EvalContext *evalctx) } } if (num_returns_per_match == 1 && matchCount == 0) { - if (findThis->toVector()[i].type() == Value::NUMBER) { - PRINTB(" WARNING: search term not found: %s",findThis->toVector()[i].toDouble()); - } - else if (findThis->toVector()[i].type() == Value::STRING) { - PRINTB(" WARNING: search term not found: \"%s\"",findThis->toVector()[i].toString()); - } returnvec.push_back(resultvec); } if (num_returns_per_match == 0 || num_returns_per_match > 1) { @@ -862,7 +856,6 @@ ValuePtr builtin_search(const Context *, const EvalContext *evalctx) } } } else { - PRINTB(" WARNING: search: none performed on input %s", findThis); return ValuePtr::undefined; } return ValuePtr(returnvec);