mirror of
https://github.com/boxgaming/qbjs.git
synced 2024-05-12 08:00:12 +00:00
Compare commits
19 commits
cb8b666256
...
056bc141d1
Author | SHA1 | Date | |
---|---|---|---|
056bc141d1 | |||
708d5b02c4 | |||
25d146c8e4 | |||
38ec714954 | |||
4567516347 | |||
e4fbe9ed8b | |||
84b095a971 | |||
6591d289e6 | |||
a6de3c57d8 | |||
000d4f35b7 | |||
fbc034da1a | |||
579481861e | |||
3ed28f6895 | |||
3f4186ca7d | |||
87528c72c6 | |||
de2efcb225 | |||
10bac0aa35 | |||
3e40944c27 | |||
8c6aefc403 |
|
@ -29,29 +29,32 @@ CodeMirror.defineMode("qbjs", function(conf, parserConf) {
|
|||
|
||||
var wordOperators = wordRegexp(['and', 'or', 'not', 'xor', 'is', 'mod', 'eqv', 'imp']);
|
||||
var commonkeywords = ['dim', 'as', 'redim', 'then', 'until', 'exit', 'in', 'to', 'let',
|
||||
'const', 'integer', 'single', 'double', 'long', '_unsigned', 'string', '_byte', 'object',
|
||||
'option explicit', 'call', 'step'];
|
||||
'const', 'integer', 'single', 'double', 'long', '_?unsigned', '_?float', '_?bit', '_?byte',
|
||||
'string', '_?byte', 'object', '_?offset', '_?integer64', 'call', 'step', '_?preserve'];
|
||||
|
||||
// TODO: adjust for QB
|
||||
var atomWords = ['true', 'false', 'nothing', 'empty', 'null'];
|
||||
|
||||
var builtinFuncsWords = ['_acos', '_acosh', '_alpha', '_alpha32', '_asin', '_asinh', '_atan2', '_atanh', '_autodisplay',
|
||||
'_backgroundcolor', '_blue', '_blue32', '_ceil', '_commandcount', '_continue', '_copyimage',
|
||||
'_cosh', '_coth', '_csch', '_cwd', '_defaultcolor', '_d2g', '_d2r', '_desktopwidth', '_desktopheight',
|
||||
'_delay', '_dest', '_dir', '_direxists', '_display', '_echo', '_fileexists', '_font', '_fontwidth', '_fontheight',
|
||||
'_freeimage', '_fullscreen', '_g2d', '_g2r', '_green', '_green32', '_height', '_hypot',
|
||||
'_instrrev', '_limit', '_keyclear', '_keydown', '_keyhit', '_loadfont', '_loadimage',
|
||||
'_mousebutton', '_mousehide', '_mouseinput', '_mouseshow', '_mousewheel', '_mousex', '_mousey',
|
||||
'_newimage', '_os', '_palettecolor', '_pi', '_printstring', '_printwidth', '_printmode', '_putimage',
|
||||
'_r2d', '_r2g', '_readbit', '_red', '_red32', '_resetbit', '_resize', '_resizewidth',
|
||||
'_resizeheight', '_rgb', '_rgba', '_rgb32', '_rgba32', '_round',
|
||||
'_screenexists', '_screenmove', '_screenx', '_screeny', '_sech', '_setbit', '_shl', '_shr', '_sinh', '_source',
|
||||
'_sndclose', '_sndopen', '_sndplay', '_sndloop', '_sndpause', '_sndstop', '_sndvol', '_startdir',
|
||||
'_strcmp', '_stricmp', '_tanh', '_title', '_trim', '_togglebit', '_width',
|
||||
var builtinFuncsWords = ['_?acos', '_?acosh', '_?alpha', '_?alpha32', '_?arccot', '_?arccsc', '_?arcsec',
|
||||
'_?asin', '_?asinh', '_?atan2', '_?atanh', '_?autodisplay',
|
||||
'_?backgroundcolor', '_?blue', '_?blue32', '_?capslock', '_?ceil', '_?commandcount', '_?continue', '_?copyimage',
|
||||
'_?cosh', '_?cot', '_?coth', '_?csc', '_?csch', '_?cwd',
|
||||
'_?defaultcolor', '_?d2g', '_?d2r', '_?deflate', '_?desktopwidth', '_?desktopheight',
|
||||
'_?delay', '_?dest', '_?dir', '_?direxists', '_?display', '_?echo', '_?fileexists', '_?font', '_?fontwidth', '_?fontheight',
|
||||
'_?freeimage', '_?fullscreen', '_?g2d', '_?g2r', '_?green', '_?green32', '_?height', '_?hypot', "_?inflate",
|
||||
'_?instrrev', '_?limit', '_?keyclear', '_?keydown', '_?keyhit', '_?loadfont', '_?loadimage',
|
||||
'_?mousebutton', '_?mousehide', '_?mouseinput', '_?mouseshow', '_?mousewheel', '_?mousex', '_?mousey',
|
||||
'_?newimage', '_?numlock', '_?os', '_?palettecolor', '_?pi', '_?printstring', '_?printwidth', '_?printmode', '_?putimage',
|
||||
'_?r2d', '_?r2g', '_?readbit', '_?red', '_?red32', '_?resetbit', '_?resize', '_?resizewidth',
|
||||
'_?resizeheight', '_?rgb', '_?rgba', '_?rgb32', '_?rgba32', '_?round',
|
||||
'_?screenexists', '_?screenmove', '_?screenx', '_?screeny', '_?scrolllock',
|
||||
'_?sec', '_?sech', '_?setbit', '_?shl', '_?shr', '_?sinh',
|
||||
'_?source', '_?sndclose', '_?sndopen', '_?sndplay', '_?sndloop', '_?sndpause', '_?sndstop', '_?sndvol', '_?startdir',
|
||||
'_?strcmp', '_?stricmp', '_?tanh', '_?title', '_?trim', '_?togglebit', '_?width',
|
||||
'abs', 'asc', 'atn', 'beep',
|
||||
'chr', 'cdbl', 'cint', 'clng', 'csng', 'circle', 'cls', 'color', 'command', 'cos', 'cvi', 'cvl',
|
||||
'data', 'date', 'draw', 'environ', 'error', 'exp', 'fix', 'hex', 'input', 'inkey', 'instr', 'int',
|
||||
'lbound', 'left', 'lcase', 'len', 'line', 'locate', 'log', 'ltrim', 'mid', 'mki', 'mkl',
|
||||
'lbound', 'left', 'lcase', 'len', 'line', 'loc', 'locate', 'log', 'ltrim', 'mid', 'mki', 'mkl',
|
||||
'oct', 'paint', 'point', 'preset', 'print', 'pset',
|
||||
'right', 'rtrim', 'randomize', 'read', 'restore', 'rnd',
|
||||
'screen', 'shared', 'sgn', 'sin', 'sleep', 'sound', 'space', 'sqr',
|
||||
|
@ -63,7 +66,7 @@ CodeMirror.defineMode("qbjs", function(conf, parserConf) {
|
|||
'export', 'from', 'import']
|
||||
|
||||
var builtinConsts = ['append', 'binary', 'input', 'output', 'random',
|
||||
'_off', '_smooth', '_stretch', '_squarepixels', '_keepbackground', '_onlybackground', '_fillbackground',
|
||||
'_?off', '_?smooth', '_?stretch', '_?squarepixels', '_?keepbackground', '_?onlybackground', '_?fillbackground',
|
||||
'gx_true', 'gx_false', 'gxevent_init', 'gxevent_update', 'gxevent_drawbg', 'gxevent_drawmap', 'gxevent_drawscreen',
|
||||
'gxevent_mouseinput', 'gxevent_paintbefore', 'gxevent_paintafter', 'gxevent_collision_tile', 'gxevent_collision_entity',
|
||||
'gxevent_player_action', 'gxevent_animate_complete', 'gxanimate_loop', 'gxanimate_single', 'gxbg_stretch',
|
||||
|
|
1
codemirror/themes/qb45.css
vendored
1
codemirror/themes/qb45.css
vendored
|
@ -45,7 +45,6 @@
|
|||
|
||||
body {
|
||||
background-color: rgb(0, 0, 170);
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
|
||||
#gx-container {
|
||||
|
|
5
codemirror/themes/qb64-vscode.css
vendored
5
codemirror/themes/qb64-vscode.css
vendored
|
@ -45,11 +45,6 @@
|
|||
|
||||
body {
|
||||
background-color: #0000AA;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
|
||||
#gx-container {
|
||||
letter-spacing: normal;
|
||||
}
|
||||
|
||||
#code, #gx-container, #toolbar, #toolbar .spacer, .tab, #output-content {
|
||||
|
|
5
codemirror/themes/qbjs.css
vendored
5
codemirror/themes/qbjs.css
vendored
|
@ -1,7 +1,7 @@
|
|||
.cm-s-qbjs {
|
||||
line-height: 1em;
|
||||
}
|
||||
.cm-s-qbjs.CodeMirror { background: rgb(0, 0, 39); color: rgb(216, 216, 216); text-shadow: 0 -1px 1px #262626; font-family: dosvga; letter-spacing: -1px}
|
||||
.cm-s-qbjs.CodeMirror { background: rgb(0, 0, 39); color: rgb(216, 216, 216); text-shadow: 0 -1px 1px #262626; font-family: dosvga; }
|
||||
.cm-s-qbjs div.CodeMirror-selected { background: #45443B; } /* 33322B*/
|
||||
.cm-s-qbjs .CodeMirror-line::selection, .cm-s-qbjs .CodeMirror-line > span::selection, .cm-s-qbjs .CodeMirror-line > span > span::selection { background: rgba(0, 49, 78, .99); }
|
||||
.cm-s-qbjs .CodeMirror-line::-moz-selection, .cm-s-qbjs .CodeMirror-line > span::-moz-selection, .cm-s-qbjs .CodeMirror-line > span > span::-moz-selection { background: rgba(69, 68, 59, .99); }
|
||||
|
@ -46,9 +46,6 @@
|
|||
.cm-s-qbjs .CodeMirror-search-field { font-family: dosvga; font-size: 1em; }
|
||||
.cm-s-qbjs .cm-searching { color: #333 !important; background-color: #ccc; }
|
||||
|
||||
body { letter-spacing: -1px; }
|
||||
#gx-container { letter-spacing: normal; }
|
||||
|
||||
#help-nav a:hover { color: #fff; }
|
||||
#help-nav a:before { content: "< "; }
|
||||
#help-nav a:after { content: " >"; }
|
||||
|
|
4
codemirror/themes/vscode-dark.css
vendored
4
codemirror/themes/vscode-dark.css
vendored
|
@ -59,7 +59,6 @@ body {
|
|||
|
||||
#slider {
|
||||
font-family: dosvga;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
|
||||
a, #tabs {
|
||||
|
@ -89,7 +88,6 @@ a, #tabs {
|
|||
|
||||
dialog textarea {
|
||||
font-family: Consolas, 'Courier New', monospace;
|
||||
letter-spacing: normal;
|
||||
background-color: #1e1e1e;
|
||||
color: #ccc;
|
||||
}
|
||||
|
@ -105,6 +103,8 @@ dialog a:hover { color: #fff !important; }
|
|||
a:before { content: ""; }
|
||||
a:after { content: ""; }
|
||||
a:hover { text-decoration: underline; }
|
||||
dialog a.disabled, dialog a.disabled:hover { color: #999 !important; }
|
||||
dialog a.disabled:hover { text-decoration: none; }
|
||||
|
||||
#fs-contents a { font-variant: normal; font-family: Verdana, Geneva, Tahoma, sans-serif; font-size: 13px; }
|
||||
#fs-contents a:hover { text-decoration: none; }
|
||||
|
|
5
codemirror/themes/win-classic.css
vendored
5
codemirror/themes/win-classic.css
vendored
|
@ -20,7 +20,6 @@
|
|||
.cm-s-win-classic .cm-header { color: #FF6400; }
|
||||
.cm-s-win-classic .cm-hr { color: #AEAEAE; }
|
||||
.cm-s-win-classic .cm-link { color:#ad9361; font-style:italic; text-decoration:none; }
|
||||
/*.cm-s-win-classic .cm-error { border-bottom: 1px solid red; }*/
|
||||
|
||||
div.cm-s-win-classic .CodeMirror-activeline-background { background: #efefff; }
|
||||
div.cm-s-win-classic span.CodeMirror-matchingbracket { outline:1px solid grey; color: inherit; }
|
||||
|
@ -43,6 +42,7 @@ a:active { border: 2px inset;}
|
|||
a:hover { color: #000; }
|
||||
a:before { content: ""; }
|
||||
a:after { content: ""; }
|
||||
dialog a.disabled:active { border: 2px outset; }
|
||||
|
||||
li a, li a:link, li a:visited { border: 0; text-decoration: underline; }
|
||||
li a:active { border: 0; }
|
||||
|
@ -50,7 +50,6 @@ li a:active { border: 0; }
|
|||
dialog textarea {
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: 14px;
|
||||
letter-spacing: normal;
|
||||
border: 2px inset;
|
||||
}
|
||||
dialog textarea:focus {
|
||||
|
@ -64,7 +63,6 @@ dialog {
|
|||
|
||||
#code {
|
||||
border: 2px inset;
|
||||
/*border-top: 0;*/
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
|
@ -72,7 +70,6 @@ dialog {
|
|||
|
||||
#output-content, #warning-container {
|
||||
font-family: 'Courier New', monospace;
|
||||
/*font-size: 14px;*/
|
||||
}
|
||||
|
||||
#output-content {
|
||||
|
|
|
@ -3,10 +3,14 @@
|
|||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="qbjs.css"></link>
|
||||
<script type="text/javascript" src="pako.2.1.0.min.js"></script>
|
||||
</head>
|
||||
<body onload="startProgram()" onresize="resizeScreen()">
|
||||
<div id="gx-container"></div>
|
||||
<div id="gx-footer" style="display:none"></div>
|
||||
<div id="gx-footer" style="display:none">
|
||||
<div id="gx-link"><a href="https://github.com/boxgaming/qbjs/wiki" target="_blank" title="Powered by QBJS"><img src="logo.png"></a></div>
|
||||
<div id="gx-fullscreen" onclick="GX.fullScreen(true)" title="Full Screen Mode"></div>
|
||||
</div>
|
||||
<span style="color:transparent"> </span>
|
||||
</body>
|
||||
<script language="javascript" src="vfs.js"></script>
|
||||
|
@ -17,12 +21,22 @@
|
|||
function startProgram() {
|
||||
resizeScreen();
|
||||
__qbjs_run();
|
||||
resizeScreen();
|
||||
}
|
||||
function resizeScreen() {
|
||||
function resizeScreen() {
|
||||
var c = document.getElementById("gx-container");
|
||||
c.style.width = window.innerWidth;
|
||||
c.style.height = window.innerHeight;
|
||||
QB.resize(c.clientWidth, c.clientHeight);
|
||||
var cv = GX.canvas();
|
||||
if (cv) {
|
||||
var footer = document.getElementById("gx-footer");
|
||||
if (footer.parentNode != c) {
|
||||
footer.style.display = "flex";
|
||||
c.appendChild(footer);
|
||||
}
|
||||
QB.resize(c.clientWidth, c.clientHeight);
|
||||
}
|
||||
}
|
||||
resizeScreen();
|
||||
</script>
|
||||
</html>
|
46
export/fullscreen-hover.svg
Normal file
46
export/fullscreen-hover.svg
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
height="32px"
|
||||
style="enable-background:new 0 0 32 32;"
|
||||
version="1.1"
|
||||
viewBox="0 0 32 32"
|
||||
width="32px"
|
||||
xml:space="preserve"
|
||||
id="svg4"
|
||||
sodipodi:docname="fullscreen-hover.svg"
|
||||
inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||
id="defs4" /><sodipodi:namedview
|
||||
id="namedview4"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:zoom="19.688504"
|
||||
inkscape:cx="12.72316"
|
||||
inkscape:cy="16.430908"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1177"
|
||||
inkscape:window-x="1912"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg4" /><g
|
||||
id="Layer_1" /><polygon
|
||||
points="20,32 32,32 32,20 27.414,24.586 22.828,20 20,22.828 24.586,27.414 "
|
||||
style="fill:#999999;fill-opacity:1"
|
||||
id="polygon1" /><polygon
|
||||
points="9.129,11.953 11.957,9.125 7.414,4.586 12,0 0,0 0,12 4.586,7.414 "
|
||||
style="fill:#999999;fill-opacity:1"
|
||||
id="polygon2" /><polygon
|
||||
points="0,32 12,32 7.414,27.414 12,22.828 9.172,20 4.586,24.586 0,20 "
|
||||
style="fill:#999999;fill-opacity:1"
|
||||
id="polygon3" /><polygon
|
||||
points="22.871,11.953 27.414,7.414 32,12 32,0 20,0 24.586,4.586 20.043,9.125 "
|
||||
style="fill:#999999;fill-opacity:1"
|
||||
id="polygon4" /></svg>
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.8 KiB |
46
export/fullscreen.svg
Normal file
46
export/fullscreen.svg
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
height="32px"
|
||||
style="enable-background:new 0 0 32 32;"
|
||||
version="1.1"
|
||||
viewBox="0 0 32 32"
|
||||
width="32px"
|
||||
xml:space="preserve"
|
||||
id="svg4"
|
||||
sodipodi:docname="fullscreen.svg"
|
||||
inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||
id="defs4" /><sodipodi:namedview
|
||||
id="namedview4"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:zoom="19.688504"
|
||||
inkscape:cx="12.723161"
|
||||
inkscape:cy="16.430908"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1177"
|
||||
inkscape:window-x="1912"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg4" /><g
|
||||
id="Layer_1" /><polygon
|
||||
points="20,32 32,32 32,20 27.414,24.586 22.828,20 20,22.828 24.586,27.414 "
|
||||
style="fill:#666666;fill-opacity:1"
|
||||
id="polygon1" /><polygon
|
||||
points="9.129,11.953 11.957,9.125 7.414,4.586 12,0 0,0 0,12 4.586,7.414 "
|
||||
style="fill:#666666;fill-opacity:1"
|
||||
id="polygon2" /><polygon
|
||||
points="0,32 12,32 7.414,27.414 12,22.828 9.172,20 4.586,24.586 0,20 "
|
||||
style="fill:#666666;fill-opacity:1"
|
||||
id="polygon3" /><polygon
|
||||
points="22.871,11.953 27.414,7.414 32,12 32,0 20,0 24.586,4.586 20.043,9.125 "
|
||||
style="fill:#666666;fill-opacity:1"
|
||||
id="polygon4" /></svg>
|
After Width: | Height: | Size: 1.7 KiB |
BIN
export/logo.png
Normal file
BIN
export/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -3,13 +3,13 @@
|
|||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="qbjs.css"></link>
|
||||
<script type="text/javascript" src="pako.2.1.0.min.js"></script>
|
||||
</head>
|
||||
<body onresize="resizeScreen()">
|
||||
<a href="#" onclick="return startProgram()" id="gx-load-screen"> </a>
|
||||
<div id="gx-container"></div>
|
||||
<div id="gx-footer">
|
||||
<div id="gx-container"><a href="#" onclick="return startProgram()" id="gx-load-screen"><span style="visibility:hidden">_</span></a></div>
|
||||
<div id="gx-footer" style="display:none">
|
||||
<div id="gx-link"><a href="https://github.com/boxgaming/qbjs/wiki" target="_blank" title="Powered by QBJS"><img src="logo.png"></a></div>
|
||||
<div id="gx-fullscreen"><img src="fullscreen.png" title="Full Screen Mode" onclick="GX.fullScreen(true)"></div>
|
||||
<div id="gx-fullscreen" onclick="GX.fullScreen(true)" title="Full Screen Mode"></div>
|
||||
</div>
|
||||
</body>
|
||||
<script language="javascript" src="vfs.js"></script>
|
||||
|
@ -19,9 +19,8 @@
|
|||
<script language="javascript">
|
||||
function startProgram() {
|
||||
document.getElementById("gx-load-screen").style.display = "none";
|
||||
document.getElementById("gx-footer").style.display = "none";
|
||||
resizeScreen();
|
||||
__qbjs_run();
|
||||
resizeScreen();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -29,7 +28,17 @@
|
|||
var c = document.getElementById("gx-container");
|
||||
c.style.width = window.innerWidth;
|
||||
c.style.height = window.innerHeight;
|
||||
QB.resize(c.clientWidth, c.clientHeight);
|
||||
var cv = GX.canvas();
|
||||
if (cv) {
|
||||
var footer = document.getElementById("gx-footer");
|
||||
if (footer.parentNode != c) {
|
||||
footer.style.display = "flex";
|
||||
c.appendChild(footer);
|
||||
document.getElementById("gx-load-screen").remove();
|
||||
}
|
||||
QB.resize(c.clientWidth, c.clientHeight);
|
||||
}
|
||||
}
|
||||
resizeScreen();
|
||||
</script>
|
||||
</html>
|
|
@ -1,11 +1,10 @@
|
|||
@font-face {
|
||||
font-family: dosvga;
|
||||
src: url(dosvga.ttf);
|
||||
src: url(qbjs.woff2);
|
||||
}
|
||||
body {
|
||||
background-color: #000;
|
||||
font-family: dosvga, Arial, Helvetica, sans-serif;
|
||||
letter-spacing: -1px;
|
||||
color: #999;
|
||||
}
|
||||
#gx-container {
|
||||
|
@ -13,10 +12,11 @@ body {
|
|||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
overflow: hidden;
|
||||
}
|
||||
#gx-footer {
|
||||
margin: 0 auto;
|
||||
background-color: #666;
|
||||
background-color: #333;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 600px;
|
||||
|
@ -24,6 +24,17 @@ body {
|
|||
#gx-link, #gx-fullscreen {
|
||||
margin: 1px;
|
||||
}
|
||||
#gx-fullscreen {
|
||||
cursor: pointer;
|
||||
background-image: url('fullscreen.svg');
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
margin: 4px;
|
||||
background-size: 26px 26px;
|
||||
}
|
||||
#gx-fullscreen:hover {
|
||||
background-image: url('fullscreen-hover.svg');
|
||||
}
|
||||
#gx-canvas {
|
||||
border: 1px solid #222;
|
||||
background-color: #000;
|
||||
|
@ -32,8 +43,8 @@ body {
|
|||
display: block;
|
||||
text-align: center;
|
||||
margin: auto;
|
||||
width: 600px;
|
||||
height: 360px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 24px;
|
||||
color: #ccc;
|
||||
border: 1px solid #000;
|
||||
|
@ -41,8 +52,8 @@ body {
|
|||
background-position: center center;
|
||||
background-image: url('play.png');
|
||||
background-repeat: no-repeat;
|
||||
background-color: #444;
|
||||
background-color: #000;
|
||||
}
|
||||
#gx-load-screen:hover {
|
||||
background-color: #555;
|
||||
background-color: #333;
|
||||
}
|
||||
|
|
96
gx/gx.js
96
gx/gx.js
|
@ -5,6 +5,7 @@ var GX = new function() {
|
|||
var _bg = [];
|
||||
var _images = [];
|
||||
var _entities = [];
|
||||
var _entity_animations = [];
|
||||
var _scene = {};
|
||||
var _tileset = {};
|
||||
var _tileset_animations = [];
|
||||
|
@ -56,11 +57,14 @@ var GX = new function() {
|
|||
}
|
||||
|
||||
function _reset() {
|
||||
// TODO: stop any sounds that are currently playing
|
||||
// stop any sounds that are currently playing
|
||||
_soundStopAll();
|
||||
|
||||
_framerate = 60;
|
||||
_bg = [];
|
||||
_images = [];
|
||||
_entities = [];
|
||||
_entity_animations = [];
|
||||
_scene = {};
|
||||
_tileset = {};
|
||||
_tileset_animations = [];
|
||||
|
@ -104,14 +108,8 @@ var GX = new function() {
|
|||
if (!_canvas) {
|
||||
_canvas = document.createElement("canvas");
|
||||
_canvas.id = "gx-canvas";
|
||||
//_canvas.style.position = "absolute";
|
||||
document.getElementById("gx-container").appendChild(_canvas);
|
||||
|
||||
//_glcanvas = document.createElement("canvas");
|
||||
//_glcanvas.id = "gl-canvas";
|
||||
////_glcanvas.style.position = "absolute";
|
||||
//document.getElementById("gx-container").appendChild(_glcanvas);
|
||||
|
||||
_canvas.addEventListener("mousemove", function(event) {
|
||||
_mousePos.x = event.offsetX;
|
||||
_mousePos.y = event.offsetY;
|
||||
|
@ -152,18 +150,14 @@ var GX = new function() {
|
|||
var rect = event.target.getBoundingClientRect();
|
||||
_touchPos.x = touch.pageX - rect.x;
|
||||
_touchPos.y = touch.pageY - rect.y;
|
||||
//alert(_touchPos.x + "," + _touchPos.y);
|
||||
_touchInputFlag = true;
|
||||
if (_bindTouchToMouse) {
|
||||
//_mousePos.x = event.offsetX;
|
||||
//_mousePos.y = event.offsetY;
|
||||
_mousePos = _touchPos;
|
||||
_mouseInputFlag = true;
|
||||
}
|
||||
});
|
||||
|
||||
_canvas.addEventListener("touchstart", function(event) {
|
||||
//alert("touchstart");
|
||||
event.preventDefault();
|
||||
var touch = event.touches[0];
|
||||
var rect = event.target.getBoundingClientRect();
|
||||
|
@ -253,8 +247,10 @@ var GX = new function() {
|
|||
_scene.height = sheight;
|
||||
_canvas.width = _scene.width;
|
||||
_canvas.height = _scene.height;
|
||||
_glcanvas.width = _scene.width;
|
||||
_glcanvas.height = _scene.height;
|
||||
if (_scene.scaleX != 1) {
|
||||
_ctx.imageSmoothingEnabled = false;
|
||||
_ctx.scale(_scene.scaleX, _scene.scaleY);
|
||||
}
|
||||
_updateSceneSize();
|
||||
}
|
||||
|
||||
|
@ -274,11 +270,13 @@ var GX = new function() {
|
|||
|
||||
// Scale the scene by the specified scale factor.
|
||||
function _sceneScale (scale) {
|
||||
var lastScale = _scene.scaleX;
|
||||
_scene.scaleX = scale;
|
||||
_scene.scaleY = scale;
|
||||
_canvas.width = _scene.width * _scene.scaleX;
|
||||
_canvas.height = _scene.height * _scene.scaleY;
|
||||
_ctx.imageSmoothingEnabled = false;
|
||||
if (lastScale > 1) { _ctx.scale(1/lastScale, 1/lastScale); }
|
||||
_ctx.scale(_scene.scaleX, _scene.scaleY);
|
||||
|
||||
var footer = document.getElementById("gx-footer");
|
||||
|
@ -725,7 +723,15 @@ var GX = new function() {
|
|||
|
||||
function _soundStop (sid) {
|
||||
_sounds[sid-1].pause();
|
||||
// TODO: reset playback position to beginning
|
||||
_sounds[sid-1].currentTime = 0;
|
||||
}
|
||||
|
||||
function _soundStopAll () {
|
||||
for (var i=0; i < _sounds.length; i++) {
|
||||
if (_sounds[i]) {
|
||||
_soundStop(i+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _soundMuted (muted) {
|
||||
|
@ -747,7 +753,10 @@ var GX = new function() {
|
|||
newent.jumpstart = 0;
|
||||
newent.height = height;
|
||||
newent.width = ewidth;
|
||||
newent.image = _imageLoad(imageFilename);
|
||||
newent.sequences = 1;
|
||||
newent.image = _imageLoad(imageFilename, function() {
|
||||
newent.sequences = Math.floor(_images[newent.image-1].height / height);
|
||||
});
|
||||
newent.spriteFrame = 1;
|
||||
newent.spriteSeq = 1;
|
||||
newent.seqFrames = seqFrames;
|
||||
|
@ -760,8 +769,17 @@ var GX = new function() {
|
|||
newent.applyGravity = false;
|
||||
_entities.push(newent);
|
||||
|
||||
// TODO: reincorporate uid
|
||||
|
||||
var animation = [];
|
||||
_entity_animations.push(animation);
|
||||
|
||||
/*
|
||||
newent.sequences = Math.floor(_images[newent.image-1].height / height);
|
||||
console.log(newent.sequences);
|
||||
for (var i=0; i < newent.sequences; i++) {
|
||||
animation.push({ frames: seqFrames });
|
||||
}
|
||||
*/
|
||||
|
||||
return _entities.length;
|
||||
}
|
||||
|
||||
|
@ -787,7 +805,21 @@ var GX = new function() {
|
|||
function _entityAnimate (eid, seq, a) {
|
||||
_entities[eid-1].animate = a;
|
||||
_entities[eid-1].spriteSeq = seq;
|
||||
_entities[eid-1].seqFrames = _entityGetFrames(eid, seq); //_entity_animations[eid-1][seq-1].frames;
|
||||
_entities[eid-1].prevFrame = -1;
|
||||
if (_entities[eid-1].spriteFrame > _entities[eid-1].seqFrames) {
|
||||
_entities[eid-1].spriteFrame = 1;
|
||||
}
|
||||
}
|
||||
|
||||
function _entityGetFrames (eid, seq) {
|
||||
var a = _entity_animations[eid-1];
|
||||
if (a[seq-1] == undefined) {
|
||||
return _entities[eid-1].seqFrames;
|
||||
}
|
||||
else {
|
||||
return _entity_animations[eid-1].frames;
|
||||
}
|
||||
}
|
||||
|
||||
function _entityAnimateStop (eid) {
|
||||
|
@ -863,10 +895,31 @@ var GX = new function() {
|
|||
|
||||
function _entityFrameSet (eid, seq, frame) {
|
||||
_entities[eid-1].spriteSeq = seq;
|
||||
_entities[eid-1].seqFrames = _entityGetFrames(eid, seq); //_entity_animations[eid-1][seq-1].frames;
|
||||
_entities[eid-1].spriteFrame = frame;
|
||||
_entities[eid-1].prevFrame = frame - 1;
|
||||
}
|
||||
|
||||
function _entityFrame (eid) {
|
||||
return _entities[eid-1].spriteFrame;
|
||||
}
|
||||
|
||||
function _entitySequence (eid) {
|
||||
return _entities[eid-1].spriteSeq;
|
||||
}
|
||||
|
||||
function _entitySequences (eid) {
|
||||
return _entities[eid-1].sequences;
|
||||
}
|
||||
|
||||
function _entityFrames (eid, seq) {
|
||||
return _entityGetFrames(eid, seq); //_entity_animations[eid-1][seq-1].frames;
|
||||
}
|
||||
|
||||
function _entityFrames (eid, seq, frames) {
|
||||
_entity_animations[eid-1][seq-1] = { frames: frames };
|
||||
}
|
||||
|
||||
function _entityType (eid, etype) {
|
||||
if (etype != undefined) {
|
||||
_entities[eid-1].type = etype;
|
||||
|
@ -2479,7 +2532,8 @@ var GX = new function() {
|
|||
this.soundRepeat = _soundRepeat;
|
||||
this.soundPause = _soundPause;
|
||||
this.soundStop = _soundStop;
|
||||
this.soundVolumne = _soundVolume;
|
||||
this.soundStopAll = _soundStopAll;
|
||||
this.soundVolume = _soundVolume;
|
||||
this.soundMuted = _soundMuted;
|
||||
|
||||
this.entityCreate = _entityCreate;
|
||||
|
@ -2506,6 +2560,12 @@ var GX = new function() {
|
|||
this.entityCollide = _entityCollide;
|
||||
this.entityApplyGravity = _entityApplyGravity;
|
||||
this.entityVisible = _entityVisible;
|
||||
|
||||
this.entityFrame = _entityFrame;
|
||||
this.entitySequence = _entitySequence;
|
||||
this.entitySequences = _entitySequences;
|
||||
this.entityFrames = _entityFrames;
|
||||
|
||||
|
||||
this.mapColumns = _mapColumns;
|
||||
this.mapCreate = _mapCreate;
|
||||
|
|
73
img/upload-hover.svg
Normal file
73
img/upload-hover.svg
Normal file
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
viewBox="0 0 256 256"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
sodipodi:docname="upload-hover.svg"
|
||||
inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:zoom="3.6679688"
|
||||
inkscape:cx="128"
|
||||
inkscape:cy="128"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1177"
|
||||
inkscape:window-x="1912"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg1" />
|
||||
<defs
|
||||
id="defs1" />
|
||||
<rect
|
||||
fill="none"
|
||||
height="256"
|
||||
width="256"
|
||||
id="rect1" />
|
||||
<path
|
||||
d="M176,128h48a8,8,0,0,1,8,8v64a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V136a8,8,0,0,1,8-8H80"
|
||||
fill="none"
|
||||
stroke="#000"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="12"
|
||||
id="path1"
|
||||
style="fill:none;fill-opacity:1;stroke:#cccccc;stroke-opacity:1;stroke-width:16;stroke-dasharray:none" />
|
||||
<line
|
||||
fill="none"
|
||||
stroke="#000"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="12"
|
||||
x1="128"
|
||||
x2="128"
|
||||
y1="128"
|
||||
y2="24"
|
||||
id="line1"
|
||||
style="fill:none;fill-opacity:1;stroke:#cccccc;stroke-opacity:1;stroke-width:16;stroke-dasharray:none" />
|
||||
<polyline
|
||||
fill="none"
|
||||
points="80 72 128 24 176 72"
|
||||
stroke="#000"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="12"
|
||||
id="polyline1"
|
||||
style="fill:none;fill-opacity:1;stroke:#cccccc;stroke-opacity:1;stroke-width:16;stroke-dasharray:none" />
|
||||
<circle
|
||||
cx="188"
|
||||
cy="168"
|
||||
r="10"
|
||||
id="circle1"
|
||||
style="fill:#cccccc;fill-opacity:1;stroke:#cccccc;stroke-opacity:1;stroke-width:5;stroke-dasharray:none" />
|
||||
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
73
img/upload.svg
Normal file
73
img/upload.svg
Normal file
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
viewBox="0 0 256 256"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
sodipodi:docname="upload.svg"
|
||||
inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:zoom="3.6679688"
|
||||
inkscape:cx="128"
|
||||
inkscape:cy="128"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1177"
|
||||
inkscape:window-x="1912"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg1" />
|
||||
<defs
|
||||
id="defs1" />
|
||||
<rect
|
||||
fill="none"
|
||||
height="256"
|
||||
width="256"
|
||||
id="rect1" />
|
||||
<path
|
||||
d="M176,128h48a8,8,0,0,1,8,8v64a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V136a8,8,0,0,1,8-8H80"
|
||||
fill="none"
|
||||
stroke="#000"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="12"
|
||||
id="path1"
|
||||
style="fill:none;fill-opacity:1;stroke:#666666;stroke-opacity:1;stroke-width:16;stroke-dasharray:none" />
|
||||
<line
|
||||
fill="none"
|
||||
stroke="#000"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="12"
|
||||
x1="128"
|
||||
x2="128"
|
||||
y1="128"
|
||||
y2="24"
|
||||
id="line1"
|
||||
style="fill:none;fill-opacity:1;stroke:#666666;stroke-opacity:1;stroke-width:16;stroke-dasharray:none" />
|
||||
<polyline
|
||||
fill="none"
|
||||
points="80 72 128 24 176 72"
|
||||
stroke="#000"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="12"
|
||||
id="polyline1"
|
||||
style="fill:none;fill-opacity:1;stroke:#666666;stroke-opacity:1;stroke-width:16;stroke-dasharray:none" />
|
||||
<circle
|
||||
cx="188"
|
||||
cy="168"
|
||||
r="10"
|
||||
id="circle1"
|
||||
style="fill:#666666;fill-opacity:1;stroke:#666666;stroke-opacity:1;stroke-width:5;stroke-dasharray:none" />
|
||||
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
54
index.html
54
index.html
|
@ -16,6 +16,7 @@
|
|||
<script type="text/javascript" src="util/jszip.min.js"></script>
|
||||
<script type="text/javascript" src="util/lzutf8.js"></script>
|
||||
<script type="text/javascript" src="util/shorty.min.js"></script>
|
||||
<script type="text/javascript" src="util/pako.2.1.0.min.js"></script>
|
||||
|
||||
<script type="text/javascript" src="codemirror/dialog.js"></script>
|
||||
<script type="text/javascript" src="codemirror/searchcursor.js"></script>
|
||||
|
@ -27,21 +28,21 @@
|
|||
</head>
|
||||
<body style="display:none">
|
||||
<div id="toolbar">
|
||||
<a href="javascript:openProject()" class="toolbar-button" id="toolbar-button-open" title="Open"></a>
|
||||
<a href="javascript:saveProject()" class="toolbar-button" id="toolbar-button-save" title="Save"></a>
|
||||
<a href="javascript:IDE.openProject()" class="toolbar-button" id="toolbar-button-open" title="Open"></a>
|
||||
<a href="javascript:IDE.saveProject()" class="toolbar-button" id="toolbar-button-save" title="Save"></a>
|
||||
<div class="spacer"></div>
|
||||
<a href="javascript:runProgram()" class="toolbar-button" id="toolbar-button-run" title="Run"></a>
|
||||
<a href="javascript:stopProgram()" class="toolbar-button" id="toolbar-button-stop" title="Stop"></a>
|
||||
<a href="javascript:shareProgram()" class="toolbar-button" id="toolbar-button-share" title="Share / Export"></a>
|
||||
<a href="javascript:IDE.runProgram()" class="toolbar-button" id="toolbar-button-run" title="Run"></a>
|
||||
<a href="javascript:IDE.stopProgram()" class="toolbar-button" id="toolbar-button-stop" title="Stop"></a>
|
||||
<a href="javascript:IDE.shareProgram()" class="toolbar-button" id="toolbar-button-share" title="Share / Export"></a>
|
||||
<div class="spacer"></div>
|
||||
<a href="javascript:showOptionDialog()" class="toolbar-button" id="toolbar-button-settings" title="Settings"></a>
|
||||
<a href="javascript:IDE.showOptionDialog()" class="toolbar-button" id="toolbar-button-settings" title="Settings"></a>
|
||||
|
||||
<a href="javascript:showDialog('about-dialog')" class="toolbar-button" id="toolbar-button-about" title="About QBJS"></a>
|
||||
<a href="javascript:IDE.showDialog('about-dialog')" class="toolbar-button" id="toolbar-button-about" title="About QBJS"></a>
|
||||
<div class="spacer" style="float:right"></div>
|
||||
<a href="javascript:showConsole()" class="toolbar-button" id="toolbar-button-console-show" title="Show Console"></a>
|
||||
<a href="javascript:showConsole()" class="toolbar-button" id="toolbar-button-console-hide" title="Hide Console" style="display:none"></a>
|
||||
<a href="javascript:slideRight()" class="toolbar-button" id="toolbar-button-slide-right" title="Slide View Right"></a>
|
||||
<a href="javascript:slideLeft()" class="toolbar-button" id="toolbar-button-slide-left" title="Slide View Left"></a>
|
||||
<a href="javascript:IDE.showConsole()" class="toolbar-button" id="toolbar-button-console-show" title="Show Console"></a>
|
||||
<a href="javascript:IDE.showConsole()" class="toolbar-button" id="toolbar-button-console-hide" title="Hide Console" style="display:none"></a>
|
||||
<a href="javascript:IDE.slideRight()" class="toolbar-button" id="toolbar-button-slide-right" title="Slide View Right"></a>
|
||||
<a href="javascript:IDE.slideLeft()" class="toolbar-button" id="toolbar-button-slide-left" title="Slide View Left"></a>
|
||||
</div>
|
||||
<div id="code-container">
|
||||
<div id="code"></div>
|
||||
|
@ -55,7 +56,7 @@
|
|||
<div id="vslider"></div>
|
||||
<div id="output-container">
|
||||
<div id="tabs">
|
||||
<div id="tab-console" class="tab active" onclick="changeTab('console')">Console</div><div id="tab-js" class="tab" onclick="changeTab('js')">Javascript</div><div id="tab-fs" class="tab" onclick="changeTab('fs')">Files</div><div id="tab-help" class="tab" onclick="changeTab('help')">Help</div>
|
||||
<div id="tab-console" class="tab active" onclick="IDE.changeTab('console')">Console</div><div id="tab-js" class="tab" onclick="IDE.changeTab('js')">Javascript</div><div id="tab-fs" class="tab" onclick="IDE.changeTab('fs')">Files</div><div id="tab-help" class="tab" onclick="IDE.changeTab('help')">Help</div>
|
||||
</div>
|
||||
<div id="output-content">
|
||||
<div id="warning-container"></div>
|
||||
|
@ -63,8 +64,9 @@
|
|||
<div id="fs-browser">
|
||||
<div id="fs-path">
|
||||
<span id="fs-url">/</span>
|
||||
<div id="fs-refresh" title="Refresh" onclick="refreshFS()"></div>
|
||||
<div id="fs-new-folder" title="New Directory" onclick="onNewDirectory()"></div>
|
||||
<div id="fs-refresh" title="Refresh" onclick="IDE.refreshFS()"></div>
|
||||
<div id="fs-new-folder" title="New Directory" onclick="IDE.onNewDirectory()"></div>
|
||||
<div id="fs-upload" title="Upload" onclick="IDE.onUploadFile()"></div>
|
||||
</div>
|
||||
<div id="fs-contents">
|
||||
</div>
|
||||
|
@ -92,15 +94,15 @@
|
|||
<div style="margin-bottom:5px">Copy the link below to share your code:</div>
|
||||
<div><textarea id="share-code" rows="15" cols="60" readonly></textarea></div>
|
||||
<div style="margin-top: 5px; float:left">Launch Mode:
|
||||
<select id="share-mode" onchange="shareProgram()">
|
||||
<select id="share-mode" onchange="IDE.shareProgram()">
|
||||
<option value="">IDE (Default)</option>
|
||||
<option value="play">Play</option>
|
||||
<option value="auto">Auto</option>
|
||||
</select>
|
||||
</div>
|
||||
<a id="export-button" href="javascript:exportProgram()" style="display: none; float:left; margin-top: 7px; margin-left: 10px">Export</a>
|
||||
<a href="javascript:closeDialog()" style="display:block; float:right; margin-top: 7px">Close</a>
|
||||
<a href="javascript:testShare()" style="display: block; float:right; margin-top: 7px; margin-right: 10px">Test</a>
|
||||
<a id="export-button" href="javascript:IDE.exportProgram()" style="float:left; margin-top: 7px; margin-left: 10px">Export</a>
|
||||
<a href="javascript:IDE.closeDialog()" style="display:block; float:right; margin-top: 7px">Close</a>
|
||||
<a href="javascript:IDE.testShare()" style="display: block; float:right; margin-top: 7px; margin-right: 10px">Test</a>
|
||||
</dialog>
|
||||
|
||||
<dialog id="prog-sel-dialog">
|
||||
|
@ -110,14 +112,14 @@
|
|||
</div>
|
||||
<select id="prog-sel-sources" size="10" style="display:block; width:100%; margin-top:10px"></select>
|
||||
<div style="text-align:center; margin-top:10px">
|
||||
<a href="javascript:onSelMainProg()">Ok</a>
|
||||
<a href="javascript:closeDialog()">Cancel</a>
|
||||
<a href="javascript:IDE.onSelMainProg()">Ok</a>
|
||||
<a href="javascript:IDE.closeDialog()">Cancel</a>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
<dialog id="options-dialog">
|
||||
<div>Select a theme:</div>
|
||||
<select id="theme-picker" onchange="changeTheme(this.value)">
|
||||
<select id="theme-picker" onchange="IDE.changeTheme(this.value)">
|
||||
<option value="qbjs">Default</option>
|
||||
<option value="qb45">QBasic</option>
|
||||
<option value="qb64-vscode">QB64 VSCode</option>
|
||||
|
@ -125,7 +127,7 @@
|
|||
<option value="vscode-dark">VSCode Dark</option>
|
||||
</select>
|
||||
<div>
|
||||
<a href="javascript:closeDialog()" style="display:block; float:right; margin-top: 7px">Close</a>
|
||||
<a href="javascript:IDE.closeDialog()" style="display:block; float:right; margin-top: 7px">Close</a>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
|
@ -139,14 +141,14 @@
|
|||
QBJS brings the fun and accessibility of QBasic to the browser.<br/>
|
||||
Learn more:<br/>
|
||||
<ul>
|
||||
<li><a href="javascript:showHelp('language')">QBasic Language Support</a></li>
|
||||
<li><a href="javascript:showHelp('keywords')">Supported Keywords</a></li>
|
||||
<li><a href="javascript:showHelp('samples')">Samples</a></li>
|
||||
<li><a href="javascript:IDE.showHelp('language')">QBasic Language Support</a></li>
|
||||
<li><a href="javascript:IDE.showHelp('keywords')">Supported Keywords</a></li>
|
||||
<li><a href="javascript:IDE.showHelp('samples')">Samples</a></li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>Copyright (c) 2022-2023 boxgaming</p>
|
||||
<div>
|
||||
<a href="javascript:closeDialog()" style="display:block; float:right">Close</a>
|
||||
<a href="javascript:IDE.closeDialog()" style="display:block; float:right">Close</a>
|
||||
</div>
|
||||
</div>
|
||||
</dialog>
|
||||
|
|
|
@ -4,8 +4,8 @@ Const SQUARE = "square"
|
|||
|
||||
Export DEFAULT, ROUND, SQUARE
|
||||
Export RotoZoom, SaveImage
|
||||
Export Triangle, FillTriangle, RoundRect, FillRoundRect
|
||||
Export Shadow, ShadowOff, LineWidth, LineCap
|
||||
Export Triangle, FillTriangle, RoundRect, FillRoundRect, InvertRect
|
||||
Export Shadow, ShadowOff, LineWidth, LineCap, LineDash, LineDashOff
|
||||
Export FillCircle, Ellipse, FillEllipse, Curve, Bezier
|
||||
|
||||
Sub RotoZoom (centerX As Long, centerY As Long, img As Long, xScale As Single, yScale As Single, rotation As Single)
|
||||
|
@ -188,6 +188,28 @@ Sub _RoundRect (x As Long, y As Long, w As Long, h As Long, radius As Integer, c
|
|||
$End If
|
||||
End Sub
|
||||
|
||||
Sub InvertRect (x As Long, y As Long, width As Long, height As Long, fill As Integer)
|
||||
Dim destImg As Long
|
||||
destImg = _Dest
|
||||
|
||||
$If Javascript Then
|
||||
var ctx = QB.getImage(destImg).getContext("2d");
|
||||
ctx.beginPath();
|
||||
ctx.globalCompositeOperation="difference";
|
||||
if (fill) {
|
||||
ctx.fillStyle = "white";
|
||||
ctx.rect(x, y, width, height);
|
||||
ctx.fill();
|
||||
}
|
||||
else {
|
||||
ctx.strokeStyle = "white";
|
||||
ctx.rect(x, y, width, height);
|
||||
ctx.stroke();
|
||||
}
|
||||
ctx.globalCompositeOperation = "source-over";
|
||||
$End If
|
||||
End Sub
|
||||
|
||||
Sub Shadow (clr As Long, offsetX As Long, offsetY As Long, blur As Long)
|
||||
Dim destImg As Long
|
||||
destImg = _Dest
|
||||
|
@ -254,6 +276,30 @@ Function LineCap
|
|||
$End If
|
||||
End Function
|
||||
|
||||
Sub LineDash (dashLen As Integer, dashSpace As Integer)
|
||||
$If Javascript Then
|
||||
var ctx = QB.getImage(QB.func__Dest()).getContext("2d");
|
||||
if (dashLen > 0) {
|
||||
var dl = dashLen;
|
||||
var ds = dashLen;
|
||||
if (dashSpace > 0) {
|
||||
ds = dashSpace;
|
||||
}
|
||||
ctx.setLineDash([dl, ds])
|
||||
}
|
||||
else {
|
||||
ctx.setLineDash([])
|
||||
}
|
||||
$End If
|
||||
End Sub
|
||||
|
||||
Sub LineDashOff
|
||||
$If Javascript Then
|
||||
var ctx = QB.getImage(QB.func__Dest()).getContext("2d");
|
||||
ctx.setLineDash([])
|
||||
$End If
|
||||
End Sub
|
||||
|
||||
Sub Curve (sx As Long, sy As Long, cx As Long, cy As Long, ex As Long, ey as Long, clr As _Unsigned Long)
|
||||
If clr = undefined Then
|
||||
clr = _DefaultColor
|
||||
|
|
|
@ -66,7 +66,11 @@ Sub UploadFile(destpath As String, filter As String, fnCallback)
|
|||
$If Javascript Then
|
||||
var vfs = QB.vfs();
|
||||
var parentDir = null;
|
||||
if (destpath == undefined || destpath == "") {
|
||||
if (destpath == "/") {
|
||||
parentDir = QB.vfs().rootDirectory();
|
||||
destpath = "";
|
||||
}
|
||||
else if (destpath == undefined || destpath == "") {
|
||||
parentDir = QB.vfsCwd();
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -38,40 +38,42 @@ Sub Log (msg As String, msgType As String)
|
|||
|
||||
$If Javascript Then
|
||||
var t = document.querySelector("#warning-container table");
|
||||
if (!t || appMode != "ide") {
|
||||
if (!t || IDE.mode() != "ide") {
|
||||
console.log(msgType + ":" + msg);
|
||||
return;
|
||||
}
|
||||
var errorLine = await getErrorLine(new Error(), 1);
|
||||
var errorLine = await IDE.getErrorLine(new Error(), 1);
|
||||
var tr = document.createElement("tr");
|
||||
addWarningCell(tr, msgType);
|
||||
addWarningCell(tr, ":");
|
||||
addWarningCell(tr, errorLine);
|
||||
addWarningCell(tr, ":");
|
||||
addWarningCell(tr, await func_EscapeHtml(msg), "99%");
|
||||
IDE.addWarningCell(tr, msgType);
|
||||
IDE.addWarningCell(tr, ":");
|
||||
IDE.addWarningCell(tr, errorLine);
|
||||
IDE.addWarningCell(tr, ":");
|
||||
IDE.addWarningCell(tr, await func_EscapeHtml(msg), "99%");
|
||||
tr.codeLine = errorLine - 1;
|
||||
tr.onclick = gotoWarning;
|
||||
tr.onclick = IDE.gotoWarning;
|
||||
t.append(tr);
|
||||
var container = document.getElementById("output-content");
|
||||
container.scrollTop = container.scrollHeight;
|
||||
changeTab("console");
|
||||
IDE.changeTab("console");
|
||||
IDE.showConsole(true);
|
||||
$End If
|
||||
End Sub
|
||||
|
||||
Sub Echo (msg As String)
|
||||
$If Javascript Then
|
||||
var t = document.querySelector("#warning-container table");
|
||||
if (!t || appMode != "ide") {
|
||||
if (!t || IDE.mode() != "ide") {
|
||||
console.log(msg);
|
||||
return;
|
||||
}
|
||||
var tr = document.createElement("tr");
|
||||
addWarningCell(tr, await func_EscapeHtml(msg));
|
||||
IDE.addWarningCell(tr, await func_EscapeHtml(msg));
|
||||
tr.firstChild.colSpan = "5";
|
||||
t.append(tr);
|
||||
var container = document.getElementById("output-content");
|
||||
container.scrollTop = container.scrollHeight;
|
||||
changeTab("console");
|
||||
IDE.changeTab("console");
|
||||
IDE.showConsole(true);
|
||||
$End If
|
||||
End Sub
|
||||
|
||||
|
|
184
qb.js
184
qb.js
|
@ -30,6 +30,8 @@ var QB = new function() {
|
|||
var _inkeymap = {};
|
||||
var _inkeynp = {};
|
||||
var _inputMode = false;
|
||||
var _inputCursor = false;
|
||||
var _inputTimeout = false;
|
||||
var _keyDownMap = {};
|
||||
var _keyHitBuffer = [];
|
||||
var _keyhitmap = {};
|
||||
|
@ -141,6 +143,9 @@ var QB = new function() {
|
|||
this.halt = function() {
|
||||
_haltedFlag = true;
|
||||
_runningFlag = false;
|
||||
_inputMode = false;
|
||||
GX.soundStopAll();
|
||||
toggleCursor(true);
|
||||
};
|
||||
|
||||
this.halted = function() {
|
||||
|
@ -169,9 +174,9 @@ var QB = new function() {
|
|||
_nextFontId = 1000;
|
||||
_font = 16;
|
||||
_fonts = {};
|
||||
_fonts[8] = { name: "dosvga", size: "16px", style: "", offset: 3, monospace: true };
|
||||
_fonts[14] = { name: "dosvga", size: "16px", style: "", offset: 3, monospace: true };
|
||||
_fonts[16] = { name: "dosvga", size: "16px", style: "", offset: 3, monospace: true };
|
||||
_fonts[8] = { name: "dosvga", size: "16px", style: "", offset: 4, monospace: true };
|
||||
_fonts[14] = { name: "dosvga", size: "16px", style: "", offset: 4, monospace: true };
|
||||
_fonts[16] = { name: "dosvga", size: "16px", style: "", offset: 4, monospace: true };
|
||||
GX.vfsCwd(GX.vfs().rootDirectory());
|
||||
_fileHandles = {};
|
||||
_initColorTable();
|
||||
|
@ -242,6 +247,18 @@ var QB = new function() {
|
|||
return Math.acosh(x);
|
||||
};
|
||||
|
||||
this.func__Arccot = function(x) {
|
||||
return 2 * Math.atan(1) - Math.atan(x);
|
||||
};
|
||||
|
||||
this.func__Arccsc = function(x) {
|
||||
return Math.asin(1 / x);
|
||||
};
|
||||
|
||||
this.func__Arcsec = function(x) {
|
||||
return Math.acos(1 / x);
|
||||
};
|
||||
|
||||
this.func__Alpha = function(rgb, imageHandle) {
|
||||
// TODO: implement corresponding logic when an image handle is supplied (maybe)
|
||||
return _color(rgb).a;
|
||||
|
@ -287,6 +304,10 @@ var QB = new function() {
|
|||
return _color(rgb).b;
|
||||
};
|
||||
|
||||
this.func__CapsLock = function() {
|
||||
return _keyDownMap._CapsLock ? -1 : 0;
|
||||
};
|
||||
|
||||
this.func__Ceil = function(x) {
|
||||
return Math.ceil(x);
|
||||
};
|
||||
|
@ -308,12 +329,20 @@ var QB = new function() {
|
|||
return Math.cosh(x);
|
||||
};
|
||||
|
||||
this.func__Cot = function(x) {
|
||||
return 1 / Math.tan(x);
|
||||
}
|
||||
|
||||
this.func__Coth = function(x) {
|
||||
return 1/Math.tanh(x);
|
||||
return 1 / Math.tanh(x);
|
||||
};
|
||||
|
||||
this.func__Csc = function(x) {
|
||||
return 1 / Math.sin(x);
|
||||
};
|
||||
|
||||
this.func__Csch = function(x) {
|
||||
return 1/Math.sinh(x);
|
||||
return 1 / Math.sinh(x);
|
||||
};
|
||||
|
||||
this.func__CWD = function() {
|
||||
|
@ -321,11 +350,11 @@ var QB = new function() {
|
|||
};
|
||||
|
||||
this.func__D2R = function(x) {
|
||||
return x*Math.PI/180;
|
||||
return x * Math.PI / 180;
|
||||
};
|
||||
|
||||
this.func__D2G = function(x) {
|
||||
return (x * 10/9);
|
||||
return (x * 10 / 9);
|
||||
};
|
||||
|
||||
this.func__DefaultColor = function(imageHandle) {
|
||||
|
@ -334,6 +363,11 @@ var QB = new function() {
|
|||
return _fgColor;
|
||||
};
|
||||
|
||||
this.func__Deflate = function(src) {
|
||||
var result = pako.deflate(src);//, { to: "string" });
|
||||
return String.fromCharCode.apply(String, result);
|
||||
};
|
||||
|
||||
this.sub__Delay = async function(seconds) {
|
||||
await GX.sleep(seconds*1000);
|
||||
};
|
||||
|
@ -351,6 +385,7 @@ var QB = new function() {
|
|||
};
|
||||
|
||||
this.sub__Dest = function(imageId) {
|
||||
_flushScreenCache(_images[_activeImage]);
|
||||
_activeImage = imageId;
|
||||
};
|
||||
|
||||
|
@ -389,12 +424,6 @@ var QB = new function() {
|
|||
};
|
||||
|
||||
this.sub__Font = function(fnt) {
|
||||
if (fnt < 1000) {
|
||||
GX.canvas().style.letterSpacing = "-1px";
|
||||
}
|
||||
else {
|
||||
GX.canvas().style.letterSpacing = "normal";
|
||||
}
|
||||
_font = fnt;
|
||||
_locX = 0;
|
||||
_lastTextX = 0;
|
||||
|
@ -479,6 +508,11 @@ var QB = new function() {
|
|||
return Math.hypot(x, y);
|
||||
};
|
||||
|
||||
this.func__Inflate = function(src) {
|
||||
var result = pako.inflate(GX.vfs().textToData(src), { to: "string" });
|
||||
return result;
|
||||
};
|
||||
|
||||
this.func__InStrRev = function(arg1, arg2, arg3) {
|
||||
var startIndex = +Infinity;
|
||||
var strSource = "";
|
||||
|
@ -517,7 +551,11 @@ var QB = new function() {
|
|||
|
||||
this.sub__Limit = async function(fps) {
|
||||
_flushAllScreenCache();
|
||||
await GX.sleep((1000 - (new Date() - _lastLimitTime))/fps);
|
||||
var frameMillis = 1000 / fps / 1.15;
|
||||
await GX.sleep(0);
|
||||
while (Date.now() - _lastLimitTime < frameMillis) {
|
||||
await GX.sleep(0);
|
||||
}
|
||||
_lastLimitTime = new Date();
|
||||
};
|
||||
|
||||
|
@ -694,6 +732,10 @@ var QB = new function() {
|
|||
return tmpId;
|
||||
};
|
||||
|
||||
this.func__NumLock = function() {
|
||||
return _keyDownMap._NumLock ? -1 : 0;
|
||||
};
|
||||
|
||||
this.func__OS = function() {
|
||||
|
||||
var browser = "";
|
||||
|
@ -752,7 +794,7 @@ var QB = new function() {
|
|||
else {
|
||||
fheight = tm.actualBoundingBoxAscent + tm.actualBoundingBoxDescent;
|
||||
}
|
||||
|
||||
|
||||
if (_printMode != QB._KEEPBACKGROUND) {
|
||||
ctx.fillStyle = _bgColor.rgba();
|
||||
ctx.fillRect(x, y, tm.width, fheight);
|
||||
|
@ -980,8 +1022,16 @@ var QB = new function() {
|
|||
return window.screenY;
|
||||
};
|
||||
|
||||
this.func__ScrollLock = function() {
|
||||
return _keyDownMap._ScrollLock ? -1 : 0;
|
||||
};
|
||||
|
||||
this.func__Sec = function(x) {
|
||||
return 1 / Math.cos(x);
|
||||
};
|
||||
|
||||
this.func__Sech = function(x) {
|
||||
return 1/Math.cosh(x);
|
||||
return 1 / Math.cosh(x);
|
||||
};
|
||||
|
||||
this.func__Setbit = function(x, y) {
|
||||
|
@ -1597,6 +1647,36 @@ var QB = new function() {
|
|||
};
|
||||
|
||||
|
||||
function blinkCursor() {
|
||||
if (_inputMode == true) {
|
||||
_inputTimeout = true;
|
||||
toggleCursor();
|
||||
setTimeout(blinkCursor, 400);
|
||||
}
|
||||
else {
|
||||
_inputTimeout = false;
|
||||
}
|
||||
}
|
||||
|
||||
function toggleCursor(off) {
|
||||
if (!off || off != _inputCursor) {
|
||||
var ctx = _images[_activeImage].ctx;
|
||||
ctx.beginPath();
|
||||
ctx.globalCompositeOperation="difference";
|
||||
ctx.fillStyle = "white";
|
||||
var w = QB.func__FontWidth();
|
||||
if (w < 1) {
|
||||
var tm = ctx.measureText("A");
|
||||
w = tm.width;
|
||||
}
|
||||
ctx.rect(_lastTextX, (_locY + 1) * QB.func__FontHeight() - 2, w, 2);
|
||||
|
||||
ctx.fill();
|
||||
ctx.globalCompositeOperation = "source-over";
|
||||
_inputCursor = !_inputCursor;
|
||||
}
|
||||
}
|
||||
|
||||
this.sub_Input = async function(values, preventNewline, addQuestionPrompt, prompt) {
|
||||
_lastKey = null;
|
||||
var str = "";
|
||||
|
@ -1612,42 +1692,65 @@ var QB = new function() {
|
|||
}
|
||||
|
||||
if (!preventNewline && _locY > _textRows()-1) {
|
||||
await _printScroll();
|
||||
await _printScroll();
|
||||
_locY = _textRows()-1;
|
||||
}
|
||||
|
||||
var ctx = _images[_activeImage].ctx;
|
||||
if (!_inputTimeout) {
|
||||
setTimeout(blinkCursor, 400);
|
||||
}
|
||||
|
||||
while (_lastKey != "Enter") {
|
||||
var ctx = _images[_activeImage].ctx;
|
||||
var copy = document.createElement("canvas");
|
||||
copy.width = _images[_activeImage].canvas.width;
|
||||
copy.height = _images[_activeImage].canvas.height;
|
||||
var copyCtx = copy.getContext("2d");
|
||||
copyCtx.drawImage(_images[_activeImage].canvas, 0, 0);
|
||||
|
||||
var beginTextX = _lastTextX;
|
||||
while (_lastKey != "Enter" && _inputMode) {
|
||||
|
||||
if (_lastKey == "Backspace" && str.length > 0) {
|
||||
toggleCursor(true);
|
||||
_locX--;
|
||||
|
||||
var tm = ctx.measureText(str);
|
||||
str = str.substring(0, str.length-1);
|
||||
ctx.beginPath();
|
||||
ctx.fillStyle = _bgColor.rgba();
|
||||
ctx.fillRect(_lastTextX, _locY * QB.func__FontHeight(), tm.width, QB.func__FontHeight());
|
||||
QB.sub__PrintString(_lastTextX, _locY * QB.func__FontHeight(), str);
|
||||
var tm = ctx.measureText(str);
|
||||
_lastTextX = beginTextX + tm.width;
|
||||
ctx.clearRect(0, 0, copy.width, copy.height);
|
||||
ctx.drawImage(copy, 0, 0);
|
||||
QB.sub__PrintString(beginTextX, _locY * QB.func__FontHeight(), str);
|
||||
}
|
||||
|
||||
else if (_lastKey && _lastKey.length < 2) {
|
||||
toggleCursor(true);
|
||||
str += _lastKey;
|
||||
QB.sub__PrintString(_lastTextX, _locY * QB.func__FontHeight(), str);
|
||||
var tm = ctx.measureText(str);
|
||||
ctx.clearRect(0, 0, copy.width, copy.height);
|
||||
ctx.drawImage(copy, 0, 0);
|
||||
QB.sub__PrintString(beginTextX, _locY * QB.func__FontHeight(), str);
|
||||
_locX++;
|
||||
_lastTextX = beginTextX + tm.width;
|
||||
}
|
||||
|
||||
_lastKey = null;
|
||||
await GX.sleep(10);
|
||||
await GX.sleep(5);
|
||||
}
|
||||
if (!_inputMode) { return; }
|
||||
|
||||
_inputMode = false;
|
||||
toggleCursor(true);
|
||||
|
||||
if (!preventNewline) {
|
||||
_locY++;
|
||||
_locX = 0;
|
||||
_lastTextX = 0;
|
||||
}
|
||||
else {
|
||||
var tm = ctx.measureText(str);
|
||||
_lastTextX += tm.width;
|
||||
if (_locY < _textRows()-1) {
|
||||
_locY = _locY + 1;
|
||||
}
|
||||
else {
|
||||
await _printScroll();
|
||||
}
|
||||
}
|
||||
|
||||
if (values.length < 2) {
|
||||
|
@ -1659,7 +1762,6 @@ var QB = new function() {
|
|||
values[i] = vparts[i] ? vparts[i] : "";
|
||||
}
|
||||
}
|
||||
_inputMode = false;
|
||||
}
|
||||
|
||||
this.sub_InputFromFile = async function(fh, returnValues) {
|
||||
|
@ -1725,6 +1827,14 @@ var QB = new function() {
|
|||
return String(value).length;
|
||||
};
|
||||
|
||||
this.func_Loc = function(fh) {
|
||||
if (!_fileHandles[fh]) {
|
||||
throw new Error("Invalid file handle");
|
||||
}
|
||||
|
||||
return _fileHandles[fh].offset;
|
||||
};
|
||||
|
||||
this.func_Log = function(value) {
|
||||
return Math.log(value);
|
||||
};
|
||||
|
@ -2339,8 +2449,8 @@ var QB = new function() {
|
|||
ctx.fillStyle = _fgColor.rgba();
|
||||
ctx.fillText(subline, x, (y + QB.func__FontHeight() - f.offset));
|
||||
}
|
||||
|
||||
x += tm.width;
|
||||
|
||||
_locX += subline.length;
|
||||
}
|
||||
|
||||
|
@ -2632,6 +2742,8 @@ var QB = new function() {
|
|||
position--;
|
||||
}
|
||||
|
||||
var vfs = GX.vfs();
|
||||
|
||||
if (value._dimensions) {
|
||||
var idx = [];
|
||||
for (var di=0; di < value._dimensions.length; di++) {
|
||||
|
@ -2856,7 +2968,6 @@ var QB = new function() {
|
|||
_keyDownMap = {};
|
||||
|
||||
// TODO: set the appropriate default font for the selected screen mode above instead of here
|
||||
//GX.canvas().style.letterSpacing = "-1px";
|
||||
};
|
||||
|
||||
this.func_Seek = function(fh) {
|
||||
|
@ -3106,6 +3217,7 @@ var QB = new function() {
|
|||
var script = document.createElement("script")
|
||||
document.body.appendChild(script);
|
||||
script.id = url;
|
||||
script.async = false;
|
||||
|
||||
var file = vfs.getNode(url, vfsCwd);
|
||||
if (file && file.type == vfs.FILE) {
|
||||
|
@ -3697,6 +3809,9 @@ var QB = new function() {
|
|||
if (kh) {
|
||||
_keyHitBuffer.push(kh);
|
||||
_keyDownMap[kh] = true;
|
||||
_keyDownMap._CapsLock = event.getModifierState("CapsLock");
|
||||
_keyDownMap._NumLock = event.getModifierState("NumLock");
|
||||
_keyDownMap._ScrollLock = event.getModifierState("ScrollLock");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -3711,6 +3826,9 @@ var QB = new function() {
|
|||
if (kh) {
|
||||
_keyHitBuffer.push(kh * -1);
|
||||
_keyDownMap[kh] = false;
|
||||
_keyDownMap._CapsLock = event.getModifierState("CapsLock");
|
||||
_keyDownMap._NumLock = event.getModifierState("NumLock");
|
||||
_keyDownMap._ScrollLock = event.getModifierState("ScrollLock");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
257
qb2js.js
257
qb2js.js
|
@ -278,14 +278,7 @@ if (QB.halted()) { return; }; firstLine = Math.round(firstLine); lastLine = Math
|
|||
typeMode = False;
|
||||
}
|
||||
} else {
|
||||
var tvar = {type:'',name:'',jsname:'',isConst:0,isArray:0,arraySize:0,typeId:0}; /* VARIABLE */
|
||||
tvar.typeId = currType;
|
||||
tvar.name = QB.arrayValue(parts, [ 1]).value;
|
||||
tvar.type = (QB.func_UCase( QB.arrayValue(parts, [ 3]).value));
|
||||
if ( tvar.type == "_UNSIGNED" ) {
|
||||
tvar.type = tvar.type + " " + (QB.func_UCase( QB.arrayValue(parts, [ 4]).value));
|
||||
}
|
||||
await sub_AddVariable( tvar, typeVars);
|
||||
await sub_DeclareTypeVar( parts , currType, i);
|
||||
}
|
||||
} else {
|
||||
if ( first == "CONST" ) {
|
||||
|
@ -470,7 +463,7 @@ if (QB.halted()) { return; }; firstLine = Math.round(firstLine); lastLine = Math
|
|||
}
|
||||
loopLevel = loopLevel - 1;
|
||||
indent = - 1;
|
||||
} else if ( first == "_CONTINUE" ) {
|
||||
} else if ( first == "_CONTINUE" || first == "CONTINUE" ) {
|
||||
js = "continue;";
|
||||
} else if ((QB.func_UCase( l)) == "EXIT FUNCTION" ) {
|
||||
js = "return " + (await func_RemoveSuffix( functionName)) + ";";
|
||||
|
@ -723,11 +716,11 @@ var ConvertSub = null;
|
|||
js = (await func_CallMethod( m)) + "(" + (await func_ConvertWindow( args, lineNumber)) + ");";
|
||||
} else if ( m.name == "Write" ) {
|
||||
js = (await func_ConvertWrite( m, args, lineNumber));
|
||||
} else if ( m.name == "_PrintString" ) {
|
||||
} else if ( m.name == "_PrintString" || m.name == "PrintString" ) {
|
||||
js = (await func_CallMethod( m)) + "(" + (await func_ConvertPrintString( args, lineNumber)) + ");";
|
||||
} else if ( m.name == "_PutImage" ) {
|
||||
} else if ( m.name == "_PutImage" || m.name == "PutImage" ) {
|
||||
js = (await func_CallMethod( m)) + "(" + (await func_ConvertPutImage( args, lineNumber)) + ");";
|
||||
} else if ( m.name == "_FullScreen" ) {
|
||||
} else if ( m.name == "_FullScreen" || m.name == "FullScreen" ) {
|
||||
js = (await func_CallMethod( m)) + "(" + (await func_ConvertFullScreen( args)) + ");";
|
||||
} else {
|
||||
js = (await func_CallMethod( m)) + "(" + (await func_ConvertMethodParams( args, lineNumber)) + ");";
|
||||
|
@ -786,16 +779,16 @@ var ConvertFullScreen = null;
|
|||
if ( argc > 0) {
|
||||
var arg = ''; /* STRING */
|
||||
arg = (QB.func_UCase( QB.arrayValue(parts, [ 1]).value));
|
||||
if ( arg == "_OFF" ) {
|
||||
if ( arg == "_OFF" || arg == "OFF" ) {
|
||||
mode = "QB.OFF";
|
||||
} else if ( arg == "_STRETCH" ) {
|
||||
} else if ( arg == "_STRETCH" || arg == "STRETCH" ) {
|
||||
mode = "QB.STRETCH";
|
||||
} else if ( arg == "_SQUAREPIXELS" ) {
|
||||
} else if ( arg == "_SQUAREPIXELS" || arg == "SQUAREPIXELS" ) {
|
||||
mode = "QB.SQUAREPIXELS";
|
||||
}
|
||||
}
|
||||
if ( argc > 1) {
|
||||
if ((QB.func_UCase( QB.arrayValue(parts, [ 2]).value)) == "_SMOOTH" ) {
|
||||
if ((QB.func_UCase( QB.arrayValue(parts, [ 2]).value)) == "_SMOOTH" || (QB.func_UCase( QB.arrayValue(parts, [ 2]).value)) == "SMOOTH" ) {
|
||||
doSmooth = "true";
|
||||
}
|
||||
}
|
||||
|
@ -864,7 +857,7 @@ var ConvertPutImage = null;
|
|||
sourceImage = "undefined";
|
||||
destImage = "undefined";
|
||||
doSmooth = "false";
|
||||
if ((await func_EndsWith( (QB.func__Trim( (QB.func_UCase( args)))) , "_SMOOTH")) ) {
|
||||
if ((await func_EndsWith( (QB.func__Trim( (QB.func_UCase( args)))) , "_SMOOTH")) || (await func_EndsWith( (QB.func__Trim( (QB.func_UCase( args)))) , "SMOOTH")) ) {
|
||||
doSmooth = "true";
|
||||
args = (QB.func_Left( (QB.func__Trim( args)) , (QB.func_Len( (QB.func__Trim( args)))) - 7));
|
||||
}
|
||||
|
@ -884,7 +877,7 @@ var ConvertPutImage = null;
|
|||
destCoord = (await func_ConvertCoordParam( QB.arrayValue(parts, [ 4]).value , True, lineNumber));
|
||||
}
|
||||
if ( argc >= 5) {
|
||||
if ((QB.func__Trim( (QB.func_UCase( QB.arrayValue(parts, [ 5]).value)))) == "_SMOOTH" ) {
|
||||
if ((QB.func__Trim( (QB.func_UCase( QB.arrayValue(parts, [ 5]).value)))) == "_SMOOTH" || (QB.func__Trim( (QB.func_UCase( QB.arrayValue(parts, [ 5]).value)))) == "SMOOTH" ) {
|
||||
doSmooth = "true";
|
||||
}
|
||||
}
|
||||
|
@ -1441,6 +1434,66 @@ var FindParamChar = null;
|
|||
FindParamChar = idx;
|
||||
return FindParamChar;
|
||||
}
|
||||
async function sub_DeclareTypeVar(parts/*STRING*/,typeId/*INTEGER*/,lineNumber/*INTEGER*/) {
|
||||
if (QB.halted()) { return; };
|
||||
var vname = ''; /* STRING */
|
||||
var vtype = ''; /* STRING */
|
||||
vtype = "";
|
||||
var vtypeIndex = 0; /* INTEGER */
|
||||
vtypeIndex = 4;
|
||||
var isGlobal = 0; /* INTEGER */
|
||||
isGlobal = False;
|
||||
var isArray = 0; /* INTEGER */
|
||||
isArray = False;
|
||||
var isStatic = 0; /* INTEGER */
|
||||
isStatic = False;
|
||||
var arraySize = ''; /* STRING */
|
||||
var pstart = 0; /* INTEGER */
|
||||
var bvar = {type:'',name:'',jsname:'',isConst:0,isArray:0,arraySize:0,typeId:0}; /* VARIABLE */
|
||||
var varnames = QB.initArray([{l:0,u:0}], ''); /* STRING */
|
||||
var vnamecount = 0; /* INTEGER */
|
||||
var findVar = {type:'',name:'',jsname:'',isConst:0,isArray:0,arraySize:0,typeId:0}; /* VARIABLE */
|
||||
var asIdx = 0; /* INTEGER */
|
||||
asIdx = 0;
|
||||
bvar.typeId = typeId;
|
||||
var i = 0; /* INTEGER */
|
||||
var ___v2981654 = 0; for ( i= 1; i <= (QB.func_UBound( parts)); i= i + 1) { if (QB.halted()) { return; } ___v2981654++; if (___v2981654 % 100 == 0) { await QB.autoLimit(); }
|
||||
if ((QB.func_UCase( QB.arrayValue(parts, [ i]).value)) == "AS" ) {
|
||||
asIdx = i;
|
||||
}
|
||||
}
|
||||
if ( asIdx == 1) {
|
||||
bvar.type = (QB.func_UCase( QB.arrayValue(parts, [ asIdx + 1]).value));
|
||||
var nextIdx = 0; /* INTEGER */
|
||||
nextIdx = asIdx + 2;
|
||||
if ( bvar.type == "_UNSIGNED" || bvar.type == "UNSIGNED" ) {
|
||||
bvar.type = (await func_NormalizeType( "_UNSIGNED " + (QB.func_UCase( QB.arrayValue(parts, [ asIdx + 2]).value))));
|
||||
nextIdx = asIdx + 3;
|
||||
}
|
||||
vnamecount = (await func_ListSplit( (await func_Join( parts , nextIdx, - 1, " ")) , varnames));
|
||||
var ___v6226967 = 0; for ( i= 1; i <= vnamecount; i= i + 1) { if (QB.halted()) { return; } ___v6226967++; if (___v6226967 % 100 == 0) { await QB.autoLimit(); }
|
||||
vname = (QB.func__Trim( QB.arrayValue(varnames, [ i]).value));
|
||||
pstart = (QB.func_InStr( vname, "("));
|
||||
if ( pstart > 0) {
|
||||
bvar.isArray = True;
|
||||
arraySize = (await func_ConvertExpression( (QB.func_Mid( vname, pstart + 1, (QB.func_Len( vname)) - pstart - 1)) , lineNumber));
|
||||
bvar.name = (await func_RemoveSuffix( (QB.func_Left( vname, pstart - 1))));
|
||||
} else {
|
||||
bvar.isArray = False;
|
||||
arraySize = "";
|
||||
bvar.name = vname;
|
||||
}
|
||||
await sub_AddVariable( bvar, typeVars);
|
||||
}
|
||||
} else {
|
||||
bvar.name = QB.arrayValue(parts, [ 1]).value;
|
||||
bvar.type = (QB.func_UCase( QB.arrayValue(parts, [ 3]).value));
|
||||
if ( bvar.type == "_UNSIGNED" || bvar.type == "UNSIGNED" ) {
|
||||
bvar.type = (await func_NormalizeType( "_UNSIGNED " + (QB.func_UCase( QB.arrayValue(parts, [ 4]).value))));
|
||||
}
|
||||
await sub_AddVariable( bvar, typeVars);
|
||||
}
|
||||
}
|
||||
async function func_DeclareVar(parts/*STRING*/,lineNumber/*INTEGER*/) {
|
||||
if (QB.halted()) { return; };
|
||||
var DeclareVar = null;
|
||||
|
@ -1465,7 +1518,7 @@ var DeclareVar = null;
|
|||
asIdx = 0;
|
||||
var js = ''; /* STRING */
|
||||
js = "";
|
||||
var preserve = ''; /* STRING */
|
||||
|
||||
preserve = "false";
|
||||
if ((QB.func_UCase( QB.arrayValue(parts, [ 1]).value)) == "STATIC" ) {
|
||||
if ( currentMethod == "" ) {
|
||||
|
@ -1485,11 +1538,11 @@ var DeclareVar = null;
|
|||
return DeclareVar;
|
||||
}
|
||||
var i = 0; /* INTEGER */
|
||||
var ___v2981654 = 0; for ( i= 1; i <= (QB.func_UBound( parts)); i= i + 1) { if (QB.halted()) { return; } ___v2981654++; if (___v2981654 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v6478212 = 0; for ( i= 1; i <= (QB.func_UBound( parts)); i= i + 1) { if (QB.halted()) { return; } ___v6478212++; if (___v6478212 % 100 == 0) { await QB.autoLimit(); }
|
||||
if ((QB.func_UCase( QB.arrayValue(parts, [ i]).value)) == "AS" ) {
|
||||
asIdx = i;
|
||||
}
|
||||
if ((QB.func_UCase( QB.arrayValue(parts, [ i]).value)) == "_PRESERVE" ) {
|
||||
if ((QB.func_UCase( QB.arrayValue(parts, [ i]).value)) == "_PRESERVE" || (QB.func_UCase( QB.arrayValue(parts, [ i]).value)) == "PRESERVE" ) {
|
||||
preserve = "true";
|
||||
}
|
||||
if ((QB.func_UCase( QB.arrayValue(parts, [ i]).value)) == "SHARED" ) {
|
||||
|
@ -1500,13 +1553,13 @@ var DeclareVar = null;
|
|||
bvar.type = (QB.func_UCase( QB.arrayValue(parts, [ asIdx + 1]).value));
|
||||
var nextIdx = 0; /* INTEGER */
|
||||
nextIdx = asIdx + 2;
|
||||
if ( bvar.type == "_UNSIGNED" ) {
|
||||
if ( bvar.type == "_UNSIGNED" || bvar.type == "UNSIGNED" ) {
|
||||
bvar.type = bvar.type + " " + (QB.func_UCase( QB.arrayValue(parts, [ asIdx + 2]).value));
|
||||
nextIdx = asIdx + 3;
|
||||
}
|
||||
bvar.typeId = (await func_FindTypeId( bvar.type));
|
||||
vnamecount = (await func_ListSplit( (await func_Join( parts , nextIdx, - 1, " ")) , varnames));
|
||||
var ___v6226967 = 0; for ( i= 1; i <= vnamecount; i= i + 1) { if (QB.halted()) { return; } ___v6226967++; if (___v6226967 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v2637929 = 0; for ( i= 1; i <= vnamecount; i= i + 1) { if (QB.halted()) { return; } ___v2637929++; if (___v2637929 % 100 == 0) { await QB.autoLimit(); }
|
||||
vname = (QB.func__Trim( QB.arrayValue(varnames, [ i]).value));
|
||||
pstart = (QB.func_InStr( vname, "("));
|
||||
if ( pstart > 0) {
|
||||
|
@ -1524,15 +1577,15 @@ var DeclareVar = null;
|
|||
var vpartcount = 0; /* INTEGER */
|
||||
var vparts = QB.initArray([{l:0,u:0}], ''); /* STRING */
|
||||
nextIdx = 0;
|
||||
var ___v6478212 = 0; for ( i= 1; i <= (QB.func_UBound( parts)); i= i + 1) { if (QB.halted()) { return; } ___v6478212++; if (___v6478212 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v2793420 = 0; for ( i= 1; i <= (QB.func_UBound( parts)); i= i + 1) { if (QB.halted()) { return; } ___v2793420++; if (___v2793420 % 100 == 0) { await QB.autoLimit(); }
|
||||
var p = ''; /* STRING */
|
||||
p = (QB.func_UCase( QB.arrayValue(parts, [ i]).value));
|
||||
if ( p == "DIM" || p == "REDIM" || p == "SHARED" || p == "_PRESERVE" || p == "STATIC" ) {
|
||||
if ( p == "DIM" || p == "REDIM" || p == "SHARED" || p == "_PRESERVE" || p == "PRESERVE" || p == "STATIC" ) {
|
||||
nextIdx = i + 1;
|
||||
}
|
||||
}
|
||||
vnamecount = (await func_ListSplit( (await func_Join( parts , nextIdx, - 1, " ")) , varnames));
|
||||
var ___v2637929 = 0; for ( i= 1; i <= vnamecount; i= i + 1) { if (QB.halted()) { return; } ___v2637929++; if (___v2637929 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v8298016 = 0; for ( i= 1; i <= vnamecount; i= i + 1) { if (QB.halted()) { return; } ___v8298016++; if (___v8298016 % 100 == 0) { await QB.autoLimit(); }
|
||||
vpartcount = (await func_SLSplit2( QB.arrayValue(varnames, [ i]).value , vparts));
|
||||
if ( vpartcount == 1) {
|
||||
bvar.type = (await func_DataTypeFromName( QB.arrayValue(vparts, [ 1]).value));
|
||||
|
@ -1572,6 +1625,7 @@ var RegisterVar = null;
|
|||
if ( isStatic) {
|
||||
bvar.jsname = "$" + currentMethod + "__" + bvar.jsname;
|
||||
}
|
||||
bvar.type = (await func_NormalizeType( bvar.type));
|
||||
if (! bvar.isArray) {
|
||||
js = js + "var " + bvar.jsname + " = " + (await func_InitTypeValue( bvar.type)) + "; ";
|
||||
} else {
|
||||
|
@ -1601,7 +1655,7 @@ var FormatArraySize = null;
|
|||
var pcount = 0; /* INTEGER */
|
||||
pcount = (await func_ListSplit( sizeString, parts));
|
||||
var i = 0; /* INTEGER */
|
||||
var ___v2793420 = 0; for ( i= 1; i <= pcount; i= i + 1) { if (QB.halted()) { return; } ___v2793420++; if (___v2793420 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v8246022 = 0; for ( i= 1; i <= pcount; i= i + 1) { if (QB.halted()) { return; } ___v8246022++; if (___v8246022 % 100 == 0) { await QB.autoLimit(); }
|
||||
var subparts = QB.initArray([{l:0,u:0}], ''); /* STRING */
|
||||
var scount = 0; /* INTEGER */
|
||||
scount = (await func_SLSplit2( QB.arrayValue(parts, [ i]).value , subparts));
|
||||
|
@ -1610,7 +1664,7 @@ var FormatArraySize = null;
|
|||
}
|
||||
var j = 0; /* INTEGER */ var toIndex = 0; /* INTEGER */
|
||||
toIndex = 0;
|
||||
var ___v8298016 = 0; for ( j= 0; j <= scount; j= j + 1) { if (QB.halted()) { return; } ___v8298016++; if (___v8298016 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v5891630 = 0; for ( j= 0; j <= scount; j= j + 1) { if (QB.halted()) { return; } ___v5891630++; if (___v5891630 % 100 == 0) { await QB.autoLimit(); }
|
||||
if ("TO" == (QB.func_UCase( QB.arrayValue(subparts, [ j]).value)) ) {
|
||||
toIndex = j;
|
||||
break;
|
||||
|
@ -1643,7 +1697,7 @@ var InitTypeValue = null;
|
|||
var typeId = 0; /* INTEGER */
|
||||
typeId = (await func_FindTypeId( vtype));
|
||||
var i = 0; /* INTEGER */
|
||||
var ___v8246022 = 0; for ( i= 1; i <= (QB.func_UBound( typeVars)); i= i + 1) { if (QB.halted()) { return; } ___v8246022++; if (___v8246022 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v9860932 = 0; for ( i= 1; i <= (QB.func_UBound( typeVars)); i= i + 1) { if (QB.halted()) { return; } ___v9860932++; if (___v9860932 % 100 == 0) { await QB.autoLimit(); }
|
||||
if ( typeId == QB.arrayValue(typeVars, [ i]).value .typeId) {
|
||||
value = value + QB.arrayValue(typeVars, [ i]).value .name + ":" + (await func_InitTypeValue( QB.arrayValue(typeVars, [ i]).value .type)) + ",";
|
||||
}
|
||||
|
@ -1659,7 +1713,7 @@ var FindTypeId = null;
|
|||
var id = 0; /* INTEGER */
|
||||
id = - 1;
|
||||
var i = 0; /* INTEGER */
|
||||
var ___v5891630 = 0; for ( i= 1; i <= (QB.func_UBound( types)); i= i + 1) { if (QB.halted()) { return; } ___v5891630++; if (___v5891630 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v9109643 = 0; for ( i= 1; i <= (QB.func_UBound( types)); i= i + 1) { if (QB.halted()) { return; } ___v9109643++; if (___v9109643 % 100 == 0) { await QB.autoLimit(); }
|
||||
if (QB.arrayValue(types, [ i]).value .name == typeName) {
|
||||
id = i;
|
||||
break;
|
||||
|
@ -1681,7 +1735,7 @@ var ConvertExpression = null;
|
|||
var stringLiteral = 0; /* INTEGER */
|
||||
var i = 0; /* INTEGER */
|
||||
i = 1;
|
||||
var ___v9860932 = 0; while ( i <= (QB.func_Len( ex))) { if (QB.halted()) { return; }___v9860932++; if (___v9860932 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v2268660 = 0; while ( i <= (QB.func_Len( ex))) { if (QB.halted()) { return; }___v2268660++; if (___v2268660 % 100 == 0) { await QB.autoLimit(); }
|
||||
c = (QB.func_Mid( ex, i, 1));
|
||||
if ( c == (QB.func_Chr( 34)) ) {
|
||||
js = js + c;
|
||||
|
@ -1745,7 +1799,7 @@ var ConvertExpression = null;
|
|||
var stringLiteral2 = 0; /* INTEGER */
|
||||
stringLiteral2 = False;
|
||||
i = i + 1;
|
||||
var ___v9109643 = 0; while (! done && i <= (QB.func_Len( ex))) { if (QB.halted()) { return; }___v9109643++; if (___v9109643 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v6951155 = 0; while (! done && i <= (QB.func_Len( ex))) { if (QB.halted()) { return; }___v6951155++; if (___v6951155 % 100 == 0) { await QB.autoLimit(); }
|
||||
c2 = (QB.func_Mid( ex, i, 1));
|
||||
if ( c2 == (QB.func_Chr( 34)) ) {
|
||||
stringLiteral2 = ! stringLiteral2;
|
||||
|
@ -1803,7 +1857,7 @@ var ConvertMethodParams = null;
|
|||
var argc = 0; /* INTEGER */
|
||||
argc = (await func_ListSplit( args, params));
|
||||
var i = 0; /* INTEGER */
|
||||
var ___v2268660 = 0; for ( i= 1; i <= argc; i= i + 1) { if (QB.halted()) { return; } ___v2268660++; if (___v2268660 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v9800032 = 0; for ( i= 1; i <= argc; i= i + 1) { if (QB.halted()) { return; } ___v9800032++; if (___v9800032 % 100 == 0) { await QB.autoLimit(); }
|
||||
if ( i > 1) {
|
||||
js = js + ",";
|
||||
}
|
||||
|
@ -1835,7 +1889,7 @@ var FindVariable = null;
|
|||
var i = 0; /* INTEGER */
|
||||
var fvarname = ''; /* STRING */
|
||||
fvarname = (QB.func__Trim( (QB.func_UCase( (await func_RemoveSuffix( varname))))));
|
||||
var ___v6951155 = 0; for ( i= 1; i <= (QB.func_UBound( localVars)); i= i + 1) { if (QB.halted()) { return; } ___v6951155++; if (___v6951155 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v2439314 = 0; for ( i= 1; i <= (QB.func_UBound( localVars)); i= i + 1) { if (QB.halted()) { return; } ___v2439314++; if (___v2439314 % 100 == 0) { await QB.autoLimit(); }
|
||||
if (QB.arrayValue(localVars, [ i]).value .isArray == isArray && (QB.func_UCase( QB.arrayValue(localVars, [ i]).value .name)) == fvarname) {
|
||||
found = True;
|
||||
bvar.type = QB.arrayValue(localVars, [ i]).value .type;
|
||||
|
@ -1849,7 +1903,7 @@ var FindVariable = null;
|
|||
}
|
||||
}
|
||||
if (! found) {
|
||||
var ___v9800032 = 0; for ( i= 1; i <= (QB.func_UBound( globalVars)); i= i + 1) { if (QB.halted()) { return; } ___v9800032++; if (___v9800032 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v5338731 = 0; for ( i= 1; i <= (QB.func_UBound( globalVars)); i= i + 1) { if (QB.halted()) { return; } ___v5338731++; if (___v5338731 % 100 == 0) { await QB.autoLimit(); }
|
||||
if (QB.arrayValue(globalVars, [ i]).value .isArray == isArray && (QB.func_UCase( QB.arrayValue(globalVars, [ i]).value .name)) == fvarname) {
|
||||
found = True;
|
||||
bvar.type = QB.arrayValue(globalVars, [ i]).value .type;
|
||||
|
@ -1872,7 +1926,7 @@ var FindMethod = null;
|
|||
var found = 0; /* INTEGER */
|
||||
found = False;
|
||||
var i = 0; /* INTEGER */
|
||||
var ___v2439314 = 0; for ( i= 1; i <= (QB.func_UBound( methods)); i= i + 1) { if (QB.halted()) { return; } ___v2439314++; if (___v2439314 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v1063697 = 0; for ( i= 1; i <= (QB.func_UBound( methods)); i= i + 1) { if (QB.halted()) { return; } ___v1063697++; if (___v1063697 % 100 == 0) { await QB.autoLimit(); }
|
||||
if (QB.arrayValue(methods, [ i]).value .uname == (QB.func__Trim( (QB.func_UCase( (await func_RemoveSuffix( mname)))))) && QB.arrayValue(methods, [ i]).value .type == t) {
|
||||
found = True;
|
||||
m.line = QB.arrayValue(methods, [ i]).value .line;
|
||||
|
@ -1888,7 +1942,7 @@ var FindMethod = null;
|
|||
}
|
||||
}
|
||||
if (! found) {
|
||||
var ___v5338731 = 0; for ( i= 1; i <= (QB.func_UBound( exportMethods)); i= i + 1) { if (QB.halted()) { return; } ___v5338731++; if (___v5338731 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v9994146 = 0; for ( i= 1; i <= (QB.func_UBound( exportMethods)); i= i + 1) { if (QB.halted()) { return; } ___v9994146++; if (___v9994146 % 100 == 0) { await QB.autoLimit(); }
|
||||
if (QB.arrayValue(exportMethods, [ i]).value .uname == (QB.func__Trim( (QB.func_UCase( (await func_RemoveSuffix( mname)))))) && QB.arrayValue(exportMethods, [ i]).value .type == t) {
|
||||
found = True;
|
||||
m.line = QB.arrayValue(exportMethods, [ i]).value .line;
|
||||
|
@ -1911,7 +1965,7 @@ async function sub_ConvertMethods() {
|
|||
if (QB.halted()) { return; };
|
||||
await sub_AddJSLine( 0, "");
|
||||
var i = 0; /* INTEGER */
|
||||
var ___v1063697 = 0; for ( i= 1; i <= (QB.func_UBound( methods)); i= i + 1) { if (QB.halted()) { return; } ___v1063697++; if (___v1063697 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v6761759 = 0; for ( i= 1; i <= (QB.func_UBound( methods)); i= i + 1) { if (QB.halted()) { return; } ___v6761759++; if (___v6761759 % 100 == 0) { await QB.autoLimit(); }
|
||||
if ((QB.arrayValue(methods, [ i]).value .line != 0) ) {
|
||||
var lastLine = 0; /* INTEGER */
|
||||
lastLine = QB.arrayValue(methods, [ i + 1]).value .line - 1;
|
||||
|
@ -1928,7 +1982,7 @@ if (QB.halted()) { return; };
|
|||
var c = 0; /* INTEGER */
|
||||
c = (await func_Split( QB.arrayValue(methods, [ i]).value .args, "," , args));
|
||||
var a = 0; /* INTEGER */
|
||||
var ___v9994146 = 0; for ( a= 1; a <= c; a= a + 1) { if (QB.halted()) { return; } ___v9994146++; if (___v9994146 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v157039 = 0; for ( a= 1; a <= c; a= a + 1) { if (QB.halted()) { return; } ___v157039++; if (___v157039 % 100 == 0) { await QB.autoLimit(); }
|
||||
var v = 0; /* INTEGER */
|
||||
var parts = QB.initArray([{l:0,u:0}], ''); /* STRING */
|
||||
v = (await func_Split( QB.arrayValue(args, [ a]).value , ":" , parts));
|
||||
|
@ -1938,7 +1992,7 @@ if (QB.halted()) { return; };
|
|||
}
|
||||
var bvar = {type:'',name:'',jsname:'',isConst:0,isArray:0,arraySize:0,typeId:0}; /* VARIABLE */
|
||||
bvar.name = (await func_RemoveSuffix( QB.arrayValue(parts, [ 1]).value));
|
||||
bvar.type = QB.arrayValue(parts, [ 2]).value;
|
||||
bvar.type = (await func_NormalizeType( QB.arrayValue(parts, [ 2]).value));
|
||||
bvar.typeId = (await func_FindTypeId( bvar.type));
|
||||
if (QB.arrayValue(parts, [ 3]).value == "true" ) {
|
||||
bvar.isArray = True;
|
||||
|
@ -1948,7 +2002,7 @@ if (QB.halted()) { return; };
|
|||
if (! bvar.isArray) {
|
||||
var typeName = ''; /* STRING */
|
||||
typeName = (QB.func_UCase( bvar.type));
|
||||
if ( typeName == "BIT" || typeName == "UNSIGNED BIT" || typeName == "BYTE" || typeName == "UNSIGNED BYTE" || typeName == "INTEGER" || typeName == "UNSIGNED INTEGER" || typeName == "LONG" || typeName == "UNSIGNED LONG" || typeName == "_INTEGER64" || typeName == "UNSIGNED _INTEGER64" ) {
|
||||
if ( typeName == "_BIT" || typeName == "_UNSIGNED _BIT" || typeName == "_BYTE" || typeName == "_UNSIGNED _BYTE" || typeName == "INTEGER" || typeName == "_UNSIGNED INTEGER" || typeName == "LONG" || typeName == "_UNSIGNED LONG" || typeName == "_INTEGER64" || typeName == "_UNSIGNED _INTEGER64" ) {
|
||||
var varIsArray = 0; /* INTEGER */
|
||||
if ((await func_FindVariable( bvar.name, bvar, varIsArray)) ) {
|
||||
intConv = intConv + bvar.jsname + " = Math.round(" + bvar.jsname + "); ";
|
||||
|
@ -1971,7 +2025,7 @@ if (QB.halted()) { return; };
|
|||
await sub_AddJSLine( lastLine, "}");
|
||||
}
|
||||
}
|
||||
var ___v6761759 = 0; for ( i= 1; i <= (QB.func_UBound( exportLines)); i= i + 1) { if (QB.halted()) { return; } ___v6761759++; if (___v6761759 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v5751838 = 0; for ( i= 1; i <= (QB.func_UBound( exportLines)); i= i + 1) { if (QB.halted()) { return; } ___v5751838++; if (___v5751838 % 100 == 0) { await QB.autoLimit(); }
|
||||
await sub_AddJSLine( i, QB.arrayValue(exportLines, [ i]).value);
|
||||
}
|
||||
QB.resizeArray(exportLines, [{l:0,u:0}], '', false); /* STRING */
|
||||
|
@ -1982,13 +2036,13 @@ if (QB.halted()) { return; };
|
|||
var lineIndex = 0; /* INTEGER */
|
||||
var rawJS = 0; /* SINGLE */
|
||||
QB.sub_Open(filename, QB.INPUT, 1);
|
||||
var ___v157039 = 0; while (!((QB.func_EOF( 1)))) { if (QB.halted()) { return; }___v157039++; if (___v157039 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v5751838 = new Array(1); await QB.sub_LineInputFromFile(1, ___v5751838); fline = ___v5751838[0];
|
||||
var ___v1000522 = 0; while (!((QB.func_EOF( 1)))) { if (QB.halted()) { return; }___v1000522++; if (___v1000522 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v1030226 = new Array(1); await QB.sub_LineInputFromFile(1, ___v1030226); fline = ___v1030226[0];
|
||||
lineIndex = lineIndex + 1;
|
||||
if ((QB.func__Trim( fline)) != "" ) {
|
||||
var ___v1000522 = 0; while ((await func_EndsWith( fline, " _"))) { if (QB.halted()) { return; }___v1000522++; if (___v1000522 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v7988844 = 0; while ((await func_EndsWith( fline, " _"))) { if (QB.halted()) { return; }___v7988844++; if (___v7988844 % 100 == 0) { await QB.autoLimit(); }
|
||||
var nextLine = ''; /* STRING */
|
||||
var ___v1030226 = new Array(1); await QB.sub_LineInputFromFile(1, ___v1030226); nextLine = ___v1030226[0];
|
||||
var ___v2844803 = new Array(1); await QB.sub_LineInputFromFile(1, ___v2844803); nextLine = ___v2844803[0];
|
||||
fline = (QB.func_Left( fline, (QB.func_Len( fline)) - 1)) + nextLine;
|
||||
}
|
||||
rawJS = (await func_ReadLine( lineIndex, fline, rawJS));
|
||||
|
@ -2003,7 +2057,7 @@ if (QB.halted()) { return; };
|
|||
var lcount = 0; /* INTEGER */
|
||||
var i = 0; /* INTEGER */
|
||||
lcount = (await func_Split( sourceText, await func_LF(), sourceLines));
|
||||
var ___v7988844 = 0; for ( i= 1; i <= lcount; i= i + 1) { if (QB.halted()) { return; } ___v7988844++; if (___v7988844 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v456492 = 0; for ( i= 1; i <= lcount; i= i + 1) { if (QB.halted()) { return; } ___v456492++; if (___v456492 % 100 == 0) { await QB.autoLimit(); }
|
||||
var fline = ''; /* STRING */
|
||||
fline = QB.arrayValue(sourceLines, [ i]).value;
|
||||
if ((QB.func__Trim( fline)) != "" ) {
|
||||
|
@ -2027,7 +2081,7 @@ if (QB.halted()) { return; };
|
|||
continue;
|
||||
}
|
||||
}
|
||||
var ___v2844803 = 0; while ((await func_EndsWith( fline, "_"))) { if (QB.halted()) { return; }___v2844803++; if (___v2844803 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v2957728 = 0; while ((await func_EndsWith( fline, "_"))) { if (QB.halted()) { return; }___v2957728++; if (___v2957728 % 100 == 0) { await QB.autoLimit(); }
|
||||
i = i + 1;
|
||||
var nextLine = ''; /* STRING */
|
||||
nextLine = QB.arrayValue(sourceLines, [ i]).value;
|
||||
|
@ -2043,7 +2097,7 @@ var ReadLine = null;
|
|||
var quoteDepth = 0; /* INTEGER */
|
||||
quoteDepth = 0;
|
||||
var i = 0; /* INTEGER */
|
||||
var ___v456492 = 0; for ( i= 1; i <= (QB.func_Len( fline)); i= i + 1) { if (QB.halted()) { return; } ___v456492++; if (___v456492 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v3820107 = 0; for ( i= 1; i <= (QB.func_Len( fline)); i= i + 1) { if (QB.halted()) { return; } ___v3820107++; if (___v3820107 % 100 == 0) { await QB.autoLimit(); }
|
||||
var c = ''; /* STRING */ var c4 = ''; /* STRING */
|
||||
c = (QB.func_Mid( fline, i, 1));
|
||||
c4 = (QB.func_UCase( (QB.func_Mid( fline, i, 4))));
|
||||
|
@ -2103,7 +2157,7 @@ var ReadLine = null;
|
|||
var dcount = 0; /* INTEGER */
|
||||
var de = QB.initArray([{l:0,u:0}], ''); /* STRING */
|
||||
dcount = (await func_ListSplit( dstr, de));
|
||||
var ___v2957728 = 0; for ( i= 1; i <= dcount; i= i + 1) { if (QB.halted()) { return; } ___v2957728++; if (___v2957728 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v3009705 = 0; for ( i= 1; i <= dcount; i= i + 1) { if (QB.halted()) { return; } ___v3009705++; if (___v3009705 % 100 == 0) { await QB.autoLimit(); }
|
||||
index = (QB.func_UBound( dataArray)) + 1;
|
||||
QB.resizeArray(dataArray, [{l:0,u:index}], '', true); /* STRING */
|
||||
QB.arrayValue(dataArray, [ index]).value = QB.arrayValue(de, [ i]).value;
|
||||
|
@ -2111,7 +2165,7 @@ var ReadLine = null;
|
|||
return ReadLine;
|
||||
}
|
||||
var ifIdx = 0; /* INTEGER */ var thenIdx = 0; /* INTEGER */ var elseIdx = 0; /* INTEGER */
|
||||
var ___v3820107 = 0; for ( i= 1; i <= wcount; i= i + 1) { if (QB.halted()) { return; } ___v3820107++; if (___v3820107 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v9485711 = 0; for ( i= 1; i <= wcount; i= i + 1) { if (QB.halted()) { return; } ___v9485711++; if (___v9485711 % 100 == 0) { await QB.autoLimit(); }
|
||||
word = (QB.func_UCase( QB.arrayValue(words, [ i]).value));
|
||||
if ( word == "IF" ) {
|
||||
ifIdx = i;
|
||||
|
@ -2146,7 +2200,7 @@ if (QB.halted()) { return; };
|
|||
var quoteDepth = 0; /* INTEGER */
|
||||
quoteDepth = 0;
|
||||
var i = 0; /* INTEGER */
|
||||
var ___v3009705 = 0; for ( i= 1; i <= (QB.func_Len( fline)); i= i + 1) { if (QB.halted()) { return; } ___v3009705++; if (___v3009705 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v9798294 = 0; for ( i= 1; i <= (QB.func_Len( fline)); i= i + 1) { if (QB.halted()) { return; } ___v9798294++; if (___v9798294 % 100 == 0) { await QB.autoLimit(); }
|
||||
var c = ''; /* STRING */
|
||||
c = (QB.func_Mid( fline, i, 1));
|
||||
if ( c == (QB.func_Chr( 34)) ) {
|
||||
|
@ -2170,7 +2224,7 @@ if (QB.halted()) { return; };
|
|||
var pcount = 0; /* INTEGER */
|
||||
var rawJS = 0; /* INTEGER */
|
||||
var parts = QB.initArray([{l:0,u:0}], ''); /* STRING */
|
||||
var ___v9485711 = 0; for ( i= 1; i <= (QB.func_UBound( lines)); i= i + 1) { if (QB.halted()) { return; } ___v9485711++; if (___v9485711 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v4013744 = 0; for ( i= 1; i <= (QB.func_UBound( lines)); i= i + 1) { if (QB.halted()) { return; } ___v4013744++; if (___v4013744 % 100 == 0) { await QB.autoLimit(); }
|
||||
pcount = (await func_Split( QB.arrayValue(lines, [ i]).value .text, " " , parts));
|
||||
var word = ''; /* STRING */
|
||||
word = (QB.func_UCase( QB.arrayValue(parts, [ 1]).value));
|
||||
|
@ -2214,7 +2268,7 @@ if (QB.halted()) { return; };
|
|||
var a = 0; /* INTEGER */
|
||||
var args = ''; /* STRING */
|
||||
args = "";
|
||||
var ___v9798294 = 0; for ( a= 1; a <= m.argc; a= a + 1) { if (QB.halted()) { return; } ___v9798294++; if (___v9798294 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v2782800 = 0; for ( a= 1; a <= m.argc; a= a + 1) { if (QB.halted()) { return; } ___v2782800++; if (___v2782800 % 100 == 0) { await QB.autoLimit(); }
|
||||
var aparts = QB.initArray([{l:0,u:0}], ''); /* STRING */
|
||||
var apcount = 0; /* INTEGER */
|
||||
var argname = ''; /* STRING */
|
||||
|
@ -2250,7 +2304,7 @@ var Split = null;
|
|||
if ( delimiter == " " ) {
|
||||
cstr = (QB.func_RTrim( (QB.func_LTrim( cstr))));
|
||||
p = (QB.func_InStr( cstr, " "));
|
||||
var ___v4013744 = 0; while ( p > 0) { if (QB.halted()) { return; }___v4013744++; if (___v4013744 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v1604415 = 0; while ( p > 0) { if (QB.halted()) { return; }___v1604415++; if (___v1604415 % 100 == 0) { await QB.autoLimit(); }
|
||||
cstr = (QB.func_Mid( cstr, 1, p - 1)) + (QB.func_Mid( cstr, p + 1));
|
||||
p = (QB.func_InStr( cstr, " "));
|
||||
}
|
||||
|
@ -2258,7 +2312,7 @@ var Split = null;
|
|||
curpos = 1;
|
||||
arrpos = 0;
|
||||
dpos = (QB.func_InStr( curpos, cstr, delimiter));
|
||||
var ___v2782800 = 0; while (!( dpos == 0)) { if (QB.halted()) { return; }___v2782800++; if (___v2782800 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v1628216 = 0; while (!( dpos == 0)) { if (QB.halted()) { return; }___v1628216++; if (___v1628216 % 100 == 0) { await QB.autoLimit(); }
|
||||
arrpos = arrpos + 1;
|
||||
QB.resizeArray(results, [{l:0,u:arrpos}], '', true); /* STRING */
|
||||
QB.arrayValue(results, [ arrpos]).value = (QB.func_Mid( cstr, curpos, dpos - curpos));
|
||||
|
@ -2283,7 +2337,7 @@ var SLSplit = null;
|
|||
var result = ''; /* STRING */
|
||||
var count = 0; /* INTEGER */
|
||||
var i = 0; /* INTEGER */
|
||||
var ___v1604415 = 0; for ( i= 1; i <= (QB.func_Len( cstr)); i= i + 1) { if (QB.halted()) { return; } ___v1604415++; if (___v1604415 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v6465872 = 0; for ( i= 1; i <= (QB.func_Len( cstr)); i= i + 1) { if (QB.halted()) { return; } ___v6465872++; if (___v6465872 % 100 == 0) { await QB.autoLimit(); }
|
||||
var c = ''; /* STRING */ var c2 = ''; /* STRING */
|
||||
c = (QB.func_Mid( cstr, i, 1));
|
||||
c2 = (QB.func_Mid( cstr, i, 2));
|
||||
|
@ -2385,7 +2439,7 @@ var SLSplit2 = null;
|
|||
var paren = 0; /* INTEGER */
|
||||
var count = 0; /* INTEGER */
|
||||
var i = 0; /* INTEGER */
|
||||
var ___v1628216 = 0; for ( i= 1; i <= (QB.func_Len( cstr)); i= i + 1) { if (QB.halted()) { return; } ___v1628216++; if (___v1628216 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v4100732 = 0; for ( i= 1; i <= (QB.func_Len( cstr)); i= i + 1) { if (QB.halted()) { return; } ___v4100732++; if (___v4100732 % 100 == 0) { await QB.autoLimit(); }
|
||||
var c = ''; /* STRING */
|
||||
c = (QB.func_Mid( cstr, i, 1));
|
||||
if ( c == (QB.func_Chr( 34)) ) {
|
||||
|
@ -2434,7 +2488,7 @@ var ListSplit = null;
|
|||
var count = 0; /* INTEGER */
|
||||
var paren = 0; /* INTEGER */
|
||||
var i = 0; /* INTEGER */
|
||||
var ___v6465872 = 0; for ( i= 1; i <= (QB.func_Len( cstr)); i= i + 1) { if (QB.halted()) { return; } ___v6465872++; if (___v6465872 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v4127668 = 0; for ( i= 1; i <= (QB.func_Len( cstr)); i= i + 1) { if (QB.halted()) { return; } ___v4127668++; if (___v4127668 % 100 == 0) { await QB.autoLimit(); }
|
||||
var c = ''; /* STRING */
|
||||
c = (QB.func_Mid( cstr, i, 1));
|
||||
if ( c == (QB.func_Chr( 34)) ) {
|
||||
|
@ -2479,7 +2533,7 @@ var PrintSplit = null;
|
|||
var count = 0; /* INTEGER */
|
||||
var paren = 0; /* INTEGER */
|
||||
var i = 0; /* INTEGER */
|
||||
var ___v4100732 = 0; for ( i= 1; i <= (QB.func_Len( cstr)); i= i + 1) { if (QB.halted()) { return; } ___v4100732++; if (___v4100732 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v7127304 = 0; for ( i= 1; i <= (QB.func_Len( cstr)); i= i + 1) { if (QB.halted()) { return; } ___v7127304++; if (___v7127304 % 100 == 0) { await QB.autoLimit(); }
|
||||
var c = ''; /* STRING */
|
||||
c = (QB.func_Mid( cstr, i, 1));
|
||||
if ( c == (QB.func_Chr( 34)) ) {
|
||||
|
@ -2523,7 +2577,7 @@ if (QB.halted()) { return; };
|
|||
await QB.sub_Print(["Methods"]);
|
||||
await QB.sub_Print(["------------------------------------------------------------"]);
|
||||
var i = 0; /* INTEGER */
|
||||
var ___v4127668 = 0; for ( i= 1; i <= (QB.func_UBound( methods)); i= i + 1) { if (QB.halted()) { return; } ___v4127668++; if (___v4127668 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v3262062 = 0; for ( i= 1; i <= (QB.func_UBound( methods)); i= i + 1) { if (QB.halted()) { return; } ___v3262062++; if (___v3262062 % 100 == 0) { await QB.autoLimit(); }
|
||||
var m = {line:0,type:'',returnType:'',name:'',uname:'',argc:0,args:'',jsname:'',sync:0}; /* METHOD */
|
||||
m = QB.arrayValue(methods, [ i]).value;
|
||||
await QB.sub_Print([(QB.func_Str( m.line)) + ": " + m.type + " - " + m.name + " [" + m.jsname + "] - " + m.returnType + " - " + m.args]);
|
||||
|
@ -2535,24 +2589,29 @@ if (QB.halted()) { return; };
|
|||
await QB.sub_Print(["Types"]);
|
||||
await QB.sub_Print(["------------------------------------------------------------"]);
|
||||
var i = 0; /* INTEGER */
|
||||
var ___v7127304 = 0; for ( i= 1; i <= (QB.func_UBound( types)); i= i + 1) { if (QB.halted()) { return; } ___v7127304++; if (___v7127304 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v6331789 = 0; for ( i= 1; i <= (QB.func_UBound( types)); i= i + 1) { if (QB.halted()) { return; } ___v6331789++; if (___v6331789 % 100 == 0) { await QB.autoLimit(); }
|
||||
var t = {line:0,name:'',argc:0,args:''}; /* QBTYPE */
|
||||
t = QB.arrayValue(types, [ i]).value;
|
||||
await QB.sub_Print([(QB.func_Str( t.line)) + ": " + t.name]);
|
||||
var v = 0; /* INTEGER */
|
||||
var ___v3262062 = 0; for ( v= 1; v <= (QB.func_UBound( typeVars)); v= v + 1) { if (QB.halted()) { return; } ___v3262062++; if (___v3262062 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v2075611 = 0; for ( v= 1; v <= (QB.func_UBound( typeVars)); v= v + 1) { if (QB.halted()) { return; } ___v2075611++; if (___v2075611 % 100 == 0) { await QB.autoLimit(); }
|
||||
if (QB.arrayValue(typeVars, [ i]).value .typeId == i) {
|
||||
await QB.sub_Print([" -> " + QB.arrayValue(typeVars, [ v]).value .name + ": " + QB.arrayValue(typeVars, [ v]).value .type]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
async function func_CopyMethod(fromMethod/*METHOD*/,toMethod/*METHOD*/) {
|
||||
async function sub_CopyMethod(fromMethod/*METHOD*/,toMethod/*METHOD*/) {
|
||||
if (QB.halted()) { return; };
|
||||
var CopyMethod = null;
|
||||
toMethod.type = fromMethod.type;
|
||||
toMethod.name = fromMethod.name;
|
||||
return CopyMethod;
|
||||
toMethod.returnType = fromMethod.returnType;
|
||||
toMethod.name = fromMethod.name;
|
||||
toMethod.uname = fromMethod.uname;
|
||||
toMethod.argc = fromMethod.argc;
|
||||
toMethod.args = fromMethod.args;
|
||||
toMethod.jsname = fromMethod.jsname;
|
||||
toMethod.sync = fromMethod.sync;
|
||||
}
|
||||
async function sub_AddMethod(m/*METHOD*/,prefix/*STRING*/,sync/*INTEGER*/) {
|
||||
if (QB.halted()) { return; };
|
||||
|
@ -2612,6 +2671,16 @@ if (QB.halted()) { return; };
|
|||
m.type = mtype;
|
||||
m.name = mname;
|
||||
await sub_AddMethod( m, "QB." , sync);
|
||||
if ((QB.func_InStr( mname, "_")) == 1) {
|
||||
var m2 = {line:0,type:'',returnType:'',name:'',uname:'',argc:0,args:'',jsname:'',sync:0}; /* METHOD */
|
||||
await sub_CopyMethod( QB.arrayValue(methods, [(QB.func_UBound( methods))]).value , m2);
|
||||
m2.name = (QB.func_Mid( mname, 2));
|
||||
m2.uname = (QB.func_UCase( (await func_RemoveSuffix( m2.name))));
|
||||
var mcount = 0; /* SINGLE */
|
||||
mcount = (QB.func_UBound( methods)) + 1;
|
||||
QB.resizeArray(methods, [{l:0,u:mcount}], {line:0,type:'',returnType:'',name:'',uname:'',argc:0,args:'',jsname:'',sync:0}, true); /* METHOD */
|
||||
QB.arrayValue(methods, [ mcount]).value = m2;
|
||||
}
|
||||
}
|
||||
async function sub_AddNativeMethod(mtype/*STRING*/,mname/*STRING*/,jsname/*STRING*/,sync/*INTEGER*/) {
|
||||
if (QB.halted()) { return; };
|
||||
|
@ -2719,7 +2788,7 @@ if (QB.halted()) { return; };
|
|||
vcount = (QB.func_UBound( vlist)) + 1;
|
||||
QB.resizeArray(vlist, [{l:0,u:vcount}], {type:'',name:'',jsname:'',isConst:0,isArray:0,arraySize:0,typeId:0}, true); /* VARIABLE */
|
||||
var nvar = {type:'',name:'',jsname:'',isConst:0,isArray:0,arraySize:0,typeId:0}; /* VARIABLE */
|
||||
nvar.type = bvar.type;
|
||||
nvar.type = (await func_NormalizeType( bvar.type));
|
||||
nvar.name = bvar.name;
|
||||
nvar.jsname = bvar.jsname;
|
||||
nvar.isConst = bvar.isConst;
|
||||
|
@ -2731,6 +2800,34 @@ if (QB.halted()) { return; };
|
|||
}
|
||||
QB.arrayValue(vlist, [ vcount]).value = nvar;
|
||||
}
|
||||
async function func_NormalizeType(itype/*STRING*/) {
|
||||
if (QB.halted()) { return; };
|
||||
var NormalizeType = null;
|
||||
var otype = ''; /* STRING */
|
||||
if ( itype == "BIT" ) {
|
||||
otype = "_BIT";
|
||||
} else if ( itype == "_UNSIGNED BIT" ) {
|
||||
otype = "_UNSIGNED _BIT";
|
||||
} else if ( itype == "BYTE" ) {
|
||||
otype = "_BYTE";
|
||||
} else if ( itype == "_UNSIGNED BYTE" ) {
|
||||
otype = "_UNSIGNED _BYTE";
|
||||
} else if ( itype == "INTEGER64" ) {
|
||||
otype = "_INTEGER64";
|
||||
} else if ( itype == "_UNSIGNED INTEGER64" ) {
|
||||
otype = "_UNSIGNED _INTEGER64";
|
||||
} else if ( itype == "FLOAT" ) {
|
||||
otype = "_FLOAT";
|
||||
} else if ( itype == "OFFSET" ) {
|
||||
otype = "_OFFSET";
|
||||
} else if ( itype == "_UNSIGNED OFFSET" ) {
|
||||
otype = "_UNSIGNED _OFFSET";
|
||||
} else {
|
||||
otype = itype;
|
||||
}
|
||||
NormalizeType = otype;
|
||||
return NormalizeType;
|
||||
}
|
||||
async function sub_AddType(t/*QBTYPE*/) {
|
||||
if (QB.halted()) { return; };
|
||||
var tcount = 0; /* SINGLE */
|
||||
|
@ -2749,7 +2846,7 @@ if (QB.halted()) { return; };
|
|||
var pairs = QB.initArray([{l:0,u:0}], ''); /* STRING */
|
||||
count = (await func_Split( args, "," , pairs));
|
||||
var i = 0; /* INTEGER */
|
||||
var ___v6331789 = 0; for ( i= 1; i <= (QB.func_UBound( pairs)); i= i + 1) { if (QB.halted()) { return; } ___v6331789++; if (___v6331789 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v1860135 = 0; for ( i= 1; i <= (QB.func_UBound( pairs)); i= i + 1) { if (QB.halted()) { return; } ___v1860135++; if (___v1860135 % 100 == 0) { await QB.autoLimit(); }
|
||||
var nv = QB.initArray([{l:0,u:0}], ''); /* STRING */
|
||||
count = (await func_Split( QB.arrayValue(pairs, [ i]).value , ":" , nv));
|
||||
var tvar = {type:'',name:'',jsname:'',isConst:0,isArray:0,arraySize:0,typeId:0}; /* VARIABLE */
|
||||
|
@ -2777,7 +2874,7 @@ var RemoveSuffix = null;
|
|||
var c = ''; /* STRING */
|
||||
vname = (QB.func__Trim( vname));
|
||||
i = (QB.func_Len( vname));
|
||||
var ___v2075611 = 0; while (! done) { if (QB.halted()) { return; }___v2075611++; if (___v2075611 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v5833590 = 0; while (! done) { if (QB.halted()) { return; }___v5833590++; if (___v5833590 % 100 == 0) { await QB.autoLimit(); }
|
||||
c = (QB.func_Mid( vname, i, 1));
|
||||
if ( c == "`" || c == "%" || c == "&" || c == "$" || c == "~" || c == "!" || c == "#" ) {
|
||||
i = i - 1;
|
||||
|
@ -2862,7 +2959,7 @@ var Join = null;
|
|||
}
|
||||
var s = ''; /* STRING */
|
||||
var i = 0; /* INTEGER */
|
||||
var ___v1860135 = 0; for ( i= startIndex; i <= endIndex; i= i + 1) { if (QB.halted()) { return; } ___v1860135++; if (___v1860135 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v807146 = 0; for ( i= startIndex; i <= endIndex; i= i + 1) { if (QB.halted()) { return; } ___v807146++; if (___v807146 % 100 == 0) { await QB.autoLimit(); }
|
||||
s = s + QB.arrayValue(parts, [ i]).value;
|
||||
if ( i != (QB.func_UBound( parts)) ) {
|
||||
s = s + delimiter;
|
||||
|
@ -2886,7 +2983,7 @@ var Replace = null;
|
|||
var i = 0; /* INTEGER */
|
||||
var slen = 0; /* INTEGER */
|
||||
slen = (QB.func_Len( searchString));
|
||||
var ___v5833590 = 0; for ( i= 1; i <= (QB.func_Len( s)); i= i + 1) { if (QB.halted()) { return; } ___v5833590++; if (___v5833590 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v4579714 = 0; for ( i= 1; i <= (QB.func_Len( s)); i= i + 1) { if (QB.halted()) { return; } ___v4579714++; if (___v4579714 % 100 == 0) { await QB.autoLimit(); }
|
||||
if ((QB.func_Mid( s, i, slen)) == searchString) {
|
||||
ns = ns + newString;
|
||||
i = i + slen - 1;
|
||||
|
@ -2928,7 +3025,7 @@ var MethodJS = null;
|
|||
var i = 0; /* INTEGER */
|
||||
var c = ''; /* STRING */
|
||||
var a = 0; /* INTEGER */
|
||||
var ___v807146 = 0; for ( i= 1; i <= (QB.func_Len( m.name)); i= i + 1) { if (QB.halted()) { return; } ___v807146++; if (___v807146 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v9057298 = 0; for ( i= 1; i <= (QB.func_Len( m.name)); i= i + 1) { if (QB.halted()) { return; } ___v9057298++; if (___v9057298 % 100 == 0) { await QB.autoLimit(); }
|
||||
c = (QB.func_Mid( m.name, i, 1));
|
||||
a = (QB.func_Asc( c));
|
||||
if ( a == 46) {
|
||||
|
@ -2956,7 +3053,7 @@ var GXMethodJS = null;
|
|||
var i = 0; /* INTEGER */
|
||||
var c = ''; /* STRING */
|
||||
var a = 0; /* INTEGER */
|
||||
var ___v4579714 = 0; for ( i= startIdx + 1; i <= (QB.func_Len( mname)); i= i + 1) { if (QB.halted()) { return; } ___v4579714++; if (___v4579714 % 100 == 0) { await QB.autoLimit(); }
|
||||
var ___v2613683 = 0; for ( i= startIdx + 1; i <= (QB.func_Len( mname)); i= i + 1) { if (QB.halted()) { return; } ___v2613683++; if (___v2613683 % 100 == 0) { await QB.autoLimit(); }
|
||||
c = (QB.func_Mid( mname, i, 1));
|
||||
a = (QB.func_Asc( c));
|
||||
if (( a >= 65 && a <= 90) || ( a >= 97 && a <= 122) || ( a >= 48 && a <= 57) || a == 95 || a == 46) {
|
||||
|
@ -3279,6 +3376,9 @@ if (QB.halted()) { return; };
|
|||
await sub_AddQBMethod( "FUNCTION" , "_Alpha32" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Acos" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Acosh" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Arccot" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Arccsc" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Arcsec" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Atanh" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Asin" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Asinh" , False);
|
||||
|
@ -3288,16 +3388,20 @@ if (QB.halted()) { return; };
|
|||
await sub_AddQBMethod( "FUNCTION" , "_BackgroundColor" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Blue" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Blue32" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_CapsLock" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Ceil" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_CommandCount" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_CopyImage" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Cosh" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Cot" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Coth" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Csc" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Csch" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_CWD$" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_D2G" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_D2R" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_DefaultColor" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Deflate" , False);
|
||||
await sub_AddQBMethod( "SUB" , "_Delay" , True);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_DesktopHeight" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_DesktopWidth" , False);
|
||||
|
@ -3322,6 +3426,7 @@ if (QB.halted()) { return; };
|
|||
await sub_AddQBMethod( "FUNCTION" , "_Green32" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Height" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Hypot" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Inflate" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_InStrRev" , False);
|
||||
await sub_AddQBMethod( "SUB" , "_Limit" , True);
|
||||
await sub_AddQBMethod( "SUB" , "_KeyClear" , False);
|
||||
|
@ -3337,6 +3442,7 @@ if (QB.halted()) { return; };
|
|||
await sub_AddQBMethod( "FUNCTION" , "_MouseX" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_MouseY" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_NewImage" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_NumLock" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_OS$" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Pi" , False);
|
||||
await sub_AddQBMethod( "SUB" , "_PaletteColor" , False);
|
||||
|
@ -3363,6 +3469,8 @@ if (QB.halted()) { return; };
|
|||
await sub_AddQBMethod( "SUB" , "_ScreenMove" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_ScreenX" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_ScreenY" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_ScrollLock" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Sec" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Sech" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Setbit" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "_Shl" , False);
|
||||
|
@ -3426,9 +3534,10 @@ if (QB.halted()) { return; };
|
|||
await sub_AddQBMethod( "FUNCTION" , "Left$" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "LCase$" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "Len" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "LOF" , False);
|
||||
await sub_AddQBMethod( "SUB" , "Line" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "Loc" , False);
|
||||
await sub_AddQBMethod( "SUB" , "Locate" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "LOF" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "Log" , False);
|
||||
await sub_AddQBMethod( "FUNCTION" , "LTrim$" , False);
|
||||
await sub_AddQBMethod( "SUB" , "Kill" , False);
|
||||
|
|
14
qbjs-ide.css
14
qbjs-ide.css
|
@ -1,6 +1,6 @@
|
|||
@font-face {
|
||||
font-family: dosvga;
|
||||
src: url(dosvga.ttf);
|
||||
src: url(qbjs.woff2);
|
||||
}
|
||||
body {
|
||||
background-color: rgb(0, 0, 39);
|
||||
|
@ -47,7 +47,6 @@ a:after { content: " >"; }
|
|||
#gx-canvas {
|
||||
border: 1px solid #222;
|
||||
background-color: #000;
|
||||
letter-spacing: -1px;
|
||||
font-family: dosvga;
|
||||
}
|
||||
#output-container {
|
||||
|
@ -187,12 +186,12 @@ dialog textarea,
|
|||
#prog-sel-dialog select {
|
||||
font-family: dosvga;
|
||||
font-size: 1em;
|
||||
letter-spacing: -1px;
|
||||
background-color: #efefef;
|
||||
padding: 5px;
|
||||
}
|
||||
dialog a { color: #333 !important; }
|
||||
dialog a:hover { color: #000 !important; }
|
||||
dialog a.disabled, dialog a.disabled:hover { color: #999 !important; }
|
||||
|
||||
#logo {
|
||||
position: absolute;
|
||||
|
@ -213,7 +212,7 @@ dialog a:hover { color: #000 !important; }
|
|||
padding: 5px;
|
||||
border: 1px solid #333;
|
||||
}
|
||||
#fs-refresh, #fs-new-folder {
|
||||
#fs-refresh, #fs-new-folder, #fs-upload {
|
||||
float: right;
|
||||
margin-top: -3px;
|
||||
cursor: pointer;
|
||||
|
@ -236,6 +235,13 @@ dialog a:hover { color: #000 !important; }
|
|||
#fs-new-folder:hover {
|
||||
background-image: url('img/new-folder-hover.svg');
|
||||
}
|
||||
#fs-upload {
|
||||
margin-right: 8px;
|
||||
background-image: url('img/upload.svg');
|
||||
}
|
||||
#fs-upload:hover {
|
||||
background-image: url('img/upload-hover.svg');
|
||||
}
|
||||
|
||||
.fs-file, .fs-dir, .fs-delete {
|
||||
display: block;
|
||||
|
|
1950
qbjs-ide.js
1950
qbjs-ide.js
File diff suppressed because it is too large
Load diff
BIN
qbjs.woff2
Normal file
BIN
qbjs.woff2
Normal file
Binary file not shown.
178
tools/qb2js.bas
178
tools/qb2js.bas
|
@ -341,12 +341,7 @@ Sub ConvertLines (firstLine As Integer, lastLine As Integer, functionName As Str
|
|||
typeMode = False
|
||||
End If
|
||||
Else
|
||||
Dim tvar As Variable
|
||||
tvar.typeId = currType
|
||||
tvar.name = parts(1)
|
||||
tvar.type = UCase$(parts(3))
|
||||
If tvar.type = "_UNSIGNED" Then tvar.type = tvar.type + " " + UCase$(parts(4))
|
||||
AddVariable tvar, typeVars()
|
||||
DeclareTypeVar parts(), currType, i
|
||||
End If
|
||||
Else
|
||||
If first = "CONST" Then
|
||||
|
@ -547,7 +542,7 @@ Sub ConvertLines (firstLine As Integer, lastLine As Integer, functionName As Str
|
|||
loopLevel = loopLevel - 1
|
||||
indent = -1
|
||||
|
||||
ElseIf first = "_CONTINUE" Then
|
||||
ElseIf first = "_CONTINUE" Or first = "CONTINUE" Then
|
||||
js = "continue;"
|
||||
|
||||
ElseIf UCase$(l) = "EXIT FUNCTION" Then
|
||||
|
@ -852,13 +847,13 @@ Function ConvertSub$ (m As Method, args As String, lineNumber As Integer)
|
|||
ElseIf m.name = "Write" Then
|
||||
js = ConvertWrite(m, args, lineNumber)
|
||||
|
||||
ElseIf m.name = "_PrintString" Then
|
||||
ElseIf m.name = "_PrintString" Or m.name = "PrintString" Then
|
||||
js = CallMethod(m) + "(" + ConvertPrintString(args, lineNumber) + ");"
|
||||
|
||||
ElseIf m.name = "_PutImage" Then
|
||||
ElseIf m.name = "_PutImage" Or m.name = "PutImage" Then
|
||||
js = CallMethod(m) + "(" + ConvertPutImage(args, lineNumber) + ");"
|
||||
|
||||
ElseIf m.name = "_FullScreen" Then
|
||||
ElseIf m.name = "_FullScreen" Or m.name = "FullScreen" Then
|
||||
js = CallMethod(m) + "(" + ConvertFullScreen(args) + ");"
|
||||
|
||||
Else
|
||||
|
@ -918,16 +913,16 @@ Function ConvertFullScreen$ (args As String)
|
|||
If argc > 0 Then
|
||||
Dim arg As String
|
||||
arg = UCase$(parts(1))
|
||||
If arg = "_OFF" Then
|
||||
If arg = "_OFF" Or arg = "OFF" Then
|
||||
mode = "QB.OFF"
|
||||
ElseIf arg = "_STRETCH" Then
|
||||
ElseIf arg = "_STRETCH" Or arg = "STRETCH" Then
|
||||
mode = "QB.STRETCH"
|
||||
ElseIf arg = "_SQUAREPIXELS" Then
|
||||
ElseIf arg = "_SQUAREPIXELS" Or arg = "SQUAREPIXELS" Then
|
||||
mode = "QB.SQUAREPIXELS"
|
||||
End If
|
||||
End If
|
||||
If argc > 1 Then
|
||||
If UCase$(parts(2)) = "_SMOOTH" Then doSmooth = "true"
|
||||
If UCase$(parts(2)) = "_SMOOTH" Or UCase$(parts(2)) = "SMOOTH" Then doSmooth = "true"
|
||||
End If
|
||||
|
||||
ConvertFullScreen = mode + ", " + doSmooth
|
||||
|
@ -988,7 +983,7 @@ Function ConvertPutImage$ (args As String, lineNumber As Integer)
|
|||
destImage = "undefined"
|
||||
|
||||
doSmooth = "false"
|
||||
If EndsWith(_Trim$(UCase$(args)), "_SMOOTH") Then
|
||||
If EndsWith(_Trim$(UCase$(args)), "_SMOOTH") Or EndsWith(_Trim$(UCase$(args)), "SMOOTH") Then
|
||||
doSmooth = "true"
|
||||
args = Left$(_Trim$(args), Len(_Trim$(args)) - 7)
|
||||
End If
|
||||
|
@ -1001,7 +996,7 @@ Function ConvertPutImage$ (args As String, lineNumber As Integer)
|
|||
End If
|
||||
If argc >= 4 Then destCoord = ConvertCoordParam(parts(4), True, lineNumber)
|
||||
If argc >= 5 Then
|
||||
If _Trim$(UCase$(parts(5))) = "_SMOOTH" Then doSmooth = "true"
|
||||
If _Trim$(UCase$(parts(5))) = "_SMOOTH" Or _Trim$(UCase$(parts(5))) = "SMOOTH" Then doSmooth = "true"
|
||||
End If
|
||||
|
||||
ConvertPutImage = startCoord + ", " + sourceImage + ", " + destImage + ", " + destCoord + ", " + doSmooth
|
||||
|
@ -1560,6 +1555,69 @@ Function FindParamChar (s As String, char As String)
|
|||
FindParamChar = idx
|
||||
End Function
|
||||
|
||||
Sub DeclareTypeVar (parts() As String, typeId As Integer, lineNumber As Integer)
|
||||
|
||||
Dim vname As String
|
||||
Dim vtype As String: vtype = ""
|
||||
Dim vtypeIndex As Integer: vtypeIndex = 4
|
||||
Dim isGlobal As Integer: isGlobal = False
|
||||
Dim isArray As Integer: isArray = False
|
||||
Dim isStatic As Integer: isStatic = False
|
||||
Dim arraySize As String
|
||||
Dim pstart As Integer
|
||||
Dim bvar As Variable
|
||||
Dim varnames(0) As String
|
||||
Dim vnamecount As Integer
|
||||
Dim findVar As Variable
|
||||
Dim asIdx As Integer
|
||||
asIdx = 0
|
||||
bvar.typeId = typeId
|
||||
|
||||
|
||||
Dim i As Integer
|
||||
For i = 1 To UBound(parts)
|
||||
If UCase$(parts(i)) = "AS" Then asIdx = i
|
||||
Next i
|
||||
|
||||
If asIdx = 1 Then
|
||||
|
||||
' Handle Dim As syntax
|
||||
bvar.type = UCase$(parts(asIdx + 1))
|
||||
Dim nextIdx As Integer
|
||||
nextIdx = asIdx + 2
|
||||
If bvar.type = "_UNSIGNED" Or bvar.type = "UNSIGNED" Then
|
||||
bvar.type = NormalizeType("_UNSIGNED " + UCase$(parts(asIdx + 2)))
|
||||
nextIdx = asIdx + 3
|
||||
End If
|
||||
'bvar.typeId = FindTypeId(bvar.type)
|
||||
|
||||
vnamecount = ListSplit(Join(parts(), nextIdx, -1, " "), varnames())
|
||||
For i = 1 To vnamecount
|
||||
vname = _Trim$(varnames(i))
|
||||
pstart = InStr(vname, "(")
|
||||
If pstart > 0 Then
|
||||
bvar.isArray = True
|
||||
arraySize = ConvertExpression(Mid$(vname, pstart + 1, Len(vname) - pstart - 1), lineNumber)
|
||||
bvar.name = RemoveSuffix(Left$(vname, pstart - 1))
|
||||
Else
|
||||
bvar.isArray = False
|
||||
arraySize = ""
|
||||
bvar.name = vname
|
||||
End If
|
||||
AddVariable bvar, typeVars()
|
||||
Next i
|
||||
|
||||
Else
|
||||
'Handle traditional syntax
|
||||
bvar.name = parts(1)
|
||||
bvar.type = UCase$(parts(3))
|
||||
If bvar.type = "_UNSIGNED" Or bvar.type = "UNSIGNED" Then bvar.type = NormalizeType("_UNSIGNED " + UCase$(parts(4)))
|
||||
'bvar.typeId = FindTypeId(bvar.type)
|
||||
AddVariable bvar, typeVars()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Function DeclareVar$ (parts() As String, lineNumber As Integer)
|
||||
|
||||
Dim vname As String
|
||||
|
@ -1604,7 +1662,7 @@ Function DeclareVar$ (parts() As String, lineNumber As Integer)
|
|||
Dim i As Integer
|
||||
For i = 1 To UBound(parts)
|
||||
If UCase$(parts(i)) = "AS" Then asIdx = i
|
||||
If UCase$(parts(i)) = "_PRESERVE" Then preserve = "true"
|
||||
If UCase$(parts(i)) = "_PRESERVE" Or UCase$(parts(i)) = "PRESERVE" Then preserve = "true"
|
||||
If UCase$(parts(i)) = "SHARED" Then isGlobal = True
|
||||
Next i
|
||||
|
||||
|
@ -1617,7 +1675,7 @@ Function DeclareVar$ (parts() As String, lineNumber As Integer)
|
|||
bvar.type = UCase$(parts(asIdx + 1))
|
||||
Dim nextIdx As Integer
|
||||
nextIdx = asIdx + 2
|
||||
If bvar.type = "_UNSIGNED" Then
|
||||
If bvar.type = "_UNSIGNED" Or bvar.type = "UNSIGNED" Then
|
||||
bvar.type = bvar.type + " " + UCase$(parts(asIdx + 2))
|
||||
nextIdx = asIdx + 3
|
||||
End If
|
||||
|
@ -1649,7 +1707,7 @@ Function DeclareVar$ (parts() As String, lineNumber As Integer)
|
|||
For i = 1 To UBound(parts)
|
||||
Dim p As String
|
||||
p = UCase$(parts(i))
|
||||
If p = "DIM" Or p = "REDIM" Or p = "SHARED" Or p = "_PRESERVE" Or p = "STATIC" Then
|
||||
If p = "DIM" Or p = "REDIM" Or p = "SHARED" Or p = "_PRESERVE" Or p = "PRESERVE" Or p = "STATIC" Then
|
||||
nextIdx = i + 1
|
||||
End If
|
||||
Next i
|
||||
|
@ -1700,6 +1758,7 @@ Function RegisterVar$ (bvar As Variable, js As String, isGlobal As Integer, isSt
|
|||
If isStatic Then
|
||||
bvar.jsname = "$" + currentMethod + "__" + bvar.jsname
|
||||
End If
|
||||
bvar.type = NormalizeType(bvar.type)
|
||||
|
||||
If Not bvar.isArray Then
|
||||
js = js + "var " + bvar.jsname + " = " + InitTypeValue(bvar.type) + "; "
|
||||
|
@ -2067,7 +2126,7 @@ Sub ConvertMethods ()
|
|||
' add the parameter to the local variables
|
||||
Dim bvar As Variable
|
||||
bvar.name = RemoveSuffix(parts(1))
|
||||
bvar.type = parts(2)
|
||||
bvar.type = NormalizeType(parts(2))
|
||||
bvar.typeId = FindTypeId(bvar.type)
|
||||
If parts(3) = "true" Then
|
||||
bvar.isArray = True
|
||||
|
@ -2079,11 +2138,11 @@ Sub ConvertMethods ()
|
|||
If Not bvar.isArray Then
|
||||
Dim typeName As String
|
||||
typeName = UCase$(bvar.type)
|
||||
If typeName = "BIT" Or typeName = "UNSIGNED BIT" Or _
|
||||
typeName = "BYTE" Or typeName = "UNSIGNED BYTE" Or _
|
||||
typeName = "INTEGER" Or typeName = "UNSIGNED INTEGER" Or _
|
||||
typeName = "LONG" Or typeName = "UNSIGNED LONG" Or _
|
||||
typeName = "_INTEGER64" Or typeName = "UNSIGNED _INTEGER64" Then
|
||||
If typeName = "_BIT" Or typeName = "_UNSIGNED _BIT" Or _
|
||||
typeName = "_BYTE" Or typeName = "_UNSIGNED _BYTE" Or _
|
||||
typeName = "INTEGER" Or typeName = "_UNSIGNED INTEGER" Or _
|
||||
typeName = "LONG" Or typeName = "_UNSIGNED LONG" Or _
|
||||
typeName = "_INTEGER64" Or typeName = "_UNSIGNED _INTEGER64" Then
|
||||
' lookup the variable to get the jsname
|
||||
Dim varIsArray As Integer
|
||||
If FindVariable(bvar.name, bvar, varIsArray) Then
|
||||
|
@ -2779,10 +2838,17 @@ Sub PrintTypes
|
|||
Next i
|
||||
End Sub
|
||||
|
||||
Function CopyMethod (fromMethod As Method, toMethod As Method)
|
||||
Sub CopyMethod (fromMethod As Method, toMethod As Method)
|
||||
toMethod.type = fromMethod.type
|
||||
toMethod.name = fromMethod.name
|
||||
End Function
|
||||
toMethod.returnType = fromMethod.returnType
|
||||
toMethod.name = fromMethod.name
|
||||
toMethod.uname = fromMethod.uname
|
||||
toMethod.argc = fromMethod.argc
|
||||
toMethod.args = fromMethod.args
|
||||
toMethod.jsname = fromMethod.jsname
|
||||
toMethod.sync = fromMethod.sync
|
||||
End Sub
|
||||
|
||||
Sub AddMethod (m As Method, prefix As String, sync As Integer)
|
||||
Dim mcount: mcount = UBound(methods) + 1
|
||||
|
@ -2796,7 +2862,6 @@ Sub AddMethod (m As Method, prefix As String, sync As Integer)
|
|||
methods(mcount) = m
|
||||
End Sub
|
||||
|
||||
|
||||
Sub AddExportMethod (m As Method, prefix As String, sync As Integer)
|
||||
Dim mcount: mcount = UBound(exportMethods) + 1
|
||||
ReDim _Preserve As Method exportMethods(mcount)
|
||||
|
@ -2840,6 +2905,16 @@ Sub AddQBMethod (mtype As String, mname As String, sync As Integer)
|
|||
m.type = mtype
|
||||
m.name = mname
|
||||
AddMethod m, "QB.", sync
|
||||
If InStr(mname, "_") = 1 Then
|
||||
' Register the method again without the "_" prefix
|
||||
Dim m2 As Method
|
||||
CopyMethod methods(UBound(methods)), m2
|
||||
m2.name = Mid$(mname, 2)
|
||||
m2.uname = UCase$(RemoveSuffix(m2.name))
|
||||
Dim mcount: mcount = UBound(methods) + 1
|
||||
ReDim _Preserve As Method methods(mcount)
|
||||
methods(mcount) = m2
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub AddNativeMethod (mtype As String, mname As String, jsname As String, sync As Integer)
|
||||
|
@ -2943,7 +3018,7 @@ Sub AddVariable (bvar As Variable, vlist() As Variable)
|
|||
Dim vcount: vcount = UBound(vlist) + 1
|
||||
ReDim _Preserve As Variable vlist(vcount)
|
||||
Dim nvar As Variable
|
||||
nvar.type = bvar.type
|
||||
nvar.type = NormalizeType(bvar.type)
|
||||
nvar.name = bvar.name
|
||||
nvar.jsname = bvar.jsname
|
||||
nvar.isConst = bvar.isConst
|
||||
|
@ -2952,9 +3027,40 @@ Sub AddVariable (bvar As Variable, vlist() As Variable)
|
|||
nvar.typeId = bvar.typeId
|
||||
|
||||
If nvar.jsname = "" Then nvar.jsname = RemoveSuffix(nvar.name)
|
||||
|
||||
|
||||
vlist(vcount) = nvar
|
||||
End Sub
|
||||
|
||||
Function NormalizeType$ (itype As String)
|
||||
' Replace non-underscore prefixed type names with the underscore version
|
||||
Dim otype As String
|
||||
|
||||
If itype = "BIT" Then
|
||||
otype = "_BIT"
|
||||
ElseIf itype = "_UNSIGNED BIT" Then
|
||||
otype = "_UNSIGNED _BIT"
|
||||
ElseIf itype = "BYTE" Then
|
||||
otype = "_BYTE"
|
||||
ElseIf itype = "_UNSIGNED BYTE" Then
|
||||
otype = "_UNSIGNED _BYTE"
|
||||
ElseIf itype = "INTEGER64" Then
|
||||
otype = "_INTEGER64"
|
||||
ElseIf itype = "_UNSIGNED INTEGER64" Then
|
||||
otype = "_UNSIGNED _INTEGER64"
|
||||
ElseIf itype = "FLOAT" Then
|
||||
otype = "_FLOAT"
|
||||
ElseIf itype = "OFFSET" Then
|
||||
otype = "_OFFSET"
|
||||
ElseIf itype = "_UNSIGNED OFFSET" Then
|
||||
otype = "_UNSIGNED _OFFSET"
|
||||
Else
|
||||
otype = itype
|
||||
End If
|
||||
|
||||
NormalizeType = otype
|
||||
End Function
|
||||
|
||||
Sub AddType (t As QBType)
|
||||
Dim tcount: tcount = UBound(types) + 1
|
||||
ReDim _Preserve As QBType types(tcount)
|
||||
|
@ -3496,6 +3602,9 @@ Sub InitQBMethods
|
|||
AddQBMethod "FUNCTION", "_Alpha32", False
|
||||
AddQBMethod "FUNCTION", "_Acos", False
|
||||
AddQBMethod "FUNCTION", "_Acosh", False
|
||||
AddQBMethod "FUNCTION", "_Arccot", False
|
||||
AddQBMethod "FUNCTION", "_Arccsc", False
|
||||
AddQBMethod "FUNCTION", "_Arcsec", False
|
||||
AddQBMethod "FUNCTION", "_Atanh", False
|
||||
AddQBMethod "FUNCTION", "_Asin", False
|
||||
AddQBMethod "FUNCTION", "_Asinh", False
|
||||
|
@ -3505,16 +3614,20 @@ Sub InitQBMethods
|
|||
AddQBMethod "FUNCTION", "_BackgroundColor", False
|
||||
AddQBMethod "FUNCTION", "_Blue", False
|
||||
AddQBMethod "FUNCTION", "_Blue32", False
|
||||
AddQBMethod "FUNCTION", "_CapsLock", False
|
||||
AddQBMethod "FUNCTION", "_Ceil", False
|
||||
AddQBMethod "FUNCTION", "_CommandCount", False
|
||||
AddQBMethod "FUNCTION", "_CopyImage", False
|
||||
AddQBMethod "FUNCTION", "_Cosh", False
|
||||
AddQBMethod "FUNCTION", "_Cot", False
|
||||
AddQBMethod "FUNCTION", "_Coth", False
|
||||
AddQBMethod "FUNCTION", "_Csc", False
|
||||
AddQBMethod "FUNCTION", "_Csch", False
|
||||
AddQBMethod "FUNCTION", "_CWD$", False
|
||||
AddQBMethod "FUNCTION", "_D2G", False
|
||||
AddQBMethod "FUNCTION", "_D2R", False
|
||||
AddQBMethod "FUNCTION", "_DefaultColor", False
|
||||
AddQBMethod "FUNCTION", "_Deflate", False
|
||||
AddQBMethod "SUB", "_Delay", True
|
||||
AddQBMethod "FUNCTION", "_DesktopHeight", False
|
||||
AddQBMethod "FUNCTION", "_DesktopWidth", False
|
||||
|
@ -3539,6 +3652,7 @@ Sub InitQBMethods
|
|||
AddQBMethod "FUNCTION", "_Green32", False
|
||||
AddQBMethod "FUNCTION", "_Height", False
|
||||
AddQBMethod "FUNCTION", "_Hypot", False
|
||||
AddQBMethod "FUNCTION", "_Inflate", False
|
||||
AddQBMethod "FUNCTION", "_InStrRev", False
|
||||
AddQBMethod "SUB", "_Limit", True
|
||||
AddQBMethod "SUB", "_KeyClear", False
|
||||
|
@ -3554,6 +3668,7 @@ Sub InitQBMethods
|
|||
AddQBMethod "FUNCTION", "_MouseX", False
|
||||
AddQBMethod "FUNCTION", "_MouseY", False
|
||||
AddQBMethod "FUNCTION", "_NewImage", False
|
||||
AddQBMethod "FUNCTION", "_NumLock", False
|
||||
AddQBMethod "FUNCTION", "_OS$", False
|
||||
AddQBMethod "FUNCTION", "_Pi", False
|
||||
AddQBMethod "SUB", "_PaletteColor", False
|
||||
|
@ -3580,6 +3695,8 @@ Sub InitQBMethods
|
|||
AddQBMethod "SUB", "_ScreenMove", False
|
||||
AddQBMethod "FUNCTION", "_ScreenX", False
|
||||
AddQBMethod "FUNCTION", "_ScreenY", False
|
||||
AddQBMethod "FUNCTION", "_ScrollLock", False
|
||||
AddQBMethod "FUNCTION", "_Sec", False
|
||||
AddQBMethod "FUNCTION", "_Sech", False
|
||||
AddQBMethod "FUNCTION", "_Setbit", False
|
||||
AddQBMethod "FUNCTION", "_Shl", False
|
||||
|
@ -3646,9 +3763,10 @@ Sub InitQBMethods
|
|||
AddQBMethod "FUNCTION", "Left$", False
|
||||
AddQBMethod "FUNCTION", "LCase$", False
|
||||
AddQBMethod "FUNCTION", "Len", False
|
||||
AddQBMethod "FUNCTION", "LOF", False
|
||||
AddQBMethod "SUB", "Line", False
|
||||
AddQBMethod "FUNCTION", "Loc", False
|
||||
AddQBMethod "SUB", "Locate", False
|
||||
AddQBMethod "FUNCTION", "LOF", False
|
||||
AddQBMethod "FUNCTION", "Log", False
|
||||
AddQBMethod "FUNCTION", "LTrim$", False
|
||||
AddQBMethod "SUB", "Kill", False
|
||||
|
|
2
util/pako.2.1.0.min.js
vendored
Normal file
2
util/pako.2.1.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue