cvsuser 04/01/16 05:30:07
Modified: classes nci.pmc
imcc optimizer.c
include/parrot extend.h
library ncurses.pasm postgres.pasm
src dynext.c extend.c
Log:
get/set intkey stuff for embedding
Revision Changes Path
1.22 +5 -1 parrot/classes/nci.pmc
Index: nci.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/nci.pmc,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -w -r1.21 -r1.22
--- nci.pmc 8 Jan 2004 16:20:31 -0000 1.21
+++ nci.pmc 16 Jan 2004 13:29:52 -0000 1.22
@@ -1,7 +1,7 @@
/* NCI.pmc
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: nci.pmc,v 1.21 2004/01/08 16:20:31 petergibbs Exp $
+ * $Id: nci.pmc,v 1.22 2004/01/16 13:29:52 dan Exp $
* Overview:
* The vtable functions for the native C call functions
* Data Structure and Algorithms:
@@ -21,6 +21,10 @@
void init() {
SELF->cache.struct_val = NULL;
+ }
+
+ STRING* name () {
+ return SELF->vtable->whoami;
}
void set_string_keyed (PMC* func, STRING* value) {
1.43 +2 -0 parrot/imcc/optimizer.c
Index: optimizer.c
===================================================================
RCS file: /cvs/public/parrot/imcc/optimizer.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -w -r1.42 -r1.43
--- optimizer.c 4 Nov 2003 07:47:01 -0000 1.42
+++ optimizer.c 16 Jan 2004 13:29:56 -0000 1.43
@@ -109,8 +109,10 @@
return 1;
if (used_once(interpreter, unit))
return 1;
+#if 0
if (loop_optimization(interpreter, unit))
return 1;
+#endif
}
return any;
}
1.13 +13 -1 parrot/include/parrot/extend.h
Index: extend.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/extend.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -w -r1.12 -r1.13
--- extend.h 31 Dec 2003 11:54:32 -0000 1.12
+++ extend.h 16 Jan 2004 13:29:58 -0000 1.13
@@ -1,7 +1,7 @@
/* extend.h
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: extend.h,v 1.12 2003/12/31 11:54:32 leo Exp $
+ * $Id: extend.h,v 1.13 2004/01/16 13:29:58 dan Exp $
* Overview:
* This is the Parrot extension mechanism, the face we present to
* extension modules and whatnot
@@ -43,21 +43,33 @@
#endif
+Parrot_PMC Parrot_PMC_get_pmc_intkey(Parrot_INTERP, Parrot_PMC, Parrot_Int);
Parrot_STRING Parrot_PMC_get_string(Parrot_INTERP, Parrot_PMC);
+Parrot_STRING Parrot_PMC_get_string_intkey(Parrot_INTERP, Parrot_PMC, Parrot_Int);
void *Parrot_PMC_get_pointer(Parrot_INTERP, Parrot_PMC);
+void *Parrot_PMC_get_pointer_intkey(Parrot_INTERP, Parrot_PMC, Parrot_Int);
Parrot_Int Parrot_PMC_get_intval(Parrot_INTERP, Parrot_PMC);
Parrot_Int Parrot_PMC_get_intval_intkey(Parrot_INTERP, Parrot_PMC, Parrot_Int);
Parrot_Float Parrot_PMC_get_numval(Parrot_INTERP, Parrot_PMC);
+Parrot_Float Parrot_PMC_get_numval_intkey(Parrot_INTERP, Parrot_PMC, Parrot_Int);
char *Parrot_PMC_get_cstring(Parrot_INTERP, Parrot_PMC);
+char *Parrot_PMC_get_cstring_intkey(Parrot_INTERP, Parrot_PMC, Parrot_Int);
char *Parrot_PMC_get_cstringn(Parrot_INTERP, Parrot_PMC, Parrot_Int *);
+char *Parrot_PMC_get_cstringn_intkey(Parrot_INTERP, Parrot_PMC, Parrot_Int *,
Parrot_Int);
+void Parrot_PMC_set_pmc_intkey(Parrot_INTERP, Parrot_PMC, Parrot_PMC, Parrot_Int);
void Parrot_PMC_set_string(Parrot_INTERP, Parrot_PMC, Parrot_STRING);
+void Parrot_PMC_set_string_intkey(Parrot_INTERP, Parrot_PMC, Parrot_STRING,
Parrot_Int);
void Parrot_PMC_set_pointer(Parrot_INTERP, Parrot_PMC, void *);
+void Parrot_PMC_set_pointer_intkey(Parrot_INTERP, Parrot_PMC, void *, Parrot_Int);
void Parrot_PMC_set_cstring(Parrot_INTERP, Parrot_PMC, const char *);
+void Parrot_PMC_set_cstring_intkey(Parrot_INTERP, Parrot_PMC, const char *,
Parrot_Int);
void Parrot_PMC_set_cstringn(Parrot_INTERP, Parrot_PMC, const char *, Parrot_Int);
+void Parrot_PMC_set_cstringn_intkey(Parrot_INTERP, Parrot_PMC, const char *,
Parrot_Int, Parrot_Int);
void Parrot_PMC_set_intval(Parrot_INTERP, Parrot_PMC, Parrot_Int);
void Parrot_PMC_set_intval_intkey(Parrot_INTERP, Parrot_PMC, Parrot_Int,
Parrot_Int);
void Parrot_PMC_set_numval(Parrot_INTERP, Parrot_PMC, Parrot_Float);
+void Parrot_PMC_set_numval_intkey(Parrot_INTERP, Parrot_PMC, Parrot_Float,
Parrot_Int);
Parrot_PMC Parrot_PMC_new(Parrot_INTERP, Parrot_Int);
Parrot_PMC Parrot_PMC_null(void);
1.8 +2 -2 parrot/library/ncurses.pasm
Index: ncurses.pasm
===================================================================
RCS file: /cvs/public/parrot/library/ncurses.pasm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -r1.7 -r1.8
--- ncurses.pasm 17 Dec 2003 02:27:38 -0000 1.7
+++ ncurses.pasm 16 Jan 2004 13:30:00 -0000 1.8
@@ -1,5 +1,5 @@
saveall
-loadlib P1, '/usr/lib/libform.dylib'
+loadlib P1, 'libform'
dlfunc P2, P1, 'new_field', 'piiiiii'
store_global 'ncurses::new_field', P2
dlfunc P2, P1, 'dup_field', 'ppii'
@@ -117,7 +117,7 @@
dlfunc P2, P1, 'data_behind', 'lp'
store_global 'ncurses::data_behind', P2
-loadlib P1, '/usr/lib/libncurses.dylib'
+loadlib P1, 'libncurses'
dlfunc P2, P1, 'keybound', 'tii'
store_global 'ncurses::keybound', P2
1.4 +1 -1 parrot/library/postgres.pasm
Index: postgres.pasm
===================================================================
RCS file: /cvs/public/parrot/library/postgres.pasm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -r1.3 -r1.4
--- postgres.pasm 2 Jan 2004 21:20:46 -0000 1.3
+++ postgres.pasm 16 Jan 2004 13:30:00 -0000 1.4
@@ -1,5 +1,5 @@
saveall
-loadlib P1, '/usr/local/pgsql/lib/libpq.so'
+loadlib P1, 'libpq'
dlfunc P2, P1, 'PQconnectStart', 'pt'
store_global 'PostgreSQL::PQconnectStart', P2
dlfunc P2, P1, 'PQconnectPoll', 'ip'
1.17 +3 -3 parrot/src/dynext.c
Index: dynext.c
===================================================================
RCS file: /cvs/public/parrot/src/dynext.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -w -r1.16 -r1.17
--- dynext.c 6 Jan 2004 12:54:35 -0000 1.16
+++ dynext.c 16 Jan 2004 13:30:07 -0000 1.17
@@ -1,7 +1,7 @@
/* dynext.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: dynext.c,v 1.16 2004/01/06 12:54:35 leo Exp $
+ * $Id: dynext.c,v 1.17 2004/01/16 13:30:07 dan Exp $
* Overview:
* Dynamic extension stuff
* Data Structure and Algorithms:
@@ -52,7 +52,6 @@
*/
set_cstring_prop(interpreter, lib_pmc, "_filename", path);
set_cstring_prop(interpreter, lib_pmc, "_type", type);
-
VTABLE_push_pmc(interpreter, dyn_libs, lib_pmc);
}
@@ -71,8 +70,9 @@
iglobals = interpreter->iglobals;
dyn_libs = VTABLE_get_pmc_keyed_int(interpreter, iglobals,
IGLOBALS_DYN_LIBS);
- if (!dyn_libs)
+ if (!dyn_libs) {
return NULL;
+ }
n = VTABLE_elements(interpreter, dyn_libs);
key = string_from_cstring(interpreter, "_filename", 0);
/* we could use an ordered hash for faster lookup here */
1.17 +104 -3 parrot/src/extend.c
Index: extend.c
===================================================================
RCS file: /cvs/public/parrot/src/extend.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -w -r1.16 -r1.17
--- extend.c 31 Dec 2003 11:54:41 -0000 1.16
+++ extend.c 16 Jan 2004 13:30:07 -0000 1.17
@@ -1,7 +1,7 @@
/* extend.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: extend.c,v 1.16 2003/12/31 11:54:41 leo Exp $
+ * $Id: extend.c,v 1.17 2004/01/16 13:30:07 dan Exp $
* Overview:
* The Parrot extension interface. These are the functions that
* parrot extensions (i.e. parrot subroutines written in C, or
@@ -44,6 +44,24 @@
return VTABLE_get_pointer(interp, pmc);
}
+/*=for api extend Parrot_PMC_get_pointer_intkey
+ *
+ * Return the keyed, signed integer value of the value in the PMC
+ */
+
+void *Parrot_PMC_get_pointer_intkey(Parrot_INTERP interp, Parrot_PMC pmc,
Parrot_Int key) {
+ return VTABLE_get_pointer_keyed_int(interp, pmc, key);
+}
+
+/*=for api extend Parrot_PMC_get_pmc_intkey
+ *
+ * Return the integer keyed PMC value of the passed-in PMC
+ */
+
+Parrot_PMC Parrot_PMC_get_pmc_intkey(Parrot_INTERP interp, Parrot_PMC pmc,
Parrot_Int key) {
+ return VTABLE_get_pmc_keyed_int(interp, pmc, key);
+}
+
/*=for api extend Parrot_PMC_get_intval
*
* Return the signed integer value of the value in the PMC
@@ -53,9 +71,9 @@
return VTABLE_get_integer(interp, pmc);
}
-/*=for api extend Parrot_PMC_get_intval
+/*=for api extend Parrot_PMC_get_intval_intkey
*
- * Return the signed integer value of the value in the PMC
+ * Return the keyed, signed integer value of the value in the PMC
*/
Parrot_Int Parrot_PMC_get_intval_intkey(Parrot_INTERP interp, Parrot_PMC pmc,
Parrot_Int key) {
@@ -71,6 +89,26 @@
return VTABLE_get_number(interp, pmc);
}
+/*=for api extend Parrot_PMC_get_numval_intkey
+ *
+ * Return the keyed, signed integer value of the value in the PMC
+ */
+
+Parrot_Float Parrot_PMC_get_numval_intkey(Parrot_INTERP interp, Parrot_PMC pmc,
Parrot_Int key) {
+ return VTABLE_get_number_keyed_int(interp, pmc, key);
+}
+
+/*=for api extend Parrot_PMC_get_cstring_intkey
+ *
+ * Return a null-terminated string that represents the string value of
+ * the PMC.
+ */
+char *Parrot_PMC_get_cstring_intkey(Parrot_INTERP interp, Parrot_PMC pmc,
Parrot_Int key) {
+ STRING *retval;
+ retval = VTABLE_get_string_keyed_int(interp, pmc, key);
+ return string_to_cstring(interp, retval);
+}
+
/*=for api extend Parrot_PMC_get_cstring
*
* Return a null-terminated string that represents the string value of
@@ -97,6 +135,21 @@
return retval;
}
+/*=for api extend Parrot_PMC_get_cstringn_intkey
+ *
+ * Return a null-terminated string for the PMC, along with the
+ * length.
+ *
+ * Yes, right now this is a bit of a cheat. It needs fixing, but
+ * without disturbing the interface.
+ */
+char *Parrot_PMC_get_cstringn_intkey(Parrot_INTERP interp, Parrot_PMC pmc,
Parrot_Int *length, Parrot_Int key) {
+ char *retval;
+ retval = string_to_cstring(interp, VTABLE_get_string_keyed_int(interp, pmc,
key));
+ *length = strlen(retval);
+ return retval;
+}
+
/*=for api extend Parrot_PMC_set_string
*
* Assign the passed-in parrot string to the passed-in PMC
@@ -105,6 +158,14 @@
VTABLE_set_string_native(interp, pmc, value);
}
+/*=for api extend Parrot_PMC_set_string
+ *
+ * Assign the passed-in parrot string to the passed-in PMC
+ */
+void Parrot_PMC_set_string_intkey(Parrot_INTERP interp, Parrot_PMC pmc,
Parrot_STRING value, Parrot_Int key) {
+ VTABLE_set_string_keyed_int(interp, pmc, key, value);
+}
+
/*=for api extend Parrot_PMC_set_pointer
*
* Assign the passed-in pointer to the passed-in PMC
@@ -113,6 +174,22 @@
VTABLE_set_pointer(interp, pmc, value);
}
+/*=for api extend Parrot_PMC_set_pmc_intkey
+ *
+ * Assign the passed-in pmc to the passed-in slot of the passed-in PMC
+ */
+void Parrot_PMC_set_pmc_intkey(Parrot_INTERP interp, Parrot_PMC pmc, Parrot_PMC
value, Parrot_Int key) {
+ VTABLE_set_pmc_keyed_int(interp, pmc, key, value);
+}
+
+/*=for api extend Parrot_PMC_set_pointer
+ *
+ * Assign the passed-in pointer to the passed-in PMC
+ */
+void Parrot_PMC_set_pointer_intkey(Parrot_INTERP interp, Parrot_PMC pmc, void
*value, Parrot_Int key) {
+ VTABLE_set_pointer_keyed_int(interp, pmc, key, value);
+}
+
/*=for api extend Parrot_PMC_set_intval
*
* Assign the passed-in parrot integer to the passed-in PMC
@@ -137,6 +214,14 @@
VTABLE_set_number_native(interp, pmc, value);
}
+/*=for api extend Parrot_PMC_set_numval
+ *
+ * Assign the passed-in parrot number to the passed-in PMC
+ */
+void Parrot_PMC_set_numval_intkey(Parrot_INTERP interp, Parrot_PMC pmc,
Parrot_Float value, Parrot_Int key) {
+ VTABLE_set_number_keyed_int(interp, pmc, key, value);
+}
+
/*=for api extend Parrot_PMC_set_cstring
*
* Assign the passed-in null-terminated C string to the passed-in PMC
@@ -145,12 +230,28 @@
VTABLE_set_string_native(interp, pmc, string_from_cstring(interp, value, 0));
}
+/*=for api extend Parrot_PMC_set_cstring
+ *
+ * Assign the passed-in null-terminated C string to the passed-in PMC
+ */
+void Parrot_PMC_set_cstring_intkey(Parrot_INTERP interp, Parrot_PMC pmc, const char
*value, Parrot_Int key) {
+ VTABLE_set_string_keyed_int(interp, pmc, key, string_from_cstring(interp,
value, 0));
+}
+
/*=for api extend Parrot_PMC_set_cstringn
*
* Assign the passed-in length-noted string to the passed-in PMC
*/
void Parrot_PMC_set_cstringn(Parrot_INTERP interp, Parrot_PMC pmc, const char
*value, Parrot_Int length) {
VTABLE_set_string_native(interp, pmc, string_from_cstring(interp, value,
length));
+}
+
+/*=for api extend Parrot_PMC_set_cstringn
+ *
+ * Assign the passed-in length-noted string to the passed-in PMC
+ */
+void Parrot_PMC_set_cstringn_intkey(Parrot_INTERP interp, Parrot_PMC pmc, const
char *value, Parrot_Int length, Parrot_Int key) {
+ VTABLE_set_string_keyed_int(interp, pmc, key, string_from_cstring(interp,
value, length));
}
/*=for api extend Parrot_PMC_new