#1021 Tk_InitConsoleChannels needs docs

closed-fixed
8
2007-11-05
2001-06-12
Don Porter
No

The public Tk function, Tk_InitConsoleChannels()
has no documentation.

When the documentation is written, it should make
it clear that Tk_InitConsoleChannels() must be called
early in a program -- before any Tcl_Channel operations
have a chance to take place.

Otherwise, the failure of Tk_InitConsoleChannels()
to Tcl_RegisterChannel() the console channels
-- it can't, it has no interp to work with --
and the lack of auto-registration of the Tcl
standard channels to make up for it -- because the
previous Tcl_Channel operations already initialized
the Tcl standard channels to the system defaults --
will cause nasty errors like

"can not find channel named "stderr""

See attached demo.c for explanation of how to
properly use Tcl_SetStdChannel, and why
Tk_InitConsoleChannels() can't do that, so must
be called early instead.

Discussion

  • Don Porter

    Don Porter - 2001-06-12

    Logged In: YES
    user_id=80530

    Hmmm.... looking again I see that Tk_InitConsoleChannels
    *does* take an interp argument after all, so maybe this
    is just a bug? Why doesn't Tk_InitConsoleChannels call
    Tcl_RegisterChannel on the channels it creates?

     
  • Don Porter

    Don Porter - 2001-08-28

    Logged In: YES
    user_id=80530

    Looks like a side effect of Tcl_RegisterChannel is
    to initialize any uninitialized standard channels
    with their platform default values. That could
    mess up Tk_InitConsoleChannels, so that's probably
    why it isn't called.

     
  • Don Porter

    Don Porter - 2002-03-19

    Logged In: YES
    user_id=80530

    This is driving me crazy again! I can't get
    Tk_InitConsoleChannels() and Tk_CreateConsoleWindow()
    to work correctly on Unix!

    Anyone know what happened to the demo.c file that was
    allegedly attached here?!

     
  • Don Porter

    Don Porter - 2002-03-19

    Logged In: YES
    user_id=80530

    AAaaaarrrrrgggggghhhhh!!!!!!

    A rebuild and things are working again (sort of).

    I hate irreproducible observations...

     
  • Don Porter

    Don Porter - 2002-03-20

    Logged In: YES
    user_id=80530

    OK, tracked it down, and my brain is back to the state
    it was in when it filed this bug report in the first
    place.

    If any Tcl routines dealing with Tcl_Channels get called
    before Tk_InitConsoleChannels, there will be problems
    with writing to stdout and stderr. It's important that if
    you are going to call Tk_InitConsoleChannels, that you do
    so before anything calls Tcl_RegisterChannel.

    ...and no, I never found demo.c.

     
  • Don Porter

    Don Porter - 2003-04-14
    • priority: 5 --> 7
     
  • Don Porter

    Don Porter - 2003-10-03
    • priority: 7 --> 8
     
  • Donal K. Fellows

    • status: open --> open-remind
     
  • Don Porter

    Don Porter - 2007-10-31
    • priority: 8 --> 9
     
  • Andreas Kupries

    Andreas Kupries - 2007-11-05

    Logged In: YES
    user_id=75003
    Originator: NO

    Added a manpage for the function. Very minimal. Needs review.

     
  • Andreas Kupries

    Andreas Kupries - 2007-11-05
    • priority: 9 --> 8
    • status: open-remind --> closed-fixed
     
  • Donal K. Fellows

    Logged In: YES
    user_id=79902
    Originator: NO

    Bugfix:
    change \fb to \fB

    Improvement:
    Add
    console(n)
    to the "SEE ALSO" section.

    (I'd fix myself except for the stupid firewall/proxy I'm behind.)

     
  • Andreas Kupries

    Andreas Kupries - 2007-11-06

    Logged In: YES
    user_id=75003
    Originator: NO

    Will do.

     
  • Andreas Kupries

    Andreas Kupries - 2007-11-06

    Logged In: YES
    user_id=75003
    Originator: NO

    And done.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks