I confess I'm slightly baffled by Richard's post. AFAIK the value returned
by the verb: viewmat is undefined, and no meaning can be attached to it.
Viewmat works in different ways on different platforms, but when I trace
the code of verb: viewmat as defined in line 361 of
~addons/graphics/viewmat/viewmat.ijs it typically returns some variant of
empty, EMPTY or i.0 0.


So, taking Richard's sample sentences and replacing the argument with y,
it's no surprise that:


   viewmat y

NB. no output


   $viewmat y

0 0


However while checking this out I've stumbled on the tip of an iceberg.
Thank you Richard for alerting me to the fact.


The code of Viewmat is involved. It looks as if it's been patched and
patched over the years. But whatever the platform, it basically works by
generating a bitmap (BMP) file (i.e. having the extension .bmp) and then
picking one of a bunch of ways to display it.


Both j701 and j901 apps for iOS generate a BMP file. j701 wraps the file
path in html code which it then displays using UIKit's (deprecated) browser
object UIWebView. j901 uses neither UIWebView nor the replacement WkWebView
to display the BMP file, but instead calls UIKit's image display object
UIImageView, which can handle BMP. Or it did once.


Apple had recently released updates to several of its systems fixing major
security exposures. Since then Viewmat *in both j701 and j901* has broken.
(It was working in both apps in July of this year.)


JQt is unaffected. Viewmat still works on a Mac running the latest version
of Monterey. I'm guessing this is because JQt does not use Apple system
code to display the generated BMP. Instead it converts the BMP file
contents into an RGB array (a J noun of integer type) and then uses gl2
(glpixels) to display it on a Qt-managed canvas.


When I copy the BMP file generated by j901 onto a Mac MBA which is still
running Big Sur, I can readily display it using Preview – and the icon
itself shows a thumbnail of the file contents. But I cannot get a newer Mac
running Monterey to display the very same BMP. Yet Monterey was able to do
so back in July, before the recent Apple fixes. It's the same story with
iOS. On both platforms Preview now tells me that my BMP file is either
corrupt or an unsupported file format.


This cannot be a coincidence. It looks as if Apple has simply decided to
cancel BMP on the latest versions of Monterey and iOS. But I find it hard
to believe. Maybe it's just a bug introduced by Apple in its haste to shore
up its systems. Or maybe the BMP spec is being more closely adhered-to than
hitherto.


I propose to take the matter up with Apple. J needs BMP, even if Apple
doesn't.

On Mon, 19 Sept 2022 at 18:24, 'Mike Day' via Programming <
programm...@jsoftware.com> wrote:

> Confirming Raul’s observations on this iPad running J701 under iOS 12.5.5
> .
> viewmat shows the circle, square and intermediate shape without problem,
> presumably as required, after copying from the email and pasting into the
> terminal screen,  so Raul probably typed correctly.  Also, same result
> using either @ or @: as he found.  And image is ok running with the
> one-liner pasted into the J701 E screen, ie the script-edit page.
>
> Cheers,
>
> Mike
>
> Sent from my iPad
>
> > On 19 Sep 2022, at 16:52, Raul Miller <rauldmil...@gmail.com> wrote:
> >
> >> On Mon, Sep 19, 2022 at 11:15 AM Richard Donovan <rsdono...@hotmail.com>
> wrote:
> >> viewmat((1>+/~@:(4^~(%~i:)))*.1<+/~@:(2^~(%~i:)))666
> >> NB. no output
> >>
> >>   $viewmat((1>+/~@:(4^~(%~i:)))*.1<+/~@:(2^~(%~i:)))666
> >> 0 0
> >
> > This is probably more a topic for the general forum than the
> > programming forum, but viewmat also produces a shape 0 0 result in
> > jqt. (In jplayground, it produces a shape 1 result which is a single
> > space..)
> >
> > In the jqt viewmat, it pops up a new window with the image. In the
> > jplayground viewmat, it produces an inline image (JHS viewmat would be
> > similar to jplayground's viewmat). On my iphone, running j701, the
> > above expression presented the viewmat image at the top of the phone
> > (or an expression close to the above -- I hand entered the line, and
> > used @ instead of @: which should produce an equivalent result here,
> > but the point is that I may have inadvertently changed something
> > else...).
> >
> > To be sure that a viewmat image consistently appears, I copied the
> > line into the edit window and ran it from there -- when I did so, the
> > edit window was hidden (icon at bottom of region changed from E to J)
> > and the session window and the image window appeared.
> >
> > So... whatever the problem is, it might depend on the version of J you
> > are running and/or the version of ios that you are running?
> >
> > I hope this helps,
> >
> > --
> > Raul
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to