Mercurial > cpython-lru_cache-weakref
annotate Python/modsupport.c @ 607:0214bbf47bf6 legacy-trunk
If sys.trace is None, don't trace. For exceptions, only use
the local trace function.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Sun, 19 Jan 1992 16:26:13 +0000 |
| parents | 90f35fcf8ea0 |
| children | 3cb686c48cdd |
| rev | line source |
|---|---|
| 145 | 1 /*********************************************************** |
| 2 Copyright 1991 by Stichting Mathematisch Centrum, Amsterdam, The | |
| 3 Netherlands. | |
| 4 | |
| 5 All Rights Reserved | |
| 6 | |
| 7 Permission to use, copy, modify, and distribute this software and its | |
| 8 documentation for any purpose and without fee is hereby granted, | |
| 9 provided that the above copyright notice appear in all copies and that | |
| 10 both that copyright notice and this permission notice appear in | |
| 11 supporting documentation, and that the names of Stichting Mathematisch | |
| 12 Centrum or CWI not be used in advertising or publicity pertaining to | |
| 13 distribution of the software without specific, written prior permission. | |
| 14 | |
| 15 STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO | |
| 16 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
| 17 FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE | |
| 18 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
| 20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT | |
| 21 OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 22 | |
| 23 ******************************************************************/ | |
| 24 | |
| 6 | 25 /* Module support implementation */ |
| 26 | |
| 86 | 27 #include "allobjects.h" |
| 6 | 28 #include "modsupport.h" |
| 29 #include "import.h" | |
| 30 | |
| 31 | |
| 32 object * | |
| 33 initmodule(name, methods) | |
| 34 char *name; | |
| 35 struct methodlist *methods; | |
| 36 { | |
| 37 object *m, *d, *v; | |
| 38 struct methodlist *ml; | |
| 86 | 39 char namebuf[256]; |
| 40 if ((m = add_module(name)) == NULL) { | |
| 6 | 41 fprintf(stderr, "initializing module: %s\n", name); |
| 42 fatal("can't create a module"); | |
| 43 } | |
| 44 d = getmoduledict(m); | |
| 45 for (ml = methods; ml->ml_name != NULL; ml++) { | |
| 86 | 46 sprintf(namebuf, "%s.%s", name, ml->ml_name); |
| 47 v = newmethodobject(strdup(namebuf), ml->ml_meth, | |
|
488
90f35fcf8ea0
Add "varargs" attribute.
Guido van Rossum <guido@python.org>
parents:
372
diff
changeset
|
48 (object *)NULL, ml->ml_varargs); |
| 86 | 49 /* XXX The strdup'ed memory is never freed */ |
| 6 | 50 if (v == NULL || dictinsert(d, ml->ml_name, v) != 0) { |
| 51 fprintf(stderr, "initializing module: %s\n", name); | |
| 52 fatal("can't initialize module"); | |
| 53 } | |
| 54 DECREF(v); | |
| 55 } | |
| 86 | 56 return m; |
| 6 | 57 } |
| 58 | |
| 59 | |
| 60 /* Argument list handling tools. | |
| 61 All return 1 for success, or call err_set*() and return 0 for failure */ | |
| 62 | |
| 63 int | |
| 64 getnoarg(v) | |
| 65 object *v; | |
| 66 { | |
| 67 if (v != NULL) { | |
| 68 return err_badarg(); | |
| 69 } | |
| 70 return 1; | |
| 71 } | |
| 72 | |
| 73 int | |
| 74 getintarg(v, a) | |
| 75 object *v; | |
| 76 int *a; | |
| 77 { | |
| 78 if (v == NULL || !is_intobject(v)) { | |
| 79 return err_badarg(); | |
| 80 } | |
| 81 *a = getintvalue(v); | |
| 82 return 1; | |
| 83 } | |
| 84 | |
| 85 int | |
| 86 getintintarg(v, a, b) | |
| 87 object *v; | |
| 88 int *a; | |
| 89 int *b; | |
| 90 { | |
| 91 if (v == NULL || !is_tupleobject(v) || gettuplesize(v) != 2) { | |
| 92 return err_badarg(); | |
| 93 } | |
| 94 return getintarg(gettupleitem(v, 0), a) && | |
| 95 getintarg(gettupleitem(v, 1), b); | |
| 96 } | |
| 97 | |
| 98 int | |
|
306
c8a979029df4
Added getintintintarg() (3 int args)
Guido van Rossum <guido@python.org>
parents:
169
diff
changeset
|
99 getintintintarg(v, a, b, c) |
|
c8a979029df4
Added getintintintarg() (3 int args)
Guido van Rossum <guido@python.org>
parents:
169
diff
changeset
|
100 object *v; |
|
c8a979029df4
Added getintintintarg() (3 int args)
Guido van Rossum <guido@python.org>
parents:
169
diff
changeset
|
101 int *a; |
|
c8a979029df4
Added getintintintarg() (3 int args)
Guido van Rossum <guido@python.org>
parents:
169
diff
changeset
|
102 int *b; |
|
c8a979029df4
Added getintintintarg() (3 int args)
Guido van Rossum <guido@python.org>
parents:
169
diff
changeset
|
103 int *c; |
|
c8a979029df4
Added getintintintarg() (3 int args)
Guido van Rossum <guido@python.org>
parents:
169
diff
changeset
|
104 { |
|
c8a979029df4
Added getintintintarg() (3 int args)
Guido van Rossum <guido@python.org>
parents:
169
diff
changeset
|
105 if (v == NULL || !is_tupleobject(v) || gettuplesize(v) != 3) { |
|
c8a979029df4
Added getintintintarg() (3 int args)
Guido van Rossum <guido@python.org>
parents:
169
diff
changeset
|
106 return err_badarg(); |
|
c8a979029df4
Added getintintintarg() (3 int args)
Guido van Rossum <guido@python.org>
parents:
169
diff
changeset
|
107 } |
|
c8a979029df4
Added getintintintarg() (3 int args)
Guido van Rossum <guido@python.org>
parents:
169
diff
changeset
|
108 return getintarg(gettupleitem(v, 0), a) && |
|
c8a979029df4
Added getintintintarg() (3 int args)
Guido van Rossum <guido@python.org>
parents:
169
diff
changeset
|
109 getintarg(gettupleitem(v, 1), b) && |
|
c8a979029df4
Added getintintintarg() (3 int args)
Guido van Rossum <guido@python.org>
parents:
169
diff
changeset
|
110 getintarg(gettupleitem(v, 2), c); |
|
c8a979029df4
Added getintintintarg() (3 int args)
Guido van Rossum <guido@python.org>
parents:
169
diff
changeset
|
111 } |
|
c8a979029df4
Added getintintintarg() (3 int args)
Guido van Rossum <guido@python.org>
parents:
169
diff
changeset
|
112 |
|
c8a979029df4
Added getintintintarg() (3 int args)
Guido van Rossum <guido@python.org>
parents:
169
diff
changeset
|
113 int |
| 6 | 114 getlongarg(v, a) |
| 115 object *v; | |
| 116 long *a; | |
| 117 { | |
| 118 if (v == NULL || !is_intobject(v)) { | |
| 119 return err_badarg(); | |
| 120 } | |
| 121 *a = getintvalue(v); | |
| 122 return 1; | |
| 123 } | |
| 124 | |
| 125 int | |
|
372
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
126 getlonglongarg(v, a, b) |
| 6 | 127 object *v; |
| 128 long *a, *b; | |
| 129 { | |
| 130 if (v == NULL || !is_tupleobject(v) || gettuplesize(v) != 2) { | |
| 131 return err_badarg(); | |
| 132 } | |
| 133 return getlongarg(gettupleitem(v, 0), a) && | |
| 134 getlongarg(gettupleitem(v, 1), b); | |
| 135 } | |
| 136 | |
| 137 int | |
|
372
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
138 getlongobjectarg(v, a, b) |
|
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
139 object *v; |
|
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
140 long *a; |
|
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
141 object **b; |
|
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
142 { |
|
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
143 if (v == NULL || !is_tupleobject(v) || gettuplesize(v) != 2) { |
|
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
144 return err_badarg(); |
|
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
145 } |
|
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
146 if (getlongarg(gettupleitem(v, 0), a)) { |
|
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
147 *b = gettupleitem(v, 1); |
|
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
148 return 1; |
|
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
149 } |
|
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
150 else { |
|
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
151 return err_badarg(); |
|
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
152 } |
|
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
153 } |
|
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
154 |
|
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
155 int |
|
16b18f586fec
getlonglongargs --> getlonglongarg
Guido van Rossum <guido@python.org>
parents:
321
diff
changeset
|
156 getlonglongobjectarg(v, a, b, c) |
| 6 | 157 object *v; |
| 158 long *a, *b; | |
| 159 object **c; | |
| 160 { | |
| 161 if (v == NULL || !is_tupleobject(v) || gettuplesize(v) != 3) { | |
| 162 return err_badarg(); | |
| 163 } | |
| 164 if (getlongarg(gettupleitem(v, 0), a) && | |
| 165 getlongarg(gettupleitem(v, 1), b)) { | |
| 166 *c = gettupleitem(v, 2); | |
| 167 return 1; | |
| 168 } | |
| 169 else { | |
| 170 return err_badarg(); | |
| 171 } | |
| 172 } | |
| 173 | |
| 174 int | |
| 175 getstrarg(v, a) | |
| 176 object *v; | |
| 177 object **a; | |
| 178 { | |
| 179 if (v == NULL || !is_stringobject(v)) { | |
| 180 return err_badarg(); | |
| 181 } | |
| 182 *a = v; | |
| 183 return 1; | |
| 184 } | |
| 185 | |
| 186 int | |
| 187 getstrstrarg(v, a, b) | |
| 188 object *v; | |
| 189 object **a; | |
| 190 object **b; | |
| 191 { | |
| 192 if (v == NULL || !is_tupleobject(v) || gettuplesize(v) != 2) { | |
| 193 return err_badarg(); | |
| 194 } | |
| 195 return getstrarg(gettupleitem(v, 0), a) && | |
| 196 getstrarg(gettupleitem(v, 1), b); | |
| 197 } | |
| 198 | |
| 199 int | |
| 200 getstrstrintarg(v, a, b, c) | |
| 201 object *v; | |
| 202 object **a; | |
| 203 object **b; | |
| 204 int *c; | |
| 205 { | |
| 206 if (v == NULL || !is_tupleobject(v) || gettuplesize(v) != 3) { | |
| 207 return err_badarg(); | |
| 208 } | |
| 209 return getstrarg(gettupleitem(v, 0), a) && | |
| 210 getstrarg(gettupleitem(v, 1), b) && | |
| 211 getintarg(gettupleitem(v, 2), c); | |
| 212 } | |
| 213 | |
| 214 int | |
| 215 getstrintarg(v, a, b) | |
| 216 object *v; | |
| 217 object **a; | |
| 218 int *b; | |
| 219 { | |
| 220 if (v == NULL || !is_tupleobject(v) || gettuplesize(v) != 2) { | |
| 221 return err_badarg(); | |
| 222 } | |
| 223 return getstrarg(gettupleitem(v, 0), a) && | |
| 224 getintarg(gettupleitem(v, 1), b); | |
| 225 } | |
| 226 | |
| 227 int | |
| 228 getintstrarg(v, a, b) | |
| 229 object *v; | |
| 230 int *a; | |
| 231 object **b; | |
| 232 { | |
| 233 if (v == NULL || !is_tupleobject(v) || gettuplesize(v) != 2) { | |
| 234 return err_badarg(); | |
| 235 } | |
| 236 return getintarg(gettupleitem(v, 0), a) && | |
| 237 getstrarg(gettupleitem(v, 1), b); | |
| 238 } | |
| 239 | |
| 240 int | |
| 241 getpointarg(v, a) | |
| 242 object *v; | |
| 243 int *a; /* [2] */ | |
| 244 { | |
| 245 return getintintarg(v, a, a+1); | |
| 246 } | |
| 247 | |
| 248 int | |
| 249 get3pointarg(v, a) | |
| 250 object *v; | |
| 251 int *a; /* [6] */ | |
| 252 { | |
| 253 if (v == NULL || !is_tupleobject(v) || gettuplesize(v) != 3) { | |
| 254 return err_badarg(); | |
| 255 } | |
| 256 return getpointarg(gettupleitem(v, 0), a) && | |
| 257 getpointarg(gettupleitem(v, 1), a+2) && | |
| 258 getpointarg(gettupleitem(v, 2), a+4); | |
| 259 } | |
| 260 | |
| 261 int | |
| 262 getrectarg(v, a) | |
| 263 object *v; | |
| 264 int *a; /* [2+2] */ | |
| 265 { | |
| 266 if (v == NULL || !is_tupleobject(v) || gettuplesize(v) != 2) { | |
| 267 return err_badarg(); | |
| 268 } | |
| 269 return getpointarg(gettupleitem(v, 0), a) && | |
| 270 getpointarg(gettupleitem(v, 1), a+2); | |
| 271 } | |
| 272 | |
| 273 int | |
| 274 getrectintarg(v, a) | |
| 275 object *v; | |
| 276 int *a; /* [4+1] */ | |
| 277 { | |
| 278 if (v == NULL || !is_tupleobject(v) || gettuplesize(v) != 2) { | |
| 279 return err_badarg(); | |
| 280 } | |
| 281 return getrectarg(gettupleitem(v, 0), a) && | |
| 282 getintarg(gettupleitem(v, 1), a+4); | |
| 283 } | |
| 284 | |
| 285 int | |
| 286 getpointintarg(v, a) | |
| 287 object *v; | |
| 288 int *a; /* [2+1] */ | |
| 289 { | |
| 290 if (v == NULL || !is_tupleobject(v) || gettuplesize(v) != 2) { | |
| 291 return err_badarg(); | |
| 292 } | |
| 293 return getpointarg(gettupleitem(v, 0), a) && | |
| 294 getintarg(gettupleitem(v, 1), a+2); | |
| 295 } | |
| 296 | |
| 297 int | |
| 298 getpointstrarg(v, a, b) | |
| 299 object *v; | |
| 300 int *a; /* [2] */ | |
| 301 object **b; | |
| 302 { | |
| 303 if (v == NULL || !is_tupleobject(v) || gettuplesize(v) != 2) { | |
| 304 return err_badarg(); | |
| 305 } | |
| 306 return getpointarg(gettupleitem(v, 0), a) && | |
| 307 getstrarg(gettupleitem(v, 1), b); | |
| 308 } | |
| 309 | |
| 310 int | |
| 311 getstrintintarg(v, a, b, c) | |
| 312 object *v; | |
| 313 object *a; | |
| 314 int *b, *c; | |
| 315 { | |
| 316 if (v == NULL || !is_tupleobject(v) || gettuplesize(v) != 3) { | |
| 317 return err_badarg(); | |
| 318 } | |
| 319 return getstrarg(gettupleitem(v, 0), a) && | |
| 320 getintarg(gettupleitem(v, 1), b) && | |
| 321 getintarg(gettupleitem(v, 2), c); | |
| 322 } | |
| 323 | |
| 324 int | |
| 325 getrectpointarg(v, a) | |
| 326 object *v; | |
| 327 int *a; /* [4+2] */ | |
| 328 { | |
| 329 if (v == NULL || !is_tupleobject(v) || gettuplesize(v) != 2) { | |
| 330 return err_badarg(); | |
| 331 } | |
| 332 return getrectarg(gettupleitem(v, 0), a) && | |
| 333 getpointarg(gettupleitem(v, 1), a+4); | |
| 334 } | |
| 335 | |
| 336 int | |
| 337 getlongtuplearg(args, a, n) | |
| 338 object *args; | |
| 339 long *a; /* [n] */ | |
| 340 int n; | |
| 341 { | |
| 342 int i; | |
| 343 if (!is_tupleobject(args) || gettuplesize(args) != n) { | |
| 344 return err_badarg(); | |
| 345 } | |
| 346 for (i = 0; i < n; i++) { | |
| 347 object *v = gettupleitem(args, i); | |
| 348 if (!is_intobject(v)) { | |
| 349 return err_badarg(); | |
| 350 } | |
| 351 a[i] = getintvalue(v); | |
| 352 } | |
| 353 return 1; | |
| 354 } | |
| 355 | |
| 356 int | |
| 357 getshorttuplearg(args, a, n) | |
| 358 object *args; | |
| 359 short *a; /* [n] */ | |
| 360 int n; | |
| 361 { | |
| 362 int i; | |
| 363 if (!is_tupleobject(args) || gettuplesize(args) != n) { | |
| 364 return err_badarg(); | |
| 365 } | |
| 366 for (i = 0; i < n; i++) { | |
| 367 object *v = gettupleitem(args, i); | |
| 368 if (!is_intobject(v)) { | |
| 369 return err_badarg(); | |
| 370 } | |
| 371 a[i] = getintvalue(v); | |
| 372 } | |
| 373 return 1; | |
| 374 } | |
| 375 | |
| 376 int | |
| 377 getlonglistarg(args, a, n) | |
| 378 object *args; | |
| 379 long *a; /* [n] */ | |
| 380 int n; | |
| 381 { | |
| 382 int i; | |
| 383 if (!is_listobject(args) || getlistsize(args) != n) { | |
| 384 return err_badarg(); | |
| 385 } | |
| 386 for (i = 0; i < n; i++) { | |
| 387 object *v = getlistitem(args, i); | |
| 388 if (!is_intobject(v)) { | |
| 389 return err_badarg(); | |
| 390 } | |
| 391 a[i] = getintvalue(v); | |
| 392 } | |
| 393 return 1; | |
| 394 } | |
| 395 | |
| 396 int | |
| 397 getshortlistarg(args, a, n) | |
| 398 object *args; | |
| 399 short *a; /* [n] */ | |
| 400 int n; | |
| 401 { | |
| 402 int i; | |
| 403 if (!is_listobject(args) || getlistsize(args) != n) { | |
| 404 return err_badarg(); | |
| 405 } | |
| 406 for (i = 0; i < n; i++) { | |
| 407 object *v = getlistitem(args, i); | |
| 408 if (!is_intobject(v)) { | |
| 409 return err_badarg(); | |
| 410 } | |
| 411 a[i] = getintvalue(v); | |
| 412 } | |
| 413 return 1; | |
| 414 } | |
|
169
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
415 |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
416 int |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
417 getdoublearg(args, px) |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
418 register object *args; |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
419 double *px; |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
420 { |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
421 if (args == NULL) |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
422 return err_badarg(); |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
423 if (is_floatobject(args)) { |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
424 *px = getfloatvalue(args); |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
425 return 1; |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
426 } |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
427 if (is_intobject(args)) { |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
428 *px = getintvalue(args); |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
429 return 1; |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
430 } |
|
321
2a84b16f91b0
Support for long integers
Guido van Rossum <guido@python.org>
parents:
306
diff
changeset
|
431 if (is_longobject(args)) { |
|
2a84b16f91b0
Support for long integers
Guido van Rossum <guido@python.org>
parents:
306
diff
changeset
|
432 *px = dgetlongvalue(args); |
|
2a84b16f91b0
Support for long integers
Guido van Rossum <guido@python.org>
parents:
306
diff
changeset
|
433 return 1; |
|
2a84b16f91b0
Support for long integers
Guido van Rossum <guido@python.org>
parents:
306
diff
changeset
|
434 } |
|
169
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
435 return err_badarg(); |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
436 } |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
437 |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
438 int |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
439 get2doublearg(args, px, py) |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
440 register object *args; |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
441 double *px, *py; |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
442 { |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
443 if (args == NULL || !is_tupleobject(args) || gettuplesize(args) != 2) |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
444 return err_badarg(); |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
445 return getdoublearg(gettupleitem(args, 0), px) && |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
446 getdoublearg(gettupleitem(args, 1), py); |
|
1ed7f6f65983
Moved get*doublearg() routines here from mathmodule.c
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
447 } |
