Changeset: acfebc9f7805 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=acfebc9f7805
Modified Files:
        sql/backends/monet5/sql_gencode.c
        sql/include/sql_catalog.h
Branch: RIntegration
Log Message:

add a ptr to the sql_func as first argument, when calling any of the
FUNC_LANG_R,C,J extentions.


diffs (91 lines):

diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -90,6 +90,21 @@ constantAtom(backend *sql, MalBlkPtr mb,
        return idx;
 }
 
+static InstrPtr
+pushPtr(MalBlkPtr mb, InstrPtr q, ptr val)
+{
+       int _t;
+       ValRecord cst;
+
+       if (q == NULL)
+               return NULL;
+       cst.vtype= TYPE_ptr;
+       cst.val.pval = val;
+       cst.len = 0;
+       _t = defConstant(mb, TYPE_ptr, &cst);
+       return pushArgument(mb, q, _t);
+}
+
 static int
 argumentZero(MalBlkPtr mb, int tpe)
 {
@@ -684,6 +699,8 @@ dump_joinN(backend *sql, MalBlkPtr mb, s
        /* filter qualifying tuples, return oids of h and tail */
        q = newStmt(mb, mod, fimp);
        q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any));
+       if (LANG_EXT(f->lang)) 
+               q = pushPtr(mb, q, f);
        if (f->lang == FUNC_LANG_R)
                q = pushStr(mb, q, f->query);
        q = pushArgument(mb, q, op1);
@@ -1217,6 +1234,8 @@ static int
                                        fimp = 
sql_func_imp(s->op4.funcval->func);
 
                                        q = newStmt(mb, mod, 
convertOperator(fimp));
+                                       if (LANG_EXT(f->lang)) 
+                                               q = pushPtr(mb, q, f);
                                        if (f->lang == FUNC_LANG_R)
                                                q = pushStr(mb, q, f->query);
                                        q = pushArgument(mb, q, l);
@@ -1838,6 +1857,8 @@ static int
                        } else {
                                q = newStmt(mb, mod, fimp);
                                setVarType(mb, getArg(q, 0), rtype);
+                               if (LANG_EXT(f->lang)) 
+                                       q = pushPtr(mb, q, f);
                                if (f->lang == FUNC_LANG_R)
                                        q = pushStr(mb, q, f->query);
                                q = pushArgument(mb, q, l);
@@ -1891,6 +1912,8 @@ static int
                                s->nr = getDestVar(q);
                        } else {
                                q = newStmt(mb, mod, convertOperator(fimp));
+                               if (LANG_EXT(f->lang)) 
+                                       q = pushPtr(mb, q, f);
                                if (f->lang == FUNC_LANG_R)
                                        q = pushStr(mb, q, f->query);
                                setVarType(mb, getArg(q, 0), rtype);
@@ -1955,6 +1978,8 @@ static int
                        if (strcmp(fimp, "round") == 0 && tpe && 
tpe->type->eclass == EC_DEC)
                                special = 1;
 
+                       if (LANG_EXT(f->func->lang)) 
+                               q = pushPtr(mb, q, f->func);
                        if (f->func->lang == FUNC_LANG_R)
                                q = pushStr(mb, q, f->func->query);
                        for (n = s->op1->op4.lval->h; n; n = n->next) {
@@ -2064,6 +2089,8 @@ static int
                                        setVarUDFtype(mb, getArg(q, 0));
                                }
                        }
+                       if (LANG_EXT(a->aggr->lang)) 
+                               q = pushPtr(mb, q, a->aggr);
                        if (a->aggr->lang == FUNC_LANG_R){
                                if (!g) {
                                        setVarType(mb, getArg(q, 0), restype);
diff --git a/sql/include/sql_catalog.h b/sql/include/sql_catalog.h
--- a/sql/include/sql_catalog.h
+++ b/sql/include/sql_catalog.h
@@ -290,6 +290,8 @@ typedef struct sql_arg {
 #define FUNC_LANG_C   4
 #define FUNC_LANG_J   5
 
+#define LANG_EXT(l)  (l>FUNC_LANG_SQL)
+
 typedef struct sql_func {
        sql_base base;
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to