Beispiel #1
0
N_NIMCALL(NI, llstreamread_177584)(Tllstream177204* s, void* buf, NI buflen) {
	NI result;
	result = 0;
	switch ((*s).kind) {
	case ((NU8) 0):
	{
		result = ((NI) 0);
	}
	break;
	case ((NU8) 1):
	{
		result = ((buflen <= (NI)(((*s).s ? (*s).s->Sup.len : 0) - (*s).rd)) ? buflen : (NI)(((*s).s ? (*s).s->Sup.len : 0) - (*s).rd));
		{
			if (!(((NI) 0) < result)) goto LA5;
			memcpy(buf, ((void*) ((&(*s).s->data[(NI)(((NI) 0) + (*s).rd)]))), ((NI) (result)));
			(*s).rd += result;
		}
		LA5: ;
	}
	break;
	case ((NU8) 2):
	{
		result = readbuffer_13515((*s).f, buf, ((NI) (buflen)));
	}
	break;
	case ((NU8) 3):
	{
		result = llreadfromstdin_177528(s, buf, buflen);
	}
	break;
	}
	return result;
}
Beispiel #2
0
N_NIMCALL(NI, llstreamread_177584)(Tllstream177204* s, void* buf, NI buflen) {
	NI result;
	nimfr("llStreamRead", "llstream.nim")
	result = 0;
	nimln(119, "llstream.nim");
	switch ((*s).kind) {
	case ((NU8) 0):
	{
		nimln(121, "llstream.nim");
		result = ((NI) 0);
	}
	break;
	case ((NU8) 1):
	{
		NI TMP2104;
		nimln(123, "llstream.nim");
		TMP2104 = subInt(((*s).s ? (*s).s->Sup.len : 0), (*s).rd);
		result = ((buflen <= (NI)(TMP2104)) ? buflen : (NI)(TMP2104));
		nimln(124, "llstream.nim");
		{
			NI TMP2105;
			NI TMP2106;
			if (!(((NI) 0) < result)) goto LA5;
			nimln(125, "llstream.nim");
			TMP2105 = addInt(((NI) 0), (*s).rd);
			if ((NU)((NI)(TMP2105)) > (NU)((*s).s->Sup.len)) raiseIndexError();
			memcpy(buf, ((void*) ((&(*s).s->data[(NI)(TMP2105)]))), ((NI)chckRange(result, ((NI) 0), ((NI) 2147483647))));
			nimln(126, "llstream.nim");
			TMP2106 = addInt((*s).rd, result);
			(*s).rd = (NI)(TMP2106);
		}
		LA5: ;
	}
	break;
	case ((NU8) 2):
	{
		nimln(128, "llstream.nim");
		result = readbuffer_13515((*s).f, buf, ((NI)chckRange(buflen, ((NI) 0), ((NI) 2147483647))));
	}
	break;
	case ((NU8) 3):
	{
		nimln(130, "llstream.nim");
		result = llreadfromstdin_177528(s, buf, buflen);
	}
	break;
	}
	popFrame();
	return result;
}