예제 #1
0
void BookExt_Conditional12::load(CFRecord& record)
{
	unsigned char flags;
	record >> flags;
	fPublishedBookItems = GETBIT(flags, 1);
	fShowPivotChartFilter = GETBIT(flags, 2);
}
예제 #2
0
/*
 * Finds the closest used position in the packed memory
 * array (including index) within a range (non-inclusive). 
 * Returns -1 on failure.
 */
int closest_in_range(PMA* pma, int index, int b_lim, int t_lim){
	int closest = -1;
	int radius = 0;
	int fail = 0;

	while (!fail && closest == -1){
		fail = 1;

		if (t_lim > index + radius){
			fail = 0;
			if (GETBIT(pma->bitmap, index + radius)){
				closest = index + radius;
			}
		}

		if (b_lim < index - radius){
			fail = 0;
			if (GETBIT(pma->bitmap, index - radius)){
				closest = index - radius;
			}
		}

		radius++;
	}

	return closest;
}
예제 #3
0
void SortData::readFields(CFRecord& record)
{
	unsigned short flags;

	record >> frtHeader >> flags;

	fCol			= GETBIT(flags, 0);
	fCaseSensitive	= GETBIT(flags, 1);
	fAltMethod		= GETBIT(flags, 2);
	sfp				= GETBITS(flags, 3, 5);
	
	RFX rfx_orig;
	record >> rfx_orig >> cconditions;
	rfx = static_cast<std::wstring >(rfx_orig);
	
	record >> idParent;
	
	std::list<CFRecordPtr>& recs = continue_records[rt_ContinueFrt12];
	while(!recs.empty())
	{
		record.appendRawData(recs.front()->getData() + 12, recs.front()->getDataSize() - 12);
		recs.pop_front();
	}
	
	for(unsigned int i = 0; i < cconditions; ++i)
	{
		SortCond12Ptr sort_cond(new SortCond12);
		record >> *sort_cond;
		sortCond12Array.push_back(sort_cond);
	}

}
예제 #4
0
/*===========================================================================*
 *				checklist				     *
 *===========================================================================*/
static int checklist(char *file, int line,
	struct slabheader *s, int l, int bytes)
{
	struct slabdata *n = s->list_head[l];
	int ch = 0;

	while(n) {
		int count = 0, i;
		MYASSERT(n->sdh.magic1 == MAGIC1);
		MYASSERT(n->sdh.magic2 == MAGIC2);
		MYASSERT(n->sdh.list == l);
		MYASSERT(usedpages_add(n->sdh.phys, VM_PAGE_SIZE) == 0);
		if(n->sdh.prev)
			MYASSERT(n->sdh.prev->sdh.next == n);
		else
			MYASSERT(s->list_head[l] == n);
		if(n->sdh.next) MYASSERT(n->sdh.next->sdh.prev == n);
		for(i = 0; i < USEELEMENTS*8; i++)
			if(i >= ITEMSPERPAGE(bytes))
				MYASSERT(!GETBIT(n, i));
			else
				if(GETBIT(n,i))
					count++;
		MYASSERT(count == n->sdh.nused);
		ch += count;
		n = n->sdh.next;
	}

	return ch;
}
예제 #5
0
void AutoFilter::readFields(CFRecord& record)
{
	size_t pos_record = record.getRdPtr();

	if (size == 0xffffffff) size = record.getDataSize() - pos_record;

	if (size > 0)
	{
		bExist = true;
	}

	m_bAutoFilter12 = false;

	unsigned short flags;
	record >> iEntry >> flags;
	
	wJoin		= GETBITS(flags, 0, 1);
	
	fSimple1	= GETBIT(flags, 2);
	fSimple2	= GETBIT(flags, 3);
	fTopN		= GETBIT(flags, 4);
	fTop		= GETBIT(flags, 5); //top(1) or bottom(0)
	fPercent	= GETBIT(flags, 6);
	
	wTopN		= GETBITS(flags, 7, 15);

	unsigned short	_iEntry		= iEntry;
	unsigned char	_wJoin		= wJoin;			
	unsigned short	_wTopN		= wTopN;			
	
	if (fTopN != 1)
	{
		record >> doper1;			
		record >> doper2;
	}
예제 #6
0
파일: DXFBdr.cpp 프로젝트: ShockwaveNN/core
void DXFBdr::load(CFRecord& record)
{
	_UINT32 flags;
	record >> flags;
	
	dgLeft		= static_cast<unsigned char>(GETBITS(flags, 0, 3));
	dgRight		= static_cast<unsigned char>(GETBITS(flags, 4, 7));
	dgTop		= static_cast<unsigned char>(GETBITS(flags, 8, 11));
	dgBottom	= static_cast<unsigned char>(GETBITS(flags, 12, 15));
	
	icvLeft		= static_cast<unsigned char>(GETBITS(flags, 16, 22));
	icvRight	= static_cast<unsigned char>(GETBITS(flags, 23, 29));
	
	bitDiagDown = GETBIT(flags, 30);
	bitDiagUp	= GETBIT(flags, 31);

	record >> flags;
	
	icvTop		= static_cast<unsigned char>(GETBITS(flags, 0, 6));
	icvBottom	= static_cast<unsigned char>(GETBITS(flags, 7, 13));
	icvDiag		= static_cast<unsigned char>(GETBITS(flags, 14, 20));
	
	dgDiag		= static_cast<unsigned char>(GETBITS(flags, 21, 24));

}
예제 #7
0
/*
 * Expand -g interval:o,t into primitive ops.
 */
void
AddGraceOp(int flags, long long n)
{
	int ScopeMask, ScopeBit, opbase;

	ScopeMask = flags&SCOPE_MASK;

	if ((flags&(TYPE_MASK|EXP_MASK)) != 0) {
		fprintf(stderr, "%s:  AddGraceOp: Invalid flags -- %#x\n",
		    Program, flags);
		Err++;
		return;
	}

	opbase = OP_SET|ARG_GRACE;
	for (ScopeBit = GETBIT(ScopeMask); ScopeBit != 0;
	    ScopeBit = GETBIT(ScopeMask)) {
		switch (ScopeBit) {
		case SCOPE_ONLINE:
		case SCOPE_TOTAL:
			AddPrimOp(opbase|ScopeBit, n);
			break;
		default:
			fprintf(stderr, "%s:  AddGraceOp:  bad option %#x\n",
			    Program, ScopeBit);
			Err++;
		}
		ScopeMask &= ~ScopeBit;
	}
}
void BookExt_Conditional11::load(CFRecord& record)
{
	unsigned char flags;
	record >> flags;
	fBuggedUserAboutSolution = GETBIT(flags, 0);
	fShowInkAnnotation = GETBIT(flags, 1);
}
예제 #9
0
void BookBool::readFields(CFRecord& record)
{
	unsigned short flags;
	record >> flags;
	
	fNoSaveSup			= GETBIT(flags, 0);
	fHasEnvelope		= GETBIT(flags, 2);
	fEnvelopeVisible	= GETBIT(flags, 3);
	fEnvelopeInitDone	= GETBIT(flags, 4);
	
	unsigned char grUpdateLinks_num = GETBITS(flags, 5, 6);
	switch(grUpdateLinks_num)
	{
		case 0:
			grUpdateLinks = std::wstring (L"userSet");
			break;
		case 1:
			grUpdateLinks = std::wstring (L"never");
			break;
		case 2:
			grUpdateLinks = std::wstring (L"always");
			break;
		default:
			throw;// EXCEPT::RT::WrongBiffRecord("Unsupported value of grUpdateLinks.", record.getTypeString());

	}
	
	fHideBorderUnselLists = GETBIT(flags, 8);
}
예제 #10
0
void letterA(void)
{
	/***letter A****/


	 for(u8 i=0;i<6;i++)
	 {
		// shift(rows[i],cols[i]);

		u8 R=rows[i];
		u8 C=cols[0][i];
		DIO_u8WritePinVal(otpt_pin,0);  //output enable
			for(s8 i=0;i<8;i++)
		{
		DIO_u8WritePinVal(DS_pin,GETBIT(R,i)); // rows
		DIO_u8WritePinVal(sh_clk,0); ///clk
		DIO_u8WritePinVal(sh_clk,1); //clk
		}

		for(s8 i=0;i<8;i++)
		{
		DIO_u8WritePinVal(DS_pin,GETBIT(C,i)); //columns
		DIO_u8WritePinVal(sh_clk,0); //clk
		DIO_u8WritePinVal(sh_clk,1); //clk
		}
		DIO_u8WritePinVal(otpt_pin,1);  // output enable
	 }

	/*DIO_u8WritePortVal(2,0b00000000); //switch all off
	DIO_u8WritePortVal(3,0b11111011); //row //low //
	DIO_u8WritePortVal(2,0b00011000);   //cols //high //
	Delay(1);


	DIO_u8WritePortVal(2,0b00000000); //switch all off
	DIO_u8WritePortVal(3,0b11110111); //row //low //
	DIO_u8WritePortVal(2,0b00100100);   //cols //high //
	Delay(1);

	DIO_u8WritePortVal(2,0b00000000); //switch all off
	DIO_u8WritePortVal(3,0b11101111); //row //low //
	DIO_u8WritePortVal(2,0b01000010);   //cols //high //
	Delay(1);

	DIO_u8WritePortVal(2,0b00000000); //switch all off
	DIO_u8WritePortVal(3,0b11011111); //row //low //
	DIO_u8WritePortVal(2,0b01111110);   //cols //high //
	Delay(1);

	DIO_u8WritePortVal(2,0b00000000); //switch all off
	DIO_u8WritePortVal(3,0b10111111); //row //low //
	DIO_u8WritePortVal(2,0b01000010);   //cols //high //
	Delay(1);

	DIO_u8WritePortVal(2,0b00000000); //switch all off
	DIO_u8WritePortVal(3,0b01111111); //row //low //
	DIO_u8WritePortVal(2,0b01000010);   //cols //high //
	Delay(1);*/

}
예제 #11
0
void FactoidData::load(CFRecord& record)
{
	unsigned short flags;
	record >> flags;
	fDelete = GETBIT(flags, 0);
	fXMLBased = GETBIT(flags, 0);
	record >> propertyBag;
}
예제 #12
0
void Frame::readFields(CFRecord& record)
{
	unsigned short flags;
	record >> frt >> flags;
	
	fAutoSize = GETBIT(flags, 0);
	fAutoPosition = GETBIT(flags, 1);
}
예제 #13
0
void RRD::load(CFRecord& record)
{
	unsigned short flags;
	record >> cbMemory >> revid >> revt >> flags;
	fAccepted = GETBIT(flags, 0);
	fUndoAction = GETBIT(flags, 1);
	fDelAtEdgeOfSort = GETBIT(flags, 3);
	record >> tabid;
}
예제 #14
0
void CatSerRange::readFields(CFRecord& record)
{
	unsigned short flags;
	record >> catCross >> catLabel >> catMark >> flags;

	fBetween = GETBIT(flags, 0);
	fMaxCross = GETBIT(flags, 1);
	fReversed = GETBIT(flags, 2);
}
예제 #15
0
파일: PLV.cpp 프로젝트: ONLYOFFICE/core
void PLV::readFields(CFRecord& record)
{
	FrtHeader frtHeader(rt_PLV);
	record >> frtHeader;
	unsigned short flags;
	record >> wScalePLV >> flags;
	fPageLayoutView = GETBIT(flags, 0);
	fRulerVisible = GETBIT(flags, 1);
	fWhitespaceHidden = GETBIT(flags, 2);
}
예제 #16
0
파일: bdz.c 프로젝트: filippobistaffa/SCFC
static int bdz_generate_queue(cmph_uint32 nedges, cmph_uint32 nvertices, bdz_queue_t queue, bdz_graph3_t* graph3)
{
	cmph_uint32 i,v0,v1,v2;
	cmph_uint32 queue_head=0,queue_tail=0;
	cmph_uint32 curr_edge;
	cmph_uint32 tmp_edge;
	cmph_uint8 * marked_edge =malloc((size_t)(nedges >> 3) + 1);
	memset(marked_edge, 0, (size_t)(nedges >> 3) + 1);

	for(i=0;i<nedges;i++){
		v0=graph3->edges[i].vertices[0];
		v1=graph3->edges[i].vertices[1];
		v2=graph3->edges[i].vertices[2];
		if(graph3->vert_degree[v0]==1 || 
				graph3->vert_degree[v1]==1 ||
				graph3->vert_degree[v2]==1){
			if(!GETBIT(marked_edge,i)) {
				queue[queue_head++]=i;
				SETBIT(marked_edge,i);
			}
		};
	};
	while(queue_tail!=queue_head){
		curr_edge=queue[queue_tail++];
		bdz_remove_edge(graph3,curr_edge);
		v0=graph3->edges[curr_edge].vertices[0];
		v1=graph3->edges[curr_edge].vertices[1];
		v2=graph3->edges[curr_edge].vertices[2];
		if(graph3->vert_degree[v0]==1 ) {
			tmp_edge=graph3->first_edge[v0];
			if(!GETBIT(marked_edge,tmp_edge)) {
				queue[queue_head++]=tmp_edge;
				SETBIT(marked_edge,tmp_edge);
			};
			
		};
		if(graph3->vert_degree[v1]==1) {
			tmp_edge=graph3->first_edge[v1];
			if(!GETBIT(marked_edge,tmp_edge)){
				queue[queue_head++]=tmp_edge;
				SETBIT(marked_edge,tmp_edge);
			};
			
		};
		if(graph3->vert_degree[v2]==1){
			tmp_edge=graph3->first_edge[v2];
			if(!GETBIT(marked_edge,tmp_edge)){
				queue[queue_head++]=tmp_edge;
				SETBIT(marked_edge,tmp_edge);
			};
		};
	};
	free(marked_edge);
	return (int)(queue_head-nedges);/* returns 0 if successful otherwies return negative number*/
};
예제 #17
0
void OleDbConn::readFields(CFRecord& record)
{
	unsigned short flags;

	record >> frtHeaderOld >> flags >> cst;
	
	fPasswd	= GETBIT(flags, 0);
	fLocal	= GETBIT(flags, 1);

	record.skipNunBytes(4); //reserved2
}
void OfficeArtClientAnchorSheet::loadFields(XLS::CFRecord& record)
{
	global_info = record.getGlobalWorkbookInfo();
	
	if (record.getGlobalWorkbookInfo()->Version < 0x0600)
	{
		unsigned char flags;
		record >> flags;
		fMove = GETBIT(flags, 0);
		fSize = GETBIT(flags, 1);
	}
예제 #19
0
void Chart3d::readFields(CFRecord& record)
{
	unsigned short flags;
	unsigned short pcHeight_raw;
	record >> anRot >> anElev >> pcDist >> pcHeight_raw >> pcDepth >> pcGap >> flags;
	fPerspective = GETBIT(flags, 0);
	fCluster = GETBIT(flags, 1);
	f3DScaling = GETBIT(flags, 2);
	fNotPieChart = GETBIT(flags, 4);
	fWalls2D = GETBIT(flags, 5);
	pcHeight = fNotPieChart ? static_cast<short>(pcHeight_raw) : pcHeight_raw;
}
예제 #20
0
void List12TableStyleClientInfo::load(CFRecord& record)
{	
	unsigned short flags;
	record >> flags;

	fFirstColumn	= GETBIT(flags, 0);
	fLastColumn		= GETBIT(flags, 1);
	fRowStripes		= GETBIT(flags, 2);
	fColumnStripes	= GETBIT(flags, 3);
	fDefaultStyle	= GETBIT(flags, 6);

	record >> stListStyleName;
}
예제 #21
0
void DataLabExtContents::readFields(CFRecord& record)
{
	FrtHeader frtHeader;
	record >> frtHeader;

	unsigned short flags;
	record >> flags >> rgchSep;

	fSerName	= GETBIT(flags, 0);
	fCatName	= GETBIT(flags, 1);
	fValue		= GETBIT(flags, 2);
	fPercent	= GETBIT(flags, 3);
	fBubSizes	= GETBIT(flags, 4);
}
예제 #22
0
파일: BookExt.cpp 프로젝트: ONLYOFFICE/core
void BookExt::readFields(CFRecord& record)
{
	FrtHeader header(rt_BookExt);
	record >> header;

	record >> cb;
	_UINT32 flags;
	
	if (record.loadAnyData(flags))
	{	
		fDontAutoRecover		= GETBIT(flags, 0);
		fHidePivotList			= GETBIT(flags, 1);
		fFilterPrivacy			= GETBIT(flags, 2);
		fEmbedFactoids			= GETBIT(flags, 3);
		mdFactoidDisplay		= GETBITS(flags, 4, 5);
		fSavedDuringRecovery	= GETBIT(flags, 6);
		fCreatedViaMinimalSave	= GETBIT(flags, 7);
		fOpenedViaDataRecovery	= GETBIT(flags, 8);
		fOpenedViaSafeLoad		= GETBIT(flags, 9);
	}
	else return;


	if(cb > 20)
	{
		record >> grbit1;
	}
예제 #23
0
void TableStyle::readFields(CFRecord& record)
{
	unsigned short flags;

	record >> frtHeader >> flags;

	fIsPivot = GETBIT(flags, 1);
	fIsTable = GETBIT(flags, 2);

	unsigned short cchName;
	record >> ctse >> cchName;
	rgchName.setSize(cchName);
	record >> rgchName;
}
예제 #24
0
void StyleXF::load(CFRecord& record)
{
	m_GlobalWorkbookInfo = record.getGlobalWorkbookInfo();

	if (m_GlobalWorkbookInfo->Version < 0x0600)
	{
		_UINT16 flags1;
		_UINT32 flags2;
		_UINT32 flags3;

		record >> flags1 >> flags2 >> flags3;
		
		alc					= static_cast<unsigned char>(GETBITS(flags1, 0, 2));
		fWrap				= GETBIT(flags1, 3);
		alcV				= static_cast<unsigned char>(GETBITS(flags1, 4, 6));
		fJustLast			= GETBIT(flags1, 7);
		trot				= 0;//static_cast<unsigned char>(GETBITS(flags1, 8, 15));	
		cIndent				= 0;//static_cast<unsigned char>(GETBITS(flags1, 16, 19));
		fShrinkToFit		= 0;//GETBIT(flags1, 20);
		iReadOrder			= 0;//static_cast<unsigned char>(GETBITS(flags1, 22, 23));

		char orient			= GETBITS(flags1, 8, 10);
		
		switch(orient)
		{
			case 0:	trot = 0;		break;		// Text orientation: not rotated.
			case 1: trot = 0xff;	break;		// Text orientation: vertically stacked.
			case 2: trot = 90;		break;		// Text orientation: 90 deg counterclockwise.
			case 3: trot = 270;		break;		// Text orientation: 90 deg clockwise.
		}	

		fill.fls = static_cast<unsigned char>(GETBITS(flags2, 16, 21));
		
		fill.icvFore = GETBITS(flags2, 0, 6);
		fill.icvBack = GETBITS(flags2, 7, 13);
		
		border.dgTop		= static_cast<unsigned char>(GETBITS(flags3, 0, 2));
		border.dgLeft		= static_cast<unsigned char>(GETBITS(flags3, 3, 5));
		border.dgRight		= static_cast<unsigned char>(GETBITS(flags3, 6, 8));		
		border.dgBottom		= static_cast<unsigned char>(GETBITS(flags2, 22, 24));	
		border.dgDiag		= 0;
		border.grbitDiag	= 0;

		border.icvLeft		= (0 != border.dgLeft)	? static_cast<unsigned char>(GETBITS(flags3, 16, 22))	: 0;
		border.icvRight		= (0 != border.dgRight)	? static_cast<unsigned char>(GETBITS(flags3, 23, 29))	: 0;
		border.icvTop		= (0 != border.dgTop)	? static_cast<unsigned char>(GETBITS(flags3,  9, 15))	: 0;
		border.icvBottom	= (0 != border.dgBottom)? static_cast<unsigned char>(GETBITS(flags2, 25, 31))	: 0;
		border.icvDiag		= 0;
	}
예제 #25
0
파일: fibre.c 프로젝트: scuzzycheese/micro
void fibres_start()
{
	coStData *curCoRo = mainRegs.next;

	regSave(&mainRegs);
	while(mainRegs.next != NULL)
	{
		CLRBIT(curCoRo->flags, JMPBIT); // = JMPFROMMAIN

		__asm__("MAINRET:");
		regRestore(&mainRegs);

		//This might be a few too many checks
		if(GETBIT(curCoRo->flags, JMPBIT) == JMPFROMMAIN && !GETBIT(curCoRo->flags, FINISHED) && GETBIT(curCoRo->flags, SHEDULED))
		{
			if(GETBIT(curCoRo->flags, CALLSTATUS) == CALL)
			{
				//We should onyl get in here once per routine,
				//there after we jmp back, not call back
				SETBIT(curCoRo->flags, CALLSTATUS); // = JMP

				//This is designed to replace to two calls below
				setStackAndCallToAdd(curCoRo->sp, curCoRo->retAdd);
				//Put us back into the right stack frame
				regRestore(&mainRegs);
				//Believe if or not, if we get here, the routine is finished
				SETBIT(curCoRo->flags, FINISHED);
			}
			else
			{
				//This is designed to replace to two calls below
				regRestoreAndJmpToYeild(curCoRo);
			}
		}
		if(GETBIT(curCoRo->flags, FINISHED) && curCoRo->mallocStack)
		{
			if(curCoRo->prev->next == curCoRo->next)
			{
				mainRegs.next = NULL;
			}
			else
			{
				curCoRo->prev->next = curCoRo->next;
			}
		}
		curCoRo = curCoRo->next;
		//printf("End loop\n");
	}
}
예제 #26
0
파일: gpiod.c 프로젝트: armedTiger/openbmc
static void
populate_gpio_pins(uint8_t fru) {

  int i, ret;

  gpio_pin_t *gpios;

  gpios = get_struct_gpio_pin(fru);
  if (gpios == NULL) {
    syslog(LOG_WARNING, "populate_gpio_pins: get_struct_gpio_pin failed.");
    return;
  }

  for(i = 0; i < gpio_pin_cnt; i++) {
    // Only monitor the PWRGOOD_CPU pin
    if (i == PWRGOOD_CPU)
      gpios[gpio_pin_list[i]].flag = 1;
  }


  for(i = 0; i < MAX_GPIO_PINS; i++) {
    if (gpios[i].flag) {
      gpios[i].ass_val = GETBIT(gpio_ass_val, i);
      ret = yosemite_get_gpio_name(fru, i, gpios[i].name);
      if (ret < 0)
        continue;
    }
  }
}
BITMAP encode (BITMAP img, FILE *fp)
{
   int k = 0, j;
   char ch;

   /*  while (ci sono bit nel messaggio)  */
   do
   {
      ch = fgetc (fp);

      for (j = 0; j < 8; j++)
      {
         /* scrivi il bit j di s[i] */
         int bit;

         bit = GETBIT(ch, j);
         SETBIT (img.pixel[k].blue, 0, bit);
         k++;
         if (k >= img.width * img.height)
         {
            printf ("spazio terminato\n");
            exit (EXIT_FAILURE);
         }
       }
   } while (ch != EOF);

   return img;
}
/*!
 **************************************************************************
 * \if Function name : ih264d_get_bit_h264 \endif
 *
 * \brief
 *    Read one bit from the bitstream.
 *
 *   This is a Bitstream processing function. It reads the
 *   bit currently pointed by the bit pointer in the
 *   buffer and advances the pointer by one. It returns
 *   the bit (0 or 1) in the form of an unsigned integer.
 *
 * \return
 *    Returns the next bit (0 or 1) in the bitstream.
 *
 **************************************************************************
 */
UWORD8 ih264d_get_bit_h264(dec_bit_stream_t *ps_stream)
{
    UWORD32 u4_code;

    GETBIT(u4_code, ps_stream->u4_ofst, ps_stream->pu4_buffer);
    return (u4_code);
}
예제 #29
0
static void
ttyinq_line_iterate(struct ttyinq *ti,
    ttyinq_line_iterator_t *iterator, void *data,
    unsigned int offset, struct ttyinq_block *tib)
{
	unsigned int boff;

	/* Use the proper block when we're at the queue head. */
	if (offset == 0)
		tib = ti->ti_firstblock;

	/* Iterate all characters and call the iterator function. */
	for (; offset < ti->ti_end; offset++) {
		boff = offset % TTYINQ_DATASIZE;
		MPASS(tib != NULL);

		/* Call back the iterator function. */
		iterator(data, tib->tib_data[boff], GETBIT(tib, boff));

		/* Last byte iterated - go to the next block. */
		if (boff == TTYINQ_DATASIZE - 1)
			tib = tib->tib_next;
		MPASS(tib != NULL);
	}
}
예제 #30
0
size_t
ttyinq_findchar(struct ttyinq *ti, const char *breakc, size_t maxlen,
    char *lastc)
{
	struct ttyinq_block *tib = ti->ti_firstblock;
	unsigned int boff = ti->ti_begin;
	unsigned int bend = MIN(MIN(TTYINQ_DATASIZE, ti->ti_linestart),
	    ti->ti_begin + maxlen);

	MPASS(maxlen > 0);

	if (tib == NULL)
		return (0);

	while (boff < bend) {
		if (strchr(breakc, tib->tib_data[boff]) && !GETBIT(tib, boff)) {
			*lastc = tib->tib_data[boff];
			return (boff - ti->ti_begin + 1);
		}
		boff++;
	}

	/* Not found - just process the entire block. */
	return (bend - ti->ti_begin);
}