aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS3
-rwxr-xr-xemcc38
-rw-r--r--src/compiler.js31
-rw-r--r--src/jsifier.js19
-rw-r--r--src/library.js119
-rw-r--r--src/library_browser.js9
-rw-r--r--src/library_glut.js10
-rw-r--r--src/library_sdl.js3
-rw-r--r--src/library_xlib.js3
-rw-r--r--src/modules.js5
-rw-r--r--src/settings.js10
-rw-r--r--system/include/net/arpa/inet.h4
-rw-r--r--system/include/sys/ioctl.h2
-rw-r--r--system/include/sys/socket.h1
-rw-r--r--system/lib/dlmalloc.c1
-rwxr-xr-xtests/runner.py259
-rwxr-xr-xtests/socket_server.sh3
-rw-r--r--tests/websockets.c125
-rw-r--r--third_party/websockify/.gitignore10
-rw-r--r--third_party/websockify/CHANGES.txt18
-rw-r--r--third_party/websockify/LICENSE.txt11
-rw-r--r--third_party/websockify/MANIFEST.in1
-rw-r--r--third_party/websockify/Makefile11
-rw-r--r--third_party/websockify/README.md155
-rw-r--r--third_party/websockify/Windows/Windows Service Readme.txt39
-rw-r--r--third_party/websockify/Windows/noVNC Websocket Service Project/Program.cs24
-rw-r--r--third_party/websockify/Windows/noVNC Websocket Service Project/ProjectInstaller.Designer.cs61
-rw-r--r--third_party/websockify/Windows/noVNC Websocket Service Project/ProjectInstaller.cs19
-rw-r--r--third_party/websockify/Windows/noVNC Websocket Service Project/ProjectInstaller.resx129
-rw-r--r--third_party/websockify/Windows/noVNC Websocket Service Project/Properties/AssemblyInfo.cs36
-rw-r--r--third_party/websockify/Windows/noVNC Websocket Service Project/Service1.Designer.cs37
-rw-r--r--third_party/websockify/Windows/noVNC Websocket Service Project/Service1.cs41
-rw-r--r--third_party/websockify/Windows/noVNC Websocket Service Project/noVNC Websocket.csproj75
-rw-r--r--third_party/websockify/Windows/noVNC Websocket Service Project/noVNC Websocket.sln20
-rw-r--r--third_party/websockify/docs/LICENSE.GPL-3621
-rw-r--r--third_party/websockify/docs/LICENSE.LGPL-3165
-rw-r--r--third_party/websockify/docs/TODO9
-rw-r--r--third_party/websockify/docs/flash_policy.txt4
-rw-r--r--third_party/websockify/docs/latency_results.txt114
-rw-r--r--third_party/websockify/docs/notes17
-rw-r--r--third_party/websockify/docs/release.txt9
-rw-r--r--third_party/websockify/docs/websockify.1110
-rw-r--r--third_party/websockify/include/VT100.js919
-rw-r--r--third_party/websockify/include/base64.js147
-rw-r--r--third_party/websockify/include/keysym.js99
-rw-r--r--third_party/websockify/include/util.js303
-rw-r--r--third_party/websockify/include/web-socket-js/README.txt109
-rw-r--r--third_party/websockify/include/web-socket-js/WebSocketMain.swfbin0 -> 177114 bytes
-rw-r--r--third_party/websockify/include/web-socket-js/swfobject.js4
-rwxr-xr-xthird_party/websockify/include/web-socket-js/web_socket.js391
-rw-r--r--third_party/websockify/include/websock.js427
-rw-r--r--third_party/websockify/include/webutil.js148
-rw-r--r--third_party/websockify/include/wsirc.js235
-rw-r--r--third_party/websockify/include/wstelnet.js335
-rw-r--r--third_party/websockify/other/Makefile14
-rw-r--r--third_party/websockify/other/README.md51
-rwxr-xr-xthird_party/websockify/other/launch.sh108
-rw-r--r--third_party/websockify/other/project.clj13
-rw-r--r--third_party/websockify/other/websocket.c802
-rw-r--r--third_party/websockify/other/websocket.h84
-rw-r--r--third_party/websockify/other/websocket.rb456
-rw-r--r--third_party/websockify/other/websockify.c385
-rw-r--r--third_party/websockify/other/websockify.clj233
-rw-r--r--third_party/websockify/other/websockify.js141
-rwxr-xr-xthird_party/websockify/other/websockify.rb171
-rwxr-xr-xthird_party/websockify/other/wswrap22
-rwxr-xr-xthird_party/websockify/rebind18
-rw-r--r--third_party/websockify/rebind.c94
-rwxr-xr-xthird_party/websockify/run5
-rw-r--r--third_party/websockify/setup.py30
-rwxr-xr-xthird_party/websockify/tests/b64_vs_utf8.py29
-rw-r--r--third_party/websockify/tests/base64.html91
-rw-r--r--third_party/websockify/tests/base64.js12
-rw-r--r--third_party/websockify/tests/echo.html148
-rwxr-xr-xthird_party/websockify/tests/echo.py75
-rwxr-xr-xthird_party/websockify/tests/echo.rb62
l---------third_party/websockify/tests/include1
-rw-r--r--third_party/websockify/tests/latency.html290
l---------third_party/websockify/tests/latency.py1
-rw-r--r--third_party/websockify/tests/load.html250
-rwxr-xr-xthird_party/websockify/tests/load.py167
-rw-r--r--third_party/websockify/tests/plain_echo.html168
-rw-r--r--third_party/websockify/tests/simple.html68
-rwxr-xr-xthird_party/websockify/tests/utf8-list.py22
l---------third_party/websockify/websockify.py1
-rw-r--r--third_party/websockify/websockify/__init__.py2
-rw-r--r--third_party/websockify/websockify/websocket.py965
-rwxr-xr-xthird_party/websockify/websockify/websocketproxy.py390
-rw-r--r--third_party/websockify/wsirc.html99
-rw-r--r--third_party/websockify/wstelnet.html74
-rw-r--r--tools/file_packager.py7
-rw-r--r--tools/js-optimizer.js39
-rw-r--r--tools/settings_template_readonly.py10
-rw-r--r--tools/shared.py50
-rwxr-xr-xtools/split.py94
95 files changed, 11177 insertions, 63 deletions
diff --git a/AUTHORS b/AUTHORS
index c78ee543..e30a10ea 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -26,7 +26,7 @@ a license to everyone to use it as detailed in LICENSE.)
* Jon Bardin <diclophis@gmail.com>
* Jukka Jylänki <jujjyl@gmail.com>
* Aleksander Guryanov <caiiiycuk@gmail.com>
-* Chad Austin <chad@chadaustin.me>
+* Chad Austin <chad@chadaustin.me> (copyright owned by IMVU)
* nandhp <nandhp@gmail.com>
* YeZhongWen <linghuye2.0@gmail.com>
* Xingxing Pan <forandom@gmail.com>
@@ -37,3 +37,4 @@ a license to everyone to use it as detailed in LICENSE.)
* Benjamin Stover <benjamin.stover@gmail.com>
* Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
* Janus Troelsen <janus.troelsen@stud.tu-darmstadt.de>
+* Lars Schneider <lars.schneider@autodesk.com> (copyright owned by Autodesk, Inc.) \ No newline at end of file
diff --git a/emcc b/emcc
index 97bc2f68..1dc9b756 100755
--- a/emcc
+++ b/emcc
@@ -268,6 +268,27 @@ Options that are modified or new in %s include:
will not minify the code (closure does
that)
+ --split <size> Splits the resulting javascript file into pieces
+ to ease debugging. This option only works if
+ Javascript is generated (target -o <name>.js).
+ Files with function declarations must be loaded
+ before main file upon execution.
+
+ Without "-g" option:
+ Creates files with function declarations up
+ to the given size with the suffix
+ "_functions.partxxx.js" and a main file with
+ the suffix ".js".
+
+ With "-g" option:
+ Recreates the directory structure of the C
+ source files and stores function declarations
+ in their respective C files with the suffix
+ ".js". If such a file exceeds the given size,
+ files with the suffix ".partxxx.js" are created.
+ The main file resides in the base directory and
+ has the suffix ".js".
+
--ignore-dynamic-linking Normally emcc will treat dynamic linking like
static linking, by linking in the code from
the dynamic library. This fails if the same
@@ -471,6 +492,7 @@ try:
pre_js = ''
post_js = ''
minify_whitespace = None
+ split_js_file = None
preload_files = []
embed_files = []
compression = None
@@ -527,6 +549,11 @@ try:
minify_whitespace = int(newargs[i+1])
newargs[i] = ''
newargs[i+1] = ''
+ elif newargs[i].startswith('--split'):
+ check_bad_eq(newargs[i])
+ split_js_file = int(newargs[i+1])
+ newargs[i] = ''
+ newargs[i+1] = ''
elif newargs[i].startswith('--embed-file'):
check_bad_eq(newargs[i])
embed_files.append(newargs[i+1])
@@ -601,6 +628,9 @@ try:
newargs[i+1] = ''
newargs = [ arg for arg in newargs if arg is not '' ]
+ if split_js_file:
+ settings_changes.append("PRINT_SPLIT_FILE_MARKER=1")
+
# Find input files
input_files = []
@@ -1071,8 +1101,12 @@ try:
html.close()
else:
- # copy final JS to output
- shutil.move(final, target)
+ if split_js_file:
+ from tools.split import split_javascript_file
+ split_javascript_file(final, unsuffixed(target), split_js_file)
+ else:
+ # copy final JS to output
+ shutil.move(final, target)
finally:
if not TEMP_DIR:
diff --git a/src/compiler.js b/src/compiler.js
index 89da32d5..2863afda 100644
--- a/src/compiler.js
+++ b/src/compiler.js
@@ -31,15 +31,30 @@ if (ENVIRONMENT_IS_NODE) {
var nodeFS = require('fs');
var nodePath = require('path');
- read = function(filename) {
- filename = nodePath['normalize'](filename);
- var ret = nodeFS['readFileSync'](filename).toString();
- // The path is absolute if the normalized version is the same as the resolved.
- if (!ret && filename != nodePath['resolve'](filename)) {
- filename = path.join(__dirname, '..', 'src', filename);
- ret = nodeFS['readFileSync'](filename).toString();
+ if (!nodeFS.existsSync) {
+ nodeFS.existsSync = function(path) {
+ try {
+ return !!nodeFS.readFileSync(path);
+ } catch(e) {
+ return false;
+ }
+ }
+ }
+
+ function find(filename) {
+ var prefixes = [__dirname, process.cwd()];
+ for (var i = 0; i < prefixes.length; ++i) {
+ var combined = nodePath.join(prefixes[i], filename);
+ if (nodeFS.existsSync(combined)) {
+ return combined;
+ }
}
- return ret;
+ return filename;
+ }
+
+ read = function(filename) {
+ var absolute = find(filename);
+ return nodeFS['readFileSync'](absolute).toString();
};
load = function(f) {
diff --git a/src/jsifier.js b/src/jsifier.js
index 01ecd7d3..8021f8a1 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -32,7 +32,7 @@ function JSify(data, functionsOnly, givenFunctions) {
// else. This lets us not hold any strings in memory, we simply print
// things out as they are ready.
- var shellFile = BUILD_AS_SHARED_LIB ? 'shell_sharedlib.js' : 'shell.js';
+ var shellFile = SHELL_FILE ? SHELL_FILE : (BUILD_AS_SHARED_LIB ? 'shell_sharedlib.js' : 'shell.js');
var shellParts = read(shellFile).split('{{BODY}}');
print(shellParts[0]);
var preFile = BUILD_AS_SHARED_LIB ? 'preamble_sharedlib.js' : 'preamble.js';
@@ -522,6 +522,11 @@ function JSify(data, functionsOnly, givenFunctions) {
func.JS += ' */\n';
}
+ if (PRINT_SPLIT_FILE_MARKER) {
+ func.JS += '\n//FUNCTION_BEGIN_MARKER\n'
+ var associatedSourceFile = "NO_SOURCE";
+ }
+
func.JS += 'function ' + func.ident + '(' + paramIdents.join(', ') + ') {\n';
if (PROFILE) {
@@ -572,6 +577,13 @@ function JSify(data, functionsOnly, givenFunctions) {
if (EXECUTION_TIMEOUT > 0) {
ret += indent + 'if (Date.now() - START_TIME >= ' + (EXECUTION_TIMEOUT*1000) + ') throw "Timed out!" + (new Error().stack);\n';
}
+
+ if (PRINT_SPLIT_FILE_MARKER && Debugging.on && Debugging.getAssociatedSourceFile(line.lineNum)) {
+ // Overwrite the associated source file for every line. The last line should contain the source file associated to
+ // the return value/address of outer most block (the marked function).
+ associatedSourceFile = Debugging.getAssociatedSourceFile(line.lineNum);
+ }
+
// for special labels we care about (for phi), mark that we visited them
return ret + label.lines.map(function(line) { return line.JS + (Debugging.on ? Debugging.getComment(line.lineNum) : '') })
.join('\n')
@@ -653,6 +665,11 @@ function JSify(data, functionsOnly, givenFunctions) {
func.JS += ' return' + (func.returnType !== 'void' ? ' null' : '') + ';\n';
}
func.JS += '}\n';
+
+ if (PRINT_SPLIT_FILE_MARKER) {
+ func.JS += '\n//FUNCTION_END_MARKER_OF_SOURCE_FILE_' + associatedSourceFile + '\n';
+ }
+
if (func.ident in EXPORTED_FUNCTIONS) {
func.JS += 'Module["' + func.ident + '"] = ' + func.ident + ';';
}
diff --git a/src/library.js b/src/library.js
index 1c150bc9..938a3c92 100644
--- a/src/library.js
+++ b/src/library.js
@@ -4850,6 +4850,7 @@ LibraryManager.library = {
// RTTI hacks for exception handling, defining type_infos for common types.
// The values are dummies. We simply use the addresses of these statically
// allocated variables as unique identifiers.
+ _ZTIb: [0], // bool
_ZTIi: [0], // int
_ZTIj: [0], // unsigned int
_ZTIl: [0], // long
@@ -4863,7 +4864,7 @@ LibraryManager.library = {
_ZTIa: [0], // signed char
_ZTIh: [0], // unsigned char
_ZTIs: [0], // short
- _ZTIt: [0], // signed short
+ _ZTIt: [0], // unsigned short
_ZTIv: [0], // void
_ZTIPv: [0], // void*
@@ -6314,6 +6315,122 @@ LibraryManager.library = {
ntohl: 'htonl',
ntohs: 'htons',
+ inet_pton__deps: ['__setErrNo', '$ERRNO_CODES'],
+ inet_pton: function(af, src, dst) {
+ // int af, const char *src, void *dst
+ if ((af ^ {{{ cDefine("AF_INET") }}}) !== 0) { ___setErrNo(ERRNO_CODES.EAFNOSUPPORT); return -1; }
+ var b = Pointer_stringify(src).split(".");
+ if (b.length !== 4) return 0;
+ var ret = Number(b[0]) | (Number(b[1]) << 8) | (Number(b[2]) << 16) | (Number(b[3]) << 24);
+ if (isNaN(ret)) return 0;
+ setValue(dst, ret, 'i32');
+ return 1;
+ },
+
+ _inet_ntop_raw: function(addr) {
+ return (addr & 0xff) + '.' + ((addr >> 8) & 0xff) + '.' + ((addr >> 16) & 0xff) + '.' + ((addr >> 24) & 0xff)
+ },
+
+ inet_ntop__deps: ['_inet_ntop_raw'],
+ inet_ntop: function(af, src, dst, size) {
+ var addr = getValue(src, 'i32');
+ var str = __inet_ntop_raw(addr);
+ writeStringToMemory(str.substr(0, size), dst, true);
+ return dst;
+ },
+
+ // ==========================================================================
+ // sockets
+ // ==========================================================================
+
+ $Sockets__deps: ['__setErrNo', '$ERRNO_CODES'],
+ $Sockets: {
+ BUFFER_SIZE: 10*1024,
+ nextFd: 1,
+ fds: {},
+ sockaddr_in_layout: Runtime.generateStructInfo([
+ ['i16', 'sin_family'],
+ ['i16', 'sin_port'],
+ ['i32', 'sin_addr'],
+ ['i64', 'sin_zero'],
+ ]),
+ },
+
+ socket__deps: ['$Sockets'],
+ socket: function(family, type, protocol) {
+ var fd = Sockets.nextFd++;
+ Sockets.fds[fd] = {
+ connected: false
+ };
+ return fd;
+ },
+
+ connect__deps: ['$Sockets', '_inet_ntop_raw', 'ntohs'],
+ connect: function(fd, addr, addrlen) {
+ var info = Sockets.fds[fd];
+ if (!info) return -1;
+ info.connected = true;
+ info.addr = getValue(addr + Sockets.sockaddr_in_layout.sin_addr, 'i32');
+ info.port = _ntohs(getValue(addr + Sockets.sockaddr_in_layout.sin_port, 'i16'));
+ inf