Beispiel #1
0
N_NIMCALL(NIM_BOOL, auxropeequalsfile_146014)(trope144007* r, FILE** bin, void* buf) {
    NIM_BOOL result;
    nimfr("auxRopeEqualsFile", "ropes.nim")
    result = 0;
    nimln(303, "ropes.nim");
    {
        NI readbytes;
        NIM_BOOL LOC9;
        nimln(303, "ropes.nim");
        nimln(303, "ropes.nim");
        if (!!(((*r).Data == NIM_NIL))) goto LA3;
        nimln(304, "ropes.nim");
        {
            nimln(304, "ropes.nim");
            if (!(1024 < (*r).Length)) goto LA7;
            nimln(305, "ropes.nim");
            errorhandler_144108.ClEnv? errorhandler_144108.ClPrc(((NU8) 2), (*r).Data, NIM_FALSE, errorhandler_144108.ClEnv):((TMP567)(errorhandler_144108.ClPrc))(((NU8) 2), (*r).Data, NIM_FALSE);
            nimln(306, "ropes.nim");
            goto BeforeRet;
        }
LA7:
        ;
        nimln(307, "ropes.nim");
        readbytes = readbuffer_10627((*bin), buf, (*r).Length);
        nimln(308, "ropes.nim");
        nimln(308, "ropes.nim");
        LOC9 = 0;
        nimln(308, "ropes.nim");
        LOC9 = (readbytes == (*r).Length);
        if (!(LOC9)) goto LA10;
        nimln(309, "ropes.nim");
        if ((NU)(0) > (NU)((*r).Data->Sup.len)) raiseIndexError();
        LOC9 = equalMem(buf, ((void*) (&(*r).Data->data[0])), (*r).Length);
LA10:
        ;
        result = LOC9;
    }
    goto LA1;
LA3:
    ;
    {
        nimln(311, "ropes.nim");
        result = auxropeequalsfile_146014((*r).Left, bin, buf);
        nimln(312, "ropes.nim");
        {
            if (!result) goto LA14;
            nimln(312, "ropes.nim");
            result = auxropeequalsfile_146014((*r).Right, bin, buf);
        }
LA14:
        ;
    }
LA1:
    ;
BeforeRet:
    ;
    popFrame();
    return result;
}
Beispiel #2
0
N_NIMCALL(NIM_BOOL, equalsfile_173403)(Ropeobj172006* r, FILE* f) {
	NIM_BOOL result;
	TY173409 buf;
	NI bpos;
	NI blen;
	NI LOC26;
{	result = 0;
	memset((void*)buf, 0, sizeof(buf));
	bpos = ((NI) 1024);
	blen = ((NI) 1024);
	{
		NimStringDesc* s_173431;
		s_173431 = 0;
		{
			TY184350* stack_173480;
			TY172507 LOC6;
			if (!!((r == NIM_NIL))) goto LA4;
			stack_173480 = (TY184350*) newSeq((&NTI184350), 1);
			memset((void*)LOC6, 0, sizeof(LOC6));
			LOC6[0] = r;
			asgnRefNoCycle((void**) (&stack_173480->data[0]), LOC6[0]);
			{
				while (1) {
					Ropeobj172006* it_173482;
					NI spos;
					NI slen;
					if (!(((NI) 0) < (stack_173480 ? stack_173480->Sup.len : 0))) goto LA8;
					it_173482 = pop_172530((&stack_173480));
					{
						while (1) {
							if (!(*it_173482).data == 0) goto LA10;
							stack_173480 = (TY184350*) incrSeqV2(&(stack_173480)->Sup, sizeof(Ropeobj172006*));
							asgnRefNoCycle((void**) (&stack_173480->data[stack_173480->Sup.len]), (*it_173482).right);
							++stack_173480->Sup.len;
							it_173482 = (*it_173482).left;
						} LA10: ;
					}
					s_173431 = (*it_173482).data;
					spos = ((NI) 0);
					slen = (s_173431 ? s_173431->Sup.len : 0);
					{
						while (1) {
							NI n;
							if (!(spos < slen)) goto LA12;
							{
								if (!(bpos == blen)) goto LA15;
								bpos = ((NI) 0);
								blen = readbuffer_15554(f, ((void*) ((&buf[(((NI) 0))- 0]))), ((NI) 1024));
								{
									if (!(blen == ((NI) 0))) goto LA19;
									result = NIM_FALSE;
									goto BeforeRet;
								}
								LA19: ;
							}
							LA15: ;
							n = (((NI)(blen - bpos) <= (NI)(slen - spos)) ? (NI)(blen - bpos) : (NI)(slen - spos));
							{
								NIM_BOOL LOC23;
								LOC23 = 0;
								LOC23 = equalMem(((void*) ((&buf[(bpos)- 0]))), ((void*) ((NI)(((NI) (s_173431->data)) + spos))), ((NI) (n)));
								if (!!(LOC23)) goto LA24;
								result = NIM_FALSE;
								goto BeforeRet;
							}
							LA24: ;
							spos += n;
							bpos += n;
						} LA12: ;
					}
				} LA8: ;
			}
		}
		LA4: ;
	}
	LOC26 = 0;
	LOC26 = readbuffer_15554(f, ((void*) ((&buf[(((NI) 0))- 0]))), ((NI) 1));
	result = (LOC26 == ((NI) 0));
	}BeforeRet: ;
	return result;
}
Beispiel #3
0
N_NIMCALL(NIM_BOOL, equalsfile_162809)(Ropeobj161009* r, FILE* f) {
	NIM_BOOL result;
	TY162814 buf;
	NI bpos;
	NI blen;
	NI LOC26;
{	result = 0;
	memset((void*)buf, 0, sizeof(buf));
	bpos = ((NI) 1024);
	blen = ((NI) 1024);
	{
		NimStringDesc* s_162837;
		s_162837 = 0;
		{
			TY163351* stack_162886;
			TY161585 LOC6;
			if (!!((r == NIM_NIL))) goto LA4;
			stack_162886 = (TY163351*) newSeq((&NTI163351), 1);
			memset((void*)LOC6, 0, sizeof(LOC6));
			LOC6[0] = r;
			asgnRefNoCycle((void**) (&stack_162886->data[0]), LOC6[0]);
			{
				while (1) {
					Ropeobj161009* it_162888;
					NI spos;
					NI slen;
					if (!(((NI) 0) < (stack_162886 ? stack_162886->Sup.len : 0))) goto LA8;
					it_162888 = pop_161597((&stack_162886));
					{
						while (1) {
							if (!(*it_162888).data == 0) goto LA10;
							stack_162886 = (TY163351*) incrSeq(&(stack_162886)->Sup, sizeof(Ropeobj161009*));
							asgnRefNoCycle((void**) (&stack_162886->data[stack_162886->Sup.len-1]), (*it_162888).right);
							it_162888 = (*it_162888).left;
						} LA10: ;
					}
					s_162837 = (*it_162888).data;
					spos = ((NI) 0);
					slen = (s_162837 ? s_162837->Sup.len : 0);
					{
						while (1) {
							NI n;
							if (!(spos < slen)) goto LA12;
							{
								if (!(bpos == blen)) goto LA15;
								bpos = ((NI) 0);
								blen = readbuffer_13515(f, ((void*) ((&buf[(((NI) 0))- 0]))), ((NI) 1024));
								{
									if (!(blen == ((NI) 0))) goto LA19;
									result = NIM_FALSE;
									goto BeforeRet;
								}
								LA19: ;
							}
							LA15: ;
							n = (((NI)(blen - bpos) <= (NI)(slen - spos)) ? (NI)(blen - bpos) : (NI)(slen - spos));
							{
								NIM_BOOL LOC23;
								LOC23 = 0;
								LOC23 = equalMem(((void*) ((&buf[(bpos)- 0]))), ((void*) ((NI)(((NI) (s_162837->data)) + spos))), ((NI) (n)));
								if (!!(LOC23)) goto LA24;
								result = NIM_FALSE;
								goto BeforeRet;
							}
							LA24: ;
							spos += n;
							bpos += n;
						} LA12: ;
					}
				} LA8: ;
			}
		}
		LA4: ;
	}
	LOC26 = 0;
	LOC26 = readbuffer_13515(f, ((void*) ((&buf[(((NI) 0))- 0]))), ((NI) 1));
	result = (LOC26 == ((NI) 0));
	}BeforeRet: ;
	return result;
}