From 65f98485f9058934d68e8f578cc5a42a36139168 Mon Sep 17 00:00:00 2001 From: Samuel GOUGEON Date: Thu, 18 Jul 2019 12:36:10 +0200 Subject: [PATCH] getPreferencesValue() Actual removal * http://bugzilla.scilab.org/15433 * after obsolescence @ https://codereview.scilab.org/19817 * for Scilab 6.1.(x>0) ? Change-Id: I5f6752e7f2356997488d9e8e80b89f0cb3f44b37 --- scilab/CHANGES.md | 1 + .../helptools/data/configuration/scilab_macros.txt | 1 - scilab/modules/io/help/en_US/load.xml | 32 +-- .../preferences/help/en_US/getPreferencesValue.xml | 284 -------------------- .../preferences/help/ja_JP/getPreferencesValue.xml | 154 ----------- scilab/modules/preferences/locales/preferences.pot | 21 +- .../preferences/macros/getPreferencesValue.sci | 106 -------- 7 files changed, 18 insertions(+), 581 deletions(-) delete mode 100644 scilab/modules/preferences/help/en_US/getPreferencesValue.xml delete mode 100644 scilab/modules/preferences/help/ja_JP/getPreferencesValue.xml delete mode 100644 scilab/modules/preferences/macros/getPreferencesValue.sci diff --git a/scilab/CHANGES.md b/scilab/CHANGES.md index 710a188..5fe0c60 100644 --- a/scilab/CHANGES.md +++ b/scilab/CHANGES.md @@ -157,6 +157,7 @@ Obsolete functions or features Removed Functions ----------------- +* `getPreferencesValue` was obsolete and has been removed. Please use `xmlGetValues` instead. * `hypermat` was obsolete and has been removed. Please use `matrix` instead. * `square` was obsolete and has been removed. * `xgetech` was obsolete and has been removed. Please use `gca` instead. diff --git a/scilab/modules/helptools/data/configuration/scilab_macros.txt b/scilab/modules/helptools/data/configuration/scilab_macros.txt index 16682d4..8ccc05a 100644 --- a/scilab/modules/helptools/data/configuration/scilab_macros.txt +++ b/scilab/modules/helptools/data/configuration/scilab_macros.txt @@ -1,5 +1,4 @@ %_EVoid_p -getPreferencesValue setPreferencesValue tbx_build_blocks tbx_build_cleaner diff --git a/scilab/modules/io/help/en_US/load.xml b/scilab/modules/io/help/en_US/load.xml index 39d1a80..65aebb6 100644 --- a/scilab/modules/io/help/en_US/load.xml +++ b/scilab/modules/io/help/en_US/load.xml @@ -71,14 +71,14 @@ - The list of variables stored in a file can be retrieved with the - listvarinfile function. + The list of variables stored in a file can be retrieved with the + listvarinfile function. - load() loads restores variables in the current scope - (not on the global one). + load() loads restores variables in the current scope + (not on the global one). @@ -87,8 +87,8 @@ - If a restored variable has the same name as an existing variable of - the current scope, the current variable is silently overwritten. + If a restored variable has the same name as an existing variable of + the current scope, the current variable is silently overwritten. @@ -151,7 +151,7 @@ The library's name can be retrieved with - getPreferencesValue("/scilablib", "name", "/path/to/lib"), + xmlGetValues("/scilablib", "name", "/path/to/lib"), where "/path/to/lib" is replaced with the actual pathname of the lib file. @@ -192,7 +192,7 @@ d, i, b, t, s, p, r save("TMPDIR/val.dat", "%e"); load("TMPDIR/val.dat"); ]]> - load("TMPDIR/val.dat"); Redefining permanent variable. ]]> @@ -208,7 +208,7 @@ save(TMPDIR+"/test.scg", "a3", "a1") clf reset load(TMPDIR+"/test.scg") ]]> - load("TMPDIR/val.dat"); Redefining permanent variable. ]]> @@ -218,11 +218,11 @@ Redefining permanent variable. - getPreferencesValue("/scilablib", "name", path) + xmlGetValues("/scilablib", "name", path) ans = Thresholdlib @@ -232,10 +232,10 @@ Functions files location : SCI\modules\scicos_blocks\macros\Threshold\. GENERAL_f ZCROSS_f NEGTOPOS_f POSTONEG_f ]]> - - xcos() must be used to load a simulation diagram: - - + xcos() must be used to load a simulation diagram: + + error xcos(path) diff --git a/scilab/modules/preferences/help/en_US/getPreferencesValue.xml b/scilab/modules/preferences/help/en_US/getPreferencesValue.xml deleted file mode 100644 index 9349fd5..0000000 --- a/scilab/modules/preferences/help/en_US/getPreferencesValue.xml +++ /dev/null @@ -1,284 +0,0 @@ - - - - - getPreferencesValue - Parses and gets values of chosen tags attributes in a XML file of preferences - (obsolete) - - - - Syntax - - Values = getPreferencesValue(path2tag, attributes) - Values = getPreferencesValue(path2tag, attributes, XMLsource) - - - - Arguments - - - path2tag - - - unique string: in the XML source file, path targeting a chosen tag whose - attributes must be read. The path is the list of nested tags leading to the - required one, such as "/a/b/c/d", or equivalently - "//b/c/d". It is case-sensitive. - - - - - attributes - - - vector or matrix of strings: names of attributes of the chosen tag, whose values - must be read. The order of attributes does not matter wrt their actual order in - the tag. - - - - Attributes names are case-sensitive. - - - If needed, the name of a given attribute may be specified several times. - - - - - - - - XMLsource - - - points to the XML document from which informations must be extracted. It - can be one of the following: - - - unique string: path to the XML source file (where preferences are - registered). By default, - SCIHOME+'/XConfiguration.xml' is considered. - - - XML handle of type XMLdoc, as returned by a - prior xmlRead(XMLsource) external instruction. - - - - - - - Values - - - matrix of strings: Values of the chosen attributes of the chosen tag: - - - If the set of chosen attributes is provided as a - matrix with several rows, then only the first occurrence of the chosen - tag is considered, and Values(i,j) is the value of - its attributes(i,j). - - - Otherwise, if the names of attributes are - provided in a row vector, then - all occurences of the chosen tag - are considered: Results are returned with one row per occurrence, - and one colum per attribute. Thus, Values(i,j) - is the value of the attributes(j) for the - - ith - - occurrence of the - tag in the document. - - - If some final values are expected to be numeric rather than literal (text), - evstr() may be applied to them to get expected numbers. - - - - - - - Description - - getPreferencesValue() is obsolete. It is cloned into - xmlGetValues(). It will be removed from Scilab 6.1.x - - - When an XML handle returned by xmlRead(..) is provided as - XMLsource, getPreferencesValue() uses it - directly to parse the XML Preferences document opened by this prior - xmlRead(..). This is useful when the same document must be parsed with - multiple calls to getPreferencesValue(), typically to address - different XML tags. In this case, one should not forget to close the XML document after - its whole processing. - - - When the path of the XML Preferences file is provided as XMLsource, - getPreferencesValue() opens the file, builds its DOM tree, parses - the tree for the chosen tag and attributes, and finally deletes the tree and closes the - file before returning results. This is what occurs with the default Xconfiguration.xml - file when no explicit XMLsource is specified. - - - The path2tag argument must be a valid "XPath" according to the - W3C recommendations. - Examples are given herebelow. If the path uses a intermediate or a final tag that does - not exist, or if one of the queried attributes does not exist, an error is yielded. - - - - Examples - Example 1: - - Your web and proxy settings for Scilab are stored in the default - SCIHOME+'/XConfiguration.xml' preferences file. Let's consider the - following excerpt of the file: - - - - ... - - - - - - - - - ... - - ]]> - - - To get some informations about the proxy parameters (proxy tag), the required code - will be: - - - - Example 2: - - - getPreferencesValue() can also be used to get values of a tag - having multiple occurrences in the XMLsource file. For instance, - your preferences for the Scilab's editor Scinotes are stored in the - SCIHOME\scinotesConfiguration.xml file. The list of most recent files - opened in Scinotes is stored in the following part and path: - - - - - - - - - - - - - - - - ]]> - - - Then, the following code will extract, return and display the column of recent files: - - - - - - See also - - - xmlGetValues - - - xmlSetValues - - - xmlXPath - - - XML path language - - - xmlRead - - - xmlDelete - - - atomsGetConfig - - - printsetupbox - - - csvDefault - - - - - History - - - 5.5.0 - getPreferencesValue() introduced. - - - - 6.0.0 - - - - XMLsource can now be the path + filename of the preferences file. - - - A tag with multiple occurrences can now be read. - - - - - - 6.0.2 - getPreferencesValue() is cloned into xmlGetValues(). It is - declared obsolete and will be removed from Scilab 6.1.x - - - - - diff --git a/scilab/modules/preferences/help/ja_JP/getPreferencesValue.xml b/scilab/modules/preferences/help/ja_JP/getPreferencesValue.xml deleted file mode 100644 index 8678c28..0000000 --- a/scilab/modules/preferences/help/ja_JP/getPreferencesValue.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - - - getPreferencesValue - 設定値を取得 (非推奨) - - - 呼び出し手順 - - getPreferencesValue(xpath, attributes [, doc]) - - - - 引数 - - - xpath - - 文字列, - 設定ファイルのノードを取得する - XPathリクエストを表す. - - - - - attributes - - 文字列の行列, 属性名. - - - - - - doc - - XMLDoc型のmlist, 設定ファイルのXML文書. - - - - - - - 説明 - - getPreferencesValue() is obsolete. It is cloned into - xmlGetValues(). It will be removed from Scilab 6.1.x - - - 設定ファイル(SCIHOME+'/XConfiguration.xml')の - 属性の値を取得します. - - - docを指定した場合, 値はこの文書内で探されます. - 複数のリクエストを実行する必要がある際, - 同じ設定ファイルを重複してパースすることを避けるために - 有用です. - - - 有効な任意のXPathリクエストを指定できます. - 例えば,proxy設定を取得するXPathリクエストは以下のように - 記述できます: - - - - - ファイルSCIHOME+'/XConfiguration.xml' - を開き,指定したノードにアクセスするためのノード名を - 取得します: - - - - - ... - - - - - - - - - ... - - ]]> - - パスは"/interface/web/body/proxy" - (または簡単化するために"//web/body/proxy") - となります. - - - - - - 例 - - - - 参照 - - - xmlGetValues - - - xmlSetValues - - - - - History - - - 5.5.0 - getPreferencesValue() introduced. - - - - 6.0.0 - - - - XMLsource can now be the path + filename of the preferences file. - - - A tag with multiple occurrences can now be read. - - - - - - 6.0.2 - getPreferencesValue() is cloned into xmlGetValues(). It is - declared obsolete and will be removed from Scilab 6.1.x - - - - - diff --git a/scilab/modules/preferences/locales/preferences.pot b/scilab/modules/preferences/locales/preferences.pot index f9b07f5..3a21574 100644 --- a/scilab/modules/preferences/locales/preferences.pot +++ b/scilab/modules/preferences/locales/preferences.pot @@ -127,68 +127,49 @@ msgstr "" msgid "Save" msgstr "" -# File: modules/preferences/macros/getPreferencesValue.sci, line: 20 +# # File: modules/preferences/macros/setPreferencesValue.sci, line: 24 #, c-format msgid "%s: Wrong number of input arguments: %d or %d expected.\n" msgstr "" # -# File: modules/preferences/macros/getPreferencesValue.sci, line: 25 # File: modules/preferences/macros/setPreferencesValue.sci, line: 28 #, c-format msgid "%s: Wrong type for input argument #%d: String expected.\n" msgstr "" # -# File: modules/preferences/macros/getPreferencesValue.sci, line: 30 # File: modules/preferences/macros/setPreferencesValue.sci, line: 32 #, c-format msgid "%s: Wrong type for input argument #%d: Matrix of strings expected.\n" msgstr "" # -# File: modules/preferences/macros/getPreferencesValue.sci, line: 44 -#, c-format -msgid "%s: Invalid %s file.\n" -msgstr "" - -# -# File: modules/preferences/macros/getPreferencesValue.sci, line: 48 -#, c-format -msgid "%s: The file %s does not exist.\n" -msgstr "" - -# -# File: modules/preferences/macros/getPreferencesValue.sci, line: 52 # File: modules/preferences/macros/setPreferencesValue.sci, line: 46 #, c-format msgid "%s: Wrong type for input argument #%d: A XMLDoc expected.\n" msgstr "" # -# File: modules/preferences/macros/getPreferencesValue.sci, line: 62 # File: modules/preferences/macros/setPreferencesValue.sci, line: 55 #, c-format msgid "%s: Invalid XPath request.\n" msgstr "" # -# File: modules/preferences/macros/getPreferencesValue.sci, line: 70 # File: modules/preferences/macros/setPreferencesValue.sci, line: 62 #, c-format msgid "%s: Invalid XPath request." msgstr "" # -# File: modules/preferences/macros/getPreferencesValue.sci, line: 81 # File: modules/preferences/macros/setPreferencesValue.sci, line: 70 #, c-format msgid "%s: Target node is not a XML_ELEMENT_NODE." msgstr "" # -# File: modules/preferences/macros/getPreferencesValue.sci, line: 95 # File: modules/preferences/macros/setPreferencesValue.sci, line: 82 #, c-format msgid "%s: Invalid attribute name: %s." diff --git a/scilab/modules/preferences/macros/getPreferencesValue.sci b/scilab/modules/preferences/macros/getPreferencesValue.sci deleted file mode 100644 index f8e2275..0000000 --- a/scilab/modules/preferences/macros/getPreferencesValue.sci +++ /dev/null @@ -1,106 +0,0 @@ -// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab -// Copyright (C) 2014 - Scilab Enterprises - Calixte DENIZET -// Copyright (C) 2017 - Samuel GOUGEON -// -// Copyright (C) 2012 - 2016 - Scilab Enterprises -// -// This file is hereby licensed under the terms of the GNU GPL v2.0, -// pursuant to article 5.3.4 of the CeCILL v.2.1. -// This file was originally licensed under the terms of the CeCILL v2.1, -// and continues to be available under such terms. -// For more information, see the COPYING file which you should have received -// along with this program. - -function values = getPreferencesValue(xpath, attributes, doc) - - warnobsolete("xmlGetValues", "6.1"); - rhs = argn(2); - - if (rhs ~= 2 & rhs ~= 3) then - msg = _("%s: Wrong number of input arguments: %d or %d expected.\n") - error(msprintf(msg, "getPreferencesValue", 2, 3)); - end - - if type(xpath) <> 10 then - msg = _("%s: Wrong type for input argument #%d: String expected.\n") - error(msprintf(msg, "getPreferencesValue", 1)); - end - - if type(attributes) <> 10 then - msg = _("%s: Wrong type for input argument #%d: Matrix of strings expected.\n") - error(msprintf(msg, "getPreferencesValue", 2)); - end - - if rhs == 2 then - doc = SCIHOME + "/XConfiguration.xml" - end - doc0 = doc - delDoc = (rhs == 2 | type(doc0)==10) - if type(doc)==10 then - if isfile(doc) - try - doc = xmlRead(doc0); - catch - msg = _("%s: Invalid ""%s"" file.\n") - error(msprintf(msg, "getPreferencesValue", tokens(doc0,["/" "\"])($))); - end - else - msg = _("%s: The file ""%s"" does not exist.\n") - error(msprintf(msg, "getPreferencesValue", doc)); - end - elseif typeof(doc) ~= "XMLDoc" then - msg = _("%s: Wrong type for input argument #%d: A XMLDoc expected.\n") - error(msprintf(msg, "getPreferencesValue", 3)); - end - - try - xp = xmlXPath(doc, xpath); - catch - if delDoc then - xmlDelete(doc); - end - msg = gettext("%s: Invalid XPath request.\n") - error(msprintf(msg, "getPreferencesValue")); - end - - if xp.size == 0 then - if delDoc then - xmlDelete(doc); - end - msg = gettext("%s: Invalid XPath request.") - error(msprintf(msg, "getPreferencesValue")); - end - - values = []; - for i = 1 : xp.size - node = xp(i); - if node.type ~= "XML_ELEMENT_NODE" then - if delDoc then - xmlDelete(doc); - end - msg = gettext("%s: Target node is not a XML_ELEMENT_NODE.") - error(msprintf(msg, "getPreferencesValue")); - end - - attr = node.attributes; - for j = 1:size(attributes,"*") - a = attributes(j) - v = attr(a); - if v ~= [] then - values(i,j) = v; - else - if delDoc then - xmlDelete(doc); - end - msg = gettext("%s: Invalid attribute name: %s.") - error(msprintf(msg, "getPreferencesValue", a)); - end - end - end - if xp.size==1 then - values = matrix(values, size(attributes)); - end - if delDoc then - xmlDelete(doc); - end -endfunction -- 1.7.9.5