diff --git a/Zadania_domowe/test2/zad1.cm b/Zadania_domowe/test2/zad1.cm new file mode 100644 index 0000000..04a0cb9 --- /dev/null +++ b/Zadania_domowe/test2/zad1.cm @@ -0,0 +1,17 @@ +monitor s{ + void a(){ + cout << "A"; + cout << "B"; + } + + void b(){ + cout << "C"; + cout << "D"; + } +} + +void proc1(){ a(); } +void proc2(){ b(); } +main(){ + cobegin { proc1(); proc2(); } +} diff --git a/Zadania_domowe/test2/zad1.lst b/Zadania_domowe/test2/zad1.lst new file mode 100644 index 0000000..4fe52b3 --- /dev/null +++ b/Zadania_domowe/test2/zad1.lst @@ -0,0 +1,20 @@ +BACI System: C-- to PCODE Compiler in C, 11:30 1 Oct 2012 +Source file: zad1.cm Mon Dec 10 11:09:29 2018 + line pc + 1 0 monitor s{ + 2 0 void a(){ + 3 1 cout << "A"; + 4 2 cout << "B"; + 5 3 } + 6 5 + 7 5 void b(){ + 8 6 cout << "C"; + 9 7 cout << "D"; + 10 8 } + 11 10 } + 12 11 + 13 11 void proc1(){ a(); } + 14 15 void proc2(){ b(); } + 15 19 main(){ + 16 20 cobegin { proc1(); proc2(); } + 17 28 } diff --git a/Zadania_domowe/test2/zad1.pco b/Zadania_domowe/test2/zad1.pco new file mode 100644 index 0000000..bc7d5b6 Binary files /dev/null and b/Zadania_domowe/test2/zad1.pco differ diff --git a/Zadania_domowe/test2/zad2.cm b/Zadania_domowe/test2/zad2.cm new file mode 100644 index 0000000..9697835 --- /dev/null +++ b/Zadania_domowe/test2/zad2.cm @@ -0,0 +1,18 @@ +monitor s{ + condition c; + int elem; + void pushElement(int val){ + elem = val; + signalc(c); + } + int getElement(){ + waitc(c); + return elem; + } + init { elem = 0; } +} +void prod() { pushElement(10); } +void kons() { cout << getElement(); } +main(){ + cobegin { prod(); kons(); }; +} diff --git a/Zadania_domowe/test2/zad2.lst b/Zadania_domowe/test2/zad2.lst new file mode 100644 index 0000000..5767841 --- /dev/null +++ b/Zadania_domowe/test2/zad2.lst @@ -0,0 +1,21 @@ +BACI System: C-- to PCODE Compiler in C, 11:30 1 Oct 2012 +Source file: zad2.cm Mon Dec 10 11:18:38 2018 + line pc + 1 0 monitor s{ + 2 0 condition c; + 3 0 int elem; + 4 0 void pushElement(int val){ + 5 1 elem = val; + 6 4 signalc(c); + 7 6 } + 8 8 int getElement(){ + 9 9 waitc(c); + 10 12 return elem; + 11 16 } + 12 18 init { elem = 0; } + 13 22 } + 14 22 void prod() { pushElement(10); } + 15 27 void kons() { cout << getElement(); } + 16 32 main(){ + 17 33 cobegin { prod(); kons(); }; + 18 41 } diff --git a/Zadania_domowe/test2/zad2.pco b/Zadania_domowe/test2/zad2.pco new file mode 100644 index 0000000..5500cb4 --- /dev/null +++ b/Zadania_domowe/test2/zad2.pco @@ -0,0 +1,93 @@ +BACI System: C-- to PCODE Compiler in C, 11:30 1 Oct 2012 +Source file: zad2.cm Mon Dec 10 11:18:38 2018 +0 44 PCODE table + lc f x y + 0 8 0 2 + 1 0 1 6 + 2 1 2 5 + 3 38 0 0 + 4 0 1 5 + 5 11 0 0 + 6 9 0 0 + 7 32 0 0 + 8 8 0 2 + 9 0 1 5 + 10 24 0 10 + 11 10 0 0 + 12 0 2 0 + 13 1 1 6 + 14 38 0 0 + 15 14 0 16 + 16 9 0 0 + 17 33 0 0 + 18 0 1 6 + 19 24 0 0 + 20 38 0 0 + 21 41 0 0 + 22 18 0 5 + 23 24 0 10 + 24 19 -1 5 + 25 3 0 1 + 26 32 0 0 + 27 18 0 7 + 28 19 -1 4 + 29 3 0 1 + 30 29 0 1 + 31 32 0 0 + 32 80 0 42 + 33 4 0 0 + 34 18 0 8 + 35 19 0 4 + 36 3 0 1 + 37 18 0 9 + 38 19 0 4 + 39 3 0 1 + 40 5 0 0 + 41 31 0 0 + 42 18 0 2 + 43 40 0 0 + 44 81 0 0 +1 10 IDENTIFIER table +index identifier link obj type ref normal lev adr mon atomic + 1 ++-outer-++ 0 7 0 0 1 0 42 0 0 + 2 s 1 5 0 1 1 0 18 0 0 + 3 c 0 1 6 0 1 1 5 0 0 + 4 elem 3 1 1 0 1 1 6 0 0 + 5 pushElement 2 3 0 2 1 1 0 2 0 + 6 val 0 1 1 0 1 2 5 0 0 + 7 getElement 5 4 1 3 1 1 8 2 0 + 8 prod 7 3 0 4 1 0 22 0 0 + 9 kons 8 3 0 5 1 0 27 0 0 + 10 main 9 6 0 6 1 0 32 0 0 +0 6 BLOCK table +index last lastpar psize vsize + 0 10 10 0 0 + 1 4 2 5 7 + 2 6 6 6 6 + 3 7 7 5 5 + 4 8 8 5 5 + 5 9 9 5 5 + 6 10 10 5 5 +0 -1 ARRAY table +index inxtype eltyp elref low high elsize size +0 0 60 STRING table +0 0 Input File array +index parent file name + 0 -1 zad2.cm +0 14 PCODE debugging information + lc findex flineno + 0 0 4 + 1 0 5 + 4 0 6 + 6 0 7 + 8 0 8 + 9 0 9 + 12 0 10 + 16 0 11 + 18 0 12 + 22 0 14 + 27 0 15 + 32 0 16 + 33 0 17 + 41 0 18 + 44 0 -18 diff --git a/Zadania_domowe/test2/zad3.cm b/Zadania_domowe/test2/zad3.cm new file mode 100644 index 0000000..575dfd3 --- /dev/null +++ b/Zadania_domowe/test2/zad3.cm @@ -0,0 +1,29 @@ +monitor s{ + condition c; + condition t; + int result; + int computed; + void complicatedCalculation(){ + result = 42; + computed = 1; + signalc(c); + signalc(t); + } + int askAboutUniverse(){ + if (computed != 1){ waitc(t); } + return result; + } + int getPizzaDiameter(){ + if (computed != 1){ waitc(c); } + return result; + } + init { result = 0; computed = 0; } +} + +void server() { complicatedCalculation(); } +void scientist() { cout << askAboutUniverse() << endl; } +void pizzerman() { cout << getPizzaDiameter() << endl; } + +main(){ + cobegin { server(); scientist(); pizzerman(); } +} diff --git a/Zadania_domowe/test2/zad3.lst b/Zadania_domowe/test2/zad3.lst new file mode 100644 index 0000000..cbf2b37 --- /dev/null +++ b/Zadania_domowe/test2/zad3.lst @@ -0,0 +1,32 @@ +BACI System: C-- to PCODE Compiler in C, 11:30 1 Oct 2012 +Source file: zad3.cm Mon Dec 10 11:50:29 2018 + line pc + 1 0 monitor s{ + 2 0 condition c; + 3 0 condition t; + 4 0 int result; + 5 0 int computed; + 6 0 void complicatedCalculation(){ + 7 1 result = 42; + 8 4 computed = 1; + 9 7 signalc(c); + 10 9 signalc(t); + 11 11 } + 12 13 int askAboutUniverse(){ + 13 14 if (computed != 1){ waitc(t); } + 14 21 return result; + 15 25 } + 16 27 int getPizzaDiameter(){ + 17 28 if (computed != 1){ waitc(c); } + 18 35 return result; + 19 39 } + 20 41 init { result = 0; computed = 0; } + 21 48 } + 22 48 + 23 48 void server() { complicatedCalculation(); } + 24 52 void scientist() { cout << askAboutUniverse() << endl; } + 25 58 void pizzerman() { cout << getPizzaDiameter() << endl; } + 26 64 + 27 64 main(){ + 28 65 cobegin { server(); scientist(); pizzerman(); } + 29 76 } diff --git a/Zadania_domowe/test2/zad3.pco b/Zadania_domowe/test2/zad3.pco new file mode 100644 index 0000000..02f54ca --- /dev/null +++ b/Zadania_domowe/test2/zad3.pco @@ -0,0 +1,140 @@ +BACI System: C-- to PCODE Compiler in C, 11:30 1 Oct 2012 +Source file: zad3.cm Mon Dec 10 11:50:29 2018 +0 79 PCODE table + lc f x y + 0 8 0 2 + 1 0 1 7 + 2 24 0 42 + 3 38 0 0 + 4 0 1 8 + 5 24 0 1 + 6 38 0 0 + 7 0 1 5 + 8 11 0 0 + 9 0 1 6 + 10 11 0 0 + 11 9 0 0 + 12 32 0 0 + 13 8 0 2 + 14 1 1 8 + 15 24 0 1 + 16 46 0 0 + 17 15 0 21 + 18 0 1 6 + 19 24 0 10 + 20 10 0 0 + 21 0 2 0 + 22 1 1 7 + 23 38 0 0 + 24 14 0 25 + 25 9 0 0 + 26 33 0 0 + 27 8 0 2 + 28 1 1 8 + 29 24 0 1 + 30 46 0 0 + 31 15 0 35 + 32 0 1 5 + 33 24 0 10 + 34 10 0 0 + 35 0 2 0 + 36 1 1 7 + 37 38 0 0 + 38 14 0 39 + 39 9 0 0 + 40 33 0 0 + 41 0 1 7 + 42 24 0 0 + 43 38 0 0 + 44 0 1 8 + 45 24 0 0 + 46 38 0 0 + 47 41 0 0 + 48 18 0 7 + 49 19 -1 4 + 50 3 0 1 + 51 32 0 0 + 52 18 0 8 + 53 19 -1 4 + 54 3 0 1 + 55 29 0 1 + 56 63 0 0 + 57 32 0 0 + 58 18 0 9 + 59 19 -1 4 + 60 3 0 1 + 61 29 0 1 + 62 63 0 0 + 63 32 0 0 + 64 80 0 77 + 65 4 0 0 + 66 18 0 10 + 67 19 0 4 + 68 3 0 1 + 69 18 0 11 + 70 19 0 4 + 71 3 0 1 + 72 18 0 12 + 73 19 0 4 + 74 3 0 1 + 75 5 0 0 + 76 31 0 0 + 77 18 0 2 + 78 40 0 0 + 79 81 0 0 +1 13 IDENTIFIER table +index identifier link obj type ref normal lev adr mon atomic + 1 ++-outer-++ 0 7 0 0 1 0 77 0 0 + 2 s 1 5 0 1 1 0 41 0 0 + 3 c 0 1 6 0 1 1 5 0 0 + 4 t 3 1 6 0 1 1 6 0 0 + 5 result 4 1 1 0 1 1 7 0 0 + 6 computed 5 1 1 0 1 1 8 0 0 + 7 complicatedC 2 3 0 2 1 1 0 2 0 + 8 askAboutUniv 7 4 1 3 1 1 13 2 0 + 9 getPizzaDiam 8 4 1 4 1 1 27 2 0 + 10 server 9 3 0 5 1 0 48 0 0 + 11 scientist 10 3 0 6 1 0 52 0 0 + 12 pizzerman 11 3 0 7 1 0 58 0 0 + 13 main 12 6 0 8 1 0 64 0 0 +0 8 BLOCK table +index last lastpar psize vsize + 0 13 13 0 0 + 1 6 2 5 9 + 2 7 7 5 5 + 3 8 8 5 5 + 4 9 9 5 5 + 5 10 10 5 5 + 6 11 11 5 5 + 7 12 12 5 5 + 8 13 13 5 5 +0 -1 ARRAY table +index inxtype eltyp elref low high elsize size +0 0 60 STRING table +0 0 Input File array +index parent file name + 0 -1 zad3.cm +0 21 PCODE debugging information + lc findex flineno + 0 0 6 + 1 0 7 + 4 0 8 + 7 0 9 + 9 0 10 + 11 0 11 + 13 0 12 + 14 0 13 + 21 0 14 + 25 0 15 + 27 0 16 + 28 0 17 + 35 0 18 + 39 0 19 + 41 0 20 + 48 0 23 + 52 0 24 + 58 0 25 + 64 0 27 + 65 0 28 + 76 0 29 + 79 0 -29