commonmarker 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of commonmarker might be problematic. Click here for more details.

Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/ext/commonmarker/cmark/CMakeLists.txt +2 -2
  3. data/ext/commonmarker/cmark/api_test/main.c +98 -90
  4. data/ext/commonmarker/cmark/build/CMakeCache.txt +82 -59
  5. data/ext/commonmarker/cmark/build/CMakeFiles/3.3.2/CMakeCCompiler.cmake +6 -6
  6. data/ext/commonmarker/cmark/build/CMakeFiles/3.3.2/CMakeCXXCompiler.cmake +6 -6
  7. data/ext/commonmarker/cmark/build/CMakeFiles/3.3.2/CMakeDetermineCompilerABI_C.bin +0 -0
  8. data/ext/commonmarker/cmark/build/CMakeFiles/3.3.2/CMakeDetermineCompilerABI_CXX.bin +0 -0
  9. data/ext/commonmarker/cmark/build/CMakeFiles/3.3.2/CMakeSystem.cmake +4 -4
  10. data/ext/commonmarker/cmark/build/CMakeFiles/3.3.2/CompilerIdC/a.out +0 -0
  11. data/ext/commonmarker/cmark/build/CMakeFiles/3.3.2/CompilerIdCXX/a.out +0 -0
  12. data/ext/commonmarker/cmark/build/CMakeFiles/CMakeError.log +6 -7
  13. data/ext/commonmarker/cmark/build/CMakeFiles/CMakeOutput.log +216 -381
  14. data/ext/commonmarker/cmark/build/CMakeFiles/Makefile.cmake +69 -0
  15. data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.bin +0 -0
  16. data/ext/commonmarker/cmark/build/Makefile +1 -1
  17. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/build.make +10 -10
  18. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/flags.make +2 -2
  19. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/link.txt +1 -1
  20. data/ext/commonmarker/cmark/build/api_test/Makefile +1 -1
  21. data/ext/commonmarker/cmark/build/man/Makefile +1 -1
  22. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/build.make +60 -60
  23. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/flags.make +1 -1
  24. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/link.txt +1 -1
  25. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/DependInfo.cmake +1 -1
  26. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/build.make +80 -80
  27. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/cmake_clean.cmake +1 -1
  28. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/flags.make +1 -1
  29. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/link.txt +1 -1
  30. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/C.includecache +4 -0
  31. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/blocks.c.o +0 -0
  32. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/build.make +57 -57
  33. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmark.c.o +0 -0
  34. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/commonmark.c.o +0 -0
  35. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/flags.make +1 -1
  36. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/html.c.o +0 -0
  37. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/iterator.c.o +0 -0
  38. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/latex.c.o +0 -0
  39. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/link.txt +2 -2
  40. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/man.c.o +0 -0
  41. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/node.c.o +0 -0
  42. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/render.c.o +0 -0
  43. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/scanners.c.o +0 -0
  44. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/xml.c.o +0 -0
  45. data/ext/commonmarker/cmark/build/src/Makefile +1 -1
  46. data/ext/commonmarker/cmark/build/src/cmake_install.cmake +5 -5
  47. data/ext/commonmarker/cmark/build/src/cmark_version.h +2 -2
  48. data/ext/commonmarker/cmark/build/src/config.h +51 -0
  49. data/ext/commonmarker/cmark/build/src/libcmark.a +0 -0
  50. data/ext/commonmarker/cmark/build/src/libcmark.pc +1 -1
  51. data/ext/commonmarker/cmark/build/testdir/Makefile +1 -1
  52. data/ext/commonmarker/cmark/changelog.txt +54 -0
  53. data/ext/commonmarker/cmark/man/make_man_page.py +3 -1
  54. data/ext/commonmarker/cmark/man/man3/cmark.3 +114 -15
  55. data/ext/commonmarker/cmark/src/blocks.c +1 -5
  56. data/ext/commonmarker/cmark/src/chunk.h +4 -4
  57. data/ext/commonmarker/cmark/src/cmark.h +13 -7
  58. data/ext/commonmarker/cmark/src/commonmark.c +45 -27
  59. data/ext/commonmarker/cmark/src/config.h.in +51 -0
  60. data/ext/commonmarker/cmark/src/html.c +9 -7
  61. data/ext/commonmarker/cmark/src/iterator.c +3 -0
  62. data/ext/commonmarker/cmark/src/latex.c +4 -2
  63. data/ext/commonmarker/cmark/src/man.c +3 -2
  64. data/ext/commonmarker/cmark/src/node.c +10 -2
  65. data/ext/commonmarker/cmark/src/render.c +17 -5
  66. data/ext/commonmarker/cmark/src/scanners.c +10457 -16407
  67. data/ext/commonmarker/cmark/src/scanners.re +3 -3
  68. data/ext/commonmarker/cmark/src/xml.c +10 -7
  69. data/ext/commonmarker/cmark/test/smart_punct.txt +30 -30
  70. data/ext/commonmarker/cmark/test/spec.txt +2152 -1440
  71. data/ext/commonmarker/cmark/test/spec_tests.py +21 -17
  72. data/ext/commonmarker/cmark/wrappers/wrapper.py +1 -1
  73. data/lib/commonmarker/version.rb +1 -1
  74. data/test/test_helper.rb +23 -21
  75. data/test/test_smartpunct.rb +1 -1
  76. data/test/test_spec.rb +1 -1
  77. metadata +2 -11
  78. data/ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CMakeCCompiler.cmake +0 -55
  79. data/ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CMakeCXXCompiler.cmake +0 -56
  80. data/ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CMakeDetermineCompilerABI_C.bin +0 -0
  81. data/ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CMakeDetermineCompilerABI_CXX.bin +0 -0
  82. data/ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CMakeSystem.cmake +0 -15
  83. data/ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CompilerIdC/CMakeCCompilerId.c +0 -393
  84. data/ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CompilerIdC/a.out +0 -0
  85. data/ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CompilerIdCXX/CMakeCXXCompilerId.cpp +0 -375
  86. data/ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CompilerIdCXX/a.out +0 -0
@@ -90,29 +90,33 @@ def get_tests(specfile):
90
90
  with open(specfile, 'r', encoding='utf-8') as specf:
91
91
  for line in specf:
92
92
  line_number = line_number + 1
93
- if state == 0 and re.match(header_re, line):
94
- headertext = header_re.sub('', line).strip()
95
- if line.strip() == ".":
96
- state = (state + 1) % 3
97
- if state == 0:
98
- example_number = example_number + 1
99
- end_line = line_number
100
- tests.append({
101
- "markdown":''.join(markdown_lines).replace('→',"\t"),
102
- "html":''.join(html_lines).replace('→',"\t"),
103
- "example": example_number,
104
- "start_line": start_line,
105
- "end_line": end_line,
106
- "section": headertext})
107
- start_line = 0
108
- markdown_lines = []
109
- html_lines = []
93
+ l = line.strip()
94
+ if l == "`" * 32 + " example":
95
+ state = 1
96
+ elif l == "`" * 32:
97
+ state = 0
98
+ example_number = example_number + 1
99
+ end_line = line_number
100
+ tests.append({
101
+ "markdown":''.join(markdown_lines).replace('→',"\t"),
102
+ "html":''.join(html_lines).replace('→',"\t"),
103
+ "example": example_number,
104
+ "start_line": start_line,
105
+ "end_line": end_line,
106
+ "section": headertext})
107
+ start_line = 0
108
+ markdown_lines = []
109
+ html_lines = []
110
+ elif l == ".":
111
+ state = 2
110
112
  elif state == 1:
111
113
  if start_line == 0:
112
114
  start_line = line_number - 1
113
115
  markdown_lines.append(line)
114
116
  elif state == 2:
115
117
  html_lines.append(line)
118
+ elif state == 0 and re.match(header_re, line):
119
+ headertext = header_re.sub('', line).strip()
116
120
  return tests
117
121
 
118
122
  if __name__ == "__main__":
@@ -22,7 +22,7 @@ markdown = cmark.cmark_markdown_to_html
22
22
  markdown.restype = c_char_p
23
23
  markdown.argtypes = [c_char_p, c_long, c_long]
24
24
 
25
- opts = 8 # CMARK_OPT_PRETTY
25
+ opts = 0 # defaults
26
26
 
27
27
  def md2html(text):
28
28
  if sys.version_info >= (3,0):
@@ -1,3 +1,3 @@
1
1
  module CommonMarker
2
- VERSION = '0.6.0'
2
+ VERSION = '0.7.0'
3
3
  end
data/test/test_helper.rb CHANGED
@@ -6,7 +6,7 @@ include CommonMarker
6
6
 
7
7
  FIXTURES_DIR = File.join(File.dirname(__FILE__), 'fixtures')
8
8
 
9
- def open_spec_file(filename, options = {})
9
+ def open_spec_file(filename)
10
10
  line_number = 0
11
11
  start_line = 0
12
12
  end_line = 0
@@ -22,32 +22,34 @@ def open_spec_file(filename, options = {})
22
22
 
23
23
  File.readlines(filepath).each do |line|
24
24
  line_number += 1
25
- if state == 0 && header_re.match(line)
26
- headertext = line.sub(header_re, '').strip
27
- end
28
25
 
29
- if line.strip == '.'
30
- state = (state + 1) % 3
31
- if state == 0
32
- example_number += 1
33
- end_line = line_number
34
- tests << {
35
- :markdown => markdown_lines.join('').gsub('→', "\t"),
36
- :html => html_lines.join('').gsub('→', "\t").rstrip,
37
- :example => example_number,
38
- :start_line => start_line,
39
- :end_line => end_line,
40
- :section => headertext
41
- }
42
- start_line = 0
43
- markdown_lines = []
44
- html_lines = []
45
- end
26
+ l = line.strip
27
+ if l == '`' * 32 + ' example'
28
+ state = 1
29
+ elsif l == '`' * 32
30
+ state = 0
31
+ example_number += 1
32
+ end_line = line_number
33
+ tests << {
34
+ :markdown => markdown_lines.join('').tr('→', "\t"),
35
+ :html => html_lines.join('').tr('→', "\t").rstrip,
36
+ :example => example_number,
37
+ :start_line => start_line,
38
+ :end_line => end_line,
39
+ :section => headertext
40
+ }
41
+ start_line = 0
42
+ markdown_lines = []
43
+ html_lines = []
44
+ elsif l == '.'
45
+ state = 2
46
46
  elsif state == 1
47
47
  start_line = line_number - 1 if start_line == 0
48
48
  markdown_lines << "#{line}"
49
49
  elsif state == 2
50
50
  html_lines << "#{line}"
51
+ elsif state == 0 && header_re.match(line)
52
+ headertext = line.sub(header_re, '').strip
51
53
  end
52
54
  end
53
55
 
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class SmartPunctTest < Minitest::Test
4
- smart_punct = open_spec_file('smart_punct.txt', normalize: true)
4
+ smart_punct = open_spec_file('smart_punct.txt')
5
5
 
6
6
  smart_punct.each do |testcase|
7
7
  doc = CommonMarker.render_doc(testcase[:markdown], :smart)
data/test/test_spec.rb CHANGED
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
  require 'json'
3
3
 
4
4
  class TestSpec < Minitest::Test
5
- spec = open_spec_file('spec.txt', normalize: true)
5
+ spec = open_spec_file('spec.txt')
6
6
 
7
7
  spec.each do |testcase|
8
8
  # next unless testcase['example'] == 420
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commonmarker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-05 00:00:00.000000000 Z
11
+ date: 2016-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-enum
@@ -140,15 +140,6 @@ files:
140
140
  - ext/commonmarker/cmark/bench/stats.py
141
141
  - ext/commonmarker/cmark/benchmarks.md
142
142
  - ext/commonmarker/cmark/build/CMakeCache.txt
143
- - ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CMakeCCompiler.cmake
144
- - ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CMakeCXXCompiler.cmake
145
- - ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CMakeDetermineCompilerABI_C.bin
146
- - ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CMakeDetermineCompilerABI_CXX.bin
147
- - ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CMakeSystem.cmake
148
- - ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CompilerIdC/CMakeCCompilerId.c
149
- - ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CompilerIdC/a.out
150
- - ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CompilerIdCXX/CMakeCXXCompilerId.cpp
151
- - ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CompilerIdCXX/a.out
152
143
  - ext/commonmarker/cmark/build/CMakeFiles/3.3.2/CMakeCCompiler.cmake
153
144
  - ext/commonmarker/cmark/build/CMakeFiles/3.3.2/CMakeCXXCompiler.cmake
154
145
  - ext/commonmarker/cmark/build/CMakeFiles/3.3.2/CMakeDetermineCompilerABI_C.bin
@@ -1,55 +0,0 @@
1
- set(CMAKE_C_COMPILER "/usr/bin/cc")
2
- set(CMAKE_C_COMPILER_ARG1 "")
3
- set(CMAKE_C_COMPILER_ID "Clang")
4
- set(CMAKE_C_COMPILER_VERSION "7.0.0")
5
- set(CMAKE_C_PLATFORM_ID "Darwin")
6
-
7
- set(CMAKE_AR "/usr/bin/ar")
8
- set(CMAKE_RANLIB "/usr/bin/ranlib")
9
- set(CMAKE_LINKER "/usr/bin/ld")
10
- set(CMAKE_COMPILER_IS_GNUCC )
11
- set(CMAKE_C_COMPILER_LOADED 1)
12
- set(CMAKE_C_COMPILER_WORKS TRUE)
13
- set(CMAKE_C_ABI_COMPILED TRUE)
14
- set(CMAKE_COMPILER_IS_MINGW )
15
- set(CMAKE_COMPILER_IS_CYGWIN )
16
- if(CMAKE_COMPILER_IS_CYGWIN)
17
- set(CYGWIN 1)
18
- set(UNIX 1)
19
- endif()
20
-
21
- set(CMAKE_C_COMPILER_ENV_VAR "CC")
22
-
23
- if(CMAKE_COMPILER_IS_MINGW)
24
- set(MINGW 1)
25
- endif()
26
- set(CMAKE_C_COMPILER_ID_RUN 1)
27
- set(CMAKE_C_SOURCE_FILE_EXTENSIONS c)
28
- set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
29
- set(CMAKE_C_LINKER_PREFERENCE 10)
30
-
31
- # Save compiler ABI information.
32
- set(CMAKE_C_SIZEOF_DATA_PTR "8")
33
- set(CMAKE_C_COMPILER_ABI "")
34
- set(CMAKE_C_LIBRARY_ARCHITECTURE "")
35
-
36
- if(CMAKE_C_SIZEOF_DATA_PTR)
37
- set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
38
- endif()
39
-
40
- if(CMAKE_C_COMPILER_ABI)
41
- set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
42
- endif()
43
-
44
- if(CMAKE_C_LIBRARY_ARCHITECTURE)
45
- set(CMAKE_LIBRARY_ARCHITECTURE "")
46
- endif()
47
-
48
-
49
-
50
-
51
- set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/lib/darwin/libclang_rt.osx.a")
52
- set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "")
53
-
54
-
55
-
@@ -1,56 +0,0 @@
1
- set(CMAKE_CXX_COMPILER "/usr/bin/c++")
2
- set(CMAKE_CXX_COMPILER_ARG1 "")
3
- set(CMAKE_CXX_COMPILER_ID "Clang")
4
- set(CMAKE_CXX_COMPILER_VERSION "7.0.0")
5
- set(CMAKE_CXX_PLATFORM_ID "Darwin")
6
-
7
- set(CMAKE_AR "/usr/bin/ar")
8
- set(CMAKE_RANLIB "/usr/bin/ranlib")
9
- set(CMAKE_LINKER "/usr/bin/ld")
10
- set(CMAKE_COMPILER_IS_GNUCXX )
11
- set(CMAKE_CXX_COMPILER_LOADED 1)
12
- set(CMAKE_CXX_COMPILER_WORKS TRUE)
13
- set(CMAKE_CXX_ABI_COMPILED TRUE)
14
- set(CMAKE_COMPILER_IS_MINGW )
15
- set(CMAKE_COMPILER_IS_CYGWIN )
16
- if(CMAKE_COMPILER_IS_CYGWIN)
17
- set(CYGWIN 1)
18
- set(UNIX 1)
19
- endif()
20
-
21
- set(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
22
-
23
- if(CMAKE_COMPILER_IS_MINGW)
24
- set(MINGW 1)
25
- endif()
26
- set(CMAKE_CXX_COMPILER_ID_RUN 1)
27
- set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
28
- set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP)
29
- set(CMAKE_CXX_LINKER_PREFERENCE 30)
30
- set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
31
-
32
- # Save compiler ABI information.
33
- set(CMAKE_CXX_SIZEOF_DATA_PTR "8")
34
- set(CMAKE_CXX_COMPILER_ABI "")
35
- set(CMAKE_CXX_LIBRARY_ARCHITECTURE "")
36
-
37
- if(CMAKE_CXX_SIZEOF_DATA_PTR)
38
- set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}")
39
- endif()
40
-
41
- if(CMAKE_CXX_COMPILER_ABI)
42
- set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}")
43
- endif()
44
-
45
- if(CMAKE_CXX_LIBRARY_ARCHITECTURE)
46
- set(CMAKE_LIBRARY_ARCHITECTURE "")
47
- endif()
48
-
49
-
50
-
51
-
52
- set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "c++;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/lib/darwin/libclang_rt.osx.a")
53
- set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "")
54
-
55
-
56
-
@@ -1,15 +0,0 @@
1
-
2
-
3
- set(CMAKE_SYSTEM "Darwin-14.5.0")
4
- set(CMAKE_SYSTEM_NAME "Darwin")
5
- set(CMAKE_SYSTEM_VERSION "14.5.0")
6
- set(CMAKE_SYSTEM_PROCESSOR "i386")
7
-
8
- set(CMAKE_HOST_SYSTEM "Darwin-14.5.0")
9
- set(CMAKE_HOST_SYSTEM_NAME "Darwin")
10
- set(CMAKE_HOST_SYSTEM_VERSION "14.5.0")
11
- set(CMAKE_HOST_SYSTEM_PROCESSOR "i386")
12
-
13
- set(CMAKE_CROSSCOMPILING "FALSE")
14
-
15
- set(CMAKE_SYSTEM_LOADED 1)
@@ -1,393 +0,0 @@
1
- #ifdef __cplusplus
2
- # error "A C++ compiler has been selected for C."
3
- #endif
4
-
5
- /* Version number components: V=Version, R=Revision, P=Patch
6
- Version date components: YYYY=Year, MM=Month, DD=Day */
7
-
8
- #if defined(__18CXX)
9
- # define ID_VOID_MAIN
10
- #endif
11
-
12
- #if defined(__INTEL_COMPILER) || defined(__ICC)
13
- # define COMPILER_ID "Intel"
14
- /* __INTEL_COMPILER = VRP */
15
- # define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
16
- # define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
17
- # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
18
- # if defined(__INTEL_COMPILER_BUILD_DATE)
19
- /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
20
- # define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
21
- # endif
22
-
23
- #elif defined(__PATHCC__)
24
- # define COMPILER_ID "PathScale"
25
- # define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
26
- # define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
27
- # if defined(__PATHCC_PATCHLEVEL__)
28
- # define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
29
- # endif
30
-
31
- #elif defined(__clang__)
32
- # define COMPILER_ID "Clang"
33
- # define COMPILER_VERSION_MAJOR DEC(__clang_major__)
34
- # define COMPILER_VERSION_MINOR DEC(__clang_minor__)
35
- # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
36
-
37
- #elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
38
- # define COMPILER_ID "Embarcadero"
39
- # define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
40
- # define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
41
- # define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF)
42
-
43
- #elif defined(__BORLANDC__)
44
- # define COMPILER_ID "Borland"
45
- /* __BORLANDC__ = 0xVRR */
46
- # define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
47
- # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
48
-
49
- #elif defined(__WATCOMC__)
50
- # define COMPILER_ID "Watcom"
51
- /* __WATCOMC__ = VVRR */
52
- # define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
53
- # define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100)
54
-
55
- #elif defined(__SUNPRO_C)
56
- # define COMPILER_ID "SunPro"
57
- # if __SUNPRO_C >= 0x5100
58
- /* __SUNPRO_C = 0xVRRP */
59
- # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12)
60
- # define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF)
61
- # define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
62
- # else
63
- /* __SUNPRO_C = 0xVRP */
64
- # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8)
65
- # define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF)
66
- # define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
67
- # endif
68
-
69
- #elif defined(__HP_cc)
70
- # define COMPILER_ID "HP"
71
- /* __HP_cc = VVRRPP */
72
- # define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000)
73
- # define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100)
74
- # define COMPILER_VERSION_PATCH DEC(__HP_cc % 100)
75
-
76
- #elif defined(__DECC)
77
- # define COMPILER_ID "Compaq"
78
- /* __DECC_VER = VVRRTPPPP */
79
- # define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000)
80
- # define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100)
81
- # define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000)
82
-
83
- #elif defined(__IBMC__)
84
- # if defined(__COMPILER_VER__)
85
- # define COMPILER_ID "zOS"
86
- # else
87
- # if __IBMC__ >= 800
88
- # define COMPILER_ID "XL"
89
- # else
90
- # define COMPILER_ID "VisualAge"
91
- # endif
92
- /* __IBMC__ = VRP */
93
- # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
94
- # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
95
- # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
96
- # endif
97
-
98
- #elif defined(__PGI)
99
- # define COMPILER_ID "PGI"
100
- # define COMPILER_VERSION_MAJOR DEC(__PGIC__)
101
- # define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
102
- # if defined(__PGIC_PATCHLEVEL__)
103
- # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
104
- # endif
105
-
106
- #elif defined(_CRAYC)
107
- # define COMPILER_ID "Cray"
108
- # define COMPILER_VERSION_MAJOR DEC(_RELEASE)
109
- # define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
110
-
111
- #elif defined(__TI_COMPILER_VERSION__)
112
- # define COMPILER_ID "TI_DSP"
113
- /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
114
- # define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
115
- # define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
116
- # define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
117
-
118
- #elif defined(__TINYC__)
119
- # define COMPILER_ID "TinyCC"
120
-
121
- #elif defined(__SCO_VERSION__)
122
- # define COMPILER_ID "SCO"
123
-
124
- #elif defined(__GNUC__)
125
- # define COMPILER_ID "GNU"
126
- # define COMPILER_VERSION_MAJOR DEC(__GNUC__)
127
- # define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
128
- # if defined(__GNUC_PATCHLEVEL__)
129
- # define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
130
- # endif
131
-
132
- #elif defined(_MSC_VER)
133
- # define COMPILER_ID "MSVC"
134
- /* _MSC_VER = VVRR */
135
- # define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
136
- # define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
137
- # if defined(_MSC_FULL_VER)
138
- # if _MSC_VER >= 1400
139
- /* _MSC_FULL_VER = VVRRPPPPP */
140
- # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
141
- # else
142
- /* _MSC_FULL_VER = VVRRPPPP */
143
- # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
144
- # endif
145
- # endif
146
- # if defined(_MSC_BUILD)
147
- # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
148
- # endif
149
-
150
- /* Analog VisualDSP++ >= 4.5.6 */
151
- #elif defined(__VISUALDSPVERSION__)
152
- # define COMPILER_ID "ADSP"
153
- /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
154
- # define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
155
- # define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
156
- # define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
157
-
158
- /* Analog VisualDSP++ < 4.5.6 */
159
- #elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
160
- # define COMPILER_ID "ADSP"
161
-
162
- /* IAR Systems compiler for embedded systems.
163
- http://www.iar.com
164
- Not supported yet by CMake
165
- #elif defined(__IAR_SYSTEMS_ICC__)
166
- # define COMPILER_ID "IAR" */
167
-
168
- /* sdcc, the small devices C compiler for embedded systems,
169
- http://sdcc.sourceforge.net */
170
- #elif defined(SDCC)
171
- # define COMPILER_ID "SDCC"
172
- /* SDCC = VRP */
173
- # define COMPILER_VERSION_MAJOR DEC(SDCC/100)
174
- # define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
175
- # define COMPILER_VERSION_PATCH DEC(SDCC % 10)
176
-
177
- #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
178
- # define COMPILER_ID "MIPSpro"
179
- # if defined(_SGI_COMPILER_VERSION)
180
- /* _SGI_COMPILER_VERSION = VRP */
181
- # define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
182
- # define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
183
- # define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10)
184
- # else
185
- /* _COMPILER_VERSION = VRP */
186
- # define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
187
- # define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
188
- # define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10)
189
- # endif
190
-
191
- /* This compiler is either not known or is too old to define an
192
- identification macro. Try to identify the platform and guess that
193
- it is the native compiler. */
194
- #elif defined(__sgi)
195
- # define COMPILER_ID "MIPSpro"
196
-
197
- #elif defined(__hpux) || defined(__hpua)
198
- # define COMPILER_ID "HP"
199
-
200
- #else /* unknown compiler */
201
- # define COMPILER_ID ""
202
-
203
- #endif
204
-
205
- /* Construct the string literal in pieces to prevent the source from
206
- getting matched. Store it in a pointer rather than an array
207
- because some compilers will just produce instructions to fill the
208
- array rather than assigning a pointer to a static array. */
209
- char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
210
-
211
- /* Identify known platforms by name. */
212
- #if defined(__linux) || defined(__linux__) || defined(linux)
213
- # define PLATFORM_ID "Linux"
214
-
215
- #elif defined(__CYGWIN__)
216
- # define PLATFORM_ID "Cygwin"
217
-
218
- #elif defined(__MINGW32__)
219
- # define PLATFORM_ID "MinGW"
220
-
221
- #elif defined(__APPLE__)
222
- # define PLATFORM_ID "Darwin"
223
-
224
- #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
225
- # define PLATFORM_ID "Windows"
226
-
227
- #elif defined(__FreeBSD__) || defined(__FreeBSD)
228
- # define PLATFORM_ID "FreeBSD"
229
-
230
- #elif defined(__NetBSD__) || defined(__NetBSD)
231
- # define PLATFORM_ID "NetBSD"
232
-
233
- #elif defined(__OpenBSD__) || defined(__OPENBSD)
234
- # define PLATFORM_ID "OpenBSD"
235
-
236
- #elif defined(__sun) || defined(sun)
237
- # define PLATFORM_ID "SunOS"
238
-
239
- #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
240
- # define PLATFORM_ID "AIX"
241
-
242
- #elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
243
- # define PLATFORM_ID "IRIX"
244
-
245
- #elif defined(__hpux) || defined(__hpux__)
246
- # define PLATFORM_ID "HP-UX"
247
-
248
- #elif defined(__HAIKU) || defined(__HAIKU__) || defined(_HAIKU)
249
- # define PLATFORM_ID "Haiku"
250
- /* Haiku also defines __BEOS__ so we must
251
- put it prior to the check for __BEOS__
252
- */
253
-
254
- #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
255
- # define PLATFORM_ID "BeOS"
256
-
257
- #elif defined(__QNX__) || defined(__QNXNTO__)
258
- # define PLATFORM_ID "QNX"
259
-
260
- #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
261
- # define PLATFORM_ID "Tru64"
262
-
263
- #elif defined(__riscos) || defined(__riscos__)
264
- # define PLATFORM_ID "RISCos"
265
-
266
- #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
267
- # define PLATFORM_ID "SINIX"
268
-
269
- #elif defined(__UNIX_SV__)
270
- # define PLATFORM_ID "UNIX_SV"
271
-
272
- #elif defined(__bsdos__)
273
- # define PLATFORM_ID "BSDOS"
274
-
275
- #elif defined(_MPRAS) || defined(MPRAS)
276
- # define PLATFORM_ID "MP-RAS"
277
-
278
- #elif defined(__osf) || defined(__osf__)
279
- # define PLATFORM_ID "OSF1"
280
-
281
- #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
282
- # define PLATFORM_ID "SCO_SV"
283
-
284
- #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
285
- # define PLATFORM_ID "ULTRIX"
286
-
287
- #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
288
- # define PLATFORM_ID "Xenix"
289
-
290
- #else /* unknown platform */
291
- # define PLATFORM_ID ""
292
-
293
- #endif
294
-
295
- /* For windows compilers MSVC and Intel we can determine
296
- the architecture of the compiler being used. This is because
297
- the compilers do not have flags that can change the architecture,
298
- but rather depend on which compiler is being used
299
- */
300
- #if defined(_WIN32) && defined(_MSC_VER)
301
- # if defined(_M_IA64)
302
- # define ARCHITECTURE_ID "IA64"
303
-
304
- # elif defined(_M_X64) || defined(_M_AMD64)
305
- # define ARCHITECTURE_ID "x64"
306
-
307
- # elif defined(_M_IX86)
308
- # define ARCHITECTURE_ID "X86"
309
-
310
- # elif defined(_M_ARM)
311
- # define ARCHITECTURE_ID "ARM"
312
-
313
- # elif defined(_M_MIPS)
314
- # define ARCHITECTURE_ID "MIPS"
315
-
316
- # elif defined(_M_SH)
317
- # define ARCHITECTURE_ID "SHx"
318
-
319
- # else /* unknown architecture */
320
- # define ARCHITECTURE_ID ""
321
- # endif
322
-
323
- #else
324
- # define ARCHITECTURE_ID ""
325
- #endif
326
-
327
- /* Convert integer to decimal digit literals. */
328
- #define DEC(n) \
329
- ('0' + (((n) / 10000000)%10)), \
330
- ('0' + (((n) / 1000000)%10)), \
331
- ('0' + (((n) / 100000)%10)), \
332
- ('0' + (((n) / 10000)%10)), \
333
- ('0' + (((n) / 1000)%10)), \
334
- ('0' + (((n) / 100)%10)), \
335
- ('0' + (((n) / 10)%10)), \
336
- ('0' + ((n) % 10))
337
-
338
- /* Convert integer to hex digit literals. */
339
- #define HEX(n) \
340
- ('0' + ((n)>>28 & 0xF)), \
341
- ('0' + ((n)>>24 & 0xF)), \
342
- ('0' + ((n)>>20 & 0xF)), \
343
- ('0' + ((n)>>16 & 0xF)), \
344
- ('0' + ((n)>>12 & 0xF)), \
345
- ('0' + ((n)>>8 & 0xF)), \
346
- ('0' + ((n)>>4 & 0xF)), \
347
- ('0' + ((n) & 0xF))
348
-
349
- /* Construct a string literal encoding the version number components. */
350
- #ifdef COMPILER_VERSION_MAJOR
351
- char const info_version[] = {
352
- 'I', 'N', 'F', 'O', ':',
353
- 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
354
- COMPILER_VERSION_MAJOR,
355
- # ifdef COMPILER_VERSION_MINOR
356
- '.', COMPILER_VERSION_MINOR,
357
- # ifdef COMPILER_VERSION_PATCH
358
- '.', COMPILER_VERSION_PATCH,
359
- # ifdef COMPILER_VERSION_TWEAK
360
- '.', COMPILER_VERSION_TWEAK,
361
- # endif
362
- # endif
363
- # endif
364
- ']','\0'};
365
- #endif
366
-
367
- /* Construct the string literal in pieces to prevent the source from
368
- getting matched. Store it in a pointer rather than an array
369
- because some compilers will just produce instructions to fill the
370
- array rather than assigning a pointer to a static array. */
371
- char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
372
- char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
373
-
374
-
375
-
376
- /*--------------------------------------------------------------------------*/
377
-
378
- #ifdef ID_VOID_MAIN
379
- void main() {}
380
- #else
381
- int main(int argc, char* argv[])
382
- {
383
- int require = 0;
384
- require += info_compiler[argc];
385
- require += info_platform[argc];
386
- require += info_arch[argc];
387
- #ifdef COMPILER_VERSION_MAJOR
388
- require += info_version[argc];
389
- #endif
390
- (void)argv;
391
- return require;
392
- }
393
- #endif