gcl-devel
[Top][All Lists]
Advanced

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

Re: [Axiom-developer] RE: [Gcl-devel] Re: axiom porting


From: Camm Maguire
Subject: Re: [Axiom-developer] RE: [Gcl-devel] Re: axiom porting
Date: 30 Apr 2005 17:55:08 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!

Bill Page <address@hidden> writes:

> Camm Maguire wrote:
> 
> >...
> >Here are my summary opinions at this point -- feedback most
> >appreciated!  (Just a note of clarification -- tcl/tk, which exists in
> >GCL now and is a portable scripting language, is *not the same* as
> >GTK+, an extremely widely used C library with multi-language bindings
> >running 'in-process')
> >
> >=========================================================================
> >Goal: generic GCL gui  -- short term
> >=========================================================================
> >
> >1) get the somewhat clunky but serviceable gcl-tk (i.e. tcl/tk)
> >   working on all platforms as quickly as possible (Need feedback from
> >   Mike and/or Bill)
> >
> For axiom's purposes on Windows I am not fond of this idea until and
> unless we already had a gcl-tk frontend for Axiom working under Linux.
> So I wouldn't push the "all platforms" requirement until we see how far
> this can go on a platform where this would (in principle) be easier (Linux).
> 
> But as I said before, perhaps there are good reasons to pursue this
> in GCL other than Axiom.
> 

Am happy to report that the top page of the hyperdoc browser can
already be implemented within axiom as currently distributed (at least
on Linux) using gcl-tk!

Just edit the 'gcl and 'gif variables at the top of the following to
point to your built or installed gcl directory and to the path of the
distributed axiom gif logo respectively, save it to e.g. "foo.lisp"
and within axiom do ')lisp (load "foo.lisp")':

=============================================================================
(in-package 'tk)
(let ((gcl "/usr/lib/gcl-2.6.6/")
      (gif "/usr/lib/axiom-20050201/doc/axiom_tutorialu/images/axiom_logo.gif"))
  (reset-sys-paths gcl)
  (tkconnect)
  (unless (fboundp '|image create photo|)
    (def-widget |image create photo|))
  (defun ahtll ( gif &optional (w '.ahtll))
    (if (winfo :exists w :return 'boolean)
        (destroy w))
    (if (winfo :exists w :return 'boolean) (destroy w))
    (toplevel w)
    (wm :title w "AXIOM HyperDoc")
    (wm :iconname w "HyperDoc")
    (let ((f1 (conc w '.frame1))
          (f2 (conc w '.frame2))
          (f3 (conc w '.frame3)))
      
      (frame f1 :relief "raised" :bd 2)
      (frame f2 :relief "raised" :bd 2)
      (frame f3 :relief "raised" :bd 2)
      
      (let ((b1 (conc f1 '.exit))
            (b2 (conc f1 '.help))
            (m1 (conc f1 '.msg))
            (b3 (conc f1 '.blank1))
            (b4 (conc f1 '.blank2)))
        
        (button b1 :text "Exit" :command (tk-conc "destroy " w))
        (button b2 :text "Help")
        (button b3 :text "")
        (button b4 :text "")
        (message m1 :font :Adobe-Times-Medium-R-Normal--*-180-* :width "13c" 
:bd 2 :relief "flat" 
                 :text "AXIOM HyperDoc TopLevel" :justify "center")
        
        (pack b1 :side "left" :pady 5)
        (pack b2 :side "left" :pady 5)
        (pack m1 :side "left" :pady 5 :fill "x" :expand "yes")
        (pack b3 :side "right" :pady 5)
        (pack b4 :side "right" :pady 5)
        
        (pack f1 :side "top" :fill "both" :expand "yes"))
      
      (let ((c (conc f2 '.c)))
        
        (canvas c :scrollregion "0c 0c 30c 24c" :width "15c" :height "10c"
                :relief "flat" :borderwidth 2)
        (let ((l (conc c '.logo))
              (i (conc c '.img)))
          (|image create photo| i :format "gif" 
           :file gif)
          (label l :image i :relief "flat" :borderwidth 2)
          (pack l :side "top" :anchor "center"))
        (pack c :side "top" :anchor "center")
        (pack f2 :side "top" :fill "both" :expand "yes"))
      (let ((m (conc f3 '.msg)))
        (message m :text "What do you want to do?" :width "13c" :bd 2 :justify 
"left")
        (pack m :side "top" :anchor "w"))
      (let ((f4 (conc f3 '.frame4)))
        (frame f4 :relief "flat" :bd 2)
        (let ((l '(|Basic Commands| |Reference| |Topics| |Browse|
                   |Examples| |Settings| |NAG Link| |About AXIOM| |What's New|))
              (i 0))
          (dolist (s l)
            (let ((f (conc f4 (intern (format nil ".f~a" i)))))
              (let ((b (conc f (intern (format nil ".b~a" i))))
                    (m (conc f (intern (format nil ".m~a" i)))))
                (frame f :relief "flat" :bd 2)
                (button b :command s)
                (message m :text (string s) :width "13c" :bd 2 :justify "left")
                (pack b :side "left")
                (pack m :side "left")
                (pack f :side "top" :fill "both" :expand "yes")))
            (incf i)))
        (pack f4 :side "left" :fill "both" :expand "yes"))
      (let ((f5 (conc f3 '.frame5)))
        (frame f5 :relief "raised" :bd 2)
        (let ((l '("Solve problems by filling in templates."
                   "Scan on-line documentation for AXIOM."
                   "Learn how to use AXIOM, by topic."
                   "Browse through the AXIOM library."
                   "See examples of use of the libarry."
                   "Display and change the system environment."
                   "Link to NAG Numerical Library."
                   "See some basic information about AXIOM."
                   "Enhancements in this version of AXIOM."))
              (i 0))
          (dolist (s l)
            (let ((m (conc f5 (intern (format nil "m~a" i)))))
              (message m :text s :width "13c" :bd 2 :justify "left")
              (pack m :side "top" :fill "y" :anchor "w" :expand "yes")
              (incf i))))
        (pack f5 :side "left" :fill "both" :expand "yes"))
      (pack f3 :side "top" :fill "both" :expand "yes")
      ))
  (ahtll gif))
=============================================================================

The only functional button is the exit button, for the purposes of
demonstration.  Other buttons are connected to symbols naming
functions yet to be written to generate subpages.

The interface is quite powerful in its closeness to lisp, IMHO, which
I think should be attractive to Tim.  Plus, the multiprocessing issues
have already been worked out, at least on Linux, via signalling with
SIGUSR1.  More on this later, but this effectively means that one can
direct the process from the GUI and the command line simultaneously.
Plus, Dr. Schelter put together some great documentation which is
found in the gcl distribution under the name gcl-tk.{texi,info}.

Of course, some 'wish', e.g. some tcl and some tk, need to be
installed to do this.  On Debian, just 'apt-get -q install tk8.4'.

More examples can be seen by firing up a built or installed gcl, doing
(tk::tkconnect), and loading the "...gcl-tk/demos/widget.lisp" file.
There are a few typos in the examples which I am cleaning up now.
Also, there is an older occasional difficulty in which a 'write
timeout' occurs between the gcl and gcltksrv process.  This is simply
due to the buffer settings in sheader.h being fractional page sizes in
some cases, which I've also fixed here locally and will push into
2.6.7.  Perhaps someone might dig up the old post to gcl-devel on this
issue and tell the submitter that the problem is apparently solved.

Mike, my guess now is that gcl-tk bombs on windows because of
sigusr1.  I agree with your earlier statement that signals are a
mistake for portability to windows.  However, I've just recently
recognized how much existing gcl functionality already exists using
signals.  I agree that we should not build anything new in this
regard, at least without some clear portability breakthrough, but I'm
wondering if we can find a passable solution to get this stuff working
on Windows.  sgc uses sigsegv processing, profil uses sigprof
processing, gcl-tk uses sigusr1 processing, and sockets can optionally
use sigio processing.  You have previously written about gtk+ mapping
its signal mechanism onto windows' 'event loop' processing.  I take it
that this is less than elegant, and gtk+ might have done same buggily,
but would this be a possibility for gcl on mingw, at least for these
four signals?  It would be a real coup, IMHO, if we could discover a
serviceable way of doing this.

More later.

Take care,


-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

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