Skip to content
Merged
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
8 changes: 6 additions & 2 deletions src/jsifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function runJSify() {
}
}

function convertPointerParams(snippet, sig) {
function convertPointerParams(symbol, snippet, sig) {
// Automatically convert any incoming pointer arguments from BigInt
// to double (this limits the range to int53).
// And convert the return value if the function returns a pointer.
Expand All @@ -99,6 +99,10 @@ function runJSify() {
let argConvertions = '';
for (let i = 1; i < sig.length; i++) {
const name = argNames[i - 1];
if (!name) {
error(`convertPointerParams: missing name for argument ${i} in ${symbol}`);
return snippet;
}
if (sig[i] == 'p') {
argConvertions += ` ${name} = Number(${name});\n`;
newArgs.push(`Number(${name})`);
Expand Down Expand Up @@ -182,7 +186,7 @@ function ${name}(${args}) {
if (MEMORY64) {
const sig = LibraryManager.library[symbol + '__sig'];
if (sig && sig.includes('p')) {
snippet = convertPointerParams(snippet, sig);
snippet = convertPointerParams(symbol, snippet, sig);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/library_async.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,13 +647,13 @@ mergeInto(LibraryManager.library, {
emscripten_sleep: function() {
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_sleep';
},
emscripten_wget: function() {
emscripten_wget: function(url, file) {
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_wget';
},
emscripten_wget_data: function() {
emscripten_wget_data: function(url, pbuffer, pnum, perror) {
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_wget_data';
},
emscripten_scan_registers: function() {
emscripten_scan_registers: function(func) {
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_scan_registers';
},
emscripten_fiber_init: function() {
Expand All @@ -662,7 +662,7 @@ mergeInto(LibraryManager.library, {
emscripten_fiber_init_from_current_context: function() {
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_fiber_init_from_current_context';
},
emscripten_fiber_swap: function() {
emscripten_fiber_swap: function(oldFiber, newFiber) {
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_fiber_swap';
},
#endif // ASYNCIFY
Expand Down
8 changes: 4 additions & 4 deletions src/library_idbstore.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,16 @@ var LibraryIDBStore = {
IDBStore.blobs[blobId] = null;
},
#else
emscripten_idb_load: function() {
emscripten_idb_load: function(db, id, pbuffer, pnum, perror) {
throw 'Please compile your program with async support in order to use synchronous operations like emscripten_idb_load, etc.';
},
emscripten_idb_store: function() {
emscripten_idb_store: function(db, id, ptr, num, perror) {
throw 'Please compile your program with async support in order to use synchronous operations like emscripten_idb_store, etc.';
},
emscripten_idb_delete: function() {
emscripten_idb_delete: function(db, id, perror) {
throw 'Please compile your program with async support in order to use synchronous operations like emscripten_idb_delete, etc.';
},
emscripten_idb_exists: function() {
emscripten_idb_exists: function(db, id, pexists, perror) {
throw 'Please compile your program with async support in order to use synchronous operations like emscripten_idb_exists, etc.';
},
#endif // ASYNCIFY
Expand Down
34 changes: 17 additions & 17 deletions src/library_sdl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1843,7 +1843,7 @@ var LibrarySDL = {
return SDL.errorMessage;
},

SDL_SetError: function() {},
SDL_SetError: function(fmt, varargs) {},

SDL_CreateRGBSurface__deps: ['malloc', 'free'],
SDL_CreateRGBSurface__proxy: 'sync',
Expand Down Expand Up @@ -2657,14 +2657,14 @@ var LibrarySDL = {
SDL_UnlockAudio: function() {},

SDL_CreateMutex: function() { return 0 },
SDL_mutexP: function() { return 0 },
SDL_mutexV: function() { return 0 },
SDL_DestroyMutex: function() {},
SDL_mutexP: function(mutex) { return 0 },
SDL_mutexV: function(mutex) { return 0 },
SDL_DestroyMutex: function(mutex) {},

SDL_CreateCond: function() { return 0 },
SDL_CondSignal: function() {},
SDL_CondWait: function() {},
SDL_DestroyCond: function() {},
SDL_CondSignal: function(cond) {},
SDL_CondWait: function(cond, mutex) {},
SDL_DestroyCond: function(cond) {},

SDL_StartTextInput__proxy: 'sync',
SDL_StartTextInput__sig: 'v',
Expand Down Expand Up @@ -3716,30 +3716,30 @@ var LibrarySDL = {
},

// TODO:
SDL_CreateThread: function() {
SDL_CreateThread: function(fs, data, pfnBeginThread, pfnEndThread) {
throw 'SDL threads cannot be supported in the web platform because they assume shared state. See emscripten_create_worker etc. for a message-passing concurrency model that does let you run code in another thread.'
},

SDL_WaitThread: function() { throw 'SDL_WaitThread' },
SDL_GetThreadID: function() { throw 'SDL_GetThreadID' },
SDL_WaitThread: function(thread, status) { throw 'SDL_WaitThread' },
SDL_GetThreadID: function(thread) { throw 'SDL_GetThreadID' },
SDL_ThreadID: function() { return 0; },
SDL_AllocRW: function() { throw 'SDL_AllocRW: TODO' },
SDL_CondBroadcast: function() { throw 'SDL_CondBroadcast: TODO' },
SDL_CondWaitTimeout: function() { throw 'SDL_CondWaitTimeout: TODO' },
SDL_CondBroadcast: function(cond) { throw 'SDL_CondBroadcast: TODO' },
SDL_CondWaitTimeout: function(cond, mutex, ms) { throw 'SDL_CondWaitTimeout: TODO' },
SDL_WM_IconifyWindow: function() { throw 'SDL_WM_IconifyWindow TODO' },

Mix_SetPostMix: function() { warnOnce('Mix_SetPostMix: TODO') },
Mix_SetPostMix: function(func, arg) { warnOnce('Mix_SetPostMix: TODO') },

Mix_VolumeChunk: function(chunk, volume) { throw 'Mix_VolumeChunk: TODO' },
Mix_SetPosition: function(channel, angle, distance) { throw 'Mix_SetPosition: TODO' },
Mix_QuerySpec: function() { throw 'Mix_QuerySpec: TODO' },
Mix_FadeInChannelTimed: function() { throw 'Mix_FadeInChannelTimed' },
Mix_QuerySpec: function(frequency, format, channels) { throw 'Mix_QuerySpec: TODO' },
Mix_FadeInChannelTimed: function(channel, chunk, loop, ms, ticks) { throw 'Mix_FadeInChannelTimed' },
Mix_FadeOutChannel: function() { throw 'Mix_FadeOutChannel' },

Mix_Linked_Version: function() { throw 'Mix_Linked_Version: TODO' },
SDL_SaveBMP_RW: function() { throw 'SDL_SaveBMP_RW: TODO' },
SDL_SaveBMP_RW: function(surface, dst, freedst) { throw 'SDL_SaveBMP_RW: TODO' },

SDL_WM_SetIcon: function() { /* This function would set the application window icon surface, which doesn't apply for web canvases, so a no-op. */ },
SDL_WM_SetIcon: function(icon, mask) { /* This function would set the application window icon surface, which doesn't apply for web canvases, so a no-op. */ },
SDL_HasRDTSC: function() { return 0; },
SDL_HasMMX: function() { return 0; },
SDL_HasMMXExt: function() { return 0; },
Expand Down
12 changes: 6 additions & 6 deletions src/library_syscall.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ var SyscallsLibrary = {
return sock.stream.fd;
},
__syscall_getsockname__deps: ['$getSocketFromFD', '$writeSockaddr', '$DNS'],
__syscall_getsockname: function(fd, addr, addrlen) {
__syscall_getsockname: function(fd, addr, addrlen, d1, d2, d3) {
err("__syscall_getsockname " + fd);
var sock = getSocketFromFD(fd);
// TODO: sock.saddr should never be undefined, see TODO in websocket_sock_ops.getname
Expand All @@ -316,7 +316,7 @@ var SyscallsLibrary = {
return 0;
},
__syscall_getpeername__deps: ['$getSocketFromFD', '$writeSockaddr', '$DNS'],
__syscall_getpeername: function(fd, addr, addrlen) {
__syscall_getpeername: function(fd, addr, addrlen, d1, d2, d3) {
var sock = getSocketFromFD(fd);
if (!sock.daddr) {
return -{{{ cDefs.ENOTCONN }}}; // The socket is not connected.
Expand All @@ -341,7 +341,7 @@ var SyscallsLibrary = {
return -{{{ cDefs.ENOSYS }}}; // unsupported feature
},
__syscall_accept4__deps: ['$getSocketFromFD', '$writeSockaddr', '$DNS'],
__syscall_accept4: function(fd, addr, addrlen, flags) {
__syscall_accept4: function(fd, addr, addrlen, flags, d1, d2) {
var sock = getSocketFromFD(fd);
var newsock = sock.sock_ops.accept(sock);
if (addr) {
Expand Down Expand Up @@ -393,7 +393,7 @@ var SyscallsLibrary = {
return sock.sock_ops.sendmsg(sock, {{{ heapAndOffset('HEAP8', 'message') }}}, length, dest.addr, dest.port);
},
__syscall_getsockopt__deps: ['$getSocketFromFD'],
__syscall_getsockopt: function(fd, level, optname, optval, optlen) {
__syscall_getsockopt: function(fd, level, optname, optval, optlen, d1) {
var sock = getSocketFromFD(fd);
// Minimal getsockopt aimed at resolving https://github.com/emscripten-core/emscripten/issues/2211
// so only supports SOL_SOCKET with SO_ERROR.
Expand All @@ -408,7 +408,7 @@ var SyscallsLibrary = {
return -{{{ cDefs.ENOPROTOOPT }}}; // The option is unknown at the level indicated.
},
__syscall_sendmsg__deps: ['$getSocketFromFD', '$readSockaddr', '$DNS'],
__syscall_sendmsg: function(fd, message, flags) {
__syscall_sendmsg: function(fd, message, flags, d1, d2, d3) {
var sock = getSocketFromFD(fd);
var iov = {{{ makeGetValue('message', C_STRUCTS.msghdr.msg_iov, '*') }}};
var num = {{{ makeGetValue('message', C_STRUCTS.msghdr.msg_iovlen, 'i32') }}};
Expand Down Expand Up @@ -440,7 +440,7 @@ var SyscallsLibrary = {
return sock.sock_ops.sendmsg(sock, view, 0, total, addr, port);
},
__syscall_recvmsg__deps: ['$getSocketFromFD', '$writeSockaddr', '$DNS'],
__syscall_recvmsg: function(fd, message, flags) {
__syscall_recvmsg: function(fd, message, flags, d1, d2, d3) {
var sock = getSocketFromFD(fd);
var iov = {{{ makeGetValue('message', C_STRUCTS.msghdr.msg_iov, POINTER_TYPE) }}};
var num = {{{ makeGetValue('message', C_STRUCTS.msghdr.msg_iovlen, 'i32') }}};
Expand Down
16 changes: 12 additions & 4 deletions src/library_webgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3710,10 +3710,18 @@ var LibraryGL = {

#if !LEGACY_GL_EMULATION

glVertexPointer: function(){ throw 'Legacy GL function (glVertexPointer) called. If you want legacy GL emulation, you need to compile with -sLEGACY_GL_EMULATION to enable legacy GL emulation.'; },
glMatrixMode: function(){ throw 'Legacy GL function (glMatrixMode) called. If you want legacy GL emulation, you need to compile with -sLEGACY_GL_EMULATION to enable legacy GL emulation.'; },
glBegin: function(){ throw 'Legacy GL function (glBegin) called. If you want legacy GL emulation, you need to compile with -sLEGACY_GL_EMULATION to enable legacy GL emulation.'; },
glLoadIdentity: function(){ throw 'Legacy GL function (glLoadIdentity) called. If you want legacy GL emulation, you need to compile with -sLEGACY_GL_EMULATION to enable legacy GL emulation.'; },
glVertexPointer: function(size, type, stride, ptr) {
throw 'Legacy GL function (glVertexPointer) called. If you want legacy GL emulation, you need to compile with -sLEGACY_GL_EMULATION to enable legacy GL emulation.';
},
glMatrixMode: function() {
throw 'Legacy GL function (glMatrixMode) called. If you want legacy GL emulation, you need to compile with -sLEGACY_GL_EMULATION to enable legacy GL emulation.';
},
glBegin: function() {
throw 'Legacy GL function (glBegin) called. If you want legacy GL emulation, you need to compile with -sLEGACY_GL_EMULATION to enable legacy GL emulation.';
},
glLoadIdentity: function() {
throw 'Legacy GL function (glLoadIdentity) called. If you want legacy GL emulation, you need to compile with -sLEGACY_GL_EMULATION to enable legacy GL emulation.';
},

#endif // LEGACY_GL_EMULATION

Expand Down
12 changes: 6 additions & 6 deletions src/library_xlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

var LibraryXlib = {
XOpenDisplay: function() {
XOpenDisplay: function(name) {
return 1; // We support 1 display, the canvas
},

Expand All @@ -16,12 +16,12 @@ var LibraryXlib = {
return 2;
},

XChangeWindowAttributes: function(){},
XSetWMHints: function(){},
XMapWindow: function(){},
XStoreName: function(){},
XChangeWindowAttributes: function(display, window, valuemask, attributes){},
XSetWMHints: function(display, win, hints){},
XMapWindow: function(display, win){},
XStoreName: function(display, win, name){},
XInternAtom: function(display, name_, hmm) { return 0 },
XSendEvent: function(){},
XSendEvent: function(display, win, propagate, event_mask, even_send){},
XPending: function(display) { return 0 },
};

Expand Down