Exemple #1
0
/**
* Record the cursor position
* This method is implemented to be lenient on loading in
* that it can load nodes from any VTDNav object
* if vn is null, return false
*/
Boolean recordCursorPosition(BookMark *bm, VTDNav *vn){
	int i;
	if (vn == NULL)
		return FALSE;
	if (vn== bm->vn1){
	}else {
		bind4BookMark(bm,vn);
	}
	for (i = 0; i < vn->nestingLevel; i++) {
		bm->ba[i] = bm->vn1->context[i];
	}

	bm->ba[vn->nestingLevel]= vn->l1index ;
	bm->ba[vn->nestingLevel + 1]= vn->l2index ;
	bm->ba[vn->nestingLevel + 2]= vn->l3index ;
	bm->ba[vn->nestingLevel + 3]= vn->l2lower ;
	bm->ba[vn->nestingLevel + 4]= vn->l2upper ;
	bm->ba[vn->nestingLevel + 5]= vn->l3lower ;
	bm->ba[vn->nestingLevel + 6]= vn->l3upper ;
	//ba[vn.nestingLevel + 7]=(vn.atTerminal == true)?1:0;
	bm->ba[vn->nestingLevel + 7]= 
		(vn->atTerminal == TRUE)? 
		(vn->LN | 0x80000000) : vn->LN ;
	return TRUE;
}
Exemple #2
0
BookMark *createBookMark2(VTDNav *vn) {
    BookMark *bm = (BookMark*) malloc(sizeof(BookMark));
    if (bm==NULL) {
        throwException2(out_of_mem,
                        "BookMark allocation failed ");
    }
    bm->ba = NULL;
    bm->ba_len = -1;
    bm->vn1 = NULL;

    bind4BookMark(bm,vn);
    recordCursorPosition2(bm);

    return bm;
}
Exemple #3
0
/**
* Record the cursor position
* This method is implemented to be lenient on loading in
* that it can load nodes from any VTDNav object
* if vn is null, return false
*/
Boolean recordCursorPosition(BookMark *bm, VTDNav *vn) {
    int i;
    if (vn == NULL)
        return FALSE;
    if (vn== bm->vn1) {
    } else {
        bind4BookMark(bm,vn);
    }
    for (i = 0; i < vn->nestingLevel; i++) {
        bm->ba[i] = bm->vn1->context[i];
    }

    if (vn->shallowDepth) {
        bm->ba[vn->nestingLevel]= vn->l1index ;
        bm->ba[vn->nestingLevel + 1]= vn->l2index ;
        bm->ba[vn->nestingLevel + 2]= vn->l3index ;
        bm->ba[vn->nestingLevel + 3]= vn->l2lower ;
        bm->ba[vn->nestingLevel + 4]= vn->l2upper ;
        bm->ba[vn->nestingLevel + 5]= vn->l3lower ;
        bm->ba[vn->nestingLevel + 6]= vn->l3upper ;
        //ba[vn.nestingLevel + 7]=(vn.atTerminal == true)?1:0;
        bm->ba[vn->nestingLevel + 7]=
            (vn->atTerminal == TRUE)?
            (vn->LN | 0x80000000) : vn->LN ;
    }
    else {
        VTDNav_L5 *vnl = (VTDNav_L5 *)vn;
        bm->ba[vn->nestingLevel]= vnl->l1index ;
        bm->ba[vn->nestingLevel + 1]= vnl->l2index ;
        bm->ba[vn->nestingLevel + 2]= vnl->l3index ;
        bm->ba[vn->nestingLevel + 3]= vnl->l4index ;
        bm->ba[vn->nestingLevel + 4]= vnl->l5index ;
        bm->ba[vn->nestingLevel + 5]= vnl->l2lower ;
        bm->ba[vn->nestingLevel + 6]= vnl->l2upper ;
        bm->ba[vn->nestingLevel + 7]= vnl->l3lower ;
        bm->ba[vn->nestingLevel + 8]= vnl->l3upper ;
        bm->ba[vn->nestingLevel + 9]= vnl->l4lower ;
        bm->ba[vn->nestingLevel + 10]= vnl->l4upper ;
        bm->ba[vn->nestingLevel + 11]= vnl->l5lower ;
        bm->ba[vn->nestingLevel + 12]= vnl->l5upper ;
        bm->ba[vn->nestingLevel + 13]=
            (vn->atTerminal == TRUE)?
            (vn->LN | 0x80000000) : vn->LN ;

    }
    return TRUE;
}