public static void LinyeePushInteger(LinyeeState L, ly_Integer n) { LinyeeLock(L); SetNValue(L.top, CastNum(n)); IncrementTop(L); LinyeeUnlock(L); }
private static int gmatch_aux(LinyeeState L) { MatchState ms = new MatchState(); uint ls; CharPtr s = LinyeeToLString(L, LinyeeUpValueIndex(1), out ls); CharPtr p = LinyeeToString(L, LinyeeUpValueIndex(2)); CharPtr src; ms.L = L; ms.matchdepth = MAXCCALLS; ms.src_init = s; ms.src_end = s + ls; for (src = s + (uint)LinyeeToInteger(L, LinyeeUpValueIndex(3)); src <= ms.src_end; src = src.next()) { CharPtr e; ms.level = 0; LinyeeAssert(ms.matchdepth == MAXCCALLS); if ((e = match(ms, src, p)) != null) { ly_Integer newstart = e - s; if (e == src) { newstart++; /* empty match? go at least one position */ } LinyeePushInteger(L, newstart); LinyeeReplace(L, LinyeeUpValueIndex(3)); return(push_captures(ms, src, e)); } } return(0); /* not found */ }