Lines Matching refs:posi
96 lua_Integer posi = u_posrelat(luaL_optinteger(L, 2, 1), len); in utflen() local
99 luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 2, in utflen()
103 while (posi <= posj) { in utflen()
104 const char *s1 = utf8_decode(s + posi, NULL, !lax); in utflen()
107 lua_pushinteger(L, posi + 1); /* ... and current position */ in utflen()
110 posi = s1 - s; in utflen()
125 lua_Integer posi = u_posrelat(luaL_optinteger(L, 2, 1), len); in codepoint() local
126 lua_Integer pose = u_posrelat(luaL_optinteger(L, 3, posi), len); in codepoint()
130 luaL_argcheck(L, posi >= 1, 2, "out of bounds"); in codepoint()
132 if (posi > pose) return 0; /* empty interval; return no values */ in codepoint()
133 if (pose - posi >= INT_MAX) /* (lua_Integer -> int) overflow? */ in codepoint()
135 n = (int)(pose - posi) + 1; /* upper bound for number of returns */ in codepoint()
139 for (s += posi - 1; s < se;) { in codepoint()
187 lua_Integer posi = (n >= 0) ? 1 : len + 1; in byteoffset() local
188 posi = u_posrelat(luaL_optinteger(L, 3, posi), len); in byteoffset()
189 luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 3, in byteoffset()
193 while (posi > 0 && iscont(s + posi)) posi--; in byteoffset()
196 if (iscont(s + posi)) in byteoffset()
199 while (n < 0 && posi > 0) { /* move back */ in byteoffset()
201 posi--; in byteoffset()
202 } while (posi > 0 && iscont(s + posi)); in byteoffset()
208 while (n > 0 && posi < (lua_Integer)len) { in byteoffset()
210 posi++; in byteoffset()
211 } while (iscont(s + posi)); /* (cannot pass final '\0') */ in byteoffset()
217 lua_pushinteger(L, posi + 1); in byteoffset()