Remove windows line break characters.
authorRobert Bradshaw <robertwb@math.washington.edu>
Tue, 9 Jun 2009 04:04:18 +0000 (21:04 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Tue, 9 Jun 2009 04:04:18 +0000 (21:04 -0700)
Cython/Compiler/ModuleNode.py
Cython/Compiler/Nodes.py
Cython/Compiler/Parsing.py
Cython/Compiler/PyrexTypes.py
Cython/Compiler/Symtab.py

index 2d10b4c4f81246057f14f5483bac47f902e1e2f2..161df8e5656b02e22559f7915810d84e7323176f 100644 (file)
@@ -704,34 +704,34 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
                 code.putln("#endif")
 
     def generate_cpp_class_definition(self, entry, code):
-        code.mark_pos(entry.pos)\r
-        type = entry.type\r
-        scope = type.scope\r
-        if scope:\r
-            kind = type.kind\r
-            packed = type.is_cpp_class and type.packed\r
-            if packed:\r
-                kind = "%s %s" % (type.kind, "__Pyx_PACKED")\r
-                code.globalstate.use_utility_code(packed_struct_utility_code)\r
-            header, footer = \\r
-                self.sue_header_footer(type, kind, type.cname)\r
-            code.putln("")\r
-            if packed:\r
-                code.putln("#if !defined(__GNUC__)")\r
-                code.putln("#pragma pack(push, 1)")\r
-                code.putln("#endif")\r
-            code.putln(header)\r
-            var_entries = scope.var_entries\r
-            for attr in var_entries:\r
-                code.putln(\r
-                    "%s;" %\r
-                        attr.type.declaration_code(attr.cname))\r
-            code.putln(footer)\r
-            if packed:\r
-                code.putln("#if !defined(__GNUC__)")\r
-                code.putln("#pragma pack(pop)")\r
-                code.putln("#endif")\r
-\r
+        code.mark_pos(entry.pos)
+        type = entry.type
+        scope = type.scope
+        if scope:
+            kind = type.kind
+            packed = type.is_cpp_class and type.packed
+            if packed:
+                kind = "%s %s" % (type.kind, "__Pyx_PACKED")
+                code.globalstate.use_utility_code(packed_struct_utility_code)
+            header, footer = \
+                self.sue_header_footer(type, kind, type.cname)
+            code.putln("")
+            if packed:
+                code.putln("#if !defined(__GNUC__)")
+                code.putln("#pragma pack(push, 1)")
+                code.putln("#endif")
+            code.putln(header)
+            var_entries = scope.var_entries
+            for attr in var_entries:
+                code.putln(
+                    "%s;" %
+                        attr.type.declaration_code(attr.cname))
+            code.putln(footer)
+            if packed:
+                code.putln("#if !defined(__GNUC__)")
+                code.putln("#pragma pack(pop)")
+                code.putln("#endif")
+
     def generate_enum_definition(self, entry, code):
         code.mark_pos(entry.pos)
         type = entry.type
index 752131a011a2940e458adf4ac4b014fab16f0fb8..ad43e45917f6e053b5ccd3eb34c083d2365a7512 100644 (file)
@@ -907,20 +907,20 @@ class CppClassNode(CStructOrUnionDefNode):
 
     #  name          string
     #  cname         string or None
-    #  visibility    "extern"\r
+    #  visibility    "extern"
     #  in_pxd        boolean
     #  attributes    [CVarDefNode] or None
     #  entry         Entry
     #  base_classes  [string]
-    #  namespace     string or None\r
+    #  namespace     string or None
 
     def analyse_declarations(self, env):
         scope = None
         if self.attributes is not None:
-            scope = CppClassScope(self.name)\r
-        self.entry = env.declare_cpp_class(\r
-            self.name, "cppclass", scope, 0, self.pos,\r
-            self.cname, self.base_classes, self.namespace, visibility = self.visibility)\r
+            scope = CppClassScope(self.name)
+        self.entry = env.declare_cpp_class(
+            self.name, "cppclass", scope, 0, self.pos,
+            self.cname, self.base_classes, self.namespace, visibility = self.visibility)
         if self.attributes is not None:
             if self.in_pxd and not env.in_cinclude:
                 self.entry.defined_in_pxd = 1
index 10f6bdad8c606fc1ec5375ebc0a87e313407201d..4c806ae3ddf625af82455e58e0c2f6fd41264d6c 100644 (file)
@@ -31,7 +31,7 @@ class Ctx(object):
     api = 0
     overridable = 0
     nogil = 0
-    namespace = None\r
+    namespace = None
 
     def __init__(self, **kwds):
         self.__dict__.update(kwds)
@@ -2124,7 +2124,7 @@ def p_cdef_extern_block(s, pos, ctx):
         _, include_file = p_string_literal(s)
     if s.systring == "namespace":
         s.next()
-        ctx.namespace = p_ident(s)\r
+        ctx.namespace = p_ident(s)
     ctx = ctx(cdef_flag = 1, visibility = 'extern')
     if p_nogil(s):
         ctx.nogil = 1
@@ -2584,10 +2584,10 @@ def p_cpp_class_definition(s, pos,  ctx):
         name = class_name,
         cname = None,
         base_classes = base_classes,
-        namespace = ctx.namespace,\r
+        namespace = ctx.namespace,
         visibility = ctx.visibility,
         in_pxd = ctx.level == 'module_pxd',
-        attributes = attributes)\r
+        attributes = attributes)
 
 
 
index ccf4d8507b9ab929825fdff85904044fb49165b0..661505981e73596127b4ac6e402467df75ad649d 100644 (file)
@@ -91,7 +91,7 @@ class PyrexType(BaseType):
     is_null_ptr = 0
     is_cfunction = 0
     is_struct_or_union = 0
-    is_cpp_class = 0\r
+    is_cpp_class = 0
     is_struct = 0
     is_enum = 0
     is_typedef = 0
@@ -1360,32 +1360,32 @@ class CStructOrUnionType(CType):
                         for x in self.scope.var_entries]
         return max(child_depths) + 1
 
-class CppClassType(CType):\r
-    #  name          string\r
-    #  cname         string\r
-    #  kind          string              "cppclass"\r
-    #  scope         CppClassScope\r
-    #  typedef_flag  boolean\r
-    #  packed        boolean\r
-    \r
-    is_cpp_class = 1\r
-    has_attributes = 1\r
+class CppClassType(CType):
+    #  name          string
+    #  cname         string
+    #  kind          string              "cppclass"
+    #  scope         CppClassScope
+    #  typedef_flag  boolean
+    #  packed        boolean
+    
+    is_cpp_class = 1
+    has_attributes = 1
     base_classes = []
-    namespace = None\r
-    \r
+    namespace = None
+    
     def __init__(self, name, kind, scope, typedef_flag, cname, base_classes,
-                 namespace = None, packed=False):\r
-        self.name = name\r
-        self.cname = cname\r
-        self.kind = kind\r
-        self.scope = scope\r
-        self.typedef_flag = typedef_flag\r
-        self.exception_check = True\r
-        self._convert_code = None\r
-        self.packed = packed\r
+                 namespace = None, packed=False):
+        self.name = name
+        self.cname = cname
+        self.kind = kind
+        self.scope = scope
+        self.typedef_flag = typedef_flag
+        self.exception_check = True
+        self._convert_code = None
+        self.packed = packed
         self.base_classes = base_classes
-        self.namespace = namespace\r
-\r
+        self.namespace = namespace
+
     def declaration_code(self, entity_code, for_display = 0, dll_linkage = None, pyrex = 0):
         inherited = ""
         for base_class in self.base_classes:
@@ -1395,22 +1395,22 @@ class CppClassType(CType):
             if base_class != baseclasses[-1]:
                 inherited += " , "
         return "%s%s" % (self.name, inherited)
-            \r
-\r
-    def is_subclass(self, other_type):\r
-        if not base_classes.empty():\r
-            for base_class in self.base_classes:\r
-                if base_class.is_subclass(other_type):\r
-                    return 1\r
-        return 0\r
-\r
-    def assignable_from_resolved_type(self, other_type):\r
-        if self.same_as_resolved_type(other_type):\r
-            return 1\r
-        if self.is_subclass(other) or self.same_as(other_type):\r
-            return 1\r
-        return 0\r
-\r
+            
+
+    def is_subclass(self, other_type):
+        if not base_classes.empty():
+            for base_class in self.base_classes:
+                if base_class.is_subclass(other_type):
+                    return 1
+        return 0
+
+    def assignable_from_resolved_type(self, other_type):
+        if self.same_as_resolved_type(other_type):
+            return 1
+        if self.is_subclass(other) or self.same_as(other_type):
+            return 1
+        return 0
+
 class CEnumType(CType):
     #  name           string
     #  cname          string or None
index a3430d6e6b371382c7f81e05675822c67a96ced4..32e0b1b50318188b158aead058f982bbb90956e6 100644 (file)
@@ -384,32 +384,32 @@ class Scope(object):
             self.check_for_illegal_incomplete_ctypedef(typedef_flag, pos)
         return entry
     
-    def declare_cpp_class(self, name, kind, scope,\r
+    def declare_cpp_class(self, name, kind, scope,
             typedef_flag, pos, cname = None, base_classes = [], namespace = None,
-            visibility = 'extern', packed = False):\r
-        if visibility != 'extern':\r
-            error(pos, "C++ classes may only be extern")\r
-        if not entry:\r
-            type = PyrexTypes.CppClassType(\r
-                name, kind, scope, typedef_flag, cname, base_classes, namespace, packed)\r
-            entry = self.declare_type(name, type, pos, cname,\r
-                visibility = visibility, defining = scope is not None)\r
-            self.sue_entries.append(entry)\r
-        else:\r
-            if not (entry.is_type and entry.type.is_cpp_class\r
-                    and entry.type.kind == kind):\r
-                warning(pos, "'%s' redeclared  " % name, 0)\r
-            elif scope and entry.type.scope:\r
-                warning(pos, "'%s' already defined  (ignoring second definition)" % name, 0)\r
-            else:\r
-                self.check_previous_typedef_flag(entry, typedef_flag, pos)\r
-                if scope:\r
-                    entry.type.scope = scope\r
-                    self.type_entries.append(entry)\r
-        if not scope and not entry.type.scope:\r
-            self.check_for_illegal_incomplete_ctypedef(typedef_flag, pos)\r
-        return entry\r
-    \r
+            visibility = 'extern', packed = False):
+        if visibility != 'extern':
+            error(pos, "C++ classes may only be extern")
+        if not entry:
+            type = PyrexTypes.CppClassType(
+                name, kind, scope, typedef_flag, cname, base_classes, namespace, packed)
+            entry = self.declare_type(name, type, pos, cname,
+                visibility = visibility, defining = scope is not None)
+            self.sue_entries.append(entry)
+        else:
+            if not (entry.is_type and entry.type.is_cpp_class
+                    and entry.type.kind == kind):
+                warning(pos, "'%s' redeclared  " % name, 0)
+            elif scope and entry.type.scope:
+                warning(pos, "'%s' already defined  (ignoring second definition)" % name, 0)
+            else:
+                self.check_previous_typedef_flag(entry, typedef_flag, pos)
+                if scope:
+                    entry.type.scope = scope
+                    self.type_entries.append(entry)
+        if not scope and not entry.type.scope:
+            self.check_for_illegal_incomplete_ctypedef(typedef_flag, pos)
+        return entry
+    
     def check_previous_typedef_flag(self, entry, typedef_flag, pos):
         if typedef_flag != entry.type.typedef_flag:
             error(pos, "'%s' previously declared using '%s'" % (