Documentation fixes.
[platform/upstream/glib.git] / docs / reference / glib / tmpl / type_conversion.sgml
index e2fc8b7..41527e5 100644 (file)
@@ -3,7 +3,7 @@ Type Conversion Macros
 
 <!-- ##### SECTION Short_Description ##### -->
 
-Portably storing integers in pointer variables.
+portably storing integers in pointer variables.
 
 <!-- ##### SECTION Long_Description ##### -->
 <para>
@@ -11,10 +11,10 @@ Many times GLib, GTK+, and other libraries allow you to pass "user
 data" to a callback, in the form of a void pointer. From time to time
 you want to pass an integer instead of a pointer. You could allocate
 an integer, with something like:
-<programlisting>
+<informalexample><programlisting>
  int *ip = g_new (int, 1);
  *ip = 42;
-</programlisting>
+</programlisting></informalexample>
 But this is inconvenient, and it's annoying to have to free the 
 memory at some later time.
 </para>
@@ -22,20 +22,20 @@ memory at some later time.
 Pointers are always at least 32 bits in size (on all platforms GLib
 intends to support). Thus you can store at least 32-bit integer values
 in a pointer value. Naively, you might try this, but it's incorrect:
-<programlisting>
+<informalexample><programlisting>
  gpointer p;
  int i;
  p = (void*) 42;
  i = (int) p;
-</programlisting>
-Again, that example was NOT correct, don't copy it. The problem is
-that on some systems you need to do this:
-<programlisting>
+</programlisting></informalexample>
+Again, that example was <emphasis>not</emphasis> correct, don't copy it. 
+The problem is that on some systems you need to do this:
+<informalexample><programlisting>
  gpointer p;
  int i;
  p = (void*) (long) 42;
  i = (int) (long) p;
-</programlisting>
+</programlisting></informalexample>
 So GPOINTER_TO_INT(), GINT_TO_POINTER(), etc. do the right thing
 on the current platform.
 </para>
@@ -66,7 +66,7 @@ storing integers in pointers, and only preserve 32 bits of the
 integer; values outside the range of a 32-bit integer will be mangled.
 </para>
 
-@i: integer to stuff into a pointer
+@i: integer to stuff into a pointer.
 
 
 <!-- ##### MACRO GPOINTER_TO_INT ##### -->
@@ -86,33 +86,35 @@ integer; values outside the range of a 32-bit integer will be mangled.
 
 <!-- ##### MACRO GUINT_TO_POINTER ##### -->
 <para>
-Same as GINT_TO_POINTER(), but for unsigned integers.
+Stuffs an unsigned integer into a pointer type.
 </para>
 
-@u: integer to stuff into the pointer
+@u: unsigned integer to stuff into the pointer.
 
 
 <!-- ##### MACRO GPOINTER_TO_UINT ##### -->
 <para>
-Same as GPOINTER_TO_INT(), but for unsigned integers.
+Extracts an unsigned integer from a pointer. The integer must have
+been stored in the pointer with GUINT_TO_POINTER().
 </para>
 
-@p: pointer to extract an integer from
+@p: pointer to extract an unsigned integer from.
 
 
 <!-- ##### MACRO GSIZE_TO_POINTER ##### -->
 <para>
-
+Stuffs a #gsize into a pointer type.
 </para>
 
-@s: 
+@s: #gsize to stuff into the pointer.
 
 
 <!-- ##### MACRO GPOINTER_TO_SIZE ##### -->
 <para>
-
+Extracts a #gsize from a pointer. The #gsize must have
+been stored in the pointer with GSIZE_TO_POINTER().
 </para>
 
-@p: 
+@p: pointer to extract a #gsize from.