<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title></title>
</head>
<body style="font-family:Arial;font-size:14px">
<p>Quoting Stéphane Mottelet <<a href="mailto:stephane.mottelet@utc.fr">stephane.mottelet@utc.fr</a>>:</p>
<blockquote style="border-left:2px solid blue;margin-left:2px;padding-left:12px;" type="cite">
<div class="moz-cite-prefix">Le 02/03/2018 à 13:00, Stéphane Mottelet a écrit :</div>
<blockquote cite="mid:9346748e-5d1f-4b6f-8b4c-e1054ece8eb4@utc.fr" type="cite">
<div class="moz-cite-prefix">Le 01/03/2018 à 23:44, Samuel Gougeon a écrit :</div>
<blockquote cite="mid:db1e1be3-fe01-738c-f252-05978e30deb1@free.fr" type="cite">
<p>Le 01/03/2018 à 23:26, Stéphane Mottelet a écrit :<br></p>
<blockquote type="cite">
<p>Le 01/03/2018 à 21:57, Stéphane Mottelet a écrit :<br></p>
<blockquote type="cite">
<p>Hello,<br>
<br></p>
<blockquote type="cite">
<p>Le 1 mars 2018 à 20:18, Samuel Gougeon <a class="moz-txt-link-rfc2396E" href="mailto:sgougeon@free.fr" moz-do-not-send="true"><sgougeon@free.fr></a> a écrit :<br>
<br></p>
<blockquote type="cite">
<p>Le 01/03/2018 à 20:09, Stéphane Mottelet a écrit :<br>
Hello,<br>
<br>
I have tried to implement a (naïve) hijacking mechanism that works *like a charm* under scilab 5.5.2:<br>
<br>
newfun('scilab_set',funptr('set'));<br>
clearfun('set');<br>
function set(varargin)<br>
    scilab_set(varargin(:))<br>
    printf("...\n")<br>
endfunction<br>
// test the hijacked "set"<br>
f=gcf()<br>
set(f,"tag","1")<br>
f.tag="2"<br>
<br>
When I test this under  6.0.0 or 6.0.1, the last line always crashes Scilab. Is there an evident reason why ? When trying this on the command line (scilab -nw)<br>
<br></p>
<blockquote type="cite">
<p>--> set(f,"tag","1")<br>
...<br>
<br>
--> f.tag="2"<br>
...<br>
/Applications/scilab-6.0.1.app/Contents/MacOS/bin/scilab: line 972: 27117 Illegal instruction: 4  "$SCILABBIN" "$@"</p>
</blockquote>
I can see that the problem occurs *after* the insertion code f.tag="2" has delegated the operation to the hijacked "set", hence the crash occurs in the built-in function which does the insertion. In order to understand why this crash occurs (under Linux or OSX), I would like to know which module is in charge of the insertion for handles (a kind of %h_i but built-in) ?</blockquote>
You may have a look at<br>
SCI\modules\graphic_objects\src\cpp\setGraphicObjectProperty.cpp<br>
and<br>
SCI\modules\graphic_objects\src\java\org\scilab\modules\graphic_objects\*</blockquote>
Hmm, the crash occurs *after* the property has been set. So my question was rather about the generic code that handles field insertion, which is delegated to “set” for handles.<br>
<br>
S.<br>
 </blockquote>
<br>
I have localized many methods for handle type in modules/ast/src/cpp/types/graphichandle.cpp. Although I don't know much of C++, I can see that GraphicHandle::invoke is delegated to the overloaded %h_e macro, hence is an extraction method, but I am not able to find any *insertion* method in this file. Maybe someone knows ?</blockquote>
<br>
Maybe<br>
edit generic_i_h</blockquote>
I found it in modules/ast/src/cpp/ast/visitor_common.cpp<br>
<br>
When you don't have any idea of where to look, sometimes a "grep theStringToFind -r ." is useful :<br>
<br>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2241" id="l2241" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2241</a>         else if (_pVar->isHandle())</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2242" id="l2242" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2242</a>         {</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2243" id="l2243" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2243</a>             if (_pArgs->size() == 1 && (*_pArgs)[0]->isString())</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2244" id="l2244" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2244</a>             {</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2245" id="l2245" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2245</a>                 //s(["x"])</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2246" id="l2246" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2246</a>                 types::GraphicHandle* pH = _pVar->getAs<types::GraphicHandle>();</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2247" id="l2247" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2247</a>                 types::String *pS = (*_pArgs)[0]->getAs<types::String>();</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2248" id="l2248" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2248</a>                 types::typed_list in;</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2249" id="l2249" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2249</a>                 types::typed_list out;</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2250" id="l2250" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2250</a>                 types::optional_list opt;</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2251" id="l2251" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2251</a></div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2252" id="l2252" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2252</a>                 in.push_back(pH);</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2253" id="l2253" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2253</a>                 in.push_back(pS);</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2254" id="l2254" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2254</a>                 in.push_back(_pInsert);</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2255" id="l2255" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2255</a></div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; color: rgb(0, 0, 0);"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2256" id="l2256" moz-do-not-send="true" style="text-decoration: none; color: rgb(153, 153, 153);">2256</a>                 types::Function* pCall = (types::Function*)symbol::Context::getInstance()->get(symbol::Symbol(L"set"));</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2257" id="l2257" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2257</a>                 if (pCall)</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2258" id="l2258" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2258</a>                 {</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2259" id="l2259" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2259</a>                     types::Callable::ReturnValue ret = pCall->call(in, opt, 1, out);</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2260" id="l2260" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2260</a>                     if (ret == types::Callable::OK)</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2261" id="l2261" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2261</a>                     {</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2262" id="l2262" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2262</a>                         pRet = _pVar;</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2263" id="l2263" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2263</a>                     }</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2264" id="l2264" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2264</a>                     else</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2265" id="l2265" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2265</a>                     {</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2266" id="l2266" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2266</a>                         throw ast::InternalError(ConfigVariable::getLastErrorMessage(), ConfigVariable::getLastErrorNumber(), e.getLocation());</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2267" id="l2267" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2267</a>                     }</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2268" id="l2268" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2268</a>                 }</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2269" id="l2269" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2269</a>             }</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2270" id="l2270" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2270</a>             else</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2271" id="l2271" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2271</a>             {</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2272" id="l2272" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2272</a>                 pRet = _pVar->getAs<types::GraphicHandle>()->insert(_pArgs, _pInsert);</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2273" id="l2273" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2273</a>             }</div>
<div class="pre" style="font-family: monospace; font-size: 12px; white-space: pre; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><a class="linenr" href="http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/ast/src/cpp/ast/visitor_common.cpp;h=6379d14e630d747599fd48e0e9cfa907cab214cd;hb=b5bcf45d3328c87b56ed5d8f9dbec623504f7c9b#l2274" id="l2274" moz-do-not-send="true" style="color: rgb(153, 153, 153); text-decoration: none;">2274</a>         }</div>
<br>
here one can see the delegation to "set" at line 2256...2259. However, the internal overload mechanism is still very obscure to me. Now that I can build scilab_master on my Linux machine, I have played a little bit and replaced lines 2246..2268 by the sole lines<br>
<br>
<span style="color: rgb(0, 0, 0); font-family: monospace; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">pRet = callOverload(e, L"i", _pArgs, _pInsert, _pVar); sciprint("after</span> <span style="color: rgb(0, 0, 0); font-family: monospace; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"><span style="color: rgb(0, 0, 0); font-family: monospace; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">callOverload</span>\n")</span>
<p>then recompiled the ast module. The result is a scilab with a fully working graphics, e.g. typing "plot" without arguments works as usual and triggers a lot of handle insertions (a bunch of "after callOverload" are printed). However, there is no %h_i macro, so I don't understand by which miracle it could work.</p>
<p>Antoine it think that you are the author of this file (/ast/src/cpp/ast/visitor_common.cpp) can you explain how it works ?</p>
<p>Thanks in advance,</p>
<p>S.</p>
</blockquote>
Ok, no miracle... in fact, if the callOverload is forced as explained above, then generic_i_h is called (thanks Samuel for your hint), and generic_i_h itself calls "set". So this is almost equivalent, besides the fact that "set" is called from a Scilab macro and not from visitor_common.cpp above. With this solution the hijacking I had proposed does not crash anymore.<br>
<br>
But after all these complications, I guess that there may be a more straightforward way of implementing new handle properties at the user level...</blockquote>
<p>To finish on this subject and maybe feed the conversation on this subject, here is the final set/get hijacking code and and a simple example of what if allows to do: e.g. here we add a 'xlim' property to the Axes entity. At the user level it is enough to write the two functions  %Axes_set_xlim_property and %Axes_get_xlim_property(varargin). Of course, this works only if the "set" hijacking does not crash scilab, which needs the hack into modules/ast/src/cpp/ast/visitor_common.cpp describe above.<br>
<br>
S.<br>
<br>
<span style="font-family:courier new,courier,monospace;">newfun('scilab_set',funptr('set'));<br>
clearfun('set');<br>
newfun('scilab_get',funptr('get'));<br>
clearfun('get');<br>
function set(varargin)<br>
    try<br>
        if length(varargin)==3           <br>
            execstr('%'+sprintf('%s_set_%s_property(varargin(:))',...<br>
            scilab_get(varargin(1),'type'),varargin(2)))<br>
        end<br>
    catch<br>
        scilab_set(varargin(:))<br>
    end<br>
end<br>
<br>
function out=get(varargin)<br>
    try<br>
        if length(varargin)==2    <br>
            out=evstr('%'+sprintf('%s_get_%s_property(varargin(:))',...<br>
            scilab_get(varargin(1),'type'),varargin(2));<br>
        else<br>
            out=scilab_get(varargin(:))<br>
        end<br>
    catch<br>
        out=scilab_get(varargin(:))<br>
    end<br>
end<br>
<br>
<strong>function %Axes_set_xlim_property(varargin)<br>
    varargin(1).data_bounds(1:2)=varargin(3)(:);<br>
end<br>
<br>
function out=%Axes_get_xlim_property(varargin)<br>
    out=varargin(1).data_bounds(1:2);<br>
end</strong><br>
<br>
<strong>clf<br>
plot<br>
a=gcf().children<br>
a(2).xlim=[2 4];<br>
disp(a(1).xlim)</strong></span><br>
<br>
<br></p>
</body>
</html>