Great, there's also positive news: the .js files work under Nashorn of Java 
8, so my wish is satisfied :), just that java 8 is not at all common yet. 
On closer look, rhino fails in the first line of this function:

  function parseJSFunc(jsfunc) {
    // Match the body and the return value of a javascript function source
    var parsed = jsfunc.toString().match(sourceRegex).slice(1);
    return {arguments : parsed[0], body : parsed[1], returnValue: parsed[2]}
  }

Should I report this as a bug? I am too lame for a pull request, but it 
seems to be due to either a bug or a lack of a feature in rhino.

On Tuesday, July 29, 2014 2:30:01 PM UTC+2, jj wrote:
>
> If there are no line breaks, you have made a minified optimized build. Try 
> making a nonminified build by passing -g2 on the link line. Bugs can be 
> reported to emscripten github repo issue tracker.
> On Jul 29, 2014 3:27 PM, <[email protected] <javascript:>> wrote:
>
>> On second look, I see that it does seem to try to find out what 
>> environment it is running in. A bug then, yeah. Where can I report it? 
>> Additional problem: the .js file is all in one line, there are no line 
>> breaks, I find it hard to find out where exactly the interpretation stops. 
>> Help?
>>
>> On Tuesday, July 29, 2014 9:12:48 AM UTC+2, jj wrote:
>>>
>>> Sure, the aim is to be portable, which is why there are such test flags 
>>> ENVIRONMENT_IS_NODE and so on. It sounds like you are hitting a bug of the 
>>> generated code, where it doesn't properly detect that it is not running in 
>>> node. Pull requests to fix such bugs are always welcome.
>>>
>>>
>>> 2014-07-29 9:41 GMT+03:00 <[email protected]>:
>>>
>>>> Could be, but this was merely the first of probably many dependencies. 
>>>> I think, if the generated .js code were truly portable among the various 
>>>> js 
>>>> implementations, emscripten would become even more popular, than it 
>>>> already 
>>>> is. Are there tutorials on running emscripten-generated programs under the 
>>>> various javascript engines?
>>>>
>>>>
>>>> On Monday, July 28, 2014 10:39:32 PM UTC+2, jj wrote:
>>>>
>>>>> You could try hacking through the execution, and removing those 
>>>>> node-dependencies one by one to see how many there are. Does Rhino have 
>>>>> an 
>>>>> equivalent of argc/argv? Perhaps we just need to condition that line on 
>>>>> ENVIRONMENT_IS_NODE?
>>>>>
>>>>>
>>>>> 2014-07-28 23:37 GMT+03:00 <[email protected]>:
>>>>>
>>>>> I've tried to run a generated .js file under rhino and it stopped at 
>>>>>> the line:
>>>>>>
>>>>>> Module["arguments"]=process["argv"].slice(2)
>>>>>>
>>>>>> I think that's a node.js dependency right there. I have no idea how 
>>>>>> to run emscripten-generated .js files under the various js 
>>>>>> implementations, 
>>>>>> are there any tutorials? I think it would be hard, as node.js is closely 
>>>>>> coupled with v8. About the .html file: probably there are no node.js 
>>>>>> dependencies in the generated script?
>>>>>>
>>>>>> On Monday, July 28, 2014 4:19:06 PM UTC+2, jj wrote:
>>>>>>
>>>>>>> Not sure how well Emscripten applications run in env.js, but for the 
>>>>>>> .html -> .js part, the code that you have in the default shell.html 
>>>>>>> file is 
>>>>>>> completely optional, and it's also possible to move all that to a 
>>>>>>> separate 
>>>>>>> file that is evaluated before the main .js, or prepend the contents to 
>>>>>>> the 
>>>>>>> beginning of the main .js file. 
>>>>>>>
>>>>>>> What do you mean by node.js dependencies? Do you refer to Rhino 
>>>>>>> having node.js dependencies? Or Emscripten-compiled output has node.js 
>>>>>>> dependencies?
>>>>>>>
>>>>>>> The idea of the generated .js files is that it should be possible to 
>>>>>>> be run under various JavaScript shells (browser, node.js, SpiderMonkey, 
>>>>>>> v8), so if you are trying to run it in Rhino and something fails, 
>>>>>>> perhaps 
>>>>>>> you are able to patch up the assumptions and provide a pull request to 
>>>>>>> add 
>>>>>>> support for execution under Rhino?
>>>>>>>
>>>>>>>
>>>>>>> 2014-07-28 17:05 GMT+03:00 <[email protected]>:
>>>>>>>
>>>>>>> Seeing a C++ program running under the JVM has been an old wish of 
>>>>>>>> mine. One day I thought I could compile an emscipten-generated .js 
>>>>>>>> file 
>>>>>>>> into a .java file using rhino, but alas, the 64k method limit struck. 
>>>>>>>> But... it is also possible to interpret javascript under Rhino, so 
>>>>>>>> I've 
>>>>>>>> also tried that, but alas, there are the node.js dependencies. A new 
>>>>>>>> development is the avatar project from java8, which is node.js 
>>>>>>>> compatible - 
>>>>>>>> I haven't tried that yet. Would it be possible to extract the .js from 
>>>>>>>> a 
>>>>>>>> generated .html page, slap env.js into the mix and interpret the whole 
>>>>>>>> thing under rhino? Would this be possible and how to do it?
>>>>>>>>  
>>>>>>>> -- 
>>>>>>>> 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/d/optout.
>>>>>>>>
>>>>>>>
>>>>>>>  -- 
>>>>>> 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/d/optout.
>>>>>>
>>>>>
>>>>>  -- 
>>>> 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/d/optout.
>>>>
>>>
>>>  -- 
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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/d/optout.

Reply via email to