Re: Quick try at building 64-bit on OSX 10.8.3

2013-05-23 Thread Alexander Burger
Hi Jorge,

 Ok, if that's the problem this is nicer… Does it compile without
 warnings on your 32-bit system?

Yes. Great! That's better. I didn't know about 'uintptr_t', that's
exactly what we need here. Thanks!

So let's stay with this :)

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


Re: Small URL problem at Cloud9

2013-05-23 Thread Alexander Burger
Hi Oskar,

 This is strange. 'ht:Pack' (in the 'ht' library) is part of the PicoLisp
 core. How did you install it? Along the lines of the INSTALL file, or
 from a Debian-Derivate?
 I build the emu version along the lines of your INSTALL file.
 With local installation mode on a 32-bit ubuntu 12.04.
 It worked on first try.

OK. So if 'ht:Pack' is undefined, then either the 'ht' library is not
found, or it somehow has the wrong contents.

What does

   $ file /usr/lib/picolisp/lib/ht

or (depending on your installation)

   $ file picoLispDir/lib/ht

say? Is it perhaps incompatible to your 'picolisp' executable (e.g.
remained from some other build)?

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


Re: Small URL problem at Cloud9

2013-05-23 Thread Oskar Wieland

Hi Alex,

OK. So if 'ht:Pack' is undefined, then either the 'ht' library is not
found, or it somehow has the wrong contents.

What does

$ file picoLispDir/lib/ht

say? Is it perhaps incompatible to your 'picolisp' executable (e.g.
remained from some other build)?

/lib/ht: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV),
dynamically linked, 
BuildID[sha1]=0x4cea250351b0b49806b2acb120c17435cc342f4a, stripped


I builded the 64-bit version again, got a new ht file and 'ht:Pack' is 
defined. (The timestamp on the files showed me I builded the 32-bit on 
top of the 64-bit)


And now the 32-bit version is showing 'ht:Pack' undefined :)

Better not run them in one installation?

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


Re: Small URL problem at Cloud9

2013-05-23 Thread Alexander Burger
Hi Oskar,

 I builded the 64-bit version again, got a new ht file and 'ht:Pack'
 is defined. (The timestamp on the files showed me I builded the
 32-bit on top of the 64-bit)

Fine. That explains it.


 And now the 32-bit version is showing 'ht:Pack' undefined :)
 Better not run them in one installation?

It is no problem if you unpack and build the tarball in two separate
directories. I have usually several version running on a single machine.
One of them you can make global by setting the symbolic links as
described in INSTALL.

The others can be used by giving eplicit path names, e.g.

   $ ./pil +

   $ /foo/bar/pil +

etc.

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


Re: Small URL problem at Cloud9

2013-05-23 Thread Jon Kleiser

Hi Alex,

It turns out that my default script was producing the same HTML code 
when I run it on c9.io (64-bit) as when I run it on localhost:8080/ 
(32-bit). E.g. the HTML on demo-project.jkleiser.c9.io/doc/ for the 
ref.html link was a href=doc/ref.htmlref.html/a, but in the 
browser that was expanded to the double-doc 
http://demo-project.jkleiser.c9.io/doc/doc/ref.html;. On c9.io I have 
now modified the default script like this

original: (td NIL (href F (pack Path F)))
new: (td NIL (href F F))

On localhost:8080, however, I've had to keep the original. Exactly why 
the browser treats localhost and c9.io differently, I'm not sure. Can 
you suggest a fix for my default script that will make it work in both 
contexts?


One more question:
Since in my web.l I use ...
(allowed (doc/) lib.css @lib/form.js favicon.ico !foo README)
.. I get a 404 Not Found if I try to go to 
http://demo-project.jkleiser.c9.io/doc; (with no / at the end). Can I 
modify my allowed to allow doc without the / at the end?


/Jon


On 22-05-13 17:38 , Alexander Burger wrote:

Hi Jon,


I inserted the (trace 'file) (on Cloud9) and what I get is this:
...
file = (doc// default . 3)

OK, good. That's the same I get.


Then Path must be doc//, and then doc/. So the problem is that

(href  F (pack Path F))

somehow builds two doc/ fragments?

Then 'F' must also contain doc/, which I can't believe, because (dir)
returns file names without paths.


I think there is no other way than doing further debugging. If I were
you, I would put an exclamation mark, e.g. in

(! let (Path (car (file))

and then single-step into the code to see what goes wrong (see the
tutorial for how to do this if necessary).

Alternatively, you may trace more functions, e.g.

(mapc trace '(file dir infohref))

to find out where things go wrong.

♪♫ Alex


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


Re: Small URL problem at Cloud9

2013-05-23 Thread Alexander Burger
Hi Jon,

 href=doc/ref.htmlref.html/a, but in the browser that was
 expanded to the double-doc
 http://demo-project.jkleiser.c9.io/doc/doc/ref.html;. On c9.io I
 ...
 sure. Can you suggest a fix for my default script that will make
 it work in both contexts?

Hm, this sounds as if the browser is using a different base href=
tag. The PicoLisp server generates one, but it contains only the
protocol (http or https), hostname and port. No path names whatsoever.
So I have no idea at the moment.


 One more question:
 Since in my web.l I use ...
 (allowed (doc/) lib.css @lib/form.js favicon.ico !foo README)
 .. I get a 404 Not Found if I try to go to
 http://demo-project.jkleiser.c9.io/doc; (with no / at the end).
 Can I modify my allowed to allow doc without the / at the end?

Yes, just omit the /. Everything in the list argument to 'allowed' is
allowed if it starts with those characters (i.e. is matched with
'pre?'). You just must be sure that there is no file or directory
starting with doc which should not be allowed.

Another way (perhaps better) would be to include doc in the normal
(exact) arguments to 'allowed' (and also keep doc/ in the list). This
allows direct requests to both doc/ and doc, but not docxxx.

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


Re: Small URL problem at Cloud9

2013-05-23 Thread Alexander Burger
Hi Jon,

 of doc/). Is it possible for my default script to access any info
 about the HTTP request from my web server (web.l)?

There are some globals which are set by the server, like

   *Url   The requested URL
   *Adr   The client's address
   *Post  Boolean GET/POST
   *SesId Session ID
   *ContLen   Content length
   *Http1 0 or 1
   *Host  Host machine
   *Gate  https or not
   *Referer   Referrer
   *Cookies   Assoc-List of cookies
   *Agent User agent

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


Re: Small URL problem at Cloud9

2013-05-23 Thread Jon Kleiser

Hi,

Here is my improved 'default' script. It now works both on c9.io and on 
localhost, and it handles both doc and doc/. The logic that takes 
care of all this, may not be rock solid and very clean, but at the 
moment it's the best I can do. Here it is:


# This 'default' will be executed as a script, called from lib/http.l

(let (Localhost (tail (chop 127.0.0.1) (chop *Adr))
IndexOf Index of 
Path (car (file))
APath Path
Th '(class . th) )
(when (tail '(/ /) (chop Path))
(setq Path (pack (head -1 (chop Path# removing extra 
/ at the end

(setq APath
(if Localhost
Path# need APath on localhost
 ) ) )# no APath needed
(html NIL
(pack IndexOf Path (when Localhost  (localhost)))# title
@lib.css
'(style . margin: 20px 60px; font-size: 105%;)# body style
(prin style scoped
tr:not(.th):hover {background-color: #ccf}
/style )
(h1 NIL IndexOf Path)
(table '(style . border-collapse: collapse) NIL NIL
(tr Th (th NIL Name) (th NIL Last modified) (th 
NIL Size))

(tr Th (th '(colspan . 3) (hr)))
(chdir Path
(for F (sort (dir))
(unless (= default F)# skipping name of 
this file

(let (Cnt (car (info F))
Dat (dat$ (cadr (info F)) -)
Tim (tim$ (cddr (info F))) )
(when (=T Cnt) (setq Cnt -))# directory
(tr NIL
(td NIL (href F (pack APath F)))
(td '(style . padding: 0 2em)
(span NIL Dat) (span '(style . 
padding-left: 1em) Tim) )
(td '(style . text-align: right) 
Cnt)) ) ) ) )

(tr Th (th '(colspan . 3) (hr))) )
(p '(style . margin: 0; font: italic small serif;)
(ht:Prin PicoLisp v (glue . (version T))  ( *OS ) 
Server) ) ) )


/Jon

On 23-05-13 14:19 , Jon Kleiser wrote:

Hi Alex,

I tried *Host and *Referer from my script, but they were empty. *Adr, 
however, gave me :::127.6.26.129, and that can be useful. I 
think I've also found a workaround for the doc / doc/ effect on 
the URLs in the list. I'll show it a little later ...


Thanks for the globals!

/Jon

On 23-05-13 13:59 , Alexander Burger wrote:

Hi Jon,


of doc/). Is it possible for my default script to access any info
about the HTTP request from my web server (web.l)?

There are some globals which are set by the server, like

*Url   The requested URL
*Adr   The client's address
*Post  Boolean GET/POST
*SesId Session ID
*ContLen   Content length
*Http1 0 or 1
*Host  Host machine
*Gate  https or not
*Referer   Referrer
*Cookies   Assoc-List of cookies
*Agent User agent

♪♫ Alex




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


Re: Quick try at building 64-bit on OSX 10.8.3

2013-05-23 Thread Jorge Acereda Maciá
Hi,

A quick question, what's the status of the *FPic variant on Linux? Is it 
working?
If it works properly, I guess I could get it running on OSX as well when I find 
some spare time...--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe