From 476a5eca7679a2062fdf21d20b4150183f266e3b Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Tue, 17 Mar 2015 22:15:54 +0100 Subject: Article en homage à Terry Pratchet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/resources/brainfuck.zip | Bin 0 -> 2731 bytes content/resources/js/bf.js | 288 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 288 insertions(+) create mode 100644 content/resources/brainfuck.zip create mode 100644 content/resources/js/bf.js (limited to 'content/resources') diff --git a/content/resources/brainfuck.zip b/content/resources/brainfuck.zip new file mode 100644 index 0000000..8cda9e9 Binary files /dev/null and b/content/resources/brainfuck.zip differ diff --git a/content/resources/js/bf.js b/content/resources/js/bf.js new file mode 100644 index 0000000..d2047c9 --- /dev/null +++ b/content/resources/js/bf.js @@ -0,0 +1,288 @@ +// Generated by js_of_ocaml 2.5 +(function(I){"use strict";var +ac=254,ab=224,Y="+",Z=65535,aa=250,o=1024,X=57343,$=512,e=128,d="",C=" : file already exists",U=56320,V=240,W=2048,a=248,T="/",_="fd ";function +J(a,b,c){var +e=new +Array(c);for(var +d=0;d=c.l||c.t==2&&e>=c.c.length)){c.c=a.t==4?H(a.c,b,e):b==0&&a.c.length==e?a.c:a.c.substr(b,e);c.t=c.c.length==c.l?0:2}else +if(c.t==2&&d==c.c.length){c.c+=a.t==4?H(a.c,b,e):b==0&&a.c.length==e?a.c:a.c.substr(b,e);c.t=c.c.length==c.l?0:2}else{if(c.t!=4)ad(c);var +g=a.c,h=c.c;if(a.t==4)for(var +f=0;f>=1;if(a==0)return c;b+=b;e++;if(e==9)b.slice(0,1)}}function +t(a){if(a.t==2)a.c+=a_(a.l-a.c.length,"\0");else +a.c=H(a.c,0,a.c.length);a.t=0}function +ae(a){if(a.length<24){for(var +b=0;b127)return false;return true}else +return!/[^\x00-\x7f]/.test(a)}function +bh(a){for(var +l=d,f=d,i,h,j,b,c=0,k=a.length;c$){f.substr(0,1);l+=f;f=d;l+=a.slice(c,g)}else +f+=a.slice(c,g);if(g==k)break;c=g}b=1;if(++c=55295&&b<57344)b=2}else{b=3;if(++c1114111)b=3}}}}}if(b<4){c-=b;f+="\ufffd"}else +if(b>Z)f+=String.fromCharCode(55232+(b>>10),U+(b&1023));else +f+=String.fromCharCode(b);if(f.length>o){f.substr(0,1);l+=f;f=d}}return l+f}function +bg(a){switch(a.t){case +9:return a.c;default:t(a);case +0:if(ae(a.c)){a.t=9;return a.c}a.t=8;case +8:return bh(a.c)}}function +g(a,b,c){this.t=a;this.c=b;this.l=c}g.prototype={toString:function(){return bg(this)}};function +a6(a,b){throw[0,a,b]}function +c(a){return new +g(0,a,a.length)}function +ai(a,b){a6(a,c(b))}var +f=[0];function +u(a){ai(f[4],a)}function +m(a){if(a<0)u("String.create");return new +g(a?2:9,d,a)}function +a5(a){throw a}function +a7(){a5(f[6])}function +aS(a,b){if(b==0)a7();return a/b|0}function +aW(a,b){var +c=a[3]<<16,d=b[3]<<16;if(c>d)return 1;if(cb[2])return 1;if(a[2]b[1])return 1;if(a[1]b.c?1:0}function +D(a,b,c){var +e=[];for(;;){if(!(c&&a===b))if(a +instanceof +g)if(b +instanceof +g){if(a!==b){var +d=ba(a,b);if(d!=0)return d}}else +return 1;else +if(a +instanceof +Array&&a[0]===(a[0]|0)){var +f=a[0];if(f===ac)f=0;if(f===aa){a=a[1];continue}else +if(b +instanceof +Array&&b[0]===(b[0]|0)){var +h=b[0];if(h===ac)h=0;if(h===aa){b=b[1];continue}else +if(f!=h)return f1)e.push(a,b,1)}}else +return 1}else +if(b +instanceof +g||b +instanceof +Array&&b[0]===(b[0]|0))return-1;else +if(typeof +a!="number"&&a&&a.compare)return a.compare(b,c);else{if(ab)return 1;if(a!=b){if(!c)return NaN;if(a==a)return 1;if(b==b)return-1}}if(e.length==0)return 0;var +i=e.pop();b=e.pop();a=e.pop();if(i+1=0)}function +bi(a){for(var +h=d,c=h,b,j,f=0,i=a.length;f$){c.substr(0,1);h+=c;c=d;h+=a.slice(f,g)}else +c+=a.slice(f,g);if(g==i)break;f=g}if(b>6);c+=String.fromCharCode(e|b&63)}else +if(b<55296||b>=X)c+=String.fromCharCode(ab|b>>12,e|b>>6&63,e|b&63);else +if(b>=56319||f+1==i||(j=a.charCodeAt(f+1))X)c+="\xef\xbf\xbd";else{f++;b=(b<<10)+j-56613888;c+=String.fromCharCode(V|b>>18,e|b>>12&63,e|b>>6&63,e|b&63)}if(c.length>o){c.substr(0,1);h+=c;c=d}}return h+c}function +F(a){var +b=9;if(!ae(a))b=8,a=bi(a);return new +g(b,a,a.length)}function +bm(a){var +d=a.length,c=new +Array(d);for(var +b=0;b0?l(a,bm(arguments)):l(a,[undefined])}}function +aY(a,b){return+(D(a,b,false)<=0)}function +h(a){ai(f[2],a)}function +aZ(a){if(!a.opened)h("Cannot flush a closed channel");if(a.buffer==d)return 0;if(a.output)switch(a.output.length){case +2:a.output(a,a.buffer);break;default:a.output(a.buffer)}a.buffer=d;return 0}function +j(a){this.data=a}j.prototype={truncate:function(){this.data=m(0)}};function +n(a){return a.l}function +ah(a){a=a +instanceof +g?a.toString():a;h(a+": No such file or directory")}var +aR=T;function +v(a){a=a +instanceof +g?a.toString():a;if(a.charCodeAt(0)!=47)a=aR+a;var +e=a.split(T),b=[];for(var +c=0;c1)b.pop();break;case".":break;case"":if(b.length==0)b.push(d);break;default:b.push(e[c]);break}b.orig=a;return b}function +k(){this.content={}}k.prototype={exists:function(a){return this.content[a]?1:0},mk:function(a,b){this.content[a]=b},get:function(a){return this.content[a]},list:function(){var +a=[];for(var +b +in +this.content)a.push(b);return a},remove:function(a){delete +this.content[a]}};var +x=new +k();x.mk(d,new +k());function +E(a){var +b=x;for(var +c=0;c=g){var +e=m(f+d);s(a.file.data,0,e,0,g);s(h,0,e,f,d);a.file.data=e}a.offset+=d;return 0}function +af(a){var +b;switch(a){case +1:b=bk;break;case +2:b=bj;break;default:b=a9}var +e=f.fds[a];if(e.flags.rdonly)h(_+a+" is readonly");var +c={file:e.file,offset:e.offset,fd:a,opened:true,buffer:d,output:b};w[c.fd]=c;return c}function +a1(){var +a=0;for(var +b +in +w)if(w[b].opened)a=[0,w[b],a];return a}if(!Math.imul)Math.imul=function(a,b){return((a>>16)*b<<16)+(a&Z)*b|0};var +ag=Math.imul;function +a3(a){return a +instanceof +Array?a[0]:a +instanceof +g?252:1e3}function +b(a,b){f[a+1]=b}var +a2={};function +aQ(a){if((a.t&6)!=0)t(a);return a.c}function +a8(a,b){a2[aQ(a)]=b;return 0}var +a4=0;function +p(a){a[2]=a4++;return a}function +a$(){u("index out of bounds")}function +bd(a,b){switch(a.t&6){default:if(b>=a.c.length)return 0;case +0:return a.c.charCodeAt(b);case +4:return a.c[b]}}function +bb(a,b){if(b>>>0>=a.l)a$();return bd(a,b)}function +aO(a,b){return a.length==1?a(b):l(a,[b])}function +aP(a,b,c){return a.length==2?a(b,c):l(a,[b,c])}b(11,[a,c("Undefined_recursive_module"),-12]);b(10,[a,c("Assert_failure"),-11]);b(9,[a,c("Sys_blocked_io"),-10]);b(8,[a,c("Stack_overflow"),-9]);b(7,[a,c("Match_failure"),-8]);b(6,[a,c("Not_found"),-7]);b(5,[a,c("Division_by_zero"),-6]);b(4,[a,c("End_of_file"),-5]);b(3,[a,c("Invalid_argument"),-4]);b(2,[a,c("Failure"),-3]);b(1,[a,c("Sys_error"),-2]);b(0,[a,c("Out_of_memory"),-1]);p([a,c("Pervasives.Exit"),0]);var +al=c("Array.Bottom"),am=c("Sys.Break"),an=c("CamlinternalFormat.Type_mismatch"),aq=c("Js.Error"),at=[0,0,0],as=[0,4,0],au=[0,0,0,0],aE=c("Ook. Ook? "),aF=c("Ook? Ook. "),aG=c("Ook. Ook. "),aH=c("Ook! Ook! "),aI=c("Ook! Ook. "),aJ=c("Ook. Ook! "),aK=c("Ook! Ook? "),aL=c("Ook? Ook! "),aw=c(">"),ax=c("<"),ay=c(Y),az=c("-"),aA=c("."),aB=c(Y),aC=c("["),aD=c("]"),aM=c(d);function +r(a){return 0<=a?a:-a|0}var +K=2147483647,aj=-2147483648;function +i(a,b){if(a){var +c=a[1];return[0,c,i(a[2],b)]}return b}a0(0);af(1);af(2);p([a,al,0]);function +L(a,b){if(b){var +c=b[2],d=aO(a,b[1]);return[0,d,L(a,c)]}return 0}p([a,am,0]);p([a,an,0]);var +M=[0,0];function +N(a){M[1]=[0,a,M[1]];return 0}var +O=I,ap=O.Array,P=p([a,aq,0]),y=[0,P,{}],ao=a3(y)===a?y:y[0+1];a8(c("jsError"),ao);N(function(a){return a[1]===P?[0,F(a[2].toString())]:0});N(function(a){return a +instanceof +ap?0:[0,F(a.toString())]});function +Q(a,b){var +d=0,c=a;for(;;){if(0===c)return d;var +d=[0,b,d],c=c-1|0;continue}}function +z(a,b,c){var +e=b,d=0,f=n(c);for(;;){if(d===f)return e;var +e=aP(a,e,bb(c,d)),d=d+1|0;continue}}function +R(a,b,c){var +d=aS(c,a),e=c-ag(d,a)|0,f=(a/2|0)