void shaders_cache::load(shader_language lang) { std::string root = path_to_root(); //shared cache load(root + "cache/", lang); std::string title_id = Emu.GetTitleID(); if (!title_id.empty()) { load(root + title_id + "/cache/", lang); } }
void print_fstree(void) { node *n = NULL; int i = 0; int rank = 0; int new_rank = 0; struct node *queue; FILE *rootlog_fh; rootlog_fh = fopen("/tmp/gitfs.log", "a"); if (fsroot == NULL) { fprintf(rootlog_fh, "Empty tree.\n"); return; } queue = NULL; enqueue(fsroot); while (queue != NULL) { n = dequeue(); if (n->parent != NULL && n == n->parent->pointers[0]) { new_rank = path_to_root (fsroot, n); if (new_rank != rank) { rank = new_rank; fprintf(rootlog_fh, "\n"); } } fprintf(rootlog_fh, "(%lx)", (unsigned long) n); for (i = 0; i < n->num_keys; i++) { fprintf(rootlog_fh, "%lx ", (unsigned long) n->pointers[i]); fprintf(rootlog_fh, "%d ", n->keys[i]); } if (!n->is_leaf) for (i = 0; i <= n->num_keys; i++) enqueue(n->pointers[i]); if (n->is_leaf) fprintf(rootlog_fh, "%lx ", (unsigned long) n->pointers[BTREE_ORDER - 1]); else fprintf(rootlog_fh, "%lx ", (unsigned long) n->pointers[n->num_keys]); fprintf(rootlog_fh, "| "); } fprintf(rootlog_fh, "\n"); fclose(rootlog_fh); }
//print the tree in the order of the level of nodes. || symbol is used to seperate the nodes //if verbose flag is set, the pointer to the keys will also be displayed void display( node * root ) { node * n = NULL; int i = 0; int rank = 0; int new_rank = 0; if (root == NULL) { printf("Empty tree.\n"); return; } queue = NULL; enqueue(root); while( queue != NULL ) { n = dequeue(); if (n->parent != NULL && n == n->parent->pointers[0]) { new_rank = path_to_root( root, n ); if (new_rank != rank) { rank = new_rank; printf("\n"); } } if (verbose_output) printf("(%lx)", (unsigned long)n); for (i = 0; i < n->num_keys; i++) { if (verbose_output) printf("%lx ", (unsigned long)n->pointers[i]); printf("%d ", n->keys[i]); } if (!n->is_leaf) for (i = 0; i <= n->num_keys; i++) enqueue(n->pointers[i]); if (verbose_output) { if (n->is_leaf) printf("%lx ", (unsigned long)n->pointers[order - 1]); else printf("%lx ", (unsigned long)n->pointers[n->num_keys]); } printf("| "); } printf("\n"); }
/** * Prints the B+ tree in the command * line in level (rank) order, with the * keys in each node and the '|' symbol * to separate nodes. * With the verbose_output flag set. * the values of the pointers corresponding * to the keys also appear next to their respective * keys, in hexadecimal notation. * * @param root the root nodes */ void BtreePrintTree(BtreeNode_t * root) { BtreeNode_t * n = NULL; int i = 0; int rank = 0; int new_rank = 0; if (root == NULL) { printf("Empty tree.\n"); return; } queue = NULL; enqueue(root); while (queue != NULL) { n = dequeue(); if (n->parent != NULL && n == n->parent->pointers[0]) { new_rank = path_to_root(root, n); if (new_rank != rank) { rank = new_rank; printf("\n"); } } if (n->is_leaf) { printf("leaf: "); } else { printf("node: "); } printf("(%lx p: %lx)\t", (unsigned long) n, (unsigned long) n->parent); for (i = 0; i < n->num_keys; i++) { printf("[%lx]", (unsigned long) n->keys[i]); } if (!n->is_leaf) for (i = 0; i <= n->num_keys; i++) enqueue(n->pointers[i]); printf("\n"); } printf("\n"); }