gcc.rb 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. module Docs
  2. class Gcc < Gnu
  3. self.name = 'GCC'
  4. self.slug = 'gcc'
  5. self.links = {
  6. home: 'https://gcc.gnu.org/'
  7. }
  8. html_filters.push 'gcc/clean_html', 'title'
  9. options[:root_title] = false
  10. options[:title] = false
  11. options[:replace_paths] = {
  12. 'aarch64_002dfeature_002dmodifiers.html' => 'AArch64-Options.html',
  13. 'AssemblerTemplate.html' => 'Extended-Asm.html',
  14. 'AVR-Named-Address-Spaces.html' => 'Named-Address-Spaces.html',
  15. 'AVR-Variable-Attributes.html' => 'Variable-Attributes.html',
  16. 'Clobbers.html' => 'Extended-Asm.html',
  17. 'dashMF.html' => 'Preprocessor-Options.html',
  18. 'GotoLabels.html' => 'Extended-Asm.html',
  19. 'InputOperands.html' => 'Extended-Asm.html',
  20. 'OutputOperands.html' => 'Extended-Asm.html',
  21. 'PowerPC-Type-Attributes.html' => 'Type-Attributes.html',
  22. 'SPU-Type-Attributes.html' => 'Type-Attributes.html',
  23. 'Type_002dpunning.html' => 'Optimize-Options.html',
  24. 'Volatile.html' => 'Extended-Asm.html',
  25. 'Wtrigraphs.html' => 'Preprocessor-Options.html',
  26. 'x86-Type-Attributes.html' => 'Type-Attributes.html',
  27. 'x86-Variable-Attributes.html' => 'Variable-Attributes.html',
  28. 'x86floatingpointasmoperands.html' => 'Extended-Asm.html',
  29. 'x86Operandmodifiers.html' => 'Extended-Asm.html',
  30. 'Example-of-asm-with-clobbered-asm-reg.html' => 'Extended-Asm.html',
  31. 'Extended-asm-with-goto.html' => 'Extended-Asm.html',
  32. 'fdollars_002din_002didentifiers.html' => 'Preprocessor-Options.html',
  33. 'i386-Type-Attributes.html' => 'Variable-Attributes.html',
  34. 'i386-Variable-Attributes.html' => 'Variable-Attributes.html'
  35. }
  36. CPP_PATHS = {
  37. 'dashMF.html' => 'Invocation.html',
  38. 'fdollars_002din_002didentifiers.html' => 'Invocation.html',
  39. 'Identifier-characters.html' => 'Implementation_002ddefined-behavior.html',
  40. 'trigraphs.html' => 'Initial-processing.html',
  41. 'Wtrigraphs.html' => 'Invocation.html'
  42. }
  43. version '9' do
  44. self.release = '9.2.0'
  45. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
  46. end
  47. version '9 CPP' do
  48. self.release = '9.2.0'
  49. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
  50. options[:replace_paths] = CPP_PATHS
  51. end
  52. version '8' do
  53. self.release = '8.3.0'
  54. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
  55. end
  56. version '8 CPP' do
  57. self.release = '8.3.0'
  58. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
  59. options[:replace_paths] = CPP_PATHS
  60. end
  61. version '7' do
  62. self.release = '7.4.0'
  63. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
  64. end
  65. version '7 CPP' do
  66. self.release = '7.4.0'
  67. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
  68. options[:replace_paths] = CPP_PATHS
  69. end
  70. version '6' do
  71. self.release = '6.4.0'
  72. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
  73. options[:root_title] = 'Using the GNU Compiler Collection (GCC)'
  74. end
  75. version '6 CPP' do
  76. self.release = '6.4.0'
  77. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
  78. options[:replace_paths] = CPP_PATHS
  79. end
  80. version '5' do
  81. self.release = '5.4.0'
  82. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
  83. options[:root_title] = 'Using the GNU Compiler Collection (GCC)'
  84. end
  85. version '5 CPP' do
  86. self.release = '5.4.0'
  87. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
  88. options[:replace_paths] = CPP_PATHS
  89. end
  90. version '4' do
  91. self.release = '4.9.3'
  92. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
  93. options[:root_title] = 'Using the GNU Compiler Collection (GCC)'
  94. end
  95. version '4 CPP' do
  96. self.release = '4.9.3'
  97. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
  98. options[:replace_paths] = CPP_PATHS
  99. end
  100. def get_latest_version(opts)
  101. doc = fetch_doc('https://gcc.gnu.org/onlinedocs/', opts)
  102. label = doc.at_css('ul > li > ul > li > a').content.strip
  103. label.scan(/([0-9.]+)/)[0][0]
  104. end
  105. end
  106. end