[Python-checkins] r54057 - sandbox/trunk/pep3101/unicodeformat.c

patrick.maupin python-checkins at python.org
Thu Mar 1 09:43:11 CET 2007


Author: patrick.maupin
Date: Thu Mar  1 09:43:11 2007
New Revision: 54057

Modified:
   sandbox/trunk/pep3101/unicodeformat.c
Log:
Reduced size of all lines below 80 characters

Modified: sandbox/trunk/pep3101/unicodeformat.c
==============================================================================
--- sandbox/trunk/pep3101/unicodeformat.c	(original)
+++ sandbox/trunk/pep3101/unicodeformat.c	Thu Mar  1 09:43:11 2007
@@ -7,8 +7,8 @@
 
     This module designed and written by Patrick Maupin and Eric V Smith
 
-    This module is designed to be compiled standalone, or from inside stringformat.c,
-    to support both unicode and traditional strings.
+    This module is designed to be compiled standalone, or from inside
+    stringformat.c, to support both unicode and traditional strings.
 */
 
 /*
@@ -126,27 +126,59 @@
     returns the number of characters written, or -1 if error
 */
 /* XXX obviously wrong, but just a placeholder currently */
-typedef Py_ssize_t (*ConversionFunction)(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
+typedef Py_ssize_t
+(*ConversionFunction)(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
 
 /*
     Forward declarations for our conversion functions
 */
-static Py_ssize_t convert_binary(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
-static Py_ssize_t convert_char(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
-static Py_ssize_t convert_decimal(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
-static Py_ssize_t convert_exponent(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
-static Py_ssize_t convert_exponentUC(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
-static Py_ssize_t convert_fixed(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
-static Py_ssize_t convert_fixedUC(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
-static Py_ssize_t convert_general(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
-static Py_ssize_t convert_generalUC(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
-static Py_ssize_t convert_number(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
-static Py_ssize_t convert_octal(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
-static Py_ssize_t convert_repr(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
-static Py_ssize_t convert_string(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
-static Py_ssize_t convert_hex(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
-static Py_ssize_t convert_hexUC(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
-static Py_ssize_t convert_percentage(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
+static Py_ssize_t
+convert_binary(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
+
+static Py_ssize_t
+convert_char(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
+
+static Py_ssize_t
+convert_decimal(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
+
+static Py_ssize_t
+convert_exponent(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
+
+static Py_ssize_t
+convert_exponentUC(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
+
+static Py_ssize_t
+convert_fixed(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
+
+static Py_ssize_t
+convert_fixedUC(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
+
+static Py_ssize_t
+convert_general(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
+
+static Py_ssize_t
+convert_generalUC(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
+
+static Py_ssize_t
+convert_number(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
+
+static Py_ssize_t
+convert_octal(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
+
+static Py_ssize_t
+convert_repr(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
+
+static Py_ssize_t
+convert_string(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
+
+static Py_ssize_t
+convert_hex(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
+
+static Py_ssize_t
+convert_hexUC(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
+
+static Py_ssize_t
+convert_percentage(PyObject *fieldobj, FmtState *fs, CH_TYPE *sign);
 
 
 /* Some forward declarations for recursion */
@@ -235,12 +267,15 @@
     case 'c': return convert_char;            /* as character */
     case 'd': return convert_decimal;         /* decimal integer */
     case 'e': return convert_exponent;        /* exponential notation */
-    case 'E': return convert_exponentUC;      /* exponential notation with uppercase 'E' */
+    case 'E': return convert_exponentUC;      /* exponential notation
+                                                 with uppercase 'E' */
     case 'f': return convert_fixed;           /* fixed-point */
     case 'F': return convert_fixedUC;         /* fixed-point with uppercase */
     case 'g': return convert_general;         /* general number notation */
-    case 'G': return convert_generalUC;       /* general number notation with uppercase 'E' */
-    case 'n': return convert_number;          /* number in locale-specific format */
+    case 'G': return convert_generalUC;       /* general number notation
+                                                 with uppercase 'E' */
+    case 'n': return convert_number;          /* number in locale-specific
+                                                 format */
     case 'o': return convert_octal;           /* octal */
     case 'r': return convert_repr;            /* in repr() format */
     case 's': return convert_string;          /* convert using str() */
@@ -357,7 +392,8 @@
 
     if (XXX -- need check function) {
         Py_DECREF(result);
-        PyErr_SetString(PyExc_ValueError, "Invalid embedded Python identifier");
+        PyErr_SetString(PyExc_ValueError,
+                      "Invalid embedded Python identifier");
         return NULL;
     }
     */
@@ -511,7 +547,8 @@
             if (isnumeric && PySequence_Check(myobj))
                 newobj = PySequence_GetItem(myobj, index);
             else {
-                /* XXX -- do we need PyLong_FromLongLong?  Using ssizet, not int... */
+                /* XXX -- do we need PyLong_FromLongLong? 
+                                   Using ssizet, not int... */
                 subobj = isnumeric ?
                           PyInt_FromLong(index) :
                           get_python_identifier(fs, isargument);
@@ -653,7 +690,8 @@
     }
 
     /* The special case for 0-padding (backwards compat) */
-    if (format->fill_char == '\0' && index < spec_len && spec->ptr[index] == '0') {
+    if (format->fill_char == '\0' &&
+             index < spec_len && spec->ptr[index] == '0') {
         format->fill_char = '0';
         if (format->align == '\0') {
             format->align = '=';
@@ -666,9 +704,9 @@
     /* recalculate the length, since the pointers may have just changed */
     spec_len = spec->end - spec->ptr;
 
-    /* if specified_width is 0, we didn't consume any characters for the width.
-       in that case, reset the width to -1, because get_integer_index() will
-       have set it to zero */
+    /* if specified_width is 0, we didn't consume any characters for
+       the width. in that case, reset the width to -1, because
+       get_integer_index() will have set it to zero */
     if (specified_width <= 0) {
         format->width = -1;
     }
@@ -872,7 +910,8 @@
         return 0;
     }
 
-    /* if no type character was specified, look up the default type character, based on the type of our object */
+    /* if no type character was specified, look up the default
+       type character, based on the type of our object */
     if (format.type == '\0') {
         if (PyInt_Check(fieldobj) || PyLong_Check(fieldobj)) {
             format.type = 'd';
@@ -883,7 +922,8 @@
         }
     }
 
-    /* handle conversion functions that logically map to other conversion functions? */
+    /* handle conversion functions that logically map to
+       other conversion functions? */
 
     conversion = conversion_function(format.type);
     if (conversion == NULL) {
@@ -892,7 +932,8 @@
     }
 
     /* convert to a string first */
-    /* get the length written so that we can fixup inside the buffer, as needed */
+    /* get the length written so that we can fixup
+       inside the buffer, as needed */
     len = conversion(fieldobj, fs, &sign);
     if (len < 0)
         return 0;
@@ -919,7 +960,8 @@
 
     /* Handle the padding logic */
     if (format.width != -1) {
-        padding = format.width - len - (prefix == '\0' ? 0 : 1) - (suffix == '\0' ? 0 : 1);
+        padding = format.width - len - (prefix == '\0' ? 0 : 1) -
+                                       (suffix == '\0' ? 0 : 1);
         if (padding > 0) {
 #if 0
             if align == '>' or align == '^':


More information about the Python-checkins mailing list