Re: Guile and Atom or XMPP

2010-07-28 Thread Thien-Thi Nguyen
() Mike Gran 
() Tue, 27 Jul 2010 16:26:10 -0700 (PDT)

   Are there libraries about that would allow Guile to interact
   with the Atom Syndication Format

I use ttn-do program format-atom-feed for output:
http://www.gnuvola.org/software/ttn-do/ttn-do.html.gz#format_002datom_002dfeed

Here is its primary artifact, for example:
http://www.gnuvola.org/NEWS.atom

For input, some wrapping of xml2sexp is probably indicated:
http://www.gnuvola.org/software/ttn-do/ttn-do.html.gz#xml2sexp

That said, ttn-do has not yet made the slog to Guile 2.x, though 2010 wanes...



Plotting in Guile

2010-07-28 Thread Joel James Adamson
Hello,

I am using Guile to iterate equations and produce trajectories from
those iterations.  My current strategy is to redirect the stdout to a
file and then use GNUPLOT to plot the trajectories as parametric
plots.  However, I would like to contain everything within one program,
to keep Makefiles simple and (ideally) only deal with one programming
language for the project.

Any suggestions on how to accomplish this?

1. Is there is a plotting extension for guile, or a library that I could
use in such a way?  The advantage of GNUPLOT is that it can produce many
different kinds of output, including SVG and Pstricks code.  If a
plotting module exists, I haven't found it yet.

2. My thoughts were that I could use the POSIX IPC modules available in
Guile to run GNUPLOT and send commands through a pipe or other
appropriate interface.  Despite knowing little of how IPC works or the
best way to accomplish this, I always like to learn something new.  Does
this sound like it's worthwhile or like it would work at all?

Thanks,

Joel
-- 
Joel J. Adamson
Servedio Lab
University of North Carolina at Chapel Hill

FSF Member #8164
http://www.unc.edu/~adamsonj


pgpPbUiPMvkIZ.pgp
Description: PGP signature


Re: Plotting in Guile

2010-07-28 Thread Hans Aberg

On 28 Jul 2010, at 17:21, Joel James Adamson wrote:


I am using Guile to iterate equations and produce trajectories from
those iterations.  My current strategy is to redirect the stdout to a
file and then use GNUPLOT to plot the trajectories as parametric
plots.  However, I would like to contain everything within one  
program,

to keep Makefiles simple and (ideally) only deal with one programming
language for the project.


GNUPLOT seems to require pipes, if not using a file.

2. My thoughts were that I could use the POSIX IPC modules available  
in

Guile to run GNUPLOT and send commands through a pipe or other
appropriate interface.


Guile has a command scm_pipe() (see manual). It is not difficult to  
link to C-code - that is a point of using Guile.


You might also define a new type, which i Guile is called a SMOB  
(small object). Again, this is not difficult to do.


  Hans





Re: Plotting in Guile

2010-07-28 Thread Mike Gran
> Hello,
> 
> 1. Is there is a plotting extension for guile, or a library that I could
> use in such a way?  The advantage of GNUPLOT is that it can produce many
> different kinds of output, including SVG and Pstricks code.  If a
> plotting module exists, I haven't found it yet.

For my own personal use, I have a Guile binding of GNU Plotutils.  I had
planned that someday I'd clean it up and making it available.  It has most
of the functionality of the GNU Plotutils 'graph' program.  

(But, I guess if you want a solution today, my vaporware isn't going to help.)

-Mike Gran



build guile error

2010-07-28 Thread Eric J. Van der Velden
Hallo,

I tried to build guile, but I have that sizeof(char) is not 1 error. I
compiled libtools myself, and did

/configure  --prefix=... LDFLAGS=-L...//libtool-2.2.10-install_OWN/lib/
CPPFLAGS=-I.../libtool-2.2.10-install_OWN/include

so that ltdl.h and libltdl.so are found.

Also, there is in /usr/lib libltdl.so.3.1.6 . But this is not found? Or is
it because of those 3.1.6 behind it?

Thanks,


Re: Plotting in Guile

2010-07-28 Thread Joel James Adamson
Mike Gran  writes:

>> Hello,
>> 
>> 1. Is there is a plotting extension for guile, or a library that I could
>> use in such a way?  The advantage of GNUPLOT is that it can produce many
>> different kinds of output, including SVG and Pstricks code.  If a
>> plotting module exists, I haven't found it yet.
>
> For my own personal use, I have a Guile binding of GNU Plotutils.  I had
> planned that someday I'd clean it up and making it available.  It has most
> of the functionality of the GNU Plotutils 'graph' program.  

My questions:
1.  What is the status of Plotutils?  I looked into it a while ago and
it seemed really out of date and seemed to have a very small user
community
2. Can plotutils produce a variety of outputs?  Pstricks or EPS output
   would be best; SVG would be a plus

> (But, I guess if you want a solution today, my vaporware isn't going
> to help.)

Today would be nice, but before I graduate is more what I'm looking
for.  If plotutils is what I'm looking for, then perhaps we can
collaborate to make your code more presentable.

Joel

-- 
Joel J. Adamson
Servedio Lab
University of North Carolina at Chapel Hill

FSF Member #8164
http://www.unc.edu/~adamsonj


pgpuNX7Q9OJhI.pgp
Description: PGP signature


Re: Guile and Atom or XMPP

2010-07-28 Thread Mike Gran
> From: Thien-Thi Nguyen t...@gnuvola.org

>   Are there libraries about that would allow Guile to interact
>   with the Atom Syndication Format
> 
> I use ttn-do program format-atom-feed for output:
> http://www.gnuvola.org/software/ttn-do/ttn-do.html.gz#format_002datom_002dfeed

Sweet.  I'll check it out.

Thanks,

-Mike Gran




Re: Plotting in Guile

2010-07-28 Thread Mike Gran
> > For my own personal use, I have a Guile binding of GNU Plotutils.  I had
> > planned that someday I'd clean it up and making it available.  It has most
> > of the functionality of the GNU Plotutils 'graph' program.  
> 
> My questions:
> 1.  What is the status of Plotutils?  I looked into it a while ago and
>     it seemed really out of date and seemed to have a very small user
>     community

I think it is more dead than alive, I think.  There are bug-fix releases, 
including one in late 2009, but, the official gnu website hasn't been updated 
in a decade or so.  There is no git repo, so it is hard to know if any work
is being done on it.

Even so, it does a great job at your standard 2D graphs.

> 2. Can plotutils produce a variety of outputs?  Pstricks or EPS output
>   would be best; SVG would be a plus

It claims to be able to do PS, PNG and SVG, and some other obscure formats.
I've only used X, tek, and PNG. I don't think it'll do Pstricks.

What is the state of the are in open-source plot libraries these days?

-Mike Gran



Re: Plotting in Guile

2010-07-28 Thread Joel James Adamson
Hans Aberg  writes:

> On 28 Jul 2010, at 17:21, Joel James Adamson wrote:
>
>> I am using Guile to iterate equations and produce trajectories from
>> those iterations.  My current strategy is to redirect the stdout to a
>> file and then use GNUPLOT to plot the trajectories as parametric
>> plots.  However, I would like to contain everything within one
>> program,
>> to keep Makefiles simple and (ideally) only deal with one programming
>> language for the project.
>
> GNUPLOT seems to require pipes, if not using a file.

The question from the IPC newbie (myself): is there something wrong with
pipes?  I've read a basic tutorial and they seem to do what I would
need, but the author seemed to think they were worthless.  Educate me.

>> 2. My thoughts were that I could use the POSIX IPC modules available
>> in
>> Guile to run GNUPLOT and send commands through a pipe or other
>> appropriate interface.
>
> Guile has a command scm_pipe() (see manual). It is not difficult to
> link to C-code - that is a point of using Guile.

So would I write a C program to handle the IPC between guile and
GNUPLOT, and then control it with Scheme?

Thanks,
Joel

-- 
Joel J. Adamson
Servedio Lab
University of North Carolina at Chapel Hill

FSF Member #8164
http://www.unc.edu/~adamsonj


pgp3tj3pwIPUf.pgp
Description: PGP signature


Re: Plotting in Guile

2010-07-28 Thread Joel James Adamson
Mike Gran  writes:

>> > For my own personal use, I have a Guile binding of GNU Plotutils.  I had
>> > planned that someday I'd clean it up and making it available.  It has most
>> > of the functionality of the GNU Plotutils 'graph' program.  
>> 
>> My questions:
>> 1.  What is the status of Plotutils?  I looked into it a while ago and
>>     it seemed really out of date and seemed to have a very small user
>>     community
>
> I think it is more dead than alive, I think.  There are bug-fix
> releases, including one in late 2009, but, the official gnu website
> hasn't been updated in a decade or so.  There is no git repo, so it is
> hard to know if any work is being done on it.

I've just created svg and ps versions of one graph using "graph."
Pretty easy.  The big problem is getting the look of the rest of my
LaTeX document within the graph (e.g. axis labels).  I wouldn't want to
get a new look just so I can use a particular graphing package when
another offers the more flexible option.

> What is the state of the are in open-source plot libraries these days?

It seems the best options are GNUPLOT and a relative newcomer called
PLPlot[1] that I will try out today.

Joel

Footnotes: 
[1]  http://plplot.sourceforge.net/

-- 
Joel J. Adamson
Servedio Lab
University of North Carolina at Chapel Hill

FSF Member #8164
http://www.unc.edu/~adamsonj


pgphx8ySuJFAr.pgp
Description: PGP signature


Re: Plotting in Guile

2010-07-28 Thread Linas Vepstas
On 28 July 2010 12:54, Joel James Adamson  wrote:
> Hans Aberg  writes:
>>
>> GNUPLOT seems to require pipes, if not using a file.
>
> The question from the IPC newbie (myself): is there something wrong with
> pipes?  I've read a basic tutorial and they seem to do what I would
> need, but the author seemed to think they were worthless.  Educate me.

Nothing. If you are a young programmer who is used to subroutine API's
then working with pipes is disconcerting. If you are a hot-shot web
designer, then the fact that its not XML and RPC and DTD and
stylesheets and whatever makes it feel stone-age. I'm guessing the
tutorial author was one/both of those.

--linas



Re: Plotting in Guile

2010-07-28 Thread Joel James Adamson
Linas Vepstas  writes:

> On 28 July 2010 12:54, Joel James Adamson  wrote:
>> Hans Aberg  writes:
>>>
>>> GNUPLOT seems to require pipes, if not using a file.
>>
>> The question from the IPC newbie (myself): is there something wrong with
>> pipes?  I've read a basic tutorial and they seem to do what I would
>> need, but the author seemed to think they were worthless.  Educate me.
>
> Nothing. If you are a young programmer who is used to subroutine API's
> then working with pipes is disconcerting. If you are a hot-shot web
> designer, then the fact that its not XML and RPC and DTD and
> stylesheets and whatever makes it feel stone-age. I'm guessing the
> tutorial author was one/both of those.

I see your point: I'm Unix to the core!

I just have to figure out how to use pipes...

Joel

-- 
Joel J. Adamson
Servedio Lab
University of North Carolina at Chapel Hill

FSF Member #8164
http://www.unc.edu/~adamsonj


pgp4sOUYg4xkn.pgp
Description: PGP signature


Re: Plotting in Guile

2010-07-28 Thread Hans Aberg

On 28 Jul 2010, at 19:54, Joel James Adamson wrote:


GNUPLOT seems to require pipes, if not using a file.


The question from the IPC newbie (myself): is there something wrong  
with

pipes?  I've read a basic tutorial and they seem to do what I would
need, but the author seemed to think they were worthless.  Educate me.


I'm no expert, but pipes are simple and effective, though somewhat  
limited, as one program must be the descendant of another. Bison uses  
a pipe to call M4, which works just fine, and you have a similar  
application. Earlier, it used the writing file variation, and there is  
a problem with cleanup.



2. My thoughts were that I could use the POSIX IPC modules available
in
Guile to run GNUPLOT and send commands through a pipe or other
appropriate interface.


Guile has a command scm_pipe() (see manual). It is not difficult to
link to C-code - that is a point of using Guile.


So would I write a C program to handle the IPC between guile and
GNUPLOT, and then control it with Scheme?


Guile has both scm_pipe() to use in a C program, and pipe to use in  
Scheme code. So you might try calling it directly. If you turn GNUPLOT  
into a library, you can link it directly to Guile.


  Hans





Re: Plotting in Guile

2010-07-28 Thread Joel James Adamson
Hans Aberg  writes:

> Guile has both scm_pipe() to use in a C program, and pipe to use in
> Scheme code. So you might try calling it directly. If you turn GNUPLOT
> into a library, you can link it directly to Guile.

There was such a library a few years back, but it is now out of synch
with the main GNUPLOT development line.

The first thing I need to do (I think) is learn more about how GNUPLOT
can be manipulated.

Joel

-- 
Joel J. Adamson
Servedio Lab
University of North Carolina at Chapel Hill

FSF Member #8164
http://www.unc.edu/~adamsonj


pgpaobldi5CGi.pgp
Description: PGP signature


Guile, C++, and Mac OS X 10.4 (powerpc)

2010-07-28 Thread Mike Solomon
Hey guile users,
Trying to compile the simple example bessel.c from
Writing-Guile-Extensions.html (renamed bessel.cc because I'm using g++), I
encountered the following error:

bessel.cc: In function 'void init_bessel()':
bessel.cc:13: error: invalid conversion from 'scm_unused_struct*
(*)(scm_unused_struct*)' to 'scm_unused_struct* (*)(...)'
bessel.cc:13: error:   initializing argument 5 of 'scm_unused_struct*
scm_c_define_gsubr(const char*, int, int, int, scm_unused_struct* (*)(...))'

This even comes up when I put everything in extern "C" { ... }.  I have seen
other postings on the net for other software (lilypond, swig) that speaks of
the same issue, and some suggest that it is a problem with g++ and not
guile.  I'm using powerpc-apple-darwin8-g++-4.0.1 (GCC) 4.0.1 (Apple
Computer, Inc. build 5370)

I know that Lilypond uses a workaround where it defines something called
GUILE_ELLIPSIS, but I am not sure how this logic can be integrated into a
small snippet of code.

Anyway, if any of you know how I can make the bessel example compile on OS X
10.4 PPC using g++ 4.0.1, I'd much appreciate it!

Cheers,
Mike





Re: Plotting in Guile

2010-07-28 Thread Hans Aberg

On 28 Jul 2010, at 20:50, Joel James Adamson wrote:


Guile has both scm_pipe() to use in a C program, and pipe to use in
Scheme code. So you might try calling it directly. If you turn  
GNUPLOT

into a library, you can link it directly to Guile.


There was such a library a few years back, but it is now out of synch
with the main GNUPLOT development line.

The first thing I need to do (I think) is learn more about how GNUPLOT
can be manipulated.


It is probably simplest to not turn it into a library on your own  
except for experimentation.


  Hans





Re: Guile, C++, and Mac OS X 10.4 (powerpc)

2010-07-28 Thread Hans Aberg

On 28 Jul 2010, at 21:49, Mike Solomon wrote:


Hey guile users,
   Trying to compile the simple example bessel.c from
Writing-Guile-Extensions.html (renamed bessel.cc because I'm using g+ 
+), I

encountered the following error:

bessel.cc: In function 'void init_bessel()':
bessel.cc:13: error: invalid conversion from 'scm_unused_struct*
(*)(scm_unused_struct*)' to 'scm_unused_struct* (*)(...)'
bessel.cc:13: error:   initializing argument 5 of 'scm_unused_struct*
scm_c_define_gsubr(const char*, int, int, int, scm_unused_struct* (*) 
(...))'


The SCM type is a pointer to an undefined C type - C hack, which  
clashes with C++. Clever in C, but bad for C++ users.


This even comes up when I put everything in extern "C" { ... }.  I  
have seen
other postings on the net for other software (lilypond, swig) that  
speaks of

the same issue, and some suggest that it is a problem with g++ and not
guile.  I'm using powerpc-apple-darwin8-g++-4.0.1 (GCC) 4.0.1 (Apple
Computer, Inc. build 5370)


When you use g++, all stuff is compiled as C++. So use gcc and add c++  
libraries when linking.


Then in formally correct C++, main() must be C++. Gcc accepts calling C 
++ from C, but attempting to pass an exception through a C function is  
converted to a termination exception.


So I wrote a C++ function scm::init_guile() calling scm_init_guile()  
and other stuff that needs to be initialized. Then

  int main(int argc, char** argv) {
init_guile();

try {
  ...
}
...
  }

Then write a header bessel.h

#ifndef BESSEL_H
#define BESSEL_H

/* Copyright ...
   Free Software Foundation GNU General Public License 

 */

#ifdef __cplusplus
extern "C" {
#endif

void init_bessel();
...

#ifdef __cplusplus
} // extern "C"
#endif

#endif BESSEL_H


The file bessel.c is compiled as C, but your C++ files include bessel.h.

  Hans






Re: Plotting in Guile

2010-07-28 Thread Thien-Thi Nguyen
() Joel James Adamson 
() Wed, 28 Jul 2010 14:43:49 -0400

   I just have to figure out how to use pipes...

Have you looked at the friendly manual?  If you find something
there is unclear, we can kill two birds with one stone:

 - improve the manual (with cooperation from Guile hackers)
 - help a (pipes w/ Guile) newbie

Even if everything is perfectly clear, perhaps such an
application (Guile + GNUPLOT) can serve as a small example.
In this way we can ratchet the manual's usefulness.