Page History
HTML |
---|
<div class="section" id="definition-files-migration"> <span id="def-files"></span><span id="index-0"></span> <p>This can be the most interesting part, requiring choices for</p> <ul class="simple"> <li>suite durability</li> <li>common libraries coding</li> <li>ensuring maintainability</li> </ul> <p>The CDP client provides an environment where CDP variables, aliases and functions are global entities. Choosing ksh to design a suite will lead to similar concepts and practices. Choosing the Python language can lead to deeper changes.</p> <p>Milestones are:</p> <ul class="simple"> <li>the expanded definition file generation</li> <li>the expanded definition file load into ecFlow server</li> <li>running the (e)suite</li> <li>eventually, expanded definition files played into SMS server, and run as (e)suite</li> </ul> <p>Language correspondence:</p> <table border="1" class="docutils"> <colgroup> <col width="36%" /> <col width="36%" /> <col width="28%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">CDP</th> <th class="head">ksh</th> <th class="head">Python</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td>if (math) then cmds; else cmds; endif</td> <td>if ((math)); then cmds; else cmds; fi</td> <td>if math: cmds; else: cmds</td> </tr> <tr class="row-odd"><td>while (math) do cmds; endwhile</td> <td>while ((math)); do cmds; done</td> <td>while math: cmds</td> </tr> <tr class="row-even"><td>loop VAR (spaced_list) do cmds; endloop</td> <td>for VAR in spaced_list; do cmds; done</td> <td>for VAR in list:</td> </tr> <tr class="row-odd"><td>case VAR</td> <td>case $VAR in</td> <td>if VAR in [comma_list]:</td> </tr> <tr class="row-even"><td>in (spaced_list) do cmds; endin</td> <td>piped_list) cmds;;</td> <td> </td> </tr> <tr class="row-odd"><td>in ( ) do cmds; endin</td> <td>*) cmds;;</td> <td>else:</td> </tr> <tr class="row-even"><td>endcase</td> <td>esac</td> <td> </td> </tr> <tr class="row-odd"><td>for VAR math1 math2; do</td> <td>var=math1; while ((var < math2)); do</td> <td>var=math1; while var<math2:</td> </tr> <tr class="row-even"><td>for VAR math1 math2 step math3; do</td> <td>var=math1; while ((var < math2)); do var=$((var+math3))</td> <td><dl class="first last docutils"> <dt>var=math1; while var<math2:</dt> <dd>var=var+math3</dd> </dl> </td> </tr> <tr class="row-odd"><td>endfor</td> <td>done</td> <td> </td> </tr> <tr class="row-even"><td>$ shell_cmd</td> <td><native></td> <td>popen2.popen2(“cmd”)</td> </tr> <tr class="row-odd"><td>% cshell_cmd</td> <td>csh</td> <td> </td> </tr> <tr class="row-even"><td>< file_include</td> <td>. file_include</td> <td>import library</td> </tr> <tr class="row-odd"><td>alias a cmds ; cmds2</td> <td>alias a=”cmds; cmds2”</td> <td>def a: cmds; cmds2</td> </tr> <tr class="row-even"><td>set variable value</td> <td>variable=value</td> <td>variable=”value”</td> </tr> <tr class="row-odd"><td>variable=math</td> <td>variable=$((math))</td> <td>variable=math</td> </tr> <tr class="row-even"><td>variable=`shell_cmd`</td> <td>variable=$(shell_cmd)</td> <td><use popen2></td> </tr> <tr class="row-odd"><td>man</td> <td>man / help</td> <td>help()</td> </tr> <tr class="row-even"><td>echo</td> <td>echo / print</td> <td>print</td> </tr> <tr class="row-odd"><td># comment</td> <td># comment</td> <td># comment</td> </tr> <tr class="row-even"><td>set debug on</td> <td>set -eux</td> <td>python -m trace -t pylint coverage</td> </tr> </tbody> </table> </div> |