Commits

Kenji TOKUDOME committed 181ff0a

fix warnings.

  • Participants
  • Parent commits 16ef96d

Comments (0)

Files changed (4)

 NATIVE_ENABLED = false
 
 # ignore the warning.
-OCAMLFLAGS[] += -w ae
-#OCAMLFLAGS   = -annot -w A-4-32
+#OCAMLFLAGS[] += -w ae
+OCAMLFLAGS   = -annot -w A-4-32
 
 OCAML_LIBS += 
 OCAML_CLIBS +=

File js_of_ocaml_game1/game1.html

   <head>
   </head>
   <body>
+	  <p>
+	  source code:
+	  <a href="https://bitbucket.org/toku/experiment/src" target="_blank">https://bitbucket.org/toku/experiment/src</a>
+	  </p>
     <script src='./game1.js'></script>
   </body>
 </html>

File js_of_ocaml_game1/game1.js

 function caml_sys_get_config () {
   return [0, new MlWrappedString("Unix"), 32, 0];
 }
-(function(){function ce(dg,dh,di){return dg.length==2?dg(dh,di):caml_call_gen(dg,[dh,di]);}function Q(de,df){return de.length==1?de(df):caml_call_gen(de,[df]);}var a=[0,new MlString("Invalid_argument")],b=[0,new MlString("Not_found")];caml_register_global(6,b);caml_register_global(5,[0,new MlString("Division_by_zero")]);caml_register_global(3,a);caml_register_global(2,[0,new MlString("Failure")]);var G=new MlString("%d"),F=new MlString("Pervasives.do_at_exit"),E=new MlString("Random.int"),D=[0,2061652523,1569539636,364182224,414272206,318284740,2064149575,383018966,1344115143,840823159,1098301843,536292337,1586008329,189156120,1803991420,1217518152,51606627,1213908385,366354223,2077152089,1774305586,2055632494,913149062,526082594,2095166879,784300257,1741495174,1703886275,2023391636,1122288716,1489256317,258888527,511570777,1163725694,283659902,308386020,1316430539,1556012584,1938930020,2101405994,1280938813,193777847,1693450012,671350186,149669678,1330785842,1161400028,558145612,1257192637,1101874969,1975074006,710253903,1584387944,1726119734,409934019,801085050],C=new MlString("on"),B=new MlString("canvas"),A=new MlString("mousedown"),z=new MlString("mousemove"),y=new MlString("2d"),x=new MlString("Dom_html.Canvas_not_available"),w=[0,0,0],v=[0,[0,[0,0,0]],0],u=new MlString("#FF0000"),t=new MlString("#000000"),s=new MlString("20pt Arial"),r=new MlString("#FFFFFF"),q=new MlString("Click to Start"),p=new MlString("Reload the page to restart"),o=new MlString("rgb(0,255,0)"),n=new MlString("rgb(255,128,0)"),m=new MlString("rgb(255,255,0)"),l=new MlString("rgb(0,255,255)"),k=[0,16,16],j=[0,4,4],i=[0,8,8];function h(d,c){return caml_lessequal(d,c)?d:c;}function H(f,e){return caml_greaterequal(f,e)?f:e;}function I(g){return 0<=g?g:-g|0;}function N(M){var J=caml_ml_out_channels_list(0);for(;;){if(J){var K=J[2];try {}catch(L){}var J=K;continue;}return 0;}}caml_register_named_value(F,N);function S(P,O){if(O){var R=O[2],T=Q(P,O[1]);return [0,T,S(P,R)];}return 0;}function ae(_){return Q(function(U,W){var V=U,X=W;for(;;){if(X){var Y=X[2],Z=X[1];if(Q(_,Z)){var $=[0,Z,V],V=$,X=Y;continue;}var X=Y;continue;}var aa=V,ab=0;for(;;){if(aa){var ac=aa[2],ad=[0,aa[1],ab],aa=ac,ab=ad;continue;}return ab;}}},0);}var af=[0,0];32===caml_sys_get_config(0)[2];var ag=[0,D.slice(),0];function al(ah){if(!(1073741823<ah)&&0<ah)for(;;){ag[2]=(ag[2]+1|0)%55|0;var ai=caml_array_get(ag[1],ag[2]),aj=(caml_array_get(ag[1],(ag[2]+24|0)%55|0)+(ai^ai>>>25&31)|0)&1073741823;caml_array_set(ag[1],ag[2],aj);var ak=caml_mod(aj,ah);if(((1073741823-ah|0)+1|0)<(aj-ak|0))continue;return ak;}throw [0,a,E];}var am=undefined,ar=null;function aq(an,ao,ap){return an===am?Q(ao,0):Q(ap,an);}var as=false,au=Array;function av(at){return at instanceof au?0:[0,new MlWrappedString(at.toString())];}af[1]=[0,av,af[1]];function aP(ax){return caml_js_wrap_callback(function(aw){if(aw){var ay=Q(ax,aw);if(!(ay|0))aw.preventDefault();return ay;}var az=event,aA=Q(ax,az);az.returnValue=aA;return aA;});}function aQ(aB){return aB.toString();}function aR(aC,aD,aG,aN){if(aC.addEventListener===am){var aE=C.toString().concat(aD),aL=function(aF){var aK=[0,aG,aF,[0]];return Q(function(aJ,aI,aH){return caml_js_call(aJ,aI,aH);},aK);};aC.attachEvent(aE,aL);return function(aM){return aC.detachEvent(aE,aL);};}aC.addEventListener(aD,aG,aN);return function(aO){return aC.removeEventListener(aD,aG,aN);};}var aS=aQ(A),aT=aQ(z),aU=this,aV=aU.document,aX=y.toString(),aW=[0,x];this.HTMLElement===am;function a1(a0){var aY=aV.body,aZ=aV.documentElement;return [0,(a0.clientX+aY.scrollLeft|0)+aZ.scrollLeft|0,(a0.clientY+aY.scrollTop|0)+aZ.scrollTop|0];}function cT(a3,a2){return Q(a3,a2);}function c$(a4,a5){return Q(a5,a4);}function bo(a6){return a6;}function bb(a7){return 1+(a7[7]/5|0)|0;}function bC(a8){return a8[1];}function be(a9){switch(a9[0]){case 1:return j;case 2:return i;default:return k;}}function bK(bc,a_){switch(a_[0]){case 1:var a$=a_[1];return [1,[0,a$[1],a$[2]-5|0]];case 2:var ba=a_[1],bd=bb(bc);return [2,[0,ba[1],ba[2]+bd|0]];default:var bf=be(a_),bg=bf[2],bh=bf[1],bi=bc[6]-bg|0,bj=h(H(bc[8][2],bg),bi),bk=bc[5]-bh|0;return [0,[0,h(H(bc[8][1],bh),bk),bj]];}}function cK(bt,bn,bl){switch(bl[0]){case 1:var bm=bl[1];bn.fillStyle=m.toString();var bp=bo(bm[2]-4|0);return bn.fillRect(bo(bm[1]-4|0),bp,8,8);case 2:var bq=bl[1];bn.fillStyle=l.toString();var br=bo(bq[2]-8|0);return bn.fillRect(bo(bq[1]-8|0),br,16,16);default:var bs=bl[1],bu=2===bt[10]?n.toString():o.toString();bn.fillStyle=bu;var bv=bo(bs[2]-16|0);return bn.fillRect(bo(bs[1]-16|0),bv,32,32);}}function cG(bw){switch(bw[10]){case 1:if(bw[9]){var bx=bw.slice(),by=bw[2],bE=bw[2];for(;;){if(!by)throw [0,b];var bz=by[1],bB=by[2],bA=0===bz[0]?1:0;if(!bA){var by=bB;continue;}var bD=bC(bz);bx[2]=[0,[1,[0,bD[1],bD[2]]],bE];bx[9]=0;var bF=bx;break;}}else var bF=bw;if(0===al(caml_div(30,bb(bF)))){var bG=bF.slice(),bH=bF[2];bG[2]=[0,[2,[0,al(bF[5]),-16]],bH];var bI=bG;}else var bI=bF;var bJ=bI.slice(),bL=bI[2];bJ[2]=S(Q(bK,bI),bL);var bM=[0,bJ[7]],bN=[0,0],b_=function(bO){var bP=bO,bQ=bJ[2];for(;;){if(bQ){var bR=bQ[1],bT=bQ[2],bS=bC(bP),bU=bC(bR),bZ=bS[2],bY=bS[1],bX=bU[2],bW=bU[1],bV=be(bP),b0=be(bR),b3=bV[2],b2=b0[2],b1=b0[1]+bV[1]|0,b4=I(bW-bY|0)<b1?1:0,b5=b4?I(bX-bZ|0)<(b2+b3|0)?1:0:b4;if(b5){switch(bR[0]){case 1:if(2===bP[0]){var b6=bP[1];bM[1]=bM[1]+1|0;var b7=[2,[0,b6[1],bJ[6]+100|0]],b8=2;}else var b8=0;break;case 2:switch(bP[0]){case 2:var b8=0;break;case 0:var b8=1;break;default:var b7=[1,[0,bP[1][1],-100]],b8=2;}break;default:var b8=2===bP[0]?1:0;}switch(b8){case 1:bN[1]=1;var b7=bP;break;case 2:break;default:var b7=bP;}var b9=b7;}else var b9=bP;var bP=b9,bQ=bT;continue;}return bP;}},ca=S(b_,bJ[2]),b$=bJ.slice();b$[2]=ca;b$[7]=bM[1];var cb=bN[1]?2:bJ[10];b$[10]=cb;var cd=function(cc){switch(cc[0]){case 1:return -4<cc[1][2]?1:0;case 2:return cc[1][2]<(b$[6]+16|0)?1:0;default:return 1;}},cg=ce(ae,cd,b$[2]),cf=b$.slice();cf[2]=cg;return cf;case 2:return bw;default:var ch=bw.slice(),ci=bw[2];ch[2]=S(Q(bK,bw),ci);if(ch[9]){var cj=ch.slice();cj[9]=0;cj[10]=1;return cj;}return ch;}}function db(cq,cl){function co(ck){return ck;}function cp(cn){var cm=cl.button-1|0;if(!(cm<0||3<cm))switch(cm){case 1:return 3;case 2:break;case 3:return 2;default:return 1;}return 0;}var cr=1===aq(cl.which,cp,co)?1:0,cs=cq[1].slice();cs[9]=cr;cq[1]=cs;return as;}function c9(cD,cv){function cA(cu){function cx(ct){return [0,cu,ct];}function cy(cw){return a1(cv);}return aq(cv.pageY,cy,cx);}function cB(cz){return a1(cv);}var cC=aq(cv.pageX,cB,cA),cE=cD[1].slice();cE[8]=[0,cC[1],cC[2]];cD[1]=cE;return as;}function c7(cF,cU){var cH=cG(cG(cF[1])),cI=cH[1].getContext(aX);if(2<=cH[10])cI.fillStyle=u.toString();else cI.fillStyle=t.toString();var cJ=bo(cH[6]);cI.fillRect(0,0,bo(cH[5]),cJ);var cL=cH[2],cM=cL,cN=ce(cK,cH,cI);for(;;){if(cM){var cO=cM[2];Q(cN,cM[1]);var cM=cO;continue;}cI.font=s.toString();cI.fillStyle=r.toString();var cS=30,cR=10,cQ=caml_format_int(G,cH[7]);cI.fillText(cT(function(cP){return cP.toString();},cQ),cR,cS);switch(cH[10]){case 1:break;case 2:cI.fillText(p.toString(),100,200);break;default:cI.fillText(q.toString(),150,200);}cF[1]=cH;return 0;}}aU.onload=aP(function(dd){var cV=aU.document,cX=cV.body,cW=aU.document.createElement(B.toString()),cY=0,cZ=0,c0=0,c1=320,c2=480,c3=0,c4=0;if(1-(cW.getContext==ar?1:0)){cW.width=480;cW.height=320;var c5=[0,cW,v,c4,c3,c2,c1,c0,w,cZ,cY],c6=[0,c5];aU.setInterval(caml_js_wrap_callback(Q(c7,c6)),1000/30);var c_=function(c8){return 0;};c$(aR(cV,aT,cT(aP,Q(c9,c6)),as),c_);var dc=function(da){return 0;};c$(aR(cV,aS,cT(aP,Q(db,c6)),as),dc);cX.appendChild(c5[1]);return as;}throw [0,aW];});N(0);return;}());
+(function(){function ce(dj,dk,dl){return dj.length==2?dj(dk,dl):caml_call_gen(dj,[dk,dl]);}function Q(dh,di){return dh.length==1?dh(di):caml_call_gen(dh,[di]);}var a=[0,new MlString("Invalid_argument")],b=[0,new MlString("Not_found")];caml_register_global(6,b);caml_register_global(5,[0,new MlString("Division_by_zero")]);caml_register_global(3,a);caml_register_global(2,[0,new MlString("Failure")]);var G=new MlString("%d"),F=new MlString("Pervasives.do_at_exit"),E=new MlString("Random.int"),D=[0,2061652523,1569539636,364182224,414272206,318284740,2064149575,383018966,1344115143,840823159,1098301843,536292337,1586008329,189156120,1803991420,1217518152,51606627,1213908385,366354223,2077152089,1774305586,2055632494,913149062,526082594,2095166879,784300257,1741495174,1703886275,2023391636,1122288716,1489256317,258888527,511570777,1163725694,283659902,308386020,1316430539,1556012584,1938930020,2101405994,1280938813,193777847,1693450012,671350186,149669678,1330785842,1161400028,558145612,1257192637,1101874969,1975074006,710253903,1584387944,1726119734,409934019,801085050],C=new MlString("on"),B=new MlString("canvas"),A=new MlString("mousedown"),z=new MlString("mousemove"),y=new MlString("2d"),x=new MlString("Dom_html.Canvas_not_available"),w=[0,0,0],v=[0,[0,[0,0,0]],0],u=new MlString("#FF0000"),t=new MlString("#000000"),s=new MlString("20pt Arial"),r=new MlString("#FFFFFF"),q=new MlString("Click to Start"),p=new MlString("Reload the page to restart"),o=new MlString("rgb(0,255,0)"),n=new MlString("rgb(255,128,0)"),m=new MlString("rgb(255,255,0)"),l=new MlString("rgb(0,255,255)"),k=[0,16,16],j=[0,4,4],i=[0,8,8];function h(d,c){return caml_lessequal(d,c)?d:c;}function H(f,e){return caml_greaterequal(f,e)?f:e;}function I(g){return 0<=g?g:-g|0;}function N(M){var J=caml_ml_out_channels_list(0);for(;;){if(J){var K=J[2];try {}catch(L){}var J=K;continue;}return 0;}}caml_register_named_value(F,N);function S(P,O){if(O){var R=O[2],T=Q(P,O[1]);return [0,T,S(P,R)];}return 0;}function ae(_){return Q(function(U,W){var V=U,X=W;for(;;){if(X){var Y=X[2],Z=X[1];if(Q(_,Z)){var $=[0,Z,V],V=$,X=Y;continue;}var X=Y;continue;}var aa=V,ab=0;for(;;){if(aa){var ac=aa[2],ad=[0,aa[1],ab],aa=ac,ab=ad;continue;}return ab;}}},0);}var af=[0,0];32===caml_sys_get_config(0)[2];var ag=[0,D.slice(),0];function al(ah){if(!(1073741823<ah)&&0<ah)for(;;){ag[2]=(ag[2]+1|0)%55|0;var ai=caml_array_get(ag[1],ag[2]),aj=(caml_array_get(ag[1],(ag[2]+24|0)%55|0)+(ai^ai>>>25&31)|0)&1073741823;caml_array_set(ag[1],ag[2],aj);var ak=caml_mod(aj,ah);if(((1073741823-ah|0)+1|0)<(aj-ak|0))continue;return ak;}throw [0,a,E];}var am=undefined,ar=null;function aq(an,ao,ap){return an===am?Q(ao,0):Q(ap,an);}var as=false,au=Array;function av(at){return at instanceof au?0:[0,new MlWrappedString(at.toString())];}af[1]=[0,av,af[1]];function aP(ax){return caml_js_wrap_callback(function(aw){if(aw){var ay=Q(ax,aw);if(!(ay|0))aw.preventDefault();return ay;}var az=event,aA=Q(ax,az);az.returnValue=aA;return aA;});}function aQ(aB){return aB.toString();}function aR(aC,aD,aG,aN){if(aC.addEventListener===am){var aE=C.toString().concat(aD),aL=function(aF){var aK=[0,aG,aF,[0]];return Q(function(aJ,aI,aH){return caml_js_call(aJ,aI,aH);},aK);};aC.attachEvent(aE,aL);return function(aM){return aC.detachEvent(aE,aL);};}aC.addEventListener(aD,aG,aN);return function(aO){return aC.removeEventListener(aD,aG,aN);};}var aS=aQ(A),aT=aQ(z),aU=this,aV=aU.document,aX=y.toString(),aW=[0,x];this.HTMLElement===am;function a1(a0){var aY=aV.body,aZ=aV.documentElement;return [0,(a0.clientX+aY.scrollLeft|0)+aZ.scrollLeft|0,(a0.clientY+aY.scrollTop|0)+aZ.scrollTop|0];}function cT(a3,a2){return Q(a3,a2);}function c$(a4,a5){return Q(a5,a4);}function bo(a6){return a6;}function bb(a7){return 1+(a7[7]/5|0)|0;}function bC(a8){return a8[1];}function be(a9){switch(a9[0]){case 1:return j;case 2:return i;default:return k;}}function bK(bc,a_){switch(a_[0]){case 1:var a$=a_[1];return [1,[0,a$[1],a$[2]-5|0]];case 2:var ba=a_[1],bd=bb(bc);return [2,[0,ba[1],ba[2]+bd|0]];default:var bf=be(a_),bg=bf[2],bh=bf[1],bi=bc[6]-bg|0,bj=h(H(bc[8][2],bg),bi),bk=bc[5]-bh|0;return [0,[0,h(H(bc[8][1],bh),bk),bj]];}}function cK(bt,bn,bl){switch(bl[0]){case 1:var bm=bl[1];bn.fillStyle=m.toString();var bp=bo(bm[2]-4|0);return bn.fillRect(bo(bm[1]-4|0),bp,8,8);case 2:var bq=bl[1];bn.fillStyle=l.toString();var br=bo(bq[2]-8|0);return bn.fillRect(bo(bq[1]-8|0),br,16,16);default:var bs=bl[1],bu=2===bt[10]?n.toString():o.toString();bn.fillStyle=bu;var bv=bo(bs[2]-16|0);return bn.fillRect(bo(bs[1]-16|0),bv,32,32);}}function cG(bw){switch(bw[10]){case 1:if(bw[9]){var bx=bw.slice(),by=bw[2],bE=bw[2];for(;;){if(!by)throw [0,b];var bz=by[1],bB=by[2],bA=0===bz[0]?1:0;if(!bA){var by=bB;continue;}var bD=bC(bz);bx[2]=[0,[1,[0,bD[1],bD[2]]],bE];bx[9]=0;var bF=bx;break;}}else var bF=bw;if(0===al(caml_div(30,bb(bF)))){var bG=bF.slice(),bH=bF[2];bG[2]=[0,[2,[0,al(bF[5]),-16]],bH];var bI=bG;}else var bI=bF;var bJ=bI.slice(),bL=bI[2];bJ[2]=S(Q(bK,bI),bL);var bM=[0,bJ[7]],bN=[0,0],b_=function(bO){var bP=bO,bQ=bJ[2];for(;;){if(bQ){var bR=bQ[1],bT=bQ[2],bS=bC(bP),bU=bC(bR),bZ=bS[2],bY=bS[1],bX=bU[2],bW=bU[1],bV=be(bP),b0=be(bR),b3=bV[2],b2=b0[2],b1=b0[1]+bV[1]|0,b4=I(bW-bY|0)<b1?1:0,b5=b4?I(bX-bZ|0)<(b2+b3|0)?1:0:b4;if(b5){switch(bR[0]){case 1:if(2===bP[0]){var b6=bP[1];bM[1]=bM[1]+1|0;var b7=[2,[0,b6[1],bJ[6]+100|0]],b8=2;}else var b8=0;break;case 2:switch(bP[0]){case 2:var b8=0;break;case 0:var b8=1;break;default:var b7=[1,[0,bP[1][1],-100]],b8=2;}break;default:var b8=2===bP[0]?1:0;}switch(b8){case 1:bN[1]=1;var b7=bP;break;case 2:break;default:var b7=bP;}var b9=b7;}else var b9=bP;var bP=b9,bQ=bT;continue;}return bP;}},ca=S(b_,bJ[2]),b$=bJ.slice();b$[2]=ca;b$[7]=bM[1];var cb=bN[1]?2:bJ[10];b$[10]=cb;var cd=function(cc){switch(cc[0]){case 1:return -4<cc[1][2]?1:0;case 2:return cc[1][2]<(b$[6]+16|0)?1:0;default:return 1;}},cg=ce(ae,cd,b$[2]),cf=b$.slice();cf[2]=cg;return cf;case 2:return bw;default:var ch=bw.slice(),ci=bw[2];ch[2]=S(Q(bK,bw),ci);if(ch[9]){var cj=ch.slice();cj[9]=0;cj[10]=1;return cj;}return ch;}}function de(cq,cl){function co(ck){return ck;}function cp(cn){var cm=cl.button-1|0;if(!(cm<0||3<cm))switch(cm){case 1:return 3;case 2:break;case 3:return 2;default:return 1;}return 0;}var cr=1===aq(cl.which,cp,co)?1:0,cs=cq[1].slice();cs[9]=cr;cq[1]=cs;return as;}function db(cD,cv){function cA(cu){function cx(ct){return [0,cu,ct];}function cy(cw){return a1(cv);}return aq(cv.pageY,cy,cx);}function cB(cz){return a1(cv);}var cC=aq(cv.pageX,cB,cA),cE=cD[1].slice();cE[8]=[0,cC[1],cC[2]];cD[1]=cE;return as;}function c9(cF,cU){var cH=cG(cG(cF[1])),cI=cH[1].getContext(aX);if(2<=cH[10])cI.fillStyle=u.toString();else cI.fillStyle=t.toString();var cJ=bo(cH[6]);cI.fillRect(0,0,bo(cH[5]),cJ);var cL=cH[2],cM=cL,cN=ce(cK,cH,cI);for(;;){if(cM){var cO=cM[2];Q(cN,cM[1]);var cM=cO;continue;}cI.font=s.toString();cI.fillStyle=r.toString();var cS=30,cR=10,cQ=caml_format_int(G,cH[7]);cI.fillText(cT(function(cP){return cP.toString();},cQ),cR,cS);switch(cH[10]){case 1:break;case 2:cI.fillText(p.toString(),100,200);break;default:cI.fillText(q.toString(),150,200);}cF[1]=cH;return 0;}}aU.onload=aP(function(dg){var cV=aU.document,cX=cV.body,cW=aU.document.createElement(B.toString()),cY=0,cZ=0,c0=0,c1=320,c2=480,c3=0,c4=0;if(1-(cW.getContext==ar?1:0)){cW.width=480;cW.height=320;var c5=[0,cW,v,c4,c3,c2,c1,c0,w,cZ,cY],c6=[0,c5],c8=1000/30,c_=function(c7){return 0;};c$(aU.setInterval(caml_js_wrap_callback(Q(c9,c6)),c8),c_);var dc=function(da){return 0;};c$(aR(cV,aT,cT(aP,Q(db,c6)),as),dc);var df=function(dd){return 0;};c$(aR(cV,aS,cT(aP,Q(de,c6)),as),df);cX.appendChild(c5[1]);return as;}throw [0,aW];});N(0);return;}());

File js_of_ocaml_game1/game1.ml

   state : gameState;
 }
 
-let bulletSpeed g = 5
+let bulletSpeed _ = 5
 
 let enemySpeed g = 1+(g.score / 5)
 
   let gv = initGameVariable () in
   let rgv = ref gv in
   let interavl = 1000. /. 30. in (* 30fps *)
-  let id = window##setInterval (Js.wrap_callback (onInterval rgv), interavl) in
+  window##setInterval (Js.wrap_callback (onInterval rgv), interavl) |> ignore;
   let target = (document :> eventTarget Js.t) in
   addEventListener target Event.mousemove (handler @@ onMouseMove rgv) Js._false |> ignore;
   addEventListener target Event.mousedown (handler @@ onMouseDown rgv) Js._false |> ignore;