api refactoring
[m6w6/ext-psi] / src / context_dump.c
index 2c6e8c06f8245d5e827aa333fc99477d1b390885..1f40e4fca0f5bd20e31bb68ef8080a2d9f44c38b 100644 (file)
@@ -1,6 +1,12 @@
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include "php.h"
 #include "php_psi.h"
 
+#include "types.h"
+
 #include "libjit.h"
 #include "libffi.h"
 
@@ -24,7 +30,7 @@ static inline void dump_decl_type(int fd, decl_type *t, unsigned level) {
        case PSI_T_STRUCT:
                dprintf(fd, "struct ");
                if (!strncmp(t->name, "struct@", sizeof("struct"))) {
-                       dump_struct_args(fd, t->strct->args, level);
+                       dump_struct_args(fd, t->real.strct->args, level);
                        return;
                }
                break;
@@ -32,7 +38,7 @@ static inline void dump_decl_type(int fd, decl_type *t, unsigned level) {
        case PSI_T_ENUM:
                dprintf(fd, "enum ");
                if (!strncmp(t->name, "enum@", sizeof("enum"))) {
-                       dump_enum_items(fd, t->enm->items, level);
+                       dump_enum_items(fd, t->real.enm->items, level);
                        return;
                }
                break;
@@ -40,7 +46,7 @@ static inline void dump_decl_type(int fd, decl_type *t, unsigned level) {
        case PSI_T_UNION:
                dprintf(fd, "union ");
                if (!strncmp(t->name, "union@", sizeof("union"))) {
-                       dump_struct_args(fd, t->unn->args, level);
+                       dump_struct_args(fd, t->real.unn->args, level);
                        return;
                }
                break;
@@ -57,20 +63,20 @@ static inline void dump_decl_var(int fd, decl_var *v) {
 
 static inline void dump_decl_arg(int fd, decl_arg *a, unsigned level) {
        if (a->type->type == PSI_T_FUNCTION) {
-               dump_decl_type(fd, a->type->func->func->type, level);
+               dump_decl_type(fd, a->type->real.func->func->type, level);
                dprintf(fd, " (");
                dump_decl_var(fd, a->var);
                dprintf(fd, ")(");
-               if (a->type->func->args) {
+               if (a->type->real.func->args) {
                        size_t j;
 
-                       for (j = 0; j < a->type->func->args->count; ++j) {
+                       for (j = 0; j < a->type->real.func->args->count; ++j) {
                                if (j) {
                                        dprintf(fd, ", ");
                                }
-                               dump_decl_arg(fd, a->type->func->args->args[j], level+1);
+                               dump_decl_arg(fd, a->type->real.func->args->args[j], level+1);
                        }
-                       if (a->type->func->args->varargs) {
+                       if (a->type->real.func->args->varargs) {
                                dprintf(fd, ", ...");
                        }
                }
@@ -497,15 +503,15 @@ static inline void dump_impls(int fd, impls *impls) {
        }
 }
 
-void PSI_ContextDump(PSI_Context *C, int fd)
+void psi_context_dump(struct psi_context *C, int fd)
 {
 #ifdef HAVE_LIBJIT
-       if (C->ops == PSI_Libjit()) {
+       if (C->ops == psi_libjit_ops()) {
                dprintf(fd, "// psi.engine=jit\n");
        }
 #endif
 #ifdef HAVE_LIBFFI
-       if (C->ops == PSI_Libffi()) {
+       if (C->ops == psi_libffi_ops()) {
                dprintf(fd, "// psi.engine=ffi\n");
        }
 #endif