You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
936 B

  1. <?php
  2. function scan_dir($dir) {
  3. if (!is_dir($dir)) return;
  4. foreach (glob("$dir/*") as $file) {
  5. if (is_dir($file)) {
  6. if (basename($file) != "CVS") {
  7. scan_dir($file);
  8. }
  9. } else if (fnmatch("*.h", $file)) {
  10. scan_file($file);
  11. }
  12. }
  13. }
  14. function scan_file($file) {
  15. $flag = false;
  16. foreach (file($file) as $nr => $line) {
  17. if (ereg("^[[:space:]]*BEGIN_EXTERN_C", $line)) {
  18. # echo "$file:".($nr+1)." $line";
  19. $flag = true;
  20. } else if (ereg("^[[:space:]]*END_EXTERN_C", $line)) {
  21. # echo "$file:".($nr+1)." $line";
  22. $flag = false;
  23. } else if ( (ereg("^[[:space:]]*PHPAPI[[:space:]]*", $line))
  24. ||(ereg("^[[:space:]]*ZEND_API[[:space:]]*", $line))) {
  25. if (strstr($line,"(")) {
  26. if (!$flag) echo "$file:".($nr+1)." $line";
  27. }
  28. }
  29. }
  30. }
  31. array_shift($_SERVER["argv"]);
  32. if (count($_SERVER["argv"])) {
  33. foreach ($_SERVER["argv"] as $dir) {
  34. scan_dir($dir);
  35. }
  36. } else {
  37. scan_dir(".");
  38. }
  39. ?>