Beispiel #1
0
N_NIMCALL(void, fillbuffer_179097)(Tbaselexer179024* L) {
	NI charsread;
	NI tocopy;
	NI s;
	NI oldbuflen;
	NI LOC5;
	charsread = 0;
	tocopy = 0;
	s = 0;
	oldbuflen = 0;
	tocopy = (NI)((NI)((*L).buflen - (*L).sentinel) - ((NI) 1));
	{
		if (!(((NI) 0) < tocopy)) goto LA3;
		memmove(((void*) ((*L).buf)), ((void*) ((&(*L).buf[(NI)((*L).sentinel + ((NI) 1))]))), ((NI) ((NI)(tocopy * ((NI) 1)))));
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = llstreamread_178584((*L).stream, ((void*) ((&(*L).buf[tocopy]))), (NI)((NI)((*L).sentinel + ((NI) 1)) * ((NI) 1)));
	charsread = (NI)(LOC5 / ((NI) 1));
	s = (NI)(tocopy + charsread);
	{
		if (!(charsread < (NI)((*L).sentinel + ((NI) 1)))) goto LA8;
		(*L).buf[s] = 0;
		(*L).sentinel = s;
	}
	goto LA6;
	LA8: ;
	{
		s -= ((NI) 1);
		{
			while (1) {
				{
					while (1) {
						NIM_BOOL LOC15;
						LOC15 = 0;
						LOC15 = (((NI) 0) <= s);
						if (!(LOC15)) goto LA16;
						LOC15 = !((((NU8)((*L).buf[s])) == ((NU8)(13)) || ((NU8)((*L).buf[s])) == ((NU8)(10))));
						LA16: ;
						if (!LOC15) goto LA14;
						s -= ((NI) 1);
					} LA14: ;
				}
				{
					if (!(((NI) 0) <= s)) goto LA19;
					(*L).sentinel = s;
					goto LA11;
				}
				goto LA17;
				LA19: ;
				{
					void* LOC22;
					NI LOC23;
					oldbuflen = (*L).buflen;
					(*L).buflen = (NI)((*L).buflen * ((NI) 2));
					LOC22 = 0;
					LOC22 = realloc_6033(((void*) ((*L).buf)), ((NI) ((NI)((*L).buflen * ((NI) 1)))));
					(*L).buf = ((NCSTRING) (LOC22));
					LOC23 = 0;
					LOC23 = llstreamread_178584((*L).stream, ((void*) ((&(*L).buf[oldbuflen]))), (NI)(oldbuflen * ((NI) 1)));
					charsread = (NI)(LOC23 / ((NI) 1));
					{
						if (!(charsread < oldbuflen)) goto LA26;
						(*L).buf[(NI)(oldbuflen + charsread)] = 0;
						(*L).sentinel = (NI)(oldbuflen + charsread);
						goto LA11;
					}
					LA26: ;
					s = (NI)((*L).buflen - ((NI) 1));
				}
				LA17: ;
			}
		} LA11: ;
	}
	LA6: ;
}
N_NIMCALL(void, fillbuffer_179097)(Tbaselexer179024* L) {
	NI charsread;
	NI tocopy;
	NI s;
	NI oldbuflen;
	NI TMP2124;
	NI TMP2125;
	NI TMP2129;
	NI TMP2130;
	NI LOC13;
	NI TMP2131;
	NI TMP2132;
	nimfr("fillBuffer", "nimlexbase.nim")
	charsread = 0;
	tocopy = 0;
	s = 0;
	oldbuflen = 0;
	nimln(82, "nimlexbase.nim");
	{
		if (!!(((*L).sentinel < (*L).buflen))) goto LA3;
		failedassertimpl_87217(((NimStringDesc*) &TMP2123));
	}
	LA3: ;
	nimln(83, "nimlexbase.nim");
	TMP2124 = subInt((*L).buflen, (*L).sentinel);
	TMP2125 = subInt((NI)(TMP2124), ((NI) 1));
	tocopy = (NI)(TMP2125);
	nimln(84, "nimlexbase.nim");
	{
		if (!!((((NI) 0) <= tocopy))) goto LA7;
		failedassertimpl_87217(((NimStringDesc*) &TMP2126));
	}
	LA7: ;
	nimln(85, "nimlexbase.nim");
	{
		NI TMP2127;
		NI TMP2128;
		if (!(((NI) 0) < tocopy)) goto LA11;
		nimln(86, "nimlexbase.nim");
		TMP2127 = addInt((*L).sentinel, ((NI) 1));
		TMP2128 = mulInt(tocopy, ((NI) 1));
		memmove(((void*) ((*L).buf)), ((void*) ((&(*L).buf[(NI)(TMP2127)]))), ((NI)chckRange((NI)(TMP2128), ((NI) 0), ((NI) 2147483647))));
	}
	LA11: ;
	nimln(88, "nimlexbase.nim");
	nimln(89, "nimlexbase.nim");
	nimln(88, "nimlexbase.nim");
	nimln(89, "nimlexbase.nim");
	TMP2129 = addInt((*L).sentinel, ((NI) 1));
	TMP2130 = mulInt((NI)(TMP2129), ((NI) 1));
	LOC13 = 0;
	LOC13 = llstreamread_178584((*L).stream, ((void*) ((&(*L).buf[tocopy]))), (NI)(TMP2130));
	TMP2131 = divInt(LOC13, ((NI) 1));
	charsread = (NI)(TMP2131);
	nimln(90, "nimlexbase.nim");
	TMP2132 = addInt(tocopy, charsread);
	s = (NI)(TMP2132);
	nimln(91, "nimlexbase.nim");
	{
		NI TMP2133;
		TMP2133 = addInt((*L).sentinel, ((NI) 1));
		if (!(charsread < (NI)(TMP2133))) goto LA16;
		nimln(92, "nimlexbase.nim");
		(*L).buf[s] = 0;
		nimln(93, "nimlexbase.nim");
		(*L).sentinel = s;
	}
	goto LA14;
	LA16: ;
	{
		NI TMP2134;
		nimln(96, "nimlexbase.nim");
		TMP2134 = subInt(s, ((NI) 1));
		s = (NI)(TMP2134);
		{
			nimln(97, "nimlexbase.nim");
			while (1) {
				nimln(98, "nimlexbase.nim");
				{
					if (!!((s < (*L).buflen))) goto LA23;
					failedassertimpl_87217(((NimStringDesc*) &TMP2135));
				}
				LA23: ;
				{
					nimln(99, "nimlexbase.nim");
					while (1) {
						NIM_BOOL LOC27;
						NI TMP2136;
						LOC27 = 0;
						LOC27 = (((NI) 0) <= s);
						if (!(LOC27)) goto LA28;
						LOC27 = !((((NU8)((*L).buf[s])) == ((NU8)(13)) || ((NU8)((*L).buf[s])) == ((NU8)(10))));
						LA28: ;
						if (!LOC27) goto LA26;
						TMP2136 = subInt(s, ((NI) 1));
						s = (NI)(TMP2136);
					} LA26: ;
				}
				nimln(100, "nimlexbase.nim");
				{
					if (!(((NI) 0) <= s)) goto LA31;
					nimln(102, "nimlexbase.nim");
					(*L).sentinel = s;
					nimln(103, "nimlexbase.nim");
					goto LA19;
				}
				goto LA29;
				LA31: ;
				{
					NI TMP2137;
					NI TMP2138;
					void* LOC34;
					NI TMP2141;
					NI LOC39;
					NI TMP2142;
					NI TMP2145;
					nimln(107, "nimlexbase.nim");
					oldbuflen = (*L).buflen;
					nimln(108, "nimlexbase.nim");
					TMP2137 = mulInt((*L).buflen, ((NI) 2));
					(*L).buflen = (NI)(TMP2137);
					nimln(109, "nimlexbase.nim");
					TMP2138 = mulInt((*L).buflen, ((NI) 1));
					LOC34 = 0;
					LOC34 = realloc_6033(((void*) ((*L).buf)), ((NI)chckRange((NI)(TMP2138), ((NI) 0), ((NI) 2147483647))));
					(*L).buf = ((NCSTRING) (LOC34));
					nimln(110, "nimlexbase.nim");
					{
						NI TMP2139;
						TMP2139 = subInt((*L).buflen, oldbuflen);
						if (!!(((NI)(TMP2139) == oldbuflen))) goto LA37;
						failedassertimpl_87217(((NimStringDesc*) &TMP2140));
					}
					LA37: ;
					nimln(111, "nimlexbase.nim");
					nimln(112, "nimlexbase.nim");
					nimln(111, "nimlexbase.nim");
					nimln(112, "nimlexbase.nim");
					TMP2141 = mulInt(oldbuflen, ((NI) 1));
					LOC39 = 0;
					LOC39 = llstreamread_178584((*L).stream, ((void*) ((&(*L).buf[oldbuflen]))), (NI)(TMP2141));
					TMP2142 = divInt(LOC39, ((NI) 1));
					charsread = (NI)(TMP2142);
					nimln(113, "nimlexbase.nim");
					{
						NI TMP2143;
						NI TMP2144;
						if (!(charsread < oldbuflen)) goto LA42;
						nimln(114, "nimlexbase.nim");
						TMP2143 = addInt(oldbuflen, charsread);
						(*L).buf[(NI)(TMP2143)] = 0;
						nimln(115, "nimlexbase.nim");
						TMP2144 = addInt(oldbuflen, charsread);
						(*L).sentinel = (NI)(TMP2144);
						nimln(116, "nimlexbase.nim");
						goto LA19;
					}
					LA42: ;
					nimln(117, "nimlexbase.nim");
					TMP2145 = subInt((*L).buflen, ((NI) 1));
					s = (NI)(TMP2145);
				}
				LA29: ;
			}
		} LA19: ;
	}
	LA14: ;
	popFrame();
}