* Problem Implementing EP
@ 2005-02-26 4:44 Zeeshan Ali
2005-02-27 19:40 ` Zeeshan Ali
0 siblings, 1 reply; 2+ messages in thread
From: Zeeshan Ali @ 2005-02-26 4:44 UTC (permalink / raw)
Hello,
I am trying to write an XChat guile plugin these days and in it i
need to have the EP part of REPL and here is how i do it:
/* Code begins here */
value = scm_c_eval_string (str);
if (value != SCM_UNDEFINED && value != SCM_UNSPECIFIED)
scm_write (value, port);
/* Code ends here */
The problem is that i get newlines after each char if the string
evaluates to a list or string. E.g if the string i evaluate is
"hello", i get this printed on my port:
"
h
e
l
l
o
"
And on evaluating '(1 2 3), i get this:
(
1
2
3
)
I just tried replacing the scm_write by scm_display and it fixed
the problem, but for strings only. i-e on "hello" i get hello printed,
but the result remains the same for lists. Any clue?
One more problem is that i can't seem to find an scm_* equivalent
of gh_eval_str_with_catch. If i am correct to assume that there is
none, perhaps i'll go for what dsmith proposed: get the code of
gh_eval_str_with_catch and write one myself and submit it for
inclusion into the next release?
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Problem Implementing EP
2005-02-26 4:44 Problem Implementing EP Zeeshan Ali
@ 2005-02-27 19:40 ` Zeeshan Ali
0 siblings, 0 replies; 2+ messages in thread
From: Zeeshan Ali @ 2005-02-27 19:40 UTC (permalink / raw)
Hello,
Guys i got the answer to both my questions and here it goes:
> The problem is that i get newlines after each char if the string
> evaluates to a list or string. E.g if the string i evaluate is
> "hello", i get this printed on my port:
>
> "
> h
> e
> l
> l
> o
> "
> And on evaluating '(1 2 3), i get this:
>
> (
> 1
>
> 2
>
> 3
> )
>
> I just tried replacing the scm_write by scm_display and it fixed
> the problem, but for strings only. i-e on "hello" i get hello printed,
> but the result remains the same for lists. Any clue?
>
Well, this turned out to be the problem of xchat print
function(s): they put a newline after each print and when it comes to
a list, you know what happens then :)
> One more problem is that i can't seem to find an scm_* equivalent
> of gh_eval_str_with_catch. If i am correct to assume that there is
> none, perhaps i'll go for what dsmith proposed: get the code of
> gh_eval_str_with_catch and write one myself and submit it for
> inclusion into the next release?
>
Well i simply used scm_internal_catch and it works.
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-02-27 19:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-26 4:44 Problem Implementing EP Zeeshan Ali
2005-02-27 19:40 ` Zeeshan Ali
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).