bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Juergen Sauermann
Subject: Re: [Bug-apl] Calling Value::print() with different ⎕PW
Date: Thu, 22 May 2014 15:10:50 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130330 Thunderbird/17.0.5

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 arg of do_CR().
Then there are two options:

1. Check the rank of Z with Z->get_rank() and

   loop(z, Z->element_count())
      {
         out << Z->get_ravel(z).get_char_value();
         // insert \n as needed, i.e. z%Z->get_last_shape_item();
       }

2.Construct a PrintBuffer object from Z (with ⎕PW as needed) and

   out << PrintBuffer object;

I haven't tested this; 1. seems more reliable (and definitely faster) while 2. looks more elegant.


/// Jürgen


On 05/22/2014 02:46 PM, Elias Mårtenson wrote:
Thank you. But I don't see how I can solve my problem then?

Regards,
Elias


On 22 May 2014 20:44, Juergen Sauermann <address@hidden> 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 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 constructor for UCS_string crash on me when I try:

#0  0x00007f228d0cbd67 in raise () from /usr/lib/libc.so.6
#1  0x00007f228d0cd118 in abort () from /usr/lib/libc.so.6
#2  0x00007f228d9c0dc5 in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib/libstdc++.so.6
#3  0x00007f228d9bee46 in ?? () from /usr/lib/libstdc++.so.6
#4  0x00007f228d9bee91 in std::terminate() () from /usr/lib/libstdc++.so.6
#5  0x00007f228d9bf0a8 in __cxa_throw () from /usr/lib/libstdc++.so.6
#6  0x00000000004b350c in throw_apl_error (code=E_RANK_ERROR, 
    loc=0x595c13 "UCS_string.cc:388") at Error.cc:188
#7  0x000000000054d31c in UCS_string::UCS_string (this=0x7f227fb3c880, value=...)
    at UCS_string.cc:388
#8  0x00007f228c0de92c in TraceData::display_value_for_trace (out=..., value=..., 
    cr_level=8) at TraceData.cc:64
#9  0x00007f228c0db4ca in enable_trace (conn=..., symbol=0xa88c90, cr_level=8)
    at FollowCommand.cc:90
#10 0x00007f228c0db9e2 in FollowCommand::run_command (this=0x7f22780011f0, conn=..., 
    args=std::vector of length 4, capacity 4 = {...}) at FollowCommand.cc:135
#11 0x00007f228c0d4eb6 in NetworkConnection::process_command (this=0x7f22780008c0, 
    command="trace:palle:on:8") at NetworkConnection.cc:209
#12 0x00007f228c0d500c in NetworkConnection::run (this=0x7f22780008c0)
    at NetworkConnection.cc:220
#13 0x00007f228c0cf542 in connection_loop (arg=0x7f22780008c0) at network.cc:36
#14 0x00007f228f120124 in start_thread () from /usr/lib/libpthread.so.0
#15 0x00007f228d1814bd in clone () from /usr/lib/libc.so.6

Do you have any idea?

Regards,
Elias


On 22 May 2014 00:21, Juergen Sauermann <address@hidden> wrote:
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ürgen



On 05/21/2014 04:54 PM, Elias Mårtenson wrote:
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 wrong?

Regards,
Elias







reply via email to

[Prev in Thread] Current Thread [Next in Thread]