u3: refactors %leer jet
-/* j/5/lore.c
+/* j/5/leer.c
**
*/
#include "all.h"
static u3_atom
- _lore_cut(c3_w pos_w, c3_w len_w, u3_atom src)
+_leer_cut(c3_w pos_w, c3_w len_w, u3_atom src)
{
if ( 0 == len_w ) {
return 0;
return u3kb_flop(tez);
}
else {
- tez = u3nc(_lore_cut(pos_w, meg_w, lub), tez);
+ tez = u3nc(_leer_cut(pos_w, meg_w, lub), tez);
if ( _(end_y) ) {
return u3kb_flop(tez);
}
{
c3_w pos_w, i_w = 0, len_w = u3r_met(3, txt);
+ u3_noun* hed;
+ u3_noun* tel;
- while ( 1 ) {
+ while ( i_w < len_w ) {
// scan till end or newline
+ //
for ( pos_w = i_w; i_w < len_w; ++i_w ) {
if ( 10 == u3r_byte(i_w, txt) ) {
break;
}
// append to list
- {
- u3_noun* hed;
- u3_noun* tel;
-
+ //
*lit = u3i_defcons(&hed, &tel);
- *hed = _lore_cut(pos_w, i_w - pos_w, txt);
+ *hed = _leer_cut(pos_w, i_w - pos_w, txt);
lit = tel;
- }
- // finish or advance
- if ( i_w++ == len_w ) {
- break;
- }
+ i_w++;
}
}
u3_noun
u3we_leer(u3_noun cor)
{
- u3_noun txt;
+ u3_noun txt = u3x_at(u3x_sam, cor);
- if ( (u3_none == (txt = u3r_at(u3x_sam, cor))) ||
- (c3n == u3ud(txt)) )
- {
+ if ( c3n == u3ud(txt) ) {
return u3m_bail(c3__fail);
- } else {
- return u3qe_leer(txt);
}
+
+ return u3qe_leer(txt);
}
