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: Elias Mårtenson
Subject: Re: [Bug-apl] Calling Value::print() with different ⎕PW
Date: Thu, 22 May 2014 22:42:59 +0800

The value argument could be anything. Basically, all I want to do is the following:
That's really all I'm trying to do.

Regards,
Elias


On 22 May 2014 22:38, Juergen Sauermann <address@hidden> wrote:
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 styles
(such as 5 ⎕CR 'hello').

/// Jürgen


On 05/22/2014 03:51 PM, Elias Mårtenson wrote:
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 <address@hidden> wrote:
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]