From f08000de17d87c8edc246e7b25d643ec5ccbbcc2 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Tue, 29 May 2007 00:57:46 +0000 Subject: [PATCH] [Python] Split docstrings into separate string literals at each newline when generating C/C++ wrapper code (the C/C++ compiler will just combine the back into a single string literal). This avoids MSVC complaining that the strings are too long (problem reported by Bo Peng on the mailing list). git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9841 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- CHANGES.current | 8 ++++++++ Source/Modules/python.cxx | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGES.current b/CHANGES.current index 2d300d2d4..65a5d45e9 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -1,6 +1,14 @@ Version 1.3.32 (in progress) ============================ +05/29/2007: olly + [Python] + Split docstrings into separate string literals at each newline when + generating C/C++ wrapper code (the C/C++ compiler will just combine + the back into a single string literal). This avoids MSVC + complaining that the strings are too long (problem reported by + Bo Peng on the mailing list). + 05/28/2007: olly [Python] Escape backslashes in docstrings. diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index cfbd793d1..06d740afd 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -1420,8 +1420,8 @@ public: if (have_docstring(n)) { String *ds = docstring(n, AUTODOC_FUNC, "", false); Replaceall(ds, "\\", "\\\\"); - Replaceall(ds, "\n", "\\n"); - Replaceall(ds, "\"", "\\\""); + Replaceall(ds, "\"", "\\\""); + Replaceall(ds, "\n", "\\n\"\n\t\t\""); Printf(methods, "(char *)\"%s\\nswig_ptr: %s\"", ds, Getattr(n, "feature:callback:name")); } else { Printf(methods, "(char *)\"swig_ptr: %s\"", Getattr(n, "feature:callback:name")); @@ -1429,8 +1429,8 @@ public: } else if (have_docstring(n)) { String *ds = docstring(n, AUTODOC_FUNC, "", false); Replaceall(ds, "\\", "\\\\"); - Replaceall(ds, "\n", "\\n"); Replaceall(ds, "\"", "\\\""); + Replaceall(ds, "\n", "\\n\"\n\t\t\""); Printf(methods, "(char *)\"%s\"", ds); } else { Append(methods, "NULL"); @@ -2445,7 +2445,7 @@ public: It should be possible to rewrite it using a more elegant way, like copying the Java approach for the 'override' array. - But for know, this seems to be the least intrusive way. + But for now, this seems to be the least intrusive way. */ Printf(f_directors_h, "\n\n"); Printf(f_directors_h, "/* Internal Director utilities */\n");