Opera 12.15 Source Code
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

doxyrun.pike 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. string root;
  2. string doxygen_exe = "doxygen";
  3. string interpreter = "";
  4. int main(int argc, array(string) argv)
  5. {
  6. for (int i=0 ; i < argc ; i++)
  7. {
  8. if (argv[i] == "--root" && argc > i + 1)
  9. {
  10. root = System.normalize_path(argv[i + 1]);
  11. i++;
  12. }
  13. if (argv[i] == "--doxygen" && argc > i + 1)
  14. {
  15. doxygen_exe = argv[i + 1];
  16. i++;
  17. }
  18. if (argv[i] == "--windows")
  19. {
  20. interpreter = "cmd.exe /C ";
  21. }
  22. }
  23. if (!root)
  24. {
  25. write(sprintf("usage: %s --root root_directory [--doxygen path_to_doxygen_executable] [--windows]\n", argv[0]));
  26. exit(1);
  27. }
  28. write(sprintf("running from directory \"%s\"\n", root));
  29. write(sprintf("using doxygen binary \"%s\"\n", interpreter + doxygen_exe));
  30. string cwd = getcwd();
  31. array(string) doxyfiles = find_dox_dirs(root);
  32. foreach(doxyfiles, string file)
  33. {
  34. file = System.normalize_path(file);
  35. write(sprintf("found file %s\n", file));
  36. run_doxygen(file - "Doxyfile");
  37. }
  38. cd(cwd);
  39. write("writing index:\n");
  40. write_index("dox_index.html", doxyfiles);
  41. write("done.\n");
  42. }
  43. array(string) find_dox_dirs(string root)
  44. {
  45. array(string) retval = ({});
  46. foreach(get_dir(root), string item)
  47. {
  48. //write(sprintf("%s\n", root + "/" + item));
  49. Stdio.Stat stat = file_stat(root + "/" + item);
  50. if (!stat)
  51. {
  52. write(sprintf("null stat: %s\n", item));
  53. continue;
  54. }
  55. if (stat->isdir)
  56. {
  57. retval += find_dox_dirs(root + "/" + item);
  58. }
  59. else if (item == "Doxyfile")
  60. {
  61. retval += ({ root + "/" + item });
  62. }
  63. }
  64. return retval;
  65. }
  66. void run_doxygen(string path)
  67. {
  68. write(sprintf("running doxygen in %s\n", path));
  69. cd(path);
  70. Process.create_process dox = Process.create_process( (interpreter + doxygen_exe) / " ");
  71. dox->wait();
  72. }
  73. string index_preamble = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"coredoc.css\"/><title>Opera Module Documentation</title></head><body><h1>Opera Module Documentation</h1></body>\n";
  74. string index_postscriptum ="</body></html>";
  75. void write_index(string file, array(string) doxfiles)
  76. {
  77. Stdio.File f = Stdio.File(file, "ctw");
  78. f->write(index_preamble);
  79. f->write(sprintf("Generated %s<p>\n", ctime(time())));
  80. foreach(doxfiles, string df)
  81. {
  82. string dfpath = df - "Doxyfile";
  83. string module = explode_path(dfpath)[-3];
  84. f->write(sprintf("<a href=\"../%s/documentation/api/index.html\">%s</a><br>\n", module, module));
  85. }
  86. f->write(index_postscriptum);
  87. }