📄 parse3.c
字号:
}/* void tcall(ce) adr(ce); push(ce); *//* void adr(ce) find address of a template * is.mode = search mode: 1 = forward, 2 = backward, 0 = outward * is.mode2 = preference: 1 = forward, 2 = backward, and return for * direction found: 1 = forward, 2 = backward, 3 = both, 0 = none * is.dval = starting address for forward search * is.dval2 = starting address for backward search * is.dreg = destination register where target address will be stored * is.dreg2 = destination register where template size will be stored * is.dreg3 = destination register where offset of target will be stored * is.sval = return address if template size = 0 * is.sval2 = template size, 0 = no template * is.sval3 = search limit, and return for distance actually searched * is.dmod = modulus value for is.dreg * is.dmod2 = modulus value for is.dreg2 * is.dmod3 = modulus value for is.dreg3 * is.dran = range to maintain for is.dreg * is.dran2 = range to maintain for is.dreg2 * is.dran3 = range to maintain for is.dreg3 *//* void push(ce) ce->c.sp = ++ce->c.sp % STACK_SIZE; * ce->c.st[ce->c.sp] = is.sval + flaw(ce); * is.sval = value to be pushed onto the stack */void ptcall(ce) /* push ip to stack, outward template jump */Pcells ce;{ I32s a, s = 0; is.iip = is.dib = 1; if (is.eins->exec) return ; a = ad(ce->c.ip + 1); /* a = address of start of template */ while(1) /* find size of template, s = size */ {#if PLOIDY == 1 if(soup[ad(a + s)].inst != Nop0 && soup[ad(a + s)].inst != Nop1)#else /* PLOIDY > 1 */ if(soup[ad(a + s)][ce->d.tr].inst != Nop0 && soup[ad(a + s)][ce->d.tr].inst != Nop1)#endif /* PLOIDY > 1 */ break; s++; } is.dreg = &(ce->c.ip); /* destination register for address */ is.dreg2 = &BitBucket; /* destination register for template size */ is.dreg3 = &BitBucket; /* destination register for offset */ is.sval = ad(ce->c.ip + s + 1); /* address to be pushed onto stack */ is.sval2 = s; /* size of template */ is.sval3 = Search_limit; is.dmod = SoupSize; is.dval = ad(a + s + 1); /* start address for forward search */ is.dval2 = ad(a - s - 1); /* start address for backward search */ is.mode = 0; /* outward jump */ is.mode2 = 1; is.dib = 1; is.iip = 0;}/* void adr(ce) find address of a template * is.mode = search mode: 1 = forward, 2 = backward, 0 = outward * is.mode2 = preference: 1 = forward, 2 = backward, and return for * direction found: 1 = forward, 2 = backward, 3 = both, 0 = none * is.dval = starting address for forward search * is.dval2 = starting address for backward search * is.dreg = destination register where target address will be stored * is.dreg2 = destination register where template size will be stored * is.dreg3 = destination register where offset of target will be stored * is.sval = return address if template size = 0 * is.sval2 = template size, 0 = no template * is.sval3 = search limit, and return for distance actually searched * is.dmod = modulus value for is.dreg * is.dmod2 = modulus value for is.dreg2 * is.dmod3 = modulus value for is.dreg3 * is.dran = range to maintain for is.dreg * is.dran2 = range to maintain for is.dreg2 * is.dran3 = range to maintain for is.dreg3 *//* search outward for template, put address in R0, template size in R1, and offset in R0, start search at offset +- R0*/void padr(ce)Pcells ce;{ I32s a, s = 0, tval; is.iip = is.dib = 1; if (is.eins->exec) return ; a = ad(ce->c.ip + 1); /* a = address of start of template */ while(1) /* find size of template, s = size */ {#if PLOIDY == 1 if(soup[ad(a + s)].inst != Nop0 && soup[ad(a + s)].inst != Nop1)#else /* PLOIDY > 1 */ if(soup[ad(a + s)][ce->d.tr].inst != Nop0 && soup[ad(a + s)][ce->d.tr].inst != Nop1)#endif /* PLOIDY > 1 */ break; s++; } if (s) { tval = flaw(ce); is.dreg = &(ce->c.re[mo(tval, NUMREG)]); /* dest reg for address */ tval = 1 + flaw(ce); is.dreg2 = &(ce->c.re[mo(tval, NUMREG)]); /* dest reg for templ size */ tval = 2 + flaw(ce); is.dreg3 = &(ce->c.re[mo(tval, NUMREG)]); /* dest reg for offset */ } else is.dreg = is.dreg2 = is.dreg3 = &BitBucket; is.sval2 = s; /* size of template */ is.dmod = SoupSize; is.dran2 = SoupSize; is.dmod3 = SoupSize; tval = 1 + flaw(ce); tval = ce->c.re[mo(tval, NUMREG)]; /* start at offset */ is.dval = ad(a + s + tval + 1); /* start address for forward search */ is.dval2 = ad(a - s - tval - 1); /* start address for backward search */ is.sval3 = Search_limit - tval; is.mode = 0; /* outward search */ is.mode2 = 1; is.iip = s + 1; is.dib = 1;}/* void adr(ce) find address of a template * is.mode = search mode: 1 = forward, 2 = backward, 0 = outward * is.mode2 = preference: 1 = forward, 2 = backward, and return for * direction found: 1 = forward, 2 = backward, 3 = both, 0 = none * is.dval = starting address for forward search * is.dval2 = starting address for backward search * is.dreg = destination register where target address will be stored * is.dreg2 = destination register where template size will be stored * is.dreg3 = destination register where offset of target will be stored * is.sval = return address if template size = 0 * is.sval2 = template size, 0 = no template * is.sval3 = search limit, and return for distance actually searched * is.dmod = modulus value for is.dreg * is.dmod2 = modulus value for is.dreg2 * is.dmod3 = modulus value for is.dreg3 * is.dran = range to maintain for is.dreg * is.dran2 = range to maintain for is.dreg2 * is.dran3 = range to maintain for is.dreg3 *//* search backward for template, put address in R0, template size in R1, and offset in R0, start search at offset - R0*/void padrb(ce)Pcells ce;{ I32s a, s = 0, tval; is.iip = is.dib = 1; if (is.eins->exec) return ; a = ad(ce->c.ip + 1); /* a = address of start of template */ while(1) /* find size of template, s = size */ {#if PLOIDY == 1 if(soup[ad(a + s)].inst != Nop0 && soup[ad(a + s)].inst != Nop1)#else /* PLOIDY > 1 */ if(soup[ad(a + s)][ce->d.tr].inst != Nop0 && soup[ad(a + s)][ce->d.tr].inst != Nop1)#endif /* PLOIDY > 1 */ break; s++; } if (s) { tval = flaw(ce); is.dreg = &(ce->c.re[mo(tval, NUMREG)]); /* dest reg for address */ tval = 1 + flaw(ce); is.dreg2 = &(ce->c.re[mo(tval, NUMREG)]); /* dest reg for templ size */ tval = 2 + flaw(ce); is.dreg3 = &(ce->c.re[mo(tval, NUMREG)]); /* dest reg for offset */ } else is.dreg = is.dreg2 = is.dreg3 = &BitBucket; is.sval2 = s; /* size of template */ is.dmod = SoupSize; is.dran2 = SoupSize; is.dmod3 = SoupSize; tval = 1 + flaw(ce); tval = ce->c.re[mo(tval, NUMREG)]; /* start at offset */ is.dval = ad(a + s + tval + 1); /* start address for forward search */ is.dval2 = ad(a - s - tval - 1); /* start address for backward search */ is.sval3 = Search_limit - tval; is.mode = 2; /* backward search */ is.mode2 = 2; is.iip = s + 1; is.dib = 1;}/* void adr(ce) find address of a template * is.mode = search mode: 1 = forward, 2 = backward, 0 = outward * is.mode2 = preference: 1 = forward, 2 = backward, and return for * direction found: 1 = forward, 2 = backward, 3 = both, 0 = none * is.dval = starting address for forward search * is.dval2 = starting address for backward search * is.dreg = destination register where target address will be stored * is.dreg2 = destination register where template size will be stored * is.dreg3 = destination register where offset of target will be stored * is.sval = return address if template size = 0 * is.sval2 = template size, 0 = no template * is.sval3 = search limit, and return for distance actually searched * is.dmod = modulus value for is.dreg * is.dmod2 = modulus value for is.dreg2 * is.dmod3 = modulus value for is.dreg3 * is.dran = range to maintain for is.dreg * is.dran2 = range to maintain for is.dreg2 * is.dran3 = range to maintain for is.dreg3 *//* search forward for template, put address in R0, template size in R1, and offset in R0, start search at offset + R0 */void padrf(ce)Pcells ce;{ I32s a, s = 0, tval; is.iip = is.dib = 1; if (is.eins->exec) return ; a = ad(ce->c.ip + 1); /* a = address of start of template */ while(1) /* find size of template, s = size */ {#if PLOIDY == 1 if(soup[ad(a + s)].inst != Nop0 && soup[ad(a + s)].inst != Nop1)#else /* PLOIDY > 1 */ if(soup[ad(a + s)][ce->d.tr].inst != Nop0 && soup[ad(a + s)][ce->d.tr].inst != Nop1)#endif /* PLOIDY > 1 */ break; s++; } if (s) { tval = flaw(ce); is.dreg = &(ce->c.re[mo(tval, NUMREG)]); /* dest reg for address */ tval = 1 + flaw(ce); is.dreg2 = &(ce->c.re[mo(tval, NUMREG)]); /* dest reg for templ size */ tval = 2 + flaw(ce); is.dreg3 = &(ce->c.re[mo(tval, NUMREG)]); /* dest reg for offset */ } else is.dreg = is.dreg2 = is.dreg3 = &BitBucket; is.sval2 = s; /* size of template */ is.dmod = SoupSize; is.dran2 = SoupSize; is.dmod3 = SoupSize; tval = 1 + flaw(ce); tval = ce->c.re[mo(tval, NUMREG)]; /* start at offset */ is.dval = ad(a + s + tval + 1); /* start address for forward search */ is.dval2 = ad(a - s - tval - 1); /* start address for backward search */ is.sval3 = Search_limit - tval; is.mode = 1; /* forward search */ is.mode2 = 1; is.iip = s + 1; is.dib = 1;}/* void malchm(ce) is.sval2 = mal(ce,&is.sval3,is.sval,is.mode2); * *(is.dreg) = is.sval3; * chmode(ce,is.sval3,is.sval2,is.mode); * is.dreg = destination register where allocated address is stored * is.sval = requested size of block for mal() * is.sval2 = flawed size of block (assigned in instruct.c) * is.sval3 = suggested address, and allocated address * is.mode = memory protection mode (rwx), probably MemModeProt * is.mode2 = memory allocation mode for mal() */void pmal(ce) /* allocate space for a new cell */Pcells ce;{ I32s tval; is.iip = is.dib = 1; if (is.eins->exec) return ; tval = flaw(ce); is.dreg = &(ce->c.re[mo(tval, NUMREG)]); tval = 1 + flaw(ce); is.sval = ce->c.re[mo(tval, NUMREG)] + flaw(ce); tval = flaw(ce); is.sval3 = ce->c.re[mo(tval, NUMREG)] + flaw(ce); if (is.sval3 < 0) is.mode2 = 1; /* better fit */ else is.mode2 = 6; /* suggester address (is.sval3) */ is.mode = MemModeProt; /* only write privelage works at the moment */}/* void divide(ce) cell division * is.mode = divide mode (3 steps) * is.sval = offset of IP into daughter's genome * is.sval2 = eject genome from soup = 0, !0 = leave in soup */void pdivide(ce) /* give life to new cell by puting in queue */Pcells ce;{ I32s tval; is.iip = is.dib = 1; if (is.eins->exec) return ; is.mode = 2; /* full division */ tval = flaw(ce); is.sval = ce->c.re[mo(tval, NUMREG)] + flaw(ce); tval = 1 + flaw(ce); is.sval2 = ce->c.re[mo(tval, NUMREG)] + flaw(ce);}#endif /* INST == 3 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -