summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine ELIAS <antoine.elias@scilab-enterprises.com>2016-03-30 12:40:23 +0200
committerAntoine ELIAS <antoine.elias@scilab-enterprises.com>2016-03-30 15:41:09 +0100
commitc1c69bf1f0b1e4638d44cf2350cf8897ef774e1b (patch)
treea996aa13663f7ee29e00dd6681705d19577dd4a9
parenta65e23197c05b5fd2438829f71e15e1959f6c34d (diff)
downloadscilab-slint-cnes.zip
scilab-slint-cnes.tar.gz
fix closure of last <File> in result xml file and add contribution messageslint-cnes
Change-Id: I31ffeaf9c94ab3a13dd1f01b3327243aa6f58f28
-rw-r--r--scilab/modules/slint/sci_gateway/cpp/sci_slint.cpp8
-rw-r--r--scilab/modules/slint/src/cpp/SLintXmlResult.cpp25
2 files changed, 23 insertions, 10 deletions
diff --git a/scilab/modules/slint/sci_gateway/cpp/sci_slint.cpp b/scilab/modules/slint/sci_gateway/cpp/sci_slint.cpp
index fb9dc77..f18299b 100644
--- a/scilab/modules/slint/sci_gateway/cpp/sci_slint.cpp
+++ b/scilab/modules/slint/sci_gateway/cpp/sci_slint.cpp
@@ -31,9 +31,11 @@
31extern "C" 31extern "C"
32{ 32{
33#include "Scierror.h" 33#include "Scierror.h"
34#include "sciprint.h"
34#include "localization.h" 35#include "localization.h"
35} 36}
36 37
38static bool contributionMsg = true;
37/** 39/**
38 * slint(String[a,b] files, String[1,c] conf, String[1,1] out) 40 * slint(String[a,b] files, String[1,c] conf, String[1,1] out)
39 * slint(String[a,b] files, String[1,1] out) : default conf is etc/slint.xml 41 * slint(String[a,b] files, String[1,1] out) : default conf is etc/slint.xml
@@ -212,5 +214,11 @@ types::Function::ReturnValue sci_slint(types::typed_list & in, int _iRetCount, t
212 214
213 delete results; 215 delete results;
214 216
217 if (contributionMsg)
218 {
219 sciprint("%s\n", _("Module developed with the contribution of CNES."));
220 contributionMsg = false;
221 }
222
215 return types::Function::OK; 223 return types::Function::OK;
216} 224}
diff --git a/scilab/modules/slint/src/cpp/SLintXmlResult.cpp b/scilab/modules/slint/src/cpp/SLintXmlResult.cpp
index eb077e3..2b59ae2 100644
--- a/scilab/modules/slint/src/cpp/SLintXmlResult.cpp
+++ b/scilab/modules/slint/src/cpp/SLintXmlResult.cpp
@@ -45,7 +45,7 @@ SLintXmlResult::SLintXmlResult(const std::wstring & _path) : current(nullptr), p
45 else 45 else
46 { 46 {
47 (*out) << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" 47 (*out) << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
48 << "<SLintResult>\n"; 48 << "<SLintResult>\n";
49 } 49 }
50} 50}
51 51
@@ -60,6 +60,11 @@ SLintXmlResult::~SLintXmlResult()
60 60
61void SLintXmlResult::finalize() 61void SLintXmlResult::finalize()
62{ 62{
63 if (current.get())
64 {
65 (*out) << " </File>\n";
66 }
67
63 (*out) << "</SLintResult>\n"; 68 (*out) << "</SLintResult>\n";
64 out->close(); 69 out->close();
65 delete out; 70 delete out;
@@ -71,7 +76,7 @@ const std::string SLintXmlResult::getStr(const std::wstring & str)
71 return scilab::UTF8::toUTF8(replaceByEntities(str)); 76 return scilab::UTF8::toUTF8(replaceByEntities(str));
72} 77}
73 78
74 void SLintXmlResult::handleMessage(SLintContext & context, const Location & loc, const SLintChecker & checker, const unsigned sub, const std::wstring & msg) 79void SLintXmlResult::handleMessage(SLintContext & context, const Location & loc, const SLintChecker & checker, const unsigned sub, const std::wstring & msg)
75{ 80{
76 if (context.getSciFile().get() != current.get()) 81 if (context.getSciFile().get() != current.get())
77 { 82 {
@@ -102,23 +107,23 @@ void SLintXmlResult::print(const Location & loc, const SLintChecker & checker, c
102void SLintXmlResult::print(const Location & loc) 107void SLintXmlResult::print(const Location & loc)
103{ 108{
104 (*out) << " <Location first_line=\"" << loc.first_line 109 (*out) << " <Location first_line=\"" << loc.first_line
105 << "\" first_column=\"" << loc.first_column 110 << "\" first_column=\"" << loc.first_column
106 << "\" last_line=\"" << loc.last_line 111 << "\" last_line=\"" << loc.last_line
107 << "\" last_column=\"" << loc.last_column 112 << "\" last_column=\"" << loc.last_column
108 << "\"/>\n"; 113 << "\"/>\n";
109} 114}
110 115
111 void SLintXmlResult::print(const SLintChecker & checker, const unsigned sub) 116void SLintXmlResult::print(const SLintChecker & checker, const unsigned sub)
112{ 117{
113 (*out) << " <Checker name=\"" << checker.getName() 118 (*out) << " <Checker name=\"" << checker.getName()
114 << "\" id=\"" << getStr(checker.getId(sub)) 119 << "\" id=\"" << getStr(checker.getId(sub))
115 << "\"/>\n"; 120 << "\"/>\n";
116} 121}
117 122
118void SLintXmlResult::print(const std::wstring & msg) 123void SLintXmlResult::print(const std::wstring & msg)
119{ 124{
120 (*out) << " <Message text=\"" << getStr(msg) 125 (*out) << " <Message text=\"" << getStr(msg)
121 << "\"/>\n"; 126 << "\"/>\n";
122} 127}
123 128
124std::wstring SLintXmlResult::replaceByEntities(const std::wstring & seq) 129std::wstring SLintXmlResult::replaceByEntities(const std::wstring & seq)