- if (!initialized) { // data structure has not been initialized properly\r
- fprintf(stderr, "Error: data structure has not been initialized properly (by calling method OpenDocument)\n");\r
- return NULLT;\r
- }\r
- \r
- // closing parenthesis for the tree root\r
- par_aux = (pb *)urealloc(par_aux, sizeof(pb)*(1+npar/(8*sizeof(pb))));\r
- \r
- // creates the data structure for the tree topology\r
- Par = (bp *)umalloc(sizeof(bp));\r
- bp_construct(Par, npar, par_aux, OPT_DEGREE|0); \r
- // creates structure for tags\r
-\r
- // If we found an attribute then "<@>" is present in the tree\r
- // if we didn't then it is not. "<$>" is never present in the tree\r
- uint max_tag = 0;\r
- for(uint i=0;i<(uint)npar-1;i++)\r
- max_tag = max(max_tag,tags_aux[i]);\r
- max_tag++;\r
- tags_aux = (TagType *) urealloc(tags_aux, sizeof(TagType)*(npar + 1));\r
- tags_aux[npar++] = max_tag;\r
- //int ntagsize = found_attributes ? 2*ntagnames-1 : 2*ntagnames - 2;\r
- int ntagsize = 2*ntagnames + 2;\r
-\r
- //static_bitsequence_builder * bmb = new static_bitsequence_builder_brw32(20);\r
- //static_permutation_builder * pmb = new static_permutation_builder_mrrr(PERM_SAMPLE, bmb);\r
- //static_sequence_builder * ssb = new static_sequence_builder_gmr_chunk(bmb, pmb);\r
- static_bitsequence_builder * bmb = new static_bitsequence_builder_brw32(20);\r
- alphabet_mapper *am = new alphabet_mapper_none();\r
- wt_coder * wc = new wt_coder_huff((uint*)tags_aux,npar,am);\r
- Tags = new static_sequence_wvtree((uint*)tags_aux,npar,wc ,bmb, am);\r
- //Tags = new static_sequence_gmr((uint *) tags_aux, (uint) npar,ntagsize, bmb, ssb);\r
- \r
- cout << "Tags test: " << Tags->test((uint*)tags_aux,npar) << endl;\r
-\r
- tags_blen = bits(max_tag);\r
- tags_len = (uint)npar;\r
- tags_fix = new uint[uint_len(tags_blen,tags_len)];\r
- for(uint i=0;i<(uint)npar;i++)\r
- set_field(tags_fix,tags_blen,i,tags_aux[i]);\r
- \r
- delete bmb;\r
- //delete pmb;\r
- //delete ssb;\r
-\r
- \r
- // makes the text collection static\r
- if (!disable_tc)\r
- Text->MakeStatic();\r