Compare commits

...

116 Commits

Author SHA1 Message Date
Marc Poulhiès f63536c5ce squashed gccdump support 5 years ago
Marc Poulhiès cfefa37387 Initial support for GCC Tree/RTL dumps. 5 years ago
Marc Poulhiès 37bbbcfcbf rebase over master 5 years ago
Marc Poulhiès c2a3a68123 fixup! fixup! hopefully the last one... 5 years ago
Marc Poulhiès 6a4e4fb834 fixup! hopefully the last one... 5 years ago
Marc Poulhiès 0fbe1c827d hopefully the last one... 5 years ago
Marc Poulhiès 8bf2c18c50 Dirty WIP 2, should fix all known issues. 5 years ago
Marc Poulhiès 9e60050cee Dirty WIP on state save/restore. 5 years ago
Marc Poulhiès 087289db8e fixup! Initial support for GCC Tree/RTL dumps. 5 years ago
Marc Poulhiès 940a8beb80 Initial support for GCC Tree/RTL dumps. 5 years ago
Matt Godbolt 577c3454c1
Merge pull request #619 from jsheard/ispc192 5 years ago
Matt Godbolt 616652ab78
Merge pull request #621 from dkm/asm-fix 5 years ago
Marc Poulhiès 9784aa54bf Better handling of assignments in assembly 5 years ago
Marc Poulhiès 6fb59802a0 initial series 5 years ago
Joshua Sheard 224b7cce7d ISPC 1.9.2 5 years ago
RabsRincon 3a6acdb835
Add option to reset LruCache for each compiler 5 years ago
Marc Poulhiès 63f0c13aa7 fixup! fixup! hopefully the last one... 5 years ago
Marc Poulhiès 17ee626618 fixup! hopefully the last one... 5 years ago
Marc Poulhiès 5836e024ff hopefully the last one... 5 years ago
Marc Poulhiès e0f132af91 Dirty WIP 2, should fix all known issues. 5 years ago
Marc Poulhiès 0d34ffd379 Dirty WIP on state save/restore. 5 years ago
Marc Poulhiès 9ed3749e7f fixup! Initial support for GCC Tree/RTL dumps. 5 years ago
Marc Poulhiès a1d0d45c6a Initial support for GCC Tree/RTL dumps. 5 years ago
Matt Godbolt 44ba96bd8b Show OS name for embedded ARM compilers. c.f. #279 5 years ago
Matt Godbolt f0da33f66e Undo unnecessary intel shenanigans 5 years ago
Matt Godbolt c214dac2d0 Config for icc18 5 years ago
Matt Godbolt 6faada8d79 Hack for intel licenses 5 years ago
Matt Godbolt 91c010edbe Fix up travis 5 years ago
Matt Godbolt bbd6f0d600 Clarify readme 5 years ago
Matt Godbolt 43c16a1238 Bump minimum node to v8 5 years ago
Matt Godbolt 13b2acd365
Merge pull request #611 from JohanEngelen/patch-1 5 years ago
Johan Engelen 3f21fd73e7
D: Add LDC 1.5.0 and make it the default. 5 years ago
RabsRincon fb4f5371aa
Remove unused variable 5 years ago
Matt Godbolt ebb5aeeb07
Merge pull request #603 from AndrewPardoe/master 5 years ago
Andrew Pardoe c443cb149b
Update app.js 5 years ago
Andrew Pardoe 0ace5fb84b Add explicit WSL option 5 years ago
Rubén cbe0dbc692 Fix Kvasir include paths 5 years ago
Matt Godbolt 6f718f4e70 More thanks 5 years ago
Matt Godbolt d7040b2ced New attempt at running the haskell demangler 5 years ago
Matt Godbolt c82fa1db32 Place a git_hash within the archive, and use it in place of git rev-parse 5 years ago
Matt Godbolt f4f400adcf Remove .orig 5 years ago
Matt Godbolt d62ff479fe Attempt two at building on all branches 5 years ago
Matt Godbolt 062a72633e Build for all branches 5 years ago
Matt Godbolt 56e53dc1c5 Name tweaks 5 years ago
Matt Godbolt fe4f2fafe1 Tweaks for deployment 5 years ago
Matt Godbolt 3ff8cec015 Re-enable gdc and ghc for travis 5 years ago
Matt Godbolt 78e42a76ad Quieten down the rust install 5 years ago
Matt Godbolt 8d85986b01 Temporarily disable ghc and gdc for travis builds 5 years ago
Matt Godbolt deed95f3b9 Put ghc on a diet 5 years ago
Matt Godbolt 5acb292393 Fix typo 5 years ago
Matt Godbolt 3b58957c87 Put temp files within build structure 5 years ago
Matt Godbolt 6d4d33f109 First attempt at getting travis to build and upload images to S3 5 years ago
Matt Godbolt a3a1f55602 Reduce the amount of rust gunk that makes it into the distribution tarball 5 years ago
Rubén 0260e0e33f Update Monaco to latest version 5 years ago
Rubén f691aaea78 Finish up Chedy's PR 5 years ago
Rubén 12c302fa3b Merge pull request #587 from cppchedy/master 5 years ago
cppchedy 0f3f24ffa2 remove comment 5 years ago
cppchedy 5cec77a499 remove if statment 5 years ago
cppchedy e9750a36ac remove Alert 5 years ago
cppchedy e59041ebe7 Merge branch 'master' of https://github.com/cppchedy/compiler-explorer 5 years ago
cppchedy 94815bb1b9 address review cpmments on message display and filter data transfer 5 years ago
cppchedy 1bb818869f Merge branch 'master' of https://github.com/mattgodbolt/compiler-explorer 5 years ago
Rubén 368dd7e7d4 Merge branch 'master' into master 5 years ago
Rubén c7dd63df65 Run formatter on compiler.js and explorer.css 5 years ago
Rubén be83a8c283 Undo rename 5 years ago
Rubén 85a392fdcf Split libs in columns of 5 5 years ago
Rubén c6838692f7 Remove dubg line 5 years ago
Rubén e7a31d7a2c Fix sentry issues #363288884 & #370010523 5 years ago
Matt Godbolt d0d9e1f18d Ban `-include` in the options 5 years ago
cppchedy 7cf0eaf2f1 fix of function filter 5 years ago
cppchedy 9a848af892 corrected cfg button state 5 years ago
cppchedy 645943a449 adress review comments 5 years ago
Matt Godbolt 71b9d19c3f Add DLib to the library list (See #589) 5 years ago
Matt Godbolt d519c96441 Rust 1.21 (see #588) 5 years ago
Rubén 7836188bc9 Add ranges-v3 5 years ago
cppchedy 28be8e933f show not supported massage instead of closing 5 years ago
cppchedy 4244f0ff91 revert package.json 5 years ago
cppchedy b956fe2b47 add semicolon 5 years ago
cppchedy b804e0b5bd desactivate Cfg mode when binary filter is set 5 years ago
cppchedy e592d33808 Merge branch 'master' of https://github.com/mattgodbolt/compiler-explorer 5 years ago
Rubén 12fe135a4b Let IE users use CE again 5 years ago
Rubén 9857ea356e Merge pull request #579 from 9il/patch-3 5 years ago
Ilya Yaroshenko 8e8c85a114 Update d.amazon.properties 5 years ago
Matt Godbolt 3755265902 Create contributing guidelines 5 years ago
Matt Godbolt ebecea3ff3 Fix up bad changelog formatting 5 years ago
Matt Godbolt f7f0be7709 Changelog update 5 years ago
Rubén f578877096 Finish adding D examples 5 years ago
Rubén 6f7a4b8b4a Add D examples and beautify all examples names 5 years ago
Matt Godbolt ec6378db10 Fix typo in gbench path 5 years ago
Rubén 4e8752fd73 Remove unused component getter 5 years ago
Rubén f150526715 Finish up cfg fixes and improvements 5 years ago
Rubén 9cd3b1dd22 Remove highlight when mouse is over a non sourced file 5 years ago
Rubén f8cb1a58ff Improve minor things in cfg code 5 years ago
Rubén b4adcab8c2 Update styling convention 5 years ago
Matt Godbolt 6b13bb1e85 Add trunk Eigen, and add Google benchmark. Closes #578 5 years ago
Ilya Yaroshenko 9938aa7dc1 update mir-algorithm version 5 years ago
Matt Godbolt 96bacaab8e Add Eigen 3.3.4 (closes #552) 5 years ago
Matt Godbolt fe644a1896 Merge pull request #569 from hanickadot/master 5 years ago
Hana Dusíková 4c387da9a8 Added "compile time regular expression" header library. 5 years ago
Matt Godbolt e1229ec79d Revert "Use same version of lru cache on server as client" 5 years ago
Matt Godbolt a6199453d0 Revert "Fixes up include paths for lru" 5 years ago
Matt Godbolt 2147e9a6fc Fixes up include paths for lru 5 years ago
Matt Godbolt e00d24da8a Use same version of lru cache on server as client 5 years ago
Rubén 30999e9062 Remove non-standard keywords and add missing ones 5 years ago
Rubén 7c9f6af470 Bump lru-cache version. 5 years ago
Rubén dd2355678f Remove sneaky file 5 years ago
Rubén 393cd975ef Fix off-by-one error 5 years ago
Rubén d0ab37557e Fix sentry issue #363237203 5 years ago
Matt Godbolt 42b792b434 `ref` is not a keyword. Fixes #567 5 years ago
cppchedy 0a65cd14c5 Merge branch 'master' of https://github.com/mattgodbolt/compiler-explorer 5 years ago
cppchedy 5fae0c9894 merge 5 years ago
Matt Godbolt 9a3d1f8556 Add a healthcheck endpoint. Closes #563 5 years ago
Matt Godbolt e108116d52 Fix up possible merge problem 5 years ago
cppchedy cf28e93a3f Merge branch 'master' of https://github.com/mattgodbolt/compiler-explorer 5 years ago
cppchedy ada06a1323 Merge branch 'master' of https://github.com/mattgodbolt/compiler-explorer 5 years ago
cppchedy 6231b73ad2 minor changes 5 years ago
  1. 1
      .bowerrc
  2. 0
      .gdb_history
  3. 10
      .gitignore
  4. 3
      .idea/.gitignore
  5. 19
      .idea/codeStyleSettings.xml
  6. 11
      .idea/compiler-explorer.iml
  7. 22
      .idea/compiler.xml
  8. 3
      .idea/copyright/profiles_settings.xml
  9. 4
      .idea/deployment.xml
  10. 6
      .idea/encodings.xml
  11. 7
      .idea/jsLibraryMappings.xml
  12. 85
      .idea/jsLinters/jshint.xml
  13. 21
      .idea/libraries/Cargo__rustfilt_.xml
  14. 16
      .idea/libraries/Rust__rustfilt_.xml
  15. 10
      .idea/misc.xml
  16. 9
      .idea/modules.xml
  17. 5
      .idea/scopes/scope_settings.xml
  18. 6
      .idea/vcs.xml
  19. 4
      .idea/watcherTasks.xml
  20. 14
      .idea/webResources.xml
  21. 4
      .jshintrc
  22. 7
      .travis.yml
  23. 28
      CODEOWNERS
  24. 46
      CODE_OF_CONDUCT.md
  25. 23
      LICENSE
  26. 108
      Makefile
  27. 135
      README.md
  28. 76
      Roadmap.md
  29. 19
      app.build.js
  30. 647
      app.js
  31. 1
      base
  32. 36
      bower.json
  33. 1
      c-preload/.gitignore
  34. 27
      c-preload/Makefile
  35. 21
      c-preload/compiler-wrapper
  36. 146
      c-preload/preload.c
  37. 2
      c-preload/tests/bad-includes
  38. 1
      c-preload/tests/bad-includes2
  39. 1
      c-preload/tests/bad-includes3
  40. 6
      c-preload/tests/testfile
  41. 1
      d/.gitignore
  42. 14
      d/Makefile
  43. 56
      d/demangle.d
  44. 1
      etc/config/asm-docs.amazon.properties
  45. 1
      etc/config/asm-docs.defaults.properties
  46. 4
      etc/config/aws.danger.properties
  47. 4
      etc/config/aws.lud-ldnmg01.properties
  48. 2
      etc/config/builtin.go.properties
  49. 2
      etc/config/builtin.haskell.properties
  50. 2
      etc/config/builtin.ispc.properties
  51. 2
      etc/config/builtin.rust.properties
  52. 2
      etc/config/builtin.swift.properties
  53. 275
      etc/config/c++.amazon.properties
  54. 11
      etc/config/c++.amazon.win32.properties
  55. 14
      etc/config/c++.cppx.properties
  56. 43
      etc/config/c++.danger.properties
  57. 41
      etc/config/c++.defaults.properties
  58. 36
      etc/config/c++.lud-mgodbolt01.properties
  59. 2
      etc/config/c++.win32.properties
  60. 23
      etc/config/c++.wud-mgodbolt01.properties
  61. 14
      etc/config/compiler-explorer.amazon.properties
  62. 1
      etc/config/compiler-explorer.amazon.win32.properties
  63. 3
      etc/config/compiler-explorer.beta.properties
  64. 1
      etc/config/compiler-explorer.danger.properties
  65. 17
      etc/config/compiler-explorer.defaults.properties
  66. 7
      etc/config/compiler-explorer.lud-mgodbolt01.properties
  67. 13
      etc/config/compiler-explorer.wud-mgodbolt01.properties
  68. 53
      etc/config/d.amazon.properties
  69. 14
      etc/config/d.defaults.properties
  70. 1
      etc/config/execution.amazon.properties
  71. 1
      etc/config/execution.defaults.properties
  72. 23
      etc/config/go.amazon.properties
  73. 12
      etc/config/go.defaults.properties
  74. 7
      etc/config/go.lud-ldnmg01.properties
  75. 8
      etc/config/go.lud-mgodbolt01.properties
  76. 11
      etc/config/haskell.amazon.properties
  77. 11
      etc/config/haskell.defaults.properties
  78. 11
      etc/config/ispc.amazon.properties
  79. 10
      etc/config/ispc.defaults.properties
  80. 58
      etc/config/rust.amazon.properties
  81. 15
      etc/config/rust.defaults.properties
  82. 1
      etc/config/rust.wud-mgodbolt01.properties
  83. 11
      etc/config/swift.amazon.properties
  84. 12
      etc/config/swift.defaults.properties
  85. 6
      etc/oldhash.txt
  86. 10
      etc/scripts/cl19_amd.bat
  87. 10
      etc/scripts/cl19_x86.bat
  88. 184
      etc/scripts/docenizer.py
  89. 5
      examples/c++/max_array.cpp
  90. 8
      examples/c++/max_array_opt.cpp
  91. 7
      examples/c++/sum_over_array.cpp
  92. 25
      examples/c++/sum_over_array_opt.cpp
  93. 11
      examples/go/max_array.go
  94. 5
      examples/haskell/sumOverArray.hs
  95. 9
      examples/ispc/max_array.ispc
  96. 7
      examples/ispc/sum_array.ispc
  97. 5
      examples/rust/max_array.rs
  98. 12
      examples/rust/max_array_opt.rs
  99. 3
      examples/rust/sum_over_array.rs
  100. 9
      examples/rust/sum_over_array_opt.rs
  101. Some files were not shown because too many files have changed in this diff Show More

1
.bowerrc

@ -1 +0,0 @@
{ "directory": "static/ext" }

0
.gdb_history

10
.gitignore vendored

@ -1,10 +0,0 @@
*.swp
/node_modules
/.npm-updated
/.bower-updated
*.vscode
/out
*.heapsnapshot
etc/config/*.local.properties
/nbproject
/package-lock.json

3
.idea/.gitignore vendored

@ -1,3 +0,0 @@
/.name
/workspace.xml
/xtextAutoBuilderState.xml

19
.idea/codeStyleSettings.xml

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<MarkdownNavigatorCodeStyleSettings>
<option name="RIGHT_MARGIN" value="72" />
</MarkdownNavigatorCodeStyleSettings>
<codeStyleSettings language="Jade">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
</value>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
</project>

11
.idea/compiler-explorer.iml

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/out" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

22
.idea/compiler.xml

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>

3
.idea/copyright/profiles_settings.xml

@ -1,3 +0,0 @@
<component name="CopyrightManager">
<settings default="" />
</component>

4
.idea/deployment.xml

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData" serverName="Compiler Explorer" />
</project>

6
.idea/encodings.xml

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

7
.idea/jsLibraryMappings.xml

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<file url="file://$PROJECT_DIR$" libraries="{compiler-explorer/node_modules}" />
<includedPredefinedLibrary name="Node.js Core" />
</component>
</project>

85
.idea/jsLinters/jshint.xml

@ -1,85 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JSHintConfiguration" version="2.9.4" use-config-file="true" use-custom-config-file="true" custom-config-file-path="$PROJECT_DIR$/.jshintrc">
<option asi="false" />
<option bitwise="true" />
<option boss="false" />
<option browser="true" />
<option browserify="false" />
<option camelcase="false" />
<option couch="false" />
<option curly="true" />
<option debug="false" />
<option devel="false" />
<option dojo="false" />
<option elision="false" />
<option enforceall="false" />
<option eqeqeq="true" />
<option eqnull="false" />
<option es3="false" />
<option es5="false" />
<option esnext="false" />
<option evil="false" />
<option expr="false" />
<option forin="true" />
<option freeze="false" />
<option funcscope="false" />
<option futurehostile="false" />
<option gcl="false" />
<option globalstrict="false" />
<option immed="false" />
<option iterator="false" />
<option jasmine="false" />
<option jquery="false" />
<option lastsemic="false" />
<option latedef="false" />
<option laxbreak="false" />
<option laxcomma="false" />
<option loopfunc="false" />
<option maxerr="50" />
<option mocha="false" />
<option module="false" />
<option mootools="false" />
<option moz="false" />
<option multistr="false" />
<option newcap="false" />
<option noarg="true" />
<option nocomma="false" />
<option node="false" />
<option noempty="true" />
<option nomen="false" />
<option nonbsp="false" />
<option nonew="true" />
<option nonstandard="false" />
<option notypeof="false" />
<option noyield="false" />
<option onevar="false" />
<option passfail="false" />
<option phantom="false" />
<option plusplus="false" />
<option proto="false" />
<option prototypejs="false" />
<option qunit="false" />
<option quotmark="false" />
<option rhino="false" />
<option scripturl="false" />
<option shadow="false" />
<option shelljs="false" />
<option singleGroups="false" />
<option smarttabs="false" />
<option strict="true" />
<option sub="false" />
<option supernew="false" />
<option trailing="false" />
<option typed="false" />
<option undef="true" />
<option unused="false" />
<option validthis="false" />
<option varstmt="false" />
<option white="false" />
<option withstmt="false" />
<option worker="false" />
<option wsh="false" />
<option yui="false" />
</component>
</project>

21
.idea/libraries/Cargo__rustfilt_.xml

@ -1,21 +0,0 @@
<component name="libraryTable">
<library name="Cargo &lt;rustfilt&gt;">
<CLASSES>
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-build-0.1.1" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.18" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.2.8" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/kernel32-sys-0.2.2" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-syntax-0.3.9" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/utf8-ranges-0.1.3" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/thread_local-0.2.7" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-0.1.80" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-demangle-0.1.3" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/aho-corasick-0.5.3" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-0.2.2" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/thread-id-2.0.0" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/memchr-0.1.11" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

16
.idea/libraries/Rust__rustfilt_.xml

@ -1,16 +0,0 @@
<component name="libraryTable">
<library name="Rust &lt;rustfilt&gt;">
<CLASSES>
<root url="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd" />
<root url="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore" />
<root url="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/liballoc" />
<root url="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcollections" />
<root url="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/liblibc/src" />
<root url="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libpanic_unwind" />
<root url="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/librustc_unicode" />
<root url="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

10
.idea/misc.xml

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" default="false" project-jdk-name="Python 2.7.12+ (/usr/bin/python2.7)" project-jdk-type="Python SDK" />
<component name="RustProjectSettings">
<option name="toolchainHomeDirectory" value="$USER_HOME$/.cargo/bin" />
</component>
</project>

9
.idea/modules.xml

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/compiler-explorer.iml" filepath="$PROJECT_DIR$/.idea/compiler-explorer.iml" />
<module fileurl="file://$PROJECT_DIR$/rust/rustfilt.iml" filepath="$PROJECT_DIR$/rust/rustfilt.iml" />
</modules>
</component>
</project>

5
.idea/scopes/scope_settings.xml

@ -1,5 +0,0 @@
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>

6
.idea/vcs.xml

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

4
.idea/watcherTasks.xml

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectTasksOptions" suppressed-tasks="Less" />
</project>

14
.idea/webResources.xml

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WebResourcesPaths">
<contentEntries>
<entry url="file://$PROJECT_DIR$">
<entryData>
<resourceRoots>
<path value="file://$PROJECT_DIR$/static" />
</resourceRoots>
</entryData>
</entry>
</contentEntries>
</component>
</project>

4
.jshintrc

@ -1,4 +0,0 @@
{
"esnext": true,
"supernew": true
}

7
.travis.yml

@ -1,7 +0,0 @@
sudo: false
language: node_js
node_js:
- "node"

28
CODEOWNERS

@ -1,28 +0,0 @@
# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.
# These owners will be the default owners for everything in the repo.
* @mattgodbolt
# rabsrincon
static/conformance-view.js @RabsRincon
static/cppp-mode.js @RabsRincon
static/themes.js @RabsRincon
lib/asm-docs.js @RabsRincon
lib/asm-docs-api.js @RabsRincon
views/sitemap.pug @RabsRincon
# jaredwy
static/opt-view.js @jaredwy
lib/compilers/argument-parsers.js @jaredwy
# tartanllama
static/ast-view.js @TartanLlama
static/haskell-mode.js @TartanLlama
lib/compilers/haskell.js @TartanLlama
views/example.hs @TartanLlama
# cppchedy
static/cfg-view.js @cppchedy
lib/cfg.js @cppchedy

46
CODE_OF_CONDUCT.md

@ -1,46 +0,0 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project owner at matt@godbolt.org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

23
LICENSE

@ -1,23 +0,0 @@
Copyright (c) 2012-2017, Matt Godbolt
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

108
Makefile

@ -1,108 +0,0 @@
ifneq "" "$(NODE_DIR)"
NPM:=$(NODE_DIR)/bin/npm
NODE:=$(NODE_DIR)/bin/node
default: run
else
ifeq "" "$(shell which npm)"
default:
@echo "Please install node.js"
@echo "Visit http://nodejs.org/ for more details"
@echo "On Ubuntu/Debian try: sudo apt-get install nodejs npm"
exit 1
else
NPM:= $(shell which npm)
NODE:= $(shell which node || which nodejs)
default: run
endif
endif
.PHONY: clean run test run-amazon c-preload optional-haskell-support optional-d-support optional-rust-support
.PHONY: dist lint prereqs node_modules bower_modules
prereqs: optional-haskell-support optional-d-support optional-rust-support node_modules c-preload bower_modules
GDC?=gdc
DMD?=dmd
LDC?=ldc2
ifneq "" "$(shell which $(GDC) 2>/dev/null || which $(DMD) 2>/dev/null || which $(LDC) 2>/dev/null)"
optional-d-support:
$(MAKE) -C d
else
optional-d-support:
@echo "D language support disabled"
endif
GHC?=ghc
ifneq "" "$(shell which $(GHC))"
optional-haskell-support:
$(MAKE) -C haskell
else
optional-haskell-support:
@echo "Haskell language support disabled"
endif
ifneq "" "$(shell which cargo)"
optional-rust-support:
cd rust && cargo build --release
else
optional-rust-support:
@echo "Rust language support disabled"
endif
NODE_MODULES=.npm-updated
$(NODE_MODULES): package.json
$(NPM) install
@touch $@
BOWER_MODULES=.bower-updated
$(BOWER_MODULES): bower.json $(NODE_MODULES)
if ! test -f "${BOWER_MODULES}"; then rm -rf static/ext; fi
$(NODE) ./node_modules/bower/bin/bower install
@touch $@
# Workaround for lack of versioned monaco-editor in bower
rm -rf static/ext/monaco-editor
cp -r node_modules/monaco-editor static/ext/
lint: $(NODE_MODULES)
$(NODE) ./node_modules/.bin/jshint app.js $(shell find lib static -name '*.js' -not -path 'static/ext/*' -not -path static/analytics.js)
LANG:=C++
node_modules: $(NODE_MODULES)
bower_modules: $(BOWER_MODULES)
test: $(NODE_MODULES) lint
$(MAKE) -C c-preload test
@echo Tests pass
clean:
rm -rf bower_modules node_modules .npm-updated .bower-updated out static/ext
$(MAKE) -C d clean
$(MAKE) -C c-preload clean
run: prereqs
$(NODE) ./node_modules/.bin/supervisor -w app.js,lib,etc/config -e 'js|node|properties' --exec $(NODE) $(NODE_ARGS) -- ./app.js --language $(LANG) $(EXTRA_ARGS)
HASH := $(shell git rev-parse HEAD)
dist: prereqs
rm -rf out/dist
$(NODE) ./node_modules/requirejs/bin/r.js -o app.build.js
# Move all assets to a versioned directory
mkdir -p out/dist/v/$(HASH)
mv out/dist/main.js* out/dist/v/$(HASH)/
mv out/dist/explorer.css out/dist/v/$(HASH)/
mv out/dist/assets/ out/dist/v/$(HASH)/
mv out/dist/themes/ out/dist/v/$(HASH)/
# copy any external references into the directory too
cp -r $(shell pwd)/out/dist/ext out/dist/v/$(HASH)/ext
# uglify requirejs itself
$(NODE) ./node_modules/.bin/uglifyjs out/dist/v/$(HASH)/ext/requirejs/require.js \
-c \
--output out/dist/v/$(HASH)/ext/requirejs/require.js \
--source-map out/dist/v/$(HASH)/ext/requirejs/require.js.map \
--source-map-url require.js.map \
--source-map-root //v/$(HASH)/ext/requirejs \
--prefix 6
c-preload:
$(MAKE) -C c-preload

135
README.md

@ -1,135 +0,0 @@
[![Build Status](https://travis-ci.org/mattgodbolt/compiler-explorer.svg?branch=master)](https://travis-ci.org/mattgodbolt/compiler-explorer)
[![Codewake](https://www.codewake.com/badges/ask_question.svg)](https://www.codewake.com/p/compiler-explorer)
Compiler Explorer
------------
Compiler Explorer is an interactive compiler. The left-hand pane shows editable C/C++/Rust/Go/D/Haskell/Swift code. The right, the
assembly output of having compiled the code with a given compiler and settings. Multiple compilers are supported, and
the UI layout is configurable (the [Golden Layout](https://www.golden-layout.com/) library is used for this).
There is also an ispc compiler for a C variant with extensions for SPMD.
Try out one of the demo sites: [C++][cpp], [Rust][rust], [D][d], [Go][go], [Haskell][haskell], [Swif][swift], [ispc][ispc].
[cpp]: https://gcc.godbolt.org/ "Compiler Explorer for C++"
[rust]: https://rust.godbolt.org/ "Compiler Explorer for Rust"
[d]: https://d.godbolt.org/ "Compiler Explorer for D"
[go]: https://go.godbolt.org/ "Compiler Explorer for Go"
[ispc]: https://ispc.godbolt.org/ "Compiler Explorer for ispc"
[haskell]: https://haskell.godbolt.org/ "Compiler Explorer for Haskell"
[swift]: https://swift.godbolt.org/ "Compiler Explorer for Swift"
You can support this [this project on Patreon](https://patreon.com/mattgodbolt).
### Developing or running a local instance
Compiler Explorer is written in node.js.
Assuming you have npm and node installed, simply running `make` ought to get you up and running with an Explorer
running on port 10240 on your local machine: http://localhost:10240/
The `Makefile` will automatically install all the third party libraries needed to run; using `npm` to install server-side
components and `bower` to install all the client-facing libraries.
If you want to point it at your own GCC or similar binaries, either edit the `etc/config/compiler-explorer.defaults.properties` or else make a new one with the name
`compiler-explorer.local.properties`. `*.local.properties` files have the highest priority when loading properties.
The config system leaves a lot to be desired, I'm working on porting [CCS](https://github.com/hellige/ccs-cpp) to javascript and then something more rational can be used.
Feel free to raise an issue on [github](https://github.com/mattgodbolt/compiler-explorer/issues) or
[email me directly](mailto:matt@godbolt.org) for more help.
There's now a [Road map](Roadmap.md) that gives a little insight into future plans for Compiler Explorer.
### Credits
Compiler Explorer is maintained by [Matt Godbolt](http://xania.org), [Rubén Rincón](https://github.com/RabsRincon) and [Simon Brand](https://blog.tartanllama.xyz/).
Multiple compiler and difference view initially implemented by [Gabriel Devillers](https://github.com/voxelf),
while working for [Kalray](http://www.kalrayinc.com/). Clang optview output by [Jared Wyles](https://github.com/jaredwy).
### RESTful API
There's a simple restful API that can be used to do compiles to asm and to list compilers. In general
all handlers live in `/api/*` endpoints, and will accept JSON or text in POSTs, and will return text responses
or JSON responses depending on the request's `Accept` header.
At a later date there may be some form of rate-limiting: currently requests will be queued and dealt with
exactly like interactive requests on the main site. Authentication might be required at some point in the
future (for the main Compiler Explorer site anyway).
The following endpoints are defined:
#### `GET /api/compilers` - return a list of compilers
Returns a list of compilers. In text form, there's a simple formatting of the ID of the compiler and its
description. In JSON, all the information is returned as an array of compilers, with the `id` key being the
primary identifier of each compiler.
#### `POST /api/compiler/<compiler-id>/compile` - perform a compilation
To specify a compilation request as a JSON document, post it as the appropriate type and send an object of
the form: `{'source': 'source to compile', 'options': {userOptions': 'compiler flags', 'compilerOptions':{}, filters': {'filter': true}}}`.
The filters are an JSON object with true/false. If not supplied, defaults are used. If supplied, the
filters are used as-is. The `compilerOptions` is used to pass extra arguments to the back end, and is probably
not useful for most REST users.
A text compilation request has the source as the body of the post, and uses query parameters to pass the
options and filters. Filters are supplied as a comma-separated string. Use the query parameter `filters=XX`
to set the filters directly, else `addFilters=XX` to add a filter to defaults, or `removeFilters` to remove from defaults. Compiler parameters should be passed as `options=-O2` and default to empty.
Filters include `binary`, `labels`, `intel`, `comments` and `directives` and correspond to the UI buttons on
the HTML version.
The text request is designed for simplicity for command-line clients like `curl`:
```bash
$ curl 'https://gcc.godbolt.org/api/compiler/g63/compile?options=-Wall' --data-binary 'int foo() { return 1; }'
# Compilation provided by Compiler Explorer at gcc.godbolt.org
foo():
push rbp
mov rbp, rsp
mov eax, 1
pop rbp
ret
```
If JSON is present in the request's `Accept` header, the compilation results are of the form:
Optional values are marked with a '**'
```
{
"code": 0 if successful, else compiler return code,
"stdout": [
{
"text": Output,
** "tag": {
"line": Source line,
"text": Parsed error for that line
}
},
...
],
"stderr": (format is similar to that of stdout),
"asm": [
{
"text": Assembly text,
"source": {file: null for user input, else path, line: number} or null if none
},
...
],
"okToCache": true if output could be locally cached else false,
** "optOutput" : {
"displayString" : String displayed in output,
"Pass" : [ Missed | Passed | Analysis ] (Specifies the type of optimisation output),
"Name" : Name of the output (mostly represents the reason for the output),
"DebugLoc" : {
"File": Name of file,
"Line": Line number,
"Column": Column number in line
},
"Function": Name of function for which optimisation output is provided,
"Args": Array of objects representing the arguments that the optimiser used when trying to optimise
}
}
```

76
Roadmap.md

@ -1,76 +0,0 @@
# Compiler Explorer Road Map
CE was started in 2012 to serve my needs at [my company](http:/drw.com) in terms of showing how
C++ constructs translated to assembly code. It started out as a `tmux` session with `vi` running in one
pane and `watch gcc -S foo.cc -o -` running in the other. Since those days, it's now a public website
serving the C++, Rust, Go and D communities and performs around 20,000 compilations per day.
This document is an attempt to capture thoughts on the future direction of Compiler Explorer.
## Areas to improve
### Mobile client support
CE's UI doesn't work well with mobile clients. The editor doesn't work well on many mobile clients, and the
layout doesn't lend itself well to small screens.
Ideas for improving mobile support include automatically folding up all the panes into a single tab upon
detection of a mobile client. This would require a bunch of fixes in the
underlying [UI library](http://golden-layout.com) as this doesn't properly work with mobile and tabs.
Perhaps a read-only simplified view would work better: the main reason one brings up the CE website is to
look at tweeted links rather than author content.
### UI improvements
The UI has a number of things that need improving:
- [X] Multiple editor windows
- [X] Saving and restoring from browser-local storage
- [ ] Handling the loss of data if one has a work-in-progress CE window open and then clicks another CE link.
### Diff view
A frequently requested feature that arrived with the inclusion of the [Monaco](https://microsoft.github.io/monaco-editor/) editor.
### Execution support
Another big ticket item is to allow executing of the user's code. This is fraught with security issues, and
brings up a number of UI and API considerations. Compiling code every time to execute with different params
seems wasteful, so caching seems good; but in a multi-instance setup a shared cache woudl be needed. Perhaps
a backend system that caches the executables (and makes them downloadable; at least for some compilers where
license allows), and stores the binaries in ephemeral, shared storage. This same backend system could also
be used to store code, and could be part of a whole new way of sending and sharing code (if made permanent
storage).
### Support more compilers
Most of the open tickets are to do with adding new compilers, or fixing issues with existing compilers.
Continuing to add more compilers and make it easier for others to submit PRs to add new compilers is
very important.
## Tensions
There's an inherent tension between the standalone, run-it-yourself version of CE and the scalable, AWS-backed
CE instance. Care must be taken to keep the standalone version usable, not least as the majority of CE's
development is done on a laptop during a commute (with little or no internet access).
## Priorities
Above all, the priority is to keep the main CE site up, stable and dependable. After that, features are
added honestly in the order that is most useful and interesting to the primary developer (Matt Godbolt).
## Non-goals
CE will remain ad-free, open-source and non-commercial. There's no plans at all to add "freemium" content.
## 2017 goals
With all this in mind, the tentative goals for 2017 are:
- [X] Move to the Monaco editor
- [X] Implement diff view
- [ ] Come up with a decent secure solution for code execution
- [ ] Design an API that can handle remote code execution and download needs
- [ ] Implement remote execution UIs
These goals will be refined as time ticks on.

19
app.build.js

@ -1,19 +0,0 @@
({
appDir: "static",
baseUrl: ".",
dir: "out/dist",
generateSourceMaps: true,
preserveLicenseComments: false,
optimize: "uglify2",
removeCombined: true,
useStrict: true,
mainConfigFile: "static/main.js",
skipDirOptimize: true,
optimizeCss: "standard",
paths: { "vs": "empty:" },
modules: [
{
name: "main"
}
]
})

647
app.js

@ -1,647 +0,0 @@
#!/usr/bin/env node
// Copyright (c) 2012-2017, Matt Godbolt
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
// Initialise options and properties. Don't load any handlers here; they
// may need an initialised properties library.
var nopt = require('nopt'),
os = require('os'),
props = require('./lib/properties'),
child_process = require('child_process'),
path = require('path'),
fs = require('fs-extra'),
http = require('http'),
https = require('https'),
url = require('url'),
Promise = require('promise'),
_ = require('underscore-node'),
utils = require('./lib/utils'),
express = require('express'),
logger = require('./lib/logger').logger;
// Parse arguments from command line 'node ./app.js args...'
var opts = nopt({
'env': [String, Array],
'rootDir': [String],
'language': [String],
'host': [String],
'port': [Number],
'propDebug': [Boolean],
'debug': [Boolean],
'static': [String],
'archivedVersions': [String],
'noRemoteFetch': [Boolean],
'tmpDir': [String]
});
if (opts.debug) logger.level = 'debug';
// AP: Detect if we're running under Windows Subsystem for Linux. Temporary modification
// of process.env is allowed: https://nodejs.org/api/process.html#process_process_env
if (child_process.execSync('uname -a').toString().indexOf('Microsoft') > -1)
process.env.wsl = true;
// AP: Allow setting of tmpDir (used in lib/base-compiler.js & lib/exec.js) through
// opts. WSL requires a tmpDir as it can't see Linux volumes so set default to c:\tmp.
if (opts.tmpDir)
process.env.tmpDir = opts.tmpDir;
else if (process.env.wsl)
process.env.tmpDir = "/mnt/c/tmp";
// Set default values for omitted arguments
var rootDir = opts.rootDir || './etc';
var language = opts.language || "C++";
var env = opts.env || ['dev'];
var hostname = opts.host;
var port = opts.port || 10240;
var staticDir = opts.static || 'static';
var archivedVersions = opts.archivedVersions;
var gitReleaseName = child_process.execSync('git rev-parse HEAD').toString().trim();
var versionedRootPrefix = "";
// Don't treat @ in paths as remote adresses
var fetchCompilersFromRemote = !opts.noRemoteFetch;
if (opts.static && fs.existsSync(opts.static + '/v/' + gitReleaseName))
versionedRootPrefix = "v/" + gitReleaseName + "/";
var propHierarchy = _.flatten([
'defaults',
env,
language,
_.map(env, function (e) {
return e + '.' + process.platform;
}),
process.platform,
os.hostname(),
'local']);
logger.info("properties hierarchy: " + propHierarchy.join(', '));
// Propagate debug mode if need be
if (opts.propDebug) props.setDebug(true);
// *All* files in config dir are parsed
props.initialize(rootDir + '/config', propHierarchy);
// Now load up our libraries.
var CompileHandler = require('./lib/compile-handler').CompileHandler,
aws = require('./lib/aws'),
asm_doc_api = require('./lib/asm-docs-api');
// Instantiate a function to access records concerning "compiler-explorer"
// in hidden object props.properties
var gccProps = props.propsFor("compiler-explorer");
// Instantiate a function to access records concerning the chosen language
// in hidden object props.properties
var compilerPropsFunc = props.propsFor(language.toLowerCase());
// If no option for the compiler ... use gcc's options (??)
function compilerProps(property, defaultValue) {
// My kingdom for ccs... [see Matt's github page]
var forCompiler = compilerPropsFunc(property, undefined);
if (forCompiler !== undefined) return forCompiler;
return gccProps(property, defaultValue); // gccProps comes from lib/compile-handler.js
}
var staticMaxAgeSecs = gccProps('staticMaxAgeSecs', 0);
function staticHeaders(res) {
if (staticMaxAgeSecs) {
res.setHeader('Cache-Control', 'public, max-age=' + staticMaxAgeSecs + ', must-revalidate');
}
}
var awsProps = props.propsFor("aws");
var awsPoller = null;
function awsInstances() {
if (!awsPoller) awsPoller = new aws.InstanceFetcher(awsProps);
return awsPoller.getInstances();
}
// function to load internal binaries (i.e. lib/source/*.js)
function loadSources() {
var sourcesDir = "lib/sources";
return fs.readdirSync(sourcesDir)
.filter(function (file) {
return file.match(/.*\.js$/);
})
.map(function (file) {
return require("./" + path.join(sourcesDir, file));
});
}
// load effectively
var fileSources = loadSources();
var sourceToHandler = {};
fileSources.forEach(function (source) {
sourceToHandler[source.urlpart] = source;
});
var clientOptionsHandler = new ClientOptionsHandler(fileSources);
var compileHandler = new CompileHandler(gccProps, compilerProps);
var apiHandler = new ApiHandler(compileHandler);
// auxiliary function used in clientOptionsHandler
function compareOn(key) {
return function (xObj, yObj) {
var x = xObj[key];
var y = yObj[key];
if (x < y) return -1;
if (x > y) return 1;
return 0;
};
}
// instantiate a function that generate javascript code,
function ClientOptionsHandler(fileSources) {
var sources = fileSources.map(function (source) {
return {name: source.name, urlpart: source.urlpart};
});
// sort source file alphabetically
sources = sources.sort(compareOn("name"));
var languages = _.compact(_.map(gccProps("languages", '').split(':'), function (thing) {
if (!thing) return null;
var splat = thing.split("=");
return {language: splat[0], url: splat[1]};
}));
var supportsBinary = !!compilerProps("supportsBinary", true);
var supportsExecute = supportsBinary && !!compilerProps("supportsExecute", true);
var libs = {};
var baseLibs = compilerProps("libs");
if (baseLibs) {
_.each(baseLibs.split(':'), function (lib) {
libs[lib] = {name: compilerProps('libs.' + lib + '.name')};
libs[lib].versions = {};
var listedVersions = compilerProps("libs." + lib + '.versions');
if (listedVersions) {
_.each(listedVersions.split(':'), function (version) {
libs[lib].versions[version] = {};
libs[lib].versions[version].version = compilerProps("libs." + lib + '.versions.' + version + '.version');
libs[lib].versions[version].path = [];
var listedIncludes = compilerProps("libs." + lib + '.versions.' + version + '.path');
if (listedIncludes) {
_.each(listedIncludes.split(':'), function (path) {
libs[lib].versions[version].path.push(path);
});
} else {
logger.warn("No paths found for " + lib + " version " + version);
}
});
} else {
logger.warn("No versions found for " + lib + " library");
}
});
}
var options = {
googleAnalyticsAccount: gccProps('clientGoogleAnalyticsAccount', 'UA-55180-6'),
googleAnalyticsEnabled: gccProps('clientGoogleAnalyticsEnabled', false),
sharingEnabled: gccProps('clientSharingEnabled', true),
githubEnabled: gccProps('clientGitHubRibbonEnabled', true),
gapiKey: gccProps('googleApiKey', ''),
googleShortLinkRewrite: gccProps('googleShortLinkRewrite', '').split('|'),
defaultSource: gccProps('defaultSource', ''),
language: language,
compilers: [],
libs: libs,
sourceExtension: compilerProps('compileFilename').split('.', 2)[1],
defaultCompiler: compilerProps('defaultCompiler', ''),
compileOptions: compilerProps('defaultOptions', ''),
supportsBinary: supportsBinary,
supportsExecute: supportsExecute,
languages: languages,
sources: sources,
raven: gccProps('ravenUrl', ''),
release: gitReleaseName,
environment: env,
localStoragePrefix: gccProps('localStoragePrefix'),
cvCompilerCountMax: gccProps('cvCompilerCountMax', 6),
defaultFontScale: gccProps('defaultFontScale', 1.0)
};
this.setCompilers = function (compilers) {
options.compilers = compilers;
};
this.setCompilers([]);
this.handler = function getClientOptions(req, res) {
res.set('Content-Type', 'application/json');
staticHeaders(res);
res.end(JSON.stringify(options));
};
this.get = function () {
return options;
};
}
// function used to enable loading and saving source code from web interface
function getSource(req, res, next) {
var bits = req.url.split("/");
var handler = sourceToHandler[bits[1]];
if (!handler) {
next();
return;
}
var action = bits[2];
if (action === "list") action = handler.list;
else if (action === "load") action = handler.load;
else if (action === "save") action = handler.save;
else action = null;
if (action === null) {
next();
return;
}
action.apply(handler, bits.slice(3).concat(function (err, response) {
staticHeaders