示例#1
0
N_NIMCALL(void, openbaselexer_178035)(Tbaselexer178024* L, Tllstream177204* inputstream, NI buflen) {
	NI TMP2153;
	void* LOC5;
	NI TMP2154;
	nimfr("openBaseLexer", "nimlexbase.nim")
	nimln(147, "nimlexbase.nim");
	{
		if (!!((((NI) 0) < buflen))) goto LA3;
		failedassertimpl_87017(((NimStringDesc*) &TMP2152));
	}
	LA3: ;
	nimln(148, "nimlexbase.nim");
	(*L).bufpos = ((NI) 0);
	nimln(149, "nimlexbase.nim");
	(*L).buflen = buflen;
	nimln(150, "nimlexbase.nim");
	TMP2153 = mulInt(buflen, ((NI) 1));
	LOC5 = 0;
	LOC5 = alloc_6001(((NI)chckRange((NI)(TMP2153), ((NI) 0), ((NI) IL64(9223372036854775807)))));
	(*L).buf = ((NCSTRING) (LOC5));
	nimln(151, "nimlexbase.nim");
	TMP2154 = subInt(buflen, ((NI) 1));
	(*L).sentinel = (NI)(TMP2154);
	nimln(152, "nimlexbase.nim");
	(*L).linestart = ((NI) 0);
	nimln(153, "nimlexbase.nim");
	(*L).linenumber = ((NI) 1);
	nimln(154, "nimlexbase.nim");
	unsureAsgnRef((void**) (&(*L).stream), inputstream);
	nimln(155, "nimlexbase.nim");
	fillbuffer_178097(L);
	nimln(156, "nimlexbase.nim");
	skiputf8bom_179416(L);
	popFrame();
}
示例#2
0
N_NIMCALL(NCSTRING*, envtocstringarray_144806)(Stringtableobj134012* t) {
	NCSTRING* result;
	NI LOC1;
	void* LOC2;
	NI i;
	result = 0;
	LOC1 = 0;
	LOC1 = nstlen(t);
	LOC2 = 0;
	LOC2 = alloc0_6017(((NI) ((NI)((NI)(LOC1 + ((NI) 1)) * ((NI) 4)))));
	result = ((NCSTRING*) (LOC2));
	i = ((NI) 0);
	{
		NimStringDesc* key_144812;
		NimStringDesc* val_144813;
		key_144812 = 0;
		val_144813 = 0;
		{
			NI h_144832;
			NI HEX3Atmp_144834;
			NI res_144836;
			h_144832 = 0;
			HEX3Atmp_144834 = 0;
			HEX3Atmp_144834 = ((*t).data ? ((*t).data->Sup.len-1) : -1);
			res_144836 = ((NI) 0);
			{
				while (1) {
					if (!(res_144836 <= HEX3Atmp_144834)) goto LA6;
					h_144832 = res_144836;
					{
						NimStringDesc* x;
						NimStringDesc* LOC11;
						void* LOC12;
						if (!!((*t).data->data[h_144832].Field0 == 0)) goto LA9;
						key_144812 = (*t).data->data[h_144832].Field0;
						val_144813 = (*t).data->data[h_144832].Field1;
						LOC11 = 0;
						LOC11 = rawNewString(key_144812->Sup.len + val_144813->Sup.len + 1);
appendString(LOC11, key_144812);
appendString(LOC11, ((NimStringDesc*) &TMP2890));
appendString(LOC11, val_144813);
						x = LOC11;
						LOC12 = 0;
						LOC12 = alloc_6001(((NI) ((NI)((x ? x->Sup.len : 0) + ((NI) 1)))));
						result[(i)- 0] = ((NCSTRING) (LOC12));
						memcpy(((void*) (result[(i)- 0])), ((void*) ((&x->data[((NI) 0)]))), ((NI) ((NI)((x ? x->Sup.len : 0) + ((NI) 1)))));
						i += ((NI) 1);
					}
					LA9: ;
					res_144836 += ((NI) 1);
				} LA6: ;
			}
		}
	}
	return result;
}
示例#3
0
N_NIMCALL(void, openbaselexer_179035)(Tbaselexer179024* L, Tllstream178204* inputstream, NI buflen) {
	void* LOC1;
	(*L).bufpos = ((NI) 0);
	(*L).buflen = buflen;
	LOC1 = 0;
	LOC1 = alloc_6001(((NI) ((NI)(buflen * ((NI) 1)))));
	(*L).buf = ((NCSTRING) (LOC1));
	(*L).sentinel = (NI)(buflen - ((NI) 1));
	(*L).linestart = ((NI) 0);
	(*L).linenumber = ((NI) 1);
	unsureAsgnRef((void**) (&(*L).stream), inputstream);
	fillbuffer_179097(L);
	skiputf8bom_180416(L);
}
示例#4
0
N_NIMCALL(void, open_245040)(Baselexer245024* L, Streamobj137027* input, NI buflen) {
	void* LOC1;
	unsureAsgnRef((void**) (&(*L).input), input);
	(*L).bufpos = ((NI) 0);
	(*L).buflen = buflen;
	LOC1 = 0;
	LOC1 = alloc_6001(((NI) ((NI)(buflen * ((NI) 1)))));
	(*L).buf = ((NCSTRING) (LOC1));
	(*L).sentinel = (NI)(buflen - ((NI) 1));
	(*L).linestart = ((NI) 0);
	(*L).linenumber = ((NI) 1);
	fillbuffer_245102(L);
	skiputf8bom_246416(L);
}
示例#5
0
N_NIMCALL(void, open_246040)(Baselexer246024* L, Streamobj138027* input, NI buflen) {
	NI TMP4261;
	void* LOC9;
	NI TMP4262;
	nimfr("open", "lexbase.nim")
	nimln(144, "lexbase.nim");
	{
		if (!!((((NI) 0) < buflen))) goto LA3;
		failedassertimpl_87017(((NimStringDesc*) &TMP4259));
	}
	LA3: ;
	nimln(145, "lexbase.nim");
	{
		if (!!(!((input == NIM_NIL)))) goto LA7;
		failedassertimpl_87017(((NimStringDesc*) &TMP4260));
	}
	LA7: ;
	nimln(146, "lexbase.nim");
	unsureAsgnRef((void**) (&(*L).input), input);
	nimln(147, "lexbase.nim");
	(*L).bufpos = ((NI) 0);
	nimln(148, "lexbase.nim");
	(*L).buflen = buflen;
	nimln(149, "lexbase.nim");
	TMP4261 = mulInt(buflen, ((NI) 1));
	LOC9 = 0;
	LOC9 = alloc_6001(((NI)chckRange((NI)(TMP4261), ((NI) 0), ((NI) 2147483647))));
	(*L).buf = ((NCSTRING) (LOC9));
	nimln(150, "lexbase.nim");
	TMP4262 = subInt(buflen, ((NI) 1));
	(*L).sentinel = (NI)(TMP4262);
	nimln(151, "lexbase.nim");
	(*L).linestart = ((NI) 0);
	nimln(152, "lexbase.nim");
	(*L).linenumber = ((NI) 1);
	nimln(153, "lexbase.nim");
	fillbuffer_246102(L);
	nimln(154, "lexbase.nim");
	skiputf8bom_247416(L);
	popFrame();
}
示例#6
0
N_NIMCALL(NCSTRING*, envtocstringarray_144854)(void) {
	NCSTRING* result;
	NI counter;
	void* LOC5;
	NI i;
	result = 0;
	counter = ((NI) 0);
	{
		NimStringDesc* key_144858;
		NimStringDesc* val_144859;
		key_144858 = 0;
		val_144859 = 0;
		getenvvarsc_122404();
		{
			NI i_144888;
			NI HEX3Atmp_144890;
			NI res_144892;
			i_144888 = 0;
			HEX3Atmp_144890 = 0;
			HEX3Atmp_144890 = (environment_122209 ? (environment_122209->Sup.len-1) : -1);
			res_144892 = ((NI) 0);
			{
				while (1) {
					NI p_144896;
					if (!(res_144892 <= HEX3Atmp_144890)) goto LA4;
					i_144888 = res_144892;
					p_144896 = nsuFindChar(environment_122209->data[i_144888], 61, ((NI) 0));
					key_144858 = copyStrLast(environment_122209->data[i_144888], ((NI) 0), (NI)(p_144896 - ((NI) 1)));
					val_144859 = copyStr(environment_122209->data[i_144888], (NI)(p_144896 + ((NI) 1)));
					counter += ((NI) 1);
					res_144892 += ((NI) 1);
				} LA4: ;
			}
		}
	}
	LOC5 = 0;
	LOC5 = alloc0_6017(((NI) ((NI)((NI)(counter + ((NI) 1)) * ((NI) 4)))));
	result = ((NCSTRING*) (LOC5));
	i = ((NI) 0);
	{
		NimStringDesc* key_144871;
		NimStringDesc* val_144872;
		key_144871 = 0;
		val_144872 = 0;
		getenvvarsc_122404();
		{
			NI i_144909;
			NI HEX3Atmp_144911;
			NI res_144913;
			i_144909 = 0;
			HEX3Atmp_144911 = 0;
			HEX3Atmp_144911 = (environment_122209 ? (environment_122209->Sup.len-1) : -1);
			res_144913 = ((NI) 0);
			{
				while (1) {
					NI p_144917;
					NimStringDesc* x;
					NimStringDesc* LOC10;
					void* LOC11;
					if (!(res_144913 <= HEX3Atmp_144911)) goto LA9;
					i_144909 = res_144913;
					p_144917 = nsuFindChar(environment_122209->data[i_144909], 61, ((NI) 0));
					key_144871 = copyStrLast(environment_122209->data[i_144909], ((NI) 0), (NI)(p_144917 - ((NI) 1)));
					val_144872 = copyStr(environment_122209->data[i_144909], (NI)(p_144917 + ((NI) 1)));
					LOC10 = 0;
					LOC10 = rawNewString(key_144871->Sup.len + val_144872->Sup.len + 1);
appendString(LOC10, key_144871);
appendString(LOC10, ((NimStringDesc*) &TMP2890));
appendString(LOC10, val_144872);
					x = LOC10;
					LOC11 = 0;
					LOC11 = alloc_6001(((NI) ((NI)((x ? x->Sup.len : 0) + ((NI) 1)))));
					result[(i)- 0] = ((NCSTRING) (LOC11));
					memcpy(((void*) (result[(i)- 0])), ((void*) ((&x->data[((NI) 0)]))), ((NI) ((NI)((x ? x->Sup.len : 0) + ((NI) 1)))));
					i += ((NI) 1);
					res_144913 += ((NI) 1);
				} LA9: ;
			}
		}
	}
	return result;
}