ref: be0d4d0d4764c2bdac6299bfed58357207de35d3
parent: 37a23afb3ca391290714b9560768defd15b27c97
author: JeffBezanson <jeff.bezanson@gmail.com>
date: Sun Aug 23 03:06:57 EDT 2009
renaming - adding fl_ prefix to some more functions
--- a/femtolisp/builtins.c
+++ b/femtolisp/builtins.c
@@ -127,7 +127,7 @@
static value_t fl_symbol(value_t *args, u_int32_t nargs)
{
argcount("symbol", nargs, 1);
- if (!isstring(args[0]))
+ if (!fl_isstring(args[0]))
type_error("symbol", "string", args[0]);
return symbol(cvalue_data(args[0]));
}
--- a/femtolisp/cvalues.c
+++ b/femtolisp/cvalues.c
@@ -220,7 +220,7 @@
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)));
}
--- a/femtolisp/flisp.c
+++ b/femtolisp/flisp.c
@@ -214,6 +214,7 @@
// safe cast operators --------------------------------------------------------
+#define isstring fl_isstring
#define SAFECAST_OP(type,ctype,cnvt) \
ctype to##type(value_t v, char *fname) \
{ \
@@ -226,6 +227,7 @@
SAFECAST_OP(fixnum,fixnum_t, numval)
SAFECAST_OP(cvalue,cvalue_t*,ptr)
SAFECAST_OP(string,char*, cvalue_data)
+#undef isstring
// symbol table ---------------------------------------------------------------
@@ -711,7 +713,7 @@
return c;
}
-int isnumber(value_t v)
+int fl_isnumber(value_t v)
{
if (isfixnum(v)) return 1;
if (iscprim(v)) {
@@ -1235,7 +1237,7 @@
Stack[SP-1] = (issymbol(Stack[SP-1]) ? FL_T : FL_F); NEXT_OP;
OP(OP_NUMBERP)
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)
Stack[SP-1] = (isfixnum(Stack[SP-1]) ? FL_T : FL_F); NEXT_OP;
OP(OP_BOUNDP)
@@ -1947,7 +1949,7 @@
{
if (nargs < 2 || nargs > 4)
argcount("function", nargs, 2);
- if (!isstring(args[0]))
+ if (!fl_isstring(args[0]))
type_error("function", "string", args[0]);
if (!isvector(args[1]))
type_error("function", "vector", args[1]);
--- a/femtolisp/flisp.h
+++ b/femtolisp/flisp.h
@@ -280,9 +280,9 @@
value_t cvalue_static_cstring(const char *str);
value_t string_from_cstr(char *str);
value_t string_from_cstrn(char *str, size_t n);
-int isstring(value_t v);
-int isnumber(value_t v);
-int isiostream(value_t v);
+int fl_isstring(value_t v);
+int fl_isnumber(value_t v);
+int fl_isiostream(value_t v);
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);
--- a/femtolisp/iostream.c
+++ b/femtolisp/iostream.c
@@ -38,7 +38,7 @@
cvtable_t iostream_vtable = { print_iostream, relocate_iostream,
free_iostream, NULL };
-int isiostream(value_t v)
+int fl_isiostream(value_t v)
{
return iscvalue(v) && cv_class((cvalue_t*)ptr(v)) == iostreamtype;
}
@@ -46,7 +46,7 @@
value_t fl_iostreamp(value_t *args, uint32_t nargs)
{
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)
@@ -64,7 +64,7 @@
static ios_t *toiostream(value_t v, char *fname)
{
- if (!isiostream(v))
+ if (!fl_isiostream(v))
type_error(fname, "iostream", v);
return value2c(ios_t*, v);
}
--- a/femtolisp/print.c
+++ b/femtolisp/print.c
@@ -166,7 +166,7 @@
{
if (issymbol(v))
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 (isfixnum(v) || isbuiltin(v));
}
@@ -174,7 +174,7 @@
static int smallp(value_t v)
{
if (tinyp(v)) return 1;
- if (isnumber(v)) return 1;
+ if (fl_isnumber(v)) return 1;
if (iscons(v)) {
if (tinyp(car_(v)) && (tinyp(cdr_(v)) ||
(iscons(cdr_(v)) && tinyp(car_(cdr_(v))) &&
--- a/femtolisp/string.c
+++ b/femtolisp/string.c
@@ -19,7 +19,7 @@
value_t fl_stringp(value_t *args, u_int32_t nargs)
{
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)
@@ -27,7 +27,7 @@
size_t start = 0;
if (nargs < 1 || nargs > 3)
argcount("string.count", nargs, 1);
- if (!isstring(args[0]))
+ if (!fl_isstring(args[0]))
type_error("string.count", "string", args[0]);
size_t len = cv_len((cvalue_t*)ptr(args[0]));
size_t stop = len;
@@ -66,7 +66,7 @@
value_t fl_string_reverse(value_t *args, u_int32_t nargs)
{
argcount("string.reverse", nargs, 1);
- if (!isstring(args[0]))
+ if (!fl_isstring(args[0]))
type_error("string.reverse", "string", args[0]);
size_t len = cv_len((cvalue_t*)ptr(args[0]));
value_t ns = cvalue_string(len);
@@ -102,7 +102,7 @@
else {
argcount("string.decode", nargs, 1);
}
- if (!isstring(args[0]))
+ if (!fl_isstring(args[0]))
type_error("string.decode", "string", args[0]);
cvalue_t *cv = (cvalue_t*)ptr(args[0]);
char *ptr = (char*)cv_data(cv);
@@ -123,7 +123,7 @@
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];
value_t arg, buf = fl_buffer(NULL, 0);
ios_t *s = value2c(ios_t*,buf);
@@ -276,7 +276,7 @@
else if (iscprim(v) && cp_class(cp) == bytetype) {
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);
needlesz = cv_len(cv);
needle = (char*)cv_data(cv);