axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] Axiom under Windows


From: Martin Rubey
Subject: Re: [Axiom-developer] Axiom under Windows
Date: 09 Jun 2007 17:57:52 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

"Alfredo Portes" <address@hidden> writes:

> Hi Greg,
> 
> On 6/9/07, Gregory Vanuxem <address@hidden> wrote:
> 
> > Ok, thanks, that works for me with wh-sandbox and build-improvements. I
> > will now be able to test your code, better understand it and probably
> > experiment with it.
> 
> Can you share your experiences and how you got it to work. I have been trying
> to test the code, but everytime it crashes on me...I had posted my errors on
> the list but no answer (maybe my problem was too obvious or silly)....

Hm, did you get my mail from today?  (in any case: there is not problem that is
too obvious or silly! never say such things!) In case you didn't receive it, I
repeat it below.  I also updated the page on MathAction.

> I recompiled wh-sandbox and it seems to work fine the first two steps.
> However I get this:
> 
> (1) -> SOCKET(8080, getDocumentation$HyperDoc)

this should read

SOCKET(8080, getDocumentation$HyperDoc)$Lisp

(SOCKET is a Lisp function)

Please excuse me, if you find another problem, I'll try to answer quicker...

Just to make sure, here is the local version of my files.  I'm constantly
having problems to upload files to MathAction, unfortunately.

WARNINGS:

(1)

http://localhost:8080/?|integrate|

will take a *very* long time on the first run.  The idea of the design is to be
able to generate html on the fly, but only if absolutely necessary (i.e., if
third party libraries were added.)

I suggest that when axiom is built, or installed as a binary, the html should
be generated for everything already in the system.

(2)

since this code generates files in the current directory, I suggest that you
put it into a fresh directory.


Again, I'm very interested in feedback, especially from Windows users.

Martin

--hyper.input------------------------------------------------------------------

)lib HYPER
)lisp (load "hyper.lisp")
SOCKET(8080, getDocumentation$HyperDoc)$Lisp
-- direct the browser to
-- http://localhost:8080/?|binomial|
-- or
-- http://localhost:8080/?|binomial` `OutputForm|

--error.html-------------------------------------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  
  "http://www.w3.org/TR/html4/loose.dtd";>  
<html > 
<head><title></title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<meta name="generator" content="TeX4ht
  (http://www.cse.ohio-state.edu/~gurari/TeX4ht/mn.html)"> 
<meta name="originator" content="TeX4ht
  (http://www.cse.ohio-state.edu/~gurari/TeX4ht/mn.html)"> 
<!-- html --> 
<meta name="src" content="sum.tex"> 
<meta name="date" content="2007-04-21 21:59:00"> 
</head><body 
>
error
</body></html> 

--hyper.spad-------------------------------------------------------------------

)abbrev package HYPER HyperDoc
HyperDoc(): Exports == Implementation where

    Exports == with

        getDatabases: () -> Void

        getDocumentation: String -> String

    Implementation == add

        ops: Database IndexCard := getDatabase("o")$OperationsQuery

        getDatabases == 
            ops := getDatabase("o")$OperationsQuery


-- ostretch`2`x`(_$,ACMachineInteger)->_$`dCycleIndexSeries``

        filter(dbase: Database IndexCard, leq: List QueryEquation): Database
        IndexCard ==
            res: Database IndexCard := dbase
            for eq in leq repeat
                res := res.eq
            res

        getSpecification(op: IndexCard): String == 
            s: String := concat([op.'name, "`", op.'type, "`", op.'origin])
            systemCommand("sys rm myspec")$MoreSystemCommands
            f: TextFile := open("myspec"::FileName, "output")
            writeLine!(f, s)
            close! f
            systemCommand("sys md5sum myspec > md5spec")$MoreSystemCommands
            f: TextFile := open("md5spec"::FileName, "input")
            r := readLine! f
            close! f
            r.(1..32)

-- this function should really be in Database.  Well, actually Database should
-- export Table or some such
        coerce(dbase: Database IndexCard): List IndexCard ==
            dbase pretend List IndexCard

        getDocumentation s ==
            import QueryEquation
            import Database IndexCard
            ls := split(s, char "`")
            output(ls::OutputForm)$OutputPackage
            leq: List QueryEquation := []
            if ls.1 ~= "%20" then leq := [equation('name, ls.1)]
            if #ls > 1 and ls.2 ~= "%20" then leq := cons(equation('params,
            ls.2), leq)
            if #ls > 2 and ls.3 ~= "%20" then leq := cons(equation('origin,
            ls.3), leq)
            r: List IndexCard := coerce(filter(ops, leq))
            output(r::OutputForm)$OutputPackage
            if empty? r
            then "error.html"
            else
                res: String
                n := #r
                if n > 1 then 
                    res := "result.html"
                    output(res::OutputForm)$OutputPackage
                    g: TextFile := open(res::FileName, "output")
                    writeLine!(g, _ 
"<html > _
<head><title></title> _
<meta http-equiv=_"Content-Type_" content=_"text/html; charset=iso-8859-1_">_
</head><body>")
                    
                for op in r repeat
                    spec := getSpecification op
                    output(spec::OutputForm)$OutputPackage
                    if not exists?(concat(spec, ".html")::FileName) then
                        f: TextFile := open(concat(spec, ".tex")::FileName,
                    "output")
                        writeLine!(f, _ 
"\documentclass{amsart}_
\usepackage{hyperref}_
\newcommand{\spad}[1]{#1}_
\newcommand{\spadtype}[1]{#1}_
\newcommand{\spadfun}[1]{\href{http://localhost:8080/?|#1|}{#1}}_
\newcommand{\spadignore}[1]{#1}_
\newcommand{\undocumented}{{\bf undocumented}}_
\newcommand{\blankline}{\par}_
\newcommand{\indented}[2]{#2}_
\def\axiom{\spad}_
\def\axiomType{\spadtype}_
\begin{document}")
                        writeLine!(f, op.'doc)
                        writeLine!(f, "\end{document}")
                        close! f
                        systemCommand(concat ["sys htlatex '", spec, ".tex'
                    _"html,css-in_""])
                                     $MoreSystemCommands
                        systemCommand("sys rm
                    *.{log,4tc,4ct,lg,tmp,aux,dvi,idv,xref,css}")
                                     $MoreSystemCommands

                    if n = 1 
                    then res := concat(spec, ".html")
                    else writeLine!(g, concat ["<a href='|", spec, ".html|'> ",
                    _
                                    op.'origin, "</a>"])

                if n > 1 then 
                    writeLine!(g, "</body></html>") 
                    close! g
                res

--hyper.lisp-------------------------------------------------------------------

;; try it with
;; )lisp (load "hyper.lisp")
;; SOCKET(8080, getDocumentation$HyperDoc)$Lisp

(defvar *docfun*)

(defun socket (port docfun)
  (setq *docfun* docfun)
  (let ((s (si::socket port :server #'server)))
    (tagbody l
             (when (si::listen s)
               (let ((w (si::accept s)))
                 (server w)))
             (sleep 0.1)
             (go l))))

; server provides the stream which is sent by socket to localhost:port
; needs tidying, especially the checking whether fn changed.  
; Does it make sense to check this?
(defun server (s)

; I do not know how to prevent read from making everything uppercase. Please
  help! 
  (let* ((get (read s nil 'eof))

; fn contains the string after "localhost:port", i.e., it will commence with a
  "/",
; which subseq removes
         (fn (and (eq get 'get) 
                  (subseq (string (read s nil 'eof)) 1))))

; the following is just a debugging message
    (format t "Got ~S~%~%" fn)

; when the leading char is a question mark, we have to prepare documentation
    (when (string= (char fn 0) "?")
; *docfun* should return the name of an html file
; in case of an error, it will also return the name of an html file, which will
; contain the error message
      (setq fn (SPADCALL (subseq fn 1) *docfun*)))

; when the trailing four characters of the string are "html", we assume that we
; have an html file and tell our browser so.
; note that pictures or stylesheets do not like being introduced with this
; header.
    (when (string= (subseq fn (- (length fn) 4)) "html")
      (format s "HTTP/1.1 ~S~%" (if fn 200 403)))

; finally, we open the file, and display it
    (with-open-file  (q fn) (si::copy-stream q s))
    (close s)))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]