summaryrefslogtreecommitdiff
path: root/vaporize/tests
diff options
context:
space:
mode:
Diffstat (limited to 'vaporize/tests')
-rw-r--r--vaporize/tests/BinaryTree.java334
-rw-r--r--vaporize/tests/BinaryTree.opt.vapor526
-rw-r--r--vaporize/tests/BinaryTree.vapor719
-rw-r--r--vaporize/tests/BubbleSort.java93
-rw-r--r--vaporize/tests/BubbleSort.opt.vapor277
-rw-r--r--vaporize/tests/BubbleSort.vapor292
-rw-r--r--vaporize/tests/Factorial.java16
-rw-r--r--vaporize/tests/Factorial.opt.vapor20
-rw-r--r--vaporize/tests/Factorial.vapor30
-rw-r--r--vaporize/tests/LinearSearch.java99
-rw-r--r--vaporize/tests/LinearSearch.opt.vapor130
-rw-r--r--vaporize/tests/LinearSearch.vapor150
-rw-r--r--vaporize/tests/LinkedList.java278
-rw-r--r--vaporize/tests/LinkedList.opt.vapor373
-rw-r--r--vaporize/tests/LinkedList.vapor505
-rw-r--r--vaporize/tests/MoreThan4.java29
-rw-r--r--vaporize/tests/MoreThan4.opt.vapor27
-rw-r--r--vaporize/tests/MoreThan4.vapor38
-rw-r--r--vaporize/tests/QuickSort.java112
-rw-r--r--vaporize/tests/QuickSort.opt.vapor378
-rw-r--r--vaporize/tests/QuickSort.vapor399
-rw-r--r--vaporize/tests/ShortCircuit.opt.vapor215
-rw-r--r--vaporize/tests/ShortCircuit.vapor128
-rw-r--r--vaporize/tests/TreeVisitor.java374
-rw-r--r--vaporize/tests/TreeVisitor.opt.vapor635
-rw-r--r--vaporize/tests/TreeVisitor.vapor855
26 files changed, 0 insertions, 7032 deletions
diff --git a/vaporize/tests/BinaryTree.java b/vaporize/tests/BinaryTree.java
deleted file mode 100644
index 18d1464..0000000
--- a/vaporize/tests/BinaryTree.java
+++ /dev/null
@@ -1,334 +0,0 @@
-class BinaryTree{
- public static void main(String[] a){
- System.out.println(new BT().Start());
- }
-}
-
-
-// This class invokes the methods to create a tree,
-// insert, delete and serach for elements on it
-class BT {
-
- public int Start(){
- Tree root ;
- boolean ntb ;
- int nti ;
-
- root = new Tree();
- ntb = root.Init(16);
- ntb = root.Print();
- System.out.println(100000000);
- ntb = root.Insert(8) ;
- ntb = root.Print();
- ntb = root.Insert(24) ;
- ntb = root.Insert(4) ;
- ntb = root.Insert(12) ;
- ntb = root.Insert(20) ;
- ntb = root.Insert(28) ;
- ntb = root.Insert(14) ;
- ntb = root.Print();
- System.out.println(root.Search(24));
- System.out.println(root.Search(12));
- System.out.println(root.Search(16));
- System.out.println(root.Search(50));
- System.out.println(root.Search(12));
- ntb = root.Delete(12);
- ntb = root.Print();
- System.out.println(root.Search(12));
-
- return 0 ;
- }
-
-}
-
-class Tree{
- Tree left ;
- Tree right;
- int key ;
- boolean has_left ;
- boolean has_right ;
- Tree my_null ;
-
- // Initialize a node with a key value and no children
- public boolean Init(int v_key){
- key = v_key ;
- has_left = false ;
- has_right = false ;
- return true ;
- }
-
- // Update the right child with rn
- public boolean SetRight(Tree rn){
- right = rn ;
- return true ;
- }
-
- // Update the left child with ln
- public boolean SetLeft(Tree ln){
- left = ln ;
- return true ;
- }
-
- public Tree GetRight(){
- return right ;
- }
-
- public Tree GetLeft(){
- return left;
- }
-
- public int GetKey(){
- return key ;
- }
-
- public boolean SetKey(int v_key){
- key = v_key ;
- return true ;
- }
-
- public boolean GetHas_Right(){
- return has_right ;
- }
-
- public boolean GetHas_Left(){
- return has_left ;
- }
-
- public boolean SetHas_Left(boolean val){
- has_left = val ;
- return true ;
- }
-
- public boolean SetHas_Right(boolean val){
- has_right = val ;
- return true ;
- }
-
- // This method compares two integers and
- // returns true if they are equal and false
- // otherwise
- public boolean Compare(int num1 , int num2){
- boolean ntb ;
- int nti ;
-
- ntb = false ;
- nti = num2 + 1 ;
- if (num1 < num2) ntb = false ;
- else if (!(num1 < nti)) ntb = false ;
- else ntb = true ;
- return ntb ;
- }
-
-
- // Insert a new element in the tree
- public boolean Insert(int v_key){
- Tree new_node ;
- boolean ntb ;
- boolean cont ;
- int key_aux ;
- Tree current_node ;
-
- new_node = new Tree();
- ntb = new_node.Init(v_key) ;
- current_node = this ;
- cont = true ;
- while (cont){
- key_aux = current_node.GetKey();
- if (v_key < key_aux){
- if (current_node.GetHas_Left())
- current_node = current_node.GetLeft() ;
- else {
- cont = false ;
- ntb = current_node.SetHas_Left(true);
- ntb = current_node.SetLeft(new_node);
- }
- }
- else{
- if (current_node.GetHas_Right())
- current_node = current_node.GetRight() ;
- else {
- cont = false ;
- ntb = current_node.SetHas_Right(true);
- ntb = current_node.SetRight(new_node);
- }
- }
- }
- return true ;
- }
-
-
- // Delete an element from the tree
- public boolean Delete(int v_key){
- Tree current_node ;
- Tree parent_node ;
- boolean cont ;
- boolean found ;
- boolean is_root ;
- int key_aux ;
- boolean ntb ;
-
- current_node = this ;
- parent_node = this ;
- cont = true ;
- found = false ;
- is_root = true ;
- while (cont){
- key_aux = current_node.GetKey();
- if (v_key < key_aux)
- if (current_node.GetHas_Left()){
- parent_node = current_node ;
- current_node = current_node.GetLeft() ;
- }
- else cont = false ;
- else
- if (key_aux < v_key)
- if (current_node.GetHas_Right()){
- parent_node = current_node ;
- current_node = current_node.GetRight() ;
- }
- else cont = false ;
- else {
- if (is_root)
- if ((!current_node.GetHas_Right()) &&
- (!current_node.GetHas_Left()) )
- ntb = true ;
- else
- ntb = this.Remove(parent_node,current_node);
- else ntb = this.Remove(parent_node,current_node);
- found = true ;
- cont = false ;
- }
- is_root = false ;
- }
- return found ;
- }
-
-
- // Check if the element to be removed will use the
- // righ or left subtree if one exists
- public boolean Remove(Tree p_node, Tree c_node){
- boolean ntb ;
- int auxkey1 ;
- int auxkey2 ;
-
- if (c_node.GetHas_Left())
- ntb = this.RemoveLeft(p_node,c_node) ;
- else
- if (c_node.GetHas_Right())
- ntb = this.RemoveRight(p_node,c_node) ;
- else {
- auxkey1 = c_node.GetKey();
- //auxtree01 = p_node.GetLeft() ;
- //auxkey2 = auxtree01.GetKey() ;
- auxkey2 = (p_node.GetLeft()).GetKey() ;
- if (this.Compare(auxkey1,auxkey2)) {
- ntb = p_node.SetLeft(my_null);
- ntb = p_node.SetHas_Left(false);
- }
- else {
- ntb = p_node.SetRight(my_null);
- ntb = p_node.SetHas_Right(false);
- }
- }
- return true ;
- }
-
-
- // Copy the child key to the parent until a leaf is
- // found and remove the leaf. This is done with the
- // right subtree
- public boolean RemoveRight(Tree p_node, Tree c_node){
- boolean ntb ;
-
- while (c_node.GetHas_Right()){
- //auxtree01 = c_node.GetRight() ;
- //auxint02 = auxtree01.GetKey();
- //ntb = c_node.SetKey(auxint02);
- ntb = c_node.SetKey((c_node.GetRight()).GetKey());
- p_node = c_node ;
- c_node = c_node.GetRight() ;
- }
- ntb = p_node.SetRight(my_null);
- ntb = p_node.SetHas_Right(false);
- return true ;
- }
-
-
- // Copy the child key to the parent until a leaf is
- // found and remove the leaf. This is done with the
- // left subtree
- public boolean RemoveLeft(Tree p_node, Tree c_node){
- boolean ntb ;
-
- while (c_node.GetHas_Left()){
- //auxtree01 = c_node.GetLeft() ;
- //auxint02 = auxtree01.GetKey();
- //ntb = c_node.SetKey(auxint02);
- ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
- p_node = c_node ;
- c_node = c_node.GetLeft() ;
- }
- ntb = p_node.SetLeft(my_null);
- ntb = p_node.SetHas_Left(false);
- return true ;
- }
-
- // Search for an elemnt in the tree
- public int Search(int v_key){
- boolean cont ;
- int ifound ;
- Tree current_node;
- int key_aux ;
-
- current_node = this ;
- cont = true ;
- ifound = 0 ;
- while (cont){
- key_aux = current_node.GetKey();
- if (v_key < key_aux)
- if (current_node.GetHas_Left())
- current_node = current_node.GetLeft() ;
- else cont = false ;
- else
- if (key_aux < v_key)
- if (current_node.GetHas_Right())
- current_node = current_node.GetRight() ;
- else cont = false ;
- else {
- ifound = 1 ;
- cont = false ;
- }
- }
- return ifound ;
- }
-
- // Invoke the method to really print the tree elements
- public boolean Print(){
- Tree current_node;
- boolean ntb ;
-
- current_node = this ;
- ntb = this.RecPrint(current_node);
- return true ;
- }
-
- // Print the elements of the tree
- public boolean RecPrint(Tree node){
- boolean ntb ;
-
- if (node.GetHas_Left()){
- //auxtree01 = node.GetLeft() ;
- //ntb = this.RecPrint(auxtree01);
- ntb = this.RecPrint(node.GetLeft());
- } else ntb = true ;
- System.out.println(node.GetKey());
- if (node.GetHas_Right()){
- //auxtree01 = node.GetRight() ;
- //ntb = this.RecPrint(auxtree01);
- ntb = this.RecPrint(node.GetRight());
- } else ntb = true ;
- return true ;
- }
-
-}
-
diff --git a/vaporize/tests/BinaryTree.opt.vapor b/vaporize/tests/BinaryTree.opt.vapor
deleted file mode 100644
index ef6ac4e..0000000
--- a/vaporize/tests/BinaryTree.opt.vapor
+++ /dev/null
@@ -1,526 +0,0 @@
-
-const empty_BT
-
-const empty_Tree
-
-
-func Main()
- t.0 = call :BT.Start(:empty_BT)
- PrintIntS(t.0)
- ret
-
-func BT.Start(this)
- root = HeapAllocZ(24)
- if root goto :null1
- Error("null pointer")
- null1:
- ntb = call :Tree.Init(root 16)
- if root goto :null2
- Error("null pointer")
- null2:
- ntb = call :Tree.Print(root)
- PrintIntS(100000000)
- if root goto :null3
- Error("null pointer")
- null3:
- ntb = call :Tree.Insert(root 8)
- if root goto :null4
- Error("null pointer")
- null4:
- ntb = call :Tree.Print(root)
- if root goto :null5
- Error("null pointer")
- null5:
- ntb = call :Tree.Insert(root 24)
- if root goto :null6
- Error("null pointer")
- null6:
- ntb = call :Tree.Insert(root 4)
- if root goto :null7
- Error("null pointer")
- null7:
- ntb = call :Tree.Insert(root 12)
- if root goto :null8
- Error("null pointer")
- null8:
- ntb = call :Tree.Insert(root 20)
- if root goto :null9
- Error("null pointer")
- null9:
- ntb = call :Tree.Insert(root 28)
- if root goto :null10
- Error("null pointer")
- null10:
- ntb = call :Tree.Insert(root 14)
- if root goto :null11
- Error("null pointer")
- null11:
- ntb = call :Tree.Print(root)
- if root goto :null12
- Error("null pointer")
- null12:
- t.0 = call :Tree.Search(root 24)
- PrintIntS(t.0)
- if root goto :null13
- Error("null pointer")
- null13:
- t.1 = call :Tree.Search(root 12)
- PrintIntS(t.1)
- if root goto :null14
- Error("null pointer")
- null14:
- t.2 = call :Tree.Search(root 16)
- PrintIntS(t.2)
- if root goto :null15
- Error("null pointer")
- null15:
- t.3 = call :Tree.Search(root 50)
- PrintIntS(t.3)
- if root goto :null16
- Error("null pointer")
- null16:
- t.4 = call :Tree.Search(root 12)
- PrintIntS(t.4)
- if root goto :null17
- Error("null pointer")
- null17:
- ntb = call :Tree.Delete(root 12)
- if root goto :null18
- Error("null pointer")
- null18:
- ntb = call :Tree.Print(root)
- if root goto :null19
- Error("null pointer")
- null19:
- t.5 = call :Tree.Search(root 12)
- PrintIntS(t.5)
- ret 0
-
-func Tree.Init(this v_key)
- [this+8] = v_key
- [this+12] = 0
- [this+16] = 0
- ret 1
-
-func Tree.SetRight(this rn)
- [this+4] = rn
- ret 1
-
-func Tree.SetLeft(this ln)
- [this+0] = ln
- ret 1
-
-func Tree.GetRight(this)
- t.0 = [this+4]
- ret t.0
-
-func Tree.GetLeft(this)
- t.0 = [this+0]
- ret t.0
-
-func Tree.GetKey(this)
- t.0 = [this+8]
- ret t.0
-
-func Tree.SetKey(this v_key)
- [this+8] = v_key
- ret 1
-
-func Tree.GetHas_Right(this)
- t.0 = [this+16]
- ret t.0
-
-func Tree.GetHas_Left(this)
- t.0 = [this+12]
- ret t.0
-
-func Tree.SetHas_Left(this val)
- [this+12] = val
- ret 1
-
-func Tree.SetHas_Right(this val)
- [this+16] = val
- ret 1
-
-func Tree.Compare(this num1 num2)
- ntb = 0
- nti = Add(num2 1)
- t.0 = LtS(num1 num2)
- if0 t.0 goto :if1_else
- ntb = 0
- goto :if1_end
- if1_else:
- t.1 = LtS(num1 nti)
- if t.1 goto :if2_else
- ntb = 0
- goto :if2_end
- if2_else:
- ntb = 1
- if2_end:
- if1_end:
- ret ntb
-
-func Tree.Insert(this v_key)
- new_node = HeapAllocZ(24)
- if new_node goto :null20
- Error("null pointer")
- null20:
- ntb = call :Tree.Init(new_node v_key)
- current_node = this
- cont = 1
- while1_top:
- if0 cont goto :while1_end
- if current_node goto :null21
- Error("null pointer")
- null21:
- key_aux = call :Tree.GetKey(current_node)
- t.0 = LtS(v_key key_aux)
- if0 t.0 goto :if3_else
- if current_node goto :null22
- Error("null pointer")
- null22:
- t.1 = call :Tree.GetHas_Left(current_node)
- if0 t.1 goto :if4_else
- if current_node goto :null23
- Error("null pointer")
- null23:
- current_node = call :Tree.GetLeft(current_node)
- goto :if4_end
- if4_else:
- cont = 0
- if current_node goto :null24
- Error("null pointer")
- null24:
- ntb = call :Tree.SetHas_Left(current_node 1)
- if current_node goto :null25
- Error("null pointer")
- null25:
- ntb = call :Tree.SetLeft(current_node new_node)
- if4_end:
- goto :if3_end
- if3_else:
- if current_node goto :null26
- Error("null pointer")
- null26:
- t.2 = call :Tree.GetHas_Right(current_node)
- if0 t.2 goto :if5_else
- if current_node goto :null27
- Error("null pointer")
- null27:
- current_node = call :Tree.GetRight(current_node)
- goto :if5_end
- if5_else:
- cont = 0
- if current_node goto :null28
- Error("null pointer")
- null28:
- ntb = call :Tree.SetHas_Right(current_node 1)
- if current_node goto :null29
- Error("null pointer")
- null29:
- ntb = call :Tree.SetRight(current_node new_node)
- if5_end:
- if3_end:
- goto :while1_top
- while1_end:
- ret 1
-
-func Tree.Delete(this v_key)
- current_node = this
- parent_node = this
- cont = 1
- found = 0
- is_root = 1
- while2_top:
- if0 cont goto :while2_end
- if current_node goto :null30
- Error("null pointer")
- null30:
- key_aux = call :Tree.GetKey(current_node)
- t.0 = LtS(v_key key_aux)
- if0 t.0 goto :if6_else
- if current_node goto :null31
- Error("null pointer")
- null31:
- t.1 = call :Tree.GetHas_Left(current_node)
- if0 t.1 goto :if7_else
- parent_node = current_node
- if current_node goto :null32
- Error("null pointer")
- null32:
- current_node = call :Tree.GetLeft(current_node)
- goto :if7_end
- if7_else:
- cont = 0
- if7_end:
- goto :if6_end
- if6_else:
- t.2 = LtS(key_aux v_key)
- if0 t.2 goto :if8_else
- if current_node goto :null33
- Error("null pointer")
- null33:
- t.3 = call :Tree.GetHas_Right(current_node)
- if0 t.3 goto :if9_else
- parent_node = current_node
- if current_node goto :null34
- Error("null pointer")
- null34:
- current_node = call :Tree.GetRight(current_node)
- goto :if9_end
- if9_else:
- cont = 0
- if9_end:
- goto :if8_end
- if8_else:
- if0 is_root goto :if10_else
- if current_node goto :null35
- Error("null pointer")
- null35:
- t.4 = call :Tree.GetHas_Right(current_node)
- if t.4 goto :if11_else
- if current_node goto :null36
- Error("null pointer")
- null36:
- t.5 = call :Tree.GetHas_Left(current_node)
- if t.5 goto :if11_else
- ntb = 1
- goto :if11_end
- if11_else:
- ntb = call :Tree.Remove(this parent_node current_node)
- if11_end:
- goto :if10_end
- if10_else:
- ntb = call :Tree.Remove(this parent_node current_node)
- if10_end:
- found = 1
- cont = 0
- if8_end:
- if6_end:
- is_root = 0
- goto :while2_top
- while2_end:
- ret found
-
-func Tree.Remove(this p_node c_node)
- if c_node goto :null37
- Error("null pointer")
- null37:
- t.0 = call :Tree.GetHas_Left(c_node)
- if0 t.0 goto :if12_else
- ntb = call :Tree.RemoveLeft(this p_node c_node)
- goto :if12_end
- if12_else:
- if c_node goto :null38
- Error("null pointer")
- null38:
- t.1 = call :Tree.GetHas_Right(c_node)
- if0 t.1 goto :if13_else
- ntb = call :Tree.RemoveRight(this p_node c_node)
- goto :if13_end
- if13_else:
- if c_node goto :null39
- Error("null pointer")
- null39:
- auxkey1 = call :Tree.GetKey(c_node)
- if p_node goto :null40
- Error("null pointer")
- null40:
- t.2 = call :Tree.GetLeft(p_node)
- if t.2 goto :null41
- Error("null pointer")
- null41:
- auxkey2 = call :Tree.GetKey(t.2)
- t.3 = call :Tree.Compare(this auxkey1 auxkey2)
- if0 t.3 goto :if14_else
- if p_node goto :null42
- Error("null pointer")
- null42:
- t.4 = [this+20]
- ntb = call :Tree.SetLeft(p_node t.4)
- if p_node goto :null43
- Error("null pointer")
- null43:
- ntb = call :Tree.SetHas_Left(p_node 0)
- goto :if14_end
- if14_else:
- if p_node goto :null44
- Error("null pointer")
- null44:
- t.5 = [this+20]
- ntb = call :Tree.SetRight(p_node t.5)
- if p_node goto :null45
- Error("null pointer")
- null45:
- ntb = call :Tree.SetHas_Right(p_node 0)
- if14_end:
- if13_end:
- if12_end:
- ret 1
-
-func Tree.RemoveRight(this p_node c_node)
- while3_top:
- if c_node goto :null46
- Error("null pointer")
- null46:
- t.0 = call :Tree.GetHas_Right(c_node)
- if0 t.0 goto :while3_end
- if c_node goto :null47
- Error("null pointer")
- null47:
- if c_node goto :null48
- Error("null pointer")
- null48:
- t.1 = call :Tree.GetRight(c_node)
- if t.1 goto :null49
- Error("null pointer")
- null49:
- t.2 = call :Tree.GetKey(t.1)
- ntb = call :Tree.SetKey(c_node t.2)
- p_node = c_node
- if c_node goto :null50
- Error("null pointer")
- null50:
- c_node = call :Tree.GetRight(c_node)
- goto :while3_top
- while3_end:
- if p_node goto :null51
- Error("null pointer")
- null51:
- t.3 = [this+20]
- ntb = call :Tree.SetRight(p_node t.3)
- if p_node goto :null52
- Error("null pointer")
- null52:
- ntb = call :Tree.SetHas_Right(p_node 0)
- ret 1
-
-func Tree.RemoveLeft(this p_node c_node)
- while4_top:
- if c_node goto :null53
- Error("null pointer")
- null53:
- t.0 = call :Tree.GetHas_Left(c_node)
- if0 t.0 goto :while4_end
- if c_node goto :null54
- Error("null pointer")
- null54:
- if c_node goto :null55
- Error("null pointer")
- null55:
- t.1 = call :Tree.GetLeft(c_node)
- if t.1 goto :null56
- Error("null pointer")
- null56:
- t.2 = call :Tree.GetKey(t.1)
- ntb = call :Tree.SetKey(c_node t.2)
- p_node = c_node
- if c_node goto :null57
- Error("null pointer")
- null57:
- c_node = call :Tree.GetLeft(c_node)
- goto :while4_top
- while4_end:
- if p_node goto :null58
- Error("null pointer")
- null58:
- t.3 = [this+20]
- ntb = call :Tree.SetLeft(p_node t.3)
- if p_node goto :null59
- Error("null pointer")
- null59:
- ntb = call :Tree.SetHas_Left(p_node 0)
- ret 1
-
-func Tree.Search(this v_key)
- current_node = this
- cont = 1
- ifound = 0
- while5_top:
- if0 cont goto :while5_end
- if current_node goto :null60
- Error("null pointer")
- null60:
- key_aux = call :Tree.GetKey(current_node)
- t.0 = LtS(v_key key_aux)
- if0 t.0 goto :if15_else
- if current_node goto :null61
- Error("null pointer")
- null61:
- t.1 = call :Tree.GetHas_Left(current_node)
- if0 t.1 goto :if16_else
- if current_node goto :null62
- Error("null pointer")
- null62:
- current_node = call :Tree.GetLeft(current_node)
- goto :if16_end
- if16_else:
- cont = 0
- if16_end:
- goto :if15_end
- if15_else:
- t.2 = LtS(key_aux v_key)
- if0 t.2 goto :if17_else
- if current_node goto :null63
- Error("null pointer")
- null63:
- t.3 = call :Tree.GetHas_Right(current_node)
- if0 t.3 goto :if18_else
- if current_node goto :null64
- Error("null pointer")
- null64:
- current_node = call :Tree.GetRight(current_node)
- goto :if18_end
- if18_else:
- cont = 0
- if18_end:
- goto :if17_end
- if17_else:
- ifound = 1
- cont = 0
- if17_end:
- if15_end:
- goto :while5_top
- while5_end:
- ret ifound
-
-func Tree.Print(this)
- current_node = this
- ntb = call :Tree.RecPrint(this current_node)
- ret 1
-
-func Tree.RecPrint(this node)
- if node goto :null65
- Error("null pointer")
- null65:
- t.0 = call :Tree.GetHas_Left(node)
- if0 t.0 goto :if19_else
- if node goto :null66
- Error("null pointer")
- null66:
- t.1 = call :Tree.GetLeft(node)
- ntb = call :Tree.RecPrint(this t.1)
- goto :if19_end
- if19_else:
- ntb = 1
- if19_end:
- if node goto :null67
- Error("null pointer")
- null67:
- t.2 = call :Tree.GetKey(node)
- PrintIntS(t.2)
- if node goto :null68
- Error("null pointer")
- null68:
- t.3 = call :Tree.GetHas_Right(node)
- if0 t.3 goto :if20_else
- if node goto :null69
- Error("null pointer")
- null69:
- t.4 = call :Tree.GetRight(node)
- ntb = call :Tree.RecPrint(this t.4)
- goto :if20_end
- if20_else:
- ntb = 1
- if20_end:
- ret 1
diff --git a/vaporize/tests/BinaryTree.vapor b/vaporize/tests/BinaryTree.vapor
deleted file mode 100644
index 275cfe3..0000000
--- a/vaporize/tests/BinaryTree.vapor
+++ /dev/null
@@ -1,719 +0,0 @@
-
-const vmt_BT
- :BT.Start
-
-const vmt_Tree
- :Tree.Init
- :Tree.SetRight
- :Tree.SetLeft
- :Tree.GetRight
- :Tree.GetLeft
- :Tree.GetKey
- :Tree.SetKey
- :Tree.GetHas_Right
- :Tree.GetHas_Left
- :Tree.SetHas_Left
- :Tree.SetHas_Right
- :Tree.Compare
- :Tree.Insert
- :Tree.Delete
- :Tree.Remove
- :Tree.RemoveRight
- :Tree.RemoveLeft
- :Tree.Search
- :Tree.Print
- :Tree.RecPrint
-
-
-func Main()
- t.0 = HeapAllocZ(4)
- [t.0] = :vmt_BT
- if t.0 goto :null1
- Error("null pointer")
- null1:
- t.1 = [t.0]
- t.1 = [t.1+0]
- t.2 = call t.1(t.0)
- PrintIntS(t.2)
- ret
-
-func BT.Start(this)
- t.0 = HeapAllocZ(28)
- [t.0] = :vmt_Tree
- root = t.0
- if root goto :null2
- Error("null pointer")
- null2:
- t.1 = [root]
- t.1 = [t.1+0]
- ntb = call t.1(root 16)
- if root goto :null3
- Error("null pointer")
- null3:
- t.2 = [root]
- t.2 = [t.2+72]
- ntb = call t.2(root)
- PrintIntS(100000000)
- if root goto :null4
- Error("null pointer")
- null4:
- t.3 = [root]
- t.3 = [t.3+48]
- ntb = call t.3(root 8)
- if root goto :null5
- Error("null pointer")
- null5:
- t.4 = [root]
- t.4 = [t.4+72]
- ntb = call t.4(root)
- if root goto :null6
- Error("null pointer")
- null6:
- t.5 = [root]
- t.5 = [t.5+48]
- ntb = call t.5(root 24)
- if root goto :null7
- Error("null pointer")
- null7:
- t.6 = [root]
- t.6 = [t.6+48]
- ntb = call t.6(root 4)
- if root goto :null8
- Error("null pointer")
- null8:
- t.7 = [root]
- t.7 = [t.7+48]
- ntb = call t.7(root 12)
- if root goto :null9
- Error("null pointer")
- null9:
- t.8 = [root]
- t.8 = [t.8+48]
- ntb = call t.8(root 20)
- if root goto :null10
- Error("null pointer")
- null10:
- t.9 = [root]
- t.9 = [t.9+48]
- ntb = call t.9(root 28)
- if root goto :null11
- Error("null pointer")
- null11:
- t.10 = [root]
- t.10 = [t.10+48]
- ntb = call t.10(root 14)
- if root goto :null12
- Error("null pointer")
- null12:
- t.11 = [root]
- t.11 = [t.11+72]
- ntb = call t.11(root)
- if root goto :null13
- Error("null pointer")
- null13:
- t.12 = [root]
- t.12 = [t.12+68]
- t.13 = call t.12(root 24)
- PrintIntS(t.13)
- if root goto :null14
- Error("null pointer")
- null14:
- t.14 = [root]
- t.14 = [t.14+68]
- t.15 = call t.14(root 12)
- PrintIntS(t.15)
- if root goto :null15
- Error("null pointer")
- null15:
- t.16 = [root]
- t.16 = [t.16+68]
- t.17 = call t.16(root 16)
- PrintIntS(t.17)
- if root goto :null16
- Error("null pointer")
- null16:
- t.18 = [root]
- t.18 = [t.18+68]
- t.19 = call t.18(root 50)
- PrintIntS(t.19)
- if root goto :null17
- Error("null pointer")
- null17:
- t.20 = [root]
- t.20 = [t.20+68]
- t.21 = call t.20(root 12)
- PrintIntS(t.21)
- if root goto :null18
- Error("null pointer")
- null18:
- t.22 = [root]
- t.22 = [t.22+52]
- ntb = call t.22(root 12)
- if root goto :null19
- Error("null pointer")
- null19:
- t.23 = [root]
- t.23 = [t.23+72]
- ntb = call t.23(root)
- if root goto :null20
- Error("null pointer")
- null20:
- t.24 = [root]
- t.24 = [t.24+68]
- t.25 = call t.24(root 12)
- PrintIntS(t.25)
- ret 0
-
-func Tree.Init(this v_key)
- [this+12] = v_key
- [this+16] = 0
- [this+20] = 0
- ret 1
-
-func Tree.SetRight(this rn)
- [this+8] = rn
- ret 1
-
-func Tree.SetLeft(this ln)
- [this+4] = ln
- ret 1
-
-func Tree.GetRight(this)
- t.0 = [this+8]
- ret t.0
-
-func Tree.GetLeft(this)
- t.0 = [this+4]
- ret t.0
-
-func Tree.GetKey(this)
- t.0 = [this+12]
- ret t.0
-
-func Tree.SetKey(this v_key)
- [this+12] = v_key
- ret 1
-
-func Tree.GetHas_Right(this)
- t.0 = [this+20]
- ret t.0
-
-func Tree.GetHas_Left(this)
- t.0 = [this+16]
- ret t.0
-
-func Tree.SetHas_Left(this val)
- [this+16] = val
- ret 1
-
-func Tree.SetHas_Right(this val)
- [this+20] = val
- ret 1
-
-func Tree.Compare(this num1 num2)
- ntb = 0
- nti = Add(num2 1)
- t.0 = LtS(num1 num2)
- if0 t.0 goto :if1_else
- ntb = 0
- goto :if1_end
- if1_else:
- t.1 = LtS(num1 nti)
- t.2 = Sub(1 t.1)
- if0 t.2 goto :if2_else
- ntb = 0
- goto :if2_end
- if2_else:
- ntb = 1
- if2_end:
- if1_end:
- ret ntb
-
-func Tree.Insert(this v_key)
- t.0 = HeapAllocZ(28)
- [t.0] = :vmt_Tree
- new_node = t.0
- if new_node goto :null21
- Error("null pointer")
- null21:
- t.1 = [new_node]
- t.1 = [t.1+0]
- ntb = call t.1(new_node v_key)
- current_node = this
- cont = 1
- while1_top:
- if0 cont goto :while1_end
- if current_node goto :null22
- Error("null pointer")
- null22:
- t.2 = [current_node]
- t.2 = [t.2+20]
- key_aux = call t.2(current_node)
- t.3 = LtS(v_key key_aux)
- if0 t.3 goto :if3_else
- if current_node goto :null23
- Error("null pointer")
- null23:
- t.4 = [current_node]
- t.4 = [t.4+32]
- t.5 = call t.4(current_node)
- if0 t.5 goto :if4_else
- if current_node goto :null24
- Error("null pointer")
- null24:
- t.6 = [current_node]
- t.6 = [t.6+16]
- current_node = call t.6(current_node)
- goto :if4_end
- if4_else:
- cont = 0
- if current_node goto :null25
- Error("null pointer")
- null25:
- t.7 = [current_node]
- t.7 = [t.7+36]
- ntb = call t.7(current_node 1)
- if current_node goto :null26
- Error("null pointer")
- null26:
- t.8 = [current_node]
- t.8 = [t.8+8]
- ntb = call t.8(current_node new_node)
- if4_end:
- goto :if3_end
- if3_else:
- if current_node goto :null27
- Error("null pointer")
- null27:
- t.9 = [current_node]
- t.9 = [t.9+28]
- t.10 = call t.9(current_node)
- if0 t.10 goto :if5_else
- if current_node goto :null28
- Error("null pointer")
- null28:
- t.11 = [current_node]
- t.11 = [t.11+12]
- current_node = call t.11(current_node)
- goto :if5_end
- if5_else:
- cont = 0
- if current_node goto :null29
- Error("null pointer")
- null29:
- t.12 = [current_node]
- t.12 = [t.12+40]
- ntb = call t.12(current_node 1)
- if current_node goto :null30
- Error("null pointer")
- null30:
- t.13 = [current_node]
- t.13 = [t.13+4]
- ntb = call t.13(current_node new_node)
- if5_end:
- if3_end:
- goto :while1_top
- while1_end:
- ret 1
-
-func Tree.Delete(this v_key)
- current_node = this
- parent_node = this
- cont = 1
- found = 0
- is_root = 1
- while2_top:
- if0 cont goto :while2_end
- if current_node goto :null31
- Error("null pointer")
- null31:
- t.0 = [current_node]
- t.0 = [t.0+20]
- key_aux = call t.0(current_node)
- t.1 = LtS(v_key key_aux)
- if0 t.1 goto :if6_else
- if current_node goto :null32
- Error("null pointer")
- null32:
- t.2 = [current_node]
- t.2 = [t.2+32]
- t.3 = call t.2(current_node)
- if0 t.3 goto :if7_else
- parent_node = current_node
- if current_node goto :null33
- Error("null pointer")
- null33:
- t.4 = [current_node]
- t.4 = [t.4+16]
- current_node = call t.4(current_node)
- goto :if7_end
- if7_else:
- cont = 0
- if7_end:
- goto :if6_end
- if6_else:
- t.5 = LtS(key_aux v_key)
- if0 t.5 goto :if8_else
- if current_node goto :null34
- Error("null pointer")
- null34:
- t.6 = [current_node]
- t.6 = [t.6+28]
- t.7 = call t.6(current_node)
- if0 t.7 goto :if9_else
- parent_node = current_node
- if current_node goto :null35
- Error("null pointer")
- null35:
- t.8 = [current_node]
- t.8 = [t.8+12]
- current_node = call t.8(current_node)
- goto :if9_end
- if9_else:
- cont = 0
- if9_end:
- goto :if8_end
- if8_else:
- if0 is_root goto :if10_else
- if current_node goto :null36
- Error("null pointer")
- null36:
- t.10 = [current_node]
- t.10 = [t.10+28]
- t.11 = call t.10(current_node)
- t.12 = Sub(1 t.11)
- if0 t.12 goto :ss1_else
- if current_node goto :null37
- Error("null pointer")
- null37:
- t.13 = [current_node]
- t.13 = [t.13+32]
- t.14 = call t.13(current_node)
- t.9 = Sub(1 t.14)
- goto :ss1_end
- ss1_else:
- t.9 = 0
- ss1_end:
- if0 t.9 goto :if11_else
- ntb = 1
- goto :if11_end
- if11_else:
- t.15 = [this]
- t.15 = [t.15+56]
- ntb = call t.15(this parent_node current_node)
- if11_end:
- goto :if10_end
- if10_else:
- t.16 = [this]
- t.16 = [t.16+56]
- ntb = call t.16(this parent_node current_node)
- if10_end:
- found = 1
- cont = 0
- if8_end:
- if6_end:
- is_root = 0
- goto :while2_top
- while2_end:
- ret found
-
-func Tree.Remove(this p_node c_node)
- if c_node goto :null38
- Error("null pointer")
- null38:
- t.0 = [c_node]
- t.0 = [t.0+32]
- t.1 = call t.0(c_node)
- if0 t.1 goto :if12_else
- t.2 = [this]
- t.2 = [t.2+64]
- ntb = call t.2(this p_node c_node)
- goto :if12_end
- if12_else:
- if c_node goto :null39
- Error("null pointer")
- null39:
- t.3 = [c_node]
- t.3 = [t.3+28]
- t.4 = call t.3(c_node)
- if0 t.4 goto :if13_else
- t.5 = [this]
- t.5 = [t.5+60]
- ntb = call t.5(this p_node c_node)
- goto :if13_end
- if13_else:
- if c_node goto :null40
- Error("null pointer")
- null40:
- t.6 = [c_node]
- t.6 = [t.6+20]
- auxkey1 = call t.6(c_node)
- if p_node goto :null41
- Error("null pointer")
- null41:
- t.7 = [p_node]
- t.7 = [t.7+16]
- t.8 = call t.7(p_node)
- if t.8 goto :null42
- Error("null pointer")
- null42:
- t.9 = [t.8]
- t.9 = [t.9+20]
- auxkey2 = call t.9(t.8)
- t.10 = [this]
- t.10 = [t.10+44]
- t.11 = call t.10(this auxkey1 auxkey2)
- if0 t.11 goto :if14_else
- if p_node goto :null43
- Error("null pointer")
- null43:
- t.12 = [p_node]
- t.12 = [t.12+8]
- t.13 = [this+24]
- ntb = call t.12(p_node t.13)
- if p_node goto :null44
- Error("null pointer")
- null44:
- t.14 = [p_node]
- t.14 = [t.14+36]
- ntb = call t.14(p_node 0)
- goto :if14_end
- if14_else:
- if p_node goto :null45
- Error("null pointer")
- null45:
- t.15 = [p_node]
- t.15 = [t.15+4]
- t.16 = [this+24]
- ntb = call t.15(p_node t.16)
- if p_node goto :null46
- Error("null pointer")
- null46:
- t.17 = [p_node]
- t.17 = [t.17+40]
- ntb = call t.17(p_node 0)
- if14_end:
- if13_end:
- if12_end:
- ret 1
-
-func Tree.RemoveRight(this p_node c_node)
- while3_top:
- if c_node goto :null47
- Error("null pointer")
- null47:
- t.0 = [c_node]
- t.0 = [t.0+28]
- t.1 = call t.0(c_node)
- if0 t.1 goto :while3_end
- if c_node goto :null48
- Error("null pointer")
- null48:
- t.2 = [c_node]
- t.2 = [t.2+24]
- if c_node goto :null49
- Error("null pointer")
- null49:
- t.3 = [c_node]
- t.3 = [t.3+12]
- t.4 = call t.3(c_node)
- if t.4 goto :null50
- Error("null pointer")
- null50:
- t.5 = [t.4]
- t.5 = [t.5+20]
- t.6 = call t.5(t.4)
- ntb = call t.2(c_node t.6)
- p_node = c_node
- if c_node goto :null51
- Error("null pointer")
- null51:
- t.7 = [c_node]
- t.7 = [t.7+12]
- c_node = call t.7(c_node)
- goto :while3_top
- while3_end:
- if p_node goto :null52
- Error("null pointer")
- null52:
- t.8 = [p_node]
- t.8 = [t.8+4]
- t.9 = [this+24]
- ntb = call t.8(p_node t.9)
- if p_node goto :null53
- Error("null pointer")
- null53:
- t.10 = [p_node]
- t.10 = [t.10+40]
- ntb = call t.10(p_node 0)
- ret 1
-
-func Tree.RemoveLeft(this p_node c_node)
- while4_top:
- if c_node goto :null54
- Error("null pointer")
- null54:
- t.0 = [c_node]
- t.0 = [t.0+32]
- t.1 = call t.0(c_node)
- if0 t.1 goto :while4_end
- if c_node goto :null55
- Error("null pointer")
- null55:
- t.2 = [c_node]
- t.2 = [t.2+24]
- if c_node goto :null56
- Error("null pointer")
- null56:
- t.3 = [c_node]
- t.3 = [t.3+16]
- t.4 = call t.3(c_node)
- if t.4 goto :null57
- Error("null pointer")
- null57:
- t.5 = [t.4]
- t.5 = [t.5+20]
- t.6 = call t.5(t.4)
- ntb = call t.2(c_node t.6)
- p_node = c_node
- if c_node goto :null58
- Error("null pointer")
- null58:
- t.7 = [c_node]
- t.7 = [t.7+16]
- c_node = call t.7(c_node)
- goto :while4_top
- while4_end:
- if p_node goto :null59
- Error("null pointer")
- null59:
- t.8 = [p_node]
- t.8 = [t.8+8]
- t.9 = [this+24]
- ntb = call t.8(p_node t.9)
- if p_node goto :null60
- Error("null pointer")
- null60:
- t.10 = [p_node]
- t.10 = [t.10+36]
- ntb = call t.10(p_node 0)
- ret 1
-
-func Tree.Search(this v_key)
- current_node = this
- cont = 1
- ifound = 0
- while5_top:
- if0 cont goto :while5_end
- if current_node goto :null61
- Error("null pointer")
- null61:
- t.0 = [current_node]
- t.0 = [t.0+20]
- key_aux = call t.0(current_node)
- t.1 = LtS(v_key key_aux)
- if0 t.1 goto :if15_else
- if current_node goto :null62
- Error("null pointer")
- null62:
- t.2 = [current_node]
- t.2 = [t.2+32]
- t.3 = call t.2(current_node)
- if0 t.3 goto :if16_else
- if current_node goto :null63
- Error("null pointer")
- null63:
- t.4 = [current_node]
- t.4 = [t.4+16]
- current_node = call t.4(current_node)
- goto :if16_end
- if16_else:
- cont = 0
- if16_end:
- goto :if15_end
- if15_else:
- t.5 = LtS(key_aux v_key)
- if0 t.5 goto :if17_else
- if current_node goto :null64
- Error("null pointer")
- null64:
- t.6 = [current_node]
- t.6 = [t.6+28]
- t.7 = call t.6(current_node)
- if0 t.7 goto :if18_else
- if current_node goto :null65
- Error("null pointer")
- null65:
- t.8 = [current_node]
- t.8 = [t.8+12]
- current_node = call t.8(current_node)
- goto :if18_end
- if18_else:
- cont = 0
- if18_end:
- goto :if17_end
- if17_else:
- ifound = 1
- cont = 0
- if17_end:
- if15_end:
- goto :while5_top
- while5_end:
- ret ifound
-
-func Tree.Print(this)
- current_node = this
- t.0 = [this]
- t.0 = [t.0+76]
- ntb = call t.0(this current_node)
- ret 1
-
-func Tree.RecPrint(this node)
- if node goto :null66
- Error("null pointer")
- null66:
- t.0 = [node]
- t.0 = [t.0+32]
- t.1 = call t.0(node)
- if0 t.1 goto :if19_else
- t.2 = [this]
- t.2 = [t.2+76]
- if node goto :null67
- Error("null pointer")
- null67:
- t.3 = [node]
- t.3 = [t.3+16]
- t.4 = call t.3(node)
- ntb = call t.2(this t.4)
- goto :if19_end
- if19_else:
- ntb = 1
- if19_end:
- if node goto :null68
- Error("null pointer")
- null68:
- t.5 = [node]
- t.5 = [t.5+20]
- t.6 = call t.5(node)
- PrintIntS(t.6)
- if node goto :null69
- Error("null pointer")
- null69:
- t.7 = [node]
- t.7 = [t.7+28]
- t.8 = call t.7(node)
- if0 t.8 goto :if20_else
- t.9 = [this]
- t.9 = [t.9+76]
- if node goto :null70
- Error("null pointer")
- null70:
- t.10 = [node]
- t.10 = [t.10+12]
- t.11 = call t.10(node)
- ntb = call t.9(this t.11)
- goto :if20_end
- if20_else:
- ntb = 1
- if20_end:
- ret 1
diff --git a/vaporize/tests/BubbleSort.java b/vaporize/tests/BubbleSort.java
deleted file mode 100644
index e5645a9..0000000
--- a/vaporize/tests/BubbleSort.java
+++ /dev/null
@@ -1,93 +0,0 @@
-class BubbleSort{
- public static void main(String[] a){
- System.out.println(new BBS().Start(10));
- }
-}
-
-
-// This class contains the array of integers and
-// methods to initialize, print and sort the array
-// using Bublesort
-class BBS{
-
- int[] number ;
- int size ;
-
- // Invoke the Initialization, Sort and Printing
- // Methods
- public int Start(int sz){
- int aux01 ;
- aux01 = this.Init(sz);
- aux01 = this.Print();
- System.out.println(99999);
- aux01 = this.Sort();
- aux01 = this.Print();
- return 0 ;
- }
-
-
- // Sort array of integers using Bublesort method
- public int Sort(){
- int nt ;
- int i ;
- int aux02 ;
- int aux04 ;
- int aux05 ;
- int aux06 ;
- int aux07 ;
- int j ;
- int t ;
- i = size - 1 ;
- aux02 = 0 - 1 ;
- while (aux02 < i) {
- j = 1 ;
- //aux03 = i+1 ;
- while (j < (i+1)){
- aux07 = j - 1 ;
- aux04 = number[aux07] ;
- aux05 = number[j] ;
- if (aux05 < aux04) {
- aux06 = j - 1 ;
- t = number[aux06] ;
- number[aux06] = number[j] ;
- number[j] = t;
- }
- else nt = 0 ;
- j = j + 1 ;
- }
- i = i - 1 ;
- }
- return 0 ;
- }
-
- // Printing method
- public int Print(){
- int j ;
- j = 0 ;
- while (j < (size)) {
- System.out.println(number[j]);
- j = j + 1 ;
- }
- return 0 ;
- }
-
- // Initialize array of integers
- public int Init(int sz){
- size = sz ;
- number = new int[sz] ;
-
- number[0] = 20 ;
- number[1] = 7 ;
- number[2] = 12 ;
- number[3] = 18 ;
- number[4] = 2 ;
- number[5] = 11 ;
- number[6] = 6 ;
- number[7] = 9 ;
- number[8] = 19 ;
- number[9] = 5 ;
-
- return 0 ;
- }
-
-}
diff --git a/vaporize/tests/BubbleSort.opt.vapor b/vaporize/tests/BubbleSort.opt.vapor
deleted file mode 100644
index a118894..0000000
--- a/vaporize/tests/BubbleSort.opt.vapor
+++ /dev/null
@@ -1,277 +0,0 @@
-
-const empty_BBS
-
-
-func Main()
- t.0 = HeapAllocZ(8)
- if t.0 goto :null1
- Error("null pointer")
- null1:
- t.1 = call :BBS.Start(t.0 10)
- PrintIntS(t.1)
- ret
-
-func BBS.Start(this sz)
- aux01 = call :BBS.Init(this sz)
- aux01 = call :BBS.Print(this)
- PrintIntS(99999)
- aux01 = call :BBS.Sort(this)
- aux01 = call :BBS.Print(this)
- ret 0
-
-func BBS.Sort(this)
- t.0 = [this+4]
- i = Sub(t.0 1)
- aux02 = Sub(0 1)
- while1_top:
- t.1 = LtS(aux02 i)
- if0 t.1 goto :while1_end
- j = 1
- while2_top:
- t.2 = Add(i 1)
- t.3 = LtS(j t.2)
- if0 t.3 goto :while2_end
- aux07 = Sub(j 1)
- t.4 = [this+0]
- if t.4 goto :null2
- Error("null pointer")
- null2:
- t.5 = [t.4]
- t.5 = Lt(aux07 t.5)
- if t.5 goto :bounds1
- Error("array index out of bounds")
- bounds1:
- t.5 = MulS(aux07 4)
- t.5 = Add(t.5 t.4)
- aux04 = [t.5+4]
- t.6 = [this+0]
- if t.6 goto :null3
- Error("null pointer")
- null3:
- t.7 = [t.6]
- t.7 = Lt(j t.7)
- if t.7 goto :bounds2
- Error("array index out of bounds")
- bounds2:
- t.7 = MulS(j 4)
- t.7 = Add(t.7 t.6)
- aux05 = [t.7+4]
- t.8 = LtS(aux05 aux04)
- if0 t.8 goto :if1_else
- aux06 = Sub(j 1)
- t.9 = [this+0]
- if t.9 goto :null4
- Error("null pointer")
- null4:
- t.10 = [t.9]
- t.10 = Lt(aux06 t.10)
- if t.10 goto :bounds3
- Error("array index out of bounds")
- bounds3:
- t.10 = MulS(aux06 4)
- t.10 = Add(t.10 t.9)
- t = [t.10+4]
- t.11 = [this+0]
- if t.11 goto :null5
- Error("null pointer")
- null5:
- t.12 = [t.11]
- t.12 = Lt(aux06 t.12)
- if t.12 goto :bounds4
- Error("array index out of bounds")
- bounds4:
- t.12 = MulS(aux06 4)
- t.12 = Add(t.12 t.11)
- t.13 = [this+0]
- if t.13 goto :null6
- Error("null pointer")
- null6:
- t.14 = [t.13]
- t.14 = Lt(j t.14)
- if t.14 goto :bounds5
- Error("array index out of bounds")
- bounds5:
- t.14 = MulS(j 4)
- t.14 = Add(t.14 t.13)
- t.15 = [t.14+4]
- [t.12+4] = t.15
- t.16 = [this+0]
- if t.16 goto :null7
- Error("null pointer")
- null7:
- t.17 = [t.16]
- t.17 = Lt(j t.17)
- if t.17 goto :bounds6
- Error("array index out of bounds")
- bounds6:
- t.17 = MulS(j 4)
- t.17 = Add(t.17 t.16)
- [t.17+4] = t
- goto :if1_end
- if1_else:
- nt = 0
- if1_end:
- j = Add(j 1)
- goto :while2_top
- while2_end:
- i = Sub(i 1)
- goto :while1_top
- while1_end:
- ret 0
-
-func BBS.Print(this)
- j = 0
- while3_top:
- t.0 = [this+4]
- t.1 = LtS(j t.0)
- if0 t.1 goto :while3_end
- t.2 = [this+0]
- if t.2 goto :null8
- Error("null pointer")
- null8:
- t.3 = [t.2]
- t.3 = Lt(j t.3)
- if t.3 goto :bounds7
- Error("array index out of bounds")
- bounds7:
- t.3 = MulS(j 4)
- t.3 = Add(t.3 t.2)
- t.4 = [t.3+4]
- PrintIntS(t.4)
- j = Add(j 1)
- goto :while3_top
- while3_end:
- ret 0
-
-func BBS.Init(this sz)
- [this+4] = sz
- t.0 = call :AllocArray(sz)
- [this+0] = t.0
- t.1 = [this+0]
- if t.1 goto :null9
- Error("null pointer")
- null9:
- t.2 = [t.1]
- t.2 = Lt(0 t.2)
- if t.2 goto :bounds8
- Error("array index out of bounds")
- bounds8:
- t.2 = MulS(0 4)
- t.2 = Add(t.2 t.1)
- [t.2+4] = 20
- t.3 = [this+0]
- if t.3 goto :null10
- Error("null pointer")
- null10:
- t.4 = [t.3]
- t.4 = Lt(1 t.4)
- if t.4 goto :bounds9
- Error("array index out of bounds")
- bounds9:
- t.4 = MulS(1 4)
- t.4 = Add(t.4 t.3)
- [t.4+4] = 7
- t.5 = [this+0]
- if t.5 goto :null11
- Error("null pointer")
- null11:
- t.6 = [t.5]
- t.6 = Lt(2 t.6)
- if t.6 goto :bounds10
- Error("array index out of bounds")
- bounds10:
- t.6 = MulS(2 4)
- t.6 = Add(t.6 t.5)
- [t.6+4] = 12
- t.7 = [this+0]
- if t.7 goto :null12
- Error("null pointer")
- null12:
- t.8 = [t.7]
- t.8 = Lt(3 t.8)
- if t.8 goto :bounds11
- Error("array index out of bounds")
- bounds11:
- t.8 = MulS(3 4)
- t.8 = Add(t.8 t.7)
- [t.8+4] = 18
- t.9 = [this+0]
- if t.9 goto :null13
- Error("null pointer")
- null13:
- t.10 = [t.9]
- t.10 = Lt(4 t.10)
- if t.10 goto :bounds12
- Error("array index out of bounds")
- bounds12:
- t.10 = MulS(4 4)
- t.10 = Add(t.10 t.9)
- [t.10+4] = 2
- t.11 = [this+0]
- if t.11 goto :null14
- Error("null pointer")
- null14:
- t.12 = [t.11]
- t.12 = Lt(5 t.12)
- if t.12 goto :bounds13
- Error("array index out of bounds")
- bounds13:
- t.12 = MulS(5 4)
- t.12 = Add(t.12 t.11)
- [t.12+4] = 11
- t.13 = [this+0]
- if t.13 goto :null15
- Error("null pointer")
- null15:
- t.14 = [t.13]
- t.14 = Lt(6 t.14)
- if t.14 goto :bounds14
- Error("array index out of bounds")
- bounds14:
- t.14 = MulS(6 4)
- t.14 = Add(t.14 t.13)
- [t.14+4] = 6
- t.15 = [this+0]
- if t.15 goto :null16
- Error("null pointer")
- null16:
- t.16 = [t.15]
- t.16 = Lt(7 t.16)
- if t.16 goto :bounds15
- Error("array index out of bounds")
- bounds15:
- t.16 = MulS(7 4)
- t.16 = Add(t.16 t.15)
- [t.16+4] = 9
- t.17 = [this+0]
- if t.17 goto :null17
- Error("null pointer")
- null17:
- t.18 = [t.17]
- t.18 = Lt(8 t.18)
- if t.18 goto :bounds16
- Error("array index out of bounds")
- bounds16:
- t.18 = MulS(8 4)
- t.18 = Add(t.18 t.17)
- [t.18+4] = 19
- t.19 = [this+0]
- if t.19 goto :null18
- Error("null pointer")
- null18:
- t.20 = [t.19]
- t.20 = Lt(9 t.20)
- if t.20 goto :bounds17
- Error("array index out of bounds")
- bounds17:
- t.20 = MulS(9 4)
- t.20 = Add(t.20 t.19)
- [t.20+4] = 5
- ret 0
-
-func AllocArray(size)
- bytes = MulS(size 4)
- bytes = Add(bytes 4)
- v = HeapAllocZ(bytes)
- [v] = size
- ret v
diff --git a/vaporize/tests/BubbleSort.vapor b/vaporize/tests/BubbleSort.vapor
deleted file mode 100644
index cedba69..0000000
--- a/vaporize/tests/BubbleSort.vapor
+++ /dev/null
@@ -1,292 +0,0 @@
-
-const vmt_BBS
- :BBS.Start
- :BBS.Sort
- :BBS.Print
- :BBS.Init
-
-
-func Main()
- t.0 = HeapAllocZ(12)
- [t.0] = :vmt_BBS
- if t.0 goto :null1
- Error("null pointer")
- null1:
- t.1 = [t.0]
- t.1 = [t.1+0]
- t.2 = call t.1(t.0 10)
- PrintIntS(t.2)
- ret
-
-func BBS.Start(this sz)
- t.0 = [this]
- t.0 = [t.0+12]
- aux01 = call t.0(this sz)
- t.1 = [this]
- t.1 = [t.1+8]
- aux01 = call t.1(this)
- PrintIntS(99999)
- t.2 = [this]
- t.2 = [t.2+4]
- aux01 = call t.2(this)
- t.3 = [this]
- t.3 = [t.3+8]
- aux01 = call t.3(this)
- ret 0
-
-func BBS.Sort(this)
- t.0 = [this+8]
- i = Sub(t.0 1)
- aux02 = Sub(0 1)
- while1_top:
- t.1 = LtS(aux02 i)
- if0 t.1 goto :while1_end
- j = 1
- while2_top:
- t.2 = Add(i 1)
- t.3 = LtS(j t.2)
- if0 t.3 goto :while2_end
- aux07 = Sub(j 1)
- t.4 = [this+4]
- if t.4 goto :null2
- Error("null pointer")
- null2:
- t.5 = [t.4]
- t.5 = Lt(aux07 t.5)
- if t.5 goto :bounds1
- Error("array index out of bounds")
- bounds1:
- t.5 = MulS(aux07 4)
- t.5 = Add(t.5 t.4)
- aux04 = [t.5+4]
- t.6 = [this+4]
- if t.6 goto :null3
- Error("null pointer")
- null3:
- t.7 = [t.6]
- t.7 = Lt(j t.7)
- if t.7 goto :bounds2
- Error("array index out of bounds")
- bounds2:
- t.7 = MulS(j 4)
- t.7 = Add(t.7 t.6)
- aux05 = [t.7+4]
- t.8 = LtS(aux05 aux04)
- if0 t.8 goto :if1_else
- aux06 = Sub(j 1)
- t.9 = [this+4]
- if t.9 goto :null4
- Error("null pointer")
- null4:
- t.10 = [t.9]
- t.10 = Lt(aux06 t.10)
- if t.10 goto :bounds3
- Error("array index out of bounds")
- bounds3:
- t.10 = MulS(aux06 4)
- t.10 = Add(t.10 t.9)
- t = [t.10+4]
- t.11 = [this+4]
- if t.11 goto :null5
- Error("null pointer")
- null5:
- t.12 = [t.11]
- t.12 = Lt(aux06 t.12)
- if t.12 goto :bounds4
- Error("array index out of bounds")
- bounds4:
- t.12 = MulS(aux06 4)
- t.12 = Add(t.12 t.11)
- t.13 = [this+4]
- if t.13 goto :null6
- Error("null pointer")
- null6:
- t.14 = [t.13]
- t.14 = Lt(j t.14)
- if t.14 goto :bounds5
- Error("array index out of bounds")
- bounds5:
- t.14 = MulS(j 4)
- t.14 = Add(t.14 t.13)
- t.15 = [t.14+4]
- [t.12+4] = t.15
- t.16 = [this+4]
- if t.16 goto :null7
- Error("null pointer")
- null7:
- t.17 = [t.16]
- t.17 = Lt(j t.17)
- if t.17 goto :bounds6
- Error("array index out of bounds")
- bounds6:
- t.17 = MulS(j 4)
- t.17 = Add(t.17 t.16)
- [t.17+4] = t
- goto :if1_end
- if1_else:
- nt = 0
- if1_end:
- j = Add(j 1)
- goto :while2_top
- while2_end:
- i = Sub(i 1)
- goto :while1_top
- while1_end:
- ret 0
-
-func BBS.Print(this)
- j = 0
- while3_top:
- t.0 = [this+8]
- t.1 = LtS(j t.0)
- if0 t.1 goto :while3_end
- t.2 = [this+4]
- if t.2 goto :null8
- Error("null pointer")
- null8:
- t.3 = [t.2]
- t.3 = Lt(j t.3)
- if t.3 goto :bounds7
- Error("array index out of bounds")
- bounds7:
- t.3 = MulS(j 4)
- t.3 = Add(t.3 t.2)
- t.4 = [t.3+4]
- PrintIntS(t.4)
- j = Add(j 1)
- goto :while3_top
- while3_end:
- ret 0
-
-func BBS.Init(this sz)
- [this+8] = sz
- t.0 = call :AllocArray(sz)
- [this+4] = t.0
- t.1 = [this+4]
- if t.1 goto :null9
- Error("null pointer")
- null9:
- t.2 = [t.1]
- t.2 = Lt(0 t.2)
- if t.2 goto :bounds8
- Error("array index out of bounds")
- bounds8:
- t.2 = MulS(0 4)
- t.2 = Add(t.2 t.1)
- [t.2+4] = 20
- t.3 = [this+4]
- if t.3 goto :null10
- Error("null pointer")
- null10:
- t.4 = [t.3]
- t.4 = Lt(1 t.4)
- if t.4 goto :bounds9
- Error("array index out of bounds")
- bounds9:
- t.4 = MulS(1 4)
- t.4 = Add(t.4 t.3)
- [t.4+4] = 7
- t.5 = [this+4]
- if t.5 goto :null11
- Error("null pointer")
- null11:
- t.6 = [t.5]
- t.6 = Lt(2 t.6)
- if t.6 goto :bounds10
- Error("array index out of bounds")
- bounds10:
- t.6 = MulS(2 4)
- t.6 = Add(t.6 t.5)
- [t.6+4] = 12
- t.7 = [this+4]
- if t.7 goto :null12
- Error("null pointer")
- null12:
- t.8 = [t.7]
- t.8 = Lt(3 t.8)
- if t.8 goto :bounds11
- Error("array index out of bounds")
- bounds11:
- t.8 = MulS(3 4)
- t.8 = Add(t.8 t.7)
- [t.8+4] = 18
- t.9 = [this+4]
- if t.9 goto :null13
- Error("null pointer")
- null13:
- t.10 = [t.9]
- t.10 = Lt(4 t.10)
- if t.10 goto :bounds12
- Error("array index out of bounds")
- bounds12:
- t.10 = MulS(4 4)
- t.10 = Add(t.10 t.9)
- [t.10+4] = 2
- t.11 = [this+4]
- if t.11 goto :null14
- Error("null pointer")
- null14:
- t.12 = [t.11]
- t.12 = Lt(5 t.12)
- if t.12 goto :bounds13
- Error("array index out of bounds")
- bounds13:
- t.12 = MulS(5 4)
- t.12 = Add(t.12 t.11)
- [t.12+4] = 11
- t.13 = [this+4]
- if t.13 goto :null15
- Error("null pointer")
- null15:
- t.14 = [t.13]
- t.14 = Lt(6 t.14)
- if t.14 goto :bounds14
- Error("array index out of bounds")
- bounds14:
- t.14 = MulS(6 4)
- t.14 = Add(t.14 t.13)
- [t.14+4] = 6
- t.15 = [this+4]
- if t.15 goto :null16
- Error("null pointer")
- null16:
- t.16 = [t.15]
- t.16 = Lt(7 t.16)
- if t.16 goto :bounds15
- Error("array index out of bounds")
- bounds15:
- t.16 = MulS(7 4)
- t.16 = Add(t.16 t.15)
- [t.16+4] = 9
- t.17 = [this+4]
- if t.17 goto :null17
- Error("null pointer")
- null17:
- t.18 = [t.17]
- t.18 = Lt(8 t.18)
- if t.18 goto :bounds16
- Error("array index out of bounds")
- bounds16:
- t.18 = MulS(8 4)
- t.18 = Add(t.18 t.17)
- [t.18+4] = 19
- t.19 = [this+4]
- if t.19 goto :null18
- Error("null pointer")
- null18:
- t.20 = [t.19]
- t.20 = Lt(9 t.20)
- if t.20 goto :bounds17
- Error("array index out of bounds")
- bounds17:
- t.20 = MulS(9 4)
- t.20 = Add(t.20 t.19)
- [t.20+4] = 5
- ret 0
-
-func AllocArray(size)
- bytes = MulS(size 4)
- bytes = Add(bytes 4)
- v = HeapAllocZ(bytes)
- [v] = size
- ret v
diff --git a/vaporize/tests/Factorial.java b/vaporize/tests/Factorial.java
deleted file mode 100644
index d938bb6..0000000
--- a/vaporize/tests/Factorial.java
+++ /dev/null
@@ -1,16 +0,0 @@
-class Factorial{
- public static void main(String[] a){
- System.out.println(new Fac().ComputeFac(10));
- }
-}
-
-class Fac {
- public int ComputeFac(int num){
- int num_aux ;
- if (num < 1)
- num_aux = 1 ;
- else
- num_aux = num * (this.ComputeFac(num-1)) ;
- return num_aux ;
- }
-}
diff --git a/vaporize/tests/Factorial.opt.vapor b/vaporize/tests/Factorial.opt.vapor
deleted file mode 100644
index aca17fe..0000000
--- a/vaporize/tests/Factorial.opt.vapor
+++ /dev/null
@@ -1,20 +0,0 @@
-
-const empty_Fac
-
-
-func Main()
- t.0 = call :Fac.ComputeFac(:empty_Fac 10)
- PrintIntS(t.0)
- ret
-
-func Fac.ComputeFac(this num)
- t.0 = LtS(num 1)
- if0 t.0 goto :if1_else
- num_aux = 1
- goto :if1_end
- if1_else:
- t.1 = Sub(num 1)
- t.2 = call :Fac.ComputeFac(this t.1)
- num_aux = MulS(num t.2)
- if1_end:
- ret num_aux
diff --git a/vaporize/tests/Factorial.vapor b/vaporize/tests/Factorial.vapor
deleted file mode 100644
index 28e1126..0000000
--- a/vaporize/tests/Factorial.vapor
+++ /dev/null
@@ -1,30 +0,0 @@
-
-const vmt_Fac
- :Fac.ComputeFac
-
-
-func Main()
- t.0 = HeapAllocZ(4)
- [t.0] = :vmt_Fac
- if t.0 goto :null1
- Error("null pointer")
- null1:
- t.1 = [t.0]
- t.1 = [t.1+0]
- t.2 = call t.1(t.0 10)
- PrintIntS(t.2)
- ret
-
-func Fac.ComputeFac(this num)
- t.0 = LtS(num 1)
- if0 t.0 goto :if1_else
- num_aux = 1
- goto :if1_end
- if1_else:
- t.1 = [this]
- t.1 = [t.1+0]
- t.2 = Sub(num 1)
- t.3 = call t.1(this t.2)
- num_aux = MulS(num t.3)
- if1_end:
- ret num_aux
diff --git a/vaporize/tests/LinearSearch.java b/vaporize/tests/LinearSearch.java
deleted file mode 100644
index daddd94..0000000
--- a/vaporize/tests/LinearSearch.java
+++ /dev/null
@@ -1,99 +0,0 @@
-class LinearSearch{
- public static void main(String[] a){
- System.out.println(new LS().Start(10));
- }
-}
-
-
-// This class contains an array of integers and
-// methods to initialize, print and search the array
-// using Linear Search
-class LS {
- int[] number ;
- int size ;
-
- // Invoke methods to initialize, print and search
- // for elements on the array
- public int Start(int sz){
- int aux01 ;
- int aux02 ;
-
- aux01 = this.Init(sz);
- aux02 = this.Print();
- System.out.println(9999);
- System.out.println(this.Search(8));
- System.out.println(this.Search(12)) ;
- System.out.println(this.Search(17)) ;
- System.out.println(this.Search(50)) ;
- return 55 ;
- }
-
- // Print array of integers
- public int Print(){
- int j ;
-
- j = 1 ;
- while (j < (size)) {
- System.out.println(number[j]);
- j = j + 1 ;
- }
- return 0 ;
- }
-
- // Search for a specific value (num) using
- // linear search
- public int Search(int num){
- int j ;
- boolean ls01 ;
- int ifound ;
- int aux01 ;
- int aux02 ;
- int nt ;
-
- j = 1 ;
- ls01 = false ;
- ifound = 0 ;
-
- //System.out.println(num);
- while (j < (size)) {
- aux01 = number[j] ;
- aux02 = num + 1 ;
- if (aux01 < num) nt = 0 ;
- else if (!(aux01 < aux02)) nt = 0 ;
- else {
- ls01 = true ;
- ifound = 1 ;
- j = size ;
- }
- j = j + 1 ;
- }
-
- return ifound ;
- }
-
-
-
- // initialize array of integers with some
- // some sequence
- public int Init(int sz){
- int j ;
- int k ;
- int aux01 ;
- int aux02 ;
-
- size = sz ;
- number = new int[sz] ;
-
- j = 1 ;
- k = size + 1 ;
- while (j < (size)) {
- aux01 = 2 * j ;
- aux02 = k - 3 ;
- number[j] = aux01 + aux02 ;
- j = j + 1 ;
- k = k - 1 ;
- }
- return 0 ;
- }
-
-}
diff --git a/vaporize/tests/LinearSearch.opt.vapor b/vaporize/tests/LinearSearch.opt.vapor
deleted file mode 100644
index 302de05..0000000
--- a/vaporize/tests/LinearSearch.opt.vapor
+++ /dev/null
@@ -1,130 +0,0 @@
-
-const empty_LS
-
-
-func Main()
- t.0 = HeapAllocZ(8)
- if t.0 goto :null1
- Error("null pointer")
- null1:
- t.1 = call :LS.Start(t.0 10)
- PrintIntS(t.1)
- ret
-
-func LS.Start(this sz)
- aux01 = call :LS.Init(this sz)
- aux02 = call :LS.Print(this)
- PrintIntS(9999)
- t.0 = call :LS.Search(this 8)
- PrintIntS(t.0)
- t.1 = call :LS.Search(this 12)
- PrintIntS(t.1)
- t.2 = call :LS.Search(this 17)
- PrintIntS(t.2)
- t.3 = call :LS.Search(this 50)
- PrintIntS(t.3)
- ret 55
-
-func LS.Print(this)
- j = 1
- while1_top:
- t.0 = [this+4]
- t.1 = LtS(j t.0)
- if0 t.1 goto :while1_end
- t.2 = [this+0]
- if t.2 goto :null2
- Error("null pointer")
- null2:
- t.3 = [t.2]
- t.3 = Lt(j t.3)
- if t.3 goto :bounds1
- Error("array index out of bounds")
- bounds1:
- t.3 = MulS(j 4)
- t.3 = Add(t.3 t.2)
- t.4 = [t.3+4]
- PrintIntS(t.4)
- j = Add(j 1)
- goto :while1_top
- while1_end:
- ret 0
-
-func LS.Search(this num)
- j = 1
- ls01 = 0
- ifound = 0
- while2_top:
- t.0 = [this+4]
- t.1 = LtS(j t.0)
- if0 t.1 goto :while2_end
- t.2 = [this+0]
- if t.2 goto :null3
- Error("null pointer")
- null3:
- t.3 = [t.2]
- t.3 = Lt(j t.3)
- if t.3 goto :bounds2
- Error("array index out of bounds")
- bounds2:
- t.3 = MulS(j 4)
- t.3 = Add(t.3 t.2)
- aux01 = [t.3+4]
- aux02 = Add(num 1)
- t.4 = LtS(aux01 num)
- if0 t.4 goto :if1_else
- nt = 0
- goto :if1_end
- if1_else:
- t.5 = LtS(aux01 aux02)
- if t.5 goto :if2_else
- nt = 0
- goto :if2_end
- if2_else:
- ls01 = 1
- ifound = 1
- j = [this+4]
- if2_end:
- if1_end:
- j = Add(j 1)
- goto :while2_top
- while2_end:
- ret ifound
-
-func LS.Init(this sz)
- [this+4] = sz
- t.0 = call :AllocArray(sz)
- [this+0] = t.0
- j = 1
- t.1 = [this+4]
- k = Add(t.1 1)
- while3_top:
- t.2 = [this+4]
- t.3 = LtS(j t.2)
- if0 t.3 goto :while3_end
- aux01 = MulS(2 j)
- aux02 = Sub(k 3)
- t.4 = [this+0]
- if t.4 goto :null4
- Error("null pointer")
- null4:
- t.5 = [t.4]
- t.5 = Lt(j t.5)
- if t.5 goto :bounds3
- Error("array index out of bounds")
- bounds3:
- t.5 = MulS(j 4)
- t.5 = Add(t.5 t.4)
- t.6 = Add(aux01 aux02)
- [t.5+4] = t.6
- j = Add(j 1)
- k = Sub(k 1)
- goto :while3_top
- while3_end:
- ret 0
-
-func AllocArray(size)
- bytes = MulS(size 4)
- bytes = Add(bytes 4)
- v = HeapAllocZ(bytes)
- [v] = size
- ret v
diff --git a/vaporize/tests/LinearSearch.vapor b/vaporize/tests/LinearSearch.vapor
deleted file mode 100644
index db4884a..0000000
--- a/vaporize/tests/LinearSearch.vapor
+++ /dev/null
@@ -1,150 +0,0 @@
-
-const vmt_LS
- :LS.Start
- :LS.Print
- :LS.Search
- :LS.Init
-
-
-func Main()
- t.0 = HeapAllocZ(12)
- [t.0] = :vmt_LS
- if t.0 goto :null1
- Error("null pointer")
- null1:
- t.1 = [t.0]
- t.1 = [t.1+0]
- t.2 = call t.1(t.0 10)
- PrintIntS(t.2)
- ret
-
-func LS.Start(this sz)
- t.0 = [this]
- t.0 = [t.0+12]
- aux01 = call t.0(this sz)
- t.1 = [this]
- t.1 = [t.1+4]
- aux02 = call t.1(this)
- PrintIntS(9999)
- t.2 = [this]
- t.2 = [t.2+8]
- t.3 = call t.2(this 8)
- PrintIntS(t.3)
- t.4 = [this]
- t.4 = [t.4+8]
- t.5 = call t.4(this 12)
- PrintIntS(t.5)
- t.6 = [this]
- t.6 = [t.6+8]
- t.7 = call t.6(this 17)
- PrintIntS(t.7)
- t.8 = [this]
- t.8 = [t.8+8]
- t.9 = call t.8(this 50)
- PrintIntS(t.9)
- ret 55
-
-func LS.Print(this)
- j = 1
- while1_top:
- t.0 = [this+8]
- t.1 = LtS(j t.0)
- if0 t.1 goto :while1_end
- t.2 = [this+4]
- if t.2 goto :null2
- Error("null pointer")
- null2:
- t.3 = [t.2]
- t.3 = Lt(j t.3)
- if t.3 goto :bounds1
- Error("array index out of bounds")
- bounds1:
- t.3 = MulS(j 4)
- t.3 = Add(t.3 t.2)
- t.4 = [t.3+4]
- PrintIntS(t.4)
- j = Add(j 1)
- goto :while1_top
- while1_end:
- ret 0
-
-func LS.Search(this num)
- j = 1
- ls01 = 0
- ifound = 0
- while2_top:
- t.0 = [this+8]
- t.1 = LtS(j t.0)
- if0 t.1 goto :while2_end
- t.2 = [this+4]
- if t.2 goto :null3
- Error("null pointer")
- null3:
- t.3 = [t.2]
- t.3 = Lt(j t.3)
- if t.3 goto :bounds2
- Error("array index out of bounds")
- bounds2:
- t.3 = MulS(j 4)
- t.3 = Add(t.3 t.2)
- aux01 = [t.3+4]
- aux02 = Add(num 1)
- t.4 = LtS(aux01 num)
- if0 t.4 goto :if1_else
- nt = 0
- goto :if1_end
- if1_else:
- t.5 = LtS(aux01 aux02)
- t.6 = Sub(1 t.5)
- if0 t.6 goto :if2_else
- nt = 0
- goto :if2_end
- if2_else:
- ls01 = 1
- ifound = 1
- j = [this+8]
- if2_end:
- if1_end:
- j = Add(j 1)
- goto :while2_top
- while2_end:
- ret ifound
-
-func LS.Init(this sz)
- [this+8] = sz
- t.0 = call :AllocArray(sz)
- [this+4] = t.0
- j = 1
- t.1 = [this+8]
- k = Add(t.1 1)
- while3_top:
- t.2 = [this+8]
- t.3 = LtS(j t.2)
- if0 t.3 goto :while3_end
- aux01 = MulS(2 j)
- aux02 = Sub(k 3)
- t.4 = [this+4]
- if t.4 goto :null4
- Error("null pointer")
- null4:
- t.5 = [t.4]
- t.5 = Lt(j t.5)
- if t.5 goto :bounds3
- Error("array index out of bounds")
- bounds3:
- t.5 = MulS(j 4)
- t.5 = Add(t.5 t.4)
- t.6 = Add(aux01 aux02)
- [t.5+4] = t.6
- j = Add(j 1)
- k = Sub(k 1)
- goto :while3_top
- while3_end:
- ret 0
-
-func AllocArray(size)
- bytes = MulS(size 4)
- bytes = Add(bytes 4)
- v = HeapAllocZ(bytes)
- [v] = size
- ret v
diff --git a/vaporize/tests/LinkedList.java b/vaporize/tests/LinkedList.java
deleted file mode 100644
index 69adc33..0000000
--- a/vaporize/tests/LinkedList.java
+++ /dev/null
@@ -1,278 +0,0 @@
-class LinkedList{
- public static void main(String[] a){
- System.out.println(new LL().Start());
- }
-}
-
-class Element {
- int Age ;
- int Salary ;
- boolean Married ;
-
- // Initialize some class variables
- public boolean Init(int v_Age, int v_Salary, boolean v_Married){
- Age = v_Age ;
- Salary = v_Salary ;
- Married = v_Married ;
- return true ;
- }
-
- public int GetAge(){
- return Age ;
- }
-
- public int GetSalary(){
- return Salary ;
- }
-
- public boolean GetMarried(){
- return Married ;
- }
-
- // This method returns true if the object "other"
- // has the same values for age, salary and
- public boolean Equal(Element other){
- boolean ret_val ;
- int aux01 ;
- int aux02 ;
- int nt ;
- ret_val = true ;
-
- aux01 = other.GetAge();
- if (!this.Compare(aux01,Age)) ret_val = false ;
- else {
- aux02 = other.GetSalary();
- if (!this.Compare(aux02,Salary)) ret_val = false ;
- else
- if (Married)
- if (!other.GetMarried()) ret_val = false;
- else nt = 0 ;
- else
- if (other.GetMarried()) ret_val = false;
- else nt = 0 ;
- }
-
- return ret_val ;
- }
-
- // This method compares two integers and
- // returns true if they are equal and false
- // otherwise
- public boolean Compare(int num1 , int num2){
- boolean retval ;
- int aux02 ;
- retval = false ;
- aux02 = num2 + 1 ;
- if (num1 < num2) retval = false ;
- else if (!(num1 < aux02)) retval = false ;
- else retval = true ;
- return retval ;
- }
-
-}
-
-class List{
- Element elem ;
- List next ;
- boolean end ;
-
- // Initialize the node list as the last node
- public boolean Init(){
- end = true ;
- return true ;
- }
-
- // Initialize the values of a new node
- public boolean InitNew(Element v_elem, List v_next, boolean v_end){
- end = v_end ;
- elem = v_elem ;
- next = v_next ;
- return true ;
- }
-
- // Insert a new node at the beginning of the list
- public List Insert(Element new_elem){
- boolean ret_val ;
- List aux03 ;
- List aux02 ;
- aux03 = this ;
- aux02 = new List();
- ret_val = aux02.InitNew(new_elem,aux03,false);
- return aux02 ;
- }
-
-
- // Update the the pointer to the next node
- public boolean SetNext(List v_next){
- next = v_next ;
- return true ;
- }
-
- // Delete an element e from the list
- public List Delete(Element e){
- List my_head ;
- boolean ret_val ;
- boolean aux05;
- List aux01 ;
- List prev ;
- boolean var_end ;
- Element var_elem ;
- int aux04 ;
- int nt ;
-
-
- my_head = this ;
- ret_val = false ;
- aux04 = 0 - 1 ;
- aux01 = this ;
- prev = this ;
- var_end = end;
- var_elem = elem ;
- while ((!var_end) && (!ret_val)){
- if (e.Equal(var_elem)){
- ret_val = true ;
- if (aux04 < 0) {
- // delete first element
- my_head = aux01.GetNext() ;
- }
- else{ // delete a non first element
- System.out.println(0-555);
- aux05 = prev.SetNext(aux01.GetNext());
- System.out.println(0-555);
-
- }
- } else nt = 0 ;
- if (!ret_val){
- prev = aux01 ;
- aux01 = aux01.GetNext() ;
- var_end = aux01.GetEnd();
- var_elem = aux01.GetElem();
- aux04 = 1 ;
- } else nt = 0 ;
- }
- return my_head ;
- }
-
-
- // Search for an element e on the list
- public int Search(Element e){
- int int_ret_val ;
- List aux01 ;
- Element var_elem ;
- boolean var_end ;
- int nt ;
-
- int_ret_val = 0 ;
- aux01 = this ;
- var_end = end;
- var_elem = elem ;
- while (!var_end){
- if (e.Equal(var_elem)){
- int_ret_val = 1 ;
- }
- else nt = 0 ;
- aux01 = aux01.GetNext() ;
- var_end = aux01.GetEnd();
- var_elem = aux01.GetElem();
- }
- return int_ret_val ;
- }
-
- public boolean GetEnd(){
- return end ;
- }
-
- public Element GetElem(){
- return elem ;
- }
-
- public List GetNext(){
- return next ;
- }
-
-
- // Print the linked list
- public boolean Print(){
- List aux01 ;
- boolean var_end ;
- Element var_elem ;
-
- aux01 = this ;
- var_end = end ;
- var_elem = elem ;
- while (!var_end){
- System.out.println(var_elem.GetAge());
- aux01 = aux01.GetNext() ;
- var_end = aux01.GetEnd();
- var_elem = aux01.GetElem();
- }
-
- return true ;
- }
-}
-
-
-// this class invokes the methods to insert, delete,
-// search and print the linked list
-class LL{
-
- public int Start(){
-
- List head ;
- List last_elem ;
- boolean aux01 ;
- Element el01 ;
- Element el02 ;
- Element el03 ;
-
- last_elem = new List();
- aux01 = last_elem.Init();
- head = last_elem ;
- aux01 = head.Init();
- aux01 = head.Print();
-
- // inserting first element
- el01 = new Element();
- aux01 = el01.Init(25,37000,false);
- head = head.Insert(el01);
- aux01 = head.Print();
- System.out.println(10000000);
- // inserting second element
- el01 = new Element();
- aux01 = el01.Init(39,42000,true);
- el02 = el01 ;
- head = head.Insert(el01);
- aux01 = head.Print();
- System.out.println(10000000);
- // inserting third element
- el01 = new Element();
- aux01 = el01.Init(22,34000,false);
- head = head.Insert(el01);
- aux01 = head.Print();
- el03 = new Element();
- aux01 = el03.Init(27,34000,false);
- System.out.println(head.Search(el02));
- System.out.println(head.Search(el03));
- System.out.println(10000000);
- // inserting fourth element
- el01 = new Element();
- aux01 = el01.Init(28,35000,false);
- head = head.Insert(el01);
- aux01 = head.Print();
- System.out.println(2220000);
-
- head = head.Delete(el02);
- aux01 = head.Print();
- System.out.println(33300000);
-
-
- head = head.Delete(el01);
- aux01 = head.Print();
- System.out.println(44440000);
-
- return 0 ;
-
-
- }
-
-}
diff --git a/vaporize/tests/LinkedList.opt.vapor b/vaporize/tests/LinkedList.opt.vapor
deleted file mode 100644
index aaca62c..0000000
--- a/vaporize/tests/LinkedList.opt.vapor
+++ /dev/null
@@ -1,373 +0,0 @@
-
-const empty_Element
-
-const empty_List
-
-const empty_LL
-
-
-func Main()
- t.0 = call :LL.Start(:empty_LL)
- PrintIntS(t.0)
- ret
-
-func Element.Init(this v_Age v_Salary v_Married)
- [this+0] = v_Age
- [this+4] = v_Salary
- [this+8] = v_Married
- ret 1
-
-func Element.GetAge(this)
- t.0 = [this+0]
- ret t.0
-
-func Element.GetSalary(this)
- t.0 = [this+4]
- ret t.0
-
-func Element.GetMarried(this)
- t.0 = [this+8]
- ret t.0
-
-func Element.Equal(this other)
- ret_val = 1
- if other goto :null1
- Error("null pointer")
- null1:
- aux01 = call :Element.GetAge(other)
- t.0 = [this+0]
- t.1 = call :Element.Compare(this aux01 t.0)
- if t.1 goto :if1_else
- ret_val = 0
- goto :if1_end
- if1_else:
- if other goto :null2
- Error("null pointer")
- null2:
- aux02 = call :Element.GetSalary(other)
- t.2 = [this+4]
- t.3 = call :Element.Compare(this aux02 t.2)
- if t.3 goto :if2_else
- ret_val = 0
- goto :if2_end
- if2_else:
- t.4 = [this+8]
- if0 t.4 goto :if3_else
- if other goto :null3
- Error("null pointer")
- null3:
- t.5 = call :Element.GetMarried(other)
- if t.5 goto :if4_else
- ret_val = 0
- goto :if4_end
- if4_else:
- nt = 0
- if4_end:
- goto :if3_end
- if3_else:
- if other goto :null4
- Error("null pointer")
- null4:
- t.6 = call :Element.GetMarried(other)
- if0 t.6 goto :if5_else
- ret_val = 0
- goto :if5_end
- if5_else:
- nt = 0
- if5_end:
- if3_end:
- if2_end:
- if1_end:
- ret ret_val
-
-func Element.Compare(this num1 num2)
- retval = 0
- aux02 = Add(num2 1)
- t.0 = LtS(num1 num2)
- if0 t.0 goto :if6_else
- retval = 0
- goto :if6_end
- if6_else:
- t.1 = LtS(num1 aux02)
- if t.1 goto :if7_else
- retval = 0
- goto :if7_end
- if7_else:
- retval = 1
- if7_end:
- if6_end:
- ret retval
-
-func List.Init(this)
- [this+8] = 1
- ret 1
-
-func List.InitNew(this v_elem v_next v_end)
- [this+8] = v_end
- [this+0] = v_elem
- [this+4] = v_next
- ret 1
-
-func List.Insert(this new_elem)
- aux03 = this
- aux02 = HeapAllocZ(12)
- if aux02 goto :null5
- Error("null pointer")
- null5:
- ret_val = call :List.InitNew(aux02 new_elem aux03 0)
- ret aux02
-
-func List.SetNext(this v_next)
- [this+4] = v_next
- ret 1
-
-func List.Delete(this e)
- my_head = this
- ret_val = 0
- aux04 = Sub(0 1)
- aux01 = this
- prev = this
- var_end = [this+8]
- var_elem = [this+0]
- while1_top:
- if var_end goto :ss1_else
- t.0 = Sub(1 ret_val)
- goto :ss1_end
- ss1_else:
- t.0 = 0
- ss1_end:
- if0 t.0 goto :while1_end
- if e goto :null6
- Error("null pointer")
- null6:
- t.1 = call :Element.Equal(e var_elem)
- if0 t.1 goto :if8_else
- ret_val = 1
- t.2 = LtS(aux04 0)
- if0 t.2 goto :if9_else
- if aux01 goto :null7
- Error("null pointer")
- null7:
- my_head = call :List.GetNext(aux01)
- goto :if9_end
- if9_else:
- t.3 = Sub(0 555)
- PrintIntS(t.3)
- if prev goto :null8
- Error("null pointer")
- null8:
- if aux01 goto :null9
- Error("null pointer")
- null9:
- t.4 = call :List.GetNext(aux01)
- aux05 = call :List.SetNext(prev t.4)
- t.5 = Sub(0 555)
- PrintIntS(t.5)
- if9_end:
- goto :if8_end
- if8_else:
- nt = 0
- if8_end:
- if ret_val goto :if10_else
- prev = aux01
- if aux01 goto :null10
- Error("null pointer")
- null10:
- aux01 = call :List.GetNext(aux01)
- if aux01 goto :null11
- Error("null pointer")
- null11:
- var_end = call :List.GetEnd(aux01)
- if aux01 goto :null12
- Error("null pointer")
- null12:
- var_elem = call :List.GetElem(aux01)
- aux04 = 1
- goto :if10_end
- if10_else:
- nt = 0
- if10_end:
- goto :while1_top
- while1_end:
- ret my_head
-
-func List.Search(this e)
- int_ret_val = 0
- aux01 = this
- var_end = [this+8]
- var_elem = [this+0]
- while2_top:
- t.0 = Sub(1 var_end)
- if0 t.0 goto :while2_end
- if e goto :null13
- Error("null pointer")
- null13:
- t.1 = call :Element.Equal(e var_elem)
- if0 t.1 goto :if11_else
- int_ret_val = 1
- goto :if11_end
- if11_else:
- nt = 0
- if11_end:
- if aux01 goto :null14
- Error("null pointer")
- null14:
- aux01 = call :List.GetNext(aux01)
- if aux01 goto :null15
- Error("null pointer")
- null15:
- var_end = call :List.GetEnd(aux01)
- if aux01 goto :null16
- Error("null pointer")
- null16:
- var_elem = call :List.GetElem(aux01)
- goto :while2_top
- while2_end:
- ret int_ret_val
-
-func List.GetEnd(this)
- t.0 = [this+8]
- ret t.0
-
-func List.GetElem(this)
- t.0 = [this+0]
- ret t.0
-
-func List.GetNext(this)
- t.0 = [this+4]
- ret t.0
-
-func List.Print(this)
- aux01 = this
- var_end = [this+8]
- var_elem = [this+0]
- while3_top:
- t.0 = Sub(1 var_end)
- if0 t.0 goto :while3_end
- if var_elem goto :null17
- Error("null pointer")
- null17:
- t.1 = call :Element.GetAge(var_elem)
- PrintIntS(t.1)
- if aux01 goto :null18
- Error("null pointer")
- null18:
- aux01 = call :List.GetNext(aux01)
- if aux01 goto :null19
- Error("null pointer")
- null19:
- var_end = call :List.GetEnd(aux01)
- if aux01 goto :null20
- Error("null pointer")
- null20:
- var_elem = call :List.GetElem(aux01)
- goto :while3_top
- while3_end:
- ret 1
-
-func LL.Start(this)
- last_elem = HeapAllocZ(12)
- if last_elem goto :null21
- Error("null pointer")
- null21:
- aux01 = call :List.Init(last_elem)
- head = last_elem
- if head goto :null22
- Error("null pointer")
- null22:
- aux01 = call :List.Init(head)
- if head goto :null23
- Error("null pointer")
- null23:
- aux01 = call :List.Print(head)
- el01 = HeapAllocZ(12)
- if el01 goto :null24
- Error("null pointer")
- null24:
- aux01 = call :Element.Init(el01 25 37000 0)
- if head goto :null25
- Error("null pointer")
- null25:
- head = call :List.Insert(head el01)
- if head goto :null26
- Error("null pointer")
- null26:
- aux01 = call :List.Print(head)
- PrintIntS(10000000)
- el01 = HeapAllocZ(12)
- if el01 goto :null27
- Error("null pointer")
- null27:
- aux01 = call :Element.Init(el01 39 42000 1)
- el02 = el01
- if head goto :null28
- Error("null pointer")
- null28:
- head = call :List.Insert(head el01)
- if head goto :null29
- Error("null pointer")
- null29:
- aux01 = call :List.Print(head)
- PrintIntS(10000000)
- el01 = HeapAllocZ(12)
- if el01 goto :null30
- Error("null pointer")
- null30:
- aux01 = call :Element.Init(el01 22 34000 0)
- if head goto :null31
- Error("null pointer")
- null31:
- head = call :List.Insert(head el01)
- if head goto :null32
- Error("null pointer")
- null32:
- aux01 = call :List.Print(head)
- el03 = HeapAllocZ(12)
- if el03 goto :null33
- Error("null pointer")
- null33:
- aux01 = call :Element.Init(el03 27 34000 0)
- if head goto :null34
- Error("null pointer")
- null34:
- t.0 = call :List.Search(head el02)
- PrintIntS(t.0)
- if head goto :null35
- Error("null pointer")
- null35:
- t.1 = call :List.Search(head el03)
- PrintIntS(t.1)
- PrintIntS(10000000)
- el01 = HeapAllocZ(12)
- if el01 goto :null36
- Error("null pointer")
- null36:
- aux01 = call :Element.Init(el01 28 35000 0)
- if head goto :null37
- Error("null pointer")
- null37:
- head = call :List.Insert(head el01)
- if head goto :null38
- Error("null pointer")
- null38:
- aux01 = call :List.Print(head)
- PrintIntS(2220000)
- if head goto :null39
- Error("null pointer")
- null39:
- head = call :List.Delete(head el02)
- if head goto :null40
- Error("null pointer")
- null40:
- aux01 = call :List.Print(head)
- PrintIntS(33300000)
- if head goto :null41
- Error("null pointer")
- null41:
- head = call :List.Delete(head el01)
- if head goto :null42
- Error("null pointer")
- null42:
- aux01 = call :List.Print(head)
- PrintIntS(44440000)
- ret 0
diff --git a/vaporize/tests/LinkedList.vapor b/vaporize/tests/LinkedList.vapor
deleted file mode 100644
index bebdf94..0000000
--- a/vaporize/tests/LinkedList.vapor
+++ /dev/null
@@ -1,505 +0,0 @@
-
-const vmt_Element
- :Element.Init
- :Element.GetAge
- :Element.GetSalary
- :Element.GetMarried
- :Element.Equal
- :Element.Compare
-
-const vmt_List
- :List.Init
- :List.InitNew
- :List.Insert
- :List.SetNext
- :List.Delete
- :List.Search
- :List.GetEnd
- :List.GetElem
- :List.GetNext
- :List.Print
-
-const vmt_LL
- :LL.Start
-
-
-func Main()
- t.0 = HeapAllocZ(4)
- [t.0] = :vmt_LL
- if t.0 goto :null1
- Error("null pointer")
- null1:
- t.1 = [t.0]
- t.1 = [t.1+0]
- t.2 = call t.1(t.0)
- PrintIntS(t.2)
- ret
-
-func Element.Init(this v_Age v_Salary v_Married)
- [this+4] = v_Age
- [this+8] = v_Salary
- [this+12] = v_Married
- ret 1
-
-func Element.GetAge(this)
- t.0 = [this+4]
- ret t.0
-
-func Element.GetSalary(this)
- t.0 = [this+8]
- ret t.0
-
-func Element.GetMarried(this)
- t.0 = [this+12]
- ret t.0
-
-func Element.Equal(this other)
- ret_val = 1
- if other goto :null2
- Error("null pointer")
- null2:
- t.0 = [other]
- t.0 = [t.0+4]
- aux01 = call t.0(other)
- t.1 = [this]
- t.1 = [t.1+20]
- t.2 = [this+4]
- t.3 = call t.1(this aux01 t.2)
- t.4 = Sub(1 t.3)
- if0 t.4 goto :if1_else
- ret_val = 0
- goto :if1_end
- if1_else:
- if other goto :null3
- Error("null pointer")
- null3:
- t.5 = [other]
- t.5 = [t.5+8]
- aux02 = call t.5(other)
- t.6 = [this]
- t.6 = [t.6+20]
- t.7 = [this+8]
- t.8 = call t.6(this aux02 t.7)
- t.9 = Sub(1 t.8)
- if0 t.9 goto :if2_else
- ret_val = 0
- goto :if2_end
- if2_else:
- t.10 = [this+12]
- if0 t.10 goto :if3_else
- if other goto :null4
- Error("null pointer")
- null4:
- t.11 = [other]
- t.11 = [t.11+12]
- t.12 = call t.11(other)
- t.13 = Sub(1 t.12)
- if0 t.13 goto :if4_else
- ret_val = 0
- goto :if4_end
- if4_else:
- nt = 0
- if4_end:
- goto :if3_end
- if3_else:
- if other goto :null5
- Error("null pointer")
- null5:
- t.14 = [other]
- t.14 = [t.14+12]
- t.15 = call t.14(other)
- if0 t.15 goto :if5_else
- ret_val = 0
- goto :if5_end
- if5_else:
- nt = 0
- if5_end:
- if3_end:
- if2_end:
- if1_end:
- ret ret_val
-
-func Element.Compare(this num1 num2)
- retval = 0
- aux02 = Add(num2 1)
- t.0 = LtS(num1 num2)
- if0 t.0 goto :if6_else
- retval = 0
- goto :if6_end
- if6_else:
- t.1 = LtS(num1 aux02)
- t.2 = Sub(1 t.1)
- if0 t.2 goto :if7_else
- retval = 0
- goto :if7_end
- if7_else:
- retval = 1
- if7_end:
- if6_end:
- ret retval
-
-func List.Init(this)
- [this+12] = 1
- ret 1
-
-func List.InitNew(this v_elem v_next v_end)
- [this+12] = v_end
- [this+4] = v_elem
- [this+8] = v_next
- ret 1
-
-func List.Insert(this new_elem)
- aux03 = this
- t.0 = HeapAllocZ(16)
- [t.0] = :vmt_List
- aux02 = t.0
- if aux02 goto :null6
- Error("null pointer")
- null6:
- t.1 = [aux02]
- t.1 = [t.1+4]
- ret_val = call t.1(aux02 new_elem aux03 0)
- ret aux02
-
-func List.SetNext(this v_next)
- [this+8] = v_next
- ret 1
-
-func List.Delete(this e)
- my_head = this
- ret_val = 0
- aux04 = Sub(0 1)
- aux01 = this
- prev = this
- var_end = [this+12]
- var_elem = [this+4]
- while1_top:
- t.1 = Sub(1 var_end)
- if0 t.1 goto :ss1_else
- t.0 = Sub(1 ret_val)
- goto :ss1_end
- ss1_else:
- t.0 = 0
- ss1_end:
- if0 t.0 goto :while1_end
- if e goto :null7
- Error("null pointer")
- null7:
- t.2 = [e]
- t.2 = [t.2+16]
- t.3 = call t.2(e var_elem)
- if0 t.3 goto :if8_else
- ret_val = 1
- t.4 = LtS(aux04 0)
- if0 t.4 goto :if9_else
- if aux01 goto :null8
- Error("null pointer")
- null8:
- t.5 = [aux01]
- t.5 = [t.5+32]
- my_head = call t.5(aux01)
- goto :if9_end
- if9_else:
- t.6 = Sub(0 555)
- PrintIntS(t.6)
- if prev goto :null9
- Error("null pointer")
- null9:
- t.7 = [prev]
- t.7 = [t.7+12]
- if aux01 goto :null10
- Error("null pointer")
- null10:
- t.8 = [aux01]
- t.8 = [t.8+32]
- t.9 = call t.8(aux01)
- aux05 = call t.7(prev t.9)
- t.10 = Sub(0 555)
- PrintIntS(t.10)
- if9_end:
- goto :if8_end
- if8_else:
- nt = 0
- if8_end:
- t.11 = Sub(1 ret_val)
- if0 t.11 goto :if10_else
- prev = aux01
- if aux01 goto :null11
- Error("null pointer")
- null11:
- t.12 = [aux01]
- t.12 = [t.12+32]
- aux01 = call t.12(aux01)
- if aux01 goto :null12
- Error("null pointer")
- null12:
- t.13 = [aux01]
- t.13 = [t.13+24]
- var_end = call t.13(aux01)
- if aux01 goto :null13
- Error("null pointer")
- null13:
- t.14 = [aux01]
- t.14 = [t.14+28]
- var_elem = call t.14(aux01)
- aux04 = 1
- goto :if10_end
- if10_else:
- nt = 0
- if10_end:
- goto :while1_top
- while1_end:
- ret my_head
-
-func List.Search(this e)
- int_ret_val = 0
- aux01 = this
- var_end = [this+12]
- var_elem = [this+4]
- while2_top:
- t.0 = Sub(1 var_end)
- if0 t.0 goto :while2_end
- if e goto :null14
- Error("null pointer")
- null14:
- t.1 = [e]
- t.1 = [t.1+16]
- t.2 = call t.1(e var_elem)
- if0 t.2 goto :if11_else
- int_ret_val = 1
- goto :if11_end
- if11_else:
- nt = 0
- if11_end:
- if aux01 goto :null15
- Error("null pointer")
- null15:
- t.3 = [aux01]
- t.3 = [t.3+32]
- aux01 = call t.3(aux01)
- if aux01 goto :null16
- Error("null pointer")
- null16:
- t.4 = [aux01]
- t.4 = [t.4+24]
- var_end = call t.4(aux01)
- if aux01 goto :null17
- Error("null pointer")
- null17:
- t.5 = [aux01]
- t.5 = [t.5+28]
- var_elem = call t.5(aux01)
- goto :while2_top
- while2_end:
- ret int_ret_val
-
-func List.GetEnd(this)
- t.0 = [this+12]
- ret t.0
-
-func List.GetElem(this)
- t.0 = [this+4]
- ret t.0
-
-func List.GetNext(this)
- t.0 = [this+8]
- ret t.0
-
-func List.Print(this)
- aux01 = this
- var_end = [this+12]
- var_elem = [this+4]
- while3_top:
- t.0 = Sub(1 var_end)
- if0 t.0 goto :while3_end
- if var_elem goto :null18
- Error("null pointer")
- null18:
- t.1 = [var_elem]
- t.1 = [t.1+4]
- t.2 = call t.1(var_elem)
- PrintIntS(t.2)
- if aux01 goto :null19
- Error("null pointer")
- null19:
- t.3 = [aux01]
- t.3 = [t.3+32]
- aux01 = call t.3(aux01)
- if aux01 goto :null20
- Error("null pointer")
- null20:
- t.4 = [aux01]
- t.4 = [t.4+24]
- var_end = call t.4(aux01)
- if aux01 goto :null21
- Error("null pointer")
- null21:
- t.5 = [aux01]
- t.5 = [t.5+28]
- var_elem = call t.5(aux01)
- goto :while3_top
- while3_end:
- ret 1
-
-func LL.Start(this)
- t.0 = HeapAllocZ(16)
- [t.0] = :vmt_List
- last_elem = t.0
- if last_elem goto :null22
- Error("null pointer")
- null22:
- t.1 = [last_elem]
- t.1 = [t.1+0]
- aux01 = call t.1(last_elem)
- head = last_elem
- if head goto :null23
- Error("null pointer")
- null23:
- t.2 = [head]
- t.2 = [t.2+0]
- aux01 = call t.2(head)
- if head goto :null24
- Error("null pointer")
- null24:
- t.3 = [head]
- t.3 = [t.3+36]
- aux01 = call t.3(head)
- t.4 = HeapAllocZ(16)
- [t.4] = :vmt_Element
- el01 = t.4
- if el01 goto :null25
- Error("null pointer")
- null25:
- t.5 = [el01]
- t.5 = [t.5+0]
- aux01 = call t.5(el01 25 37000 0)
- if head goto :null26
- Error("null pointer")
- null26:
- t.6 = [head]
- t.6 = [t.6+8]
- head = call t.6(head el01)
- if head goto :null27
- Error("null pointer")
- null27:
- t.7 = [head]
- t.7 = [t.7+36]
- aux01 = call t.7(head)
- PrintIntS(10000000)
- t.8 = HeapAllocZ(16)
- [t.8] = :vmt_Element
- el01 = t.8
- if el01 goto :null28
- Error("null pointer")
- null28:
- t.9 = [el01]
- t.9 = [t.9+0]
- aux01 = call t.9(el01 39 42000 1)
- el02 = el01
- if head goto :null29
- Error("null pointer")
- null29:
- t.10 = [head]
- t.10 = [t.10+8]
- head = call t.10(head el01)
- if head goto :null30
- Error("null pointer")
- null30:
- t.11 = [head]
- t.11 = [t.11+36]
- aux01 = call t.11(head)
- PrintIntS(10000000)
- t.12 = HeapAllocZ(16)
- [t.12] = :vmt_Element
- el01 = t.12
- if el01 goto :null31
- Error("null pointer")
- null31:
- t.13 = [el01]
- t.13 = [t.13+0]
- aux01 = call t.13(el01 22 34000 0)
- if head goto :null32
- Error("null pointer")
- null32:
- t.14 = [head]
- t.14 = [t.14+8]
- head = call t.14(head el01)
- if head goto :null33
- Error("null pointer")
- null33:
- t.15 = [head]
- t.15 = [t.15+36]
- aux01 = call t.15(head)
- t.16 = HeapAllocZ(16)
- [t.16] = :vmt_Element
- el03 = t.16
- if el03 goto :null34
- Error("null pointer")
- null34:
- t.17 = [el03]
- t.17 = [t.17+0]
- aux01 = call t.17(el03 27 34000 0)
- if head goto :null35
- Error("null pointer")
- null35:
- t.18 = [head]
- t.18 = [t.18+20]
- t.19 = call t.18(head el02)
- PrintIntS(t.19)
- if head goto :null36
- Error("null pointer")
- null36:
- t.20 = [head]
- t.20 = [t.20+20]
- t.21 = call t.20(head el03)
- PrintIntS(t.21)
- PrintIntS(10000000)
- t.22 = HeapAllocZ(16)
- [t.22] = :vmt_Element
- el01 = t.22
- if el01 goto :null37
- Error("null pointer")
- null37:
- t.23 = [el01]
- t.23 = [t.23+0]
- aux01 = call t.23(el01 28 35000 0)
- if head goto :null38
- Error("null pointer")
- null38:
- t.24 = [head]
- t.24 = [t.24+8]
- head = call t.24(head el01)
- if head goto :null39
- Error("null pointer")
- null39:
- t.25 = [head]
- t.25 = [t.25+36]
- aux01 = call t.25(head)
- PrintIntS(2220000)
- if head goto :null40
- Error("null pointer")
- null40:
- t.26 = [head]
- t.26 = [t.26+16]
- head = call t.26(head el02)
- if head goto :null41
- Error("null pointer")
- null41:
- t.27 = [head]
- t.27 = [t.27+36]
- aux01 = call t.27(head)
- PrintIntS(33300000)
- if head goto :null42
- Error("null pointer")
- null42:
- t.28 = [head]
- t.28 = [t.28+16]
- head = call t.28(head el01)
- if head goto :null43
- Error("null pointer")
- null43:
- t.29 = [head]
- t.29 = [t.29+36]
- aux01 = call t.29(head)
- PrintIntS(44440000)
- ret 0
diff --git a/vaporize/tests/MoreThan4.java b/vaporize/tests/MoreThan4.java
deleted file mode 100644
index 4960f01..0000000
--- a/vaporize/tests/MoreThan4.java
+++ /dev/null
@@ -1,29 +0,0 @@
-class MoreThan4{
- public static void main(String[] a){
- System.out.println(new MT4().Start(1,2,3,4,5,6));
- }
-}
-
-class MT4 {
- public int Start(int p1, int p2, int p3 , int p4, int p5, int p6){
- int aux ;
- System.out.println(p1);
- System.out.println(p2);
- System.out.println(p3);
- System.out.println(p4);
- System.out.println(p5);
- System.out.println(p6);
- aux = this.Change(p6,p5,p4,p3,p2,p1);
- return aux ;
- }
-
- public int Change(int p1, int p2, int p3 , int p4, int p5, int p6){
- System.out.println(p1);
- System.out.println(p2);
- System.out.println(p3);
- System.out.println(p4);
- System.out.println(p5);
- System.out.println(p6);
- return 0 ;
- }
-}
diff --git a/vaporize/tests/MoreThan4.opt.vapor b/vaporize/tests/MoreThan4.opt.vapor
deleted file mode 100644
index a59d1b5..0000000
--- a/vaporize/tests/MoreThan4.opt.vapor
+++ /dev/null
@@ -1,27 +0,0 @@
-
-const empty_MT4
-
-
-func Main()
- t.0 = call :MT4.Start(:empty_MT4 1 2 3 4 5 6)
- PrintIntS(t.0)
- ret
-
-func MT4.Start(this p1 p2 p3 p4 p5 p6)
- PrintIntS(p1)
- PrintIntS(p2)
- PrintIntS(p3)
- PrintIntS(p4)
- PrintIntS(p5)
- PrintIntS(p6)
- aux = call :MT4.Change(this p6 p5 p4 p3 p2 p1)
- ret aux
-
-func MT4.Change(this p1 p2 p3 p4 p5 p6)
- PrintIntS(p1)
- PrintIntS(p2)
- PrintIntS(p3)
- PrintIntS(p4)
- PrintIntS(p5)
- PrintIntS(p6)
- ret 0
diff --git a/vaporize/tests/MoreThan4.vapor b/vaporize/tests/MoreThan4.vapor
deleted file mode 100644
index 6067f8e..0000000
--- a/vaporize/tests/MoreThan4.vapor
+++ /dev/null
@@ -1,38 +0,0 @@
-
-const vmt_MT4
- :MT4.Start
- :MT4.Change
-
-
-func Main()
- t.0 = HeapAllocZ(4)
- [t.0] = :vmt_MT4
- if t.0 goto :null1
- Error("null pointer")
- null1:
- t.1 = [t.0]
- t.1 = [t.1+0]
- t.2 = call t.1(t.0 1 2 3 4 5 6)
- PrintIntS(t.2)
- ret
-
-func MT4.Start(this p1 p2 p3 p4 p5 p6)
- PrintIntS(p1)
- PrintIntS(p2)
- PrintIntS(p3)
- PrintIntS(p4)
- PrintIntS(p5)
- PrintIntS(p6)
- t.0 = [this]
- t.0 = [t.0+4]
- aux = call t.0(this p6 p5 p4 p3 p2 p1)
- ret aux
-
-func MT4.Change(this p1 p2 p3 p4 p5 p6)
- PrintIntS(p1)
- PrintIntS(p2)
- PrintIntS(p3)
- PrintIntS(p4)
- PrintIntS(p5)
- PrintIntS(p6)
- ret 0
diff --git a/vaporize/tests/QuickSort.java b/vaporize/tests/QuickSort.java
deleted file mode 100644
index 5893390..0000000
--- a/vaporize/tests/QuickSort.java
+++ /dev/null
@@ -1,112 +0,0 @@
-class QuickSort{
- public static void main(String[] a){
- System.out.println(new QS().Start(10));
- }
-}
-
-
-// This class contains the array of integers and
-// methods to initialize, print and sort the array
-// using Quicksort
-class QS{
-
- int[] number ;
- int size ;
-
- // Invoke the Initialization, Sort and Printing
- // Methods
- public int Start(int sz){
- int aux01 ;
- aux01 = this.Init(sz);
- aux01 = this.Print();
- System.out.println(9999);
- aux01 = size - 1 ;
- aux01 = this.Sort(0,aux01);
- aux01 = this.Print();
- return 0 ;
- }
-
-
- // Sort array of integers using Quicksort method
- public int Sort(int left, int right){
- int v ;
- int i ;
- int j ;
- int nt;
- int t ;
- boolean cont01;
- boolean cont02;
- int aux03 ;
- t = 0 ;
- if (left < right){
- v = number[right] ;
- i = left - 1 ;
- j = right ;
- cont01 = true ;
- while (cont01){
- cont02 = true ;
- while (cont02){
- i = i + 1 ;
- aux03 = number[i] ;
- if (!(aux03<v)) cont02 = false ;
- else cont02 = true ;
- }
- cont02 = true ;
- while (cont02){
- j = j - 1 ;
- aux03 = number[j] ;
- if (!(v < aux03)) cont02 = false ;
- else cont02 = true ;
- }
-
-
- t = number[i] ;
- number[i] = number[j] ;
- number[j] = t ;
- //aux03 = i + 1 ;
- if ( j < (i+1)) cont01 = false ;
- else cont01 = true ;
- }
- number[j] = number[i] ;
- number[i] = number[right] ;
- number[right] = t ;
- nt = this.Sort(left,i-1);
- nt = this.Sort(i+1,right);
- }
- else nt = 0 ;
- return 0 ;
- }
-
-
- // Print array of integers
- public int Print(){
- int j ;
- j = 0 ;
- while (j < (size)) {
- System.out.println(number[j]);
- j = j + 1 ;
- }
- return 0 ;
- }
-
-
- // Initialize array of integers
- public int Init(int sz){
- size = sz ;
- number = new int[sz] ;
-
- number[0] = 20 ;
- number[1] = 7 ;
- number[2] = 12 ;
- number[3] = 18 ;
- number[4] = 2 ;
- number[5] = 11 ;
- number[6] = 6 ;
- number[7] = 9 ;
- number[8] = 19 ;
- number[9] = 5 ;
-
- return 0 ;
- }
-
-}
diff --git a/vaporize/tests/QuickSort.opt.vapor b/vaporize/tests/QuickSort.opt.vapor
deleted file mode 100644
index 6e14e5a..0000000
--- a/vaporize/tests/QuickSort.opt.vapor
+++ /dev/null
@@ -1,378 +0,0 @@
-
-const empty_QS
-
-
-func Main()
- t.0 = HeapAllocZ(8)
- if t.0 goto :null1
- Error("null pointer")
- null1:
- t.1 = call :QS.Start(t.0 10)
- PrintIntS(t.1)
- ret
-
-func QS.Start(this sz)
- aux01 = call :QS.Init(this sz)
- aux01 = call :QS.Print(this)
- PrintIntS(9999)
- t.0 = [this+4]
- aux01 = Sub(t.0 1)
- aux01 = call :QS.Sort(this 0 aux01)
- aux01 = call :QS.Print(this)
- ret 0
-
-func QS.Sort(this left right)
- t = 0
- t.0 = LtS(left right)
- if0 t.0 goto :if1_else
- t.1 = [this+0]
- if t.1 goto :null2
- Error("null pointer")
- null2:
- t.2 = [t.1]
- t.2 = Lt(right t.2)
- if t.2 goto :bounds1
- Error("array index out of bounds")
- bounds1:
- t.2 = MulS(right 4)
- t.2 = Add(t.2 t.1)
- v = [t.2+4]
- i = Sub(left 1)
- j = right
- cont01 = 1
- while1_top:
- if0 cont01 goto :while1_end
- cont02 = 1
- while2_top:
- if0 cont02 goto :while2_end
- i = Add(i 1)
- t.3 = [this+0]
- if t.3 goto :null3
- Error("null pointer")
- null3:
- t.4 = [t.3]
- t.4 = Lt(i t.4)
- if t.4 goto :bounds2
- Error("array index out of bounds")
- bounds2:
- t.4 = MulS(i 4)
- t.4 = Add(t.4 t.3)
- aux03 = [t.4+4]
- t.5 = LtS(aux03 v)
- if t.5 goto :if2_else
- cont02 = 0
- goto :if2_end
- if2_else:
- cont02 = 1
- if2_end:
- goto :while2_top
- while2_end:
- cont02 = 1
- while3_top:
- if0 cont02 goto :while3_end
- j = Sub(j 1)
- t.6 = [this+0]
- if t.6 goto :null4
- Error("null pointer")
- null4:
- t.7 = [t.6]
- t.7 = Lt(j t.7)
- if t.7 goto :bounds3
- Error("array index out of bounds")
- bounds3:
- t.7 = MulS(j 4)
- t.7 = Add(t.7 t.6)
- aux03 = [t.7+4]
- t.8 = LtS(v aux03)
- if t.8 goto :if3_else
- cont02 = 0
- goto :if3_end
- if3_else:
- cont02 = 1
- if3_end:
- goto :while3_top
- while3_end:
- t.9 = [this+0]
- if t.9 goto :null5
- Error("null pointer")
- null5:
- t.10 = [t.9]
- t.10 = Lt(i t.10)
- if t.10 goto :bounds4
- Error("array index out of bounds")
- bounds4:
- t.10 = MulS(i 4)
- t.10 = Add(t.10 t.9)
- t = [t.10+4]
- t.11 = [this+0]
- if t.11 goto :null6
- Error("null pointer")
- null6:
- t.12 = [t.11]
- t.12 = Lt(i t.12)
- if t.12 goto :bounds5
- Error("array index out of bounds")
- bounds5:
- t.12 = MulS(i 4)
- t.12 = Add(t.12 t.11)
- t.13 = [this+0]
- if t.13 goto :null7
- Error("null pointer")
- null7:
- t.14 = [t.13]
- t.14 = Lt(j t.14)
- if t.14 goto :bounds6
- Error("array index out of bounds")
- bounds6:
- t.14 = MulS(j 4)
- t.14 = Add(t.14 t.13)
- t.15 = [t.14+4]
- [t.12+4] = t.15
- t.16 = [this+0]
- if t.16 goto :null8
- Error("null pointer")
- null8:
- t.17 = [t.16]
- t.17 = Lt(j t.17)
- if t.17 goto :bounds7
- Error("array index out of bounds")
- bounds7:
- t.17 = MulS(j 4)
- t.17 = Add(t.17 t.16)
- [t.17+4] = t
- t.18 = Add(i 1)
- t.19 = LtS(j t.18)
- if0 t.19 goto :if4_else
- cont01 = 0
- goto :if4_end
- if4_else:
- cont01 = 1
- if4_end:
- goto :while1_top
- while1_end:
- t.20 = [this+0]
- if t.20 goto :null9
- Error("null pointer")
- null9:
- t.21 = [t.20]
- t.21 = Lt(j t.21)
- if t.21 goto :bounds8
- Error("array index out of bounds")
- bounds8:
- t.21 = MulS(j 4)
- t.21 = Add(t.21 t.20)
- t.22 = [this+0]
- if t.22 goto :null10
- Error("null pointer")
- null10:
- t.23 = [t.22]
- t.23 = Lt(i t.23)
- if t.23 goto :bounds9
- Error("array index out of bounds")
- bounds9:
- t.23 = MulS(i 4)
- t.23 = Add(t.23 t.22)
- t.24 = [t.23+4]
- [t.21+4] = t.24
- t.25 = [this+0]
- if t.25 goto :null11
- Error("null pointer")
- null11:
- t.26 = [t.25]
- t.26 = Lt(i t.26)
- if t.26 goto :bounds10
- Error("array index out of bounds")
- bounds10:
- t.26 = MulS(i 4)
- t.26 = Add(t.26 t.25)
- t.27 = [this+0]
- if t.27 goto :null12
- Error("null pointer")
- null12:
- t.28 = [t.27]
- t.28 = Lt(right t.28)
- if t.28 goto :bounds11
- Error("array index out of bounds")
- bounds11:
- t.28 = MulS(right 4)
- t.28 = Add(t.28 t.27)
- t.29 = [t.28+4]
- [t.26+4] = t.29
- t.30 = [this+0]
- if t.30 goto :null13
- Error("null pointer")
- null13:
- t.31 = [t.30]
- t.31 = Lt(right t.31)
- if t.31 goto :bounds12
- Error("array index out of bounds")
- bounds12:
- t.31 = MulS(right 4)
- t.31 = Add(t.31 t.30)
- [t.31+4] = t
- t.32 = Sub(i 1)
- nt = call :QS.Sort(this left t.32)
- t.33 = Add(i 1)
- nt = call :QS.Sort(this t.33 right)
- goto :if1_end
- if1_else:
- nt = 0
- if1_end:
- ret 0
-
-func QS.Print(this)
- j = 0
- while4_top:
- t.0 = [this+4]
- t.1 = LtS(j t.0)
- if0 t.1 goto :while4_end
- t.2 = [this+0]
- if t.2 goto :null14
- Error("null pointer")
- null14:
- t.3 = [t.2]
- t.3 = Lt(j t.3)
- if t.3 goto :bounds13
- Error("array index out of bounds")
- bounds13:
- t.3 = MulS(j 4)
- t.3 = Add(t.3 t.2)
- t.4 = [t.3+4]
- PrintIntS(t.4)
- j = Add(j 1)
- goto :while4_top
- while4_end:
- ret 0
-
-func QS.Init(this sz)
- [this+4] = sz
- t.0 = call :AllocArray(sz)
- [this+0] = t.0
- t.1 = [this+0]
- if t.1 goto :null15
- Error("null pointer")
- null15:
- t.2 = [t.1]
- t.2 = Lt(0 t.2)
- if t.2 goto :bounds14
- Error("array index out of bounds")
- bounds14:
- t.2 = MulS(0 4)
- t.2 = Add(t.2 t.1)
- [t.2+4] = 20
- t.3 = [this+0]
- if t.3 goto :null16
- Error("null pointer")
- null16:
- t.4 = [t.3]
- t.4 = Lt(1 t.4)
- if t.4 goto :bounds15
- Error("array index out of bounds")
- bounds15:
- t.4 = MulS(1 4)
- t.4 = Add(t.4 t.3)
- [t.4+4] = 7
- t.5 = [this+0]
- if t.5 goto :null17
- Error("null pointer")
- null17:
- t.6 = [t.5]
- t.6 = Lt(2 t.6)
- if t.6 goto :bounds16
- Error("array index out of bounds")
- bounds16:
- t.6 = MulS(2 4)
- t.6 = Add(t.6 t.5)
- [t.6+4] = 12
- t.7 = [this+0]
- if t.7 goto :null18
- Error("null pointer")
- null18:
- t.8 = [t.7]
- t.8 = Lt(3 t.8)
- if t.8 goto :bounds17
- Error("array index out of bounds")
- bounds17:
- t.8 = MulS(3 4)
- t.8 = Add(t.8 t.7)
- [t.8+4] = 18
- t.9 = [this+0]
- if t.9 goto :null19
- Error("null pointer")
- null19:
- t.10 = [t.9]
- t.10 = Lt(4 t.10)
- if t.10 goto :bounds18
- Error("array index out of bounds")
- bounds18:
- t.10 = MulS(4 4)
- t.10 = Add(t.10 t.9)
- [t.10+4] = 2
- t.11 = [this+0]
- if t.11 goto :null20
- Error("null pointer")
- null20:
- t.12 = [t.11]
- t.12 = Lt(5 t.12)
- if t.12 goto :bounds19
- Error("array index out of bounds")
- bounds19:
- t.12 = MulS(5 4)
- t.12 = Add(t.12 t.11)
- [t.12+4] = 11
- t.13 = [this+0]
- if t.13 goto :null21
- Error("null pointer")
- null21:
- t.14 = [t.13]
- t.14 = Lt(6 t.14)
- if t.14 goto :bounds20
- Error("array index out of bounds")
- bounds20:
- t.14 = MulS(6 4)
- t.14 = Add(t.14 t.13)
- [t.14+4] = 6
- t.15 = [this+0]
- if t.15 goto :null22
- Error("null pointer")
- null22:
- t.16 = [t.15]
- t.16 = Lt(7 t.16)
- if t.16 goto :bounds21
- Error("array index out of bounds")
- bounds21:
- t.16 = MulS(7 4)
- t.16 = Add(t.16 t.15)
- [t.16+4] = 9
- t.17 = [this+0]
- if t.17 goto :null23
- Error("null pointer")
- null23:
- t.18 = [t.17]
- t.18 = Lt(8 t.18)
- if t.18 goto :bounds22
- Error("array index out of bounds")
- bounds22:
- t.18 = MulS(8 4)
- t.18 = Add(t.18 t.17)
- [t.18+4] = 19
- t.19 = [this+0]
- if t.19 goto :null24
- Error("null pointer")
- null24:
- t.20 = [t.19]
- t.20 = Lt(9 t.20)
- if t.20 goto :bounds23
- Error("array index out of bounds")
- bounds23:
- t.20 = MulS(9 4)
- t.20 = Add(t.20 t.19)
- [t.20+4] = 5
- ret 0
-
-func AllocArray(size)
- bytes = MulS(size 4)
- bytes = Add(bytes 4)
- v = HeapAllocZ(bytes)
- [v] = size
- ret v
diff --git a/vaporize/tests/QuickSort.vapor b/vaporize/tests/QuickSort.vapor
deleted file mode 100644
index 3fe3798..0000000
--- a/vaporize/tests/QuickSort.vapor
+++ /dev/null
@@ -1,399 +0,0 @@
-
-const vmt_QS
- :QS.Start
- :QS.Sort
- :QS.Print
- :QS.Init
-
-
-func Main()
- t.0 = HeapAllocZ(12)
- [t.0] = :vmt_QS
- if t.0 goto :null1
- Error("null pointer")
- null1:
- t.1 = [t.0]
- t.1 = [t.1+0]
- t.2 = call t.1(t.0 10)
- PrintIntS(t.2)
- ret
-
-func QS.Start(this sz)
- t.0 = [this]
- t.0 = [t.0+12]
- aux01 = call t.0(this sz)
- t.1 = [this]
- t.1 = [t.1+8]
- aux01 = call t.1(this)
- PrintIntS(9999)
- t.2 = [this+8]
- aux01 = Sub(t.2 1)
- t.3 = [this]
- t.3 = [t.3+4]
- aux01 = call t.3(this 0 aux01)
- t.4 = [this]
- t.4 = [t.4+8]
- aux01 = call t.4(this)
- ret 0
-
-func QS.Sort(this left right)
- t = 0
- t.0 = LtS(left right)
- if0 t.0 goto :if1_else
- t.1 = [this+4]
- if t.1 goto :null2
- Error("null pointer")
- null2:
- t.2 = [t.1]
- t.2 = Lt(right t.2)
- if t.2 goto :bounds1
- Error("array index out of bounds")
- bounds1:
- t.2 = MulS(right 4)
- t.2 = Add(t.2 t.1)
- v = [t.2+4]
- i = Sub(left 1)
- j = right
- cont01 = 1
- while1_top:
- if0 cont01 goto :while1_end
- cont02 = 1
- while2_top:
- if0 cont02 goto :while2_end
- i = Add(i 1)
- t.3 = [this+4]
- if t.3 goto :null3
- Error("null pointer")
- null3:
- t.4 = [t.3]
- t.4 = Lt(i t.4)
- if t.4 goto :bounds2
- Error("array index out of bounds")
- bounds2:
- t.4 = MulS(i 4)
- t.4 = Add(t.4 t.3)
- aux03 = [t.4+4]
- t.5 = LtS(aux03 v)
- t.6 = Sub(1 t.5)
- if0 t.6 goto :if2_else
- cont02 = 0
- goto :if2_end
- if2_else:
- cont02 = 1
- if2_end:
- goto :while2_top
- while2_end:
- cont02 = 1
- while3_top:
- if0 cont02 goto :while3_end
- j = Sub(j 1)
- t.7 = [this+4]
- if t.7 goto :null4
- Error("null pointer")
- null4:
- t.8 = [t.7]
- t.8 = Lt(j t.8)
- if t.8 goto :bounds3
- Error("array index out of bounds")
- bounds3:
- t.8 = MulS(j 4)
- t.8 = Add(t.8 t.7)
- aux03 = [t.8+4]
- t.9 = LtS(v aux03)
- t.10 = Sub(1 t.9)
- if0 t.10 goto :if3_else
- cont02 = 0
- goto :if3_end
- if3_else:
- cont02 = 1
- if3_end:
- goto :while3_top
- while3_end:
- t.11 = [this+4]
- if t.11 goto :null5
- Error("null pointer")
- null5:
- t.12 = [t.11]
- t.12 = Lt(i t.12)
- if t.12 goto :bounds4
- Error("array index out of bounds")
- bounds4:
- t.12 = MulS(i 4)
- t.12 = Add(t.12 t.11)
- t = [t.12+4]
- t.13 = [this+4]
- if t.13 goto :null6
- Error("null pointer")
- null6:
- t.14 = [t.13]
- t.14 = Lt(i t.14)
- if t.14 goto :bounds5
- Error("array index out of bounds")
- bounds5:
- t.14 = MulS(i 4)
- t.14 = Add(t.14 t.13)
- t.15 = [this+4]
- if t.15 goto :null7
- Error("null pointer")
- null7:
- t.16 = [t.15]
- t.16 = Lt(j t.16)
- if t.16 goto :bounds6
- Error("array index out of bounds")
- bounds6:
- t.16 = MulS(j 4)
- t.16 = Add(t.16 t.15)
- t.17 = [t.16+4]
- [t.14+4] = t.17
- t.18 = [this+4]
- if t.18 goto :null8
- Error("null pointer")
- null8:
- t.19 = [t.18]
- t.19 = Lt(j t.19)
- if t.19 goto :bounds7
- Error("array index out of bounds")
- bounds7:
- t.19 = MulS(j 4)
- t.19 = Add(t.19 t.18)
- [t.19+4] = t
- t.20 = Add(i 1)
- t.21 = LtS(j t.20)
- if0 t.21 goto :if4_else
- cont01 = 0
- goto :if4_end
- if4_else:
- cont01 = 1
- if4_end:
- goto :while1_top
- while1_end:
- t.22 = [this+4]
- if t.22 goto :null9
- Error("null pointer")
- null9:
- t.23 = [t.22]
- t.23 = Lt(j t.23)
- if t.23 goto :bounds8
- Error("array index out of bounds")
- bounds8:
- t.23 = MulS(j 4)
- t.23 = Add(t.23 t.22)
- t.24 = [this+4]
- if t.24 goto :null10
- Error("null pointer")
- null10:
- t.25 = [t.24]
- t.25 = Lt(i t.25)
- if t.25 goto :bounds9
- Error("array index out of bounds")
- bounds9:
- t.25 = MulS(i 4)
- t.25 = Add(t.25 t.24)
- t.26 = [t.25+4]
- [t.23+4] = t.26
- t.27 = [this+4]
- if t.27 goto :null11
- Error("null pointer")
- null11:
- t.28 = [t.27]
- t.28 = Lt(i t.28)
- if t.28 goto :bounds10
- Error("array index out of bounds")
- bounds10:
- t.28 = MulS(i 4)
- t.28 = Add(t.28 t.27)
- t.29 = [this+4]
- if t.29 goto :null12
- Error("null pointer")
- null12:
- t.30 = [t.29]
- t.30 = Lt(right t.30)
- if t.30 goto :bounds11
- Error("array index out of bounds")
- bounds11:
- t.30 = MulS(right 4)
- t.30 = Add(t.30 t.29)
- t.31 = [t.30+4]
- [t.28+4] = t.31
- t.32 = [this+4]
- if t.32 goto :null13
- Error("null pointer")
- null13:
- t.33 = [t.32]
- t.33 = Lt(right t.33)
- if t.33 goto :bounds12
- Error("array index out of bounds")
- bounds12:
- t.33 = MulS(right 4)
- t.33 = Add(t.33 t.32)
- [t.33+4] = t
- t.34 = [this]
- t.34 = [t.34+4]
- t.35 = Sub(i 1)
- nt = call t.34(this left t.35)
- t.36 = [this]
- t.36 = [t.36+4]
- t.37 = Add(i 1)
- nt = call t.36(this t.37 right)
- goto :if1_end
- if1_else:
- nt = 0
- if1_end:
- ret 0
-
-func QS.Print(this)
- j = 0
- while4_top:
- t.0 = [this+8]
- t.1 = LtS(j t.0)
- if0 t.1 goto :while4_end
- t.2 = [this+4]
- if t.2 goto :null14
- Error("null pointer")
- null14:
- t.3 = [t.2]
- t.3 = Lt(j t.3)
- if t.3 goto :bounds13
- Error("array index out of bounds")
- bounds13:
- t.3 = MulS(j 4)
- t.3 = Add(t.3 t.2)
- t.4 = [t.3+4]
- PrintIntS(t.4)
- j = Add(j 1)
- goto :while4_top
- while4_end:
- ret 0
-
-func QS.Init(this sz)
- [this+8] = sz
- t.0 = call :AllocArray(sz)
- [this+4] = t.0
- t.1 = [this+4]
- if t.1 goto :null15
- Error("null pointer")
- null15:
- t.2 = [t.1]
- t.2 = Lt(0 t.2)
- if t.2 goto :bounds14
- Error("array index out of bounds")
- bounds14:
- t.2 = MulS(0 4)
- t.2 = Add(t.2 t.1)
- [t.2+4] = 20
- t.3 = [this+4]
- if t.3 goto :null16
- Error("null pointer")
- null16:
- t.4 = [t.3]
- t.4 = Lt(1 t.4)
- if t.4 goto :bounds15
- Error("array index out of bounds")
- bounds15:
- t.4 = MulS(1 4)
- t.4 = Add(t.4 t.3)
- [t.4+4] = 7
- t.5 = [this+4]
- if t.5 goto :null17
- Error("null pointer")
- null17:
- t.6 = [t.5]
- t.6 = Lt(2 t.6)
- if t.6 goto :bounds16
- Error("array index out of bounds")
- bounds16:
- t.6 = MulS(2 4)
- t.6 = Add(t.6 t.5)
- [t.6+4] = 12
- t.7 = [this+4]
- if t.7 goto :null18
- Error("null pointer")
- null18:
- t.8 = [t.7]
- t.8 = Lt(3 t.8)
- if t.8 goto :bounds17
- Error("array index out of bounds")
- bounds17:
- t.8 = MulS(3 4)
- t.8 = Add(t.8 t.7)
- [t.8+4] = 18
- t.9 = [this+4]
- if t.9 goto :null19
- Error("null pointer")
- null19:
- t.10 = [t.9]
- t.10 = Lt(4 t.10)
- if t.10 goto :bounds18
- Error("array index out of bounds")
- bounds18:
- t.10 = MulS(4 4)
- t.10 = Add(t.10 t.9)
- [t.10+4] = 2
- t.11 = [this+4]
- if t.11 goto :null20
- Error("null pointer")
- null20:
- t.12 = [t.11]
- t.12 = Lt(5 t.12)
- if t.12 goto :bounds19
- Error("array index out of bounds")
- bounds19:
- t.12 = MulS(5 4)
- t.12 = Add(t.12 t.11)
- [t.12+4] = 11
- t.13 = [this+4]
- if t.13 goto :null21
- Error("null pointer")
- null21:
- t.14 = [t.13]
- t.14 = Lt(6 t.14)
- if t.14 goto :bounds20
- Error("array index out of bounds")
- bounds20:
- t.14 = MulS(6 4)
- t.14 = Add(t.14 t.13)
- [t.14+4] = 6
- t.15 = [this+4]
- if t.15 goto :null22
- Error("null pointer")
- null22:
- t.16 = [t.15]
- t.16 = Lt(7 t.16)
- if t.16 goto :bounds21
- Error("array index out of bounds")
- bounds21:
- t.16 = MulS(7 4)
- t.16 = Add(t.16 t.15)
- [t.16+4] = 9
- t.17 = [this+4]
- if t.17 goto :null23
- Error("null pointer")
- null23:
- t.18 = [t.17]
- t.18 = Lt(8 t.18)
- if t.18 goto :bounds22
- Error("array index out of bounds")
- bounds22:
- t.18 = MulS(8 4)
- t.18 = Add(t.18 t.17)
- [t.18+4] = 19
- t.19 = [this+4]
- if t.19 goto :null24
- Error("null pointer")
- null24:
- t.20 = [t.19]
- t.20 = Lt(9 t.20)
- if t.20 goto :bounds23
- Error("array index out of bounds")
- bounds23:
- t.20 = MulS(9 4)
- t.20 = Add(t.20 t.19)
- [t.20+4] = 5
- ret 0
-
-func AllocArray(size)
- bytes = MulS(size 4)
- bytes = Add(bytes 4)
- v = HeapAllocZ(bytes)
- [v] = size
- ret v
diff --git a/vaporize/tests/ShortCircuit.opt.vapor b/vaporize/tests/ShortCircuit.opt.vapor
deleted file mode 100644
index 8275acd..0000000
--- a/vaporize/tests/ShortCircuit.opt.vapor
+++ /dev/null
@@ -1,215 +0,0 @@
-
-const vmt_Main
- :Main.run1
- :Main.run2
- :Main.run3
- :Main.run4
- :Main.if1
- :Main.if2
- :Main.if3
- :Main.if4
- :Main.if5
- :Main.if6
-
-
-func Main()
- PrintIntS(1)
- ret
-
-func Main.run1(this a b c)
- if0 a goto :ss2_else
- t.1 = b
- goto :ss2_end
- ss2_else:
- t.1 = 0
- ss2_end:
- if0 t.1 goto :ss1_else
- t.0 = 1
- goto :ss1_end
- ss1_else:
- t.0 = c
- ss1_end:
- ret t.0
-
-func Main.run2(this a b c)
- if0 a goto :ss3_else
- if0 b goto :ss4_else
- t.1 = 1
- goto :ss4_end
- ss4_else:
- t.1 = c
- ss4_end:
- t.0 = t.1
- goto :ss3_end
- ss3_else:
- t.0 = 0
- ss3_end:
- ret t.0
-
-func Main.run3(this a b c)
- if0 a goto :ss6_else
- t.1 = 1
- goto :ss6_end
- ss6_else:
- t.1 = b
- ss6_end:
- if0 t.1 goto :ss5_else
- t.0 = c
- goto :ss5_end
- ss5_else:
- t.0 = 0
- ss5_end:
- ret t.0
-
-func Main.run4(this a b c)
- if0 a goto :ss7_else
- t.0 = 1
- goto :ss7_end
- ss7_else:
- if0 b goto :ss8_else
- t.1 = c
- goto :ss8_end
- ss8_else:
- t.1 = 0
- ss8_end:
- t.0 = t.1
- ss7_end:
- ret t.0
-
-func Main.if1(this a b c)
- if0 a goto :ss10_else
- t.1 = b
- goto :ss10_end
- ss10_else:
- t.1 = 0
- ss10_end:
- if0 t.1 goto :ss9_else
- t.0 = 1
- goto :ss9_end
- ss9_else:
- t.0 = c
- ss9_end:
- if0 t.0 goto :if1_else
- if1_then:
- PrintIntS(1)
- goto :if1_end
- if1_else:
- if1_end:
- ret 1
-
-func Main.if2(this a b c)
- if0 a goto :ss11_else
- if0 b goto :ss12_else
- t.1 = 1
- goto :ss12_end
- ss12_else:
- t.1 = c
- ss12_end:
- t.0 = t.1
- goto :ss11_end
- ss11_else:
- t.0 = 0
- ss11_end:
- if0 t.0 goto :if2_else
- if2_then:
- PrintIntS(2)
- goto :if2_end
- if2_else:
- if2_end:
- ret 1
-
-func Main.if3(this a b c)
- if0 a goto :ss14_else
- t.1 = 1
- goto :ss14_end
- ss14_else:
- t.1 = b
- ss14_end:
- if0 t.1 goto :ss13_else
- t.0 = c
- goto :ss13_end
- ss13_else:
- t.0 = 0
- ss13_end:
- if0 t.0 goto :if3_else
- if3_then:
- PrintIntS(3)
- goto :if3_end
- if3_else:
- if3_end:
- ret 1
-
-func Main.if4(this a b c)
- if0 a goto :ss15_else
- t.0 = 1
- goto :ss15_end
- ss15_else:
- if0 b goto :ss16_else
- t.1 = c
- goto :ss16_end
- ss16_else:
- t.1 = 0
- ss16_end:
- t.0 = t.1
- ss15_end:
- if0 t.0 goto :if4_else
- if4_then:
- PrintIntS(4)
- goto :if4_end
- if4_else:
- if4_end:
- ret 1
-
-func Main.if5(this a b c d)
- if0 a goto :ss19_else
- t.2 = 1
- goto :ss19_end
- ss19_else:
- t.2 = b
- ss19_end:
- if0 t.2 goto :ss18_else
- t.1 = 1
- goto :ss18_end
- ss18_else:
- t.1 = c
- ss18_end:
- if0 t.1 goto :ss17_else
- t.0 = 1
- goto :ss17_end
- ss17_else:
- t.0 = d
- ss17_end:
- if0 t.0 goto :if5_else
- if5_then:
- PrintIntS(5)
- goto :if5_end
- if5_else:
- if5_end:
- ret 1
-
-func Main.if6(this a b c d)
- if0 a goto :ss22_else
- t.2 = b
- goto :ss22_end
- ss22_else:
- t.2 = 0
- ss22_end:
- if0 t.2 goto :ss21_else
- t.1 = c
- goto :ss21_end
- ss21_else:
- t.1 = 0
- ss21_end:
- if0 t.1 goto :ss20_else
- t.0 = d
- goto :ss20_end
- ss20_else:
- t.0 = 0
- ss20_end:
- if0 t.0 goto :if6_else
- if6_then:
- PrintIntS(6)
- goto :if6_end
- if6_else:
- if6_end:
- ret 1
diff --git a/vaporize/tests/ShortCircuit.vapor b/vaporize/tests/ShortCircuit.vapor
deleted file mode 100644
index 31cc088..0000000
--- a/vaporize/tests/ShortCircuit.vapor
+++ /dev/null
@@ -1,128 +0,0 @@
-
-const empty_Main
-
-
-func Main()
- PrintIntS(1)
- ret
-
-func Main.run1(this a b c)
- if0 a goto :ss1_else
- if0 b goto :ss1_else
- t.0 = 1
- goto :ss1_end
- ss1_else:
- t.0 = c
- ss1_end:
- ret t.0
-
-func Main.run2(this a b c)
- if0 a goto :ss3_else
- if0 b goto :ss4_else
- t.1 = 1
- goto :ss4_end
- ss4_else:
- t.1 = c
- ss4_end:
- t.0 = t.1
- goto :ss3_end
- ss3_else:
- t.0 = 0
- ss3_end:
- ret t.0
-
-func Main.run3(this a b c)
- if a goto :ss5_then
- if0 b goto :ss5_else
- ss5_then:
- t.0 = c
- goto :ss5_end
- ss5_else:
- t.0 = 0
- ss5_end:
- ret t.0
-
-func Main.run4(this a b c)
- if0 a goto :ss7_else
- t.0 = 1
- goto :ss7_end
- ss7_else:
- if0 b goto :ss8_else
- t.1 = c
- goto :ss8_end
- ss8_else:
- t.1 = 0
- ss8_end:
- t.0 = t.1
- ss7_end:
- ret t.0
-
-func Main.if1(this a b c)
- if0 a goto :ss9
- if b goto :if1_then
- ss9:
- if0 c goto :if1_else
- if1_then:
- PrintIntS(1)
- goto :if1_end
- if1_else:
- if1_end:
- ret 1
-
-func Main.if2(this a b c)
- if0 a goto :if2_else
- if b goto :if2_then
- if0 c goto :if2_else
- if2_then:
- PrintIntS(2)
- goto :if2_end
- if2_else:
- if2_end:
- ret 1
-
-func Main.if3(this a b c)
- if a goto :ss13
- if0 b goto :if3_else
- ss13:
- if0 c goto :if3_else
- if3_then:
- PrintIntS(3)
- goto :if3_end
- if3_else:
- if3_end:
- ret 1
-
-func Main.if4(this a b c)
- if a goto :if4_then
- if0 b goto :if4_else
- if0 c goto :if4_else
- if4_then:
- PrintIntS(4)
- goto :if4_end
- if4_else:
- if4_end:
- ret 1
-
-func Main.if5(this a b c d)
- if a goto :if5_then
- if b goto :if5_then
- if c goto :if5_then
- if0 d goto :if5_else
- if5_then:
- PrintIntS(5)
- goto :if5_end
- if5_else:
- if5_end:
- ret 1
-
-func Main.if6(this a b c d)
- if0 a goto :if6_else
- if0 b goto :if6_else
- if0 c goto :if6_else
- if0 d goto :if6_else
- if6_then:
- PrintIntS(6)
- goto :if6_end
- if6_else:
- if6_end:
- ret 1
diff --git a/vaporize/tests/TreeVisitor.java b/vaporize/tests/TreeVisitor.java
deleted file mode 100644
index 8debfe6..0000000
--- a/vaporize/tests/TreeVisitor.java
+++ /dev/null
@@ -1,374 +0,0 @@
-// The classes are basically the same as the BinaryTree
-// file except the visitor classes and the accept method
-// in the Tree class
-
-class TreeVisitor{
- public static void main(String[] a){
- System.out.println(new TV().Start());
- }
-}
-
-class TV {
-
- public int Start(){
- Tree root ;
- boolean ntb ;
- int nti ;
- MyVisitor v ;
-
- root = new Tree();
- ntb = root.Init(16);
- ntb = root.Print();
- System.out.println(100000000);
- ntb = root.Insert(8) ;
- ntb = root.Insert(24) ;
- ntb = root.Insert(4) ;
- ntb = root.Insert(12) ;
- ntb = root.Insert(20) ;
- ntb = root.Insert(28) ;
- ntb = root.Insert(14) ;
- ntb = root.Print();
- System.out.println(100000000);
- v = new MyVisitor();
- System.out.println(50000000);
- nti = root.accept(v);
- System.out.println(100000000);
- System.out.println(root.Search(24));
- System.out.println(root.Search(12));
- System.out.println(root.Search(16));
- System.out.println(root.Search(50));
- System.out.println(root.Search(12));
- ntb = root.Delete(12);
- ntb = root.Print();
- System.out.println(root.Search(12));
-
- return 0 ;
- }
-
-}
-
-
-class Tree{
- Tree left ;
- Tree right;
- int key ;
- boolean has_left ;
- boolean has_right ;
- Tree my_null ;
-
-
-
- //Tree new_node ;
- //Tree current_node ;
- //Tree parent_node ;
-
- // boolean ntb ;
- //boolean cont ;
- //boolean found ;
- //int ifound ;
- // boolean is_root ;
- // int nti ;
- // int key_aux ;
- // int auxkey1 ;
- // int auxkey2 ;
-
- public boolean Init(int v_key){
- key = v_key ;
- has_left = false ;
- has_right = false ;
- return true ;
- }
-
- public boolean SetRight(Tree rn){
- right = rn ;
- return true ;
- }
-
- public boolean SetLeft(Tree ln){
- left = ln ;
- return true ;
- }
-
- public Tree GetRight(){
- return right ;
- }
-
- public Tree GetLeft(){
- return left;
- }
-
- public int GetKey(){
- return key ;
- }
-
- public boolean SetKey(int v_key){
- key = v_key ;
- return true ;
- }
-
- public boolean GetHas_Right(){
- return has_right ;
- }
-
- public boolean GetHas_Left(){
- return has_left ;
- }
-
- public boolean SetHas_Left(boolean val){
- has_left = val ;
- return true ;
- }
-
- public boolean SetHas_Right(boolean val){
- has_right = val ;
- return true ;
- }
-
- public boolean Compare(int num1 , int num2){
- boolean ntb ;
- int nti ;
-
- ntb = false ;
- nti = num2 + 1 ;
- if (num1 < num2) ntb = false ;
- else if (!(num1 < nti)) ntb = false ;
- else ntb = true ;
- return ntb ;
- }
-
- public boolean Insert(int v_key){
- Tree new_node ;
- boolean ntb ;
- Tree current_node ;
- boolean cont ;
- int key_aux ;
-
- new_node = new Tree();
- ntb = new_node.Init(v_key) ;
- current_node = this ;
- cont = true ;
- while (cont){
- key_aux = current_node.GetKey();
- if (v_key < key_aux){
- if (current_node.GetHas_Left())
- current_node = current_node.GetLeft() ;
- else {
- cont = false ;
- ntb = current_node.SetHas_Left(true);
- ntb = current_node.SetLeft(new_node);
- }
- }
- else{
- if (current_node.GetHas_Right())
- current_node = current_node.GetRight() ;
- else {
- cont = false ;
- ntb = current_node.SetHas_Right(true);
- ntb = current_node.SetRight(new_node);
- }
- }
- }
- return true ;
- }
-
- public boolean Delete(int v_key){
- Tree current_node ;
- Tree parent_node ;
- boolean cont ;
- boolean found ;
- boolean ntb ;
- boolean is_root ;
- int key_aux ;
-
- current_node = this ;
- parent_node = this ;
- cont = true ;
- found = false ;
- is_root = true ;
- while (cont){
- key_aux = current_node.GetKey();
- if (v_key < key_aux)
- if (current_node.GetHas_Left()){
- parent_node = current_node ;
- current_node = current_node.GetLeft() ;
- }
- else cont = false ;
- else
- if (key_aux < v_key)
- if (current_node.GetHas_Right()){
- parent_node = current_node ;
- current_node = current_node.GetRight() ;
- }
- else cont = false ;
- else {
- if (is_root)
- if (!current_node.GetHas_Right() &&
- !current_node.GetHas_Left() )
- ntb = true ;
- else
- ntb = this.Remove(parent_node,current_node);
- else ntb = this.Remove(parent_node,current_node);
- found = true ;
- cont = false ;
- }
- is_root = false ;
- }
- return found ;
- }
-
- public boolean Remove(Tree p_node, Tree c_node){
- boolean ntb ;
- int auxkey1 ;
- int auxkey2 ;
-
- if (c_node.GetHas_Left())
- ntb = this.RemoveLeft(p_node,c_node) ;
- else
- if (c_node.GetHas_Right())
- ntb = this.RemoveRight(p_node,c_node) ;
- else {
- auxkey1 = c_node.GetKey();
- auxkey2 = (p_node.GetLeft()).GetKey() ;
- if (this.Compare(auxkey1,auxkey2)) {
- ntb = p_node.SetLeft(my_null);
- ntb = p_node.SetHas_Left(false);
- }
- else {
- ntb = p_node.SetRight(my_null);
- ntb = p_node.SetHas_Right(false);
- }
- }
- return true ;
- }
-
- public boolean RemoveRight(Tree p_node, Tree c_node){
- boolean ntb ;
- while (c_node.GetHas_Right()){
- ntb = c_node.SetKey((c_node.GetRight()).GetKey());
- p_node = c_node ;
- c_node = c_node.GetRight() ;
- }
- ntb = p_node.SetRight(my_null);
- ntb = p_node.SetHas_Right(false);
- return true ;
- }
-
- public boolean RemoveLeft(Tree p_node, Tree c_node){
- boolean ntb ;
- while (c_node.GetHas_Left()){
- ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
- p_node = c_node ;
- c_node = c_node.GetLeft() ;
- }
- ntb = p_node.SetLeft(my_null);
- ntb = p_node.SetHas_Left(false);
- return true ;
- }
-
-
- public int Search(int v_key){
- Tree current_node ;
- int ifound ;
- boolean cont ;
- int key_aux ;
-
- current_node = this ;
- cont = true ;
- ifound = 0 ;
- while (cont){
- key_aux = current_node.GetKey();
- if (v_key < key_aux)
- if (current_node.GetHas_Left())
- current_node = current_node.GetLeft() ;
- else cont = false ;
- else
- if (key_aux < v_key)
- if (current_node.GetHas_Right())
- current_node = current_node.GetRight() ;
- else cont = false ;
- else {
- ifound = 1 ;
- cont = false ;
- }
- }
- return ifound ;
- }
-
- public boolean Print(){
- boolean ntb ;
- Tree current_node ;
-
- current_node = this ;
- ntb = this.RecPrint(current_node);
- return true ;
- }
-
- public boolean RecPrint(Tree node){
- boolean ntb ;
-
- if (node.GetHas_Left()){
- ntb = this.RecPrint(node.GetLeft());
- } else ntb = true ;
- System.out.println(node.GetKey());
- if (node.GetHas_Right()){
- ntb = this.RecPrint(node.GetRight());
- } else ntb = true ;
- return true ;
- }
-
- public int accept(Visitor v){
- int nti ;
-
- System.out.println(333);
- nti = v.visit(this) ;
- return 0 ;
- }
-
-}
-
-
-
-class Visitor {
- Tree l ;
- Tree r ;
-
- public int visit(Tree n){
- int nti ;
-
- if (n.GetHas_Right()){
- r = n.GetRight() ;
- nti = r.accept(this) ; }
- else nti = 0 ;
-
- if (n.GetHas_Left()) {
- l = n.GetLeft();
- nti = l.accept(this) ; }
- else nti = 0 ;
-
- return 0;
- }
-
-}
-
-
-class MyVisitor extends Visitor {
-
- public int visit(Tree n){
- int nti ;
-
- if (n.GetHas_Right()){
- r = n.GetRight() ;
- nti = r.accept(this) ; }
- else nti = 0 ;
-
- System.out.println(n.GetKey());
-
- if (n.GetHas_Left()) {
- l = n.GetLeft();
- nti =l.accept(this) ; }
- else nti = 0 ;
-
- return 0;
- }
-
-}
diff --git a/vaporize/tests/TreeVisitor.opt.vapor b/vaporize/tests/TreeVisitor.opt.vapor
deleted file mode 100644
index dfa80a6..0000000
--- a/vaporize/tests/TreeVisitor.opt.vapor
+++ /dev/null
@@ -1,635 +0,0 @@
-
-const empty_TV
-
-const empty_Tree
-
-const vmt_Visitor
- :Visitor.visit
-
-const vmt_MyVisitor
- :MyVisitor.visit
-
-
-func Main()
- t.0 = call :TV.Start(:empty_TV)
- PrintIntS(t.0)
- ret
-
-func TV.Start(this)
- root = HeapAllocZ(24)
- if root goto :null1
- Error("null pointer")
- null1:
- ntb = call :Tree.Init(root 16)
- if root goto :null2
- Error("null pointer")
- null2:
- ntb = call :Tree.Print(root)
- PrintIntS(100000000)
- if root goto :null3
- Error("null pointer")
- null3:
- ntb = call :Tree.Insert(root 8)
- if root goto :null4
- Error("null pointer")
- null4:
- ntb = call :Tree.Insert(root 24)
- if root goto :null5
- Error("null pointer")
- null5:
- ntb = call :Tree.Insert(root 4)
- if root goto :null6
- Error("null pointer")
- null6:
- ntb = call :Tree.Insert(root 12)
- if root goto :null7
- Error("null pointer")
- null7:
- ntb = call :Tree.Insert(root 20)
- if root goto :null8
- Error("null pointer")
- null8:
- ntb = call :Tree.Insert(root 28)
- if root goto :null9
- Error("null pointer")
- null9:
- ntb = call :Tree.Insert(root 14)
- if root goto :null10
- Error("null pointer")
- null10:
- ntb = call :Tree.Print(root)
- PrintIntS(100000000)
- t.0 = HeapAllocZ(12)
- [t.0] = :vmt_MyVisitor
- v = t.0
- PrintIntS(50000000)
- if root goto :null11
- Error("null pointer")
- null11:
- nti = call :Tree.accept(root v)
- PrintIntS(100000000)
- if root goto :null12
- Error("null pointer")
- null12:
- t.1 = call :Tree.Search(root 24)
- PrintIntS(t.1)
- if root goto :null13
- Error("null pointer")
- null13:
- t.2 = call :Tree.Search(root 12)
- PrintIntS(t.2)
- if root goto :null14
- Error("null pointer")
- null14:
- t.3 = call :Tree.Search(root 16)
- PrintIntS(t.3)
- if root goto :null15
- Error("null pointer")
- null15:
- t.4 = call :Tree.Search(root 50)
- PrintIntS(t.4)
- if root goto :null16
- Error("null pointer")
- null16:
- t.5 = call :Tree.Search(root 12)
- PrintIntS(t.5)
- if root goto :null17
- Error("null pointer")
- null17:
- ntb = call :Tree.Delete(root 12)
- if root goto :null18
- Error("null pointer")
- null18:
- ntb = call :Tree.Print(root)
- if root goto :null19
- Error("null pointer")
- null19:
- t.6 = call :Tree.Search(root 12)
- PrintIntS(t.6)
- ret 0
-
-func Tree.Init(this v_key)
- [this+8] = v_key
- [this+12] = 0
- [this+16] = 0
- ret 1
-
-func Tree.SetRight(this rn)
- [this+4] = rn
- ret 1
-
-func Tree.SetLeft(this ln)
- [this+0] = ln
- ret 1
-
-func Tree.GetRight(this)
- t.0 = [this+4]
- ret t.0
-
-func Tree.GetLeft(this)
- t.0 = [this+0]
- ret t.0
-
-func Tree.GetKey(this)
- t.0 = [this+8]
- ret t.0
-
-func Tree.SetKey(this v_key)
- [this+8] = v_key
- ret 1
-
-func Tree.GetHas_Right(this)
- t.0 = [this+16]
- ret t.0
-
-func Tree.GetHas_Left(this)
- t.0 = [this+12]
- ret t.0
-
-func Tree.SetHas_Left(this val)
- [this+12] = val
- ret 1
-
-func Tree.SetHas_Right(this val)
- [this+16] = val
- ret 1
-
-func Tree.Compare(this num1 num2)
- ntb = 0
- nti = Add(num2 1)
- t.0 = LtS(num1 num2)
- if0 t.0 goto :if1_else
- ntb = 0
- goto :if1_end
- if1_else:
- t.1 = LtS(num1 nti)
- if t.1 goto :if2_else
- ntb = 0
- goto :if2_end
- if2_else:
- ntb = 1
- if2_end:
- if1_end:
- ret ntb
-
-func Tree.Insert(this v_key)
- new_node = HeapAllocZ(24)
- if new_node goto :null20
- Error("null pointer")
- null20:
- ntb = call :Tree.Init(new_node v_key)
- current_node = this
- cont = 1
- while1_top:
- if0 cont goto :while1_end
- if current_node goto :null21
- Error("null pointer")
- null21:
- key_aux = call :Tree.GetKey(current_node)
- t.0 = LtS(v_key key_aux)
- if0 t.0 goto :if3_else
- if current_node goto :null22
- Error("null pointer")
- null22:
- t.1 = call :Tree.GetHas_Left(current_node)
- if0 t.1 goto :if4_else
- if current_node goto :null23
- Error("null pointer")
- null23:
- current_node = call :Tree.GetLeft(current_node)
- goto :if4_end
- if4_else:
- cont = 0
- if current_node goto :null24
- Error("null pointer")
- null24:
- ntb = call :Tree.SetHas_Left(current_node 1)
- if current_node goto :null25
- Error("null pointer")
- null25:
- ntb = call :Tree.SetLeft(current_node new_node)
- if4_end:
- goto :if3_end
- if3_else:
- if current_node goto :null26
- Error("null pointer")
- null26:
- t.2 = call :Tree.GetHas_Right(current_node)
- if0 t.2 goto :if5_else
- if current_node goto :null27
- Error("null pointer")
- null27:
- current_node = call :Tree.GetRight(current_node)
- goto :if5_end
- if5_else:
- cont = 0
- if current_node goto :null28
- Error("null pointer")
- null28:
- ntb = call :Tree.SetHas_Right(current_node 1)
- if current_node goto :null29
- Error("null pointer")
- null29:
- ntb = call :Tree.SetRight(current_node new_node)
- if5_end:
- if3_end:
- goto :while1_top
- while1_end:
- ret 1
-
-func Tree.Delete(this v_key)
- current_node = this
- parent_node = this
- cont = 1
- found = 0
- is_root = 1
- while2_top:
- if0 cont goto :while2_end
- if current_node goto :null30
- Error("null pointer")
- null30:
- key_aux = call :Tree.GetKey(current_node)
- t.0 = LtS(v_key key_aux)
- if0 t.0 goto :if6_else
- if current_node goto :null31
- Error("null pointer")
- null31:
- t.1 = call :Tree.GetHas_Left(current_node)
- if0 t.1 goto :if7_else
- parent_node = current_node
- if current_node goto :null32
- Error("null pointer")
- null32:
- current_node = call :Tree.GetLeft(current_node)
- goto :if7_end
- if7_else:
- cont = 0
- if7_end:
- goto :if6_end
- if6_else:
- t.2 = LtS(key_aux v_key)
- if0 t.2 goto :if8_else
- if current_node goto :null33
- Error("null pointer")
- null33:
- t.3 = call :Tree.GetHas_Right(current_node)
- if0 t.3 goto :if9_else
- parent_node = current_node
- if current_node goto :null34
- Error("null pointer")
- null34:
- current_node = call :Tree.GetRight(current_node)
- goto :if9_end
- if9_else:
- cont = 0
- if9_end:
- goto :if8_end
- if8_else:
- if0 is_root goto :if10_else
- if current_node goto :null35
- Error("null pointer")
- null35:
- t.4 = call :Tree.GetHas_Right(current_node)
- if t.4 goto :if11_else
- if current_node goto :null36
- Error("null pointer")
- null36:
- t.5 = call :Tree.GetHas_Left(current_node)
- if t.5 goto :if11_else
- ntb = 1
- goto :if11_end
- if11_else:
- ntb = call :Tree.Remove(this parent_node current_node)
- if11_end:
- goto :if10_end
- if10_else:
- ntb = call :Tree.Remove(this parent_node current_node)
- if10_end:
- found = 1
- cont = 0
- if8_end:
- if6_end:
- is_root = 0
- goto :while2_top
- while2_end:
- ret found
-
-func Tree.Remove(this p_node c_node)
- if c_node goto :null37
- Error("null pointer")
- null37:
- t.0 = call :Tree.GetHas_Left(c_node)
- if0 t.0 goto :if12_else
- ntb = call :Tree.RemoveLeft(this p_node c_node)
- goto :if12_end
- if12_else:
- if c_node goto :null38
- Error("null pointer")
- null38:
- t.1 = call :Tree.GetHas_Right(c_node)
- if0 t.1 goto :if13_else
- ntb = call :Tree.RemoveRight(this p_node c_node)
- goto :if13_end
- if13_else:
- if c_node goto :null39
- Error("null pointer")
- null39:
- auxkey1 = call :Tree.GetKey(c_node)
- if p_node goto :null40
- Error("null pointer")
- null40:
- t.2 = call :Tree.GetLeft(p_node)
- if t.2 goto :null41
- Error("null pointer")
- null41:
- auxkey2 = call :Tree.GetKey(t.2)
- t.3 = call :Tree.Compare(this auxkey1 auxkey2)
- if0 t.3 goto :if14_else
- if p_node goto :null42
- Error("null pointer")
- null42:
- t.4 = [this+20]
- ntb = call :Tree.SetLeft(p_node t.4)
- if p_node goto :null43
- Error("null pointer")
- null43:
- ntb = call :Tree.SetHas_Left(p_node 0)
- goto :if14_end
- if14_else:
- if p_node goto :null44
- Error("null pointer")
- null44:
- t.5 = [this+20]
- ntb = call :Tree.SetRight(p_node t.5)
- if p_node goto :null45
- Error("null pointer")
- null45:
- ntb = call :Tree.SetHas_Right(p_node 0)
- if14_end:
- if13_end:
- if12_end:
- ret 1
-
-func Tree.RemoveRight(this p_node c_node)
- while3_top:
- if c_node goto :null46
- Error("null pointer")
- null46:
- t.0 = call :Tree.GetHas_Right(c_node)
- if0 t.0 goto :while3_end
- if c_node goto :null47
- Error("null pointer")
- null47:
- if c_node goto :null48
- Error("null pointer")
- null48:
- t.1 = call :Tree.GetRight(c_node)
- if t.1 goto :null49
- Error("null pointer")
- null49:
- t.2 = call :Tree.GetKey(t.1)
- ntb = call :Tree.SetKey(c_node t.2)
- p_node = c_node
- if c_node goto :null50
- Error("null pointer")
- null50:
- c_node = call :Tree.GetRight(c_node)
- goto :while3_top
- while3_end:
- if p_node goto :null51
- Error("null pointer")
- null51:
- t.3 = [this+20]
- ntb = call :Tree.SetRight(p_node t.3)
- if p_node goto :null52
- Error("null pointer")
- null52:
- ntb = call :Tree.SetHas_Right(p_node 0)
- ret 1
-
-func Tree.RemoveLeft(this p_node c_node)
- while4_top:
- if c_node goto :null53
- Error("null pointer")
- null53:
- t.0 = call :Tree.GetHas_Left(c_node)
- if0 t.0 goto :while4_end
- if c_node goto :null54
- Error("null pointer")
- null54:
- if c_node goto :null55
- Error("null pointer")
- null55:
- t.1 = call :Tree.GetLeft(c_node)
- if t.1 goto :null56
- Error("null pointer")
- null56:
- t.2 = call :Tree.GetKey(t.1)
- ntb = call :Tree.SetKey(c_node t.2)
- p_node = c_node
- if c_node goto :null57
- Error("null pointer")
- null57:
- c_node = call :Tree.GetLeft(c_node)
- goto :while4_top
- while4_end:
- if p_node goto :null58
- Error("null pointer")
- null58:
- t.3 = [this+20]
- ntb = call :Tree.SetLeft(p_node t.3)
- if p_node goto :null59
- Error("null pointer")
- null59:
- ntb = call :Tree.SetHas_Left(p_node 0)
- ret 1
-
-func Tree.Search(this v_key)
- current_node = this
- cont = 1
- ifound = 0
- while5_top:
- if0 cont goto :while5_end
- if current_node goto :null60
- Error("null pointer")
- null60:
- key_aux = call :Tree.GetKey(current_node)
- t.0 = LtS(v_key key_aux)
- if0 t.0 goto :if15_else
- if current_node goto :null61
- Error("null pointer")
- null61:
- t.1 = call :Tree.GetHas_Left(current_node)
- if0 t.1 goto :if16_else
- if current_node goto :null62
- Error("null pointer")
- null62:
- current_node = call :Tree.GetLeft(current_node)
- goto :if16_end
- if16_else:
- cont = 0
- if16_end:
- goto :if15_end
- if15_else:
- t.2 = LtS(key_aux v_key)
- if0 t.2 goto :if17_else
- if current_node goto :null63
- Error("null pointer")
- null63:
- t.3 = call :Tree.GetHas_Right(current_node)
- if0 t.3 goto :if18_else
- if current_node goto :null64
- Error("null pointer")
- null64:
- current_node = call :Tree.GetRight(current_node)
- goto :if18_end
- if18_else:
- cont = 0
- if18_end:
- goto :if17_end
- if17_else:
- ifound = 1
- cont = 0
- if17_end:
- if15_end:
- goto :while5_top
- while5_end:
- ret ifound
-
-func Tree.Print(this)
- current_node = this
- ntb = call :Tree.RecPrint(this current_node)
- ret 1
-
-func Tree.RecPrint(this node)
- if node goto :null65
- Error("null pointer")
- null65:
- t.0 = call :Tree.GetHas_Left(node)
- if0 t.0 goto :if19_else
- if node goto :null66
- Error("null pointer")
- null66:
- t.1 = call :Tree.GetLeft(node)
- ntb = call :Tree.RecPrint(this t.1)
- goto :if19_end
- if19_else:
- ntb = 1
- if19_end:
- if node goto :null67
- Error("null pointer")
- null67:
- t.2 = call :Tree.GetKey(node)
- PrintIntS(t.2)
- if node goto :null68
- Error("null pointer")
- null68:
- t.3 = call :Tree.GetHas_Right(node)
- if0 t.3 goto :if20_else
- if node goto :null69
- Error("null pointer")
- null69:
- t.4 = call :Tree.GetRight(node)
- ntb = call :Tree.RecPrint(this t.4)
- goto :if20_end
- if20_else:
- ntb = 1
- if20_end:
- ret 1
-
-func Tree.accept(this v)
- PrintIntS(333)
- if v goto :null70
- Error("null pointer")
- null70:
- t.0 = [v]
- t.0 = [t.0+0]
- nti = call t.0(v this)
- ret 0
-
-func Visitor.visit(this n)
- if n goto :null71
- Error("null pointer")
- null71:
- t.0 = call :Tree.GetHas_Right(n)
- if0 t.0 goto :if21_else
- if n goto :null72
- Error("null pointer")
- null72:
- t.1 = call :Tree.GetRight(n)
- [this+8] = t.1
- t.2 = [this+8]
- if t.2 goto :null73
- Error("null pointer")
- null73:
- nti = call :Tree.accept(t.2 this)
- goto :if21_end
- if21_else:
- nti = 0
- if21_end:
- if n goto :null74
- Error("null pointer")
- null74:
- t.3 = call :Tree.GetHas_Left(n)
- if0 t.3 goto :if22_else
- if n goto :null75
- Error("null pointer")
- null75:
- t.4 = call :Tree.GetLeft(n)
- [this+4] = t.4
- t.5 = [this+4]
- if t.5 goto :null76
- Error("null pointer")
- null76:
- nti = call :Tree.accept(t.5 this)
- goto :if22_end
- if22_else:
- nti = 0
- if22_end:
- ret 0
-
-func MyVisitor.visit(this n)
- if n goto :null77
- Error("null pointer")
- null77:
- t.0 = call :Tree.GetHas_Right(n)
- if0 t.0 goto :if23_else
- if n goto :null78
- Error("null pointer")
- null78:
- t.1 = call :Tree.GetRight(n)
- [this+8] = t.1
- t.2 = [this+8]
- if t.2 goto :null79
- Error("null pointer")
- null79:
- nti = call :Tree.accept(t.2 this)
- goto :if23_end
- if23_else:
- nti = 0
- if23_end:
- if n goto :null80
- Error("null pointer")
- null80:
- t.3 = call :Tree.GetKey(n)
- PrintIntS(t.3)
- if n goto :null81
- Error("null pointer")
- null81:
- t.4 = call :Tree.GetHas_Left(n)
- if0 t.4 goto :if24_else
- if n goto :null82
- Error("null pointer")
- null82:
- t.5 = call :Tree.GetLeft(n)
- [this+4] = t.5
- t.6 = [this+4]
- if t.6 goto :null83
- Error("null pointer")
- null83:
- nti = call :Tree.accept(t.6 this)
- goto :if24_end
- if24_else:
- nti = 0
- if24_end:
- ret 0
diff --git a/vaporize/tests/TreeVisitor.vapor b/vaporize/tests/TreeVisitor.vapor
deleted file mode 100644
index d8aa63b..0000000
--- a/vaporize/tests/TreeVisitor.vapor
+++ /dev/null
@@ -1,855 +0,0 @@
-
-const vmt_TV
- :TV.Start
-
-const vmt_Tree
- :Tree.Init
- :Tree.SetRight
- :Tree.SetLeft
- :Tree.GetRight
- :Tree.GetLeft
- :Tree.GetKey
- :Tree.SetKey
- :Tree.GetHas_Right
- :Tree.GetHas_Left
- :Tree.SetHas_Left
- :Tree.SetHas_Right
- :Tree.Compare
- :Tree.Insert
- :Tree.Delete
- :Tree.Remove
- :Tree.RemoveRight
- :Tree.RemoveLeft
- :Tree.Search
- :Tree.Print
- :Tree.RecPrint
- :Tree.accept
-
-const vmt_Visitor
- :Visitor.visit
-
-const vmt_MyVisitor
- :MyVisitor.visit
-
-
-func Main()
- t.0 = HeapAllocZ(4)
- [t.0] = :vmt_TV
- if t.0 goto :null1
- Error("null pointer")
- null1:
- t.1 = [t.0]
- t.1 = [t.1+0]
- t.2 = call t.1(t.0)
- PrintIntS(t.2)
- ret
-
-func TV.Start(this)
- t.0 = HeapAllocZ(28)
- [t.0] = :vmt_Tree
- root = t.0
- if root goto :null2
- Error("null pointer")
- null2:
- t.1 = [root]
- t.1 = [t.1+0]
- ntb = call t.1(root 16)
- if root goto :null3
- Error("null pointer")
- null3:
- t.2 = [root]
- t.2 = [t.2+72]
- ntb = call t.2(root)
- PrintIntS(100000000)
- if root goto :null4
- Error("null pointer")
- null4:
- t.3 = [root]
- t.3 = [t.3+48]
- ntb = call t.3(root 8)
- if root goto :null5
- Error("null pointer")
- null5:
- t.4 = [root]
- t.4 = [t.4+48]
- ntb = call t.4(root 24)
- if root goto :null6
- Error("null pointer")
- null6:
- t.5 = [root]
- t.5 = [t.5+48]
- ntb = call t.5(root 4)
- if root goto :null7
- Error("null pointer")
- null7:
- t.6 = [root]
- t.6 = [t.6+48]
- ntb = call t.6(root 12)
- if root goto :null8
- Error("null pointer")
- null8:
- t.7 = [root]
- t.7 = [t.7+48]
- ntb = call t.7(root 20)
- if root goto :null9
- Error("null pointer")
- null9:
- t.8 = [root]
- t.8 = [t.8+48]
- ntb = call t.8(root 28)
- if root goto :null10
- Error("null pointer")
- null10:
- t.9 = [root]
- t.9 = [t.9+48]
- ntb = call t.9(root 14)
- if root goto :null11
- Error("null pointer")
- null11:
- t.10 = [root]
- t.10 = [t.10+72]
- ntb = call t.10(root)
- PrintIntS(100000000)
- t.11 = HeapAllocZ(12)
- [t.11] = :vmt_MyVisitor
- v = t.11
- PrintIntS(50000000)
- if root goto :null12
- Error("null pointer")
- null12:
- t.12 = [root]
- t.12 = [t.12+80]
- nti = call t.12(root v)
- PrintIntS(100000000)
- if root goto :null13
- Error("null pointer")
- null13:
- t.13 = [root]
- t.13 = [t.13+68]
- t.14 = call t.13(root 24)
- PrintIntS(t.14)
- if root goto :null14
- Error("null pointer")
- null14:
- t.15 = [root]
- t.15 = [t.15+68]
- t.16 = call t.15(root 12)
- PrintIntS(t.16)
- if root goto :null15
- Error("null pointer")
- null15:
- t.17 = [root]
- t.17 = [t.17+68]
- t.18 = call t.17(root 16)
- PrintIntS(t.18)
- if root goto :null16
- Error("null pointer")
- null16:
- t.19 = [root]
- t.19 = [t.19+68]
- t.20 = call t.19(root 50)
- PrintIntS(t.20)
- if root goto :null17
- Error("null pointer")
- null17:
- t.21 = [root]
- t.21 = [t.21+68]
- t.22 = call t.21(root 12)
- PrintIntS(t.22)
- if root goto :null18
- Error("null pointer")
- null18:
- t.23 = [root]
- t.23 = [t.23+52]
- ntb = call t.23(root 12)
- if root goto :null19
- Error("null pointer")
- null19:
- t.24 = [root]
- t.24 = [t.24+72]
- ntb = call t.24(root)
- if root goto :null20
- Error("null pointer")
- null20:
- t.25 = [root]
- t.25 = [t.25+68]
- t.26 = call t.25(root 12)
- PrintIntS(t.26)
- ret 0
-
-func Tree.Init(this v_key)
- [this+12] = v_key
- [this+16] = 0
- [this+20] = 0
- ret 1
-
-func Tree.SetRight(this rn)
- [this+8] = rn
- ret 1
-
-func Tree.SetLeft(this ln)
- [this+4] = ln
- ret 1
-
-func Tree.GetRight(this)
- t.0 = [this+8]
- ret t.0
-
-func Tree.GetLeft(this)
- t.0 = [this+4]
- ret t.0
-
-func Tree.GetKey(this)
- t.0 = [this+12]
- ret t.0
-
-func Tree.SetKey(this v_key)
- [this+12] = v_key
- ret 1
-
-func Tree.GetHas_Right(this)
- t.0 = [this+20]
- ret t.0
-
-func Tree.GetHas_Left(this)
- t.0 = [this+16]
- ret t.0
-
-func Tree.SetHas_Left(this val)
- [this+16] = val
- ret 1
-
-func Tree.SetHas_Right(this val)
- [this+20] = val
- ret 1
-
-func Tree.Compare(this num1 num2)
- ntb = 0
- nti = Add(num2 1)
- t.0 = LtS(num1 num2)
- if0 t.0 goto :if1_else
- ntb = 0
- goto :if1_end
- if1_else:
- t.1 = LtS(num1 nti)
- t.2 = Sub(1 t.1)
- if0 t.2 goto :if2_else
- ntb = 0
- goto :if2_end
- if2_else:
- ntb = 1
- if2_end:
- if1_end:
- ret ntb
-
-func Tree.Insert(this v_key)
- t.0 = HeapAllocZ(28)
- [t.0] = :vmt_Tree
- new_node = t.0
- if new_node goto :null21
- Error("null pointer")
- null21:
- t.1 = [new_node]
- t.1 = [t.1+0]
- ntb = call t.1(new_node v_key)
- current_node = this
- cont = 1
- while1_top:
- if0 cont goto :while1_end
- if current_node goto :null22
- Error("null pointer")
- null22:
- t.2 = [current_node]
- t.2 = [t.2+20]
- key_aux = call t.2(current_node)
- t.3 = LtS(v_key key_aux)
- if0 t.3 goto :if3_else
- if current_node goto :null23
- Error("null pointer")
- null23:
- t.4 = [current_node]
- t.4 = [t.4+32]
- t.5 = call t.4(current_node)
- if0 t.5 goto :if4_else
- if current_node goto :null24
- Error("null pointer")
- null24:
- t.6 = [current_node]
- t.6 = [t.6+16]
- current_node = call t.6(current_node)
- goto :if4_end
- if4_else:
- cont = 0
- if current_node goto :null25
- Error("null pointer")
- null25:
- t.7 = [current_node]
- t.7 = [t.7+36]
- ntb = call t.7(current_node 1)
- if current_node goto :null26
- Error("null pointer")
- null26:
- t.8 = [current_node]
- t.8 = [t.8+8]
- ntb = call t.8(current_node new_node)
- if4_end:
- goto :if3_end
- if3_else:
- if current_node goto :null27
- Error("null pointer")
- null27:
- t.9 = [current_node]
- t.9 = [t.9+28]
- t.10 = call t.9(current_node)
- if0 t.10 goto :if5_else
- if current_node goto :null28
- Error("null pointer")
- null28:
- t.11 = [current_node]
- t.11 = [t.11+12]
- current_node = call t.11(current_node)
- goto :if5_end
- if5_else:
- cont = 0
- if current_node goto :null29
- Error("null pointer")
- null29:
- t.12 = [current_node]
- t.12 = [t.12+40]
- ntb = call t.12(current_node 1)
- if current_node goto :null30
- Error("null pointer")
- null30:
- t.13 = [current_node]
- t.13 = [t.13+4]
- ntb = call t.13(current_node new_node)
- if5_end:
- if3_end:
- goto :while1_top
- while1_end:
- ret 1
-
-func Tree.Delete(this v_key)
- current_node = this
- parent_node = this
- cont = 1
- found = 0
- is_root = 1
- while2_top:
- if0 cont goto :while2_end
- if current_node goto :null31
- Error("null pointer")
- null31:
- t.0 = [current_node]
- t.0 = [t.0+20]
- key_aux = call t.0(current_node)
- t.1 = LtS(v_key key_aux)
- if0 t.1 goto :if6_else
- if current_node goto :null32
- Error("null pointer")
- null32:
- t.2 = [current_node]
- t.2 = [t.2+32]
- t.3 = call t.2(current_node)
- if0 t.3 goto :if7_else
- parent_node = current_node
- if current_node goto :null33
- Error("null pointer")
- null33:
- t.4 = [current_node]
- t.4 = [t.4+16]
- current_node = call t.4(current_node)
- goto :if7_end
- if7_else:
- cont = 0
- if7_end:
- goto :if6_end
- if6_else:
- t.5 = LtS(key_aux v_key)
- if0 t.5 goto :if8_else
- if current_node goto :null34
- Error("null pointer")
- null34:
- t.6 = [current_node]
- t.6 = [t.6+28]
- t.7 = call t.6(current_node)
- if0 t.7 goto :if9_else
- parent_node = current_node
- if current_node goto :null35
- Error("null pointer")
- null35:
- t.8 = [current_node]
- t.8 = [t.8+12]
- current_node = call t.8(current_node)
- goto :if9_end
- if9_else:
- cont = 0
- if9_end:
- goto :if8_end
- if8_else:
- if0 is_root goto :if10_else
- if current_node goto :null36
- Error("null pointer")
- null36:
- t.10 = [current_node]
- t.10 = [t.10+28]
- t.11 = call t.10(current_node)
- t.12 = Sub(1 t.11)
- if0 t.12 goto :ss1_else
- if current_node goto :null37
- Error("null pointer")
- null37:
- t.13 = [current_node]
- t.13 = [t.13+32]
- t.14 = call t.13(current_node)
- t.9 = Sub(1 t.14)
- goto :ss1_end
- ss1_else:
- t.9 = 0
- ss1_end:
- if0 t.9 goto :if11_else
- ntb = 1
- goto :if11_end
- if11_else:
- t.15 = [this]
- t.15 = [t.15+56]
- ntb = call t.15(this parent_node current_node)
- if11_end:
- goto :if10_end
- if10_else:
- t.16 = [this]
- t.16 = [t.16+56]
- ntb = call t.16(this parent_node current_node)
- if10_end:
- found = 1
- cont = 0
- if8_end:
- if6_end:
- is_root = 0
- goto :while2_top
- while2_end:
- ret found
-
-func Tree.Remove(this p_node c_node)
- if c_node goto :null38
- Error("null pointer")
- null38:
- t.0 = [c_node]
- t.0 = [t.0+32]
- t.1 = call t.0(c_node)
- if0 t.1 goto :if12_else
- t.2 = [this]
- t.2 = [t.2+64]
- ntb = call t.2(this p_node c_node)
- goto :if12_end
- if12_else:
- if c_node goto :null39
- Error("null pointer")
- null39:
- t.3 = [c_node]
- t.3 = [t.3+28]
- t.4 = call t.3(c_node)
- if0 t.4 goto :if13_else
- t.5 = [this]
- t.5 = [t.5+60]
- ntb = call t.5(this p_node c_node)
- goto :if13_end
- if13_else:
- if c_node goto :null40
- Error("null pointer")
- null40:
- t.6 = [c_node]
- t.6 = [t.6+20]
- auxkey1 = call t.6(c_node)
- if p_node goto :null41
- Error("null pointer")
- null41:
- t.7 = [p_node]
- t.7 = [t.7+16]
- t.8 = call t.7(p_node)
- if t.8 goto :null42
- Error("null pointer")
- null42:
- t.9 = [t.8]
- t.9 = [t.9+20]
- auxkey2 = call t.9(t.8)
- t.10 = [this]
- t.10 = [t.10+44]
- t.11 = call t.10(this auxkey1 auxkey2)
- if0 t.11 goto :if14_else
- if p_node goto :null43
- Error("null pointer")
- null43:
- t.12 = [p_node]
- t.12 = [t.12+8]
- t.13 = [this+24]
- ntb = call t.12(p_node t.13)
- if p_node goto :null44
- Error("null pointer")
- null44:
- t.14 = [p_node]
- t.14 = [t.14+36]
- ntb = call t.14(p_node 0)
- goto :if14_end
- if14_else:
- if p_node goto :null45
- Error("null pointer")
- null45:
- t.15 = [p_node]
- t.15 = [t.15+4]
- t.16 = [this+24]
- ntb = call t.15(p_node t.16)
- if p_node goto :null46
- Error("null pointer")
- null46:
- t.17 = [p_node]
- t.17 = [t.17+40]
- ntb = call t.17(p_node 0)
- if14_end:
- if13_end:
- if12_end:
- ret 1
-
-func Tree.RemoveRight(this p_node c_node)
- while3_top:
- if c_node goto :null47
- Error("null pointer")
- null47:
- t.0 = [c_node]
- t.0 = [t.0+28]
- t.1 = call t.0(c_node)
- if0 t.1 goto :while3_end
- if c_node goto :null48
- Error("null pointer")
- null48:
- t.2 = [c_node]
- t.2 = [t.2+24]
- if c_node goto :null49
- Error("null pointer")
- null49:
- t.3 = [c_node]
- t.3 = [t.3+12]
- t.4 = call t.3(c_node)
- if t.4 goto :null50
- Error("null pointer")
- null50:
- t.5 = [t.4]
- t.5 = [t.5+20]
- t.6 = call t.5(t.4)
- ntb = call t.2(c_node t.6)
- p_node = c_node
- if c_node goto :null51
- Error("null pointer")
- null51:
- t.7 = [c_node]
- t.7 = [t.7+12]
- c_node = call t.7(c_node)
- goto :while3_top
- while3_end:
- if p_node goto :null52
- Error("null pointer")
- null52:
- t.8 = [p_node]
- t.8 = [t.8+4]
- t.9 = [this+24]
- ntb = call t.8(p_node t.9)
- if p_node goto :null53
- Error("null pointer")
- null53:
- t.10 = [p_node]
- t.10 = [t.10+40]
- ntb = call t.10(p_node 0)
- ret 1
-
-func Tree.RemoveLeft(this p_node c_node)
- while4_top:
- if c_node goto :null54
- Error("null pointer")
- null54:
- t.0 = [c_node]
- t.0 = [t.0+32]
- t.1 = call t.0(c_node)
- if0 t.1 goto :while4_end
- if c_node goto :null55
- Error("null pointer")
- null55:
- t.2 = [c_node]
- t.2 = [t.2+24]
- if c_node goto :null56
- Error("null pointer")
- null56:
- t.3 = [c_node]
- t.3 = [t.3+16]
- t.4 = call t.3(c_node)
- if t.4 goto :null57
- Error("null pointer")
- null57:
- t.5 = [t.4]
- t.5 = [t.5+20]
- t.6 = call t.5(t.4)
- ntb = call t.2(c_node t.6)
- p_node = c_node
- if c_node goto :null58
- Error("null pointer")
- null58:
- t.7 = [c_node]
- t.7 = [t.7+16]
- c_node = call t.7(c_node)
- goto :while4_top
- while4_end:
- if p_node goto :null59
- Error("null pointer")
- null59:
- t.8 = [p_node]
- t.8 = [t.8+8]
- t.9 = [this+24]
- ntb = call t.8(p_node t.9)
- if p_node goto :null60
- Error("null pointer")
- null60:
- t.10 = [p_node]
- t.10 = [t.10+36]
- ntb = call t.10(p_node 0)
- ret 1
-
-func Tree.Search(this v_key)
- current_node = this
- cont = 1
- ifound = 0
- while5_top:
- if0 cont goto :while5_end
- if current_node goto :null61
- Error("null pointer")
- null61:
- t.0 = [current_node]
- t.0 = [t.0+20]
- key_aux = call t.0(current_node)
- t.1 = LtS(v_key key_aux)
- if0 t.1 goto :if15_else
- if current_node goto :null62
- Error("null pointer")
- null62:
- t.2 = [current_node]
- t.2 = [t.2+32]
- t.3 = call t.2(current_node)
- if0 t.3 goto :if16_else
- if current_node goto :null63
- Error("null pointer")
- null63:
- t.4 = [current_node]
- t.4 = [t.4+16]
- current_node = call t.4(current_node)
- goto :if16_end
- if16_else:
- cont = 0
- if16_end:
- goto :if15_end
- if15_else:
- t.5 = LtS(key_aux v_key)
- if0 t.5 goto :if17_else
- if current_node goto :null64
- Error("null pointer")
- null64:
- t.6 = [current_node]
- t.6 = [t.6+28]
- t.7 = call t.6(current_node)
- if0 t.7 goto :if18_else
- if current_node goto :null65
- Error("null pointer")
- null65:
- t.8 = [current_node]
- t.8 = [t.8+12]
- current_node = call t.8(current_node)
- goto :if18_end
- if18_else:
- cont = 0
- if18_end:
- goto :if17_end
- if17_else:
- ifound = 1
- cont = 0
- if17_end:
- if15_end:
- goto :while5_top
- while5_end:
- ret ifound
-
-func Tree.Print(this)
- current_node = this
- t.0 = [this]
- t.0 = [t.0+76]
- ntb = call t.0(this current_node)
- ret 1
-
-func Tree.RecPrint(this node)
- if node goto :null66
- Error("null pointer")
- null66:
- t.0 = [node]
- t.0 = [t.0+32]
- t.1 = call t.0(node)
- if0 t.1 goto :if19_else
- t.2 = [this]
- t.2 = [t.2+76]
- if node goto :null67
- Error("null pointer")
- null67:
- t.3 = [node]
- t.3 = [t.3+16]
- t.4 = call t.3(node)
- ntb = call t.2(this t.4)
- goto :if19_end
- if19_else:
- ntb = 1
- if19_end:
- if node goto :null68
- Error("null pointer")
- null68:
- t.5 = [node]
- t.5 = [t.5+20]
- t.6 = call t.5(node)
- PrintIntS(t.6)
- if node goto :null69
- Error("null pointer")
- null69:
- t.7 = [node]
- t.7 = [t.7+28]
- t.8 = call t.7(node)
- if0 t.8 goto :if20_else
- t.9 = [this]
- t.9 = [t.9+76]
- if node goto :null70
- Error("null pointer")
- null70:
- t.10 = [node]
- t.10 = [t.10+12]
- t.11 = call t.10(node)
- ntb = call t.9(this t.11)
- goto :if20_end
- if20_else:
- ntb = 1
- if20_end:
- ret 1
-
-func Tree.accept(this v)
- PrintIntS(333)
- if v goto :null71
- Error("null pointer")
- null71:
- t.0 = [v]
- t.0 = [t.0+0]
- nti = call t.0(v this)
- ret 0
-
-func Visitor.visit(this n)
- if n goto :null72
- Error("null pointer")
- null72:
- t.0 = [n]
- t.0 = [t.0+28]
- t.1 = call t.0(n)
- if0 t.1 goto :if21_else
- if n goto :null73
- Error("null pointer")
- null73:
- t.2 = [n]
- t.2 = [t.2+12]
- t.3 = call t.2(n)
- [this+8] = t.3
- t.4 = [this+8]
- if t.4 goto :null74
- Error("null pointer")
- null74:
- t.5 = [t.4]
- t.5 = [t.5+80]
- nti = call t.5(t.4 this)
- goto :if21_end
- if21_else:
- nti = 0
- if21_end:
- if n goto :null75
- Error("null pointer")
- null75:
- t.6 = [n]
- t.6 = [t.6+32]
- t.7 = call t.6(n)
- if0 t.7 goto :if22_else
- if n goto :null76
- Error("null pointer")
- null76:
- t.8 = [n]
- t.8 = [t.8+16]
- t.9 = call t.8(n)
- [this+4] = t.9
- t.10 = [this+4]
- if t.10 goto :null77
- Error("null pointer")
- null77:
- t.11 = [t.10]
- t.11 = [t.11+80]
- nti = call t.11(t.10 this)
- goto :if22_end
- if22_else:
- nti = 0
- if22_end:
- ret 0
-
-func MyVisitor.visit(this n)
- if n goto :null78
- Error("null pointer")
- null78:
- t.0 = [n]
- t.0 = [t.0+28]
- t.1 = call t.0(n)
- if0 t.1 goto :if23_else
- if n goto :null79
- Error("null pointer")
- null79:
- t.2 = [n]
- t.2 = [t.2+12]
- t.3 = call t.2(n)
- [this+8] = t.3
- t.4 = [this+8]
- if t.4 goto :null80
- Error("null pointer")
- null80:
- t.5 = [t.4]
- t.5 = [t.5+80]
- nti = call t.5(t.4 this)
- goto :if23_end
- if23_else:
- nti = 0
- if23_end:
- if n goto :null81
- Error("null pointer")
- null81:
- t.6 = [n]
- t.6 = [t.6+20]
- t.7 = call t.6(n)
- PrintIntS(t.7)
- if n goto :null82
- Error("null pointer")
- null82:
- t.8 = [n]
- t.8 = [t.8+32]
- t.9 = call t.8(n)
- if0 t.9 goto :if24_else
- if n goto :null83
- Error("null pointer")
- null83:
- t.10 = [n]
- t.10 = [t.10+16]
- t.11 = call t.10(n)
- [this+4] = t.11
- t.12 = [this+4]
- if t.12 goto :null84
- Error("null pointer")
- null84:
- t.13 = [t.12]
- t.13 = [t.13+80]
- nti = call t.13(t.12 this)
- goto :if24_end
- if24_else:
- nti = 0
- if24_end:
- ret 0