- if (!PSI_ParserInit(&P, psi, C->error, 0)) {
- C->error(PSI_WARNING, "Failed to init PSI parser (%s): %s",
- psi, strerror(errno));
- continue;
+
+ n = php_scandir(ptr, &entries, psi_select_dirent, alphasort);
+
+ if (n > 0) {
+ for (i = 0; i < n; ++i) {
+ char psi[MAXPATHLEN];
+ PSI_Parser P;
+
+ if (MAXPATHLEN <= slprintf(psi, MAXPATHLEN, "%s/%s", ptr, entries[i]->d_name)) {
+ C->error(PSI_WARNING, "Path to PSI file too long: %s/%s",
+ ptr, entries[i]->d_name);
+ }
+ if (!PSI_ParserInit(&P, psi, C->error, 0)) {
+ C->error(PSI_WARNING, "Failed to init PSI parser (%s): %s",
+ psi, strerror(errno));
+ continue;
+ }
+
+ while (-1 != PSI_ParserScan(&P)) {
+ PSI_ParserParse(&P, PSI_TokenAlloc(&P));
+ };
+ PSI_ParserParse(&P, NULL);
+ PSI_ContextValidate(C, &P);
+ PSI_ParserDtor(&P);
+ }