assert(ops->call != NULL);
assert(ops->compile != NULL);
- /* build up predefs in a temporary PSI_Data for validation */
+ /* build up predefs in a temporary psi_data for validation */
memset(&T, 0, sizeof(T));
psi_data_ctor_with_dtors(&T, error, flags);
type = psi_decl_type_init(member->type_tag, member->type_name);
dvar = psi_decl_var_init(member->var_name, member->pointer_level, member->array_size);
darg = psi_decl_arg_init(type, dvar);
- darg->layout = psi_layout_init(member->offset, member->size);
+ darg->layout = psi_layout_init(member->offset, member->size, NULL);
switch (predef_composite->type_tag) {
case PSI_T_STRUCT:
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);
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",
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;
}
-
- psi_parser_parse(&P);
+ psi_parser_parse(&P, I);
psi_context_add_data(C, PSI_DATA(&P));
psi_parser_dtor(&P);
+ free(I);
}
}
struct psi_decl_enum_item *item;
while (psi_plist_get(e->items, j++, &item)) {
- zend_string *name = strpprintf(0, "psi\\%s\\%s", e->name, item->name);
+ zend_string *name;
+
+ if (psi_decl_type_is_anon(e->name, "enum")) {
+ name = strpprintf(0, "psi\\%s", item->name);
+ } else {
+ name = strpprintf(0, "psi\\%s\\%s", e->name, item->name);
+ }
+
+ if (zend_get_constant(name)) {
+ zend_string_release(name);
+ continue;
+ }
zc.name = zend_string_dup(name, 1);
ZVAL_LONG(&zc.value, psi_long_num_exp(item->num, NULL, NULL));
return FAILURE;
}
- psi_call_frame_do_call(frame);
+ C->ops->call(frame);
if (SUCCESS != psi_call_frame_do_assert(frame, PSI_ASSERT_POST)) {
psi_call_frame_do_return(frame, return_value);