Offer to help with WinHugs
Neil Mitchell
ndmitchell at gmail.com
Fri May 20 15:43:31 EDT 2005
Hi,
> > The changes to Char.h and WinText.h fix up the output. Since WinHugs
> > last worked the program has moved to using unicode output functions,
> > which were not trapped. This traps them and redirects them towards the
> > WinHugs GUI.
>
> Is that the right place to intercept it, i.e. couldn't we just intercept
> fputc and fgetc? And (how) does the console work with non Latin-1
> encodings?
>
I debated over this with a friend, and we couldn't find a cleaner
place to put the console intercepts. Before unicode happened
intercepting fgetc worked. Now, with unicode defined, fgetc_mb is used
- which is a defined function, not a library call. Since Wintext.h is
imported *before* char.h, its then impossible to redefine fgetc_mb as
something else (because the prototype and the declaration both use
fgetc_mb, so would be redefined anyway, and defeat the purpose).
Because of this the redefine's must occur after char.h is imported -
and the cleanest place to ensure this is at the bottom of char.h.
I personally think this is the wrong solution entirely - WinHugs
should spawn a windows version of the console hugs, and just do stderr
and stdout trapping in a separate process. This way winhugs would be
entirely different from the hugs runtime, and no redefines (or any
interaction between them) would be required. If this happened WinHugs
would not have *any* impact on hugs at all, not even any #ifdef's.
This isn't the way it was done in the past though, so its probably
best to stick with the current mechanism until I have cleaned up
WinHugs significantly, then I would like to give increased separation a try.
As to how the WinHugs console emulator works with unicode, I have no
idea. I wouldn't even like to take a guess. My first task is going to
be to simplify, reduce and refactor the WinHugs code. After that, I'll
take a look at the console and see if a replacement using Windows Rich
Text control would work (which gives Unicode and lots of other nice
features for free), or if the console can be extended to unicode
(should be relatively easy).
Thanks
Neil
More information about the Cvs-hugs
mailing list