Permalink
Browse files

Initial commit, ASCII chicken: <")3

  • Loading branch information...
0 parents commit 5f2c984b79f58dc6ed80a243741d8a442895287a @vmg committed Apr 21, 2011
Showing with 100 additions and 0 deletions.
  1. +6 −0 .gitmodules
  2. +30 −0 Makefile
  3. +1 −0 emscripten
  4. +28 −0 index.html
  5. +22 −0 js_wrap.c
  6. +1 −0 upskirt
  7. +12 −0 upskirt.js
@@ -0,0 +1,6 @@
+[submodule "upskirt"]
+ path = upskirt
+ url = git://github.com/tanoku/upskirt.git
+[submodule "emscripten"]
+ path = emscripten
+ url = git://github.com/kripken/emscripten.git
@@ -0,0 +1,30 @@
+CC=clang
+LLVM_FLAGS=-arch i386 -c -D_FORTIFY_SOURCE=0 -emit-llvm -Iupskirt/src -Iupskirt/render
+EMS=emscripten/emscripten.py
+JS_ENGINE=d8
+
+all: upskirt_ems.js
+
+.PHONY: all clean
+
+upskirt_ems.js: upskirt.ll
+ $(EMS) $^ $(JS_ENGINE) > $@
+
+upskirt.ll: markdown.ll.o array.ll.o buffer.ll.o xhtml.ll.o js_wrap.ll.o
+ llvm-link $^ | llvm-dis -show-annotations > $@
+
+# housekeeping
+clean:
+ rm -f *.o
+ rm -f upskirt.ll upskirt_ems.js
+
+# generic object compilations
+%.ll.o: upskirt/src/%.c
+ $(CC) $(LLVM_FLAGS) -o $@ $<
+
+xhtml.ll.o: upskirt/render/xhtml.c
+ $(CC) $(LLVM_FLAGS) -o $@ $<
+
+js_wrap.ll.o: js_wrap.c
+ $(CC) $(LLVM_FLAGS) -o $@ $<
+
Submodule emscripten added at 512846
@@ -0,0 +1,28 @@
+<html>
+ <head>
+ <title>
+ DAWG
+ </title>
+ <script>
+ function print_parse(text) {
+ document.getElementById('output').innerHTML = text;
+ }
+ </script>
+ <script src="upskirt.js"></script>
+ <script src="upskirt_ems.js"></script>
+ </head>
+ <body onload="document.getElementById('the_input').focus()">
+ <p>
+ YO I HEARD YOU LIKE JAVASCRIPT SO I'VE TRANSLATED SOME C INTO JAVASCRIPT SO YOU CAN MARKDOWN SOME SHIT
+ </p>
+ <hr>
+ <form onsubmit="print_parse(markdown(the_input.value)); the_input.value = ''; return false">
+ <p><b>Enter some Markdown up in this bitch:</b></p>
+ <p><textarea rows="10" cols="80" id="the_input"></textarea>
+ <input type="submit" value="PARSE THE FUCKER"></p>
+ </form>
+ <hr>
+ <div id="output"></div>
+ </body>
+</html>
+
@@ -0,0 +1,22 @@
+#include <string.h>
+#include <markdown.h>
+#include <xhtml.h>
+
+const char *JSUPS_parse(char *text)
+{
+ struct mkd_renderer renderer;
+ struct buf ib = {0, 0, 0, 0, 0};
+ struct buf *ob;
+
+ ib.data = text;
+ ib.size = strlen(text);
+
+ ob = bufnew(64);
+
+ ups_xhtml_renderer(&renderer, 0);
+ ups_markdown(ob, &ib, &renderer, 0xFF);
+ ups_free_renderer(&renderer);
+
+ ob->data[ob->size] = 0;
+ return ob->data;
+}
Submodule upskirt added at 3f01b8
@@ -0,0 +1,12 @@
+function markdown(text) {
+ var ptr = _JSUPS_parse(Pointer_make(intArrayFromString(text)))
+ var len = String_len(ptr)
+ var ret = '';
+
+ for (var i = 0; i < len; i++) {
+ ret += String.fromCharCode(IHEAP[ptr + i]);
+ }
+ return ret;
+}
+
+arguments = [];

0 comments on commit 5f2c984

Please sign in to comment.