Re: [PD] get console messages within patch

2011-11-20 Thread Mathieu Bouchard

Le 2011-11-16 à 18:06:00, Jonathan Wilkes a écrit :

From: Mathieu Bouchard ma...@artengine.ca
  http://artengine.ca/desiredata/gallery/unpost.gif
But this external would require a modification to pd that has been circulating 
on the net since 2003 and rejected by Miller in 2004.

What's the modification?  Is it on the tracker?


Actually, I don't find it in the bug tracker nor the patch tracker.

Don't worry, it's somewhere in SourceForget.

...

Actually, you can find it in the devel_0_37 branch. This is what I used to 
implement the original Pd console. Then I submitted it to Miller (through 
pd-list). Then Miller ignored my code and rewrote it without using 
printhook and left out one or two features as well. I'm pretty sure he 
claimed that t_printhook was a bad or ugly design. That was in jan 2004 or 
so, but I only got to know about Miller's console in august when he 
unveiled pd 38.


 __
| Mathieu BOUCHARD - téléphone : +1.514.383.3801 - Montréal, QC___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] get console messages within patch

2011-11-20 Thread Jonathan Wilkes




- Original Message -
 From: Mathieu Bouchard ma...@artengine.ca
 To: Jonathan Wilkes jancs...@yahoo.com
 Cc: Vincent Kaschner kostrowit...@gmx.de; pd-list@iem.at 
 pd-list@iem.at; IOhannes m zmoelnig zmoel...@iem.at
 Sent: Sunday, November 20, 2011 11:59 PM
 Subject: Re: [PD] get console messages within patch
 
 Le 2011-11-16 à 18:06:00, Jonathan Wilkes a écrit :
  From: Mathieu Bouchard ma...@artengine.ca
    http://artengine.ca/desiredata/gallery/unpost.gif
  But this external would require a modification to pd that has been 
 circulating on the net since 2003 and rejected by Miller in 2004.
  What's the modification?  Is it on the tracker?
 
 Actually, I don't find it in the bug tracker nor the patch tracker.
 
 Don't worry, it's somewhere in SourceForget.
 
 ...
 
 Actually, you can find it in the devel_0_37 branch. This is what I used to 
 implement the original Pd console. Then I submitted it to Miller (through 
 pd-list). Then Miller ignored my code and rewrote it without using printhook

What's printhook?

 and 
 left out one or two features as well. I'm pretty sure he claimed that 
 t_printhook was a bad or ugly design. That was in jan 2004 or so, but I only 
 got 
 to know about Miller's console in august when he unveiled pd 38.
 
 __
 | Mathieu BOUCHARD - téléphone : +1.514.383.3801 - Montréal, QC
 

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] get console messages within patch

2011-11-20 Thread Mathieu Bouchard

Le 2011-11-20 à 22:23:00, Jonathan Wilkes a écrit :

- Original Message -

From: Mathieu Bouchard ma...@artengine.ca
Le 2011-11-16 à 18:06:00, Jonathan Wilkes a écrit :

 From: Mathieu Bouchard ma...@artengine.ca
   http://artengine.ca/desiredata/gallery/unpost.gif
 But this external would require a modification to pd that has been 

circulating on the net since 2003 and rejected by Miller in 2004.

 What's the modification?  Is it on the tracker?

Actually, I don't find it in the bug tracker nor the patch tracker.
Don't worry, it's somewhere in SourceForget.

What's printhook?


It's the feature that redirects the formatted output of [print] and post() 
and error() to a single destination.


[unpost] changes this at runtime while keeping a backup, sends a message, 
and when the call returns, it restores the backup. That's all.


Here's the source code of [unpost] :

-8découpez-ici8-

static t_class *unpost_class;
struct t_unpost : t_object {
t_outlet *o0,*o1;
};
struct t_unpost_frame {
t_unpost *self;
std::ostringstream buf;
};
static t_unpost_frame *current_unpost;

void *unpost_new (t_symbol *s) {
t_unpost *x = (t_unpost *)pd_new(unpost_class);
x-o0 = outlet_new(x,s_symbol);
x-o1 = outlet_new(x,s_symbol);
return x;
}
extern t_printhook sys_printhook;
void unpost_printhook (const char *s) {
std::ostringstream b = current_unpost-buf;
b  s;
const char *p;
const char *d=b.str().data(),*dd=d;
for (;;) {
p = strchr(d,'\n');
if (!p) break;
current_unpost-self-o1-send(gensym2(d,p-d));
d=p+1;
}
if (d!=dd) {
char *q = strdup(d); /* well i could use memmove, but i'm not supposed 
to use strcpy because of overlap */
current_unpost-buf.clear();
current_unpost-buf  q;
free(q);
}
}
void unpost_anything (t_unpost *x, t_symbol *s, int argc, t_atom *argv) {
t_printhook backup1 = sys_printhook;
t_unpost_frame *backup2 = current_unpost;
sys_printhook = unpost_printhook;
current_unpost = new t_unpost_frame;
current_unpost-self = x;
x-o0-send(s,argc,argv);
sys_printhook = backup1;
current_unpost = backup2;
}

 __
| Mathieu BOUCHARD - téléphone : +1.514.383.3801 - Montréal, QC___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] get console messages within patch

2011-11-17 Thread IOhannes m zmoelnig
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 2011-11-17 02:25, Vincent Kaschner wrote:
 As a beginner in Pd, I'm also wondering what that means...
 
 
 
 Hey IOhannes,

 thank you, but could you please explain it a bit more in detail? I am not
 a complete newbie, but not so much into the pd-list speak. I searched in
 the list for the question, but there was no comprehensible solution shown...
 It's on pd extended 0.42.5 on Win XP.

sorry for talking gibberish.

i don't know much about Pd-extended and little about w32.
i'll give it a try though:

$ pd -stderr 21 | pdsend  localhost udp

this basically means:
- - take the output of Pd, and send it (using pdsend) to port  of the
local machine.

the 2nd part of the line (pdsend  localhost udp) should be fairly
obvious: it calls the pdsend program (on w32 it is called pdsend.exe and
you might have to find out where it is - somewhere in the Pd\bin\ folder
is a good guess), with some parameters, that specify the target port
(), the target host (localhost, the machine the program is executed
on) and the protocol (udp).

the 1st part is a bit more complicated, i'll come to it later. it
basically grabs all messages printed by Pd.

the fun part is in the middle, | (aka 'pipe') takes the output of
one program (in this case Pd) and uses it as input to another program
(here: pdsend)


the slightly unorthodox part is the 1st one:
we have to make Pd produce it's output in a form that is usable as input
for pdsend. this basically means that instead of sending the printout to
the pd-console, we have to redirect it to a special output, that is
called stdout (pdsend will read from stdin, and the pipe (|) will
magically transform the stdout of the 1st program to the stdin of the
2nd; see [1] for more information)
Pd usually send s it output to the Pd-console.
however, you can start it with a special cmdline flag, that will all
messages to a special output, the stderr (see [1] again).
if you start Pd from the console (the cmdline; on w32 this would be e.g.
the cmd program), all messages sent to the stderr will show up on the
console (note, that on w32 you will have to start pd.com rather than
pd.exe, because else windows will prevent the stderr to be printed to
the console).
this is almost what we want (we are sending Pd's printout to some
standard stream!), but we are not there yet (Pd sends to stderr,
whereas we want it to send to stdout)

luckily enough, many cmdline interpreters have a special syntax for
redirecting stdstreams. on bash (a common cmdline interpreter on un*x)
and afaik on w32, you can do redirect the stderr of a program to the
stdout using 21 (stderr has a numeric file descriptor 2; stdout has
a numeric file descriptor 1; so this redirection means: take
filedescriptor 2 (stderr) and send it to filedescriptor 1 (stdout))

so the line i gave means:
pd - start Pd,
-stderr- but send all printout to stderr rather than the pdconsole
21   - then redirect the stderr to stdout,
|  - pipe the stdout to the stdin
pdsend ... - of pdsend, which will send the data (back to Pd)


hope that helps.

fgamrt
IOhannes




[1] http://en.wikipedia.org/wiki/Standard_streams


 best
 mirro

 Hi list,

 I wonder if there is a possibility to receive console messages within a
 patch. Could be helpful, for instance, when there is a certain error that
 should immediately trigger a reaction. 
 Thanks for advice.

 i guess there are some answers for that in the archives.

 the simplest is probably still
 $ pd -stderr 21 | pdsend  localhost udp

 and then have
 [netreceive  1]
 listen for your output.

 fgmasdr
 IOhannes
 -- 
 
 
 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7ExbcACgkQkX2Xpv6ydvQVrgCgqNEW7N3V8vWSk8M01MLpDr22
jVcAoIFKLeGVp/g3+gV6K1wm4KuYH+Ri
=0WOh
-END PGP SIGNATURE-



smime.p7s
Description: S/MIME Cryptographic Signature
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] get console messages within patch

2011-11-17 Thread tim vets
2011/11/17 IOhannes m zmoelnig zmoel...@iem.at

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On 2011-11-17 02:25, Vincent Kaschner wrote:
  As a beginner in Pd, I'm also wondering what that means...
 
 
 
  Hey IOhannes,
 
  thank you, but could you please explain it a bit more in detail? I am
 not
  a complete newbie, but not so much into the pd-list speak. I searched in
  the list for the question, but there was no comprehensible solution
 shown...
  It's on pd extended 0.42.5 on Win XP.

 sorry for talking gibberish.

 i don't know much about Pd-extended and little about w32.
 i'll give it a try though:

 $ pd -stderr 21 | pdsend  localhost udp

 this basically means:
 - - take the output of Pd, and send it (using pdsend) to port  of the
 local machine.

 the 2nd part of the line (pdsend  localhost udp) should be fairly
 obvious: it calls the pdsend program (on w32 it is called pdsend.exe and
 you might have to find out where it is - somewhere in the Pd\bin\ folder
 is a good guess), with some parameters, that specify the target port
 (), the target host (localhost, the machine the program is executed
 on) and the protocol (udp).

 the 1st part is a bit more complicated, i'll come to it later. it
 basically grabs all messages printed by Pd.

 the fun part is in the middle, | (aka 'pipe') takes the output of
 one program (in this case Pd) and uses it as input to another program
 (here: pdsend)


 the slightly unorthodox part is the 1st one:
 we have to make Pd produce it's output in a form that is usable as input
 for pdsend. this basically means that instead of sending the printout to
 the pd-console, we have to redirect it to a special output, that is
 called stdout (pdsend will read from stdin, and the pipe (|) will
 magically transform the stdout of the 1st program to the stdin of the
 2nd; see [1] for more information)
 Pd usually send s it output to the Pd-console.
 however, you can start it with a special cmdline flag, that will all
 messages to a special output, the stderr (see [1] again).
 if you start Pd from the console (the cmdline; on w32 this would be e.g.
 the cmd program), all messages sent to the stderr will show up on the
 console (note, that on w32 you will have to start pd.com rather than
 pd.exe, because else windows will prevent the stderr to be printed to
 the console).
 this is almost what we want (we are sending Pd's printout to some
 standard stream!), but we are not there yet (Pd sends to stderr,
 whereas we want it to send to stdout)

 luckily enough, many cmdline interpreters have a special syntax for
 redirecting stdstreams. on bash (a common cmdline interpreter on un*x)
 and afaik on w32, you can do redirect the stderr of a program to the
 stdout using 21 (stderr has a numeric file descriptor 2; stdout has
 a numeric file descriptor 1; so this redirection means: take
 filedescriptor 2 (stderr) and send it to filedescriptor 1 (stdout))

 so the line i gave means:
 pd - start Pd,
 -stderr- but send all printout to stderr rather than the pdconsole
 21   - then redirect the stderr to stdout,
 |  - pipe the stdout to the stdin
 pdsend ... - of pdsend, which will send the data (back to Pd)


 hope that helps.

 fgamrt
 IOhannes


 How do I get past send: Connection refused (111)?

gr,
Tim



 [1] http://en.wikipedia.org/wiki/Standard_streams

 
  best
  mirro
 
  Hi list,
 
  I wonder if there is a possibility to receive console messages within a
  patch. Could be helpful, for instance, when there is a certain error
 that
  should immediately trigger a reaction.
  Thanks for advice.
 
  i guess there are some answers for that in the archives.
 
  the simplest is probably still
  $ pd -stderr 21 | pdsend  localhost udp
 
  and then have
  [netreceive  1]
  listen for your output.
 
  fgmasdr
  IOhannes
  --
 
 
 

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.11 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

 iEYEARECAAYFAk7ExbcACgkQkX2Xpv6ydvQVrgCgqNEW7N3V8vWSk8M01MLpDr22
 jVcAoIFKLeGVp/g3+gV6K1wm4KuYH+Ri
 =0WOh
 -END PGP SIGNATURE-


 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management -
 http://lists.puredata.info/listinfo/pd-list


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] get console messages within patch

2011-11-17 Thread IOhannes m zmoelnig
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 2011-11-17 09:53, tim vets wrote:

 
 How do I get past send: Connection refused (111)?
 

by re-reading my original email and adding a receiver ([netreceive])
within Pd, that listens on the port (and protocol) you specified with
pdsend.


fgmasdr
IOhannes
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7E0TIACgkQkX2Xpv6ydvSJ1wCgqSmpUnOq3V4jR0gy5fCqqQu2
lqkAoKgolgucGcrqx2xkKKtLBwGIL4jR
=IFe5
-END PGP SIGNATURE-



smime.p7s
Description: S/MIME Cryptographic Signature
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] get console messages within patch

2011-11-16 Thread Vincent Kaschner
As a beginner in Pd, I'm also wondering what that means...



 Hey IOhannes,
 
 thank you, but could you please explain it a bit more in detail? I am not
 a complete newbie, but not so much into the pd-list speak. I searched in
 the list for the question, but there was no comprehensible solution shown...
 It's on pd extended 0.42.5 on Win XP.
 
 best
 mirro
 
  Hi list,
  
  I wonder if there is a possibility to receive console messages within a
 patch. Could be helpful, for instance, when there is a certain error that
 should immediately trigger a reaction. 
  Thanks for advice.
 
 i guess there are some answers for that in the archives.
 
 the simplest is probably still
 $ pd -stderr 21 | pdsend  localhost udp
 
 and then have
 [netreceive  1]
 listen for your output.
 
 fgmasdr
 IOhannes
 -- 



-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] get console messages within patch

2011-11-16 Thread Mathieu Bouchard
I wonder if there is a possibility to receive console messages within 
a patch. Could be helpful, for instance, when there is a certain error 
that should immediately trigger a reaction. Thanks for advice.


I had made something specifically for that, that redirects the console 
messages in a way similar to how other languages have «try/catch» or 
«begin/rescue» keywords to trap errors.


  http://artengine.ca/desiredata/gallery/unpost.gif

But this external would require a modification to pd that has been 
circulating on the net since 2003 and rejected by Miller in 2004.


Because Miller doesn't want features like that.

 __
| Mathieu BOUCHARD - téléphone : +1.514.383.3801 - Montréal, QC___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] get console messages within patch

2011-11-16 Thread Jonathan Wilkes




- Original Message -
 From: Mathieu Bouchard ma...@artengine.ca
 To: Vincent Kaschner kostrowit...@gmx.de
 Cc: pd-list@iem.at; IOhannes m zmoelnig zmoel...@iem.at
 Sent: Wednesday, November 16, 2011 8:53 PM
 Subject: Re: [PD] get console messages within patch
 
  I wonder if there is a possibility to receive console messages 
 within a patch. Could be helpful, for instance, when there is a certain error 
 that should immediately trigger a reaction. Thanks for advice.
 
 I had made something specifically for that, that redirects the console 
 messages 
 in a way similar to how other languages have «try/catch» or «begin/rescue» 
 keywords to trap errors.
 
   http://artengine.ca/desiredata/gallery/unpost.gif
 
 But this external would require a modification to pd that has been 
 circulating 
 on the net since 2003 and rejected by Miller in 2004.

What's the modification?  Is it on the tracker?

 
 Because Miller doesn't want features like that.
 
 __
 | Mathieu BOUCHARD - téléphone : +1.514.383.3801 - Montréal, QC
 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management - 
 http://lists.puredata.info/listinfo/pd-list


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] get console messages within patch

2011-06-24 Thread IOhannes m zmoelnig
On 2011-06-23 18:39, Mirko Maier wrote:
 Hi list,
 
 I wonder if there is a possibility to receive console messages within a 
 patch. Could be helpful, for instance, when there is a certain error that 
 should immediately trigger a reaction. 
 Thanks for advice.

i guess there are some answers for that in the archives.

the simplest is probably still
$ pd -stderr 21 | pdsend  localhost udp

and then have
[netreceive  1]
listen for your output.

fgmasdr
IOhannes



smime.p7s
Description: S/MIME Cryptographic Signature
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] get console messages within patch

2011-06-24 Thread Mirko Maier
Hey IOhannes,

thank you, but could you please explain it a bit more in detail? I am not a 
complete newbie, but not so much into the pd-list speak. I searched in the list 
for the question, but there was no comprehensible solution shown...
It's on pd extended 0.42.5 on Win XP.

best
mirro

 Hi list,
 
 I wonder if there is a possibility to receive console messages within a 
 patch. Could be helpful, for instance, when there is a certain error that 
 should immediately trigger a reaction. 
 Thanks for advice.

i guess there are some answers for that in the archives.

the simplest is probably still
$ pd -stderr 21 | pdsend  localhost udp

and then have
[netreceive  1]
listen for your output.

fgmasdr
IOhannes
-- 
NEU: FreePhone - kostenlos mobil telefonieren!  
Jetzt informieren: http://www.gmx.net/de/go/freephone

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] get console messages within patch

2011-06-24 Thread Matteo Sisti Sette

On 06/24/2011 10:53 AM, IOhannes m zmoelnig wrote:


the simplest is probably still
$ pd -stderr 21 | pdsend  localhost udp


Great!

But is there another way so that you would be able to catch the console 
messages at the point of the message tree when they are generated?


Otherwise it is pretty difficult to manage them usefully...

Thanks
m.

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] get console messages within patch

2011-06-24 Thread András Murányi
On Fri, Jun 24, 2011 at 13:14, Matteo Sisti Sette 
matteosistise...@gmail.com wrote:

 On 06/24/2011 10:53 AM, IOhannes m zmoelnig wrote:

  the simplest is probably still
 $ pd -stderr 21 | pdsend  localhost udp


 Great!

 But is there another way so that you would be able to catch the console
 messages at the point of the message tree when they are generated?

 Otherwise it is pretty difficult to manage them usefully...


Just a shot in the dark:
you could use an external which enables TCL scripting, then rewrite the
::pdwindow::verbose function, eventually in a search-and replace way so it
has less chances to break wirh Pd changing (see
http://puredata.info/docs/guiplugins Overwriting functions)

Andras
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


[PD] get console messages within patch

2011-06-23 Thread Mirko Maier
Hi list,

I wonder if there is a possibility to receive console messages within a patch. 
Could be helpful, for instance, when there is a certain error that should 
immediately trigger a reaction. 
Thanks for advice.

Best
Mirko
-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list