Re: Preliminary tidy-sharp bindings

Cory Nelson <[email protected]>
Newsgroups gmane.comp.web.html-tidy.devel
Message-ID <[email protected]>
On Thu, 16 Dec 2004 10:45:32 -0500, Charles Reitzel <[email protected]> wrote:
> Hi Corey,
> 
> Happening.  Looks like you got farther than I did.  However, there are
> still a couple macros you might be able to use left over from my
> attempt.  More below.
> 
> take it easy,
> Charlie
> 
> At 02:13 AM 12/16/2004 -0800, Cory Nelson wrote:
> >Okay, I've got some mostly working cross-platform .NET bindings.  They
> >are by no means finished but I'm not sure if I'll get time in the next
> >month or so to work on it.
> >
> >Current limitations:
> >
> >Loading from a TextReader is buggy as there is no way to unget a byte.
> >  Not sure how to cleanly handle this without possible corruption of
> >the TextReader.
> 
> My first thought is that the bindings/wrapper shouldn't need to
> unget.  TidyLib does that.  What am I missing?
> 

The TextReader/TextWriter loaders take advantage of Tidy's stream
reading.  It makes you give byte-level callbacks for getbyte,
ungetbyte, eof.  If Tidy peeked instead of ungetting it wouldn't be a
problem.

> >Using the TextReader/TextWriter methods will be pretty slow as it
> >needs to marshal on every byte read.  No way to get past this.
> 
> Hmm.  How does your wrapper work?

See above.

> >On Windows, tidylib.dll must be compiled using __stdcall (the ones on
> >my binaries page are using __cdecl right now).  Might be able to fix
> >this in the DllImportAttribute constructors but I've heard that breaks
> >Mono on *nix.
> 
> You should be able to specify the call declaration in the Makefile by
> defining either TIDY_EXPORT or TIDY_STRUCT as you see fit.  I added
> TIDY_STRUCT these macros in early attempts to add CLI attributes for .NET
> builds.  TIDY_EXPORT, likewise, can be used to set the calling convention.

The problem is, I'm hesitant to break binary compatibility with past
DLLs.  I know a lot of people switch them right out.  Changing calling
convention can't be put before the function, it needs something like
__declspec(dllexport) void __stdcall do_something(void);  Or simply
changing a compiler switch to default to __stdcall.  In any case I
need to test on Mono because I really don't want to break *nix
compatibility.

> >The file is here: http://dev.int64.org/tidy-sharp.zip
> >I'll make a project page if I ever get it finished.
> >
> >PS: put out new binaries this morning
> >
> >--
> >Cory Nelson
> >http://www.int64.org
> >
> >
> >-------------------------------------------------------
> >SF email is sponsored by - The IT Product Guide
> >Read honest & candid reviews on hundreds of IT Products from real users.
> >Discover which products truly live up to the hype. Start reading now.
> >http://productguide.itmanagersjournal.com/
> >_______________________________________________
> >Tidy-develop mailing list
> >[email protected]
> >https://lists.sourceforge.net/lists/listinfo/tidy-develop
> 
> 


-- 
Cory Nelson
http://www.int64.org


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.