Re: native/lisp in picolisp32

2020-05-16 Thread C K Kashyap
I get a feeling that most of the folks on this list have Alex as the first
name :)

Here's my problem. I am convinced that PicoLisp is my final language but
unfortunately I am unable to use it on Windows where I have to spend most
of the time :(
I just got it working with SDL on windows a couple of weeks ago (It's on my
github page but I have not talked about it since it needs polishing :) )

It would be great if picoLisp could have a OS abstraction layer that
normalizes all the POSIX calls - while P in POSIX is meant to be portable -
my personal experience has been that there are subtle differences between
HPUX/AIX/Solaris and GNU/Linux - ofcourse this personal experience is from
15 years ago so  I am not sure of the current situation.  One could then
implement the OS abstraction layer on windows and have picoLisp running on
windows too. Actually, its not just windows - this approach could perhaps
make it easier for other platforms too - but since most new platforms
support GNU/Linux these days, perhaps there is not a strong motivation
there.

Anyway, I agree with your statements Alex.

Regards,
Kashyap






On Sat, May 16, 2020 at 10:15 AM Alex Gilding  wrote:

> With a system like miniPicoLisp, like any ultra-light footprint
> interpreter - does a general purpose FFI really gel with the design?
>
> IMO the way people normally use interpreters in this weight class (see
> also, Lua, Chibi, picoC, Jim, ...) is to embed them: i.e. the interpreter
> becomes a first-class part of the hosting C (or equivalent) program. In so
> doing it gains first-class access to all of the host's API on the runtime
> level, and instead of using a dynamic API load native functions at runtime,
> it has the ability to statically expose them as part of what effectively
> becomes a domain-specific extension of the interpreter that provides the
> useful parts of the program's internal C API as "builtins".
>
> This isn't necessarily a very picoLisp way to structure a program - I get
> the impression picoLisp is usually the "host" by design - but I wonder
> whether, if you avoid that and try to make miniPicoLisp the conceptually
> freestanding language, you'd end up erasing most of what makes it distinct
> from the main picoLisp anyway.
>
> AlexG
>
> On Sat, 16 May 2020, 16:43 C K Kashyap,  wrote:
>
>> Oh btw Andras,
>> The main reason I would love those features in pil32 (C) is so that I can
>> more easily translate it to miniPicoLisp
>> I really want to be able to have a system that requires nothing more than
>> C :)
>> Regards,
>> Kashyap
>>
>> On Fri, May 15, 2020 at 10:53 PM C K Kashyap  wrote:
>>
>>> Absolutely!!!
>>> If that is done - I believe there is no reason not to have pil64 in C
>>> too right :)
>>> Regards,
>>> Kashyap
>>>
>>> On Fri, May 15, 2020 at 9:55 PM Andras Pahi  wrote:
>>>
>>>> Hi,
>>>>
>>>> If you are still interested in native/lisp in picolisp32 then I am
>>>> working to support the pil64
>>>> features in picolisp32. The development branch of
>>>> https://github.com/pahihu/picoLisp
>>>> just missing the coroutines (stay tuned), and builds on 64bit/32bit
>>>> targets.
>>>> It uses libffi for the native C calls.
>>>>
>>>> Regards,
>>>> Andras
>>>>
>>>> On 2020. May 8., at 16:36, C K Kashyap  wrote:
>>>>
>>>> Thanks Alex,
>>>> I think I'll try and see if I can get a simple SDL callback to work
>>>> with miniPicoLisp - that way, I can really understand the issues better.
>>>> If I remember correctly - pil21 initially did not have the POSIX
>>>> requirement. Is there a way to get older versions of pil21 (I know that it
>>>> is a strange request for a POC :) )
>>>>
>>>> Thanks Tomas for your ffi link.
>>>>
>>>> Regards,
>>>> Kashyap
>>>>
>>>> On Fri, May 8, 2020 at 2:24 AM Tomas Hlavaty  wrote:
>>>>
>>>>> Hi Kashyap,
>>>>>
>>>>> C K Kashyap  writes:
>>>>> > I am now trying to figure out how to do FFI min miniPicoLisp and I
>>>>> > realized that only pil64 has native/lisp support. Is there any reason
>>>>> > it could not be done in the 'c' implementation of pil32? I just
>>>>> wanted
>>>>> > to make sure that there is no "impossibility" about attempting to
>>>>> port
>>>>> > the native/lisp functions to miniPicoLisp.
>>>>>
>>>>> here is an example of ffi with minipicolisp:
>>>>> https://logand.com/sw/mplisp/files.html
>>>>>
>>>>> Cheers
>>>>>
>>>>> Tomas
>>>>>
>>>>> --
>>>>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>>>>>
>>>>
>>>>


Re: native/lisp in picolisp32

2020-05-16 Thread Alex Gilding
With a system like miniPicoLisp, like any ultra-light footprint interpreter
- does a general purpose FFI really gel with the design?

IMO the way people normally use interpreters in this weight class (see
also, Lua, Chibi, picoC, Jim, ...) is to embed them: i.e. the interpreter
becomes a first-class part of the hosting C (or equivalent) program. In so
doing it gains first-class access to all of the host's API on the runtime
level, and instead of using a dynamic API load native functions at runtime,
it has the ability to statically expose them as part of what effectively
becomes a domain-specific extension of the interpreter that provides the
useful parts of the program's internal C API as "builtins".

This isn't necessarily a very picoLisp way to structure a program - I get
the impression picoLisp is usually the "host" by design - but I wonder
whether, if you avoid that and try to make miniPicoLisp the conceptually
freestanding language, you'd end up erasing most of what makes it distinct
from the main picoLisp anyway.

AlexG

On Sat, 16 May 2020, 16:43 C K Kashyap,  wrote:

> Oh btw Andras,
> The main reason I would love those features in pil32 (C) is so that I can
> more easily translate it to miniPicoLisp
> I really want to be able to have a system that requires nothing more than
> C :)
> Regards,
> Kashyap
>
> On Fri, May 15, 2020 at 10:53 PM C K Kashyap  wrote:
>
>> Absolutely!!!
>> If that is done - I believe there is no reason not to have pil64 in C too
>> right :)
>> Regards,
>> Kashyap
>>
>> On Fri, May 15, 2020 at 9:55 PM Andras Pahi  wrote:
>>
>>> Hi,
>>>
>>> If you are still interested in native/lisp in picolisp32 then I am
>>> working to support the pil64
>>> features in picolisp32. The development branch of
>>> https://github.com/pahihu/picoLisp
>>> just missing the coroutines (stay tuned), and builds on 64bit/32bit
>>> targets.
>>> It uses libffi for the native C calls.
>>>
>>> Regards,
>>> Andras
>>>
>>> On 2020. May 8., at 16:36, C K Kashyap  wrote:
>>>
>>> Thanks Alex,
>>> I think I'll try and see if I can get a simple SDL callback to work with
>>> miniPicoLisp - that way, I can really understand the issues better.
>>> If I remember correctly - pil21 initially did not have the POSIX
>>> requirement. Is there a way to get older versions of pil21 (I know that it
>>> is a strange request for a POC :) )
>>>
>>> Thanks Tomas for your ffi link.
>>>
>>> Regards,
>>> Kashyap
>>>
>>> On Fri, May 8, 2020 at 2:24 AM Tomas Hlavaty  wrote:
>>>
>>>> Hi Kashyap,
>>>>
>>>> C K Kashyap  writes:
>>>> > I am now trying to figure out how to do FFI min miniPicoLisp and I
>>>> > realized that only pil64 has native/lisp support. Is there any reason
>>>> > it could not be done in the 'c' implementation of pil32? I just wanted
>>>> > to make sure that there is no "impossibility" about attempting to port
>>>> > the native/lisp functions to miniPicoLisp.
>>>>
>>>> here is an example of ffi with minipicolisp:
>>>> https://logand.com/sw/mplisp/files.html
>>>>
>>>> Cheers
>>>>
>>>> Tomas
>>>>
>>>> --
>>>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>>>>
>>>
>>>


Re: native/lisp in picolisp32

2020-05-16 Thread C K Kashyap
Oh btw Andras,
The main reason I would love those features in pil32 (C) is so that I can
more easily translate it to miniPicoLisp.
I really want to be able to have a system that requires nothing more than C
:)
Regards,
Kashyap

On Fri, May 15, 2020 at 10:53 PM C K Kashyap  wrote:

> Absolutely!!!
> If that is done - I believe there is no reason not to have pil64 in C too
> right :)
> Regards,
> Kashyap
>
> On Fri, May 15, 2020 at 9:55 PM Andras Pahi  wrote:
>
>> Hi,
>>
>> If you are still interested in native/lisp in picolisp32 then I am
>> working to support the pil64
>> features in picolisp32. The development branch of
>> https://github.com/pahihu/picoLisp
>> just missing the coroutines (stay tuned), and builds on 64bit/32bit
>> targets.
>> It uses libffi for the native C calls.
>>
>> Regards,
>> Andras
>>
>> On 2020. May 8., at 16:36, C K Kashyap  wrote:
>>
>> Thanks Alex,
>> I think I'll try and see if I can get a simple SDL callback to work with
>> miniPicoLisp - that way, I can really understand the issues better.
>> If I remember correctly - pil21 initially did not have the POSIX
>> requirement. Is there a way to get older versions of pil21 (I know that it
>> is a strange request for a POC :) )
>>
>> Thanks Tomas for your ffi link.
>>
>> Regards,
>> Kashyap
>>
>> On Fri, May 8, 2020 at 2:24 AM Tomas Hlavaty  wrote:
>>
>>> Hi Kashyap,
>>>
>>> C K Kashyap  writes:
>>> > I am now trying to figure out how to do FFI min miniPicoLisp and I
>>> > realized that only pil64 has native/lisp support. Is there any reason
>>> > it could not be done in the 'c' implementation of pil32? I just wanted
>>> > to make sure that there is no "impossibility" about attempting to port
>>> > the native/lisp functions to miniPicoLisp.
>>>
>>> here is an example of ffi with minipicolisp:
>>> https://logand.com/sw/mplisp/files.html
>>>
>>> Cheers
>>>
>>> Tomas
>>>
>>> --
>>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>>>
>>
>>


Re: native/lisp in picolisp32

2020-05-16 Thread C K Kashyap
Absolutely!!!
If that is done - I believe there is no reason not to have pil64 in C too
right :)
Regards,
Kashyap

On Fri, May 15, 2020 at 9:55 PM Andras Pahi  wrote:

> Hi,
>
> If you are still interested in native/lisp in picolisp32 then I am working
> to support the pil64
> features in picolisp32. The development branch of
> https://github.com/pahihu/picoLisp
> just missing the coroutines (stay tuned), and builds on 64bit/32bit
> targets.
> It uses libffi for the native C calls.
>
> Regards,
> Andras
>
> On 2020. May 8., at 16:36, C K Kashyap  wrote:
>
> Thanks Alex,
> I think I'll try and see if I can get a simple SDL callback to work with
> miniPicoLisp - that way, I can really understand the issues better.
> If I remember correctly - pil21 initially did not have the POSIX
> requirement. Is there a way to get older versions of pil21 (I know that it
> is a strange request for a POC :) )
>
> Thanks Tomas for your ffi link.
>
> Regards,
> Kashyap
>
> On Fri, May 8, 2020 at 2:24 AM Tomas Hlavaty  wrote:
>
>> Hi Kashyap,
>>
>> C K Kashyap  writes:
>> > I am now trying to figure out how to do FFI min miniPicoLisp and I
>> > realized that only pil64 has native/lisp support. Is there any reason
>> > it could not be done in the 'c' implementation of pil32? I just wanted
>> > to make sure that there is no "impossibility" about attempting to port
>> > the native/lisp functions to miniPicoLisp.
>>
>> here is an example of ffi with minipicolisp:
>> https://logand.com/sw/mplisp/files.html
>>
>> Cheers
>>
>> Tomas
>>
>> --
>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>>
>
>


Re: native/lisp in picolisp32

2020-05-15 Thread Andras Pahi
Hi,

If you are still interested in native/lisp in picolisp32 then I am working to 
support the pil64
features in picolisp32. The development branch of 
https://github.com/pahihu/picoLisp <https://github.com/pahihu/picoLisp>
just missing the coroutines (stay tuned), and builds on 64bit/32bit targets.
It uses libffi for the native C calls.

Regards,
Andras

> On 2020. May 8., at 16:36, C K Kashyap  <mailto:ckkash...@gmail.com>> wrote:
> 
> Thanks Alex,
> I think I'll try and see if I can get a simple SDL callback to work with 
> miniPicoLisp - that way, I can really understand the issues better.
> If I remember correctly - pil21 initially did not have the POSIX requirement. 
> Is there a way to get older versions of pil21 (I know that it is a strange 
> request for a POC :) )
> 
> Thanks Tomas for your ffi link.
> 
> Regards,
> Kashyap
> 
> On Fri, May 8, 2020 at 2:24 AM Tomas Hlavaty  <mailto:t...@logand.com>> wrote:
> Hi Kashyap,
> 
> C K Kashyap mailto:ckkash...@gmail.com>> writes:
> > I am now trying to figure out how to do FFI min miniPicoLisp and I
> > realized that only pil64 has native/lisp support. Is there any reason
> > it could not be done in the 'c' implementation of pil32? I just wanted
> > to make sure that there is no "impossibility" about attempting to port
> > the native/lisp functions to miniPicoLisp.
> 
> here is an example of ffi with minipicolisp:
> https://logand.com/sw/mplisp/files.html 
> <https://logand.com/sw/mplisp/files.html>
> 
> Cheers
> 
> Tomas
> 
> -- 
> UNSUBSCRIBE: mailto:picolisp@software-lab.de 
> <mailto:picolisp@software-lab.de>?subject=Unsubscribe



Re: native/lisp in picolisp32

2020-05-08 Thread C K Kashyap
Got it - thanks Alex.

I wish there was a libposix (perhaps using libuv) that PicoLisp would work
against and then it would magically work on Mac and Windows too :)

I was working on miniPicoLIsp with the idea of building in those
features into miniPicoLisp (since it already works on Windows - builds
using MS C compiler after VLA removal and Mac). I think an SDL (libSDL) app
may be a good POC.

Regards,
Kashyap

On Fri, May 8, 2020 at 9:56 AM Alexander Burger  wrote:

> On Fri, May 08, 2020 at 06:42:33PM +0200, Alexander Burger wrote:
> > Yes, miniPicoLisp and Ersatz do not depend on POSIX. Mini just uses the C
> > standard I/O stuff. "POSIX" basically means "Unix".
>
> It means processes (yes, fork()) and process groups, terminal handling,
> signals,
> pipes, file control (fcntl()), asynchronous I/O (select() or poll()) and
> so on.
> The PicoLisp infrastructure completely depends on these things.
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: native/lisp in picolisp32

2020-05-08 Thread Alexander Burger
On Fri, May 08, 2020 at 06:42:33PM +0200, Alexander Burger wrote:
> Yes, miniPicoLisp and Ersatz do not depend on POSIX. Mini just uses the C
> standard I/O stuff. "POSIX" basically means "Unix".

It means processes (yes, fork()) and process groups, terminal handling, signals,
pipes, file control (fcntl()), asynchronous I/O (select() or poll()) and so on.
The PicoLisp infrastructure completely depends on these things.

☺/ A!ex

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


Re: native/lisp in picolisp32

2020-05-08 Thread Alexander Burger
On Fri, May 08, 2020 at 09:28:36AM -0700, C K Kashyap wrote:
> again, miniPicoLisp is also POSIX compliant right - but it uses a very
> narrow slice of the POSIX API. Or am I understanding POSIX wrong here?

Yes, miniPicoLisp and Ersatz do not depend on POSIX. Mini just uses the C
standard I/O stuff. "POSIX" basically means "Unix".

☺/ A!ex

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


Re: native/lisp in picolisp32

2020-05-08 Thread C K Kashyap
>
>
> How do you mean that? Pil21 is not even finished for the first version.
>
> Perhaps I am remembering it incorrectly - I thought pil21 (a couple of
months ago I think) - did not support 'fork'/'call' etc thereby making me
thing it did not depend POSIX as heavily yet - when I say that I mean,
depending on a wider range of the POSIX API set.

But anyway it was always POSIX (as pil32 and pil64).
>

again, miniPicoLisp is also POSIX compliant right - but it uses a very
narrow slice of the POSIX API. Or am I understanding POSIX wrong here?


>
> ☺/ A!ex
>
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: native/lisp in picolisp32

2020-05-08 Thread Alexander Burger
Hi Kashyap,

> If I remember correctly - pil21 initially did not have the POSIX
> requirement. Is there a way to get older versions of pil21 (I know that it
> is a strange request for a POC :) )

How do you mean that? Pil21 is not even finished for the first version.

But anyway it was always POSIX (as pil32 and pil64).

☺/ A!ex


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


Re: native/lisp in picolisp32

2020-05-08 Thread C K Kashyap
Thanks Alex,
I think I'll try and see if I can get a simple SDL callback to work with
miniPicoLisp - that way, I can really understand the issues better.
If I remember correctly - pil21 initially did not have the POSIX
requirement. Is there a way to get older versions of pil21 (I know that it
is a strange request for a POC :) )

Thanks Tomas for your ffi link.

Regards,
Kashyap

On Fri, May 8, 2020 at 2:24 AM Tomas Hlavaty  wrote:

> Hi Kashyap,
>
> C K Kashyap  writes:
> > I am now trying to figure out how to do FFI min miniPicoLisp and I
> > realized that only pil64 has native/lisp support. Is there any reason
> > it could not be done in the 'c' implementation of pil32? I just wanted
> > to make sure that there is no "impossibility" about attempting to port
> > the native/lisp functions to miniPicoLisp.
>
> here is an example of ffi with minipicolisp:
> https://logand.com/sw/mplisp/files.html
>
> Cheers
>
> Tomas
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: native/lisp in picolisp32

2020-05-08 Thread Tomas Hlavaty
Hi Kashyap,

C K Kashyap  writes:
> I am now trying to figure out how to do FFI min miniPicoLisp and I
> realized that only pil64 has native/lisp support. Is there any reason
> it could not be done in the 'c' implementation of pil32? I just wanted
> to make sure that there is no "impossibility" about attempting to port
> the native/lisp functions to miniPicoLisp.

here is an example of ffi with minipicolisp:
https://logand.com/sw/mplisp/files.html

Cheers

Tomas

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



Re: native/lisp in picolisp32

2020-05-08 Thread Alexander Burger
Hi Kashyap,

> I think I have fully digested gen3m.c at this point :). I am now trying to
> figure out how to do FFI min miniPicoLisp and I realized that only pil64
> has native/lisp support. Is there any reason it could not be done in the
> 'c' implementation of pil32?

Pil32 and miniPicoLisp are written in C, and C does not support calling other
functions in a generic way. This is one of the reasons pil64 was written in
assembly (in addition to stack control and CPU status bits).


> I just wanted to make sure that there is no
> "impossibility" about attempting to port the native/lisp functions to
> miniPicoLisp.

Meanwhile there *is* a way: libffi - which takes care of that low level stuff. I
use it now in pil21 (only a proof of concept so far, I hope it is indeed
portable enough).


> A quick question on gen3m.c - I noticed an unused parameter '*mem' in mkSym
> - is there a reason to let it remain?

Right, it seems to be replaced in the function by always "(Rom+%d)", so it is
indeed not needed.

☺/ A!ex

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


native/lisp in picolisp32

2020-05-07 Thread C K Kashyap
Hi Alex,
I think I have fully digested gen3m.c at this point :). I am now trying to
figure out how to do FFI min miniPicoLisp and I realized that only pil64
has native/lisp support. Is there any reason it could not be done in the
'c' implementation of pil32? I just wanted to make sure that there is no
"impossibility" about attempting to port the native/lisp functions to
miniPicoLisp.

A quick question on gen3m.c - I noticed an unused parameter '*mem' in mkSym
- is there a reason to let it remain?

Regards,
Kashyap