#include <stdlib.h>
#include <string.h>
+#include <strings.h>
#include <math.h>
#include "gwion_util.h"
#include "gwion_ast.h"
static MFUN(string_findStart) {
const m_str base = STRING(o);
const size_t sz = strlen(base);
- const char pos = *(m_int*)MEM(SZ_INT);
+ const char pos = *(m_int*)MEM(SZ_INT *2);
if(pos >= 0 && (size_t)pos < sz) {
- const char arg = *(m_int*)MEM(SZ_INT * 2);
+ const char arg = *(m_int*)MEM(SZ_INT);
char *str = index(base + pos, arg);
*(m_uint*)RETURN = str ? str - pos - base : -1;
} else
static MFUN(string_findStrStart) {
const m_str base = STRING(o);
const size_t sz = strlen(base);
- const char pos = *(m_int*)MEM(SZ_INT);
- const M_Object obj = *(M_Object*)MEM(SZ_INT * 2);
+ const char pos = *(m_int*)MEM(SZ_INT*2);
+ const M_Object obj = *(M_Object*)MEM(SZ_INT);
if(pos >= 0 && (size_t)pos < sz) {
const m_str arg = STRING(obj);
const m_str str = strstr(base + pos, arg);
static MFUN(string_rfindStrStart) {
const m_str base = STRING(o);
const size_t sz = strlen(base);
- const char pos = *(m_int*)MEM(SZ_INT);
+ const char pos = *(m_int*)MEM(SZ_INT *2);
const M_Object obj = *(M_Object*)MEM(SZ_INT * 2);
if(sz) {
const m_str arg = STRING(obj);
GWI_BB(gwi_func_end(gwi, string_find, ae_flag_none))
gwi_func_ini(gwi, "int", "find");
- gwi_func_arg(gwi, "int", "pos");
gwi_func_arg(gwi, "char", "c");
+ gwi_func_arg(gwi, "int", "pos");
GWI_BB(gwi_func_end(gwi, string_findStart, ae_flag_none))
gwi_func_ini(gwi, "int", "find");
GWI_BB(gwi_func_end(gwi, string_findStr, ae_flag_none))
gwi_func_ini(gwi, "int", "find");
- gwi_func_arg(gwi, "int", "pos");
gwi_func_arg(gwi, "nonnull string", "str");
+ gwi_func_arg(gwi, "int", "pos");
GWI_BB(gwi_func_end(gwi, string_findStrStart, ae_flag_none))
gwi_func_ini(gwi, "int", "rfind");
GWI_BB(gwi_func_end(gwi, string_rfind, ae_flag_none))
gwi_func_ini(gwi, "int", "rfind");
- gwi_func_arg(gwi, "int", "pos");
gwi_func_arg(gwi, "char", "c");
+ gwi_func_arg(gwi, "int", "pos");
GWI_BB(gwi_func_end(gwi, string_rfindStart, ae_flag_none))
gwi_func_ini(gwi, "int", "rfind");
GWI_BB(gwi_func_end(gwi, string_rfindStr, ae_flag_none))
gwi_func_ini(gwi, "int", "rfind");
- gwi_func_arg(gwi, "int", "pos");
gwi_func_arg(gwi, "nonnull string", "str");
+ gwi_func_arg(gwi, "int", "pos");
GWI_BB(gwi_func_end(gwi, string_rfindStrStart, ae_flag_none))
gwi_func_ini(gwi, "void", "erase");