<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Le 05/03/2016 00:00, Samuel Gougeon a
      écrit :<br>
    </div>
    <blockquote cite="mid:56DA13A6.5090206@free.fr" type="cite">
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">Le 04/03/2016 23:33, Samuel Gougeon a
        écrit :<br>
      </div>
      <blockquote cite="mid:56DA0D4A.8090703@free.fr" type="cite">
        <meta content="text/html; charset=windows-1252"
          http-equiv="Content-Type">
        <div class="moz-cite-prefix">Le 02/03/2016 12:24, David Chèze a
          écrit :<br>
        </div>
        <blockquote cite="mid:1456917849551-4033598.post@n3.nabble.com"
          type="cite">
          <pre wrap="">Hi all,

I would like to define a variable in a user module in such a way that this
constant would be available for all functions (also out of the module) as a
"hidden(you don't need to see it inbrowsvar), protected (should not be
possible to clear it, even with clearglobal )" global variable as soon the
module is loaded: do you have suggestions how to do it within scilab?</pre>
        </blockquote>
        <br>
        There is still no actual solution to protect variables against
        clear.<br>
      </blockquote>
      .<br>
      Actually, there are one or two solutions :<br>
      <ol>
        <li> Set and store your constants in a TCL session (the main one
          or a slave), and recall them from it. Data in TCL sessions are
          not cleared by clear() nor by clearglobal(). This is what i
          use in drivers published on the fileexchange to set/get
          "persistent" communication parameters with devices.<br>
        </li>
        <li>May be the same could be possible with java objects? I have
          never tried.</li>
        <li>Another solution is to use the userdata field of the default
          figure. The default figure (gdf()) is not clearable. But then
          all your graphic windows will embed your constants in their
          .userdata. So it is preferable not to have MBytes of
          constantes ;) And to set a struct() in userdata. This is a
          rather bad hacking.<br>
        </li>
      </ol>
      May be there are other solutions. Let's free your imagination :)<br>
    </blockquote>
    Yes there is at least another one :-; : use the user_data field of
    an unvisible graphic window<br>
    fig=figure("visible","off","user_data",struct("A",123,"b","FOO"));<br>
    <br>
    a=fig.user_data.A<br>
    Serge<br>
    <blockquote cite="mid:56DA13A6.5090206@free.fr" type="cite"> <br>
      Samuel<br>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>