From 84962245aa0a65df7f1928df880f05b682bb1f33 Mon Sep 17 00:00:00 2001 From: kinoshita-eos Date: Thu, 22 Jan 2015 09:50:55 +0900 Subject: [PATCH] Add: PIONE tutorial of Loop Statement with constraint or sequence. new file: SampleCode/PIONE/Basic11/EvenOddLoop3.pione new file: SampleCode/PIONE/Basic11/LoopTouch3.pione new file: SampleCode/PIONE/Basic11/LoopTouch4.pione Add: PIONE tutorial of if Statement for Debug. new file: SampleCode/PIONE/Basic7/ForDebug.pione new file: SampleCode/PIONE/Basic7/input/1.txt new file: SampleCode/PIONE/Basic7/input/2.txt --- SampleCode/PIONE/Basic11/EvenOddLoop3.pione | 42 ++++++++++++++++++++++++++++ SampleCode/PIONE/Basic11/LoopTouch3.pione | 24 ++++++++++++++++ SampleCode/PIONE/Basic11/LoopTouch4.pione | 23 +++++++++++++++ SampleCode/PIONE/Basic7/ForDebug.pione | 43 +++++++++++++++++++++++++++++ SampleCode/PIONE/Basic7/input/1.txt | 5 ++++ SampleCode/PIONE/Basic7/input/2.txt | 3 ++ 6 files changed, 140 insertions(+) create mode 100644 SampleCode/PIONE/Basic11/EvenOddLoop3.pione create mode 100644 SampleCode/PIONE/Basic11/LoopTouch3.pione create mode 100644 SampleCode/PIONE/Basic11/LoopTouch4.pione create mode 100644 SampleCode/PIONE/Basic7/ForDebug.pione create mode 100644 SampleCode/PIONE/Basic7/input/1.txt create mode 100644 SampleCode/PIONE/Basic7/input/2.txt diff --git a/SampleCode/PIONE/Basic11/EvenOddLoop3.pione b/SampleCode/PIONE/Basic11/EvenOddLoop3.pione new file mode 100644 index 0000000..a0ff8e2 --- /dev/null +++ b/SampleCode/PIONE/Basic11/EvenOddLoop3.pione @@ -0,0 +1,42 @@ +param $maxval := 456 +param $minval := 123 +param $dval := 37 + +Rule Main + output '*.txt'.all +Flow + rule LoopSystem {val: $minval} +End + +Rule LoopSystem + output '*.txt'.all + param $val + constraint $val <= $maxval +Flow + rule EvenOdd {val: $val} + rule LoopSystem {val: (($val * 2) - $minval) + ($dval * (1|2))} +End + +Rule EvenOdd + output '*.txt' + param $val +Flow + if $val % 2 == 0 + rule Even {val: $val} + else + rule Odd {val: $val} + end +End + +Rule Even + output '*.txt' + param $val +Action + echo "{$val} is even." >> Even{$val}.txt; +End + +Rule Odd + output '*.txt' +Action + echo "{$val} is odd." >> Odd{$val}.txt; +End \ No newline at end of file diff --git a/SampleCode/PIONE/Basic11/LoopTouch3.pione b/SampleCode/PIONE/Basic11/LoopTouch3.pione new file mode 100644 index 0000000..bdedcf3 --- /dev/null +++ b/SampleCode/PIONE/Basic11/LoopTouch3.pione @@ -0,0 +1,24 @@ +param $max := 64 + +Rule Main + output '*.txt' +Flow + rule LoopSystem {val: 0} +End + +Rule LoopSystem + output '*.txt' + param $val + constraint $val <= $max +Flow + rule Test {val: $val} + rule LoopSystem {val: ($val * 2) + 1} + rule LoopSystem {val: ($val * 2) + 2} +End + +Rule Test + output '{$val}.txt' + param $val +Action + touch {$O[1]} +End \ No newline at end of file diff --git a/SampleCode/PIONE/Basic11/LoopTouch4.pione b/SampleCode/PIONE/Basic11/LoopTouch4.pione new file mode 100644 index 0000000..69926a2 --- /dev/null +++ b/SampleCode/PIONE/Basic11/LoopTouch4.pione @@ -0,0 +1,23 @@ +param $max := 64 + +Rule Main + output '*.txt' +Flow + rule LoopSystem {val: 0} +End + +Rule LoopSystem + output '*.txt' + param $val + constraint $val <= $max +Flow + rule Test {val: $val} + rule LoopSystem {val: ($val * 2) + (1|2)} +End + +Rule Test + output '{$val}.txt' + param $val +Action + touch {$O[1]} +End \ No newline at end of file diff --git a/SampleCode/PIONE/Basic7/ForDebug.pione b/SampleCode/PIONE/Basic7/ForDebug.pione new file mode 100644 index 0000000..33475a7 --- /dev/null +++ b/SampleCode/PIONE/Basic7/ForDebug.pione @@ -0,0 +1,43 @@ +$LogFlag := false +$LogFile := '{$I[1][1]}.log' + +Rule Main + input '*.txt' + output '{$I[1][1]}.out' + if $LogFlag + output $LogFile + end +Flow + rule Sub1 +End + +Rule Sub1 + input '*.txt' + output '{$I[1][1]}.out' + if $LogFlag + output $LogFile + end +Flow + rule Sub2 +End + +Rule Sub2 + input '*.txt' + output '{$I[1][1]}.out' + if $LogFlag + output $LogFile + end +Flow + rule Sub3 +End + +Rule Sub3 + input '*.txt' + output '{$I[1][1]}.out' + output $LogFile +Action + touch {$O[1]} + if [ {$LogFlag} ] ; then + wc {$I[1]} > {$O[2]} + fi +End \ No newline at end of file diff --git a/SampleCode/PIONE/Basic7/input/1.txt b/SampleCode/PIONE/Basic7/input/1.txt new file mode 100644 index 0000000..33a0a15 --- /dev/null +++ b/SampleCode/PIONE/Basic7/input/1.txt @@ -0,0 +1,5 @@ +1234 +56789 +0qwe +rt +y diff --git a/SampleCode/PIONE/Basic7/input/2.txt b/SampleCode/PIONE/Basic7/input/2.txt new file mode 100644 index 0000000..99de5ac --- /dev/null +++ b/SampleCode/PIONE/Basic7/input/2.txt @@ -0,0 +1,3 @@ +!!!!!!!!!!!!!!!!! +DDDDDDDDDDDDDDDDD +!!!!!!!!!!!!!!!!! -- 2.11.0