Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions dtoa.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@
#include <inttypes.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>
#include <sys/time.h>
#include <math.h>
#include <setjmp.h>

#include "cutils.h"
#include "dtoa.h"
Expand Down
3 changes: 3 additions & 0 deletions dtoa.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

//#define JS_DTOA_DUMP_STATS

#include <stdint.h>
#include <stddef.h>

/* maximum number of digits for fixed and frac formats */
#define JS_DTOA_MAX_DIGITS 101

Expand Down
4 changes: 0 additions & 4 deletions example.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,16 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <inttypes.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>
#include <time.h>
#include <sys/time.h>
#include <math.h>
#include <fcntl.h>

#include "cutils.h"
#include "mquickjs.h"

#define JS_CLASS_RECTANGLE (JS_CLASS_USER + 0)
Expand Down
1 change: 0 additions & 1 deletion example_stdlib.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <math.h>
#include <stdio.h>
#include <string.h>

Expand Down
9 changes: 4 additions & 5 deletions libm.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
* is preserved.
* ====================================================
*/
#include <stdio.h>
#include <inttypes.h>
#include <math.h>
#define NDEBUG
Expand Down Expand Up @@ -433,10 +432,10 @@ double js_scalbn(double x, int n)
if (k > 0) /* normal result */
{x = set_high_word(x, (hx&0x800fffff)|(k<<20)); return x;}
if (k <= -54) {
if (n > 50000) /* in case integer overflow in n+k */
return huge*copysign(huge,x); /*overflow*/
else
return tiny*copysign(tiny,x); /*underflow*/
if (n > 50000) /* in case integer overflow in n+k */
return huge * copysign(huge, x); /*overflow*/
else
return tiny * copysign(tiny, x); /*underflow*/
}
k += 54; /* subnormal result */
x = set_high_word(x, (hx&0x800fffff)|(k<<20));
Expand Down
2 changes: 2 additions & 0 deletions libm.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <stdint.h>

double js_scalbn(double x, int n);
double js_floor(double x);
double js_ceil(double x);
Expand Down
2 changes: 0 additions & 2 deletions mqjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
Expand All @@ -32,7 +31,6 @@
#include <ctype.h>
#include <time.h>
#include <sys/time.h>
#include <math.h>
#include <fcntl.h>

#include "cutils.h"
Expand Down
1 change: 1 addition & 0 deletions mquickjs.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define MQUICKJS_H

#include <inttypes.h>
#include <stddef.h>

#if defined(__GNUC__) || defined(__clang__)
#define __js_printf_like(f, a) __attribute__((format(printf, f, a)))
Expand Down
12 changes: 10 additions & 2 deletions mquickjs_build.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include <inttypes.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>
#include <math.h>

#include "cutils.h"
#include "list.h"
Expand Down Expand Up @@ -897,6 +895,16 @@ int build_atoms(const char *stdlib_name, const JSPropDef *global_obj,

printf("/* this file is automatically generated - do not edit */\n\n");
printf("#include \"mquickjs_priv.h\"\n\n");

printf("/* standard library functions expected to be provided by the host application */\n");
printf("JSValue js_date_now(JSContext *ctx, JSValue *this_val, int argc, JSValue *argv);\n");
printf("JSValue js_print(JSContext *ctx, JSValue *this_val, int argc, JSValue *argv);\n");
printf("JSValue js_gc(JSContext *ctx, JSValue *this_val, int argc, JSValue *argv);\n");
printf("JSValue js_date_now(JSContext *ctx, JSValue *this_val, int argc, JSValue *argv);\n");
printf("JSValue js_performance_now(JSContext *ctx, JSValue *this_val, int argc, JSValue *argv);\n");
printf("JSValue js_load(JSContext *ctx, JSValue *this_val, int argc, JSValue *argv);\n");
printf("JSValue js_setTimeout(JSContext *ctx, JSValue *this_val, int argc, JSValue *argv);\n");
printf("JSValue js_clearTimeout(JSContext *ctx, JSValue *this_val, int argc, JSValue *argv);\n\n");

printf("static const uint%u_t __attribute((aligned(%d))) js_stdlib_table[] = {\n",
JSW * 8, ATOM_ALIGN);
Expand Down
2 changes: 1 addition & 1 deletion readline.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#ifndef READLINE_H
#define READLINE_H

#include "cutils.h"
#include <stdint.h>

typedef struct ReadlineState ReadlineState;

Expand Down
3 changes: 0 additions & 3 deletions readline_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <inttypes.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>
#include <time.h>
#include <sys/time.h>
#include <math.h>
#include <fcntl.h>
#ifdef _WIN32
#include <windows.h>
Expand Down
2 changes: 2 additions & 0 deletions readline_tty.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#include "cutils.h"
#include "readline.h"

int readline_tty_init(void);
Expand Down