]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Work in progress javascript compiler
authorDale Weiler <killfieldengine@gmail.com>
Mon, 12 Nov 2012 02:47:25 +0000 (02:47 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Mon, 12 Nov 2012 02:47:25 +0000 (02:47 +0000)
index.html
javascripts/compiler.js [new file with mode: 0644]
stylesheets/styles.css
test.html [new file with mode: 0644]

index d6fee39f5dabe805acf2b8539923d011c7da3bdc..8badc788873743ca177c426c5d2a65fb22ce3b67 100644 (file)
@@ -25,6 +25,7 @@
           <li class="download"><a class="buttons" href="https://github.com/graphitemaster/gmqcc/zipball/master">Download ZIP</a></li>
           <li class="download"><a class="buttons" href="https://github.com/graphitemaster/gmqcc/tarball/master">Download TAR</a></li>
           <li><a class="buttons issues" href="https://github.com/graphitemaster/gmqcc/issues">Issues</a></li>
+          <li><a class="buttons test"   href="test.html">Try it</a></li>
           <li><a class="buttons github" href="https://github.com/graphitemaster/gmqcc">View On GitHub</a></li>
         </ul>
 
diff --git a/javascripts/compiler.js b/javascripts/compiler.js
new file mode 100644 (file)
index 0000000..bd7dbaa
--- /dev/null
@@ -0,0 +1,25 @@
+// compiler bootstraps down to the emcscripten compiled compiler
+// and the execution
+
+var std     = "gmqcc";
+var example = "1";
+function update() {
+    var select = document.getElementById("std");
+    var change = select.options[select.selectedIndex].value;
+    if (change != std) {
+        std = change;
+    }
+        
+    select = document.getElementById("eg");
+    change = select.options[select.selectedIndex].value;
+    if (change != example) {
+        example = change;
+    }
+}
+
+function compile() {
+    var string = '"' + document.getElementById("input").value + '"';
+    string += " -std="+std+" ";
+    
+    document.getElementById("output").value = string;
+}
index a2dfecff42eda25ba73ec85f64819bb1a1a703e2..00958563d3d260aa4bdffdc08aa9452858400a08 100644 (file)
@@ -33,8 +33,16 @@ body {
        background-color: #FBFAF7;
        margin: 0;
        line-height: 1.8em;
-       -webkit-font-smoothing: antialiased;
+       -webkit-font-smoothing: antialiased;    
+
+}
 
+textarea {
+    outline: none;
+    resize: none;
+    background-color: #FBFAF7;
+    border: 1;
+    border-color: red;
 }
 
 h1, h2, h3, h4, h5, h6 {
diff --git a/test.html b/test.html
new file mode 100644 (file)
index 0000000..a49d83c
--- /dev/null
+++ b/test.html
@@ -0,0 +1,61 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+    <title>GMQCC by graphitemaster</title>
+
+    <link rel="stylesheet" href="stylesheets/styles.css">
+    <link rel="stylesheet" href="stylesheets/pygment_trac.css">
+    <script src="javascripts/scale.fix.js"></script>
+    <script src="javascripts/compiler.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <a href="https://github.com/graphitemaster/gmqcc"><div class="fork"></div></a>
+    <div class="wrapper">
+      <header>
+          
+        <h1 class="header">GMQCC</h1>
+        <p class="header">An Improved Quake C Compiler</p>
+
+        <ul>
+          <li class="download"><a class="buttons" href="https://github.com/graphitemaster/gmqcc/zipball/master">Download ZIP</a></li>
+          <li class="download"><a class="buttons" href="https://github.com/graphitemaster/gmqcc/tarball/master">Download TAR</a></li>
+          <li><a class="buttons issues" href="https://github.com/graphitemaster/gmqcc/issues">Issues</a></li>
+          <li><a class="buttons test"   href="test.html">Try it</a></li>
+          <li><a class="buttons github" href="https://github.com/graphitemaster/gmqcc">View On GitHub</a></li>
+        </ul>
+
+      </header>
+      <section>
+        <h3>Try it from your browser</h3>
+        Load Example:
+        <select id="eg" onchange="update()">
+            <option value="1">Hello World</option>
+            <option value="2">Loops</option>
+        </select>
+        &nbsp;
+        Standard:
+        <select id="std" onchange="update()">
+            <option value="qcc">QCC</option>
+            <option value="fteqcc">FTEQCC</option>
+            <option value="gmqcc">GMQCC</option>
+        </select>
+        <textarea id="input" rows="18" cols="100%"></textarea>
+        <button onclick="compile();">Compile &amp; Run</button>
+        <h4>Compiler Output:</h4>
+        <textarea id="output" rows="8" cols="100%"></textarea>
+        <h4>Execution Output:</h4>
+        <textarea id="exec" rows="8", cols="100%"></textarea>
+      </section>
+      <footer>
+        <script type="text/javascript" src="http://www.ohloh.net/p/602517/widgets/project_partner_badge.js"></script>
+      </footer>
+    </div>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+  </body>
+</html>