gcc.rb 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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 '14' do
  44. self.release = '14.2.0'
  45. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
  46. end
  47. version '14 CPP' do
  48. self.release = '14.2.0'
  49. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
  50. end
  51. version '13' do
  52. self.release = '13.3.0'
  53. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
  54. end
  55. version '13 CPP' do
  56. self.release = '13.3.0'
  57. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
  58. end
  59. version '12' do
  60. self.release = '12.2.0'
  61. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
  62. end
  63. version '12 CPP' do
  64. self.release = '12.1.0'
  65. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
  66. end
  67. version '11' do
  68. self.release = '11.4.0'
  69. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
  70. end
  71. version '11 CPP' do
  72. self.release = '11.4.0'
  73. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
  74. end
  75. version '10' do
  76. self.release = '10.5.0'
  77. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
  78. end
  79. version '10 CPP' do
  80. self.release = '10.5.0'
  81. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
  82. end
  83. version '9' do
  84. self.release = '9.5.0'
  85. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
  86. end
  87. version '9 CPP' do
  88. self.release = '9.5.0'
  89. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
  90. options[:replace_paths] = CPP_PATHS
  91. end
  92. version '8' do
  93. self.release = '8.5.0'
  94. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
  95. end
  96. version '8 CPP' do
  97. self.release = '8.5.0'
  98. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
  99. options[:replace_paths] = CPP_PATHS
  100. end
  101. version '7' do
  102. self.release = '7.5.0'
  103. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
  104. end
  105. version '7 CPP' do
  106. self.release = '7.5.0'
  107. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
  108. options[:replace_paths] = CPP_PATHS
  109. end
  110. version '6' do
  111. self.release = '6.5.0'
  112. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
  113. options[:root_title] = 'Using the GNU Compiler Collection (GCC)'
  114. end
  115. version '6 CPP' do
  116. self.release = '6.5.0'
  117. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
  118. options[:replace_paths] = CPP_PATHS
  119. end
  120. version '5' do
  121. self.release = '5.5.0'
  122. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
  123. options[:root_title] = 'Using the GNU Compiler Collection (GCC)'
  124. end
  125. version '5 CPP' do
  126. self.release = '5.5.0'
  127. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
  128. options[:replace_paths] = CPP_PATHS
  129. end
  130. version '4' do
  131. self.release = '4.9.4'
  132. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
  133. options[:root_title] = 'Using the GNU Compiler Collection (GCC)'
  134. end
  135. version '4 CPP' do
  136. self.release = '4.9.4'
  137. self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
  138. options[:replace_paths] = CPP_PATHS
  139. end
  140. def get_latest_version(opts)
  141. doc = fetch_doc('https://gcc.gnu.org/onlinedocs/', opts)
  142. label = doc.at_css('details > ul > li > a')['href'].strip
  143. label.scan(/([0-9.]+)/)[2..-1][0][0]
  144. end
  145. end
  146. end