Example #1
0
static void readatomics(void)
	{
	int curpos,len;
	rrecs[currec].acnt=0;
	rrecs[currec].cura=0;
begin:
	flushbuff();
	if(rrecs[currec].eof==1 && rrecs[currec].comment==1)
		{
		longjmp(lex_jmp_buf,2);
		printf("\nEnd of file \"%s\" within comment /*...*/ \n",
		CurrentInputFile());
		exit(0);
		}
	
	if(rrecs[currec].eof==1) return;
	len=strlen(cbuf);
	curpos=0;
	if(rrecs[currec].comment==1)
		{
		curpos=end_of_comment(-2);
		if(cbuf[curpos]!=0)
			rrecs[currec].comment=0;
		else
			goto begin;
		}
	
	while((isspace(cbuf[curpos])||iscntrl(cbuf[curpos])) && curpos<len)
			curpos++;
	if(curpos==len) goto begin;
	if(cbuf[curpos]=='%') goto begin;
	
	while(curpos<len)
		{
		int alen;
		if(cbuf[curpos]=='%')
			{
			if(rrecs[currec].acnt==0) goto begin;
			else return;
			}	
		if(cbuf[curpos]=='/' && cbuf[curpos+1]=='*')
			{
			curpos=end_of_comment(curpos);
			if(cbuf[curpos]==0)
				rrecs[currec].comment=1;
			goto lll;
			}
			
		rrecs[currec].a[rrecs[currec].acnt]=read_a(cbuf+curpos,&alen);
		rrecs[currec].acnt++;
		curpos+=alen;
lll:		while((isspace(cbuf[curpos])||iscntrl(cbuf[curpos])) 
				&& curpos<len)
			curpos++;
		}
		
	if(rrecs[currec].acnt==0) goto begin;
	}
Example #2
0
/* Flushes the bit output buffer and the byte output buffer */
void bitoflush() {
	register unsigned int outbyte;
    
    while (bits < 32) {
		outbyte = reg >> 24;
        myputc(outbyte, out);
		if ( outbyte == 0xff ) {
			bits += 7;
			reg <<= 7;
			reg &= ~(1<<(8*sizeof(reg)-1)); /* stuff a 0 at MSB */
		} else {
		    bits += 8;
		    reg <<= 8;
		}
	}
	flushbuff(out);
	bitoinit();
}