X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcontext.c;h=d1eb05e35323aed7137f258c808b24420cb402e6;hb=4926283fa0589f3f9c25616304672018dba77429;hp=d4510ebc579d1af794c4bd89b8c563c4b373d935;hpb=f15288e185e65bcdfde87c217fb6bd7ff12eb653;p=m6w6%2Fext-psi diff --git a/src/context.c b/src/context.c index d4510eb..d1eb05e 100644 --- a/src/context.c +++ b/src/context.c @@ -178,7 +178,7 @@ struct psi_context *psi_context_init(struct psi_context *C, struct psi_context_o struct psi_decl_var *fname = psi_decl_var_init(predef_decl->var_name, predef_decl->pointer_level, predef_decl->array_size); struct psi_decl_arg *tdef, *func = psi_decl_arg_init(ftype, fname); struct psi_plist *args = psi_plist_init((psi_plist_dtor) psi_decl_arg_free); - struct psi_decl *decl = psi_decl_init(psi_decl_abi_init("default"), func, args); + struct psi_decl *decl = psi_decl_init(func, args); for (farg = &predef_decl[1]; farg->type_tag; ++farg) { struct psi_decl_type *arg_type = psi_decl_type_init(farg->type_tag, farg->type_name); @@ -240,6 +240,7 @@ void psi_context_build(struct psi_context *C, const char *paths) for (i = 0; i < n; ++i) { char psi[MAXPATHLEN]; struct psi_parser P; + struct psi_parser_input *I; if (MAXPATHLEN <= slprintf(psi, MAXPATHLEN, "%s/%s", ptr, entries[i]->d_name)) { C->error(PSI_DATA(C), NULL, PSI_WARNING, "Path to PSI file too long: %s/%s", @@ -250,22 +251,15 @@ void psi_context_build(struct psi_context *C, const char *paths) psi, strerror(errno)); continue; } - if (!psi_parser_open_file(&P, psi)) { + if (!(I = psi_parser_open_file(&P, psi, true))) { C->error(PSI_DATA(C), NULL, PSI_WARNING, "Failed to open PSI file (%s): %s", psi, strerror(errno)); continue; } - - while (0 < psi_parser_scan(&P)) { - psi_parser_parse(&P, psi_token_alloc(&P)); - if (P.num == PSI_T_EOF) { - break; - } - } - - psi_parser_parse(&P, NULL); + psi_parser_parse(&P, I); psi_context_add_data(C, PSI_DATA(&P)); psi_parser_dtor(&P); + free(I); } } @@ -341,7 +335,7 @@ zend_function_entry *psi_context_compile(struct psi_context *C) zend_string *name = strpprintf(0, "psi\\%s\\%s", e->name, item->name); zc.name = zend_string_dup(name, 1); - ZVAL_LONG(&zc.value, psi_long_num_exp(item->num, NULL)); + ZVAL_LONG(&zc.value, psi_long_num_exp(item->num, NULL, NULL)); zend_register_constant(&zc); zend_string_release(name); }