Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #55312

Re: PyDoc_STRVAR error in msvc compile

From Robin Becker <robin@reportlab.com>
Subject Re: PyDoc_STRVAR error in msvc compile
Date 2013-10-02 12:28 +0100
References <524AFB57.9090500@chamonix.reportlab.co.uk> <524B05B7.4060906@mrabarnett.plus.com> <524BE099.8040004@chamonix.reportlab.co.uk> <524BEEFD.50202@chamonix.reportlab.co.uk> <l2gto9$in1$1@ger.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.614.1380713327.18130.python-list@python.org> (permalink)

Show all headers | View raw


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.
-- 
Robin Becker

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: PyDoc_STRVAR error in msvc compile Robin Becker <robin@reportlab.com> - 2013-10-02 12:28 +0100

csiph-web