mirror of
https://github.com/boxgaming/qbjs.git
synced 2024-09-20 04:24:45 +00:00
Added support for base-8 numbers: created Oct$, enabled Val("&O"...)
This commit is contained in:
parent
b8470ba965
commit
49f1732075
4 changed files with 9 additions and 1 deletions
|
@ -42,7 +42,7 @@ CodeMirror.defineMode("qbjs", function(conf, parserConf) {
|
||||||
'_screenexists', '_sndclose', '_sndopen', '_sndplay', '_sndloop', '_sndpause', '_sndstop', '_sndvol',
|
'_screenexists', '_sndclose', '_sndopen', '_sndplay', '_sndloop', '_sndpause', '_sndstop', '_sndvol',
|
||||||
'_title', '_trim', '_width', 'abs', 'asc', 'atn', 'chr', 'circle', 'cls', 'color', 'command', 'cos', 'cvi', 'cvl', 'exp',
|
'_title', '_trim', '_width', 'abs', 'asc', 'atn', 'chr', 'circle', 'cls', 'color', 'command', 'cos', 'cvi', 'cvl', 'exp',
|
||||||
'fix', 'hex', 'input', 'inkey', 'instr', 'int', 'lbound', 'left', 'lcase', 'len', 'line', 'locate', 'log', 'ltrim', 'mid', 'mki', 'mkl',
|
'fix', 'hex', 'input', 'inkey', 'instr', 'int', 'lbound', 'left', 'lcase', 'len', 'line', 'locate', 'log', 'ltrim', 'mid', 'mki', 'mkl',
|
||||||
'point', 'print', 'pset', 'right', 'rtrim', 'rnd', 'screen', 'shared', 'sgn', 'sin', 'sleep', 'space', 'sqr', 'str', 'swap', 'tan',
|
'oct', 'point', 'print', 'pset', 'right', 'rtrim', 'rnd', 'screen', 'shared', 'sgn', 'sin', 'sleep', 'space', 'sqr', 'str', 'swap', 'tan',
|
||||||
'timer', 'ubound', 'ucase', 'val',
|
'timer', 'ubound', 'ucase', 'val',
|
||||||
// QBJS-specific
|
// QBJS-specific
|
||||||
'alert', 'confirm', 'domadd', 'domcontainer', 'domcreate', 'domevent','domget', 'domgetimage', 'domremove', 'export',
|
'alert', 'confirm', 'domadd', 'domcontainer', 'domcreate', 'domevent','domget', 'domgetimage', 'domremove', 'export',
|
||||||
|
|
6
qb.js
6
qb.js
|
@ -854,6 +854,10 @@ var QB = new function() {
|
||||||
return ascii.split("").reverse().join("");
|
return ascii.split("").reverse().join("");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.func_Oct = function(n) {
|
||||||
|
return n.toString(8).toUpperCase();
|
||||||
|
};
|
||||||
|
|
||||||
this.func_Point = function(x, y) {
|
this.func_Point = function(x, y) {
|
||||||
var screen = _images[_activeImage];
|
var screen = _images[_activeImage];
|
||||||
var ctx = screen.ctx;
|
var ctx = screen.ctx;
|
||||||
|
@ -1102,6 +1106,8 @@ var QB = new function() {
|
||||||
var ret;
|
var ret;
|
||||||
if (value.substring(0, 2) == "&H") {
|
if (value.substring(0, 2) == "&H") {
|
||||||
ret = parseInt(value.slice(2), 16);
|
ret = parseInt(value.slice(2), 16);
|
||||||
|
} else if (value.substring(0, 2) == "&O") {
|
||||||
|
ret = parseInt(value.slice(2), 8);
|
||||||
} else {
|
} else {
|
||||||
ret = Number(value);
|
ret = Number(value);
|
||||||
}
|
}
|
||||||
|
|
1
qb2js.js
1
qb2js.js
|
@ -2531,6 +2531,7 @@ if (QB.halted()) { return; }
|
||||||
await sub_AddQBMethod( "FUNCTION", "Mid$", False);
|
await sub_AddQBMethod( "FUNCTION", "Mid$", False);
|
||||||
await sub_AddQBMethod( "FUNCTION", "Mki$", False);
|
await sub_AddQBMethod( "FUNCTION", "Mki$", False);
|
||||||
await sub_AddQBMethod( "FUNCTION", "Mkl$", False);
|
await sub_AddQBMethod( "FUNCTION", "Mkl$", False);
|
||||||
|
await sub_AddQBMethod( "FUNCTION", "Oct$", False);
|
||||||
await sub_AddQBMethod( "FUNCTION", "Point", False);
|
await sub_AddQBMethod( "FUNCTION", "Point", False);
|
||||||
await sub_AddQBMethod( "SUB", "Print", True);
|
await sub_AddQBMethod( "SUB", "Print", True);
|
||||||
await sub_AddQBMethod( "SUB", "PSet", False);
|
await sub_AddQBMethod( "SUB", "PSet", False);
|
||||||
|
|
|
@ -2673,6 +2673,7 @@ Sub InitQBMethods
|
||||||
AddQBMethod "FUNCTION", "Mid$", False
|
AddQBMethod "FUNCTION", "Mid$", False
|
||||||
AddQBMethod "FUNCTION", "Mki$", False
|
AddQBMethod "FUNCTION", "Mki$", False
|
||||||
AddQBMethod "FUNCTION", "Mkl$", False
|
AddQBMethod "FUNCTION", "Mkl$", False
|
||||||
|
AddQBMethod "FUNCTION", "Oct$", False
|
||||||
AddQBMethod "FUNCTION", "Point", False
|
AddQBMethod "FUNCTION", "Point", False
|
||||||
AddQBMethod "SUB", "Print", True
|
AddQBMethod "SUB", "Print", True
|
||||||
AddQBMethod "SUB", "PSet", False
|
AddQBMethod "SUB", "PSet", False
|
||||||
|
|
Loading…
Reference in a new issue