silence first validation round
[m6w6/ext-psi] / src / context.c
index 3fe6c3f17af72acf303c95c4cbe040550578f2a3..8bd2deef155d1b20da822b217b65e686ed49cde0 100644 (file)
@@ -37,7 +37,7 @@
 #include "php_psi_structs.h"
 
 
-PSI_Context *PSI_ContextInit(PSI_Context *C, PSI_ContextOps *ops, PSI_ContextErrorFunc error)
+PSI_Context *PSI_ContextInit(PSI_Context *C, PSI_ContextOps *ops, PSI_ContextErrorFunc error, unsigned flags)
 {
        PSI_Data T;
        struct psi_predef_type *predef_type;
@@ -51,6 +51,7 @@ PSI_Context *PSI_ContextInit(PSI_Context *C, PSI_ContextOps *ops, PSI_ContextErr
        memset(C, 0, sizeof(*C));
 
        C->error = error;
+       C->flags = flags;
        C->ops = ops;
 
        if (ops->init) {
@@ -66,7 +67,8 @@ PSI_Context *PSI_ContextInit(PSI_Context *C, PSI_ContextOps *ops, PSI_ContextErr
 
        for (predef_type = &psi_predef_types[0]; predef_type->type_tag; ++predef_type) {
                decl_type *type = init_decl_type(predef_type->type_tag, predef_type->type_name);
-               decl_typedef *def = init_decl_typedef(predef_type->alias, type);
+               decl_var *var = init_decl_var(predef_type->alias, 0, 0); /* FIXME: indirection */
+               decl_arg *def = init_decl_arg(type, var);
 
                T.defs = add_decl_typedef(T.defs, def);
        }
@@ -156,11 +158,10 @@ static int psi_select_dirent(const struct dirent *entry)
 
 void PSI_ContextBuild(PSI_Context *C, const char *paths)
 {
-       int i, n, flags = psi_check_env("PSI_DEBUG") ? PSI_PARSER_DEBUG : 0;
+       int i, n;
        char *sep = NULL, *cpy = strdup(paths), *ptr = cpy;
        struct dirent **entries = NULL;
 
-
        do {
                sep = strchr(ptr, ':');
 
@@ -176,11 +177,11 @@ void PSI_ContextBuild(PSI_Context *C, const char *paths)
                                PSI_Parser P;
 
                                if (MAXPATHLEN <= slprintf(psi, MAXPATHLEN, "%s/%s", ptr, entries[i]->d_name)) {
-                                       C->error(NULL, PSI_WARNING, "Path to PSI file too long: %s/%s",
+                                       C->error(C, NULL, PSI_WARNING, "Path to PSI file too long: %s/%s",
                                                ptr, entries[i]->d_name);
                                }
-                               if (!PSI_ParserInit(&P, psi, C->error, flags)) {
-                                       C->error(NULL, PSI_WARNING, "Failed to init PSI parser (%s): %s",
+                               if (!PSI_ParserInit(&P, psi, C->error, C->flags)) {
+                                       C->error(C, NULL, PSI_WARNING, "Failed to init PSI parser (%s): %s",
                                                psi, strerror(errno));
                                        continue;
                                }
@@ -210,7 +211,7 @@ void PSI_ContextBuild(PSI_Context *C, const char *paths)
 
 
        if (PSI_ContextCompile(C) && SUCCESS != zend_register_functions(NULL, C->closures, NULL, MODULE_PERSISTENT)) {
-               C->error(NULL, PSI_WARNING, "Failed to register functions!");
+               C->error(C, NULL, PSI_WARNING, "Failed to register functions!");
        }
 
        free(cpy);