Commit 264f6513 authored by Matej Genci's avatar Matej Genci

Make printing without newline possible

parent 4dd3c938
......@@ -11,6 +11,20 @@
/>
<script>
var EMULATOR_CONSOLE_READ = () => { return window.prompt()};
// Fixes for printing with new lines.
let waccPrintingBuffer = ""
function waccPrint(str) {
printing_buffer += str
}
function waccPrintLn(str) {
waccPrint(str + "\n")
}
function waccPrintFinished() {
console.log(waccPrintingBuffer)
}
</script>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
......
......@@ -60,7 +60,10 @@ class App extends React.Component {
clearConsole = () => {
this.setState({consoleReset: this.state.consoleReset + 1})
}
processWaccCode = async (code) => {
eval("waccPrintingBuffer = ''")
let rsp = await sendWaccCode(code);
let graph = this.state.graphData;
if (typeof rsp.isError !== "undefined") {
......@@ -73,8 +76,6 @@ class App extends React.Component {
graphData: graph
})
}
}
render() {
......@@ -90,10 +91,11 @@ class App extends React.Component {
this.processWaccCode(this.state.wacc.code)
this.clearConsole()
}}
onStepJsClick={(e) => {
this.setState({js: {code: "Hello World!"}})
onExecuteClick={(e) => {
eval(this.state.js.code)
eval("waccPrintFinished()")
}}
onStepOverAstClick={(e) => {
onStepWaccClick={(e) => {
this.readInputCallBack(e)
}}
/>
......
......@@ -25,7 +25,7 @@ function generateArmMarkers(lineNums) {
}
function createGraphNode(node, astMeta){
let name = node.name;
let name = node.name.replace("AST", "");
let value = node.value;
let childrenIDs = node.children;
let children = [];
......
......@@ -3,7 +3,9 @@ import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
export var test = ""
ReactDOM.render(<App />, document.getElementById('root'));
// If you want your app to work offline and load faster, you can change
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment