This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: awk imitation with guile


Jim Blandy writes:
 > 
 > >  > The Scheme48 license isn't Open Source because it requires you to give
 > >  > the authors notice for commercial use.  In a business context, where
 > >  > you're trying to keep things secret until their release, this could be
 > >  > annoying.  I think the FSF would say this isn't quite Free software
 > >  > either.
 > > 
 > > It's semi-free.
 > 
 > Okay. :)
 > 
 > 
 > >  > Note that SCSH just inherited its license from Scheme48.  I know Olin
 > >  > is very much in favor of free software, and I'd bet he'd entertain the
 > >  > notion of releasing the SCSH code (considered separately from the
 > >  > Scheme48 code also included in the SCSH distribution) under the GPL as
 > >  > well.
 > >  > 
 > > Does scsh take nontrivial code from scheme48, thus making it a derived work?
 > 
 > Most of SCSH is written in Scheme, and it just runs on top of
 > Scheme48.  It adds a few C functions to Scheme48, for regexp matching
 > and such.  It is quite separable from Scheme48.  Olin and Brian are
 > the authors of everything that we really need.
 > 
 > > Btw I originally mentioned Bevan's bawk package for r4rs in this
 > > thread.  I was now able to contact Bevan and he allows to use,
 > > modify and redistribute it in any way, expecting an informal
 > > acknowledgement.  A. Jaffer also wrote an interface from bevan's
 > > packages for slib.
 > 
 > If you would like to package that up for Guile and post it, we could
 > include it in the contrib area.
 > 

As there are many files involved and they are all easily available from 
the indiana scheme repository, I rather describe here my strategy to get them
to work with the guile module system only.
 There are several tarballs required from Bevan's contributions: bawk.tar.gz
depends on string.tar.gz , btree.tar.gz and char-set.tar.gz .
Each of them contains several scheme files. string.tar.gz for example contains
files string00.scm, string01.scm, ... until string59.scm .
Those files depend on each others and on those from other packages, the 
dependencies are represented by (require 'feature) calls. If one wants to do
without slib, one needs to get rid of the requires and merge all files from
within a package into one big file, wiping out the requires. This can be
achieved by a shell-script like the following:

for file in string*.scm
do
	sed 's/^(require//' < $file
done > string.scm
 
then one needs to turn the mega files thus obtained into guile modules,
by defining them as such and declaring their mutual dependencies. Of course
it depends where one wants to have the modules (see our discussions about
the module system in the last weeks). I put them all in the util hierarchy
for now, thus e.g.
bawk.scm starts with

(define-module (util bawk)
:use-module (util char-set)
:use-module (util string)
:use-module (util btree))

string.scm with

(define-module (util string)
:use-module (util char-set))

char-set and btree don't depend on other modules.

Finally, many of the procedures need to be defined as public. I might not have
done this very carefully, so there should be inconsistencies in the result.
Experience might show and enforce corrections. 

I can send my util hierarchy as uuencoded archive to interested participants,
> 200 kB are too much for a mailing list, some mailgates and providers have
size restrictions for bulk.


The performance is not overly convincing. Using the shared substring concept 
of guile might trigger an essential boost.

   Klaus Schilling