diff --git a/examples/snip.rkt b/examples/snip.rkt new file mode 100644 index 0000000..35232fb --- /dev/null +++ b/examples/snip.rkt @@ -0,0 +1,593 @@ +#reader(lib"read.ss""wxme")WXME0108 ## +#| + This file uses the GRacket editor format. + Open this file in DrRacket version 5.1.2 or later to read it. + + Most likely, it was created by saving a program in DrRacket, + and it probably contains a program with non-text elements + (such as images or comment boxes). + + http://racket-lang.org/ +|# + 28 7 #"wxtext\0" +3 1 6 #"wxtab\0" +1 1 8 #"wximage\0" +2 0 8 #"wxmedia\0" +4 1 34 #"(lib \"syntax-browser.ss\" \"mrlib\")\0" +1 0 16 #"drscheme:number\0" +3 0 44 #"(lib \"number-snip.ss\" \"drscheme\" \"private\")\0" +1 0 36 #"(lib \"comment-snip.ss\" \"framework\")\0" +1 0 43 #"(lib \"collapsed-snipclass.ss\" \"framework\")\0" +0 0 19 #"drscheme:sexp-snip\0" +0 0 36 #"(lib \"cache-image-snip.ss\" \"mrlib\")\0" +1 0 68 +( + #"((lib \"image-core.ss\" \"mrlib\") (lib \"image-core-wxme.rkt\" \"mr" + #"lib\"))\0" +) 1 0 33 #"(lib \"bullet-snip.ss\" \"browser\")\0" +0 0 29 #"drscheme:bindings-snipclass%\0" +1 0 25 #"(lib \"matrix.ss\" \"htdp\")\0" +1 0 22 #"drscheme:lambda-snip%\0" +1 0 57 +#"(lib \"hrule-snip.rkt\" \"macro-debugger\" \"syntax-browser\")\0" +1 0 45 #"(lib \"image-snipr.ss\" \"slideshow\" \"private\")\0" +1 0 26 #"drscheme:pict-value-snip%\0" +0 0 38 #"(lib \"pict-snipclass.ss\" \"slideshow\")\0" +2 0 55 #"(lib \"vertical-separator-snip.ss\" \"stepper\" \"private\")\0" +1 0 18 #"drscheme:xml-snip\0" +1 0 31 #"(lib \"xml-snipclass.ss\" \"xml\")\0" +1 0 21 #"drscheme:scheme-snip\0" +2 0 34 #"(lib \"scheme-snipclass.ss\" \"xml\")\0" +1 0 10 #"text-box%\0" +1 0 32 #"(lib \"text-snipclass.ss\" \"xml\")\0" +1 0 15 #"test-case-box%\0" +2 0 1 6 #"wxloc\0" + 0 0 55 0 1 #"\0" +0 75 1 #"\0" +0 12 90 -1 90 -1 3 -1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 255 255 255 1 -1 0 9 +#"Standard\0" +0 75 10 #"Monospace\0" +0 13 90 -1 90 -1 3 -1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 255 255 255 1 -1 2 1 +#"\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 -1 -1 2 24 +#"framework:default-color\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 1 +#"\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 150 0 150 0 0 0 -1 -1 2 15 +#"text:ports out\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 150 0 150 0 0 0 -1 -1 2 1 +#"\0" +0 -1 1 #"\0" +1.0 0 -1 -1 93 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 255 0 0 0 0 0 -1 +-1 2 15 #"text:ports err\0" +0 -1 1 #"\0" +1.0 0 -1 -1 93 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 255 0 0 0 0 0 -1 +-1 2 1 #"\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 175 0 0 0 -1 -1 2 17 +#"text:ports value\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 175 0 0 0 -1 -1 2 1 +#"\0" +0 -1 1 #"\0" +1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 34 139 34 0 0 0 -1 +-1 2 27 #"Matching Parenthesis Style\0" +0 -1 1 #"\0" +1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 34 139 34 0 0 0 -1 +-1 2 1 #"\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 38 38 128 0 0 0 -1 -1 2 37 +#"framework:syntax-color:scheme:symbol\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 38 38 128 0 0 0 -1 -1 2 38 +#"framework:syntax-color:scheme:keyword\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 38 38 128 0 0 0 -1 -1 2 1 +#"\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 194 116 31 0 0 0 -1 -1 2 +38 #"framework:syntax-color:scheme:comment\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 194 116 31 0 0 0 -1 -1 2 1 +#"\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 41 128 38 0 0 0 -1 -1 2 37 +#"framework:syntax-color:scheme:string\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 41 128 38 0 0 0 -1 -1 2 39 +#"framework:syntax-color:scheme:constant\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 41 128 38 0 0 0 -1 -1 2 1 +#"\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 132 60 36 0 0 0 -1 -1 2 42 +#"framework:syntax-color:scheme:parenthesis\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 132 60 36 0 0 0 -1 -1 2 1 +#"\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 36 +#"framework:syntax-color:scheme:error\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 1 +#"\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 36 +#"framework:syntax-color:scheme:other\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 1 +#"\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 81 112 203 0 0 0 -1 -1 2 +38 #"drracket:check-syntax:lexically-bound\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 81 112 203 0 0 0 -1 -1 2 1 +#"\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 178 34 34 0 0 0 -1 -1 2 28 +#"drracket:check-syntax:set!d\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 178 34 34 0 0 0 -1 -1 2 1 +#"\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 68 0 203 0 0 0 -1 -1 2 31 +#"drracket:check-syntax:imported\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 68 0 203 0 0 0 -1 -1 2 47 +#"drracket:check-syntax:my-obligation-style-pref\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 178 34 34 0 0 0 -1 -1 2 1 +#"\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 116 0 0 0 0 -1 -1 2 50 +#"drracket:check-syntax:their-obligation-style-pref\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 116 0 0 0 0 -1 -1 2 48 +#"drracket:check-syntax:unk-obligation-style-pref\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 1 +#"\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 139 142 28 0 0 0 -1 -1 2 +49 #"drracket:check-syntax:both-obligation-style-pref\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 139 142 28 0 0 0 -1 -1 2 +26 #"plt:htdp:test-coverage-on\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 1 +#"\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 255 165 0 0 0 0 -1 -1 2 27 +#"plt:htdp:test-coverage-off\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 255 165 0 0 0 0 -1 -1 4 1 +#"\0" +0 70 1 #"\0" +1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0 +-1 -1 4 4 #"XML\0" +0 70 1 #"\0" +1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0 +-1 -1 2 1 #"\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 34 139 34 0 0 0 -1 -1 2 37 +#"plt:module-language:test-coverage-on\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 34 139 34 0 0 0 -1 -1 2 1 +#"\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 176 48 96 0 0 0 -1 -1 2 38 +#"plt:module-language:test-coverage-off\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 176 48 96 0 0 0 -1 -1 4 1 +#"\0" +0 71 1 #"\0" +1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0 +-1 -1 4 1 #"\0" +0 -1 1 #"\0" +1.0 0 -1 -1 -1 -1 -1 -1 1 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 0 255 0 0 0 -1 +-1 4 1 #"\0" +0 71 1 #"\0" +1.0 0 -1 -1 -1 -1 -1 -1 1 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 0 255 0 0 0 -1 +-1 4 1 #"\0" +0 71 1 #"\0" +1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 100 0 0 0 0 -1 +-1 0 1 #"\0" +0 75 10 #"Monospace\0" +0.0 13 90 -1 90 -1 3 -1 0 1 0 1 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255 +255 255 1 -1 4 1 #"\0" +0 -1 1 #"\0" +1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 255 255 0 -1 -1 0 +1 #"\0" +0 -1 1 #"\0" +1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 200 0 0 0 0 0 -1 -1 + 0 35 0 24 3 12 #"#lang planet" +0 0 4 3 1 #" " +0 0 14 3 14 #"dyoo/whalesong" +0 0 4 29 1 #"\n" +0 0 22 3 1 #"(" +0 0 14 3 7 #"require" +0 0 4 3 1 #" " +0 0 22 3 1 #"(" +0 0 14 3 6 #"planet" +0 0 4 3 1 #" " +0 0 14 3 20 #"dyoo/whalesong/image" +0 0 22 3 2 #"))" +0 0 4 29 1 #"\n" +0 0 4 29 1 #"\n" +0 0 22 3 1 #"(" +0 0 15 3 6 #"define" +0 0 4 3 1 #" " +0 0 14 3 6 #"a-snip" +0 0 4 3 1 #" " +0 2 35 4 1 #"\0" +2 -1.0 -1.0 0.0 0.0 0 12 500 +( + #"\211PNG\r\n\32\n\0\0\0\rIHDR\0\0\0X\0\0\0U\b" + #"\6\0\0\0\315\v#\352\0\0\0\6bKGD\0\377\0\377\0\377\240\275\247" + #"\223\0\0\25\355IDATx\234\355" + #"\234Y\254\34\305\271\200\277\252\236\231\263" + #"y7\266\317\361n\360\2\266\3\16\306\vf7\216\223\\ \21I\20\302\271\220" + #"D\212\24\244D\21\nW\271I$\256P\224\227(/\311KP\36\22\31\t\2" + #"\17(\4\"\24\226k.\4\204\314*\300\6cb\233\v\266\217}\354\30\373\370" + #",\263tW\325}\250\251\236\232\236\356Y\354c@W\374R\251{z\252{\252" + #"\276\371\373\257\277\376Z\4`\370LH" + #"\16\350\5\246\0\223\200n\244\314c\214" + #" \b\24RV\20\242H\30\236\306\230Q\240\4h\314g\244\364Y\"\370\224\0" + #"O\236<\203\201\201\305,^\274\224y" + #"\363\26\323\337\337O>?\235R\251\207#Gr\274\367^\300\256]\206R\311\0" + #"\32!\24P\301\230q`\24)?F\210#\b\361\21B\374/Qt\4\30\377" + #"\314\1\377D\1\367\317[\304\232\265\353" + #"\270l\375:\226-[\312\254i\323\350)\4H\t\306h\300T\217\2320\324\34" + #"8\240y\350!\315\363\317k@\1\272Z\\\355\235G\3008\360/\204\330\207\20" + #"\273\201\177b\314\360g\2\3669\a\334=e\n\3536ld\363\225W\261f\356" + #"\\f\227K\344N\17C>\217\276\350" + #"B\30\230\213\bCL\225\206\326\272\232" + #"\24Bh\224R\334\177\277b\373v\205" + #"\205\234\226\34p\2002B\34C\312\335\300kh\375A\374\354OC\316\31\340I" + #"\347\235\307\346u\353\270i\351RV\236" + #"\32\246g\317\273\210\375\373\221'O\22" + #"\0\1 \346\314\201{\357\305|\365\253\230\361q\2141(\245\352\222" + #"\326\nc\"~\363\233\210G\37\215\260\32\353\222\362\216>lU-\305" +) 500 +( + #"(\260\27)_\4\366\242\265\342\223\226" + #"\t\a\234\v\2\256\17\2\266\255X\301\3120\244g\377~raH\36\310c\233" + #"2\a\30\300L\232\204\371\323\237\320[" + #"\267\242\307\307QJ\21E\21a\30\306G\255#FFB\356\2743\344\335wC" + #",\324\260\232\34d\22745\350\316\214" + #"\24\221\362=\204\370\37\264\336\377\211\232" + #"\216\211\3,\4\253\244\344\373\300\225Z\323g\f]X\277\240\e(`\341\n@" + #"V\217N\314\300\0\321\263\317\22.YB8>N\30\206T*\225\272\243\224!" + #";vD\334uW\5\255\35d?\371\327\2346\373\347\32\30A\210\327\201\3470" + #"\346\324\204T\273\225\4\300\275g\373\220" + #"B\20\360\357R\3623\245Xk\fS\201\31\300t\254\323\325\203\5\3544\327\1" + #"vI\216\216\22\f\16\222\273\3556d\20 \204\250K\0J\t\346\3177\354\334" + #"i8z\324\375rR7\4\351b\252)\a,\0\226\"\345\bp\354l\253\336" + #"R\316\32\360\202|\236\377\22\202mQ" + #"\304\0\26\354L\240\17k\22\222\332\232%b\357^\344e\227\21\254\\I %" + #"R\312:\300\0]] \4\354\330\341" + #"\337i\22\347\315~\315\201\356\303\230\345" + #"\4A7p\220\232\315\236x9+\300\353s9~\245\24W(\305L,\330I" + #"\325\207:\333\343\252\233Uu\207G\0" + #"\346\360a\304\355\267\23\344\363\4A\200" + #"\224\262>\257\201\376~\303\323O\303\360" + #"p\22\254\361\236\226f\365\222\337I\214" + #"\231\17\364c!\227\332\253t\207rf" + #"\200\205\340+A\300\275J\261\22\230\205" + #"5\ay\352!f\235\223\270\356\276\23" + #"\207\16\301\365\327\303\242EH)c\310\316\3152\6&O6\34?\16\257\276\n" + #"\265F\314\207\353\334\265,\310&q>\23k6\216\0#mT\2763" + #"\351\34\260\224|+\b\370\231R,\1fc\315A\253\27\323IS\2156" +) 500 +( + #"\6\272\273\341\206\el^!bSa\277\266P\246L1\374\345/\20E\256\323" + #"\221\246\301\311\224U\"S\255\301B\244" + #"\34\302\230\341\246\325\357Td\353,\236" + #"\b\301\267\202\200\377\210\"\26b\341v{_\247U+\r\256;O{\241\3153" + #"\317`\306\306\354\2711H)\351\352\352" + #"\242\273\273\233\256\256.\244,\260jU" + #"\201\265ks\330F\313\245\254&4\231dF\232\211\3267\20\4\363;B\322J" + #":\2\374oRrw\30\262\0\v\267\340}\3474\322\177\345I|NBO\263" + #"\323|\360\1\274\365V|\335A.\24\ntuu\221\317\27\350\353\313s\323M" + #"i\236u\328\341\375\232\179\r\366L\224\372j\265v\23#m\3^/%" + #"\377\251T\254\271\371\304\367\311\327=\v" + #"t\332\365\272\262)E\244\224\344r9\214\311\261~}\216\215\e;\201\333" + #"\314P\371Z\35\0y\214\271\4!\26\265Q\213li\n\370\vB\360\355(b" + #"\0060\255\305\203\322\376\350\266zpi" + #"\27\213E\370\360\303\364\374B\20\4\1" + #"A\220\243\247'\340\333\337N\263\275I3Q\347mg\224B\244\334" + #"\327\207\326\e\260\235\3753\223L\300\5!\370\276\326\314\303v\177\203" +) 500 +( + #"\254\214g mE\227j\1\207\6\261" + #"\200\3\224\222l\331\"Y\261\"\315\216" + #"\266c\"|\361\363\372\317\231\3\254n\247\304\231OM\225/K\311F`2g" + #"\363\377\245K[fMf\277\\N\213\205\b\230>=`\333\266,\367,M{" + #"\333\321d\227\334[q!\266\307\327\271" + #"\244\326bj\20p\213\326L\6\246R\363W\323:\20YQ\200\254NG\333i" + #"`\300\36\215\211\23\20\37]7:\212$_\373\232d\336\274\206\30]\n0'" + #"\315\376\3424wn2\260\272.\360\324" + #"\256\244\2\336\n\254\250\206\35\375\236Z" + #"\332\377\237,~\332\365\216\323\244I\210" + #"%K\354y\"l\351\316]\254\2$\375\375\222[n\311\202\332\252qKJ\22" + #"\2563\27\v\261Njg\322\0x\262" + #"\20\334\240\24\223\260\261\334\316\372\322\331" + #"\322N|+\226\345\313a\341\302\372\274" + #"\211a\b\a\331j\261\340\e\337\220\314" + #"\234\331\nr\273\222\346U\364a\314\212" + #"\16\236a\245\201\337\345\300Rj#\21I\311\n\233\264j\270|3\223&uf" + #"\346\252\2530\371|\235i\250\313kL\235fk-Y\270Pp\323M\376\257\245" + #"\275[\315 \247EM\222\232<\37k4\333\227:\300\201\224l\26\202n,`" + #"\337s\310*f\263&#)\315\356\255C\261uk\235y\240z\336\360\274\0302" + #"h\r\337\374\246\240\257/\313\307\315\372" + #"\334\254\264\376Q\2\275\b\2610#\177" + #"\272\324\1^\"%\27iM\36\253\275" + #"\235\233\364\t\220\205\va\323\246\246Y" + #"\322\354r\24\t\226-\23l\336\234z\307Y\24\250\336T\0303\217\306HL\266" + #"\324\1^\217\r\234\27314h\35ame\32Z\231\204\206t\343\215\230i\323" + #"jy\306\3060\17?\2149q\242vo\325l$\207\224\214\201\233o" + #"\206\\\333\301\222\264Q\21'i\346E\2\323\20bz\273?P\3\234\3" +) 500 +( + #"\326x\332\353\227\261\35\210\355\346q)" + #"U\247\202\0\261m[\3557\225\202;" + #"\357\204\333n\203\273\356\302\37oO\263" + #"\315Q\4_\370\2\254Y\223\374e\262" + #"~1\221'\2536\276\231\350\302\0163\265'1\340~!X\24259j\203\225" + #"\311\3077sv\262\212/\0\223\30%" + #"\26B\200\20\215\317\331\260\1\326\257\257" + #"]\373\363\237\341\201\al\276\a\37\204" + #"\307\37\267\371\274\21\16\37\264\326\206B" + #"\1n\2741Y\212$\264\266\372\222\244" + #"kq\2001\347\321\256\177\25\347Z\212" + #"u\247\375~P\326hD\326\365\3642\212\354\335" + #"p\355\265\311\32\264+\255\f\236\300\232" + #"\211\366\3345\t \205`\00153\236\366b4\353\261\371\307\264\342dy\243u" + #"&\342G?BL\236l?\27\213\210\373\356kx\6\0\277\375-\224\313 D" + #"\372(\274\375v\303" + #"=\2\340\345\227\21O>\211\366\0'!G\221\341\374\363\r_\374b;\357^" + #"\262&Y5J\226\244\3\300S\215a\n\3557`\255z\363\235\212\270\373n\230" + #":\325\376V\245\2\277\373]\363g\377" + #"\376\367\3500\254\3\354\203\326\332 \245" + #"a\353\3264\357\240\231\321J\346K-m5\3654+a" + #",\26\260\326\24\252\217t\223?\233\275\\\355\372\303-\253" +) 500 +( + #"c\ff\315\32\314\355\267\327\236\363\364" + #"\323\230W_mn\273\237{\16\365\362\313\250 \310\204\\.k\326\2541,Y" + #"\322\256\211h\347{'\316\16\267v\270-`!\2204\2\316\322hR\276k\370" + #"/\215ii\307\21\2\356\271\az{" + #"\3555c\340\276\373\20\325{\263\356\323" + #"\225\n\352\301\aQ)f\242\366\331\320" + #"\323\243\371\322\227\222\23S\232ih+" + #"\225\361\363H\332\6\334\27\4\30\352'" + #"}\352D\30635\5\231\367\31\203\370" + #"\362\227\341\353_\257]{\353-\304\263" + #"\317\266|\246\6\324\343\217\243>\372\b" + #"\225\230\264\355C\256T\f\e7\32f\315j\69\353\35\245E^I;]f" + #"\t\220S\252N{\335,\333\263\226\254" + #"\231\316\306@o/\346\227\277\204\300\v" + #")m\337\16\245\346\223\360\f\325\231\300" + #"\203\203\250g\236A\5Au&|\243\231\210\"\303\264i\326\243h\17p\253\306" + #"0i&\332\264\3019h\0\0346\271\251#m\316\202\374\275\357!\326\255\253=" + #"\353\304\tx\344\221\226\217\363\25@=" + #"\362\bQ\261\230j\207-dM\245\242\271\342\n;\237\255V\313f\r\\\362\330" + #"\354\17h\23\260\277vGa\341\226\231" + #"\300Y\263\306\324\247y\363\340\27\277\210" + #"\277\26\0\177\373\e\34>\334\3741\324" + #"\346\261+ z\3555\324\356\335()" + #"\23\353:j\220\243\310\232\210+\257\364W&ub*\332\371#\262E\2\204\306" + #"\304\366\327\301-\323\\\213\317J\356\271" + #"\a\346\316\255}\326\32\356\277\277\345m\21P\241\266:#*\225PO\344\6\355u\351\205\27P\247N\241\22P\e\3356\315\246M\332\v" + #"e\266j\364\222`\235\201jo\301L\34[?(D\235\e\344\354\260\323b\267" + #"CCX\375\331d\f\302]K\215_\334}7L\237^\37\203\0\314\37\376`" + #"]4\357Y\356O\316\202\233l\350b" + #"\320\207\16\241\337z\253\251O\354\0\17" + #"\f\30V\257n\267As6\327\a\354\324\256\3\300\37R\363}]\205\212^\32" + #"\253\246qj\326\307\25-\253\323(\0\261z5\334" + #"qGc\b\364\335w\21O" + #"\341p\241\276\315\351X\272\273\273Y\273" + #"v-+\346\317'\37E\4\245\22\271\321Qr\243\243\4\a\16 N\236\314\236" + #"\335N#\350\244\366\372\327:1\23\251" + #"]\354|\236p\313\26*\205\2\245\361" + #"q\306\306\307\31\376\370c\216\f\16r" + #"rx\370\314!\264\220\263\2\f6\336" + #"\260\274P\340\222J\205\311\306\20\320z" + #"\243C\377\307}i\0057\313.\247v\223i\f\227W\226.\245\270`\1##" + #"#\234\32\32\342\350\320\20\243M\346\304M\204\2345`'3\2005X7\316\355" + #"\302\232\265\17_Z!H\24\244\35\310" + #"iv\330\a\233\234\320X\4N\367\366" + #"\362\257 \340\330\310\310\304\314\342o!" + #"\23\6\30,\310\363\201\213\260\353 \375" + #"\rY\342\215\361i\324\3464\260\376y" + #"\26\3304{\254\251\357\35\272\250\3028\266ov\234s\261\211m\266L(`'" + #"\275\300\5B\260\330\230x\303\346\206a%\322\375b\22\347\255:#\311ASg" + #"\22|\260\247\261Q\205\223\347\242\262" + #"-\344\234\0v\322\v,\22\202\371\325\r\226\234\351H" + #"&\177\354/)\315\32\270d\360\307\245\nvx\3624\326" +) 188 +( + #"w\37\256\346\3714\344\234\2v\222\307" + #"n\3576\200\335}\314\355G\2216\2432M\262\\3gg}s0\216\5z" + #"\n\333\373\374\24456)\237\b`_" + #"z\260\r\342\f\254\235\356\301\216\353\371" + #"\235\20\2238\317r\301\\\3035\16\214\n\301(0Z]o\362Y\221O\34\260" + #"/\201\20\364\30C/\325]\256\204\240`L\274!H@\343p~\b\224\205\240" + #"dL<\335\252\302\247\257\251Y\362\251" + #"\2\316\22Au\352\225\277\205\214\20\250" + #"\2545w\237a\371L\2\376\377$\23" + #"\265\261\337\347\222!\237\3>\307\3629\340s,\237\3>\307\362" + #"\177z\314\306\205O<{Y\0\0\0\0IEND\256B`\202" +) 0 0 22 3 1 #")" +0 0 4 29 1 #"\n" +0 0 22 3 1 #"(" +0 0 14 3 11 #"image-width" +0 0 4 3 1 #" " +0 0 14 3 6 #"a-snip" +0 0 22 3 1 #")" +0 0 4 29 1 #"\n" +0 0 22 3 1 #"(" +0 0 14 3 12 #"image-height" +0 0 4 3 1 #" " +0 0 14 3 6 #"a-snip" +0 0 22 3 1 #")" +0 0 4 29 1 #"\n" +0 0 14 3 6 #"a-snip" +0 0 diff --git a/expand-out-images.rkt b/expand-out-images.rkt index 7f02bec..8f6d8c5 100644 --- a/expand-out-images.rkt +++ b/expand-out-images.rkt @@ -1,9 +1,10 @@ #lang racket/base -(require syntax/kerncase - (for-template (planet dyoo/whalesong/lang/kernel) - "resource.rkt") - "resource.rkt") +(require planet/version + syntax/kerncase + net/base64 + (for-template (this-package-in lang/kernel)) + (this-package-in image/main)) (provide expand-out-images) @@ -136,9 +137,13 @@ (dynamic-require 'file/convertible 'convert))) (cond [(image? (syntax-e datum-stx)) - (with-syntax ([image-bytes (convert (syntax-e datum-stx) 'png-bytes)]) + (with-syntax ([image-uri + (string-append "data:image/png;charset=utf-8;base64," + (bytes->string/utf-8 + (base64-encode + (convert (syntax-e datum-stx) 'png-bytes))))]) (quasisyntax/loc datum-stx - (make-bytes-resource #f #f image-bytes)))] + (image-url image-uri)))] [else (k datum-stx)])) diff --git a/get-module-bytecode.rkt b/get-module-bytecode.rkt index 5387848..6cd43ec 100644 --- a/get-module-bytecode.rkt +++ b/get-module-bytecode.rkt @@ -4,12 +4,7 @@ syntax/modcode "language-namespace.rkt" "logger.rkt" - "expand-out-images.rkt" - syntax/kerncase - (for-template (planet dyoo/whalesong/lang/kernel) - "resource.rkt") - - "resource.rkt") + "expand-out-images.rkt") (provide get-module-bytecode) @@ -24,38 +19,39 @@ (define (get-module-bytecode x) (log-debug "grabbing module bytecode for ~s" x) - (let ([compiled-code - (cond - ;; Assumed to be a path string - [(string? x) - (get-compiled-code-from-path (normalize-path (build-path x)))] - - [(path? x) - (get-compiled-code-from-path x)] - - ;; Input port is assumed to contain the text of a module. - [(input-port? x) - (get-compiled-code-from-port x)] - - [else - (error 'get-module-bytecode)])]) - (let ([op (open-output-bytes)]) - (write compiled-code op) - (get-output-bytes op)))) - - -;; Tries to use get-module-code to grab at module bytecode. Sometimes -;; this fails because it appears get-module-code tries to write to -;; compiled/. -(define (get-compiled-code-from-path p) - (with-handlers ([void (lambda (exn) - ;; Failsafe: try to do it from scratch - (call-with-input-file* p - (lambda (ip) - (get-compiled-code-from-port ip))))]) - (get-module-code p))) + (define-values (compiled-code alternative-f) + (cond + ;; Assumed to be a path string + [(string? x) + (log-debug "assuming path string") + (values (get-compiled-code-from-path (normalize-path (build-path x))) + (lambda () + (call-with-input-file* (normalize-path (build-path x)) + get-compiled-code-from-port) + ))] + + [(path? x) + (values (get-compiled-code-from-path x) + (lambda () + (call-with-input-file* x get-compiled-code-from-port)))] + + ;; Input port is assumed to contain the text of a module. + [(input-port? x) + (values (get-compiled-code-from-port x) + (lambda () + (get-compiled-code-from-port x)))] + + [else + (error 'get-module-bytecode)])) + (with-handlers ([exn? (lambda (exn) + (define op (open-output-bytes)) + (write (alternative-f) op) + (get-output-bytes op))]) + (define op (open-output-bytes)) + (write compiled-code op) + (get-output-bytes op))) @@ -67,6 +63,21 @@ #;(make-base-namespace)) + +;; Tries to use get-module-code to grab at module bytecode. Sometimes +;; this fails because it appears get-module-code tries to write to +;; compiled/. +(define (get-compiled-code-from-path p) + (log-debug "get-compiled-code-from-path") + (with-handlers ([exn? (lambda (exn) + ;; Failsafe: try to do it from scratch + (log-debug "parsing from scratch") + (call-with-input-file* p + (lambda (ip) + (get-compiled-code-from-port ip))))]) + (get-module-code p))) + + (define (get-compiled-code-from-port ip) (parameterize ([read-accept-reader #t] [current-namespace base-namespace]) diff --git a/image/private/js-impl.js b/image/private/js-impl.js index ff82e9a..4d8663a 100644 --- a/image/private/js-impl.js +++ b/image/private/js-impl.js @@ -314,12 +314,12 @@ EXPORTS['image-url'] = ); }); - EXPORTS['open-image-url'] = plt.baselib.functions.renameProcedure(EXPORTS['image-url'], 'open-image-url'); + EXPORTS['overlay'] = makePrimitiveProcedure( 'overlay', diff --git a/image/private/main.rkt b/image/private/main.rkt index 39a790a..c6cae6b 100644 --- a/image/private/main.rkt +++ b/image/private/main.rkt @@ -61,9 +61,4 @@ angle? side-count? step-count? - - image? - - )) - - + image?)) diff --git a/image/private/racket-impl.rkt b/image/private/racket-impl.rkt index a310a7d..0b79622 100644 --- a/image/private/racket-impl.rkt +++ b/image/private/racket-impl.rkt @@ -61,6 +61,7 @@ ;; Something funky is happening on the Racket side of things with regards ;; to step-count? See: http://bugs.racket-lang.org/query/?cmd=view&pr=12031 ;; step-count? + ) @@ -86,4 +87,10 @@ (and (integer? x) (>= x 1))) + +(define (png-bytes->image bytes) + (error 'png-bytes->image "not implemented yet")) + + + (provide (rename-out [my-step-count? step-count?])) \ No newline at end of file diff --git a/js-assembler/assemble-helpers.rkt b/js-assembler/assemble-helpers.rkt index 51e0d3e..d751e65 100644 --- a/js-assembler/assemble-helpers.rkt +++ b/js-assembler/assemble-helpers.rkt @@ -3,7 +3,8 @@ (require "../compiler/il-structs.rkt" "../compiler/expression-structs.rkt" "../compiler/lexical-structs.rkt" - racket/list) + racket/list + racket/string) (provide assemble-oparg assemble-target @@ -122,8 +123,15 @@ (format "RUNTIME.NULL")] [(number? val) (assemble-numeric-constant val)] + [(string? val) + (format "~s" val)] + [(bytes? val) + (format "RUNTIME.makeBytes(~a)" + (string-join (for/list ([a-byte val]) + (number->string a-byte)) + ","))] [else - (format "~s" val)]))) + (error 'assemble-const "Unsupported datum ~s" val)]))) (: assemble-listof-assembled-values ((Listof String) -> String)) (define (assemble-listof-assembled-values vals) diff --git a/js-assembler/runtime-src/baselib-bytes.js b/js-assembler/runtime-src/baselib-bytes.js index d608ef1..045610c 100644 --- a/js-assembler/runtime-src/baselib-bytes.js +++ b/js-assembler/runtime-src/baselib-bytes.js @@ -37,7 +37,6 @@ if (end === null || end === undefined) { end = this.bytes.length; } - return new Bytes( this.bytes.slice(start, end), true ); }; @@ -63,12 +62,12 @@ Bytes.prototype.toString = function(cache) { - var ret = '', i; + var ret = [], i; for (i = 0; i < this.bytes.length; i++) { - ret += String.fromCharCode(this.bytes[i]); + ret.push(String.fromCharCode(this.bytes[i])); } - return ret; + return ret.join(''); }; Bytes.prototype.toDisplayedString = Bytes.prototype.toString; @@ -106,9 +105,16 @@ return ret.join(''); }; + var makeBytes = function(bytes) { + return new Bytes(bytes); + }; + var isBytes = baselib.makeClassPredicate(Bytes); exports.Bytes = Bytes; + exports.makeBytes = makeBytes; + exports.isBytes = isBytes; + }(this.plt.baselib)); \ No newline at end of file diff --git a/js-assembler/runtime-src/baselib-check.js b/js-assembler/runtime-src/baselib-check.js index dd1255e..13e8a25 100644 --- a/js-assembler/runtime-src/baselib-check.js +++ b/js-assembler/runtime-src/baselib-check.js @@ -171,6 +171,10 @@ baselib.numbers.isByte, 'byte'); + var checkBytes = makeCheckArgumentType( + baselib.bytes.isBytes, + 'bytes'); + var checkNaturalInRange = makeCheckParameterizedArgumentType( function (x, a, b) { if (! baselib.numbers.isNatural(x)) { return false; } @@ -248,6 +252,7 @@ exports.checkNatural = checkNatural; exports.checkNaturalInRange = checkNaturalInRange; exports.checkByte = checkByte; + exports.checkBytes = checkBytes; exports.checkInteger = checkInteger; exports.checkRational = checkRational; exports.checkPair = checkPair; diff --git a/js-assembler/runtime-src/runtime.js b/js-assembler/runtime-src/runtime.js index ee7f914..d9458f7 100644 --- a/js-assembler/runtime-src/runtime.js +++ b/js-assembler/runtime-src/runtime.js @@ -42,7 +42,9 @@ var makeBignum = baselib.numbers.makeBignum; var makeComplex = baselib.numbers.makeComplex; + var makeSymbol = baselib.symbols.makeSymbol; + var makeBytes = baselib.bytes.makeBytes; var makeBox = baselib.boxes.makeBox; var isBox = baselib.boxes.isBox; @@ -674,6 +676,7 @@ exports['makeBignum'] = makeBignum; exports['makeComplex'] = makeComplex; exports['makeSymbol'] = makeSymbol; + exports['makeBytes'] = makeBytes; // Type predicates