summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-01-27 16:50:21 (GMT)
committerGuido van Rossum <guido@python.org>1992-01-27 16:50:21 (GMT)
commit550fbcc2aa8d77faab142177470390abe7e4728d (patch)
tree0e954140a7395cdd9ebc57d20182be3d7345af9b
parent9c16d7fbac98c2b3a4a6061a36c88f57accc1a89 (diff)
downloadcpython-550fbcc2aa8d77faab142177470390abe7e4728d.zip
cpython-550fbcc2aa8d77faab142177470390abe7e4728d.tar.gz
cpython-550fbcc2aa8d77faab142177470390abe7e4728d.tar.bz2
New getargs() function. Define macros with conventional names,
except get*str*arg --> get*Str*arg; get*str*arg fetches a C string.
-rw-r--r--Include/modsupport.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/Include/modsupport.h b/Include/modsupport.h
index 016220f..60965d0 100644
--- a/Include/modsupport.h
+++ b/Include/modsupport.h
@@ -25,3 +25,31 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Module support interface */
extern object *initmodule PROTO((char *, struct methodlist *));
+extern int getargs PROTO((object *, char *, ...));
+
+#define getnoarg(v) getargs(v, "")
+#define getintarg(v, a) getargs(v, "i", a)
+#define getintintarg(v, a, b) getargs(v, "(ii)", a, b)
+#define getintintintarg(v, a, b, c) getargs(v, "(iii)", a, b, c)
+#define getlongarg(v, a) getargs(v, "l", a)
+#define getlonglongarg(v, a, b) getargs(v, "(ll)", a, b)
+#define getlonglongobjectarg(v, a, b, c) getargs(v, "(llO)", a, b, c)
+#define getStrarg(v, a) getargs(v, "S", a)
+#define getstrarg(v, a) getargs(v, "s", a)
+#define getstrstrarg(v, a, b) getargs(v, "(ss)", a, b)
+#define getStrStrarg(v, a, b) getargs(v, "(SS)", a, b)
+#define getstrstrintarg(v, a, b, c) getargs(v, "(ssi)", a, b, c)
+#define getStrintarg(v, a, b) getargs(v, "(Si)", a, b)
+#define getstrintarg(v, a, b) getargs(v, "(si)", a, b)
+#define getintstrarg(v, a, b) getargs(v, "(is)", a, b)
+#define getpointarg(v, a) getargs(v, "(ii)", a, (a)+1)
+#define get3pointarg(v, a) getargs(v, "((ii)(ii)(ii))", \
+ a, a+1, a+2, a+3, a+4, a+5)
+#define getrectarg(v, a) getargs(v, "((ii)(ii))", a, a+1, a+2, a+3)
+#define getrectintarg(v, a) getargs(v, "(((ii)(ii))i)", a, a+1, a+2, a+3, a+4)
+#define getpointintarg(v, a) getargs(v, "((ii)i)", a, a+1, a+2)
+#define getpointstrarg(v, a, b) getargs(v, "((ii)s)", a, a+1, b)
+#define getrectpointarg(v, a) getargs(v, "(((ii)(ii))(ii))", \
+ a, a+1, a+2, a+3, a+4, a+5)
+#define getdoublearg(v, a) getargs(v, "d", a)
+#define get2doublearg(v, a, b) getargs(v, "(dd)", a, b)