This is the mail archive of the guile@sourceware.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: Question about ports


On Thu, 23 Mar 2000, Craig Wright wrote:

> I've just started embedding guile in a MUD that I'm writing.  What
> I really want to do is make the scheme interpreter accesible over the
> network.  After I've gotten a scheme command from a connection and have
> called gh_eval_str(command), I want to be able to package the return value
> into another char* so I can ship it back over the network...

If you (write ...) the return value, you could send the resulting string
back to be evaluated.  (write will, in contrast to display, produce a
result that should re-evaluate into the structure that was written.)

> In addition I'd like to be able to make it so all calls to display and it's 
> like are echoed back to the correct network connection.  I want a single
> global scheme interpreter for all users.  Actually only users of the
> correct acces get this, but that's really an unecessary detail.

(let* ((old-display display))
  (set! display
        (lambda ...     put your replacement function for display here
                        and, in its implementation, use old-display
                        whenever you want to call the original function.

> Also, since this may be a problem: I'm using socket++, so I have no direct
> access to the file descriptors.  I would prefer that all output from the
> scheme interpreter is put in a char* so that I can send it out myself.
> This includes calls to display and displaying return values of function calls.

Maybe 'with-output-to-string' is what you are looking for?

Best regards
Dirk Herrmann


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