Code: Select all
diff -ur a/nl-string.c b/nl-string.c
--- a/nl-string.c 2014-04-08 09:54:24.000000000 -0500
+++ b/nl-string.c 2014-06-14 11:07:48.972430323 -0500
@@ -1359,6 +1359,11 @@
return(stuffString((char *)getAddress(params)));
}
+CELL * p_getCELL(CELL *params)
+{
+return(copyCell((CELL *)getAddress(params)));
+}
+
CELL * p_getInteger(CELL * params)
{
return(stuffInteger(*(int *)getAddress(params)));
diff -ur a/primes.h b/primes.h
--- a/primes.h 2014-04-08 09:54:24.000000000 -0500
+++ b/primes.h 2014-06-14 10:49:06.035008299 -0500
@@ -245,6 +245,7 @@
{"bits", p_bits, 0},
{"get-float", p_getFloat, 0},
{"get-string", p_getString, 0},
+ {"get-cell", p_getCELL, 0},
{"get-int", p_getInteger, 0},
{"get-long", p_getLong, 0},
{"get-char", p_getChar, 0},
diff -ur a/protos.h b/protos.h
--- a/protos.h 2014-04-08 09:54:24.000000000 -0500
+++ b/protos.h 2014-06-14 10:56:08.637362480 -0500
@@ -252,6 +252,7 @@
CELL * p_getInteger(CELL * params);
CELL * p_getLong(CELL * params);
CELL * p_getString(CELL * params);
+CELL * p_getCELL(CELL *params);
CELL * p_getUrl(CELL * params);
CELL * p_getenv(CELL * params);
CELL * p_global(CELL * params);
Lutz, if this function is acceptable, then I would also be willing to write the documentation. But I'm not going to do that unless I can get this approved somehow. I do not know newLISP as well as you do obviously, but I would really like some way to access a FOOP object (or other cells) from the registered C API callback. Being able to convert a pointer back to a usable cell, either as a reference or a copy, is something I think would be very useful for allowing FOOP to better act as a wrapper for C APIs. I have briefly tested it and it appears to work, but I don't know the newLISP innards very well.
Thanks for reading.