Oops, that's a bug, sorry about that. Fixed on incoming and added a
testcase so we don't regress it again. Let me know if that didn't fix your
issue.

- Alon



On Tue, Jan 14, 2014 at 4:10 PM, Matthew Casperson <
[email protected]> wrote:

> I have defined Module['print'] to be a function that takes the console
> text and sets it as the return value (taken from pre.js at
> https://github.com/kripken/xml.js/blob/master/pre.js). I recently updated
> emscripten, and now my function assigned to Module['print'] doesn't work.
> Looking through the generated code, and a function is assigned to
> Module['print'] without checking to see if it already exists.
>
> else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
>   Module['read'] = function read(url) {
>     var xhr = new XMLHttpRequest();
>     xhr.open('GET', url, false);
>     xhr.send(null);
>     return xhr.responseText;
>   };
>   if (typeof arguments != 'undefined') {
>     Module['arguments'] = arguments;
>   }
>   if (typeof console !== 'undefined') {
>     Module['print'] = function print(x) { // *********************** This
> overwrites an existing  Module['print'] function
>       console.log(x);
>     };
>     Module['printErr'] = function printErr(x) {
>       console.log(x);
>     };
>   } else {
>     // Probably a worker, and without console.log. We can do very little
> here...
>     var TRY_USE_DUMP = false;
>     Module['print'] = (TRY_USE_DUMP && (typeof(dump) !== "undefined") ?
> (function(x) {
>       dump(x);
>     }) : (function(x) {
>       // self.postMessage(x); // enable this if you want stdout to be sent
> as messages
>     }));
>   }
>   if (ENVIRONMENT_IS_WEB) {
>     this['Module'] = Module;
>   } else {
>     Module['load'] = importScripts;
>   }
> }
>
> Is it still valid to assign a function to Module['print'] in a pre.js
> file, or is this now accomplished another way?
>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to