//Then in javascript, there the System object have been "exposed" to JavaScript. System.log("How are you?"); //prints "howareyou?" not "how are you?", e.g no whitespaces
In the example do I get the text: "Howareyou?", not "How are you?", what does I wrong? Why are all white spaces removed? The std::ostream::write write oformatted output, so it does not remove any white space, so it is not the problem.
> //Then in javascript, there the System object have been "exposed" to
> JavaScript.
> System.log("How are you?"); //prints "howareyou?" not "how are you?",
> e.g no whitespaces
> In the example do I get the text: "Howareyou?", not "How are you?", what
> does I wrong? Why are all white spaces removed? The std::ostream::write
> write oformatted output, so it does not remove any white space, so it is
> not the problem.
> //Then in javascript, there the System object have been "exposed" to
> JavaScript.
> System.log("How are you?"); //prints "howareyou?" not "how are you?", e.g
> no whitespaces
> In the example do I get the text: "Howareyou?", not "How are you?", what
> does I wrong? Why are all white spaces removed? The std::ostream::write
> write oformatted output, so it does not remove any white space, so it is
> not the problem.
Will it print out the length without any whitespaces, e.g javascript code: System.log(" "); prints "Length: 0". However, do anyone have any idea what I can have done wrong? I am adding the method by doing something like the following, if it helps:
Handlescope handle_scope; Persistent<Context> context = context(Context::New()); Context::Scope context_scope(context); Local<ObjectTemplate> env = ObjectTemplate::New(); env->Set(String::New("log"), FunctionTemplate::New(&System::log)); //System.log is a static method of course context->Global()->Set(String::New("System"), env->NewInstance());
Den onsdagen den 2:e maj 2012 kl. 02:47:52 UTC+2 skrev idleman:
> //Then in javascript, there the System object have been "exposed" to > JavaScript. > System.log("How are you?"); //prints "howareyou?" not "how are you?", e.g > no whitespaces
> In the example do I get the text: "Howareyou?", not "How are you?", what > does I wrong? Why are all white spaces removed? The std::ostream::write > write oformatted output, so it does not remove any white space, so it is > not the problem.
I haven't checked where that logic lives, but I guess the string you're
passing is automatically split up into several arguments along whitespace
boundaries. Try printing the value of args.Length() to verify this.
If things behave like command shells, you should be able to do
System.log("\"multi word argument\""); to get a single argument consisting
of several words.
On Wed, May 2, 2012 at 11:42 AM, idleman <evoo...@gmail.com> wrote:
> Well, like a said before, the std::ostream object is not the problem, if i
> change the method to:
> Will it print out the length without any whitespaces, e.g javascript code:
> System.log(" "); prints "Length: 0". However, do anyone have any idea
> what I can have done wrong? I am adding the method by doing something like
> the following, if it helps:
> Handlescope handle_scope;
> Persistent<Context> context = context(Context::New());
> Context::Scope context_scope(context);
> Local<ObjectTemplate> env = ObjectTemplate::New();
> env->Set(String::New("log"), FunctionTemplate::New(&System::log));
> //System.log is a static method of course
> context->Global()->Set(String::New("System"), env->NewInstance());
> Den onsdagen den 2:e maj 2012 kl. 02:47:52 UTC+2 skrev idleman:
> Why does all white spaces get removed in the example below?
>> //Then in javascript, there the System object have been "exposed" to
>> JavaScript.
>> System.log("How are you?"); //prints "howareyou?" not "how are you?",
>> e.g no whitespaces
>> In the example do I get the text: "Howareyou?", not "How are you?", what
>> does I wrong? Why are all white spaces removed? The std::ostream::write
>> write oformatted output, so it does not remove any white space, so it is
>> not the problem.
> Will it print out the length without any whitespaces, e.g javascript code:
> System.log(" "); prints "Length: 0". However, do anyone have any idea
> what I can have done wrong? I am adding the method by doing something like
> the following, if it helps:
> Handlescope handle_scope;
> Persistent<Context> context = context(Context::New());
> Context::Scope context_scope(context);
> Local<ObjectTemplate> env = ObjectTemplate::New();
> env->Set(String::New("log"), FunctionTemplate::New(&System::log));
> //System.log is a static method of course
> context->Global()->Set(String::New("System"), env->NewInstance());
> Den onsdagen den 2:e maj 2012 kl. 02:47:52 UTC+2 skrev idleman:
>> Why does all white spaces get removed in the example below?
>> //Then in javascript, there the System object have been "exposed" to
>> JavaScript.
>> System.log("How are you?"); //prints "howareyou?" not "how are you?",
>> e.g no whitespaces
>> In the example do I get the text: "Howareyou?", not "How are you?", what
>> does I wrong? Why are all white spaces removed? The std::ostream::write
>> write oformatted output, so it does not remove any white space, so it is
>> not the problem.
Now was it embarrassing, but I forgot that std::istream_iterator skip white spaces by default, which I used to read the JavaScript file, so no white spaces was not even compiled, but I assume it can happen all, thanks anyway!