Unsubscribe
Good bye Vijay Mathew vijay.the.sche...@gmail.com :-( You are now unsubscribed -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
PicoLisp on Plan9
I compiled the full PicoLisp natively on Plan9, without using GCC. I am planning to replace the POSIX/Sockets functions with Plan9's simple, 'file io' style interface for networking, cpu sharing etc. Plan9 specific features like channels, graphics and threads will be added so that Pico can be used as a full 'systems' language for that OS. As there will be so many changes and new low-level functions, do I have to call this port SomeLisp derived from PicoLisp? Thanks, -- Vijay -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: Porting PicoLisp to Plan9
Plan9 has a GCC port on which pico compiles with a few changes. (The changes are required because the GCC port itself is not complete!). The binary runs with no problems. About the lack of shared libraries on Plan9: Plan9 don't need shared libraries because components on Plan9 can interact using just four system calls - open, read, write and close. As an example consider a graphics library that could be shared by various applications: /* Pseudo C */ handle =3D LoadLibrary (graphics.so); CallFn (handle, drawRect, 0, 0, 200, 200); Close (handle); The equivalent plan9 code will be something like this: handle =3D open (/sys/graphics/cntl); cmd =3D drawRect 0 0 200 200; write (handle, cmd, strlen (cmd)); close (handle); The interesting thing is that /sys/graphics/cntl/ could be on a remote file system. This makes distributed computing easy and shared libraries redundant. Thanks, -- Vijay On Fri, Sep 3, 2010 at 1:17 PM, Mateusz Jan Przybylski dexen.devr...@gmail.com wrote: Hi Tomas, On Thursday 02 September 2010 19:32:40 you wrote: makes up my daily work environment ;) cool. =A0I looked at it briefly but couldn't find my way around. =A0Do y= ou really use that acme editor or how it's called? =A0Is it possible to run it as console only with vi (or emacs;-)? even more ot To clear it up, i use the `Plan 9 from User Space' (i.e., the tools porte= d to POSIX). Mostly because of Acme -- for very quick edit/[compile/]run/open-file-wit= h- error cycle, and for the Rc shell -- practical for scripting. http://swtch.com/plan9port/man/man1/install.html Acme requires GUI (it could be implemented with exact same semantics in t= ext mode, I guess, but it isn't). However, it uses little bandwidth, and so i= t's usual and natural to use it over network in both native Plan 9 and ported= X11 version. ssh -Y -C gets the job done even on slow links. It took me a few (3?) months to learn to use Acme efficiently. Acme takes a three-buttoned mouse, preferably with a scroll. It's pretty important to have all three physical buttons, since a lot is done via cho= rding two buttons. Acme understands and uses a certain text processing language, based on se= d's. It's executed via the `Edit THE_PROGRAM'. For example, I indent selected portion of text with: Edit s,^, =A0 =A0 =A0 ,g To find current selection address(es), I do Edit =3D etc.etc. You ought to have plumber up and running before you start Acme http://swtch.com/plan9port/man/man4/plumber.htm to get some extra functionality, mostly related to opening files you indi= cate with rightclick. You want the plumber started on the same machine the Acme is running (one= of POSIX limitations) My plumbing rules (the file is $HOME/lib/plumbing) are as follows: #file / line in PHP format type is text data matches '(.+) on line ([0-9]+)' arg isfile $1 data set $file attr add addr=3D$2 plumb to edit include /usr/local/plan9/plumb/initial.plumbing As a curiosity, there are no shared libraries in P9 -- only what we ca= ll `static linking'. It's awesome in the longer run 3 What's so awesome about it? No DLL hell. Programs (and thus processes) and libraries are very small. Greater percentage of code data fits in CPU cache. Less indirect more direct data access code calls/jumps. etc. etc. http://harmful.cat-v.org/software/dynamic-linking/ and it avoids the worst bane of DLL so far: http://harmful.cat-v.org/software/dynamic-linking/versioned-symbols /even more ot tl;dr: Plan 9 from User Space provides tools that may appeal to a long-time POSI= X user ;-) Cheers, -- Mateusz Jan Przybylski ``One can't proceed from the informal to the formal by formal means.'' -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: Porting PicoLisp to Plan9
Hi Alex, Thanks for the help. I have made quite a few changes to adapt pico to the plan9 compiler. I don't think there is a compiler flag that let me align addresses. I have to search further or repeat the changes in the bigpico and try to compile that. Anyway, have to wait till I get a comfortable weekend or the next holiday. :-) Thanks, -- Vijay On Thu, Sep 2, 2010 at 11:27 AM, Alexander Burger a...@software-lab.de wro= te: Hi Vijay, I've been trying to port PicoLisp to Plan9 Great! :) (http://plan9.bell-labs.com/plan9/). The code compiled but the binary fails at startup because of the following check in boxSubr(fun f): =A0 =A0 =A0 if (num(f) 3) =A0 =A0 =A0 =A0 =A0giveup(Unaligned function); I see. This is miniPicoLisp. For reasons of internal tag bits, it is necessary that those functions start at an address aligned to a multiple of four. Do you know if there is some compile time flag, e.g. some optimization parameter, which could guarantee that? Another option might be to first compile to assembly language, do some processing on the asm file (inserting 'align' statements), and then compile to final object code. BTW, the full picoLisp doesn't have that restriction. Do you think it is possible to port that version? Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: Porting PicoLisp to Plan9
Hi all, I think this will be of great help: http://doc.cat-v.org/plan_9/4th_edition/papers/ape -- Vijay On Thu, Sep 2, 2010 at 7:47 PM, Mateusz Jan Przybylski dexen.devr...@gmail.com wrote: On Thursday 02 September 2010 15:42:56 you wrote: Hi Vijay and Mateusz, On Thursday 02 September 2010 13:52:32 you wrote: Thanks for the help. I have made quite a few changes to adapt pico to the plan9 compiler. I don't think there is a compiler flag that let me Oh, so this sounds rather tough. Is Plan9 not a POSIX system? slightly ot It is not by itself. It was written as a Unix replacement, by the fathers of Unix. They found full Unix compatibility too constraining at some point. However, Plan 9 shares a lot of core concepts with Unix; in a way, it just takes Unix one logical step further. A lot of semantics and APIs is similar enough to POSIX for a thin, straightforward POSIX compatibility environment (APE) to exist. On the other hand, a lot of P9 innovations trickled down to recent Unix derivatives and wannabes, for example the clone() syscall, bitblit API, UTF-8 and so on. Moreover, a lot of Plan 9 softwari can, and indeed has been, ported to POSIX -- `Plan 9 from Userspace' resulted. Some functionality is missing because POSIX is very lacking in some areas, but it's pretty useful anyway -- and makes up my daily work environment ;) As a curiosity, there are no shared libraries in P9 -- only what we call `static linking'. It's awesome in the longer run 3 Misc resources related to Plan 9: http://cat-v.org/ /slightly ot align addresses. I have to search further or repeat the changes in the bigpico and try to compile that. Anyway, have to wait till I get a Porting picoLisp to a non-POSIX system might be very difficult, as a lot of functionality depends on it. In this regard, miniPicoLisp is much easier, as it uses more or less only plain vanilla C. I was pondering porting picoLisp to P9 for several months, and (with my limited understanding of P9) it doesn't seem very problematic. Never expected the matter of symbol alignment, thou. I think you could create a C program that reads symbols their values from a compiled (and possibly linked) executable and writes a new executable with functions aligned `by hand' to desired value. There is a bunch of functions in http://plan9.bell-labs.com/magic/man2html/2/symbol http://plan9.bell-labs.com/magic/man2html/2/object and http://plan9.bell-labs.com/magic/man2html/2/mach which let you read and write symbols from to files. Cool. But is it really able to relocate symbols? I couldn't detect that from scanning the above resources. If it does, what happens to other references from inside the object code to those relocated symbols? I dunno for sure. My understanding is, the linker (2l, as in two-ell) uses those APIs to output executables. So it's either `use them to read a compiled executable and generate a new executable', or `modify the underlying library and/or linker so it outputs stuff aligned'. -- Mateusz Jan Przybylski ``One can't proceed from the informal to the formal by formal means.'' -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Subscribe
Hello Vijay Mathew vijay.the.sche...@gmail.com :-) You are now subscribed -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: Floating point arithmetic
Hello Alex, Thanks for the detailed answer and thanks for PicoLisp! -- Vijay On Wed, Aug 25, 2010 at 5:34 PM, Alexander Burger a...@software-lab.de wro= te: Hi Vijay, How can I do floating point arithmetic in PicoLisp? Is there an example of fixed-point division? As your question seems to correctly presume, there is no real floating point arithmetic in PicoLisp. Fixed point numbers are actually scaled integer numbers. So a division always requires a multiplication with the scale _before_ actually dividing the numbers, and a multiplication needs a division by the scale _after_ multiplying the arguments. In both cases, the '*/' function (muldiv) is normally used. In addition to being faster than separate calls to '*' and '/', '*/' also rounds the result. For example: : (scl 6) =A0# Use a scale of 100 - 6 # Division : (*/ 17.0 1.0 3.0) =A0# Divide 17 by 3 - 567 : (format @ *Scl) =A0# See it as fixpoint - 5.67 # Multiplication : (*/ 12.345 0.99 1.0) =A0# Multiply 12.345 with 0.99 - 12221550 : (format @ *Scl) - 12.221550 As you see, the scale (100) can be specified conveniently as 1.0. Does this help? Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe