Re: Bug?

2020-06-21 Thread Alexander Burger
On Mon, Jun 22, 2020 at 05:27:37AM +, Shaughan Lavine wrote:
> Does something have to be allowed for forms.l to work? I'm getting
> '*Get [::1] not allowed'.

That's right. Some global variables used in HTTP transactions need to be
allowed. But this is done automatically in the first few lines of @lib/form.l
when it is loaded.


> And I'm still stumped about '"@doc/form/refD.html" -- Open error: Permission 
> denied' without sudo.

Uh, yes. But I really have no clue. Is it possibly an SELinux issue?

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe



Re: Bug?

2020-06-21 Thread Shaughan Lavine
Yep. Got it. That's about what I'd settled on---though without thinking about 
the security implications.

Does something have to be allowed for forms.l to work? I'm getting
'*Get [::1] not allowed'.

And I'm still stumped about '"@doc/form/refD.html" -- Open error: Permission 
denied' without sudo.

I very much appreciate all the help!

Sent from ProtonMail Mobile

On Sun, Jun 21, 2020 at 9:57 PM, Alexander Burger  wrote:

> Hi all,
>
>> OK, thanks, It isn't worth trying to modify the reader. I'll just add the
>> decimal point while processing the input.
>
> It is not a good idea to use the Lisp reader in a GUI. Imagine what a 
> malicious
> user can do with read macros! She could enter things like
> `(call "sh" "-c" "rm -r *").
>
> So, yes, the input needs to be handled as strings. You could check what the
> PicoLisp GUI does (also in PilBox apps on Android) in "@lib/form.l". The code
> for a fixpoint input field is:
>
> (class +FixField +numField)
>
> (dm T (N . @)
> (=: scl N)
> (pass super) )
>
> (dm txt> (Val)
> (format Val (: scl) *Sep0 *Sep3) )
>
> (dm set> (Val Dn)
> (super (format Val (: scl) *Sep0 *Sep3) Dn) )
>
> (dm val> ()
> (let S (super)
> (format
> (or (sub? *Sep0 S) (pack S *Sep0))
> (: scl)
> *Sep0
> *Sep3 ) ) )
>
> The relevant line here is the 4th in the 'val>' method.
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Re: Bug?

2020-06-21 Thread Alexander Burger
Hi all,

> OK, thanks, It isn't worth trying to modify the reader. I'll just add the
> decimal point while processing the input.

It is not a good idea to use the Lisp reader in a GUI. Imagine what a malicious
user can do with read macros! She could enter things like
`(call "sh" "-c" "rm -r *").

So, yes, the input needs to be handled as strings. You could check what the
PicoLisp GUI does (also in PilBox apps on Android) in "@lib/form.l". The code
for a fixpoint input field is:

   (class +FixField +numField)

   (dm T (N . @)
  (=: scl N)
  (pass super) )

   (dm txt> (Val)
  (format Val (: scl) *Sep0 *Sep3) )

   (dm set> (Val Dn)
  (super (format Val (: scl) *Sep0 *Sep3) Dn) )

   (dm val> ()
  (let S (super)
 (format
(or (sub? *Sep0 S) (pack S *Sep0))
(: scl)
*Sep0
*Sep3 ) ) )

The relevant line here is the 4th in the 'val>' method.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Bug?

2020-06-21 Thread Shaughan Lavine
OK, thanks, It isn't worth trying to modify the reader. I'll just add the 
decimal point while processing the input.

Sent from ProtonMail Mobile

On Sun, Jun 21, 2020 at 8:06 PM, John Duncan  wrote:

> That I don't know. I don't know if you can modify the scanning part of the 
> reader with picolisp, the examples I've seen all work on atoms. You might 
> have to read bytes and process it yourself. Or rewrite the scanner in the C 
> source.
>
> On Sun, Jun 21, 2020 at 3:43 PM Shaughan Lavine  
> wrote:
>
>> Thanks for the rapid reply! This is for an android app. I can hardly require 
>> an end user to supply a decimal point. Of course, I can look for one and 
>> supply it if missing. I just wondered if, since this must be a common use 
>> case, there was a better way.
>>
>> Sent from ProtonMail mobile
>>
>>  Original Message 
>> On Jun 21, 2020, 12:16 PM, John Duncan < duncan.j...@gmail.com> wrote:
>>
>>> Not a bug, this is the design of the reader (symToNum). Can you make input 
>>> include the decimal point?
>>>
>>> On Sun, Jun 21, 2020 at 14:34 Shaughan Lavine 
>>> <[shaug...@nometaphysics.org](mailto:shaughan@nometaphysicsorg)> wrote:
>>>
 Isn't this a bug?
 ---
 :(scl 2)
 :212
 212
 :212.
 21200
 -
 Shouldn't 212 be equal to 212. ?
 If not, how do I force a "." after an integer input by a user? Do I really 
 have to use a string input and look for a "."?

 Sent from ProtonMail mobile
>>>
>>> --
>>>
>>> John Duncan
>
> --
>
> John Duncan

Re: Bug?

2020-06-21 Thread John Duncan
That I don't know. I don't know if you can modify the scanning part of the
reader with picolisp, the examples I've seen all work on atoms. You might
have to read bytes and process it yourself. Or rewrite the scanner in the C
source.

On Sun, Jun 21, 2020 at 3:43 PM Shaughan Lavine 
wrote:

> Thanks for the rapid reply! This is for an android app. I can hardly
> require an end user to supply a decimal point. Of course, I can look for
> one and supply it if missing. I just wondered if, since this must be a
> common use case, there was a better way.
>
>
> Sent from ProtonMail mobile
>
>
>
>  Original Message 
> On Jun 21, 2020, 12:16 PM, John Duncan < duncan.j...@gmail.com> wrote:
>
>
> Not a bug, this is the design of the reader (symToNum). Can you make input
> include the decimal point?
>
> On Sun, Jun 21, 2020 at 14:34 Shaughan Lavine  > wrote:
>
>> Isn't this a bug?
>> ---
>> :(scl 2)
>> :212
>> 212
>> :212.
>> 21200
>> -
>> Shouldn't 212 be equal to 212. ?
>> If not, how do I force a "." after an integer input by a user? Do I
>> really have to use a string input and look for a "."?
>>
>>
>> Sent from ProtonMail mobile
>>
>>
>> --
> John Duncan
>
>

-- 
John Duncan


Re: Bug?

2020-06-21 Thread Shaughan Lavine
Thanks for the rapid reply! This is for an android app. I can hardly require an 
end user to supply a decimal point. Of course, I can look for one and supply it 
if missing. I just wondered if, since this must be a common use case, there was 
a better way.

Sent from ProtonMail mobile

 Original Message 
On Jun 21, 2020, 12:16 PM, John Duncan wrote:

> Not a bug, this is the design of the reader (symToNum). Can you make input 
> include the decimal point?
>
> On Sun, Jun 21, 2020 at 14:34 Shaughan Lavine 
> <[shaug...@nometaphysics.org](mailto:shaughan@nometaphysicsorg)> wrote:
>
>> Isn't this a bug?
>> ---
>> :(scl 2)
>> :212
>> 212
>> :212.
>> 21200
>> -
>> Shouldn't 212 be equal to 212. ?
>> If not, how do I force a "." after an integer input by a user? Do I really 
>> have to use a string input and look for a "."?
>>
>> Sent from ProtonMail mobile
>
> --
>
> John Duncan

Re: Bug?

2020-06-21 Thread John Duncan
Not a bug, this is the design of the reader (symToNum). Can you make input
include the decimal point?

On Sun, Jun 21, 2020 at 14:34 Shaughan Lavine 
wrote:

> Isn't this a bug?
> ---
> :(scl 2)
> :212
> 212
> :212.
> 21200
> -
> Shouldn't 212 be equal to 212. ?
> If not, how do I force a "." after an integer input by a user? Do I really
> have to use a string input and look for a "."?
>
>
> Sent from ProtonMail mobile
>
>
> --
John Duncan


Bug?

2020-06-21 Thread Shaughan Lavine
Isn't this a bug?
---
:(scl 2)
:212
212
:212.
21200
-
Shouldn't 212 be equal to 212. ?
If not, how do I force a "." after an integer input by a user? Do I really have 
to use a string input and look for a "."?

Sent from ProtonMail mobile