Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'static': 0.04; 'url:bitbucket': 0.05; '(all': 0.07; 'string': 0.09; '#endif': 0.09; 'logic': 0.09; 'seemed': 0.09; 'spaces': 0.09; 'times,': 0.14; '"..."': 0.16; '#create': 0.16; '#delete': 0.16; '#ifdef': 0.16; 'backslashes': 0.16; 'conditional': 0.16; 'definitions,': 0.16; 'expands': 0.16; 'experiment.': 0.16; 'formatted': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'line)': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'string\\n': 0.16; 'tabs': 0.16; 'variations': 0.16; 'vim)': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'library': 0.18; 'module': 0.19; 'first.': 0.19; 'properly': 0.19; 'skip:g 40': 0.19; 'url:default': 0.19; 'fit': 0.20; 'seems': 0.21; '>>>': 0.22; 'import': 0.22; 'header:User-Agent:1': 0.23; 'char': 0.24; 'either.': 0.24; 'looks': 0.24; 'source': 0.25; 'extension': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'skip:p 30': 0.29; "doesn't": 0.30; 'dos': 0.30; 'expansion': 0.30; "i'm": 0.30; 'work.': 0.31; '(which': 0.31; 'code': 0.31; 'lines': 0.31; 'font': 0.31; 'quotes': 0.31; 'interface': 0.32; 'run': 0.32; 'another': 0.32; 'actual': 0.34; 'skip:_ 10': 0.34; "can't": 0.35; 'something': 0.35; 'etc': 0.35; 'no,': 0.35; 'received:84': 0.35; 'but': 0.35; 'there': 0.35; 'version': 0.36; 'url:org': 0.36; 'so,': 0.37; 'two': 0.37; 'skip:m 40': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'does': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'dave': 0.60; 'ago.': 0.61; 'eye': 0.61; 'lost': 0.61; 'simple': 0.61; 'first': 0.61; 'show': 0.63; 'such': 0.63; 'skip:n 10': 0.64; 'url:c': 0.67; 'header:Reply-To:1': 0.67; 'believe': 0.68; 'reply-to:no real name:2**0': 0.71; 'unusual': 0.74; 'ending': 0.78; '");': 0.84; '(according': 0.84; 'etc,': 0.84; 'overlooked': 0.84; 'reply-to:addr:python.org': 0.84; 'angel': 0.91 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=PIY2p5aC c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=LqG8EI-UCiYA:10 a=Ta871D-plWYA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=n1oe47EORhEA:10 a=xtERp6CFAAAA:8 a=jfk4nI1gsRHGcmXhdegA:9 a=wPNLvfGTeEIA:10 X-AUTH: mrabarnett:2500 Date: Wed, 02 Oct 2013 16:18:03 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: PyDoc_STRVAR error in msvc compile References: <524AFB57.9090500@chamonix.reportlab.co.uk> <524B05B7.4060906@mrabarnett.plus.com> <524BE099.8040004@chamonix.reportlab.co.uk> <524BEEFD.50202@chamonix.reportlab.co.uk> <524C035F.6030000@chamonix.reportlab.co.uk> In-Reply-To: <524C035F.6030000@chamonix.reportlab.co.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 67 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1380727072 news.xs4all.nl 15883 [2001:888:2000:d::a6]:51771 X-Complaints-To: abuse@xs4all.nl Path: csiph.com!usenet.pasdenom.info!news.franciliens.net!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Xref: csiph.com comp.lang.python:55351 On 02/10/2013 12:28, Robin Becker wrote: > On 02/10/2013 11:49, Dave Angel wrote: >>> conditional string or "" then MSVC 9 seems to be ok with it. >>> > >> MSVC and other compilers do not not see eye to eye on the preprocessor >> semantics. I no longer use MSVC so I can't experiment. I can only try >> to recall extensive manipulation two decades ago. >> >> I believe it does the logic of "backslash at the end of line" first. So >> if there are any spaces or tabs after those backslashes (which might >> have been lost when you pasted it here), fix them first. >> >> Then I think it looks for macro definitions, where the # must be the >> first non-whitespace of the line. Then it expands such macros, and I >> think MSVC is unusual in that it expands them multiple times, so a macro >> expansion can result in another macro invocation. >> >> I'm not sure where quotes fit in here. >> >> Your original message code doesn't match the expansion you show with -E, >> so i suspect your "..." eliding hid something significant. > > The actual is this code from _renderPM.c > > https://bitbucket.org/rptlab/reportlab/src/fa65fe72b6c2aaecb7747bf14884adb996d8e87f/src/rl_addons/renderPM/_renderPM.c?at=default > > PyDoc_STRVAR(__DOC__, > "Helper extension module for renderPM.\n\ > \n\ > Interface summary:\n\ > \n\ > import _renderPM\n\ > gstate(width,height[,depth=3,bg=0xffffff]) #create an initialised > graphics state\n\ > makeT1Font(fontName,pfbPath,names[,reader]) #make a T1 font\n\ > delCache() #delete all T1 font info\n\ > pil2pict(cols,rows,datastr,palette) hreturn PICT version of im as bytes\n" > #ifdef RENDERPM_FT > " ft_get_face(fontName) --> ft_face instance\n" > #endif > "\n\ > _libart_version # base library version string\n\ > _version # module version string\n\ > "); > > when I run that through the pre-processor I get (all on a single line) > > > static char __DOC__[] = "Helper extension module for renderPM.\n\nInterface > summary:\n\n import _renderPM\n gstate(width,height[,depth=3,bg=0xffffff]) > #create an initialised graphics state\n > makeT1Font(fontName,pfbPath,names[,reader]) #make a T1 font\n delCache() #delete > all T1 font info\n pil2pict(cols,rows,datastr,palette) hreturn PICT version of > im as bytes\n" #ifdef 1 " ft_get_face(fontName) --> ft_face instance\n" > #endif "\n _libart_version # base library version string\n _version # module > version string\n"; > > > > I tried a couple of variations of \ at the end of the line preceding #ifdef etc > etc, but nothing seemed to work. The source is properly DOS formatted (according > to vim) so it's not a simple line ending issue and I don't have any extra spaces > at the end of the lines etc etc. > I overlooked that PyDoc_STRVAR is a macro, so, no, it doesn't work for me either.