all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: C-code : printing into a buffer
@ 2009-05-29  7:49 A. Soare
  0 siblings, 0 replies; 6+ messages in thread
From: A. Soare @ 2009-05-29  7:49 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Emacs   Dev  [emacs-devel]


> 
> "A. Soare" <alinsoar@voila.fr> writes:
> 
> > My problem is to define a buffer in emacs such that in the moment when I call this function via a pointer, all its output to be discarged in that buffer, not in the terminal of emacs.
> >
> > Is that possible? Any ideas of how to solve it?
> 
> Use sprintf instead.
> 


No, printf is just an example. I want to do something such that the output from _all_ the functions of libc be redirected to a buffer of emacs, not just printf. Saying, temporary to define the terminal of emacs as a buffer of emacs.



Al.in


____________________________________________________

Découvrez le nouveau Voila.fr et apprenez à maîtriser le web 2.0 sur http://voila.fr






^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: C-code : printing into a buffer
@ 2009-05-29  9:13 A. Soare
  2009-06-01  1:57 ` Stephen J. Turnbull
  2009-06-01 14:31 ` Stefan Monnier
  0 siblings, 2 replies; 6+ messages in thread
From: A. Soare @ 2009-05-29  9:13 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: Emacs   Dev  [emacs-devel]


IStreams, as far as I see, create a pipe, such that the lisp functions inside are redirected to a new-created stream. But the lisp functions print messages via a lisp function like (message), and this function know the pipe where to print.

If you call printf from the C-level of the emacs-lisp evaluator, printf does not know nothing about lisp level. So the problem would be beyond the lisp evaluator. The problem is about the linux system... and from the lisp code to redirect the printf output temporary to an emacs buf.

The Istreams concept is also explained in SICP. Nothing unusual.

Alin.








> 
> A. Soare writes:
> 
>  > > > My problem is to define a buffer in emacs such that in the
>  > > > moment when I call this function via a pointer, all its output
>  > > > to be discarged in that buffer, not in the terminal of emacs.
> 
> In XEmacs you could do this fairly straightforwardly with an lstream,
> I think (an lstream is the internal XEmacs primitive used to deal with
> anything that can be thought of as a sequence of bytes or characters).
> 
> I don't think Emacs has a corresponding facility.  If not, and you
> really need this badly, feel free to ask at xemacs-beta@xemacs.org.
> 
> 
> 

____________________________________________________

Découvrez le nouveau Voila.fr et apprenez à maîtriser le web 2.0 sur http://voila.fr






^ permalink raw reply	[flat|nested] 6+ messages in thread
* C-code : printing into a buffer
@ 2009-05-29  6:43 A. Soare
  2009-05-29  7:16 ` Andreas Schwab
  0 siblings, 1 reply; 6+ messages in thread
From: A. Soare @ 2009-05-29  6:43 UTC (permalink / raw)
  To: Emacs   Dev  [emacs-devel]

Hi,

I have the following problem:

Supposing that

1. I call dlsym for the funtion X="printf" from emacs. No need for dlopen, because I suppose that X always belongs to libc.
2. I get the ADDRESS of X ( for ex. printf ).
3. I call printf from that address using a pointer of the form
   (* (some_cast to a pointer to that function) (ADDRESS)) (str, ...);


My problem is to define a buffer in emacs such that in the moment when I call this function via a pointer, all its output to be discarged in that buffer, not in the terminal of emacs.

Is that possible? Any ideas of how to solve it?


Thanks in advance.

Alin.





____________________________________________________

Découvrez le nouveau Voila.fr et apprenez à maîtriser le web 2.0 sur http://voila.fr






^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-06-01 14:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-29  7:49 C-code : printing into a buffer A. Soare
  -- strict thread matches above, loose matches on Subject: below --
2009-05-29  9:13 A. Soare
2009-06-01  1:57 ` Stephen J. Turnbull
2009-06-01 14:31 ` Stefan Monnier
2009-05-29  6:43 A. Soare
2009-05-29  7:16 ` Andreas Schwab

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.