use text output for local doc builds, and make emcc --help read and print its docs

This commit is contained in:
Alon Zakai 2014-08-20 11:40:04 -07:00
Родитель 575d26e287
Коммит 206b05b7e8
22 изменённых файлов: 5099 добавлений и 9528 удалений

17
emcc
Просмотреть файл

@ -128,17 +128,22 @@ while response_file:
if len(sys.argv) == 1 or '--help' in sys.argv: if len(sys.argv) == 1 or '--help' in sys.argv:
this = os.path.basename('em++' if os.environ.get('EMMAKEN_CXX') else 'emcc') this = os.path.basename('em++' if os.environ.get('EMMAKEN_CXX') else 'emcc')
# Documentation for emcc and its options must be updated in:
# site/source/docs/tools_reference/emcc.rst
# A prebuilt local version of the documentation is available at:
# site/build/text/docs/tools_reference/emcc.txt
# (it is read from there and printed out when --help is invoked)
# You can also build docs locally as HTML or other formats in site/
# An online HTML version (which may be of a different version of Emscripten)
# is up at http://kripken.github.io/emscripten-site/docs/tools_reference/emcc.html
print '''%s [options] file... print '''%s [options] file...
Most normal gcc/g++/clang/clang++ options will work, for example: %s
--help Display this information
--version Display compiler version information
%s has various additional options. See site/docs/tools_reference/emcc.html
emcc: supported targets: llvm bitcode, javascript, NOT elf emcc: supported targets: llvm bitcode, javascript, NOT elf
(autoconf likes to see elf above to enable shared object support) (autoconf likes to see elf above to enable shared object support)
''' % (this, this) ''' % (this, open(shared.path_from_root('site', 'build', 'text', 'docs', 'tools_reference', 'emcc.txt')).read())
exit(0) exit(0)
elif sys.argv[1] == '--version': elif sys.argv[1] == '--version':

Двоичные данные
site/build/html/_static/Emscripten_logo_full.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 43 KiB

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1,238 +0,0 @@
/*
* doctools.js
* ~~~~~~~~~~~
*
* Sphinx JavaScript utilities for all documentation.
*
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
/**
* select a different prefix for underscore
*/
$u = _.noConflict();
/**
* make the code below compatible with browsers without
* an installed firebug like debugger
if (!window.console || !console.firebug) {
var names = ["log", "debug", "info", "warn", "error", "assert", "dir",
"dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace",
"profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i)
window.console[names[i]] = function() {};
}
*/
/**
* small helper function to urldecode strings
*/
jQuery.urldecode = function(x) {
return decodeURIComponent(x).replace(/\+/g, ' ');
};
/**
* small helper function to urlencode strings
*/
jQuery.urlencode = encodeURIComponent;
/**
* This function returns the parsed url parameters of the
* current request. Multiple values per key are supported,
* it will always return arrays of strings for the value parts.
*/
jQuery.getQueryParameters = function(s) {
if (typeof s == 'undefined')
s = document.location.search;
var parts = s.substr(s.indexOf('?') + 1).split('&');
var result = {};
for (var i = 0; i < parts.length; i++) {
var tmp = parts[i].split('=', 2);
var key = jQuery.urldecode(tmp[0]);
var value = jQuery.urldecode(tmp[1]);
if (key in result)
result[key].push(value);
else
result[key] = [value];
}
return result;
};
/**
* highlight a given string on a jquery object by wrapping it in
* span elements with the given class name.
*/
jQuery.fn.highlightText = function(text, className) {
function highlight(node) {
if (node.nodeType == 3) {
var val = node.nodeValue;
var pos = val.toLowerCase().indexOf(text);
if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) {
var span = document.createElement("span");
span.className = className;
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
node.parentNode.insertBefore(span, node.parentNode.insertBefore(
document.createTextNode(val.substr(pos + text.length)),
node.nextSibling));
node.nodeValue = val.substr(0, pos);
}
}
else if (!jQuery(node).is("button, select, textarea")) {
jQuery.each(node.childNodes, function() {
highlight(this);
});
}
}
return this.each(function() {
highlight(this);
});
};
/**
* Small JavaScript module for the documentation.
*/
var Documentation = {
init : function() {
this.fixFirefoxAnchorBug();
this.highlightSearchWords();
this.initIndexTable();
},
/**
* i18n support
*/
TRANSLATIONS : {},
PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; },
LOCALE : 'unknown',
// gettext and ngettext don't access this so that the functions
// can safely bound to a different name (_ = Documentation.gettext)
gettext : function(string) {
var translated = Documentation.TRANSLATIONS[string];
if (typeof translated == 'undefined')
return string;
return (typeof translated == 'string') ? translated : translated[0];
},
ngettext : function(singular, plural, n) {
var translated = Documentation.TRANSLATIONS[singular];
if (typeof translated == 'undefined')
return (n == 1) ? singular : plural;
return translated[Documentation.PLURALEXPR(n)];
},
addTranslations : function(catalog) {
for (var key in catalog.messages)
this.TRANSLATIONS[key] = catalog.messages[key];
this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')');
this.LOCALE = catalog.locale;
},
/**
* add context elements like header anchor links
*/
addContextElements : function() {
$('div[id] > :header:first').each(function() {
$('<a class="headerlink">\u00B6</a>').
attr('href', '#' + this.id).
attr('title', _('Permalink to this headline')).
appendTo(this);
});
$('dt[id]').each(function() {
$('<a class="headerlink">\u00B6</a>').
attr('href', '#' + this.id).
attr('title', _('Permalink to this definition')).
appendTo(this);
});
},
/**
* workaround a firefox stupidity
*/
fixFirefoxAnchorBug : function() {
if (document.location.hash && $.browser.mozilla)
window.setTimeout(function() {
document.location.href += '';
}, 10);
},
/**
* highlight the search words provided in the url in the text
*/
highlightSearchWords : function() {
var params = $.getQueryParameters();
var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : [];
if (terms.length) {
var body = $('div.body');
if (!body.length) {
body = $('body');
}
window.setTimeout(function() {
$.each(terms, function() {
body.highlightText(this.toLowerCase(), 'highlighted');
});
}, 10);
$('<p class="highlight-link"><a href="javascript:Documentation.' +
'hideSearchWords()">' + _('Hide Search Matches') + '</a></p>')
.appendTo($('#searchbox'));
}
},
/**
* init the domain index toggle buttons
*/
initIndexTable : function() {
var togglers = $('img.toggler').click(function() {
var src = $(this).attr('src');
var idnum = $(this).attr('id').substr(7);
$('tr.cg-' + idnum).toggle();
if (src.substr(-9) == 'minus.png')
$(this).attr('src', src.substr(0, src.length-9) + 'plus.png');
else
$(this).attr('src', src.substr(0, src.length-8) + 'minus.png');
}).css('display', '');
if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) {
togglers.click();
}
},
/**
* helper function to hide the search marks again
*/
hideSearchWords : function() {
$('#searchbox .highlight-link').fadeOut(300);
$('span.highlighted').removeClass('highlighted');
},
/**
* make the url absolute
*/
makeURL : function(relativeURL) {
return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL;
},
/**
* get the current relative url
*/
getCurrentURL : function() {
var path = document.location.pathname;
var parts = path.split(/\//);
$.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() {
if (this == '..')
parts.pop();
});
var url = parts.join('/');
return path.substring(url.lastIndexOf('/') + 1, path.length - 1);
}
};
// quick alias for translations
_ = Documentation.gettext;
$(document).ready(function() {
Documentation.init();
});

Двоичный файл не отображается.

Двоичный файл не отображается.

2
site/build/html/_static/jquery.js поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1,47 +0,0 @@
$( document ).ready(function() {
// Shift nav in mobile when clicking the menu.
$(document).on('click', "[data-toggle='wy-nav-top']", function() {
$("[data-toggle='wy-nav-shift']").toggleClass("shift");
$("[data-toggle='rst-versions']").toggleClass("shift");
});
// Close menu when you click a link.
$(document).on('click', ".wy-menu-vertical .current ul li a", function() {
$("[data-toggle='wy-nav-shift']").removeClass("shift");
$("[data-toggle='rst-versions']").toggleClass("shift");
});
$(document).on('click', "[data-toggle='rst-current-version']", function() {
$("[data-toggle='rst-versions']").toggleClass("shift-up");
});
// Make tables responsive
$("table.docutils:not(.field-list)").wrap("<div class='wy-table-responsive'></div>");
});
window.SphinxRtdTheme = (function (jquery) {
var stickyNav = (function () {
var navBar,
win,
stickyNavCssClass = 'stickynav',
applyStickNav = function () {
if (navBar.height() <= win.height()) {
navBar.addClass(stickyNavCssClass);
} else {
navBar.removeClass(stickyNavCssClass);
}
},
enable = function () {
applyStickNav();
win.on('resize', applyStickNav);
},
init = function () {
navBar = jquery('nav.wy-nav-side:first');
win = jquery(window);
};
jquery(init);
return {
enable : enable
};
}());
return {
StickyNav : stickyNav
};
}($));

Просмотреть файл

@ -1,31 +0,0 @@
// Underscore.js 1.3.1
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore is freely distributable under the MIT license.
// Portions of Underscore are inspired or borrowed from Prototype,
// Oliver Steele's Functional, and John Resig's Micro-Templating.
// For all details and documentation:
// http://documentcloud.github.com/underscore
(function(){function q(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source==
c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&q(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&q(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c,
h)&&!f--)break;g=!f}}d.pop();return g}var r=this,G=r._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,H=k.unshift,l=o.toString,I=o.hasOwnProperty,w=k.forEach,x=k.map,y=k.reduce,z=k.reduceRight,A=k.filter,B=k.every,C=k.some,p=k.indexOf,D=k.lastIndexOf,o=Array.isArray,J=Object.keys,s=Function.prototype.bind,b=function(a){return new m(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else r._=b;b.VERSION="1.3.1";var j=b.each=
b.forEach=function(a,c,d){if(a!=null)if(w&&a.forEach===w)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e<f;e++){if(e in a&&c.call(d,a[e],e,a)===n)break}else for(e in a)if(b.has(a,e)&&c.call(d,a[e],e,a)===n)break};b.map=b.collect=function(a,c,b){var e=[];if(a==null)return e;if(x&&a.map===x)return a.map(c,b);j(a,function(a,g,h){e[e.length]=c.call(b,a,g,h)});if(a.length===+a.length)e.length=a.length;return e};b.reduce=b.foldl=b.inject=function(a,c,d,e){var f=arguments.length>2;a==
null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=
function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(B&&a.every===B)return a.every(c,b);j(a,function(a,g,h){if(!(e=
e&&c.call(b,a,g,h)))return n});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return n});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return p&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck=
function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b<e.computed&&(e={value:a,computed:b})});
return e.value};b.shuffle=function(a){var b=[],d;j(a,function(a,f){f==0?b[0]=a:(d=Math.floor(Math.random()*(f+1)),b[f]=b[d],b[d]=a)});return b};b.sortBy=function(a,c,d){return b.pluck(b.map(a,function(a,b,g){return{value:a,criteria:c.call(d,a,b,g)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,
c,d){d||(d=b.identity);for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?e=g+1:f=g}return e};b.toArray=function(a){return!a?[]:a.toArray?a.toArray():b.isArray(a)?i.call(a):b.isArguments(a)?i.call(a):b.values(a)};b.size=function(a){return b.toArray(a).length};b.first=b.head=function(a,b,d){return b!=null&&!d?i.call(a,0,b):a[0]};b.initial=function(a,b,d){return i.call(a,0,a.length-(b==null||d?1:b))};b.last=function(a,b,d){return b!=null&&!d?i.call(a,Math.max(a.length-b,0)):a[a.length-1]};b.rest=
b.tail=function(a,b,d){return i.call(a,b==null||d?1:b)};b.compact=function(a){return b.filter(a,function(a){return!!a})};b.flatten=function(a,c){return b.reduce(a,function(a,e){if(b.isArray(e))return a.concat(c?e:b.flatten(e));a[a.length]=e;return a},[])};b.without=function(a){return b.difference(a,i.call(arguments,1))};b.uniq=b.unique=function(a,c,d){var d=d?b.map(a,d):a,e=[];b.reduce(d,function(d,g,h){if(0==h||(c===true?b.last(d)!=g:!b.include(d,g)))d[d.length]=g,e[e.length]=a[h];return d},[]);
return e};b.union=function(){return b.uniq(b.flatten(arguments,true))};b.intersection=b.intersect=function(a){var c=i.call(arguments,1);return b.filter(b.uniq(a),function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.indexOf=function(a,c,
d){if(a==null)return-1;var e;if(d)return d=b.sortedIndex(a,c),a[d]===c?d:-1;if(p&&a.indexOf===p)return a.indexOf(c);for(d=0,e=a.length;d<e;d++)if(d in a&&a[d]===c)return d;return-1};b.lastIndexOf=function(a,b){if(a==null)return-1;if(D&&a.lastIndexOf===D)return a.lastIndexOf(b);for(var d=a.length;d--;)if(d in a&&a[d]===b)return d;return-1};b.range=function(a,b,d){arguments.length<=1&&(b=a||0,a=0);for(var d=arguments[2]||1,e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;)g[f++]=a,a+=d;return g};
var F=function(){};b.bind=function(a,c){var d,e;if(a.bind===s&&s)return s.apply(a,i.call(arguments,1));if(!b.isFunction(a))throw new TypeError;e=i.call(arguments,2);return d=function(){if(!(this instanceof d))return a.apply(c,e.concat(i.call(arguments)));F.prototype=a.prototype;var b=new F,g=a.apply(b,e.concat(i.call(arguments)));return Object(g)===g?g:b}};b.bindAll=function(a){var c=i.call(arguments,1);c.length==0&&(c=b.functions(a));j(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,
c){var d={};c||(c=b.identity);return function(){var e=c.apply(this,arguments);return b.has(d,e)?d[e]:d[e]=a.apply(this,arguments)}};b.delay=function(a,b){var d=i.call(arguments,2);return setTimeout(function(){return a.apply(a,d)},b)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(i.call(arguments,1)))};b.throttle=function(a,c){var d,e,f,g,h,i=b.debounce(function(){h=g=false},c);return function(){d=this;e=arguments;var b;f||(f=setTimeout(function(){f=null;h&&a.apply(d,e);i()},c));g?h=true:
a.apply(d,e);i();g=true}};b.debounce=function(a,b){var d;return function(){var e=this,f=arguments;clearTimeout(d);d=setTimeout(function(){d=null;a.apply(e,f)},b)}};b.once=function(a){var b=false,d;return function(){if(b)return d;b=true;return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(i.call(arguments,0));return b.apply(this,d)}};b.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};
b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.defaults=function(a){j(i.call(arguments,
1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return q(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};
b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"};
b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return I.call(a,b)};b.noConflict=function(){r._=G;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};b.escape=function(a){return(""+a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")};b.mixin=function(a){j(b.functions(a),
function(c){K(c,b[c]=a[c])})};var L=0;b.uniqueId=function(a){var b=L++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/.^/,u=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||t,function(a,b){return"',_.escape("+
u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var v=function(a,c){return c?b(a).chain():a},K=function(a,c){m.prototype[a]=
function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=
true;return this};m.prototype.value=function(){return this._wrapped}}).call(this);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,466 @@
preamble.js
***********
The JavaScript APIs in preamble.js provide programmatic access for
interacting with the compiled C code, including: calling compiled C
functions, accessing memory, converting pointers to JavaScript
"Strings" and "Strings" to pointers (with different
encodings/formats), and other convenience functions.
Note: All functions should be called though the "Module" object (for
example: "Module.functionName"). At optimisation "-O2" (and higher)
function names are minified by the closure compiler, and calling
them directly will fail.
Table of Contents
^^^^^^^^^^^^^^^^^
* Calling compiled C functions from JavaScript
* Accessing memory
* Conversion functions — strings, pointers and arrays
* Run dependencies
* Stack trace
* Type accessors for Typed Arrays Mode 2
Calling compiled C functions from JavaScript
============================================
ccall(ident, returnType, argTypes, args)
Call a compiled C function from JavaScript.
The function executes a compiled C function from JavaScript and
returns the result. C++ name mangling means that "normal" C++
functions cannot be called; the function must either be defined in
a **.c** file or be a C++ function defined with "extern "C"".
// Call C from JavaScript
var result = Module.ccall('c_add', // name of C function
'number', // return type
['number', 'number'], // argument types
[10, 20]); // arguments
// result is 30
Note: * "ccall" uses the C stack for temporary values. If you
pass a
string then it is only "alive" until the call is complete. If
the code being called saves the pointer to be used later, it
may point to invalid data.
* If you need a string to live forever, you can create it, for
example, using "_malloc" and "writeStringToMemory()". However,
you must later delete it manually!
* LLVM optimizations can inline and remove functions, after
which you will not be able to call them. Similarly, function
names minified by the *Closure Compiler* are inaccessible. In
either case, the solution is to add the functions to the
"EXPORTED_FUNCTIONS" list when you invoke *emcc* :
-s EXPORTED_FUNCTIONS='["_main", "_myfunc"]'
Exported functions can be called as normal:
a_result = Module.ccall('myfunc', 'number', ['number'], 10)
Arguments:
* **ident** -- The name of the C function to be called.
* **returnType** -- The return type of the function. This will
be one of the JavaScript types "number", "string" or "array"
(use "number" for any C pointer, and "array" for JavaScript
arrays and typed arrays; note that arrays are 8-bit).
* **argTypes** -- An array of the types of arguments for the
function (if there are no arguments, this can be omitted).
Types are as in "returnType", except that "array" is not
supported as there is no way for us to know the length of the
array).
* **args** -- An array of the arguments to the function, as
native JavaScript values (as in "returnType"). Note that
string arguments will be stored on the stack (the JavaScript
string will become a C string on the stack).
Returns:
The result of the function call as a native JavaScript value (as
in "returnType").
cwrap(ident, returnType, argTypes)
Returns a native JavaScript wrapper for a C function.
This is similar to "ccall()", but returns a JavaScript function
that can be reused as many time as needed. The C function can be
defined in a C file, or be a C-compatible C++ function defined
using "extern "C"" (to prevent name mangling).
// Call C from JavaScript
var c_javascript_add = Module.cwrap('c_add', // name of C function
'number', // return type
['number', 'number']); // argument types
// Call c_javascript_add normally
console.log(c_javascript_add(10, 20)); // 30
console.log(c_javascript_add(20, 30)); // 50
Note: * "cwrap" uses the C stack for temporary values. If you
pass a
string then it is only "alive" until the call is complete. If
the code being called saves the pointer to be used later, it
may point to invalid data.
* If you need a string to live forever, you can create it, for
example, using "_malloc" and "writeStringToMemory()". However,
you must later delete it manually!
* LLVM optimizations can inline and remove functions, after
which you will not be able to "wrap" them. Similarly, function
names minified by the *Closure Compiler* are inaccessible. In
either case, the solution is to add the functions to the
"EXPORTED_FUNCTIONS" list when you invoke *emcc* :
-s EXPORTED_FUNCTIONS='["_main", "_myfunc"]'
Exported functions can be called as normal:
my_func = Module.cwrap('myfunc', 'number', ['number'])
my_func(12)
Arguments:
* **ident** -- The name of the C function to be called.
* **returnType** -- The return type of the function. This will
be one of the JavaScript types "number", "string" or "array"
(use "number" for any C pointer, and "array" for JavaScript
arrays and typed arrays; note that arrays are 8-bit).
* **argTypes** -- An array of the types of arguments for the
function (if there are no arguments, this can be omitted).
Types are as in "returnType", except that "array" is not
supported as there is no way for us to know the length of the
array).
Returns:
A JavaScript function that can be used for running the C
function.
Accessing memory
================
setValue(ptr, value, type[, noSafe])
Sets a value at a specific memory address at run-time.
Note: * "setValue()" and "getValue()" only do *aligned* writes
and
reads.
* The "type" is an LLVM IR type (one of "i8", "i16", "i32",
"i64", "float", "double", or a pointer type like "i8*" or just
"*"), not JavaScript types as used in "ccall()" or "cwrap()".
This is a lower-level operation, and we do need to care what
specific type is being used.
Arguments:
* **ptr** -- A pointer (number) representing the memory
address.
* **value** -- The value to be stored
* **type** -- An LLVM IR type as a string (see "note" above).
* **noSafe** (*bool*) -- Developers should ignore this
variable. It is only used in "SAFE_HEAP" compilation mode,
where it can help avoid infinite recursion in some specialist
use cases.
getValue(ptr, type[, noSafe])
Gets a value at a specific memory address at run-time.
Note: * "setValue()" and "getValue()" only do *aligned* writes
and
reads!
* The "type" is an LLVM IR type (one of "i8", "i16", "i32",
"i64", "float", "double", or a pointer type like "i8*" or just
"*"), not JavaScript types as used in "ccall()" or "cwrap()".
This is a lower-level operation, and we do need to care what
specific type is being used.
Arguments:
* **ptr** -- A pointer (number) representing the memory
address.
* **type** -- An LLVM IR type as a string (see "note" above).
* **noSafe** (*bool*) -- Developers should ignore this
variable. It is on used in "SAFE_HEAP" compilation mode, where
it can be avoid infinite recursion in some specialist use
cases.
Returns:
The value stored at the specified memory address.
Conversion functions — strings, pointers and arrays
===================================================
Pointer_stringify(ptr[, length])
Returns a JavaScript String from a pointer, for use in compiled
code.
Arguments:
* **ptr** -- The pointer to be converted to a "String".
* **length** -- The length of the data in the pointer
(optional).
Returns:
A JavaScript "String" containing the data from "ptr".
Return type:
String
UTF16ToString(ptr)
Given a pointer "ptr" to a null-terminated UTF16LE-encoded string
in the Emscripten HEAP, returns a copy of that string as a
Javascript "String" object.
Arguments:
* **ptr** -- A pointer to a null-terminated UTF16LE-encoded
string in the Emscripten HEAP.
Returns:
A Javascript "String" object
stringToUTF16(str, outPtr)
Copies the given JavaScript "String" object "str" to the Emscripten
HEAP at address "outPtr", null-terminated and encoded in UTF16LE
form.
The copy will require at most "(str.length*2+1)*2" bytes of space
in the HEAP.
Arguments:
* **str** (*String*) -- A JavaScript "String" object.
* **outPtr** -- Pointer to data copied from "str", encoded in
UTF16LE format and null-terminated.
UTF32ToString(ptr)
Given a pointer "ptr" to a null-terminated UTF32LE-encoded string
in the Emscripten HEAP, returns a copy of that string as a
JavaScript "String" object.
Arguments:
* **ptr** -- A pointer to a null-terminated UTF32LE-encoded
string in the Emscripten HEAP.
Returns:
A Javascript "String" object.
stringToUTF32(str, outPtr)
Copies the given JavaScript "String" object "str" to the Emscripten
HEAP at address "outPtr", null-terminated and encoded in UTF32LE
form.
The copy will require at most "(str.length+1)*4" bytes of space in
the HEAP, but can use less, since "str.length" does not return the
number of characters in the string, but the number of UTF-16 code
units in the string.
Arguments:
* **str** (*String*) -- A JavaScript "String" object.
* **outPtr** -- Pointer to data copied from "str", encoded in
encoded in UTF32LE format and null-terminated.
intArrayFromString(stringy, dontAddNull[, length])
This converts a JavaScript string into a C-line array of numbers,
0-terminated.
Arguments:
* **stringy** (*String*) -- The string to be converted.
* **dontAddNull** (*bool*) -- If "true", the new array is not
zero-terminated.
* **length** -- The length of the array (optional).
Returns:
The array created from "stringy".
intArrayToString(array)
This creates a JavaScript string from a zero-terminated C-line
array of numbers.
Arguments:
* **array** -- The array to convert.
Returns:
A "String", containing the content of "array".
writeStringToMemory(string, buffer, dontAddNull)
Writes a JavaScript string to a specified address in the heap.
// Allocate space for string and extra '0' at the end
var buffer = Module._malloc(myString.length+1);
// Write the string to memory
Module.writeStringToMemory(myString, buffer);
// We can now send buffer into a C function, it is just a normal char* pointer
Arguments:
* **string** (*String*) -- The string to write into memory.
* **buffer** (*Number*) -- The address (number) where "string"
is to be written.
* **dontAddNull** (*bool*) -- If "true", the new array is not
zero-terminated.
writeArrayToMemory(array, buffer)
Writes an array to a specified address in the heap. Note that
memory should to be allocated for the array before it is written.
Arguments:
* **array** -- The array to write to memory.
* **buffer** (*Number*) -- The address (number) where "array"
is to be written.
writeAsciiToMemory(str, buffer, dontAddNull)
Writes an ASCII string to a specified address in the heap. Note
that memory should to be allocated for the string before it is
written.
The string is assumed to only have characters in the ASCII
character set. If ASSERTIONS are enabled and this is not the case,
it will fail.
// Allocate space for string
var buffer = Module._malloc(myString.length);
// Write the string to memory
Module.writeStringToMemory(myString, buffer);
Arguments:
* **string** -- The string to write into memory.
* **buffer** -- The address where "string" is to be written.
* **dontAddNull** (*bool*) -- If "true", the new string is not
zero-terminated.
Run dependencies
================
Note that generally run dependencies are managed by the file packager
and other parts of the system. It is rare for developers to use this
API directly.
addRunDependency(id)
Adds an "id" to the list of run dependencies.
This adds a run dependency and increments the run dependency
counter.
Arguments:
* **id** (*String*) -- An arbitrary id representing the
operation.
removeRunDependency(id)
Removes a specified "id" from the list of run dependencies.
Arguments:
* **id** (*String*) -- The identifier for the specific
dependency to be removed (added with "addRunDependency()")
Stack trace
===========
stackTrace()
Returns the current stack track.
Note: The stack trace is not available at least on IE10 and
Safari 6.
Returns:
The current stack trace, if available.
Type accessors for Typed Arrays Mode 2
======================================
When using *Typed Arrays Mode 2* a typed array buffer ("ArrayBuffer")
is used to represent memory, with different views into it giving
access to the different types. The views for accessing different types
of memory are listed below.
HEAP8
View for 8-bit signed memory.
HEAP16
View for 16-bit signed memory.
HEAP32
View for 32-bit signed memory.
HEAPU8
View for 32-bit unsigned memory.
HEAPU8
View for 32-bit unsigned memory.
HEAPU16
View for 16-bit unsigned memory.
HEAPU32
View for 32-bit unsigned memory.
HEAPF32
View for 32-bit float memory.
HEAPF64
View for 64-bit float memory.

Просмотреть файл

@ -0,0 +1,518 @@
Emscripten Compiler Frontend (emcc) (under-construction)
********************************************************
**This document provides the command syntax for the Emscription
Compiler Frontend.**
Purpose
=======
The Emscripten Compiler Frontend ("emcc") is used to call the
Emscripten compiler from the command line. It is effectively a drop-in
replacement for a standard compiler like *gcc* or *clang*.
Command line syntax
===================
emcc [options] file...
The input file(s) can be either source code files that *Clang* can
handle (C or C++), LLVM bitcode in binary form, or LLVM assembly files
in human-readable form.
Supported targets include: llvm bitcode, JavaScript, NOT elf (autoconf
likes to see elf above to enable shared object support).
Arguments
---------
Most clang options will work, as will gcc options, for example:
# Display this information
emcc --help
Display compiler version information
emcc --version
To see the full list of *Clang* options supported on the version of
*Clang* used by Emscripten, run "clang --help".
Options that are modified or new in *emcc* are listed below:
"-O0"
No optimizations (default). This is the recommended setting for
starting to port a project, as it includes various assertions.
"-O1"
Simple optimizations. These include using **asm.js**, LLVM "-O1"
optimizations, relooping, removing runtime assertions and C++
exception catching, and enabling "-s ALIASING_FUNCTION_POINTERS=1".
This is the recommended setting when you want a reasonably
optimized build that is generated as quickly as possible (it builds
much faster than "-O2").
Note: * For details on the affects of different opt levels, see
"apply_opt_level()" in tools/shared.py and also
src/settings.js.
* To re-enable C++ exception catching, use "-s
DISABLE_EXCEPTION_CATCHING=0".
"-O2"
Like "-O1", but with various JavaScript-level optimizations and
LLVM "-O3" optimizations.
Note: This is the recommended setting for a release build,
offering slower compilation time in return for the smallest and
fastest output.
"-Os"
Like "-O2", but with extra optimizations for size.
"-Oz"
Like "-Os", but reduces code size even further.
"-O3"
Like "-O2", but with additional JavaScript optimizations that can
take a significant amount of compilation time and/or are relatively
new.
Note: This differs from "-O2" only during the bitcode to
JavaScript (final link and JavaScript generation) stage. It is
JavaScript- specific, so you can run "-Os" on your source files
for example, and "-O3" during JavaScript generation if you want.
For more tips on optimizing your code, see *Optimizing Code
(wiki-import)*.
"-s OPTION=VALUE"
JavaScript code generation option passed into the Emscripten
compiler. For the available options, see src/settings.js.
Note: For options that are lists, you need quotation marks (")
around the list in most shells (to avoid errors being raised).
Two examples are shown below:
-s RUNTIME_LINKED_LIBS="['liblib.so']"
-s "RUNTIME_LINKED_LIBS=['liblib.so']"
You can also specify a file from which the value would be read, for
example,
-s DEAD_FUNCTIONS=@/path/to/file
The contents of **/path/to/file** will be read, JSON.parsed and set
into "DEAD_FUNCTIONS" (so the file could contain ["_func1",
"func2"] ). Note that the path must be absolute, not relative.
"-g"
Use debug info.
* When compiling to bitcode, this is the same as in *Clang* and
*gcc* (it adds debug information to the object files).
* When compiling from source to JavaScript or bitcode to
JavaScript, it is equivalent to "-g3" (discards LLVM debug info
including C/C++ line numbers, but otherwise keeps as much debug
information as possible). Use "-g4" to get line number debugging
information in JavaScript.
"-g<level>"
Controls how much debug information is kept when compiling from
bitcode to JavaScript. Each of these levels builds on the previous:
* "-g0": Make no effort to keep code debuggable. Will discard
LLVM debug information (default in "O1" and higher).
* "-g1": Preserve (do not minify) whitespace.
* "-g2": Preserve function names.
* "-g3": Preserve variable names.
* "-g4": Preserve LLVM debug information. If "-g" was used
when compiling the C/C++ sources, show line number debug
comments, and generate source maps. This is the highest level
of debuggability.
Note: This may make compilation at optimization level
"-O1" and above significantly slower, because JavaScript
optimization will be limited to one core (default in
"-O0").
"-profiling"
Use reasonable defaults when emitting JavaScript to make the build
useful for profiling. This sets "-g2" (preserve function names) and
may also enable optimizations that affect performance and otherwise
might not be performed in "-g2".
"--emit-symbol-map"
Save a map file between the minified global names and the original
function names. This allows you, for example, to reconstruct
meaningful stack traces.
Note: This is only relevant when *minifying* global names, which
happens in "-O2" and above, and when no "-g" option was specified
to prevent minification.
"--typed-arrays <mode>"
Set the *typed array mode*. Possible values are:
* "0": No typed arrays.
* "1": Parallel typed arrays.
* "2": Shared (C-like) typed arrays (default).
"--js-opts <level>"
Possible "level" values are:
* "0": Prevent JavaScript optimizer from running.
* "1": Use JavaScript optimizer (default).
"--llvm-opts <level>"
Possible "level" values are:
* "0": No LLVM optimizations (default in -O0).
* "1": LLVM "-O1" optimizations (default in -O1).
* "2": LLVM "-O2" optimizations.
* "3": LLVM "-O3" optimizations (default in -O2+).
You can also specify arbitrary LLVM options, e.g.:
--llvm-opts "['-O3', '-somethingelse']"
"--llvm-lto <level>"
Possible "level" values are:
* "0": No LLVM LTO (default).
* "1": LLVM LTO is performed.
* "2": Combine all the bitcode and run LLVM opt "-O3" on it.
This optimizes across modules, but is not the same as normal
LTO.
* "3": Does level "2" and then level "1".
Note: * If LLVM optimizations are not run (see "--llvm-opts"),
this
setting has no effect.
* LLVM LTO is not perfectly stable yet, and can can cause code
to behave incorrectly.
.
"--closure <on>"
Runs the *Closure Compiler*. Possible "on" values are:
* "0": No closure compiler (default in "-O2" and below).
* "1": Run closure compiler. This greatly reduces code size
and may in some cases increase runtime speed (although the
opposite can also occur). Note that it takes time to run, and
may require some changes to the code.
In **asm.js** mode, closure will only be used on the 'shell' code
around the compiled code (the compiled code will be processed by
the custom **asm.js** minifier).
Note: * If closure compiler hits an out-of-memory, try adjusting
"JAVA_HEAP_SIZE" in the environment (for example, to 4096m for
4GB).
* Closure is only run if JavaScript opts are being done ("-O2"
or above, or "--js-opts 1").
"--pre-js <file>"
Specify a file whose contents are added before the generated code.
This is done *before* optimization, so it will be minified properly
if the *Closure Compiler* is run.
"--post-js <file>"
Specify a file whose contents are added after the generated code.
This is done *before* optimization, so it will be minified properly
if the *Closure Compiler* is run.
"--embed-file <file>"
Specify a file (with path) to embed inside the generated
JavaScript. The path is relative to the current directory at
compile time. If a directory is passed here, its entire contents
will be embedded.
For example, if the command includes "--embed-file dir/file.dat",
then "dir/file.dat" must exist relative to the directory where you
run *emcc*.
Note: Embedding files is much less efficient than *preloading*
them. You should only use it for small amounts of small files.
Instead, use "--preload-file" which emits efficient binary data.
"--preload-file <name>"
Specify a file to preload before running the compiled code
asynchronously. The path is relative to the current directory at
compile time. If a directory is passed here, its entire contents
will be embedded.
Preloaded files are stored in **filename.data**, where
**filename.html** is the main file you are compiling to. To run
your code, you will need both the **.html** and the **.data**.
Note: This option is similar to *--embed-file*, except that it is
only relevant when generating HTML (it uses asynchronous binary
*XHRs*), or JavaScript that will be used in a web page.
*emcc* runs tools/file_packager.py to do the actual packaging of
embedded and preloaded files. You can run the file packager
yourself if you want (see the documentation inside that file). You
should then put the output of the file packager in an emcc "--pre-
js", so that it executes before your main compiled code.
For more information about the "--preload-file" options, see
*Filesystem Guide (wiki-import)*.
"--exclude-file <name>"
Files and directories to be excluded from *--embed-file* and
*--preload-file*. Wildcard is supported.
"--shell-file <path>"
The path name to a skeleton HTML file used when generating HTML
output. The shell file used needs to have this token inside it:
"{{{ SCRIPT }}}".
Note: * See src/shell.html and src/shell_minimal.html for
examples.
* This argument is ignored if a target other than HTML is
specified using the "-o" option.
"--compression <codec>"
Compress both the compiled code and embedded/ preloaded files.
Warning: This option is deprecated.
"<codec>" should be a triple:
"<native_encoder>,<js_decoder>,<js_name>", where:
* "native_encoder" is a native executable that compresses
"stdin" to "stdout" (the simplest possible interface).
* "js_decoder" is a JavaScript file that implements a decoder.
* "js_name" is the name of the function to call in the decoder
file (which should receive an array/typed array and return an
array/typed array.
Compression only works when generating HTML. When compression is
on, all files specified to be preloaded are compressed in one big
archive, which is given the same name as the output HTML but with
suffix **.data.compress**.
"--minify 0"
Identical to "-g1".
"--js-transform <cmd>"
Specifies a "<cmd>" to be called on the generated code before it is
optimized. This lets you modify the JavaScript, for example adding
or removing some code, in a way that those modifications will be
optimized together with the generated code.
"<cmd>" will be called with the file name of the generated code as
a parameter. To modify the code, you can read the original data and
then append to it or overwrite it with the modified data.
"<cmd>" is interpreted as a space-separated list of arguments, for
example, "<cmd>" of **python processor.py** will cause a Python
script to be run.
"--split <size>"
Splits the resulting JavaScript file into pieces to ease debugging.
Warning: This option is deprecated (modern JavaScript debuggers
should work even on large files).
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 this 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 the "-g" option this 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".
"--bind"
Compiles the source code using the *embind (wiki-import)* bindings
approach, which connects C/C++ and JavaScript.
"--ignore-dynamic-linking"
Tells the compiler to ignore dynamic linking (the user will need to
manually link to the shared libraries later on).
Normally *emcc* will simply link in code from the dynamic library
as though it were statically linked, which will fail if the same
dynamic library is linked more than once. With this option, dynamic
linking is ignored, which allows the build system to proceed
without errors.
"--js-library <lib>"
A JavaScript library to use in addition to those in Emscripten's
core libraries (src/library_*).
"-v"
Turns on verbose output.
This will pass "-v" to *Clang*, and also enable "EMCC_DEBUG" (gets
intermediate files for the compilers various stages). It will also
run Emscripten's internal sanity checks on the toolchain, etc.
Tip: "emcc -v" is a useful tool for diagnosing errors. It works
with or without other arguments.
"--clear-cache"
Manually clears the cache of compiled Emscripten system libraries
(libc++, libc++abi, libc).
This is normally handled automatically, but if you update LLVM in-
place (instead of having a different directory for a new version),
the caching mechanism can get confused. Clearing the cache can fix
weird problems related to cache incompatibilities, like *Clang*
failing to link with library files. This also clears other cached
data like the jcache and the bootstrapped relooper. After the cache
is cleared, this process will exit.
"--save-bc PATH"
When compiling to JavaScript or HTML, this option will save a copy
of the bitcode to the specified path. The bitcode will include all
files being linked after link-time optimizations have been
performed (if any), including standard libraries.
"--memory-init-file <on>"
Specifies whether to emit a separate memory initialization file.
Possible "on" values are:
* "0": Do not emit a separate memory initialization file
(default). Instead keep the static initialization inside the
generated JavaScript as text.
* "1": Emit a separate memory initialization file in binary
format. This is more efficient than storing it as text inside
JavaScript, but does mean you have another file to publish.
The binary file will also be loaded asynchronously, which
means "main()" will not be called until the file is downloaded
and applied; you cannot call any C functions until it arrives.
Note: Call yourself from "main()" to know when all asynchronous
processing has completed and it is safe to call library
functions, as "main()" will only be called at that time. You can
also call "addOnPreMain" from a "preRun".
"-Wno-warn-absolute-paths"
Suppress warnings about the use of absolute paths in "-I" and "-L"
command line directives. This is used to hide the warnings and
acknowledge that the explicit use of absolute paths is intentional.
"--proxy-to-worker"
Runs the main application code in a worker, proxying events to it
and output from it. If emitting HTML, this emits a **.html** and a
**.js** file, with the JavaScript to be run in a worker. If
emitting JavaScript, the target file name contains the part to be
run on the main thread, while a second **.js** file with suffix
".worker.js" will contain the worker portion.
"--emrun"
Enables the generated output to be aware of the *emrun* command
line tool. This allows "stdout", "stderr" and "exit(returncode)"
capture when running the generated application through *emrun*.
"--em-config"
Specifies the location of the **.emscripten** configuration file
for the current compiler run. If not specified, the environment
variable "EM_CONFIG" is first read for this location. If neither
are specified, the default location **~/.emscripten** is used.
"--default-obj-ext .ext"
Specifies the file suffix to generate if the location of a
directory name is passed to the "-o" directive.
For example, consider the following command which will by default
generate an output name **dir/a.o**. With "--default-obj-ext .ext"
the generated file has the custom suffix *dir/a.ext*.
emcc -c a.c -o dir/
"--valid_abspath path"
Whitelist an absolute path to prevent warnings about absolute
include paths.
"-o <target>"
The "target" file name extension defines what type of output be
generated:
* <name> **.js** : JavaScript.
* <name> **.html** : HTML + separate JavaScript file
(**<name>.js**). Having the separate JavaScript file improves
page load time.
* <name> **.bc** : LLVM bitcode (default).
* <name> **.o** : LLVM bitcode (same as .bc).
Note: If "--memory-init-file" is used, then in addition to the
**.js** or **.html** file which is generated, a **.mem** file
will also be created.
"-c"
Tells *gcc* not to run the linker and causes LLVM bitcode to be
generated, as *emcc* only generates JavaScript in the final linking
stage of building.
Environment variables
=====================
*emcc* is affected by several environment variables, as listed below:
* "EMMAKEN_JUST_CONFIGURE"
* "EMMAKEN_JUST_CONFIGURE_RECURSE"
* "EMCONFIGURE_JS"
* "CONFIGURE_CC"
* "EMMAKEN_CXX"
* "EMMAKEN_CXX"
* "EMMAKEN_COMPILER"
* "EMMAKEN_CFLAGS"
* "EMCC_DEBUG"
* "EMCC_FAST_COMPILER"
Search for 'os.environ' in emcc to see how these are used. The most
interesting is possibly "EMCC_DEBUG", which forces the compiler to
dump its build and temporary files to a temporary directory where they
can be reviewed.

Просмотреть файл

@ -11,7 +11,7 @@ Emscripten Compiler Frontend (emcc) (under-construction)
Purpose Purpose
============================================ ============================================
The Emscripten Compiler Frontend (``emcc``) is used to call the Emscripten compiler from the command line. It is effectively a drop-in replacement for a standard compiler like *gcc*. The Emscripten Compiler Frontend (``emcc``) is used to call the Emscripten compiler from the command line. It is effectively a drop-in replacement for a standard compiler like *gcc* or *clang*.
Command line syntax Command line syntax

Просмотреть файл

@ -1,11 +1,12 @@
// === Auto-generated preamble library stuff === // === Preamble library stuff ===
// Documentation for the public APIs defined in this file must be updated in: // Documentation for the public APIs defined in this file must be updated in:
// /emscripten/site/source/docs/api_reference/preamble.js.rst // site/source/docs/api_reference/preamble.js.rst
// A prebuilt version of the documentation is available at: // A prebuilt local version of the documentation is available at:
// /emscripten/site/build/html/docs/api_reference/preamble.js.html // site/build/text/docs/api_reference/preamble.js.txt
// // You can also build docs locally as HTML or other formats in site/
// The code can be used permissively under the MIT license. // An online HTML version (which may be of a different version of Emscripten)
// is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html
//======================================== //========================================
// Runtime code shared with compiler // Runtime code shared with compiler

Просмотреть файл

@ -3,16 +3,15 @@
/** /**
* This file contains a few useful things for compiling C/C++ code * This file contains a few useful things for compiling C/C++ code
* with Emscripten, an LLVM-to-JavaScript compiler. * with Emscripten.
* *
* Documentation for the public APIs defined in this file must be updated in * Documentation for the public APIs defined in this file must be updated in:
* /emscripten/site/source/docs/api_reference/emscripten.h.rst * site/source/docs/api_reference/emscripten.h.rst
* A prebuilt version of the documentation is available at: * A prebuilt local version of the documentation is available at:
* /emscripten/site/build/html/docs/api_reference/emscripten.h.html * site/build/text/docs/api_reference/emscripten.h.txt
* * You can also build docs locally as HTML or other formats in site/
* The code can be used permissively under the MIT license. * An online HTML version (which may be of a different version of Emscripten)
* * is up at http://kripken.github.io/emscripten-site/docs/api_reference/emscripten.h.html
* http://emscripten.org
*/ */
#ifdef __cplusplus #ifdef __cplusplus

Просмотреть файл

@ -8,12 +8,12 @@ extern "C" {
/* This file defines Emscripten low-level glue bindings for interfacing with HTML5 APIs /* This file defines Emscripten low-level glue bindings for interfacing with HTML5 APIs
* *
* Documentation for the public APIs defined in this file must be updated in: * Documentation for the public APIs defined in this file must be updated in:
* /emscripten/site/source/docs/api_reference/html5.h.rst * site/source/docs/api_reference/html5.h.rst
* A prebuilt version of the documentation is available at: * A prebuilt local version of the documentation is available at:
* /emscripten/site/build/html/docs/api_reference/html5.h.html * site/build/text/docs/api_reference/html5.h.txt
* * You can also build docs locally as HTML or other formats in site/
* The code can be used permissively under the MIT license. * An online HTML version (which may be of a different version of Emscripten)
* * is up at http://kripken.github.io/emscripten-site/docs/api_reference/html5.h.html
*/ */
#define EMSCRIPTEN_EVENT_KEYPRESS 1 #define EMSCRIPTEN_EVENT_KEYPRESS 1

Просмотреть файл

@ -32,6 +32,7 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P
# --help # --help
output = Popen([PYTHON, compiler, '--help'], stdout=PIPE, stderr=PIPE).communicate() output = Popen([PYTHON, compiler, '--help'], stdout=PIPE, stderr=PIPE).communicate()
self.assertContained('Display this information', output[0]) self.assertContained('Display this information', output[0])
self.assertContained('Most clang options will work', output[0])
# emcc src.cpp ==> writes a.out.js # emcc src.cpp ==> writes a.out.js
self.clear() self.clear()