Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/mujs/jsboolean.c @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 #include "jsi.h" | |
| 2 | |
| 3 static void jsB_new_Boolean(js_State *J) | |
| 4 { | |
| 5 js_newboolean(J, js_toboolean(J, 1)); | |
| 6 } | |
| 7 | |
| 8 static void jsB_Boolean(js_State *J) | |
| 9 { | |
| 10 js_pushboolean(J, js_toboolean(J, 1)); | |
| 11 } | |
| 12 | |
| 13 static void Bp_toString(js_State *J) | |
| 14 { | |
| 15 js_Object *self = js_toobject(J, 0); | |
| 16 if (self->type != JS_CBOOLEAN) js_typeerror(J, "not a boolean"); | |
| 17 js_pushliteral(J, self->u.boolean ? "true" : "false"); | |
| 18 } | |
| 19 | |
| 20 static void Bp_valueOf(js_State *J) | |
| 21 { | |
| 22 js_Object *self = js_toobject(J, 0); | |
| 23 if (self->type != JS_CBOOLEAN) js_typeerror(J, "not a boolean"); | |
| 24 js_pushboolean(J, self->u.boolean); | |
| 25 } | |
| 26 | |
| 27 void jsB_initboolean(js_State *J) | |
| 28 { | |
| 29 J->Boolean_prototype->u.boolean = 0; | |
| 30 | |
| 31 js_pushobject(J, J->Boolean_prototype); | |
| 32 { | |
| 33 jsB_propf(J, "Boolean.prototype.toString", Bp_toString, 0); | |
| 34 jsB_propf(J, "Boolean.prototype.valueOf", Bp_valueOf, 0); | |
| 35 } | |
| 36 js_newcconstructor(J, jsB_Boolean, jsB_new_Boolean, "Boolean", 1); | |
| 37 js_defglobal(J, "Boolean", JS_DONTENUM); | |
| 38 } |
