Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-22 Thread Elias Mårtenson
Thanks! It works now. Could you check out the latest version from git branch "master" and copy the content of the directory "native" it to the GNU APL distribution? I've updated everything and included the Makefile.am file so that it should need to changes. This will ensure that the native module

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-22 Thread Juergen Sauermann
Hi Elias, I have added Value::print1(ostream & out, PrintContext pctx). I have used PrintContext instead of print width because you probably want to set the print precision and maybe style as well. Use like: PrintContext pctx( /* satyle */ PST_NONE, /* precision */ 16, /* width */ 2000);

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-22 Thread Elias Mårtenson
The value argument could be anything. Basically, all I want to do is the following: - Given any Value_P, get the textual representation of that value as if it had been displayed in the interpreter, *without* any wrapping. Or... - Given any Value_P, get the textual representation of that v

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-22 Thread Juergen Sauermann
Hi again, it is actually somewhat difficult to see what happens. The private use characters are not displayed in the same way on all machines. Also I can't see how your do_CR() value argument looks like (could be ⍳ something). Maybe it is easier to start with an a that does not involve print

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-22 Thread Juergen Sauermann
Hi Elias, so do_CR returns the internal character representation which contains "blanks" inserted by the APL formatting (which is somewhat non-trivial). The different symbols tell why a blank was inserted and the final action is to (1) replace the blanks and to (2) ⎕PW-wrap the output. You wa

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-22 Thread Elias Mårtenson
Well, I tried with 1 as well, and got the same result. How do you recommend I deal with it? Also, how can I use do_CR to render with the default (non-CR) output style? Regards, Elias On 22 May 2014 21:47, Juergen Sauermann wrote: > Hi Elias, > > I see, the private use symbols can be made visi

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-22 Thread Juergen Sauermann
Hi Elias, I see, the private use symbols can be made visible with ./configure VISIBLE_MARKERS_WANTED-yes in case you are interested in the details of APL output formatting. They can be removed (visible or not) with UCS_string::remove_pad() (which returns another UCS_string with these characte

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-22 Thread Elias Mårtenson
Thanks. I tried the second solution, and got the below result. Very strange. Here's the code: const PrintContext pctx( PST_NONE, Workspace::get_PP(), 10 ); Value_P cr_formatted = Quad_CR::do_CR( cr_level, *value, pctx ); const PrintContext pctx2( PST_NONE, Workspace::g

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-22 Thread Juergen Sauermann
Hi Elias, if the values was a matrix then you may have another problem that the matrix has no \n at the end of each row (not sure how your output is supposed to look like). Let say do_CR returns *Value_P Z *(which can be a scalar, a vector, or a matrix depending on the value ⎕CRed and the first

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-22 Thread Elias Mårtenson
Thank you. But I don't see how I can solve my problem then? Regards, Elias On 22 May 2014 20:44, Juergen Sauermann wrote: > Hi Elias, > > yes, sorry. Forgot to mention that the APL values used in the constructor > of UCS_string > must have rank ≤ 1 while do_CR() might produce matrices for some

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-22 Thread Juergen Sauermann
Hi Elias, yes, sorry. Forgot to mention that the APL values used in the constructor of UCS_string must have rank ≤ 1 while do_CR() might produce matrices for some left arguments of ⎕CR. /// Jürgen On 05/22/2014 11:13 AM, Elias Mårtenson wrote: I tried to do this, but I'm having the construc

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-22 Thread Elias Mårtenson
I tried to do this, but I'm having the constructor for UCS_string crash on me when I try: #0 0x7f228d0cbd67 in raise () from /usr/lib/libc.so.6 #1 0x7f228d0cd118 in abort () from /usr/lib/libc.so.6 #2 0x7f228d9c0dc5 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/lib

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-21 Thread Juergen Sauermann
Hi Elias, the *operator<<(ostream & out, const Value & v)* calls *v.print(out)* which then does the line break at *⎕PW*. The cr_formatted below is probably OK but printing it introduces line wrapping. You could have used UCS_string(*cr_formatted) instead of *cr_formatted to avoid that. /// J

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-21 Thread Elias Mårtenson
I tried to specify a different PW like the below, but the with is still limited to something close to 80: const PrintContext pctx( PST_NONE, Workspace::get_PP(), 1000 ); Value_P cr_formatted = Quad_CR::do_CR( cr_level, *value, pctx ); out << *cr_formatted; What did I do wr

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-21 Thread Elias Mårtenson
Cool. Thanks! And what if I want to output without any quad-CR style at all? (I.e. the default output style ]BOXING none). Is there a cr-style I can use for that? Is it 0? Regards, Elias On 21 May 2014 21:43, Juergen Sauermann wrote: > Hi Elias, > > done in SVN 281. I had to change your Trace

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-21 Thread Juergen Sauermann
Hi Elias, done in SVN 281. I had to change your TraceData.cc due to the extra argument. I used PrintContext (style + ⎕PP + ⎕PW) instead of print width alone so that other output aspects can be controlled as well. /// Jürgen On 05/21/2014 02:54 PM, Elias Mårtenson wrote: Yes, of course. :-

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-21 Thread Elias Mårtenson
Yes, of course. :-) I was focused on the other solution to set a custom PW. Obviously adding pw as an argument to do_CR is a better idea. Regards, Elias On 21 May 2014 20:52, "Juergen Sauermann" wrote: > H Elias, > > that sounds more like making the print width a parameter of do_CR() > because

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-21 Thread Juergen Sauermann
H Elias, that sounds more like making the print width a parameter of do_CR() because the left arg of ⎕CR is already the first argument of do_CR() ? /// Jürgen On 05/21/2014 02:33 PM, Elias Mårtenson wrote: To clarify, What I have is a Value, and all I want to do is to get a string containing

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-21 Thread Elias Mårtenson
To clarify, What I have is a Value, and all I want to do is to get a string containing the printed form of that Value for a given quad-CR-left-hand-value. I don't want the resulting string to be wrapped (since I'm handling that on the Emacs side). Regards, Elias On 21 May 2014 20:29, Elias Mårte

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-21 Thread Elias Mårtenson
I mean the number to the left of quad-cr. :-) Regards, Elias On 21 May 2014 20:28, "Juergen Sauermann" wrote: > Hi Elias, > > not sure what you mean by 'CR-level' ? > > /// Jürgen > > > On 05/21/2014 06:32 AM, Elias Mårtenson wrote: > > Hello Jürgen, > > I finally got around to attempting to i

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-21 Thread Juergen Sauermann
Hi Elias, not sure what you mean by 'CR-level' ? /// Jürgen On 05/21/2014 06:32 AM, Elias Mårtenson wrote: Hello Jürgen, I finally got around to attempting to implement this. What I'm actually doing is to ensure that the output in a trace buffer (that displays the content of a variable in

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-05-20 Thread Elias Mårtenson
Hello Jürgen, I finally got around to attempting to implement this. What I'm actually doing is to ensure that the output in a trace buffer (that displays the content of a variable in real-time) is not wrapped. This is, of course, because Emacs allows you to navigate around a larger buffer. Curre

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-02-18 Thread Elias Mårtenson
Thank you. This is a lot better. I was doing that just because I didn't see a better way to do it. Clearly, this is a better way to do it. :-) Regards, Elias On 18 February 2014 18:34, Juergen Sauermann wrote: > Hi Elias, > > normally you do something like this: > > // const Value & value; >

Re: [Bug-apl] Calling Value::print() with different ⎕PW

2014-02-18 Thread Juergen Sauermann
Hi Elias, normally you do something like this: // const Value & value; PrintContext pctx(style, Workspace::get_PP(), Workspace::get_CT(), Workspace::get_PW()); PrintBuffer pb(value, pctx); UCS_string ucs(pb, value.get_rank(), pctx.get_PW()); ... You can use your own ⎕PW value instead of Work

[Bug-apl] Calling Value::print() with different ⎕PW

2014-02-17 Thread Elias Mårtenson
In my native code, I would like to be able to get a printable representation of a Value_P as if ⎕PW was set to some very large value (effectively unlimited). What is the most efficient way to do this? I was trying to call assign on the return value from Workspace::get_v_Quad_PW(), but I got a DOM