add website base
This commit is contained in:
parent
7706aa8462
commit
e5d67431b6
|
@ -1015,11 +1015,11 @@ typedef struct JSCFunctionListEntry {
|
|||
#define JS_DEF_ALIAS 9
|
||||
|
||||
/* Note: c++ does not like nested designators */
|
||||
#define JS_CFUNC_DEF(name, length, func1) { name, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE | JS_PROP_ENUMERABLE, JS_DEF_CFUNC, 0, .u = { .func = { length, JS_CFUNC_generic, { .generic = func1 } } } }
|
||||
#define JS_CFUNC_DEF(name, length, func1) { name, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE, JS_DEF_CFUNC, 0, .u = { .func = { length, JS_CFUNC_generic, { .generic = func1 } } } }
|
||||
#define JS_CFUNC_MAGIC_DEF(name, length, func1, magic) { name, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE, JS_DEF_CFUNC, magic, .u = { .func = { length, JS_CFUNC_generic_magic, { .generic_magic = func1 } } } }
|
||||
#define JS_CFUNC_SPECIAL_DEF(name, length, cproto, func1) { name, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE, JS_DEF_CFUNC, 0, .u = { .func = { length, JS_CFUNC_ ## cproto, { .cproto = func1 } } } }
|
||||
#define JS_ITERATOR_NEXT_DEF(name, length, func1, magic) { name, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE, JS_DEF_CFUNC, magic, .u = { .func = { length, JS_CFUNC_iterator_next, { .iterator_next = func1 } } } }
|
||||
#define JS_CGETSET_DEF(name, fgetter, fsetter) { name, JS_PROP_ENUMERABLE | JS_PROP_CONFIGURABLE, JS_DEF_CGETSET, 0, .u = { .getset = { .get = { .getter = fgetter }, .set = { .setter = fsetter } } } }
|
||||
#define JS_CGETSET_DEF(name, fgetter, fsetter) { name, JS_PROP_CONFIGURABLE, JS_DEF_CGETSET, 0, .u = { .getset = { .get = { .getter = fgetter }, .set = { .setter = fsetter } } } }
|
||||
#define JS_CGETSET_MAGIC_DEF(name, fgetter, fsetter, magic) { name, JS_PROP_CONFIGURABLE, JS_DEF_CGETSET_MAGIC, magic, .u = { .getset = { .get = { .getter_magic = fgetter }, .set = { .setter_magic = fsetter } } } }
|
||||
#define JS_PROP_STRING_DEF(name, cstr, prop_flags) { name, prop_flags, JS_DEF_PROP_STRING, 0, .u = { .str = cstr } }
|
||||
#define JS_PROP_INT32_DEF(name, val, prop_flags) { name, prop_flags, JS_DEF_PROP_INT32, 0, .u = { .i32 = val } }
|
||||
|
|
|
@ -24,6 +24,39 @@ WeakSet = undefined;
|
|||
|
||||
var fmt = {};
|
||||
|
||||
function arabic2roman(num)
|
||||
{
|
||||
if (num <= 0 || num >= 4000)
|
||||
return "Invalid input. Roman numerals are not defined for numbers less than 1 or greater than 3999.";
|
||||
|
||||
var roman_numerals = {
|
||||
M: 1000,
|
||||
CM: 900,
|
||||
D: 500,
|
||||
CD: 400,
|
||||
C: 100,
|
||||
XC: 90,
|
||||
L: 50,
|
||||
XL: 40,
|
||||
X: 10,
|
||||
IX: 9,
|
||||
V: 5,
|
||||
IV: 4,
|
||||
I: 1
|
||||
};
|
||||
|
||||
var result = '';
|
||||
|
||||
for (var key in roman_numerals) {
|
||||
while (num >= roman_numerals[key]) {
|
||||
result += key;
|
||||
num -= roman_numerals[key];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
var timeparse = {
|
||||
yyyy: "year",
|
||||
mm: "month",
|
||||
|
|
|
@ -877,7 +877,6 @@ editor.inputs['M-t'].doc = "Unlock all objects in current level.";
|
|||
|
||||
editor.inputs['C-n'] = function() {
|
||||
editor.edit_level.spawn();
|
||||
return;
|
||||
};
|
||||
editor.inputs['C-n'].doc = "Create an empty object.";
|
||||
|
||||
|
|
|
@ -1812,7 +1812,12 @@ GETSET_PAIR(warp_gravity, spherical, bool)
|
|||
GETSET_PAIR(warp_gravity, mask, bitmask)
|
||||
GETSET_PAIR(warp_gravity, planar_force, vec3)
|
||||
|
||||
#define CGETSET_ADD(ID, ENTRY) JS_CGETSET_DEF(#ENTRY, ID##_get_##ENTRY, ID##_set_##ENTRY)
|
||||
#define MIST_CFUNC_DEF(name, length, func1) { name, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE | JS_PROP_ENUMERABLE, JS_DEF_CFUNC, 0, .u = { .func = { length, JS_CFUNC_generic, { .generic = func1 } } } }
|
||||
|
||||
#define MIST_CGETSET_DEF(name, fgetter, fsetter) { name, JS_PROP_CONFIGURABLE | JS_PROP_ENUMERABLE, JS_DEF_CGETSET, 0, .u = { .getset = { .get = { .getter = fgetter }, .set = { .setter = fsetter } } } }
|
||||
|
||||
|
||||
#define CGETSET_ADD(ID, ENTRY) MIST_CGETSET_DEF(#ENTRY, ID##_get_##ENTRY, ID##_set_##ENTRY)
|
||||
|
||||
static const JSCFunctionListEntry js_warp_gravity_funcs [] = {
|
||||
CGETSET_ADD(warp_gravity, strength),
|
||||
|
@ -1887,9 +1892,9 @@ static const JSCFunctionListEntry js_emitter_funcs[] = {
|
|||
CGETSET_ADD(emitter, persist),
|
||||
CGETSET_ADD(emitter, persist_var),
|
||||
CGETSET_ADD(emitter, warp_mask),
|
||||
JS_CFUNC_DEF("start", 0, js_emitter_start),
|
||||
JS_CFUNC_DEF("stop", 0, js_emitter_stop),
|
||||
JS_CFUNC_DEF("emit", 1, js_emitter_emit)
|
||||
MIST_CFUNC_DEF("start", 0, js_emitter_start),
|
||||
MIST_CFUNC_DEF("stop", 0, js_emitter_stop),
|
||||
MIST_CFUNC_DEF("emit", 1, js_emitter_emit)
|
||||
};
|
||||
|
||||
GETSET_PAIR(dsp_node, pass, bool)
|
||||
|
@ -1914,8 +1919,8 @@ static const JSCFunctionListEntry js_dsp_node_funcs[] = {
|
|||
CGETSET_ADD(dsp_node, off),
|
||||
CGETSET_ADD(dsp_node, gain),
|
||||
CGETSET_ADD(dsp_node, pan),
|
||||
JS_CFUNC_DEF("plugin", 1, js_dsp_node_plugin),
|
||||
JS_CFUNC_DEF("unplug", 0, js_dsp_node_unplug)
|
||||
MIST_CFUNC_DEF("plugin", 1, js_dsp_node_plugin),
|
||||
MIST_CFUNC_DEF("unplug", 0, js_dsp_node_unplug)
|
||||
};
|
||||
|
||||
GETSET_PAIR(sound, loop, bool)
|
||||
|
@ -2064,8 +2069,8 @@ JSValue nota_decode(JSContext *js, JSValueConst this, int argc, JSValueConst *ar
|
|||
}
|
||||
|
||||
static const JSCFunctionListEntry nota_funcs[] = {
|
||||
JS_CFUNC_DEF("encode", 1, nota_encode),
|
||||
JS_CFUNC_DEF("decode", 1, nota_decode)
|
||||
MIST_CFUNC_DEF("encode", 1, nota_encode),
|
||||
MIST_CFUNC_DEF("decode", 1, nota_decode)
|
||||
};
|
||||
|
||||
#define DUK_FUNC(NAME, ARGS) JS_SetPropertyStr(js, globalThis, #NAME, JS_NewCFunction(js, duk_##NAME, #NAME, ARGS));
|
||||
|
|
Loading…
Reference in a new issue