Esempio n. 1
0
// MARK is a MarkBox in SRC.  Find equivalent box in DUP.
MarkBox *BoxGraphNode::find_mark(Box *dup, Box *src, Box *mark)
{
    assert (box() != 0);

    if (mark == 0)
	return 0;

    if (src == mark)
    {
	MarkBox *dup_mb = ptr_cast(MarkBox, dup);
	assert(dup_mb != 0);
	return dup_mb;
    }

    // Try Composite children
    CompositeBox *src_cb = ptr_cast(CompositeBox, src);
    if (src_cb != 0)
    {
	CompositeBox *dup_cb = ptr_cast(CompositeBox, dup);
	assert(dup_cb != 0);
	assert(src_cb->nchildren() == dup_cb->nchildren());

	for (int i = 0; i < src_cb->nchildren(); i++)
	{
	    MarkBox *mb = 
		find_mark((*dup_cb)[i], (*src_cb)[i], mark);
	    if (mb)
		return mb;
	}

	return 0;
    }

    // Try HatBox child
    HatBox *src_hb = ptr_cast(HatBox, src);
    if (src_hb != 0)
    {
	HatBox *dup_hb = ptr_cast(HatBox, dup);
	assert(dup_hb != 0);

	return find_mark(dup_hb->box(), src_hb->box(), mark);
    }

    return 0;
}
Esempio n. 2
0
int add_mark(struct Client* sptr, const char* mark)
{
  struct SLink *lp;

  if (!find_mark(sptr, mark)) {
    lp = make_link();
    memset(lp, 0, sizeof(struct SLink));
    lp->next = cli_marks(sptr);
    lp->value.cp = (char*) MyMalloc(strlen(mark) + 1);
    assert(0 != lp->value.cp);
    strcpy(lp->value.cp, mark);
    cli_marks(sptr) = lp;
  }
  return 0;
}
Esempio n. 3
0
void
MarkBase_mmdb::get_all_marks (xList<UAS_Pointer<Mark> > &list)
{
  static UAS_Pointer<UAS_Common> null_doc;
  mmdb_pos_t i;
  Mark_mmdb *m;
  for (i = f_mark_base->first(); i != 0; f_mark_base->next(i))
    {
      oid_t id = f_mark_base->get_mark_oid (i);
      try
	{
	  m = find_mark (id, null_doc);
	  list.append (m);
	}
      catch_any()
	{
	  // ignore any errors for now -- DJB
	}
      end_try;
    }
}
Esempio n. 4
0
void
MarkBase_mmdb::get_marks (UAS_Pointer<UAS_Common> &doc_ptr,
			  xList<UAS_Pointer<Mark> > &list)
{
#ifdef FUJITSU_OLIAS
  UAS_String theId = doc_ptr->bid();
  theId = theId + "/" + doc_ptr->id();
#else
  UAS_String theId = doc_ptr->id();
#endif

  oid_list_handler *l =
    f_mark_base->get_mark_list ((char *) theId);

  if (l != NULL)
    {
      for (int i = 1; i <= (*l)->count(); i++)
	{
	  // Pull the entry from the list and replace it with NULL so
	  // that it doesn't get deleted when the list is deleted.
	  oid_t id = (*l)-> operator()(i);

	  // Assure that the oid_t has not been deleted. qfc 7-6-93
          if (id.eq (oid_t (c_code_t(0), 0)) == false)
	    {
	      try
		{
		  Mark_mmdb *m = find_mark (id, doc_ptr);
		  list.append (m);
		}
	      catch_any()
		{
		  // ignore failure for now! DJB 
		}
	      end_try;
	    }
	}
      delete l;
    }
}
Esempio n. 5
0
//=====================================================
int trans()//转置
{


		int i,j,s,t;


		int d[4][4]={0};
	//	if(c[][]==1&&c[][]==1&&c[][]==1&&c[][]==1)
			if(line_mark==1)
			{
				screen_a[m][n-2]=screen_a[m][n-1]=screen_a[m][n+1]=1;
				screen_a[m-2][n]=screen_a[m-1][n]=screen_a[m+1][n]=0;
				line_mark=0;
				find_mark();
				printf_full();
				return 1;
			}

			if(line_mark==2)
			{
				screen_a[m-2][n]=screen_a[m-1][n]=screen_a[m+1][n]=1;
				screen_a[m][n-2]=screen_a[m][n-1]=screen_a[m][n+1]=0;
				line_mark=0;
				find_mark();
				printf_full();
				return 1;
			}



			for(i=m,s=2;i<m+3;s--,i++)
			for(j=n-1,t=0;j<n+2;t++,j++)
                if(screen_a[i][j]<2)
				d[t][s]=screen_a[i][j];
	//	for(i=m-1,s=3;i<4;i++,s--)
	//		for(j=1,t=1;j<4;j++,t++)
	//			b[t][s]=c[i][j];


			if(d[0][2]==1&&d[1][1]==1&&d[1][2]==1&&d[2][1]==1)
			{
				d[1][0]=d[2][0]=d[0][1]=1;
			    d[2][1]=d[0][2]=d[1][2]=0;

			}
			if(d[0][1]==1&&d[1][1]==1&&d[1][2]==1&&d[2][2]==1)
			{
				d[0][0]=d[1][0]=d[2][1]=1;
                d[1][2]=d[2][2]=d[0][1]=0;

			}

			if(d[0][2]==1&&d[1][2]==1&&d[2][2]==1&&d[1][1]==1)
            {
                d[0][1]=d[1][1]=d[2][1]=d[1][0]=1;
                d[0][2]=d[1][2]=d[2][2]=0;

            }

            if(d[0][2]==1&&d[1][2]==1&&d[2][2]==1&&d[2][1]==1)
            {
                d[0][1]=d[1][1]=d[2][1]=d[2][0]=1;
                d[0][2]=d[1][2]=d[2][2]=0;

            }

            if(d[0][2]==1&&d[1][2]==1&&d[2][2]==1&&d[0][1]==1)

            {
                d[0][1]=d[1][1]=d[2][1]=d[0][0]=1;
                d[0][2]=d[1][2]=d[2][2]=0;
            }


			for(i=0,s=m;i<3;s++,i++)
				for(j=0,t=n-1;j<3;t++,j++)
                {
                if(d[i][j]==0)
                  if(screen_a[s][t]>=2)
                       continue;
                screen_a[s][t]=d[i][j];
                }
		//system("cls");
		find_mark();
		printf_full();
		return 1;



}
Esempio n. 6
0
// Copy Constructor
BoxGraphNode::BoxGraphNode(const BoxGraphNode& node):
    RegionGraphNode(node),
    _box(node._box ? node._box->dup() : 0),
    _highlight(node._box ? find_mark(_box, node._box, node._highlight) : 0)
{}
Esempio n. 7
0
const mark_t *
get_mark(const int index)
{
	return find_mark(index);
}
Esempio n. 8
0
/* Gets mark data structure by name of a mark.  Returns pointer to mark's data
 * structure or NULL. */
TSTATIC mark_t *
get_mark_by_name(const char mark)
{
	const char *const pos = strchr(valid_marks, mark);
	return (pos == NULL) ? NULL : find_mark(pos - valid_marks);
}
Esempio n. 9
0
File: BIDI.c Progetto: 12019/mtktest
/*****************************************************************************
 * FUNCTION
 *  bidi_main
 * DESCRIPTION
 *  fill the string buffer to bidirectional algorithm
 * PARAMETERS
 *  logicalStr              [IN]        Input string for bidi
 *  logicalStrLen           [IN]        String length of input string
 *  logicalCurPos           [IN]        Current cursor position of input string
 *  visualStr               [OUT]       Final output string from bidi algorithm
 *  visualStrLen            [OUT]       String length of final output string
 *  visualCurPos            [OUT]       Cursor position of final output string
 *  fSwap                   [IN]        If true, then reserse the string after apply bidi algorithm
 *  inputMode               [IN]        
 *  logicalHilightStart     [IN]        Word hilight start position of input string
 *  logicalHilightEnd       [IN]        Word hilight end position of input string
 *  visualHilightStart      [OUT]       Word hilight start position of output string
 *  visualHilightEnd        [OUT]       Word hilight end position of output string
 * RETURNS
 *  void
 *****************************************************************************/
void bidi_main(
        U8 *logicalStr,
        U16 logicalStrLen,
        U16 logicalCurPos,
        U8 *visualStr,
        U16 *visualStrLen,
        U16 *visualCurPos,
        pBOOL fSwap,
        U8 inputMode,
        U16 logicalHilightStart,
        U16 logicalHilightEnd,
        U16 *visualHilightStart,
        U16 *visualHilightEnd)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    U8 paragraphEmbeddingLevel = 0;

#if BIDI_CONSIDER_DIFF_INPUT_METHOD_BEHAVIOR
    U8 lastType;
    pBOOL flag = FALSE;
#endif /* BIDI_CONSIDER_DIFF_INPUT_METHOD_BEHAVIOR */ 
    pBOOL bCheckFlag;
    S16 iCount, nParaCount = 0;
    U8 *pInputType = input_types;
    U8 *pInputLevels = input_levels;
    U8 *pDestLevels = dest_levels;
    U8 *pDestTypes = dest_types;
    U8 *pLogicalBuffer = localLogicalBuffer;
    U8 *pVisualBuffer = visualStr;
    U16 mark;

    /* START TARUN PMT 20050202 */
    U8 newLineflag = 0;

    /* END TARUN PMT 20050202 */
    U8 testHilighOneCharFlag = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset(input_types, 0,sizeof(input_types));
    memset(input_levels, 0,sizeof(input_levels));
    memset(dest_levels, 0,sizeof(dest_levels));
    memset(dest_types, 0,sizeof(dest_types));
    memset(localLogicalBuffer, 0,sizeof(localLogicalBuffer));

    if (logicalStrLen == 0)
    {
        /* *visualCurPos = 0; */
        *visualCurPos = 0xFFFF;
        *visualStr = 0;
        *(visualStr + 1) = 0;
        *visualStrLen = 0;
        *visualHilightStart = 0;
        *visualHilightEnd = 0;
        return;
    }

    if (logicalCurPos != 0xFFFF)
    {
        if (logicalCurPos < logicalHilightEnd)
        {
            logicalCurPos = logicalHilightEnd;
        }
        if (logicalHilightStart > logicalHilightEnd)
        {
            logicalHilightStart = logicalHilightEnd;
        }
    }


/*PMT IRE START*/
/*removed unwanted code*/
/*PMT IRE END*/
    mmi_ucs2ncpy((S8*) localLogicalBuffer, (const S8*)logicalStr, (U32) logicalStrLen);

#if BIDI_CONSIDER_DIFF_INPUT_METHOD_BEHAVIOR
    if (inputMode == BIDI_R)
    {
        bidi_get_char_type((U8*) & localLogicalBuffer[(logicalStrLen - 1) * BIDI_ENCODING_LENGTH], (U8*) & lastType);
        if (lastType == WS)
        {
            localLogicalBuffer[(logicalStrLen - 1) * BIDI_ENCODING_LENGTH] = 0;
            localLogicalBuffer[(logicalStrLen - 1) * BIDI_ENCODING_LENGTH + 1] = 0;
            if (logicalCurPos == logicalStrLen)
            {
                flag = TRUE;
                logicalCurPos--;
            }
            logicalStrLen--;
        }

        set_bidi_cursor_pos((U8*) localLogicalBuffer, logicalCurPos, (U16) CURSOR_MARK);

        logicalStrLen = (U16) mmi_ucs2strlen((const S8*)localLogicalBuffer);

        set_bidi_cursor_pos((U8*) localLogicalBuffer, logicalStrLen, (U16) LAST_MARK);
    }
    else
#endif /* BIDI_CONSIDER_DIFF_INPUT_METHOD_BEHAVIOR */ 
    {
        if (logicalCurPos != 0xFFFF)
        {
            set_bidi_cursor_pos((U8*) localLogicalBuffer, logicalCurPos, (U16) CURSOR_MARK);
        }
    }

    set_bidi_cursor_pos((U8*) localLogicalBuffer, logicalHilightEnd, (U16) SECOND_HIGHLT);
    set_bidi_cursor_pos((U8*) localLogicalBuffer, (U16) (logicalHilightStart), (U16) FIRST_HIGHLT);

    mmi_ucs2cpy((S8*) visualStr, (const S8*)localLogicalBuffer);
    logicalStrLen = get_direction_codes((U8*) input_types, (U8*) localLogicalBuffer, 0);

    iCount = 0;

    while (iCount < logicalStrLen)
    {
        bCheckFlag = FALSE;
        nParaCount = identify_paragraphs(pInputType, (U16) (logicalStrLen - iCount), &bCheckFlag);
        if (logicalCurPos < nParaCount)
        {
            newLineflag = 1;
        }
        copy_direction_codes(pDestTypes, pInputType, (U16) nParaCount);
        if (bCheckFlag)
        {
            pDestTypes[nParaCount] = 0;
            pInputType[nParaCount] = 0;
            if (pInputType[nParaCount - 1] == BIDI_B)
            {
                pDestTypes[nParaCount - 1] = 0;
                pInputType[nParaCount - 1] = 0;
            }
        }

        /*----------------------------------------------------------------*/
        /* We use bidi_main line by line, so we can't get the paragraph   */
        /* embedding level from the current line.                         */
        /* Now change to set the paragraph embedding                      */
        /* level by the flag: fSwap.                                       */
        /*----------------------------------------------------------------*/
        /* paragraphEmbeddingLevel = get_para_embedding_level(pInputType, nParaCount); */
        paragraphEmbeddingLevel = (fSwap == 1) ? 1 : 0;
        set_dest_levels(0, nParaCount, paragraphEmbeddingLevel, pDestLevels);

        get_run_level(nParaCount, paragraphEmbeddingLevel, pDestLevels, pDestTypes);
        resolve_lines(paragraphEmbeddingLevel, pVisualBuffer, nParaCount, TRUE, pDestTypes, pDestLevels);

        if (bCheckFlag)
        {
            nParaCount++;
        }
        pInputType += nParaCount;
        pInputLevels += nParaCount;
        pDestLevels += nParaCount;
        pDestTypes += nParaCount;
        pLogicalBuffer += nParaCount * 2;
        pVisualBuffer += nParaCount * 2;
        iCount += nParaCount;
    }

    *visualStrLen = (U16) mmi_ucs2strlen((const S8*)visualStr);

    if (fSwap)
    {
        bidi_reverse((U8*) visualStr, *visualStrLen);
    }

    *visualCurPos = 0xFFFF;
    /* START Changed by YOGESH PMT 20050912 */
    while (find_mark(visualStr, *visualStrLen, &mark, (U16*) & iCount))
        /* END YOGESH PMT 20050912 */
    {
        switch (mark)
        {
            case LAST_MARK:
            case CURSOR_MARK:
        #if BIDI_CONSIDER_DIFF_INPUT_METHOD_BEHAVIOR
                if (inputMode == BIDI_R)
                {
                    *visualCurPos = get_bidi_cursor_pos(visualStr, (U16) LAST_MARK);

                    if (lastType == WS)
                    {
                        set_bidi_cursor_pos(visualStr, *visualCurPos, (U16) (0x0020));
                    }

                    *visualCurPos = get_bidi_cursor_pos(visualStr, (U16) CURSOR_MARK);
                }
                else
        #endif /* BIDI_CONSIDER_DIFF_INPUT_METHOD_BEHAVIOR */ 
                {
                    *visualCurPos = get_bidi_cursor_pos(visualStr, (U16) CURSOR_MARK);
                }
                testHilighOneCharFlag = 1;
                break;
            case SECOND_HIGHLT:
                *visualHilightEnd = get_bidi_cursor_pos(visualStr, (U16) SECOND_HIGHLT);
                testHilighOneCharFlag = 0;
                break;
            case FIRST_HIGHLT:
                *visualHilightStart = get_bidi_cursor_pos(visualStr, (U16) FIRST_HIGHLT);
                testHilighOneCharFlag = 0;

                break;
        }
    }

    if (testHilighOneCharFlag == 0 && *visualHilightEnd == *visualHilightStart)
    {
        *visualHilightEnd = *visualHilightStart = *visualCurPos + 1;
    }

    if ((logicalHilightStart == 0) && (logicalHilightEnd == 0))
    {
        *visualHilightEnd = 0;
        *visualHilightStart = 0;
    }

    if ((*visualHilightEnd <
         /*=*/ *visualHilightStart) /* && (!(*visualHilightStart == 0 && *visualHilightEnd == 0)) */ )
    {
        (*visualHilightEnd)++;
        (*visualHilightStart)++;
    }

    *visualStrLen = (U16) mmi_ucs2strlen((const S8*)visualStr);
}