mail-archives/mono-osx/2011-February/003940.html

125 строки
4.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-osx] [Mono-Mac] ImageKit bindings and sample
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20%5BMono-Mac%5D%20ImageKit%20bindings%20and%20sample&In-Reply-To=AANLkTimP1rjLgcqzFwsWGaRz8OYKqR%2BmUsA9TY7BDd%2BP%40mail.gmail.com">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="003939.html">
<LINK REL="Next" HREF="003943.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-osx] [Mono-Mac] ImageKit bindings and sample</H1>
<B>Miguel de Icaza</B>
<A HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20%5BMono-Mac%5D%20ImageKit%20bindings%20and%20sample&In-Reply-To=AANLkTimP1rjLgcqzFwsWGaRz8OYKqR%2BmUsA9TY7BDd%2BP%40mail.gmail.com"
TITLE="[Mono-osx] [Mono-Mac] ImageKit bindings and sample">miguel at novell.com
</A><BR>
<I>Wed Feb 2 11:00:08 EST 2011</I>
<P><UL>
<LI>Previous message: <A HREF="003939.html">[Mono-osx] [Mono-Mac] ImageKit bindings and sample
</A></li>
<LI>Next message: <A HREF="003943.html">[Mono-osx] How can a custom library be included in a package.
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#3940">[ date ]</a>
<a href="thread.html#3940">[ thread ]</a>
<a href="subject.html#3940">[ subject ]</a>
<a href="author.html#3940">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Hello,
&gt;<i> I noticed that all the uints in PdfKit were changed to ints, so I did the
</I>&gt;<i> same here.
</I>
The use of ints instead of uints is needed to support languages that
do not expose unsigned data types.
When it is clear that the full range of a uint will be needed, we keep
the signature, but when we the likelihood of the use of the full range
is in doubt, we can move that to an int. For example, GoToPage in a
PDF file for a PDF that has more than 2^31 pages is very unlikely, so
we turn the uint into an int.
&gt;<i> But I am confused. What happens if a client passes a negative int to a objC
</I>&gt;<i> method that is expecting a uint,
</I>
They would get a very large uint value.
The only case where it would be required is if you actually need a
value beyond 2^31, so you would use:
(int) some_uint value
That would give you the full range you need.
&gt;<i> It seems using uint would allow the compiler to help keep the code sane.
</I>&gt;<i> &#160;What am I missing?
</I>
That every API that is exposed as uints is not CLS-compliant and
prevents some programming languages from accessing the API.
&gt;<i> I made some changes to AppKit for the sample: &#160;I added two dragging
</I>&gt;<i> protocols. &#160;I only needed NSDraggingDestination, but you get the
</I>&gt;<i> NSDraggingSource for free.
</I>&gt;<i> Not sure if they are generally useful, but here they are. &#160;I noticed a
</I>&gt;<i> binding for a type called
</I>&gt;<i> NSDragDestination&#160;which is not a Apple type, and the methods are same as
</I>&gt;<i> NSDraggingInfo &#160;It seems like it should be removed, but I don't know its
</I>&gt;<i> history.
</I>
You are right, I am not sure what that thing was for.
In general, we do have a problem here with the bindings. The
NSDraggingDestination and NSDraggingSource are protocols that are
implemented by certain objects (not sure which). Ideally we would
declare these as interfaces and expose this contract explicitly,
instead of replicating it when we find that they implement the
protocol.
But looking at the source code does not make it obvious which methods
explicitly implement this support.
&gt;<i> It's been fun, and I've learned a ton, but I have to give up this hobby for
</I>&gt;<i> a month or so to complete other obligations. &#160;Hopefully there will be more
</I>&gt;<i> to do when I return.
</I>
Glad to hear that! Thank you for your contributions, you helped us
improve MonoMac with your carefully crafted code!
Miguel
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="003939.html">[Mono-osx] [Mono-Mac] ImageKit bindings and sample
</A></li>
<LI>Next message: <A HREF="003943.html">[Mono-osx] How can a custom library be included in a package.
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#3940">[ date ]</a>
<a href="thread.html#3940">[ thread ]</a>
<a href="subject.html#3940">[ subject ]</a>
<a href="author.html#3940">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/mono-osx">More information about the Mono-osx
mailing list</a><br>
</body></html>