flush
[m6w6/ext-psi] / src / context.c
index ba587201926ffafc0286fce4b8c76d1dc8fdf491..f580f7f424bb70a8fd3d9fcd0a9ee9900539a55c 100644 (file)
@@ -161,11 +161,26 @@ int psi_glob(const char *pattern, int flags,
        return rv;
 }
 
        return rv;
 }
 
+int psi_printf(const char *fmt, ...) {
+       int rs;
+       char *a1;
+       va_list ap1, ap2;
+
+       va_start(ap1, fmt);
+       va_copy(ap2, ap1);
+       a1 = va_arg(ap2, char *);
+       rs = vprintf(fmt, ap1);
+       va_end(ap1);
+       va_end(ap2);
+       return rs;
+}
+
 static struct psi_func_redir {
        const char *name;
        void (*func)(void);
 } psi_func_redirs[] = {
        {"glob", (void (*)(void)) psi_glob},
 static struct psi_func_redir {
        const char *name;
        void (*func)(void);
 } psi_func_redirs[] = {
        {"glob", (void (*)(void)) psi_glob},
+       {"printf", (void (*)(void)) psi_printf},
        PSI_REDIRS
        {0}
 };
        PSI_REDIRS
        {0}
 };
@@ -1214,9 +1229,9 @@ zend_function_entry *PSI_ContextCompile(PSI_Context *C)
 }
 
 
 }
 
 
-void PSI_ContextCall(PSI_Context *C, decl_callinfo *decl_call)
+void PSI_ContextCall(PSI_Context *C, decl_callinfo *decl_call, impl_vararg *va)
 {
 {
-       C->ops->call(C, decl_call);
+       C->ops->call(C, decl_call, va);
 }
 
 static inline void dump_decl_type(int fd, decl_type *t) {
 }
 
 static inline void dump_decl_type(int fd, decl_type *t) {
@@ -1404,8 +1419,8 @@ void PSI_ContextDump(PSI_Context *C, int fd)
                                                dprintf(fd, " = %s", iarg->def->text);
                                        }
                                }
                                                dprintf(fd, " = %s", iarg->def->text);
                                        }
                                }
-                               if (impl->func->args->vararg) {
-                                       impl_arg *vararg = impl->func->args->vararg;
+                               if (impl->func->args->vararg.name) {
+                                       impl_arg *vararg = impl->func->args->vararg.name;
 
                                        dprintf(fd, ", %s %s...$%s",
                                                        vararg->type->name,
 
                                        dprintf(fd, ", %s %s...$%s",
                                                        vararg->type->name,