Commit 4477fcdb authored by Farzad Sehat's avatar Farzad Sehat

Ajout fonction toString dans le CUDA_GP.tpl afin de pouvoir afficher la...

Ajout fonction toString dans le CUDA_GP.tpl afin de pouvoir afficher la fonction trouvé sous forme de chaine de caractère
parent 17ea5fcf
......@@ -383,6 +383,44 @@ void toDotFile_r(GPNode* root, FILE* outputFile){
}
}
}
void toString_r(GPNode* root) {
std::cout << '(';
if (opArity[root->opCode] == 2) {
toString_r(root->children[0]);
std::cout << ' ';
std::cout << opCodeName[(int)root->opCode];
std::cout << ' ';
toString_r(root->children[1]);
} else {
if (root->opCode == OP_ERC) {
std::cout << root->erc_value;
} else {
std::cout << opCodeName[(int)root->opCode];
}
for (int i = 0; i < opArity[root->opCode]; ++i) {
if (root->children[i]) {
toString_r(root->children[i]);
if (i < opArity[root->opCode] - 1) {
std::cout << ' ';
}
}
}
}
std::cout << ')';
return;
}
void toString(GPNode* root) {
toString_r(root);
std::cout << std::endl;
return;
}
/**
This function prints a tree in dot (graphviz format).
This is the entry point for the print operation. (see toDotFile_r,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment