├── public ├── favicon.ico ├── manifest.json └── index.html ├── doc └── SIMD-Visualizer-Demo.gif ├── src ├── ASMComponents │ ├── UnsupportedCommand.js │ ├── Function.js │ ├── ret.js │ ├── Shift.js │ ├── Vector.js │ ├── SequentialComponent.js │ └── Arithmetic.js ├── css │ ├── GlobalVariables.css │ ├── ASMVisualizer.css │ ├── Vector.css │ ├── App.css │ ├── Tabs.css │ └── ASTVisualizer.css ├── index.css ├── index.js ├── components │ ├── WaitingScreen.js │ ├── CodeStatus.js │ ├── ErrorHandler.js │ ├── FrontPage.js │ ├── ButtonPanel.js │ ├── ASTVisualizer.js │ ├── ASMVisualizer.js │ ├── App.js │ └── ParametersPage.js ├── Utils │ ├── index.js │ ├── Compiler.js │ ├── Tabs.js │ ├── Registry.js │ ├── Converter.js │ └── Parser.js ├── Images │ ├── Cog.js │ ├── CProgramming.js │ ├── c-programming.svg │ ├── cog.svg │ ├── cryingboy.svg │ └── Cryingboy.js └── serviceWorker.js ├── .gitignore ├── package.json ├── LICENSE ├── README.md └── .idea └── workspace.xml /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piotte13/SIMD-Visualiser/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /doc/SIMD-Visualizer-Demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piotte13/SIMD-Visualiser/HEAD/doc/SIMD-Visualizer-Demo.gif -------------------------------------------------------------------------------- /src/ASMComponents/UnsupportedCommand.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from "react"; 2 | 3 | export default class UnsupportedCommand extends Component { 4 | 5 | render() { 6 | return ( 7 |
Unsupported Command: "{this.props.name}"
8 | ); 9 | } 10 | } -------------------------------------------------------------------------------- /src/css/GlobalVariables.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --main: #2A363B; 3 | --dark-main: #1F292E; 4 | --one: #A7226E; 5 | --two: #EC2049; 6 | --three: #F26B38; 7 | --four: #F7DB4F; 8 | --five: #2F9599; 9 | --gray: #A8A7A7; 10 | --clear-text-color: #FFF; 11 | --dark-text-color: #000 12 | } -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "SIMD Visualizer", 3 | "name": "The Ultimate SIMD Visualizer", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | 23 | .idea 24 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | background-color: #F7F7F7; 5 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", 6 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", 7 | sans-serif; 8 | font-size: 16px; 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | } 12 | 13 | code { 14 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 15 | monospace; 16 | } 17 | -------------------------------------------------------------------------------- /src/css/ASMVisualizer.css: -------------------------------------------------------------------------------- 1 | .playback-button { 2 | width: 150px; 3 | /*background-color: var(--three) !important;*/ 4 | /*border-color: var(--five) !important;*/ 5 | /*color: var(--five) !important;*/ 6 | /*#273890*/ 7 | } 8 | 9 | .btn-outline-primary { 10 | /*background-color: var(--three) !important;*/ 11 | border-color: var(--main) !important; 12 | color: var(--main) !important; 13 | } 14 | 15 | .btn-outline-primary:hover { 16 | color: #fff !important; 17 | background-color: var(--main) !important; 18 | border-color: var(--main) !important; 19 | } -------------------------------------------------------------------------------- /src/css/Vector.css: -------------------------------------------------------------------------------- 1 | .vector-container { 2 | fill: var(--main); 3 | filter: drop-shadow(3px 3px 2px rgba(42, 54, 59, .5)); 4 | -webkit-filter: drop-shadow(3px 3px 2px rgba(42, 54, 59, .5)); 5 | } 6 | 7 | .vector-line { 8 | stroke: var(--gray); 9 | stroke-width: 1; 10 | shape-rendering: crispEdges; 11 | } 12 | 13 | .vector-values { 14 | fill: var(--clear-text-color); 15 | text-anchor: middle; 16 | } 17 | 18 | .shift-values-right { 19 | fill: var(--five); 20 | text-anchor: middle; 21 | } 22 | 23 | .shift-values-left { 24 | fill: var(--two); 25 | text-anchor: middle; 26 | } -------------------------------------------------------------------------------- /src/css/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .react-codemirror2 { 6 | font-size: 24px; 7 | -ms-flex: 1 1; 8 | flex: 1 1; 9 | } 10 | 11 | .react-codemirror2 .CodeMirror { 12 | height: 100%; 13 | } 14 | 15 | .editor-highlighted-background { 16 | background-color: #44535a; 17 | } 18 | 19 | @media (max-width: 700px) { 20 | .react-codemirror2 { 21 | font-size: 13px; 22 | } 23 | } 24 | 25 | strong { 26 | font-weight: 700 !important; 27 | } 28 | 29 | .highlighted-code { 30 | background-color: #44535a; 31 | } 32 | 33 | .sequential-highlighted-code { 34 | background-color: #44535a; 35 | } -------------------------------------------------------------------------------- /src/css/Tabs.css: -------------------------------------------------------------------------------- 1 | .tabs { 2 | background: #fff; 3 | border: 1px solid #e5e5e5; 4 | border-radius: 3px; 5 | height: 100%; 6 | } 7 | 8 | .tabs__labels { 9 | margin: 0; 10 | padding: 0; 11 | } 12 | 13 | .tabs__labels li { 14 | display: inline-block; 15 | } 16 | 17 | .tabs__labels li a { 18 | padding: 8px 50px; 19 | display: block; 20 | color: #444; 21 | text-decoration: none; 22 | border-bottom: 3px solid #f5f5f5; 23 | } 24 | 25 | .tabs__labels li a.active { 26 | border-bottom-color: var(--five); 27 | transition: all 0.3s ease-out; 28 | } 29 | 30 | .tabs__content { 31 | padding: 25px; 32 | height: calc(100% - 40px); 33 | } 34 | 35 | .tabs__content > div:first-child { 36 | height: 100%; 37 | } -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './components/App'; 5 | import * as serviceWorker from './serviceWorker'; 6 | import 'bootstrap/dist/css/bootstrap.min.css'; 7 | import {HashRouter, Switch, Route} from "react-router-dom"; 8 | 9 | ReactDOM.render( 10 | 11 | 12 | 13 | 14 | 15 | , 16 | document.getElementById('root') 17 | ); 18 | 19 | // If you want your app to work offline and load faster, you can change 20 | // unregister() to register() below. Note this comes with some pitfalls. 21 | // Learn more about service workers: http://bit.ly/CRA-PWA 22 | serviceWorker.unregister(); 23 | -------------------------------------------------------------------------------- /src/components/WaitingScreen.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import styled from 'styled-components' 3 | import anime from "animejs"; 4 | import SvgCog from "../Images/Cog"; 5 | 6 | const Container = styled.div` 7 | height: 40vh; 8 | margin: 30vh auto; 9 | color: var(--dark-main); 10 | text-align: center; 11 | ` 12 | 13 | export default class WaitingScreen extends Component { 14 | 15 | constructor() { 16 | super(); 17 | 18 | this.cog = React.createRef(); 19 | } 20 | 21 | componentDidMount() { 22 | this.cogAnim = anime({ 23 | targets: this.cog.current, 24 | loop: true, 25 | rotate: '360deg', 26 | duration: 4000, 27 | easing: 'linear' 28 | }) 29 | } 30 | 31 | render() { 32 | return ( 33 | 34 | 35 | 36 | ); 37 | } 38 | } -------------------------------------------------------------------------------- /src/Utils/index.js: -------------------------------------------------------------------------------- 1 | export function getFlatColors() { 2 | return { 3 | main: getComputedStyle(document.documentElement).getPropertyValue('--main'), 4 | darkMain: getComputedStyle(document.documentElement).getPropertyValue('--dark-main'), 5 | one: getComputedStyle(document.documentElement).getPropertyValue('--one'), 6 | two: getComputedStyle(document.documentElement).getPropertyValue('--two'), 7 | three: getComputedStyle(document.documentElement).getPropertyValue('--three'), 8 | four: getComputedStyle(document.documentElement).getPropertyValue('--four'), 9 | five: getComputedStyle(document.documentElement).getPropertyValue('--five'), 10 | gray: getComputedStyle(document.documentElement).getPropertyValue('--gray'), 11 | clearTextColor: getComputedStyle(document.documentElement).getPropertyValue('--clear-text-color'), 12 | DarkTextColor: getComputedStyle(document.documentElement).getPropertyValue('--dark-text-color') 13 | } 14 | } -------------------------------------------------------------------------------- /src/Images/Cog.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const SvgCog = React.forwardRef((props, ref) => ( 4 | 5 | 9 | 10 | )); 11 | 12 | export default SvgCog; 13 | -------------------------------------------------------------------------------- /src/ASMComponents/Function.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from "react"; 2 | import styled from "styled-components"; 3 | import Registry from "../Utils/Registry"; 4 | import {convert} from "../Utils/Converter"; 5 | 6 | const FunctionContainer = styled.div` 7 | ` 8 | const FunctionName = styled.div` 9 | font-size: 32px; 10 | font-weight: normal; 11 | color: rgb(72, 72, 72); 12 | margin-bottom: 15px; 13 | text-align: center; 14 | ` 15 | 16 | export default class Function extends Component { 17 | 18 | constructor(props) { 19 | super(props); 20 | 21 | //Reset the registry because this is a new function! 22 | Registry.clear(); 23 | 24 | props.params.forEach(param => { 25 | Registry.set(param.register, convert(param.value, 'uint', 8, 'uint', param.bitWidth)); 26 | }) 27 | } 28 | 29 | 30 | render() { 31 | return ( 32 | 33 | {this.props.name} 34 |
35 |
36 | ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/css/ASTVisualizer.css: -------------------------------------------------------------------------------- 1 | @import "GlobalVariables.css"; 2 | 3 | .rst__rowContents { 4 | color: var(--clear-text-color); 5 | background-color: var(--main); 6 | border: none; 7 | border-radius: 10px; 8 | min-width: 0px; 9 | padding: 0 5px 0 25px; 10 | } 11 | 12 | .rst__rowTitle { 13 | font-weight: normal; 14 | } 15 | 16 | .Program .rst__rowContents { 17 | background-color: var(--dark-main); 18 | } 19 | 20 | .VariableDeclarator .rst__rowContents { 21 | background-color: var(--five); 22 | } 23 | 24 | .arguments .rst__rowContents { 25 | background-color: var(--three); 26 | } 27 | 28 | .BinaryExpression .rst__rowContents { 29 | background-color: var(--four); 30 | color: var(--dark-text-color); 31 | } 32 | 33 | .UnaryExpression .rst__rowContents { 34 | background-color: var(--four); 35 | color: var(--dark-text-color); 36 | } 37 | 38 | .AssignmentExpression .rst__rowContents { 39 | background-color: var(--four); 40 | color: var(--dark-text-color); 41 | } 42 | 43 | .Identifier .rst__rowContents { 44 | background-color: var(--one); 45 | } 46 | 47 | .Literal .rst__rowContents { 48 | background-color: var(--two); 49 | } 50 | -------------------------------------------------------------------------------- /src/components/CodeStatus.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import styled from 'styled-components' 3 | import {getFlatColors} from "../Utils"; 4 | 5 | const Status = styled.div` 6 | background: ${({bg}) => bg}; 7 | display: flex; 8 | justify-content: flex-start; 9 | align-items: center; 10 | font-weight: 300 11 | font-size: 14px; 12 | padding: 5px; 13 | padding-left: 10px; 14 | margin-bottom: 5px; 15 | 16 | > span { 17 | font-weight: 500; 18 | margin-left: 10px; 19 | } 20 | 21 | @media (max-width: 700px) { 22 | font-size: 8px; 23 | } 24 | ` 25 | 26 | export default function CodeStatus({status = 'compiles'}) { 27 | let color = ''; 28 | let message = ''; 29 | if (status === 'compiles') { 30 | color = getFlatColors().five; 31 | message = 'Code status: Compiles..'; 32 | } 33 | else if (status === 'error') { 34 | color = getFlatColors().two; 35 | message = 'Code status: Error..'; 36 | } 37 | else if (status === 'warning') { 38 | color = getFlatColors().four; 39 | message = 'Code status: warning..'; 40 | } 41 | 42 | return ( 43 | 44 | {message} 45 | 46 | ); 47 | } -------------------------------------------------------------------------------- /src/Images/CProgramming.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const SvgCProgramming = React.forwardRef((props, ref) => ( 4 | 5 | 6 | 10 | 14 | 18 | 22 | 23 | 24 | )); 25 | 26 | export default SvgCProgramming; 27 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SIMD-Visualiser", 3 | "version": "0.1.0", 4 | "private": true, 5 | "homepage": "http://piotte13.github.io/SIMD-Visualiser", 6 | "dependencies": { 7 | "acorn": "^6.0.4", 8 | "animejs": "^2.2.0", 9 | "bitly": "^6.0.8", 10 | "bootstrap": "^4.1.3", 11 | "codemirror": "^5.41.0", 12 | "history": "^4.7.2", 13 | "i": "^0.3.6", 14 | "lodash": "^4.17.11", 15 | "node-sass": "^4.10.0", 16 | "npm": "^6.4.1", 17 | "prop-types": "^15.6.2", 18 | "qs": "^6.6.0", 19 | "rc-slider": "^8.6.4", 20 | "react": "^16.6.3", 21 | "react-codemirror2": "^5.1.0", 22 | "react-copy-to-clipboard": "^5.0.1", 23 | "react-dom": "^16.6.0", 24 | "react-rangeslider": "^2.2.0", 25 | "react-router-dom": "^4.3.1", 26 | "react-scripts": "2.0.5", 27 | "react-sortable-tree": "^2.3.0", 28 | "react-transition-group": "^2.5.0", 29 | "reactstrap": "^6.5.0", 30 | "request": "^2.88.0", 31 | "styled-components": "^4.0.2", 32 | "uint32": "^0.2.1" 33 | }, 34 | "scripts": { 35 | "start": "react-scripts start", 36 | "build": "react-scripts build", 37 | "test": "react-scripts test", 38 | "eject": "react-scripts eject", 39 | "predeploy": "npm run build", 40 | "deploy": "gh-pages -d build" 41 | }, 42 | "eslintConfig": { 43 | "extends": "react-app" 44 | }, 45 | "browserslist": [ 46 | ">0.2%", 47 | "not dead", 48 | "not ie <= 11", 49 | "not op_mini all" 50 | ], 51 | "devDependencies": { 52 | "gh-pages": "^2.0.1" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Utils/Compiler.js: -------------------------------------------------------------------------------- 1 | import * as request from 'request'; 2 | 3 | 4 | //Callback must be -> callback(error, asm, ast) 5 | export function compile(code, callback) { 6 | let options = { 7 | url: 'https://godbolt.org/api/compiler/clang700/compile', 8 | method: 'POST', 9 | headers: { 10 | 'content-type': 'application/json' 11 | }, 12 | json: true, 13 | body: { 14 | "source": code, 15 | "compiler": "clang700", 16 | "options": { 17 | "userArguments": "-O3 -march=native", 18 | "compilerOptions": { 19 | "produceGccDump": {}, 20 | "produceCfg": false, 21 | "produceAst": true 22 | }, 23 | "filters": { 24 | "binary": false, 25 | "execute": false, 26 | "labels": true, 27 | "directives": true, 28 | "commentOnly": true, 29 | "trim": true, 30 | "intel": true, 31 | "demangle": true 32 | }, 33 | "tools": [] 34 | }, 35 | "lang": "c++" 36 | } 37 | }; 38 | request(options, (error, response, body) => { 39 | if (error) { 40 | alert("oops! https://godbolt.org/ seems to be down! \n You will have to wait my friend.") 41 | callback({}, [], "") 42 | } 43 | else { 44 | callback(body.stderr, body.asm, body.astOutput) 45 | } 46 | }) 47 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2018, Jeremie Piotte and Pierre Marie Ntang 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /src/Utils/Tabs.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable jsx-a11y/anchor-is-valid */ 2 | import React, {Component} from "react"; 3 | import "../css/Tabs.css" 4 | 5 | export class Tabs extends Component { 6 | state = { 7 | selected: this.props.selected 8 | }; 9 | 10 | shouldComponentUpdate(nextProps, nextState) { 11 | return this.props !== nextProps || this.state !== nextState; 12 | } 13 | 14 | handleClick = (index, event) => { 15 | event.preventDefault(); 16 | this.setState({ 17 | selected: index 18 | }); 19 | } 20 | _renderTitles = () => { 21 | 22 | return ( 23 | 36 | ); 37 | }; 38 | 39 | _renderContent = () => { 40 | return ( 41 |
42 | {this.props.children[this.state.selected]} 43 |
44 | ); 45 | }; 46 | 47 | render() { 48 | return ( 49 |
50 | {this._renderTitles()} 51 | {this._renderContent()} 52 |
53 | ); 54 | } 55 | } 56 | 57 | export class Pane extends Component { 58 | render() { 59 | return ( 60 |
61 | {this.props.children} 62 |
63 | ); 64 | } 65 | }; 66 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 14 | 15 | 24 | SIMD Visualizer 25 | 26 | 27 | 30 |
31 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/Images/c-programming.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 7 | 9 | 11 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/ASMComponents/ret.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from "react"; 2 | import Registry from "../Utils/Registry"; 3 | import Vector from "./Vector"; 4 | import anime from 'animejs'; 5 | 6 | export default class Ret extends Component { 7 | 8 | static defaultProps = { 9 | type: "uint", 10 | bitWidth: 32, 11 | base: 10, 12 | }; 13 | 14 | constructor(props) { 15 | super(props); 16 | 17 | //Ret returns value on top of the stack. For now we will assume the value is always 128 bits... (Xmm) 18 | let returnValue = Registry.get('xmm0'); 19 | 20 | this.state = { 21 | returnValue, 22 | }; 23 | 24 | this.vector = React.createRef(); 25 | this.computeCommand(); 26 | } 27 | 28 | getAnimation() { 29 | 30 | //We make an empty timeline because sequentialComponent needs to know when to jump to the next command. 31 | let timeline = anime.timeline({ 32 | easing: "linear", 33 | autoplay: false, 34 | }); 35 | 36 | timeline 37 | .add({ 38 | targets: this.vector.current, 39 | duration: 1000 40 | }); 41 | 42 | let eternalGlow = anime.timeline({ 43 | easing: "linear", 44 | loop: true, 45 | autoplay: true, 46 | direction: 'alternate' 47 | }); 48 | 49 | eternalGlow // Creates the glow arround the returned vector (glowing box shadow) 50 | .add({ 51 | targets: this.vector.current, 52 | filter: ["drop-shadow(0px 0px 10px rgba(42, 54, 59, 1))", "drop-shadow(0px 0px 1px rgba(42, 54, 59, .5))"], 53 | duration: 1000 54 | }); 55 | 56 | return timeline; 57 | } 58 | 59 | //Compute the command and set the registry. 60 | computeCommand() { 61 | 62 | } 63 | 64 | render() { 65 | let {returnValue} = this.state; 66 | let {type, bitWidth, base} = this.props; 67 | 68 | return ( 69 | this.vector = ref}/> 74 | ); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/components/ErrorHandler.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import styled from "styled-components"; 3 | import SvgCryingboy from "../Images/Cryingboy"; 4 | 5 | const ErrorPageContainer = styled.div` 6 | padding: 50px; 7 | ` 8 | 9 | const TextJumbo = styled.div` 10 | font-size: 60px; 11 | font-weight: 700; 12 | color: rgb(72, 72, 72); 13 | margin-bottom: 15px; 14 | ` 15 | 16 | const ErrorMessage = styled.div` 17 | font-size: 32px; 18 | font-weight: normal; 19 | color: rgb(72, 72, 72); 20 | margin-bottom: 15px; 21 | margin-top: 25px; 22 | ` 23 | 24 | const ErrorPosition = styled.div` 25 | font-size: 14px; 26 | font-weight: bold; 27 | color: #767676; 28 | margin-bottom: 15px; 29 | margin-top: 25px; 30 | ` 31 | const ImageContainer = styled.div` 32 | position: absolute; 33 | bottom: 0; 34 | right: 0; 35 | width: 50vh; 36 | ` 37 | 38 | class ErrorHandler extends Component { 39 | 40 | componentDidMount() { 41 | if (this.props.error.length !== 0) { 42 | this.highlightCode(); 43 | } 44 | } 45 | 46 | componentWillUnmount() { 47 | this.clearHighlightedCode() 48 | } 49 | 50 | highlightCode = () => { 51 | const line = this.props.error[0].tag.line - 1; 52 | let cm = this.props.cm.current; 53 | if (cm) { 54 | const lineLength = cm.editor.getLine(line).length; 55 | cm.editor.doc.markText({line, ch: 0}, {line, ch: lineLength}, { 56 | className: 'highlighted-code' 57 | }); 58 | } 59 | }; 60 | 61 | clearHighlightedCode = () => { 62 | let cm = this.props.cm.current; 63 | cm && cm.editor.doc.getAllMarks().forEach((m) => { 64 | m.clear() 65 | }) 66 | }; 67 | 68 | getErrorMessage = () => { 69 | return this.props.error[0].tag.text; 70 | } 71 | getErrorPosition = () => { 72 | return
73 |

Line: {this.props.error[0].tag.line}

74 |

Column: {this.props.error[0].tag.column}

75 |
76 | 77 | } 78 | 79 | render() { 80 | return ( 81 | 82 | Oops! 83 | 84 | {this.getErrorMessage()} 85 | 86 | 87 | {this.getErrorPosition()} 88 | 89 | 90 | 91 | 92 | 93 | ); 94 | } 95 | } 96 | 97 | export default ErrorHandler; -------------------------------------------------------------------------------- /src/Images/cog.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 30 | 50 | 53 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/components/FrontPage.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import styled from 'styled-components' 3 | import anime from "animejs"; 4 | import SvgCProgramming from "../Images/CProgramming"; 5 | 6 | 7 | const Image = styled.div` 8 | width: 40vmin; 9 | margin: 8vh auto; 10 | ` 11 | const AppTitle = styled.div` 12 | text-align: center; 13 | font-weight: 300; 14 | font-size: calc(12px + 3.6vw); 15 | letter-spacing: 1.8px; 16 | margin-top: 40px; 17 | border: medium none; 18 | margin-bottom: 20px; 19 | ` 20 | const AppDescription = styled.div` 21 | text-align: center; 22 | font-weight: 300; 23 | margin: 0px auto; 24 | font-size: calc(8px + 0.91vw); 25 | ` 26 | const Container = styled.div` 27 | ` 28 | 29 | const GHButton = styled.button` 30 | padding: 3px 10px 3px 8px; 31 | font-size: 16px; 32 | line-height: 22px; 33 | border-radius: 4px; 34 | text-shadow: 0 1px 0 #fff; 35 | white-space: nowrap; 36 | cursor: pointer; 37 | color: #333; 38 | background-repeat: no-repeat; 39 | border: 1px solid #d5d5d5; 40 | font-weight: 700; 41 | vertical-align: top; 42 | margin: 0 10px; 43 | 44 | :hover{ 45 | text-decoration: none; 46 | background-color: #ddd; 47 | background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0,#eee),color-stop(100%,#ddd)); 48 | background-image: -webkit-linear-gradient(top,#eee 0,#ddd 100%); 49 | background-image: -moz-linear-gradient(top,#eee 0,#ddd 100%); 50 | background-image: -ms-linear-gradient(top,#eee 0,#ddd 100%); 51 | background-image: -o-linear-gradient(top,#eee 0,#ddd 100%); 52 | background-image: linear-gradient(to bottom,#eee 0,#ddd 100%); 53 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#dddddd', GradientType=0); 54 | border-color: #ccc; 55 | } 56 | ` 57 | 58 | const ButtonGroup = styled.div` 59 | margin-top: 40px; 60 | text-align: center; 61 | ` 62 | 63 | export default class FrontPage extends Component { 64 | constructor() { 65 | super(); 66 | 67 | this.image = React.createRef(); 68 | this.imageContainer = React.createRef(); 69 | } 70 | 71 | componentDidMount() { 72 | let scaleAnime = anime({ 73 | easing: "easeOutCubic", 74 | targets: this.imageContainer.current, 75 | direction: 'alternate', 76 | duration: 2000, 77 | scale: '.9', 78 | loop: true 79 | }); 80 | 81 | let spinAnime = anime({ 82 | targets: this.image.current, 83 | delay: 6000, 84 | duration: 4000, 85 | rotate: '360deg', 86 | loop: true 87 | }) 88 | } 89 | 90 | 91 | render() { 92 | return ( 93 | 94 | 95 | 96 | 97 | 98 | 99 | The Ultimate SIMD visualizer 100 | 101 | Built by Jérémie Piotte, Daniel Lemire and Pierre Marie 102 | Ntang 103 | 104 | 105 | 106 | View on GitHub 107 | 108 |