renaming - adding fl_ prefix to some more functions
This commit is contained in:
parent
37a23afb3c
commit
be0d4d0d47
|
@ -127,7 +127,7 @@ static value_t fl_exit(value_t *args, u_int32_t nargs)
|
||||||
static value_t fl_symbol(value_t *args, u_int32_t nargs)
|
static value_t fl_symbol(value_t *args, u_int32_t nargs)
|
||||||
{
|
{
|
||||||
argcount("symbol", nargs, 1);
|
argcount("symbol", nargs, 1);
|
||||||
if (!isstring(args[0]))
|
if (!fl_isstring(args[0]))
|
||||||
type_error("symbol", "string", args[0]);
|
type_error("symbol", "string", args[0]);
|
||||||
return symbol(cvalue_data(args[0]));
|
return symbol(cvalue_data(args[0]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,7 +220,7 @@ value_t string_from_cstr(char *str)
|
||||||
return string_from_cstrn(str, strlen(str));
|
return string_from_cstrn(str, strlen(str));
|
||||||
}
|
}
|
||||||
|
|
||||||
int isstring(value_t v)
|
int fl_isstring(value_t v)
|
||||||
{
|
{
|
||||||
return (iscvalue(v) && cv_isstr((cvalue_t*)ptr(v)));
|
return (iscvalue(v) && cv_isstr((cvalue_t*)ptr(v)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,6 +214,7 @@ void bounds_error(char *fname, value_t arr, value_t ind)
|
||||||
|
|
||||||
// safe cast operators --------------------------------------------------------
|
// safe cast operators --------------------------------------------------------
|
||||||
|
|
||||||
|
#define isstring fl_isstring
|
||||||
#define SAFECAST_OP(type,ctype,cnvt) \
|
#define SAFECAST_OP(type,ctype,cnvt) \
|
||||||
ctype to##type(value_t v, char *fname) \
|
ctype to##type(value_t v, char *fname) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -226,6 +227,7 @@ SAFECAST_OP(symbol,symbol_t*,ptr)
|
||||||
SAFECAST_OP(fixnum,fixnum_t, numval)
|
SAFECAST_OP(fixnum,fixnum_t, numval)
|
||||||
SAFECAST_OP(cvalue,cvalue_t*,ptr)
|
SAFECAST_OP(cvalue,cvalue_t*,ptr)
|
||||||
SAFECAST_OP(string,char*, cvalue_data)
|
SAFECAST_OP(string,char*, cvalue_data)
|
||||||
|
#undef isstring
|
||||||
|
|
||||||
// symbol table ---------------------------------------------------------------
|
// symbol table ---------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -711,7 +713,7 @@ value_t fl_cons(value_t a, value_t b)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
int isnumber(value_t v)
|
int fl_isnumber(value_t v)
|
||||||
{
|
{
|
||||||
if (isfixnum(v)) return 1;
|
if (isfixnum(v)) return 1;
|
||||||
if (iscprim(v)) {
|
if (iscprim(v)) {
|
||||||
|
@ -1235,7 +1237,7 @@ static value_t apply_cl(uint32_t nargs)
|
||||||
Stack[SP-1] = (issymbol(Stack[SP-1]) ? FL_T : FL_F); NEXT_OP;
|
Stack[SP-1] = (issymbol(Stack[SP-1]) ? FL_T : FL_F); NEXT_OP;
|
||||||
OP(OP_NUMBERP)
|
OP(OP_NUMBERP)
|
||||||
v = Stack[SP-1];
|
v = Stack[SP-1];
|
||||||
Stack[SP-1] = (isnumber(v) ? FL_T:FL_F); NEXT_OP;
|
Stack[SP-1] = (fl_isnumber(v) ? FL_T:FL_F); NEXT_OP;
|
||||||
OP(OP_FIXNUMP)
|
OP(OP_FIXNUMP)
|
||||||
Stack[SP-1] = (isfixnum(Stack[SP-1]) ? FL_T : FL_F); NEXT_OP;
|
Stack[SP-1] = (isfixnum(Stack[SP-1]) ? FL_T : FL_F); NEXT_OP;
|
||||||
OP(OP_BOUNDP)
|
OP(OP_BOUNDP)
|
||||||
|
@ -1947,7 +1949,7 @@ static value_t fl_function(value_t *args, uint32_t nargs)
|
||||||
{
|
{
|
||||||
if (nargs < 2 || nargs > 4)
|
if (nargs < 2 || nargs > 4)
|
||||||
argcount("function", nargs, 2);
|
argcount("function", nargs, 2);
|
||||||
if (!isstring(args[0]))
|
if (!fl_isstring(args[0]))
|
||||||
type_error("function", "string", args[0]);
|
type_error("function", "string", args[0]);
|
||||||
if (!isvector(args[1]))
|
if (!isvector(args[1]))
|
||||||
type_error("function", "vector", args[1]);
|
type_error("function", "vector", args[1]);
|
||||||
|
|
|
@ -280,9 +280,9 @@ value_t cvalue_string(size_t sz);
|
||||||
value_t cvalue_static_cstring(const char *str);
|
value_t cvalue_static_cstring(const char *str);
|
||||||
value_t string_from_cstr(char *str);
|
value_t string_from_cstr(char *str);
|
||||||
value_t string_from_cstrn(char *str, size_t n);
|
value_t string_from_cstrn(char *str, size_t n);
|
||||||
int isstring(value_t v);
|
int fl_isstring(value_t v);
|
||||||
int isnumber(value_t v);
|
int fl_isnumber(value_t v);
|
||||||
int isiostream(value_t v);
|
int fl_isiostream(value_t v);
|
||||||
value_t cvalue_compare(value_t a, value_t b);
|
value_t cvalue_compare(value_t a, value_t b);
|
||||||
int numeric_compare(value_t a, value_t b, int eq, int eqnans, char *fname);
|
int numeric_compare(value_t a, value_t b, int eq, int eqnans, char *fname);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ void relocate_iostream(value_t oldv, value_t newv)
|
||||||
cvtable_t iostream_vtable = { print_iostream, relocate_iostream,
|
cvtable_t iostream_vtable = { print_iostream, relocate_iostream,
|
||||||
free_iostream, NULL };
|
free_iostream, NULL };
|
||||||
|
|
||||||
int isiostream(value_t v)
|
int fl_isiostream(value_t v)
|
||||||
{
|
{
|
||||||
return iscvalue(v) && cv_class((cvalue_t*)ptr(v)) == iostreamtype;
|
return iscvalue(v) && cv_class((cvalue_t*)ptr(v)) == iostreamtype;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ int isiostream(value_t v)
|
||||||
value_t fl_iostreamp(value_t *args, uint32_t nargs)
|
value_t fl_iostreamp(value_t *args, uint32_t nargs)
|
||||||
{
|
{
|
||||||
argcount("iostream?", nargs, 1);
|
argcount("iostream?", nargs, 1);
|
||||||
return isiostream(args[0]) ? FL_T : FL_F;
|
return fl_isiostream(args[0]) ? FL_T : FL_F;
|
||||||
}
|
}
|
||||||
|
|
||||||
value_t fl_eof_object(value_t *args, uint32_t nargs)
|
value_t fl_eof_object(value_t *args, uint32_t nargs)
|
||||||
|
@ -64,7 +64,7 @@ value_t fl_eof_objectp(value_t *args, uint32_t nargs)
|
||||||
|
|
||||||
static ios_t *toiostream(value_t v, char *fname)
|
static ios_t *toiostream(value_t v, char *fname)
|
||||||
{
|
{
|
||||||
if (!isiostream(v))
|
if (!fl_isiostream(v))
|
||||||
type_error(fname, "iostream", v);
|
type_error(fname, "iostream", v);
|
||||||
return value2c(ios_t*, v);
|
return value2c(ios_t*, v);
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ static inline int tinyp(value_t v)
|
||||||
{
|
{
|
||||||
if (issymbol(v))
|
if (issymbol(v))
|
||||||
return (u8_strwidth(symbol_name(v)) < SMALL_STR_LEN);
|
return (u8_strwidth(symbol_name(v)) < SMALL_STR_LEN);
|
||||||
if (isstring(v))
|
if (fl_isstring(v))
|
||||||
return (cv_len((cvalue_t*)ptr(v)) < SMALL_STR_LEN);
|
return (cv_len((cvalue_t*)ptr(v)) < SMALL_STR_LEN);
|
||||||
return (isfixnum(v) || isbuiltin(v));
|
return (isfixnum(v) || isbuiltin(v));
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ static inline int tinyp(value_t v)
|
||||||
static int smallp(value_t v)
|
static int smallp(value_t v)
|
||||||
{
|
{
|
||||||
if (tinyp(v)) return 1;
|
if (tinyp(v)) return 1;
|
||||||
if (isnumber(v)) return 1;
|
if (fl_isnumber(v)) return 1;
|
||||||
if (iscons(v)) {
|
if (iscons(v)) {
|
||||||
if (tinyp(car_(v)) && (tinyp(cdr_(v)) ||
|
if (tinyp(car_(v)) && (tinyp(cdr_(v)) ||
|
||||||
(iscons(cdr_(v)) && tinyp(car_(cdr_(v))) &&
|
(iscons(cdr_(v)) && tinyp(car_(cdr_(v))) &&
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
value_t fl_stringp(value_t *args, u_int32_t nargs)
|
value_t fl_stringp(value_t *args, u_int32_t nargs)
|
||||||
{
|
{
|
||||||
argcount("string?", nargs, 1);
|
argcount("string?", nargs, 1);
|
||||||
return isstring(args[0]) ? FL_T : FL_F;
|
return fl_isstring(args[0]) ? FL_T : FL_F;
|
||||||
}
|
}
|
||||||
|
|
||||||
value_t fl_string_count(value_t *args, u_int32_t nargs)
|
value_t fl_string_count(value_t *args, u_int32_t nargs)
|
||||||
|
@ -27,7 +27,7 @@ value_t fl_string_count(value_t *args, u_int32_t nargs)
|
||||||
size_t start = 0;
|
size_t start = 0;
|
||||||
if (nargs < 1 || nargs > 3)
|
if (nargs < 1 || nargs > 3)
|
||||||
argcount("string.count", nargs, 1);
|
argcount("string.count", nargs, 1);
|
||||||
if (!isstring(args[0]))
|
if (!fl_isstring(args[0]))
|
||||||
type_error("string.count", "string", args[0]);
|
type_error("string.count", "string", args[0]);
|
||||||
size_t len = cv_len((cvalue_t*)ptr(args[0]));
|
size_t len = cv_len((cvalue_t*)ptr(args[0]));
|
||||||
size_t stop = len;
|
size_t stop = len;
|
||||||
|
@ -66,7 +66,7 @@ value_t fl_string_width(value_t *args, u_int32_t nargs)
|
||||||
value_t fl_string_reverse(value_t *args, u_int32_t nargs)
|
value_t fl_string_reverse(value_t *args, u_int32_t nargs)
|
||||||
{
|
{
|
||||||
argcount("string.reverse", nargs, 1);
|
argcount("string.reverse", nargs, 1);
|
||||||
if (!isstring(args[0]))
|
if (!fl_isstring(args[0]))
|
||||||
type_error("string.reverse", "string", args[0]);
|
type_error("string.reverse", "string", args[0]);
|
||||||
size_t len = cv_len((cvalue_t*)ptr(args[0]));
|
size_t len = cv_len((cvalue_t*)ptr(args[0]));
|
||||||
value_t ns = cvalue_string(len);
|
value_t ns = cvalue_string(len);
|
||||||
|
@ -102,7 +102,7 @@ value_t fl_string_decode(value_t *args, u_int32_t nargs)
|
||||||
else {
|
else {
|
||||||
argcount("string.decode", nargs, 1);
|
argcount("string.decode", nargs, 1);
|
||||||
}
|
}
|
||||||
if (!isstring(args[0]))
|
if (!fl_isstring(args[0]))
|
||||||
type_error("string.decode", "string", args[0]);
|
type_error("string.decode", "string", args[0]);
|
||||||
cvalue_t *cv = (cvalue_t*)ptr(args[0]);
|
cvalue_t *cv = (cvalue_t*)ptr(args[0]);
|
||||||
char *ptr = (char*)cv_data(cv);
|
char *ptr = (char*)cv_data(cv);
|
||||||
|
@ -123,7 +123,7 @@ extern value_t stream_to_string(value_t *ps);
|
||||||
|
|
||||||
value_t fl_string(value_t *args, u_int32_t nargs)
|
value_t fl_string(value_t *args, u_int32_t nargs)
|
||||||
{
|
{
|
||||||
if (nargs == 1 && isstring(args[0]))
|
if (nargs == 1 && fl_isstring(args[0]))
|
||||||
return args[0];
|
return args[0];
|
||||||
value_t arg, buf = fl_buffer(NULL, 0);
|
value_t arg, buf = fl_buffer(NULL, 0);
|
||||||
ios_t *s = value2c(ios_t*,buf);
|
ios_t *s = value2c(ios_t*,buf);
|
||||||
|
@ -276,7 +276,7 @@ value_t fl_string_find(value_t *args, u_int32_t nargs)
|
||||||
else if (iscprim(v) && cp_class(cp) == bytetype) {
|
else if (iscprim(v) && cp_class(cp) == bytetype) {
|
||||||
return mem_find_byte(s, *(char*)cp_data(cp), start, len);
|
return mem_find_byte(s, *(char*)cp_data(cp), start, len);
|
||||||
}
|
}
|
||||||
else if (isstring(v)) {
|
else if (fl_isstring(v)) {
|
||||||
cvalue_t *cv = (cvalue_t*)ptr(v);
|
cvalue_t *cv = (cvalue_t*)ptr(v);
|
||||||
needlesz = cv_len(cv);
|
needlesz = cv_len(cv);
|
||||||
needle = (char*)cv_data(cv);
|
needle = (char*)cv_data(cv);
|
||||||
|
|
Loading…
Reference in New Issue