[niemeyer@conectiva.com: Re: [Python-Dev] Python's footprint]

Gustavo Niemeyer niemeyer@conectiva.com
Mon, 14 Jan 2002 09:30:53 -0200


--2/5bycvrmDh4d1IB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

> Why don't you use macro which only takes the name of the
> static array and the doc-string itself as argument ? This
> could then be expanded to whatever needs to be done for
> a particular case/platform, e.g.
>=20
> Py_DefineDocString(foo__doc__, "foo does bar");
>=20
> (I use such an approach in the mx stuff and it works great.)

Yes, it's a nice idea!

I'm looking for some way to "discard" the string using a macro. Let me
explain with code:

[...]
#define Py_DOCSTR(name, str) static char *name =3D str
#ifdef WITH_DOC_STRINGS
#define Py_DOCSTR_START(name) Py_DOCSTR(name,)
#define Py_DOCSTR_END ;
#else
#define Py_DOCSTR_START(name) Py_DOCSTR(name, ""); /* Also discards what
                                                      follows somehow */
#define Py_DOCSTR_END /* Stop discarding */
#endif
[...]


This would make it possible to do something like this:

Py_DOCSTR(simple_doc, "This is a simple doc string.");

=2E..and also...

Py_DOCSTR_START(complex_doc)
"This is a complex doc string"
#ifndef MS_WIN16
"like the one in sysmodule.c"
#endif
"Something else"
Py_DOCSTR_END

This seems to be the most elegant way to allow these complex strings.
But unfortunately, I haven't found any way so far to do this "discarding
thing", besides including another "#if" in the documentation itself.

Any good ideas?

--=20
Gustavo Niemeyer

[ 2AAC 7928 0FBF 0299 5EB5  60E2 2253 B29A 6664 3A0C ]

--2/5bycvrmDh4d1IB
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8QsFtIlOymmZkOgwRAhCuAKCzfuR27L8hkrrUPdnvp/ACfxUozgCfYuMn
n14LE+7EpRShujzh6ZZm+HA=
=x9QI
-----END PGP SIGNATURE-----

--2/5bycvrmDh4d1IB--