[svn:parrot] r48430 - trunk/src/pmc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Thu Aug 12 09:56:24 UTC 2010


Author: NotFound
Date: Thu Aug 12 09:56:24 2010
New Revision: 48430
URL: https://trac.parrot.org/parrot/changeset/48430

Log:
some cleaning of FIA: put METHOD after vtable functions and fix and improve doc, no functional changes

Modified:
   trunk/src/pmc/fixedintegerarray.pmc

Modified: trunk/src/pmc/fixedintegerarray.pmc
==============================================================================
--- trunk/src/pmc/fixedintegerarray.pmc	Thu Aug 12 09:40:25 2010	(r48429)
+++ trunk/src/pmc/fixedintegerarray.pmc	Thu Aug 12 09:56:24 2010	(r48430)
@@ -11,10 +11,6 @@
 This class, FixedIntegerArray, implements an array of fixed size which stores
 INTVALs.  It uses Integer PMCs for all of the conversions.
 
-=head2 Functions
-
-=over 4
-
 =cut
 
 */
@@ -34,23 +30,6 @@
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 /* HEADERIZER END: static */
 
-/*
-
-=item C<static int auxcmpfunc(const INTVAL *i, const INTVAL *j)>
-
-
-
-=cut
-
-*/
-
-PARROT_PURE_FUNCTION
-static int
-auxcmpfunc(ARGIN(const INTVAL *i), ARGIN(const INTVAL *j))
-{
-    ASSERT_ARGS(auxcmpfunc)
-    return *i - *j;
-}
 
 pmclass FixedIntegerArray auto_attrs provides array {
     ATTR INTVAL   size;  /* number of INTVALs stored in this array */
@@ -58,9 +37,7 @@
 
 /*
 
-=back
-
-=head2 Methods
+=head2 Vtable functions
 
 =over 4
 
@@ -521,25 +498,6 @@
         SELF.set_pmc_keyed_int(k, value);
     }
 
-    METHOD sort(PMC *cmp_func :optional) {
-        UINTVAL n;
-        INTVAL  size;
-
-        GET_ATTR_size(INTERP, SELF, size);
-        n = (UINTVAL)size;
-
-        if (n > 1) {
-            INTVAL *int_array;
-            GET_ATTR_int_array(INTERP, SELF, int_array);
-            if (PMC_IS_NULL(cmp_func))
-                qsort(int_array, n, sizeof (INTVAL),
-                        (int (*)(const void *, const void*))auxcmpfunc);
-            else
-                Parrot_quicksort(INTERP, (void**)int_array, n, cmp_func);
-        }
-        RETURN(PMC *SELF);
-    }
-
 /*
 
 =item C<INTVAL is_equal(PMC *value)>
@@ -643,6 +601,66 @@
                 int_array[i] = VTABLE_shift_integer(INTERP, info);
         }
     }
+
+/*
+
+=back
+
+=head2 Methods
+
+=over 4
+
+=item C<PMC *sort()>
+
+Sort the array and return self.
+
+=cut
+
+*/
+
+    METHOD sort(PMC *cmp_func :optional) {
+        UINTVAL n;
+        INTVAL  size;
+
+        GET_ATTR_size(INTERP, SELF, size);
+        n = (UINTVAL)size;
+
+        if (n > 1) {
+            INTVAL *int_array;
+            GET_ATTR_int_array(INTERP, SELF, int_array);
+            if (PMC_IS_NULL(cmp_func))
+                qsort(int_array, n, sizeof (INTVAL),
+                        (int (*)(const void *, const void*))auxcmpfunc);
+            else
+                Parrot_quicksort(INTERP, (void**)int_array, n, cmp_func);
+        }
+        RETURN(PMC *SELF);
+    }
+
+}
+
+/*
+
+=back
+
+=head2 Auxiliar functions
+
+=over 4
+
+=item C<static int auxcmpfunc(const INTVAL *i, const INTVAL *j)>
+
+INTVAL compare function for qsort usage.
+
+=cut
+
+*/
+
+PARROT_PURE_FUNCTION
+static int
+auxcmpfunc(ARGIN(const INTVAL *i), ARGIN(const INTVAL *j))
+{
+    ASSERT_ARGS(auxcmpfunc)
+    return *i - *j;
 }
 
 /*


More information about the parrot-commits mailing list