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:47:02 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130330 Thunderbird/17.0.5

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 characters replaced with spaces).

Apart from that everything looks really fine :-) .

You probably want to go for 1. anyhow.

/// Jürgen


On 05/22/2014 03:35 PM, Elias Mårtenson wrote:
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(), 100000 );
        Value_P cr_formatted = Quad_CR::do_CR( cr_level, *value, pctx );

        const PrintContext pctx2( PST_NONE, Workspace::get_PP(), 100000 );
        PrintBuffer buffer( *cr_formatted, pctx2 );
        out << buffer;

Then, this renders as a lot of private use symbols (U+EEEE). I've attached a screenshot of what it looks like.

Regards,
Elias


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








reply via email to

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