rsalmaso / tinypy

Automatically exported from code.google.com/p/tinypy
Other
0 stars 0 forks source link

Patches for stdout/stderr/stdin callbacks #49

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

there has always been a need (at least for me) to redirect the output of
print() to somewhere else than stdout, especially lately, as I was
programming PSP-related things with TinyPy.

Here, I submit 3 patches and 1 new file for this - they are based off the
latest SVN revision (R148).
I did not know how the functions and types should be named, and therefore
may be currently named rather confusingly - feel free to change this if you
do decide to put this into trunk.

The patches were tested on Windows with the default TinyPy runner (just to
verify that it still works as usual) and with with PSP (on which I did use
callbacks).

At the moment, the compiler complains about tp_stderr and tp_stdin being
defined and not used - I've just added them for future use, feel free to
comment them out.

Original issue reported on code.google.com by darkuran...@gmail.com on 8 May 2010 at 11:28

GoogleCodeExporter commented 8 years ago
By the way, this should be put under the "enhancement" type.

Original comment by darkuran...@gmail.com on 8 May 2010 at 11:29

GoogleCodeExporter commented 8 years ago
Hmm, I have just realized a possible improvement - this could (and should) be 
done on
a per-vm basis - but before I start with that (as it would require changes in 
the
structure of tp_vm), I would like to know what do you think so far?

Original comment by darkuran...@gmail.com on 8 May 2010 at 11:44

GoogleCodeExporter commented 8 years ago
Also, the typedefs might actually not be required...

Original comment by darkuran...@gmail.com on 8 May 2010 at 11:46

GoogleCodeExporter commented 8 years ago
Deleted above patches, as I added a new set of them... This time, the callbacks 
are
set on a per-VM basis, with (in my opinion) much more clear syntax/types.

Original comment by darkuran...@gmail.com on 8 May 2010 at 1:31

GoogleCodeExporter commented 8 years ago
Same set of patches, in ed script form, accepted by the patch tool (I noticed 
that I
forgot the -e argument to diff earlier...)

Original comment by darkuran...@gmail.com on 8 May 2010 at 1:41

GoogleCodeExporter commented 8 years ago
I've deleted the patches since I've noticed that simply modifying the builtin 
print() function works.
However, if anyone is interested, I've included some new patches, with new 
(cleaner) code and no new file.

Original comment by darkuran...@gmail.com on 29 Jun 2010 at 2:59

Attachments: