Example #1
0
N_NIMCALL(NimStringDesc*, readoutput_379009)(Processobj142402* p) {
	NimStringDesc* result;
	Streamobj137027* output;
	NI LOC5;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2885));
	output = nospoutputStream(p);
	{
		while (1) {
			NIM_BOOL LOC3;
			NimStringDesc* LOC4;
			LOC3 = 0;
			LOC3 = atend_137111(output);
			if (!!(LOC3)) goto LA2;
			LOC4 = 0;
			LOC4 = readline_137531(output);
			result = resizeString(result, LOC4->Sup.len + 0);
appendString(result, LOC4);
			result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TMP2897));
		} LA2: ;
	}
	result = setLengthStr(result, ((NI) ((NI)((result ? result->Sup.len : 0) - ((NI) 1)))));
	LOC5 = 0;
	LOC5 = nospwaitForExit(p, ((NI) -1));
	return result;
}
Example #2
0
N_NIMCALL(NI, nospexecProcesses)(NimStringDesc** Cmds_68686, NI Cmds_68686Len0, NU8 Options_68688, NI N_68689) {
NI Result_68690;
TY68699* Q_68700;
NI M_68725;
NI I_68734;
NI HEX3Atmp_68824;
NI Res_68826;
NI I_68735;
NI R_68746;
NI HEX3Atmp_68827;
NI Res_68829;
NIM_BOOL LOC8;
NI LOC11;
NI I_68809;
NI HEX3Atmp_68830;
NI Res_68832;
NI LOC16;
NI I_68820;
NI HEX3Atmp_68833;
NI Res_68835;
TY68202* P_68821;
NI LOC18;
Result_68690 = 0;
if (!(1 < N_68689)) goto LA2;
Q_68700 = 0;
Q_68700 = (TY68699*) newSeq(NTI68699, N_68689);
M_68725 = 0;
M_68725 = ((N_68689 <= Cmds_68686Len0) ? N_68689 : Cmds_68686Len0);
I_68734 = 0;
HEX3Atmp_68824 = 0;
HEX3Atmp_68824 = (NI32)(M_68725 - 1);
Res_68826 = 0;
Res_68826 = 0;
while (1) {
if (!(Res_68826 <= HEX3Atmp_68824)) goto LA4;
I_68734 = Res_68826;
asgnRefNoCycle((void**) &Q_68700->data[I_68734], Startprocessaux_68603(Cmds_68686[I_68734], Options_68688));
Res_68826 += 1;
} LA4: ;
I_68735 = 0;
I_68735 = M_68725;
while (1) {
if (!(I_68735 <= (Cmds_68686Len0-1))) goto LA5;
nossleep(50);
R_68746 = 0;
HEX3Atmp_68827 = 0;
HEX3Atmp_68827 = (NI32)(N_68689 - 1);
Res_68829 = 0;
Res_68829 = 0;
while (1) {
if (!(Res_68829 <= HEX3Atmp_68827)) goto LA6;
R_68746 = Res_68829;
LOC8 = nosprunning(Q_68700->data[R_68746]);
if (!!(LOC8)) goto LA9;
LOC11 = nospwaitForExit(Q_68700->data[R_68746]);
Result_68690 = ((LOC11 >= Result_68690) ? LOC11 : Result_68690);
asgnRefNoCycle((void**) &Q_68700->data[R_68746], Startprocessaux_68603(Cmds_68686[I_68735], Options_68688));
I_68735 += 1;
if (!((Cmds_68686Len0-1) < I_68735)) goto LA13;
goto LA6;
LA13: ;
LA9: ;
Res_68829 += 1;
} LA6: ;
} LA5: ;
I_68809 = 0;
HEX3Atmp_68830 = 0;
HEX3Atmp_68830 = (NI32)(M_68725 - 1);
Res_68832 = 0;
Res_68832 = 0;
while (1) {
if (!(Res_68832 <= HEX3Atmp_68830)) goto LA15;
I_68809 = Res_68832;
LOC16 = nospwaitForExit(Q_68700->data[I_68809]);
Result_68690 = ((LOC16 >= Result_68690) ? LOC16 : Result_68690);
Res_68832 += 1;
} LA15: ;
goto LA1;
LA2: ;
I_68820 = 0;
HEX3Atmp_68833 = 0;
HEX3Atmp_68833 = (Cmds_68686Len0-1);
Res_68835 = 0;
Res_68835 = 0;
while (1) {
if (!(Res_68835 <= HEX3Atmp_68833)) goto LA17;
I_68820 = Res_68835;
P_68821 = 0;
P_68821 = Startprocessaux_68603(Cmds_68686[I_68820], Options_68688);
LOC18 = nospwaitForExit(P_68821);
Result_68690 = ((LOC18 >= Result_68690) ? LOC18 : Result_68690);
Res_68835 += 1;
} LA17: ;
LA1: ;
return Result_68690;
}
Example #3
0
N_NIMCALL(NI, nospexecProcesses)(NimStringDesc** cmds, NI cmdsLen0, NU8 options_143795, NI n, TY171656 beforerunevent) {
	NI result;
	NU8 options;
	result = 0;
	options = (options_143795 & ~ 16);
	{
		TY144201* q;
		NI m;
		NI i;
		if (!(((NI) 1) < n)) goto LA3;
		q = 0;
		q = (TY144201*) newSeq((&NTI144201), ((NI) (n)));
		m = ((n <= cmdsLen0) ? n : cmdsLen0);
		{
			NI i_144235;
			NI HEX3Atmp_144536;
			NI res_144539;
			i_144235 = 0;
			HEX3Atmp_144536 = 0;
			HEX3Atmp_144536 = (NI)(m - ((NI) 1));
			res_144539 = ((NI) 0);
			{
				while (1) {
					TY219714 LOC12;
					if (!(res_144539 <= HEX3Atmp_144536)) goto LA7;
					i_144235 = res_144539;
					{
						if (!!((beforerunevent.ClPrc == TMP4336.ClPrc && beforerunevent.ClEnv == TMP4336.ClEnv))) goto LA10;
						beforerunevent.ClEnv? beforerunevent.ClPrc(i_144235, beforerunevent.ClEnv):((TMP4337)(beforerunevent.ClPrc))(i_144235);
					}
					LA10: ;
					memset((void*)LOC12, 0, sizeof(LOC12));
					asgnRef((void**) (&q->data[i_144235]), nospstartProcess(cmds[i_144235], ((NimStringDesc*) &TMP4338), LOC12, 0, NIM_NIL, (options | 4)));
					res_144539 += ((NI) 1);
				} LA7: ;
			}
		}
		i = m;
		{
			while (1) {
				if (!(i <= (cmdsLen0-1))) goto LA14;
				nossleep(((NI) 50));
				{
					NI r_144413;
					NI HEX3Atmp_144545;
					NI res_144548;
					r_144413 = 0;
					HEX3Atmp_144545 = 0;
					HEX3Atmp_144545 = (NI)(n - ((NI) 1));
					res_144548 = ((NI) 0);
					{
						while (1) {
							if (!(res_144548 <= HEX3Atmp_144545)) goto LA17;
							r_144413 = res_144548;
							{
								NIM_BOOL LOC20;
								NI LOC23;
								TY219714 LOC32;
								LOC20 = 0;
								LOC20 = nosprunning(q->data[r_144413]);
								if (!!(LOC20)) goto LA21;
								LOC23 = 0;
								LOC23 = nospwaitForExit(q->data[r_144413], ((NI) -1));
								result = ((LOC23 >= result) ? LOC23 : result);
								{
									if (!!((q->data[r_144413] == NIM_NIL))) goto LA26;
									nospclose(q->data[r_144413]);
								}
								LA26: ;
								{
									if (!!((beforerunevent.ClPrc == TMP4336.ClPrc && beforerunevent.ClEnv == TMP4336.ClEnv))) goto LA30;
									beforerunevent.ClEnv? beforerunevent.ClPrc(i, beforerunevent.ClEnv):((TMP4339)(beforerunevent.ClPrc))(i);
								}
								LA30: ;
								memset((void*)LOC32, 0, sizeof(LOC32));
								asgnRef((void**) (&q->data[r_144413]), nospstartProcess(cmds[i], ((NimStringDesc*) &TMP4338), LOC32, 0, NIM_NIL, (options | 4)));
								i += ((NI) 1);
								{
									if (!((cmdsLen0-1) < i)) goto LA35;
									goto LA15;
								}
								LA35: ;
							}
							LA21: ;
							res_144548 += ((NI) 1);
						} LA17: ;
					}
				} LA15: ;
			} LA14: ;
		}
		{
			NI j_144475;
			NI HEX3Atmp_144553;
			NI res_144556;
			j_144475 = 0;
			HEX3Atmp_144553 = 0;
			HEX3Atmp_144553 = (NI)(m - ((NI) 1));
			res_144556 = ((NI) 0);
			{
				while (1) {
					NI LOC40;
					if (!(res_144556 <= HEX3Atmp_144553)) goto LA39;
					j_144475 = res_144556;
					LOC40 = 0;
					LOC40 = nospwaitForExit(q->data[j_144475], ((NI) -1));
					result = ((LOC40 >= result) ? LOC40 : result);
					{
						if (!!((q->data[j_144475] == NIM_NIL))) goto LA43;
						nospclose(q->data[j_144475]);
					}
					LA43: ;
					res_144556 += ((NI) 1);
				} LA39: ;
			}
		}
	}
	goto LA1;
	LA3: ;
	{
		{
			NI i_144502;
			NI HEX3Atmp_144561;
			NI res_144564;
			i_144502 = 0;
			HEX3Atmp_144561 = 0;
			HEX3Atmp_144561 = (cmdsLen0-1);
			res_144564 = ((NI) 0);
			{
				while (1) {
					Processobj143402* p;
					TY219714 LOC53;
					NI LOC54;
					if (!(res_144564 <= HEX3Atmp_144561)) goto LA48;
					i_144502 = res_144564;
					{
						if (!!((beforerunevent.ClPrc == TMP4336.ClPrc && beforerunevent.ClEnv == TMP4336.ClEnv))) goto LA51;
						beforerunevent.ClEnv? beforerunevent.ClPrc(i_144502, beforerunevent.ClEnv):((TMP4340)(beforerunevent.ClPrc))(i_144502);
					}
					LA51: ;
					memset((void*)LOC53, 0, sizeof(LOC53));
					p = nospstartProcess(cmds[i_144502], ((NimStringDesc*) &TMP4338), LOC53, 0, NIM_NIL, (options | 4));
					LOC54 = 0;
					LOC54 = nospwaitForExit(p, ((NI) -1));
					result = ((LOC54 >= result) ? LOC54 : result);
					nospclose(p);
					res_144564 += ((NI) 1);
				} LA48: ;
			}
		}
	}
	LA1: ;
	return result;
}