swarm-support
[Top][All Lists]
Advanced

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

Gnumeric and Swarm Lisp archives


From: Marcus G. Daniels
Subject: Gnumeric and Swarm Lisp archives
Date: 23 Feb 1999 12:10:07 -0800

Just little a heads up on a nifty free software project called Gnumeric.

  http://www.gnome.org/gnumeric
  http://www.tw.gnome.org/gnumeric 
      (a mirror, the main site is currently unresponsive)

Briefly, Gnumeric is a free spreadsheet for Unix systems.  It aims to
provide Excel compatibility, and all of the features Users expect of a
modern spreadsheet.  FWIW, I think their progress is impressive.

Gnumeric is part of the GNOME project, a free CORBA-based desktop
system for Unix users.  Redhat is a contributor to GNOME, in addition
to course dozens of volunteers.  The next release of `R' will have
GNOME support.

Anyway, I hacked up a bit of code to show how Swarm Lisp archives can
be read into Gnumeric.  This is just to give a feel for Gnumeric's
extensibility; this code doesn't collate data into multiple sheets or
provide a resave option or anything like that.  (Incidentally, the
built-in storage format of Gnumeric is XML.)

Gnumeric (like GIMP) uses an embedded Scheme interpreter (Guile), and
it is possible to add new spreadsheet functions using this very
flexible programming language.  Below, I added a LOADARCHIVER function
to the spreadsheet.  The usage is to type "=LOADARCHIVER()" in a
spreadsheet cell.  The result of this bit of code is that the
per-application metadata (typically the positions of windows for
different Swarm applications) are loaded row by row into the scratch
spreadsheet.

Note, as of Swarm 1.4, any object can be stored to a Lisp archive, so
Gnumeric might be a useful analysis tool for handling Swarm parameters
or agent statistics.

The stuff below goes in ~/.gnumeric.scm.

(define *archiver-list* #f)
(define (make-instance type . args) (cons type args))
(define (archiver l) (set! *archiver-list* l))

(define (load-archiver)
  (load (string-append (getenv "HOME") "/.swarmArchiver"))
  (let loop ((al *archiver-list*)
             (i 0))
       (if (null? al)
           #f
           (let ((app (caar al))
                 (vals (cdar al)))
             (set-cell-string! (make-cell-ref 0 i) (symbol->string (car app)))
             (set-cell-string! (make-cell-ref 1 i) (symbol->string (cadr app)))
             (let ((j 0))
               (let loop-j ((vl vals))
                    (if (null? vl)
                        #f
                        (begin
                         (let loop-k ((kl (car vl)))
                              (if (null? kl)
                                  #f
                                  (begin
                                   (set-cell-string! (make-cell-ref (+ 2 j) i)
                                                     (call-with-output-string
                                                      (lambda (port)
                                                        (display (car kl) 
port))))
                                   (set! j (+ j 1))
                                   (loop-k (cdr kl)))))
                         (loop-j (cdr vl))))))
             (loop (cdr al) (+ i 1))))))

(register-function
  "loadarchiver" ""
  "@FUNCTION=LOADARCHIVER
@SYNTAX=LOADARCHIVER()
@DESCRIPTION=Set sheet data from ~/.swarmArchiver."
  load-archiver)


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

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