guile-user
[Top][All Lists]
Advanced

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

Re: Newbie pleading for help...


From: Alex Kim
Subject: Re: Newbie pleading for help...
Date: Wed, 20 Feb 2002 09:20:11 -0800 (PST)

Hello,

Thank you very much for your reply.  If you wouldn't
mind, I would like to ask you some more questions.

Guile ref. manual says that "An application can use
Guile as an extension language..." and this is exactly
what I want to do.  I am writing a simple image
processing toolkit with GUI in c. The GUI displays an
image and waits for input.  The input is an array of
points and the GUI draws lines connecting the points
on top of the image.  The input, ie, the array of
points, can be generated using various algorithms and
this is where I am trying to use GUILE as an extension
language: the toolkit provides to GUILE one simple
function that draws a line given two points; the
various algorithms are implemented in GUILE calling
the line drawing function to display their results.
This way, I can easily add new algorithms to the
toolkit without touching any other parts of the code.
And I got it work this far following mainly the
tortoise example written by David Drysdale.

Then, I wanted to add event processing loop for the
GUI itself to respond to the mouse interaction so
that I can interactively modify the lines as needed.
As I described in the previous message, this
turned out to be very hard for me to achieve since two
event loops that never return are required (one for
gh_repl and the other for GUI).  After many days
of struggling with pthread, I learned from the list's
archive that pthread can't solve the problem and also
learned that guile and gtk may give me the solution.
So, I am looking for some example codes or any
pointers that can help me solve my problem.  Simply
put, I am looking for something that works just like
the tortoise example (found on GUILE tutorial at
http://www.gnu.org/software/guile/docs/docs.html),
but with added event handling ability for mouse
interaction with GUI.

I hope I described my problem a bit clearer this time.
Do you think what I am trying to do can be achievable?
Again, I sincerely appreciate your reply and any
further advice/helps.
Thank you very much.

Sincerely,
---

Alex Kim





--- Bo Forslund <address@hidden> wrote:
> Hello!
> 
> 
> I'm afraid I can't say that I understand what You
> are asking, but I shall try to give an answer.
> 
> I think I understand that You want a graphic
> interface to scheme. You can have the interface
> written entirely in scheme using guile-gtk, or in
> C and use guile-gtk  glue functions to to call
> scheme functions.
> I managed to get a deck of cards written in scheme
> into a gtk interface some while ago. I also managed
> to do a little prog with the Glade GUI builder that
> called a scheme function.
> Unfortunate it got lost when I had a a crach and had
> to reinstall Linux from scratch. It was 4 - 5
> months ago so I don't remember very well what I did
> either.
> 
> I started out by reading the examples in guile-gtk
> (guile-1.5.4 and guile-gtk-0.21pre4). It was
> difficult to get them compile due to some errors in
> the Makefile.am.
> 
> I also read this pages I found on web.
> 
> 
> http://www.lilypond.org/wiki/?Guile
>
http://www.nada.kth.se/~mdj/guile-ref/guile-ref_toc.html#TOC10
> 
> 
> 
> I hope that tihs is to any help
> Bo Forslund
> 
> 
> Alex Kim wrote:
> 
> > Dear guile (and guile-gtk) experts,
> >
> > I understand that my question may irritate some of
> > you since it has been discussed here before.
> > Nevertheless, I am asking the question with 
> > desperation and as a last resort.
> > Many apologies.
> >
> > I was given a task a couple of months ago.  After
> > a long serious thinking, I came up with an idea
> > which made use of a lot of stack and list 
> > operations (which scheme is good at) and wanted to
> > verify my idea as quickly as possible. Fortunately
> > (or unfortunately, I can't say for sure yet),
> > I know just enough scheme to write moderate size
> > programs. So, I started coding in scheme.
> >
> > My intension was to implement the idea in guile
> > scheme and the GUI in c with X or gtk providing
> > one simple line drawing function for guile to call
> > so that I can draw lines as they are computed from
> > scheme code (similar to tortoise example). And it
> > worked great.
> >
> > Then, I wanted to add event processing to the GUI
> > and this is where I got stuck---it also required
> > its own event loop in addition to gh_repl. At
first,
> > I naively thought I could resolve the problem
> > using pthread, which didn't work.  With pitiful
> > and (of course) unsuccessful debugging of many
> > days, I looked up the list's archive and found out
> > that the question has been discussed previously
> > and someone successfully  solved the problem using
> > event-repl stuff coming with guile-gtk.
> > Nevertheless, with my short knowledge of guile,
> > the discussions were hard to follow and I ended
> > up with a conclusion of rewriting the whole thing
> > in c.
> >
> > However, I still desperately want to stay with
>
> > scheme since it will make further improvement of
> > my idea extremely easier.  So, before I begin to
> > rewriting, I thought I might ask you, the guile
> > experts, for help as a last resort.  Would anyone
> > out there generously provide me some pointers or
> > simple example codes that work just like tortoise
> > example, but with added event handling ability 
> > (either X or gtk)?  I would be very grateful to
> >  you.
> >
> > Please accept my sincere apology if you got upset
> > by my posting of what has been discussed before.
> > Thank you very much.
> >
> > Sincerely,


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com



reply via email to

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