From loewis@users.sourceforge.net Tue Jan 1 18:41:35 2002 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 01 Jan 2002 10:41:35 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc ACKS,1.151,1.152 NEWS,1.341,1.342 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv30638/Misc Modified Files: ACKS NEWS Log Message: Patch #497098: build support for GNU/Hurd. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.151 retrieving revision 1.152 diff -C2 -d -r1.151 -r1.152 *** ACKS 2001/12/28 20:53:22 1.151 --- ACKS 2002/01/01 18:41:32 1.152 *************** *** 302,305 **** --- 302,306 ---- The Dragon De Monsyne Skip Montanaro + James A Morrison Sape Mullender Sjoerd Mullender Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.341 retrieving revision 1.342 diff -C2 -d -r1.341 -r1.342 *** NEWS 2001/12/28 20:57:14 1.341 --- NEWS 2002/01/01 18:41:32 1.342 *************** *** 31,34 **** --- 31,36 ---- New platforms + - GNU/Hurd is now supported. + Tests From loewis@users.sourceforge.net Tue Jan 1 18:41:35 2002 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 01 Jan 2002 10:41:35 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python thread_cthread.h,2.15,2.16 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv30638/Python Modified Files: thread_cthread.h Log Message: Patch #497098: build support for GNU/Hurd. Index: thread_cthread.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/thread_cthread.h,v retrieving revision 2.15 retrieving revision 2.16 diff -C2 -d -r2.15 -r2.16 *** thread_cthread.h 2001/10/16 21:13:49 2.15 --- thread_cthread.h 2002/01/01 18:41:33 2.16 *************** *** 1,5 **** --- 1,10 ---- + #ifdef MACH_C_THREADS #include + #endif + #ifdef HURD_C_THREADS + #include + #endif /* *************** *** 9,13 **** PyThread__init_thread(void) { ! cthread_init(); } --- 14,25 ---- PyThread__init_thread(void) { ! #ifndef HURD_C_THREADS ! /* Roland McGrath said this should not be used since this is ! done while linking to threads */ ! cthread_init(); ! #else ! /* do nothing */ ! ; ! #endif } *************** *** 128,135 **** dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag)); if (waitflag) { /* blocking */ ! mutex_lock(lock); success = TRUE; } else { /* non blocking */ ! success = mutex_try_lock(lock); } dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success)); --- 140,147 ---- dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag)); if (waitflag) { /* blocking */ ! mutex_lock((mutex_t)lock); success = TRUE; } else { /* non blocking */ ! success = mutex_try_lock((mutex_t)lock); } dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success)); From loewis@users.sourceforge.net Tue Jan 1 18:41:34 2002 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 01 Jan 2002 10:41:34 -0800 Subject: [Python-checkins] CVS: python/dist/src acconfig.h,1.58,1.59 configure,1.279,1.280 configure.in,1.288,1.289 pyconfig.h.in,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv30638 Modified Files: acconfig.h configure configure.in pyconfig.h.in Log Message: Patch #497098: build support for GNU/Hurd. Index: acconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/acconfig.h,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** acconfig.h 2001/10/24 17:10:49 1.58 --- acconfig.h 2002/01/01 18:41:32 1.59 *************** *** 20,23 **** --- 20,29 ---- #undef C_THREADS + /* Define if you are using Mach cthreads under mach / */ + #undef MACH_C_THREADS + + /* Define if you are using Mach cthreads directly under /include */ + #undef HURD_C_THREADS + /* Define to `long' if doesn't define. */ #undef clock_t *************** *** 47,50 **** --- 53,59 ---- /* struct addrinfo (netdb.h) */ #undef HAVE_ADDRINFO + + /* Define if you have the getaddrinfo function. */ + #undef HAVE_GETADDRINFO /* struct sockaddr_storage (sys/socket.h) */ Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.279 retrieving revision 1.280 diff -C2 -d -r1.279 -r1.280 *** configure 2001/12/07 15:38:25 1.279 --- configure 2002/01/01 18:41:32 1.280 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.287 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.288 [...2971 lines suppressed...] if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < *************** *** 7543,7547 **** SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 ! echo "configure:7546: checking for build directories" >&5 for dir in $SRCDIRS; do if test ! -d $dir; then --- 7594,7598 ---- SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 ! echo "configure:7597: checking for build directories" >&5 for dir in $SRCDIRS; do if test ! -d $dir; then Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.288 retrieving revision 1.289 diff -C2 -d -r1.288 -r1.289 *** configure.in 2001/12/07 15:38:26 1.288 --- configure.in 2002/01/01 18:41:32 1.289 *************** *** 797,801 **** LDSHARED="$LDSHARED -flat_namespace -undefined suppress" fi ;; ! Linux*) LDSHARED="gcc -shared";; dgux*) LDSHARED="ld -G";; BSD/OS*/4*) LDSHARED="gcc -shared";; --- 797,801 ---- LDSHARED="$LDSHARED -flat_namespace -undefined suppress" fi ;; ! Linux*|GNU*) LDSHARED="gcc -shared";; dgux*) LDSHARED="ld -G";; BSD/OS*/4*) LDSHARED="gcc -shared";; *************** *** 833,837 **** else CCSHARED="+z"; fi;; ! Linux*) CCSHARED="-fPIC";; BSD/OS*/4*) CCSHARED="-fpic";; FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fPIC";; --- 833,837 ---- else CCSHARED="+z"; fi;; ! Linux*|GNU*) CCSHARED="-fPIC";; BSD/OS*/4*) CCSHARED="-fpic";; FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fPIC";; *************** *** 861,865 **** LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";; ! Linux*) LINKFORSHARED="-Xlinker -export-dynamic";; # -u libsys_s pulls in all symbols in libsys Darwin/*) --- 861,865 ---- LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";; ! Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";; # -u libsys_s pulls in all symbols in libsys Darwin/*) *************** *** 1034,1039 **** --- 1034,1045 ---- AC_DEFINE(_REENTRANT) + AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD) + AC_DEFINE(C_THREADS) + AC_DEFINE(HURD_C_THREADS) + LIBS="$LIBS -lthreads" + LIBOBJS="$LIBOBJS thread.o"],[ AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) AC_DEFINE(C_THREADS) + AC_DEFINE(MACH_C_THREADS) LIBOBJS="$LIBOBJS thread.o"],[ AC_MSG_CHECKING(for --with-pth) *************** *** 1089,1093 **** LIBOBJS="$LIBOBJS thread.o"],[ USE_THREAD_MODULE="#"]) ! ])])])])])])])])]) if test "$posix_threads" = "yes"; then --- 1095,1099 ---- LIBOBJS="$LIBOBJS thread.o"],[ USE_THREAD_MODULE="#"]) ! ])])])])])])])])])]) if test "$posix_threads" = "yes"; then Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** pyconfig.h.in 2001/10/24 17:10:49 1.20 --- pyconfig.h.in 2002/01/01 18:41:32 1.21 *************** *** 94,97 **** --- 94,103 ---- #undef C_THREADS + /* Define if you are using Mach cthreads under mach / */ + #undef MACH_C_THREADS + + /* Define if you are using Mach cthreads directly under /include */ + #undef HURD_C_THREADS + /* Define to `long' if doesn't define. */ #undef clock_t *************** *** 122,125 **** --- 128,134 ---- #undef HAVE_ADDRINFO + /* Define if you have the getaddrinfo function. */ + #undef HAVE_GETADDRINFO + /* struct sockaddr_storage (sys/socket.h) */ #undef HAVE_SOCKADDR_STORAGE *************** *** 402,408 **** /* Define if you have the gai_strerror function. */ #undef HAVE_GAI_STRERROR - - /* Define if you have the getaddrinfo function. */ - #undef HAVE_GETADDRINFO /* Define if you have the getcwd function. */ --- 411,414 ---- From nnorwitz@users.sourceforge.net Tue Jan 1 19:07:15 2002 From: nnorwitz@users.sourceforge.net (Neal Norwitz) Date: Tue, 01 Jan 2002 11:07:15 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects fileobject.c,2.141,2.142 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv2511/Objects Modified Files: fileobject.c Log Message: SF Patch #494863, file.xreadlines() should raise ValueError if file is closed This makes xreadlines behave like all other file methods (other than close() which just returns). Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.141 retrieving revision 2.142 diff -C2 -d -r2.141 -r2.142 *** fileobject.c 2001/11/30 14:16:36 2.141 --- fileobject.c 2002/01/01 19:07:13 2.142 *************** *** 1026,1029 **** --- 1026,1031 ---- static PyObject* xreadlines_function = NULL; + if (f->f_fp == NULL) + return err_closed(); if (!xreadlines_function) { PyObject *xreadlines_module = From nnorwitz@users.sourceforge.net Tue Jan 1 19:07:15 2002 From: nnorwitz@users.sourceforge.net (Neal Norwitz) Date: Tue, 01 Jan 2002 11:07:15 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.342,1.343 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv2511/Misc Modified Files: NEWS Log Message: SF Patch #494863, file.xreadlines() should raise ValueError if file is closed This makes xreadlines behave like all other file methods (other than close() which just returns). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.342 retrieving revision 1.343 diff -C2 -d -r1.342 -r1.343 *** NEWS 2002/01/01 18:41:32 1.342 --- NEWS 2002/01/01 19:07:13 1.343 *************** *** 7,10 **** --- 7,14 ---- Core and builtins + - file.xreadlines() now raises a ValueError if the file is closed: + Previously, an xreadlines object was returned which would raise + a ValueError when the xreadlines.next() method was called. + Extension modules From nnorwitz@users.sourceforge.net Tue Jan 1 19:11:15 2002 From: nnorwitz@users.sourceforge.net (Neal Norwitz) Date: Tue, 01 Jan 2002 11:11:15 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_file.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv3187/Lib/test Modified Files: test_file.py Log Message: SF Patch #494867 test file methods Test that the file methods raise ValueError when called on a closed file. Test .isatty() Test name, closed attributes Index: test_file.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_file.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_file.py 2001/11/09 19:34:43 1.5 --- test_file.py 2002/01/01 19:11:13 1.6 *************** *** 61,63 **** --- 61,92 ---- print "no error for invalid mode: %s" % bad_mode + f = open(TESTFN) + if f.name != TESTFN: + raise TestError, 'file.name should be "%s"' % TESTFN + if f.isatty(): + raise TestError, 'file.isatty() should be false' + + if f.closed: + raise TestError, 'file.closed should be false' + + f.close() + if not f.closed: + raise TestError, 'file.closed should be true' + + for methodname in ['fileno', 'flush', 'isatty', 'read', 'readinto', 'readline', 'readlines', 'seek', 'tell', 'truncate', 'write', 'xreadlines' ]: + method = getattr(f, methodname) + try: + method() + except ValueError: + pass + else: + raise TestError, 'file.%s() on a closed file should raise a ValueError' % methodname + + try: + f.writelines([]) + except ValueError: + pass + else: + raise TestError, 'file.writelines([]) on a closed file should raise a ValueError' + os.unlink(TESTFN) From loewis@users.sourceforge.net Tue Jan 1 19:59:13 2002 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 01 Jan 2002 11:59:13 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include opcode.h,2.37,2.38 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv10915/Include Modified Files: opcode.h Log Message: Patch #494783: Rename cmp_op enumerators. Index: opcode.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/opcode.h,v retrieving revision 2.37 retrieving revision 2.38 diff -C2 -d -r2.37 -r2.38 *** opcode.h 2001/08/08 05:00:17 2.37 --- opcode.h 2002/01/01 19:59:10 2.38 *************** *** 143,149 **** #define EXTENDED_ARG 143 ! /* Comparison operator codes (argument to COMPARE_OP) */ ! enum cmp_op {LT=Py_LT, LE=Py_LE, EQ=Py_EQ, NE=Py_NE, GT=Py_GT, GE=Py_GE, ! IN, NOT_IN, IS, IS_NOT, EXC_MATCH, BAD}; #define HAS_ARG(op) ((op) >= HAVE_ARGUMENT) --- 143,149 ---- #define EXTENDED_ARG 143 ! ! enum cmp_op {PyCmp_LT=Py_LT, PyCmp_LE=Py_LE, PyCmp_EQ=Py_EQ, PyCmp_NE=Py_NE, PyCmp_GT=Py_GT, PyCmp_GE=Py_GE, ! PyCmp_IN, PyCmp_NOT_IN, PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD}; #define HAS_ARG(op) ((op) >= HAVE_ARGUMENT) From loewis@users.sourceforge.net Tue Jan 1 19:59:13 2002 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 01 Jan 2002 11:59:13 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc ACKS,1.152,1.153 NEWS,1.343,1.344 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv10915/Misc Modified Files: ACKS NEWS Log Message: Patch #494783: Rename cmp_op enumerators. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.152 retrieving revision 1.153 diff -C2 -d -r1.152 -r1.153 *** ACKS 2002/01/01 18:41:32 1.152 --- ACKS 2002/01/01 19:59:11 1.153 *************** *** 86,89 **** --- 86,90 ---- David Cinege Mike Clarkson + Brad Clements Steve Clift Josh Cogliati Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.343 retrieving revision 1.344 diff -C2 -d -r1.343 -r1.344 *** NEWS 2002/01/01 19:07:13 1.343 --- NEWS 2002/01/01 19:59:11 1.344 *************** *** 25,28 **** --- 25,30 ---- C API + - The enumerators of cmp_op have been renamed to use the prefix PyCmp_. + - An old #define of ANY as void has been removed from pyport.h. This hasn't been used since Python's pre-ANSI days, and the #define has From loewis@users.sourceforge.net Tue Jan 1 19:59:13 2002 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 01 Jan 2002 11:59:13 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.302,2.303 compile.c,2.234,2.235 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv10915/Python Modified Files: ceval.c compile.c Log Message: Patch #494783: Rename cmp_op enumerators. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.302 retrieving revision 2.303 diff -C2 -d -r2.302 -r2.303 *** ceval.c 2001/12/25 18:49:11 2.302 --- ceval.c 2002/01/01 19:59:11 2.303 *************** *** 1786,1797 **** b = PyInt_AS_LONG(w); switch (oparg) { ! case LT: res = a < b; break; ! case LE: res = a <= b; break; ! case EQ: res = a == b; break; ! case NE: res = a != b; break; ! case GT: res = a > b; break; ! case GE: res = a >= b; break; ! case IS: res = v == w; break; ! case IS_NOT: res = v != w; break; default: goto slow_compare; } --- 1786,1797 ---- b = PyInt_AS_LONG(w); switch (oparg) { ! case PyCmp_LT: res = a < b; break; ! case PyCmp_LE: res = a <= b; break; ! case PyCmp_EQ: res = a == b; break; ! case PyCmp_NE: res = a != b; break; ! case PyCmp_GT: res = a > b; break; ! case PyCmp_GE: res = a >= b; break; ! case PyCmp_IS: res = v == w; break; ! case PyCmp_IS_NOT: res = v != w; break; default: goto slow_compare; } *************** *** 2987,2990 **** --- 2987,2994 ---- cf->cf_flags |= compilerflags; } + if (codeflags & CO_GENERATOR_ALLOWED) { + result = 1; + cf->cf_flags |= CO_GENERATOR_ALLOWED; + } } return result; *************** *** 3471,3489 **** int res = 0; switch (op) { ! case IS: ! case IS_NOT: res = (v == w); ! if (op == (int) IS_NOT) res = !res; break; ! case IN: ! case NOT_IN: res = PySequence_Contains(w, v); if (res < 0) return NULL; ! if (op == (int) NOT_IN) res = !res; break; ! case EXC_MATCH: res = PyErr_GivenExceptionMatches(v, w); break; --- 3475,3493 ---- int res = 0; switch (op) { ! case PyCmp_IS: ! case PyCmp_IS_NOT: res = (v == w); ! if (op == (int) PyCmp_IS_NOT) res = !res; break; ! case PyCmp_IN: ! case PyCmp_NOT_IN: res = PySequence_Contains(w, v); if (res < 0) return NULL; ! if (op == (int) PyCmp_NOT_IN) res = !res; break; ! case PyCmp_EXC_MATCH: res = PyErr_GivenExceptionMatches(v, w); break; Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.234 retrieving revision 2.235 diff -C2 -d -r2.234 -r2.235 *** compile.c 2001/12/13 19:51:56 2.234 --- compile.c 2002/01/01 19:59:11 2.235 *************** *** 703,707 **** /*fprintf(stderr, "%3d: %3d\n", c->c_nexti, byte);*/ assert(byte >= 0 && byte <= 255); ! assert(c->c_code); if (com_check_size(&c->c_code, c->c_nexti)) { c->c_errors++; --- 703,707 ---- /*fprintf(stderr, "%3d: %3d\n", c->c_nexti, byte);*/ assert(byte >= 0 && byte <= 255); ! assert(c->c_code != 0); if (com_check_size(&c->c_code, c->c_nexti)) { c->c_errors++; *************** *** 2139,2151 **** n = CHILD(n, 0); switch (TYPE(n)) { ! case LESS: return LT; ! case GREATER: return GT; case EQEQUAL: /* == */ ! case EQUAL: return EQ; ! case LESSEQUAL: return LE; ! case GREATEREQUAL: return GE; ! case NOTEQUAL: return NE; /* <> or != */ ! case NAME: if (strcmp(STR(n), "in") == 0) return IN; ! if (strcmp(STR(n), "is") == 0) return IS; } } --- 2139,2151 ---- n = CHILD(n, 0); switch (TYPE(n)) { ! case LESS: return PyCmp_LT; ! case GREATER: return PyCmp_GT; case EQEQUAL: /* == */ ! case EQUAL: return PyCmp_EQ; ! case LESSEQUAL: return PyCmp_LE; ! case GREATEREQUAL: return PyCmp_GE; ! case NOTEQUAL: return PyCmp_NE; /* <> or != */ ! case NAME: if (strcmp(STR(n), "in") == 0) return PyCmp_IN; ! if (strcmp(STR(n), "is") == 0) return PyCmp_IS; } } *************** *** 2153,2162 **** switch (TYPE(CHILD(n, 0))) { case NAME: if (strcmp(STR(CHILD(n, 1)), "in") == 0) ! return NOT_IN; if (strcmp(STR(CHILD(n, 0)), "is") == 0) ! return IS_NOT; } } ! return BAD; } --- 2153,2162 ---- switch (TYPE(CHILD(n, 0))) { case NAME: if (strcmp(STR(CHILD(n, 1)), "in") == 0) ! return PyCmp_NOT_IN; if (strcmp(STR(CHILD(n, 0)), "is") == 0) ! return PyCmp_IS_NOT; } } ! return PyCmp_BAD; } *************** *** 2215,2219 **** } op = cmp_type(CHILD(n, i-1)); ! if (op == BAD) { com_error(c, PyExc_SystemError, "com_comparison: unknown comparison op"); --- 2215,2219 ---- } op = cmp_type(CHILD(n, i-1)); ! if (op == PyCmp_BAD) { com_error(c, PyExc_SystemError, "com_comparison: unknown comparison op"); *************** *** 3248,3252 **** com_push(c, 1); com_node(c, CHILD(ch, 1)); ! com_addoparg(c, COMPARE_OP, EXC_MATCH); com_pop(c, 1); com_addfwref(c, JUMP_IF_FALSE, &except_anchor); --- 3248,3252 ---- com_push(c, 1); com_node(c, CHILD(ch, 1)); ! com_addoparg(c, COMPARE_OP, PyCmp_EXC_MATCH); com_pop(c, 1); com_addfwref(c, JUMP_IF_FALSE, &except_anchor); From loewis@users.sourceforge.net Tue Jan 1 20:18:32 2002 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 01 Jan 2002 12:18:32 -0800 Subject: [Python-checkins] CVS: python/dist/src setup.py,1.73,1.74 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv15605 Modified Files: setup.py Log Message: Patch #497126: Always compile dl. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** setup.py 2001/12/17 17:24:43 1.73 --- setup.py 2002/01/01 20:18:30 1.74 *************** *** 568,571 **** --- 568,576 ---- libraries = ['expat']) ) + # Dynamic loading module + dl_inc = find_file('dlfcn.h', [], inc_dirs) + if dl_inc is not None: + exts.append( Extension('dl', ['dlmodule.c']) ) + # Platform-specific libraries if platform == 'linux2': From loewis@users.sourceforge.net Tue Jan 1 20:18:32 2002 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 01 Jan 2002 12:18:32 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules dlmodule.c,2.18,2.19 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv15605/Modules Modified Files: dlmodule.c Log Message: Patch #497126: Always compile dl. Index: dlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/dlmodule.c,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -d -r2.18 -r2.19 *** dlmodule.c 2001/12/08 18:02:56 2.18 --- dlmodule.c 2002/01/01 20:18:30 2.19 *************** *** 159,162 **** --- 159,169 ---- int mode; PyUnivPtr *handle; + if (sizeof(int) != sizeof(long) || + sizeof(long) != sizeof(char *)) { + PyErr_SetString(PyExc_SystemError, + "module dl requires sizeof(int) == sizeof(long) == sizeof(char*)"); + return NULL; + } + if (PyArg_Parse(args, "z", &name)) mode = RTLD_LAZY; *************** *** 204,214 **** { PyObject *m, *d, *x; - - if (sizeof(int) != sizeof(long) || - sizeof(long) != sizeof(char *)) { - PyErr_SetString(PyExc_SystemError, - "module dl requires sizeof(int) == sizeof(long) == sizeof(char*)"); - return; - } /* Initialize object type */ --- 211,214 ---- From loewis@users.sourceforge.net Tue Jan 1 20:18:32 2002 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 01 Jan 2002 12:18:32 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc ACKS,1.153,1.154 NEWS,1.344,1.345 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv15605/Misc Modified Files: ACKS NEWS Log Message: Patch #497126: Always compile dl. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.153 retrieving revision 1.154 diff -C2 -d -r1.153 -r1.154 *** ACKS 2002/01/01 19:59:11 1.153 --- ACKS 2002/01/01 20:18:30 1.154 *************** *** 313,316 **** --- 313,317 ---- Max Neunhöffer George Neville-Neil + Gustavo Niemeyer Oscar Nierstrasz Hrvoje Niksic Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.344 retrieving revision 1.345 diff -C2 -d -r1.344 -r1.345 *** NEWS 2002/01/01 19:59:11 1.344 --- NEWS 2002/01/01 20:18:30 1.345 *************** *** 13,16 **** --- 13,20 ---- Extension modules + - dl is now build on every system that has dlfcn.h. Failure in case + of sizeof(int)!=sizeof(long)!=sizeof(void*) is delayed until dl.open + is called. + Library From nnorwitz@users.sourceforge.net Tue Jan 1 21:14:14 2002 From: nnorwitz@users.sourceforge.net (Neal Norwitz) Date: Tue, 01 Jan 2002 13:14:14 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.345,1.346 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv25641/Misc Modified Files: NEWS Log Message: Improve grammar Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.345 retrieving revision 1.346 diff -C2 -d -r1.345 -r1.346 *** NEWS 2002/01/01 20:18:30 1.345 --- NEWS 2002/01/01 21:14:12 1.346 *************** *** 13,17 **** Extension modules ! - dl is now build on every system that has dlfcn.h. Failure in case of sizeof(int)!=sizeof(long)!=sizeof(void*) is delayed until dl.open is called. --- 13,17 ---- Extension modules ! - dl now builds on every system that has dlfcn.h. Failure in case of sizeof(int)!=sizeof(long)!=sizeof(void*) is delayed until dl.open is called. From jackjansen@users.sourceforge.net Tue Jan 1 22:39:09 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 01 Jan 2002 14:39:09 -0800 Subject: [Python-checkins] CVS: python/dist/src/Tools/bgen/bgen bgenlocations.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory usw-pr-cvs1:/tmp/cvs-serv9103/Python/Tools/bgen/bgen Modified Files: bgenlocations.py Log Message: Updated to current pathnames. Index: bgenlocations.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenlocations.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** bgenlocations.py 2000/06/28 20:53:33 1.4 --- bgenlocations.py 2002/01/01 22:39:07 1.5 *************** *** 2,12 **** # Local customizations # ! # Where to find the Universal Header include files: ! MWERKSDIR="Macintosh HD:SWDev:Codewarrior Pro 5:Metrowerks CodeWarrior:" INCLUDEDIR=MWERKSDIR + "MacOS Support:Universal:Interfaces:CIncludes:" # Where to put the python definitions file: ! TOOLBOXDIR="Macintosh HD:SWDev:Jack:Python:Mac:Lib:lib-toolbox:" # Creator for C files: --- 2,12 ---- # Local customizations # ! import sys, os # Where to find the Universal Header include files: ! MWERKSDIR="Moes:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior:" INCLUDEDIR=MWERKSDIR + "MacOS Support:Universal:Interfaces:CIncludes:" # Where to put the python definitions file: ! TOOLBOXDIR=os.path.join(sys.prefix, ":Mac:Lib:Carbon:") # Creator for C files: From jackjansen@users.sourceforge.net Tue Jan 1 22:40:04 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 01 Jan 2002 14:40:04 -0800 Subject: [Python-checkins] CVS: python/dist/src/Tools/bgen/bgen bgenType.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory usw-pr-cvs1:/tmp/cvs-serv9307/Python/Tools/bgen/bgen Modified Files: bgenType.py Log Message: Added some support for Uicode arguments. Still leaves something to be desired, especially because of poor unicode support in PyArg_ParseTuple. Index: bgenType.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenType.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** bgenType.py 2000/07/06 15:17:52 1.6 --- bgenType.py 2002/01/01 22:40:02 1.7 *************** *** 150,153 **** --- 150,154 ---- # see the module bgenBuffer. stringptr = InputOnlyType("char*", "s") + unicodestringptr = InputOnlyType("wchar_t *", "u") From jackjansen@users.sourceforge.net Tue Jan 1 22:40:10 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 01 Jan 2002 14:40:10 -0800 Subject: [Python-checkins] CVS: python/dist/src/Tools/bgen/bgen bgenBuffer.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory usw-pr-cvs1:/tmp/cvs-serv9346/Python/Tools/bgen/bgen Modified Files: bgenBuffer.py Log Message: Added some support for Uicode arguments. Still leaves something to be desired, especially because of poor unicode support in PyArg_ParseTuple. Index: bgenBuffer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenBuffer.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** bgenBuffer.py 2001/09/05 10:27:48 1.6 --- bgenBuffer.py 2002/01/01 22:40:08 1.7 *************** *** 160,164 **** def passInput(self, name): return "%s__in__, %s__len__" % (name, name) ! class OptionalVarInputBufferType(OptionalInputBufferMixIn, VarInputBufferType): pass --- 160,170 ---- def passInput(self, name): return "%s__in__, %s__len__" % (name, name) ! ! class ReverseInputBufferMixin: ! """ Mixin for input buffers that are passed as (size, buffer) """ ! ! def passInput(self, name): ! return "%s__len__, %s__in__" % (name, name) ! class OptionalVarInputBufferType(OptionalInputBufferMixIn, VarInputBufferType): pass From jackjansen@users.sourceforge.net Tue Jan 1 22:40:00 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 01 Jan 2002 14:40:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Tools/bgen/bgen macsupport.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory usw-pr-cvs1:/tmp/cvs-serv9253/Python/Tools/bgen/bgen Modified Files: macsupport.py Log Message: Added some support for Uicode arguments. Still leaves something to be desired, especially because of poor unicode support in PyArg_ParseTuple. Index: macsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/macsupport.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** macsupport.py 2001/12/18 15:48:28 1.25 --- macsupport.py 2002/01/01 22:39:58 1.26 *************** *** 48,51 **** --- 48,53 ---- FSSpec_ptr = OpaqueType("FSSpec", "PyMac_BuildFSSpec", "PyMac_GetFSSpec") FSSpec = OpaqueByValueType("FSSpec", "PyMac_BuildFSSpec", "PyMac_GetFSSpec") + FSRef_ptr = OpaqueType("FSRef", "PyMac_BuildFSRef", "PyMac_GetFSRef") + FSRef = OpaqueByValueType("FSRef", "PyMac_BuildFSRef", "PyMac_GetFSRef") # OSType and ResType: 4-byte character strings *************** *** 111,114 **** --- 113,129 ---- VarOutBuffer = VarHeapOutputBufferType('char', 'long', 'l') # (buf, &len) VarVarOutBuffer = VarVarHeapOutputBufferType('char', 'long', 'l') # (buf, len, &len) + + # Unicode arguments sometimes have reversed len, buffer (don't understand why Apple did this...) + class VarUnicodeInputBufferType(VarInputBufferType): + + def getargsFormat(self): + return "u#" + + class VarUnicodeReverseInputBufferType(ReverseInputBufferMixin, VarUnicodeInputBufferType): + pass + + UnicodeInBuffer = VarUnicodeInputBufferType('UniChar', 'UniCharCount', 'l') + UnicodeReverseInBuffer = VarUnicodeReverseInputBufferType('UniChar', 'UniCharCount', 'l') + UniChar_ptr = InputOnlyType("UniCharPtr", "u") From jackjansen@users.sourceforge.net Tue Jan 1 22:42:21 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 01 Jan 2002 14:42:21 -0800 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/mlte _Mltemodule.c,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/mlte In directory usw-pr-cvs1:/tmp/cvs-serv10145/Python/Mac/Modules/mlte Modified Files: _Mltemodule.c Log Message: Added some support for unicode arguments. Index: _Mltemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/mlte/_Mltemodule.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** _Mltemodule.c 2001/12/18 15:37:09 1.8 --- _Mltemodule.c 2002/01/01 22:42:19 1.9 *************** *** 1007,1010 **** --- 1007,1035 ---- } + static PyObject *TXNObj_TXNEchoMode(TXNObjectObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OSStatus _err; + UniChar iEchoCharacter; + TextEncoding iEncoding; + Boolean iOn; + #ifndef TXNEchoMode + PyMac_PRECHECK(TXNEchoMode); + #endif + if (!PyArg_ParseTuple(_args, "hlb", + &iEchoCharacter, + &iEncoding, + &iOn)) + return NULL; + _err = TXNEchoMode(_self->ob_itself, + iEchoCharacter, + iEncoding, + iOn); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; + } + static PyObject *TXNObj_TXNDoFontMenuSelection(TXNObjectObject *_self, PyObject *_args) { *************** *** 1252,1255 **** --- 1277,1282 ---- {"TXNActivate", (PyCFunction)TXNObj_TXNActivate, 1, "(TXNFrameID iTXNFrameID, TXNScrollBarState iActiveState) -> None"}, + {"TXNEchoMode", (PyCFunction)TXNObj_TXNEchoMode, 1, + "(UniChar iEchoCharacter, TextEncoding iEncoding, Boolean iOn) -> None"}, {"TXNDoFontMenuSelection", (PyCFunction)TXNObj_TXNDoFontMenuSelection, 1, "(TXNFontMenuObject iTXNFontMenuObject, SInt16 iMenuID, SInt16 iMenuItem) -> None"}, From jackjansen@users.sourceforge.net Tue Jan 1 22:42:26 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 01 Jan 2002 14:42:26 -0800 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/mlte mltesupport.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/mlte In directory usw-pr-cvs1:/tmp/cvs-serv10169/Python/Mac/Modules/mlte Modified Files: mltesupport.py Log Message: Added some support for unicode arguments. Index: mltesupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/mlte/mltesupport.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** mltesupport.py 2001/12/18 15:39:33 1.7 --- mltesupport.py 2002/01/01 22:42:23 1.8 *************** *** 130,133 **** --- 130,135 ---- OptFSSpecPtr = OpaqueByValueType("FSSpec *", "OptFSSpecPtr") OptRectPtr = OpaqueByValueType("Rect *", "OptRectPtr") + + UniChar = Type("UniChar", "h") # XXXX For now... # ADD object type here From jackjansen@users.sourceforge.net Tue Jan 1 22:42:37 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 01 Jan 2002 14:42:37 -0800 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/mlte mltescan.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/mlte In directory usw-pr-cvs1:/tmp/cvs-serv10204/Python/Mac/Modules/mlte Modified Files: mltescan.py Log Message: Added some support for unicode arguments. Index: mltescan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/mlte/mltescan.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mltescan.py 2001/12/18 15:39:09 1.6 --- mltescan.py 2002/01/01 22:42:34 1.7 *************** *** 94,100 **** "TXNMatchTextRecord", #TBD "TXNBackground", #TBD - "UniChar", #TBD - "UniCharCount", #TBD - "UniChar_ptr", #TBD "TXNFindUPP", "ATSUStyle", #TBD --- 94,97 ---- From jackjansen@users.sourceforge.net Tue Jan 1 22:42:49 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 01 Jan 2002 14:42:49 -0800 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/cf _CFmodule.c,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cf In directory usw-pr-cvs1:/tmp/cvs-serv10230/Python/Mac/Modules/cf Modified Files: _CFmodule.c Log Message: Added some support for unicode arguments. Index: _CFmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/_CFmodule.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** _CFmodule.c 2001/12/18 15:38:34 1.9 --- _CFmodule.c 2002/01/01 22:42:47 1.10 *************** *** 2047,2050 **** --- 2047,2070 ---- } + static PyObject *CFMutableStringRefObj_CFStringAppendCharacters(CFMutableStringRefObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + UniChar *chars__in__; + UniCharCount chars__len__; + int chars__in_len__; + #ifndef CFStringAppendCharacters + PyMac_PRECHECK(CFStringAppendCharacters); + #endif + if (!PyArg_ParseTuple(_args, "u#", + &chars__in__, &chars__in_len__)) + return NULL; + chars__len__ = chars__in_len__; + CFStringAppendCharacters(_self->ob_itself, + chars__in__, chars__len__); + Py_INCREF(Py_None); + _res = Py_None; + return _res; + } + static PyObject *CFMutableStringRefObj_CFStringAppendPascalString(CFMutableStringRefObject *_self, PyObject *_args) { *************** *** 2218,2221 **** --- 2238,2243 ---- {"CFStringAppend", (PyCFunction)CFMutableStringRefObj_CFStringAppend, 1, "(CFStringRef appendedString) -> None"}, + {"CFStringAppendCharacters", (PyCFunction)CFMutableStringRefObj_CFStringAppendCharacters, 1, + "(Buffer chars) -> None"}, {"CFStringAppendPascalString", (PyCFunction)CFMutableStringRefObj_CFStringAppendPascalString, 1, "(Str255 pStr, CFStringEncoding encoding) -> None"}, *************** *** 3222,3225 **** --- 3244,3268 ---- } + static PyObject *CF_CFStringCreateWithCharacters(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + CFStringRef _rv; + UniChar *chars__in__; + UniCharCount chars__len__; + int chars__in_len__; + #ifndef CFStringCreateWithCharacters + PyMac_PRECHECK(CFStringCreateWithCharacters); + #endif + if (!PyArg_ParseTuple(_args, "u#", + &chars__in__, &chars__in_len__)) + return NULL; + chars__len__ = chars__in_len__; + _rv = CFStringCreateWithCharacters((CFAllocatorRef)NULL, + chars__in__, chars__len__); + _res = Py_BuildValue("O&", + CFStringRefObj_New, _rv); + return _res; + } + static PyObject *CF_CFStringCreateWithPascalStringNoCopy(PyObject *_self, PyObject *_args) { *************** *** 3266,3269 **** --- 3309,3334 ---- } + static PyObject *CF_CFStringCreateWithCharactersNoCopy(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + CFStringRef _rv; + UniChar *chars__in__; + UniCharCount chars__len__; + int chars__in_len__; + #ifndef CFStringCreateWithCharactersNoCopy + PyMac_PRECHECK(CFStringCreateWithCharactersNoCopy); + #endif + if (!PyArg_ParseTuple(_args, "u#", + &chars__in__, &chars__in_len__)) + return NULL; + chars__len__ = chars__in_len__; + _rv = CFStringCreateWithCharactersNoCopy((CFAllocatorRef)NULL, + chars__in__, chars__len__, + (CFAllocatorRef)NULL); + _res = Py_BuildValue("O&", + CFStringRefObj_New, _rv); + return _res; + } + static PyObject *CF_CFStringCreateMutable(PyObject *_self, PyObject *_args) { *************** *** 3668,3675 **** --- 3733,3744 ---- {"CFStringCreateWithCString", (PyCFunction)CF_CFStringCreateWithCString, 1, "(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)"}, + {"CFStringCreateWithCharacters", (PyCFunction)CF_CFStringCreateWithCharacters, 1, + "(Buffer chars) -> (CFStringRef _rv)"}, {"CFStringCreateWithPascalStringNoCopy", (PyCFunction)CF_CFStringCreateWithPascalStringNoCopy, 1, "(Str255 pStr, CFStringEncoding encoding) -> (CFStringRef _rv)"}, {"CFStringCreateWithCStringNoCopy", (PyCFunction)CF_CFStringCreateWithCStringNoCopy, 1, "(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)"}, + {"CFStringCreateWithCharactersNoCopy", (PyCFunction)CF_CFStringCreateWithCharactersNoCopy, 1, + "(Buffer chars) -> (CFStringRef _rv)"}, {"CFStringCreateMutable", (PyCFunction)CF_CFStringCreateMutable, 1, "(CFIndex maxLength) -> (CFMutableStringRef _rv)"}, From jackjansen@users.sourceforge.net Tue Jan 1 22:42:53 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 01 Jan 2002 14:42:53 -0800 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/cf cfscan.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cf In directory usw-pr-cvs1:/tmp/cvs-serv10268/Python/Mac/Modules/cf Modified Files: cfscan.py Log Message: Added some support for unicode arguments. Index: cfscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/cfscan.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** cfscan.py 2001/07/17 20:47:08 1.5 --- cfscan.py 2002/01/01 22:42:51 1.6 *************** *** 93,96 **** --- 93,99 ---- "CFStringGetCharacters", "CFURLCreateStringWithFileSystemPath", # Gone in later releases + "CFStringCreateMutableWithExternalCharactersNoCopy", # Not a clue... + "CFStringSetExternalCharactersNoCopy", + "CFStringGetCharacterAtIndex", # No format for single unichars yet. ] *************** *** 106,112 **** "CFArrayApplierFunction", # Callback function pointer "CFDictionaryApplierFunction", # Callback function pointer - "UniChar_ptr", # XXXX To be done - "const_UniChar_ptr", # XXXX To be done - "UniChar", # XXXX To be done "va_list", # For printf-to-a-cfstring. Use Python. "const_CFStringEncoding_ptr", # To be done, I guess --- 109,112 ---- *************** *** 119,122 **** --- 119,125 ---- [("UcharInBuffer", "*", "*")]), + ([("UniChar_ptr", "*", "InMode"), ("CFIndex", "*", "InMode")], + [("UnicodeInBuffer", "*", "*")]), + # Some functions return a const char *. Don't worry, we won't modify it. ([("const_char_ptr", "*", "ReturnMode")], From jackjansen@users.sourceforge.net Tue Jan 1 22:42:57 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 01 Jan 2002 14:42:57 -0800 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/res resscan.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/res In directory usw-pr-cvs1:/tmp/cvs-serv10317/Python/Mac/Modules/res Modified Files: resscan.py Log Message: Added some support for unicode arguments. Index: resscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/resscan.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** resscan.py 2001/12/18 15:35:52 1.14 --- resscan.py 2002/01/01 22:42:55 1.15 *************** *** 49,53 **** def makeblacklisttypes(self): return [ - "UniCharCount", #TBD ] --- 49,52 ---- *************** *** 87,91 **** ([("SInt8", "*", "*")], ! [("SignedByte", "*", "*")]) ] --- 86,94 ---- ([("SInt8", "*", "*")], ! [("SignedByte", "*", "*")]), ! ! ! ([("UniCharCount", "*", "InMode"), ("UniChar_ptr", "*", "InMode")], ! [("UnicodeReverseInBuffer", "*", "*")]), ] From jackjansen@users.sourceforge.net Tue Jan 1 22:43:05 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 01 Jan 2002 14:43:05 -0800 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/res _Resmodule.c,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/res In directory usw-pr-cvs1:/tmp/cvs-serv10344/Python/Mac/Modules/res Modified Files: _Resmodule.c Log Message: Added some support for unicode arguments. Index: _Resmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/_Resmodule.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** _Resmodule.c 2001/12/18 15:35:48 1.7 --- _Resmodule.c 2002/01/01 22:43:03 1.8 *************** *** 1383,1386 **** --- 1383,1416 ---- } + static PyObject *Res_FSCreateResFile(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + FSRef parentRef; + UniChar *nameLength__in__; + UniCharCount nameLength__len__; + int nameLength__in_len__; + FSRef newRef; + FSSpec newSpec; + if (!PyArg_ParseTuple(_args, "O&u#", + PyMac_GetFSRef, &parentRef, + &nameLength__in__, &nameLength__in_len__)) + return NULL; + nameLength__len__ = nameLength__in_len__; + FSCreateResFile(&parentRef, + nameLength__len__, nameLength__in__, + 0, + (FSCatalogInfo *)0, + &newRef, + &newSpec); + { + OSErr _err = ResError(); + if (_err != noErr) return PyMac_Error(_err); + } + _res = Py_BuildValue("O&O&", + PyMac_BuildFSRef, newRef, + PyMac_BuildFSSpec, newSpec); + return _res; + } + static PyObject *Res_FSResourceFileAlreadyOpen(PyObject *_self, PyObject *_args) { *************** *** 1407,1410 **** --- 1437,1508 ---- } + static PyObject *Res_FSCreateResourceFile(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OSErr _rv; + FSRef parentRef; + UniChar *nameLength__in__; + UniCharCount nameLength__len__; + int nameLength__in_len__; + UniChar *forkNameLength__in__; + UniCharCount forkNameLength__len__; + int forkNameLength__in_len__; + FSRef newRef; + FSSpec newSpec; + if (!PyArg_ParseTuple(_args, "O&u#u#", + PyMac_GetFSRef, &parentRef, + &nameLength__in__, &nameLength__in_len__, + &forkNameLength__in__, &forkNameLength__in_len__)) + return NULL; + nameLength__len__ = nameLength__in_len__; + forkNameLength__len__ = forkNameLength__in_len__; + _rv = FSCreateResourceFile(&parentRef, + nameLength__len__, nameLength__in__, + 0, + (FSCatalogInfo *)0, + forkNameLength__len__, forkNameLength__in__, + &newRef, + &newSpec); + { + OSErr _err = ResError(); + if (_err != noErr) return PyMac_Error(_err); + } + _res = Py_BuildValue("hO&O&", + _rv, + PyMac_BuildFSRef, newRef, + PyMac_BuildFSSpec, newSpec); + return _res; + } + + static PyObject *Res_FSOpenResourceFile(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OSErr _rv; + FSRef ref; + UniChar *forkNameLength__in__; + UniCharCount forkNameLength__len__; + int forkNameLength__in_len__; + SignedByte permissions; + SInt16 refNum; + if (!PyArg_ParseTuple(_args, "O&u#b", + PyMac_GetFSRef, &ref, + &forkNameLength__in__, &forkNameLength__in_len__, + &permissions)) + return NULL; + forkNameLength__len__ = forkNameLength__in_len__; + _rv = FSOpenResourceFile(&ref, + forkNameLength__len__, forkNameLength__in__, + permissions, + &refNum); + { + OSErr _err = ResError(); + if (_err != noErr) return PyMac_Error(_err); + } + _res = Py_BuildValue("hh", + _rv, + refNum); + return _res; + } + static PyObject *Res_Resource(PyObject *_self, PyObject *_args) { *************** *** 1570,1575 **** --- 1668,1679 ---- {"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1, "(FSRef ref, SignedByte permission) -> (short _rv)"}, + {"FSCreateResFile", (PyCFunction)Res_FSCreateResFile, 1, + "(FSRef parentRef, Buffer nameLength) -> (FSRef newRef, FSSpec newSpec)"}, {"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1, "(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)"}, + {"FSCreateResourceFile", (PyCFunction)Res_FSCreateResourceFile, 1, + "(FSRef parentRef, Buffer nameLength, Buffer forkNameLength) -> (OSErr _rv, FSRef newRef, FSSpec newSpec)"}, + {"FSOpenResourceFile", (PyCFunction)Res_FSOpenResourceFile, 1, + "(FSRef ref, Buffer forkNameLength, SignedByte permissions) -> (OSErr _rv, SInt16 refNum)"}, {"Resource", (PyCFunction)Res_Resource, 1, "Convert a string to a resource object.\n\nThe created resource object is actually just a handle,\napply AddResource() to write it to a resource file.\nSee also the Handle() docstring.\n"}, From jackjansen@users.sourceforge.net Tue Jan 1 22:43:10 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 01 Jan 2002 14:43:10 -0800 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/res ressupport.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/res In directory usw-pr-cvs1:/tmp/cvs-serv10384/Python/Mac/Modules/res Modified Files: ressupport.py Log Message: Added some support for unicode arguments. Index: ressupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/ressupport.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ressupport.py 2001/12/18 15:35:57 1.18 --- ressupport.py 2002/01/01 22:43:07 1.19 *************** *** 6,11 **** from macsupport import * - FSRef_ptr = OpaqueType("FSRef", "PyMac_BuildFSRef", "PyMac_GetFSRef") - class ResMixIn: --- 6,9 ---- *************** *** 21,24 **** --- 19,24 ---- RsrcChainLocation = Type("RsrcChainLocation", "h") + FSCatalogInfoBitmap = FakeType("0") # Type("FSCatalogInfoBitmap", "l") + FSCatalogInfo_ptr = FakeType("(FSCatalogInfo *)0") # includestuff etc. are imported from macsupport From jackjansen@users.sourceforge.net Tue Jan 1 22:43:16 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 01 Jan 2002 14:43:16 -0800 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/cf cfsupport.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cf In directory usw-pr-cvs1:/tmp/cvs-serv10406/Python/Mac/Modules/cf Modified Files: cfsupport.py Log Message: Added some support for unicode arguments. Index: cfsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/cfsupport.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** cfsupport.py 2001/12/16 20:18:18 1.13 --- cfsupport.py 2002/01/01 22:43:13 1.14 *************** *** 172,177 **** CFComparisonResult = Type("CFComparisonResult", "l") # a bit dangerous, it's an enum CFURLPathStyle = Type("CFURLPathStyle", "l") # a bit dangerous, it's an enum - FSRef_ptr = OpaqueType("FSRef", "PyMac_BuildFSRef", "PyMac_GetFSRef") - FSRef = OpaqueByValueType("FSRef", "PyMac_BuildFSRef", "PyMac_GetFSRef") char_ptr = stringptr --- 172,175 ---- From jvr@users.sourceforge.net Wed Jan 2 14:48:38 2002 From: jvr@users.sourceforge.net (Just van Rossum) Date: Wed, 02 Jan 2002 06:48:38 -0800 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/menu _Menumodule.c,1.7,1.8 menuedit.py,1.8,1.9 menusupport.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/menu In directory usw-pr-cvs1:/tmp/cvs-serv19249 Modified Files: _Menumodule.c menuedit.py menusupport.py Log Message: - Added support for optional MenuObj arguments - Added a bunch of calls as functions with an optional MenuObj first argument. The same calls already exist as methods, but then the first arg isn't optional... The method versions could go as far as I'm concerned. Jack? Index: _Menumodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/_Menumodule.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** _Menumodule.c 2001/12/18 15:37:18 1.7 --- _Menumodule.c 2002/01/02 14:48:36 1.8 *************** *** 51,54 **** --- 51,76 ---- #define as_Resource(h) ((Handle)h) + + /* Alternative version of ResObj_New, which returns None for null argument */ + PyObject *OptMenuObj_New(MenuRef itself) + { + if (itself == NULL) { + Py_INCREF(Py_None); + return Py_None; + } + return MenuObj_New(itself); + } + + int OptMenuObj_Convert(PyObject *v, MenuRef *p_itself) + { + PyObject *tmp; + + if ( v == Py_None ) { + *p_itself = NULL; + return 1; + } + return MenuObj_Convert(v, p_itself); + } + static PyObject *Menu_Error; *************** *** 3679,3682 **** --- 3701,3941 ---- } + #if TARGET_API_MAC_CARBON + + static PyObject *Menu_CountMenuItemsWithCommandID(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + ItemCount _rv; + MenuHandle inMenu; + MenuCommand inCommandID; + #ifndef CountMenuItemsWithCommandID + PyMac_PRECHECK(CountMenuItemsWithCommandID); + #endif + if (!PyArg_ParseTuple(_args, "O&l", + OptMenuObj_Convert, &inMenu, + &inCommandID)) + return NULL; + _rv = CountMenuItemsWithCommandID(inMenu, + inCommandID); + _res = Py_BuildValue("l", + _rv); + return _res; + } + #endif + + #if TARGET_API_MAC_CARBON + + static PyObject *Menu_GetIndMenuItemWithCommandID(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OSStatus _err; + MenuHandle inMenu; + MenuCommand inCommandID; + UInt32 inItemIndex; + MenuHandle outMenu; + MenuItemIndex outIndex; + #ifndef GetIndMenuItemWithCommandID + PyMac_PRECHECK(GetIndMenuItemWithCommandID); + #endif + if (!PyArg_ParseTuple(_args, "O&ll", + OptMenuObj_Convert, &inMenu, + &inCommandID, + &inItemIndex)) + return NULL; + _err = GetIndMenuItemWithCommandID(inMenu, + inCommandID, + inItemIndex, + &outMenu, + &outIndex); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&h", + MenuObj_New, outMenu, + outIndex); + return _res; + } + #endif + + #if TARGET_API_MAC_CARBON + + static PyObject *Menu_EnableMenuCommand(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + MenuHandle inMenu; + MenuCommand inCommandID; + #ifndef EnableMenuCommand + PyMac_PRECHECK(EnableMenuCommand); + #endif + if (!PyArg_ParseTuple(_args, "O&l", + OptMenuObj_Convert, &inMenu, + &inCommandID)) + return NULL; + EnableMenuCommand(inMenu, + inCommandID); + Py_INCREF(Py_None); + _res = Py_None; + return _res; + } + #endif + + #if TARGET_API_MAC_CARBON + + static PyObject *Menu_DisableMenuCommand(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + MenuHandle inMenu; + MenuCommand inCommandID; + #ifndef DisableMenuCommand + PyMac_PRECHECK(DisableMenuCommand); + #endif + if (!PyArg_ParseTuple(_args, "O&l", + OptMenuObj_Convert, &inMenu, + &inCommandID)) + return NULL; + DisableMenuCommand(inMenu, + inCommandID); + Py_INCREF(Py_None); + _res = Py_None; + return _res; + } + #endif + + #if TARGET_API_MAC_CARBON + + static PyObject *Menu_IsMenuCommandEnabled(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + Boolean _rv; + MenuHandle inMenu; + MenuCommand inCommandID; + #ifndef IsMenuCommandEnabled + PyMac_PRECHECK(IsMenuCommandEnabled); + #endif + if (!PyArg_ParseTuple(_args, "O&l", + OptMenuObj_Convert, &inMenu, + &inCommandID)) + return NULL; + _rv = IsMenuCommandEnabled(inMenu, + inCommandID); + _res = Py_BuildValue("b", + _rv); + return _res; + } + #endif + + #if TARGET_API_MAC_CARBON + + static PyObject *Menu_SetMenuCommandMark(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OSStatus _err; + MenuHandle inMenu; + MenuCommand inCommandID; + UniChar inMark; + #ifndef SetMenuCommandMark + PyMac_PRECHECK(SetMenuCommandMark); + #endif + if (!PyArg_ParseTuple(_args, "O&lh", + OptMenuObj_Convert, &inMenu, + &inCommandID, + &inMark)) + return NULL; + _err = SetMenuCommandMark(inMenu, + inCommandID, + inMark); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; + } + #endif + + #if TARGET_API_MAC_CARBON + + static PyObject *Menu_GetMenuCommandMark(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OSStatus _err; + MenuHandle inMenu; + MenuCommand inCommandID; + UniChar outMark; + #ifndef GetMenuCommandMark + PyMac_PRECHECK(GetMenuCommandMark); + #endif + if (!PyArg_ParseTuple(_args, "O&l", + OptMenuObj_Convert, &inMenu, + &inCommandID)) + return NULL; + _err = GetMenuCommandMark(inMenu, + inCommandID, + &outMark); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("h", + outMark); + return _res; + } + #endif + + #if TARGET_API_MAC_CARBON + + static PyObject *Menu_GetMenuCommandPropertySize(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OSStatus _err; + MenuHandle inMenu; + MenuCommand inCommandID; + OSType inPropertyCreator; + OSType inPropertyTag; + ByteCount outSize; + #ifndef GetMenuCommandPropertySize + PyMac_PRECHECK(GetMenuCommandPropertySize); + #endif + if (!PyArg_ParseTuple(_args, "O&lO&O&", + OptMenuObj_Convert, &inMenu, + &inCommandID, + PyMac_GetOSType, &inPropertyCreator, + PyMac_GetOSType, &inPropertyTag)) + return NULL; + _err = GetMenuCommandPropertySize(inMenu, + inCommandID, + inPropertyCreator, + inPropertyTag, + &outSize); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("l", + outSize); + return _res; + } + #endif + + #if TARGET_API_MAC_CARBON + + static PyObject *Menu_RemoveMenuCommandProperty(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OSStatus _err; + MenuHandle inMenu; + MenuCommand inCommandID; + OSType inPropertyCreator; + OSType inPropertyTag; + #ifndef RemoveMenuCommandProperty + PyMac_PRECHECK(RemoveMenuCommandProperty); + #endif + if (!PyArg_ParseTuple(_args, "O&lO&O&", + OptMenuObj_Convert, &inMenu, + &inCommandID, + PyMac_GetOSType, &inPropertyCreator, + PyMac_GetOSType, &inPropertyTag)) + return NULL; + _err = RemoveMenuCommandProperty(inMenu, + inCommandID, + inPropertyCreator, + inPropertyTag); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; + } + #endif + static PyMethodDef Menu_methods[] = { *************** *** 3788,3791 **** --- 4047,4095 ---- {"DrawMenuBar", (PyCFunction)Menu_DrawMenuBar, 1, "() -> None"}, + + #if TARGET_API_MAC_CARBON + {"CountMenuItemsWithCommandID", (PyCFunction)Menu_CountMenuItemsWithCommandID, 1, + "(MenuHandle inMenu, MenuCommand inCommandID) -> (ItemCount _rv)"}, + #endif + + #if TARGET_API_MAC_CARBON + {"GetIndMenuItemWithCommandID", (PyCFunction)Menu_GetIndMenuItemWithCommandID, 1, + "(MenuHandle inMenu, MenuCommand inCommandID, UInt32 inItemIndex) -> (MenuHandle outMenu, MenuItemIndex outIndex)"}, + #endif + + #if TARGET_API_MAC_CARBON + {"EnableMenuCommand", (PyCFunction)Menu_EnableMenuCommand, 1, + "(MenuHandle inMenu, MenuCommand inCommandID) -> None"}, + #endif + + #if TARGET_API_MAC_CARBON + {"DisableMenuCommand", (PyCFunction)Menu_DisableMenuCommand, 1, + "(MenuHandle inMenu, MenuCommand inCommandID) -> None"}, + #endif + + #if TARGET_API_MAC_CARBON + {"IsMenuCommandEnabled", (PyCFunction)Menu_IsMenuCommandEnabled, 1, + "(MenuHandle inMenu, MenuCommand inCommandID) -> (Boolean _rv)"}, + #endif + + #if TARGET_API_MAC_CARBON + {"SetMenuCommandMark", (PyCFunction)Menu_SetMenuCommandMark, 1, + "(MenuHandle inMenu, MenuCommand inCommandID, UniChar inMark) -> None"}, + #endif + + #if TARGET_API_MAC_CARBON + {"GetMenuCommandMark", (PyCFunction)Menu_GetMenuCommandMark, 1, + "(MenuHandle inMenu, MenuCommand inCommandID) -> (UniChar outMark)"}, + #endif + + #if TARGET_API_MAC_CARBON + {"GetMenuCommandPropertySize", (PyCFunction)Menu_GetMenuCommandPropertySize, 1, + "(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> (ByteCount outSize)"}, + #endif + + #if TARGET_API_MAC_CARBON + {"RemoveMenuCommandProperty", (PyCFunction)Menu_RemoveMenuCommandProperty, 1, + "(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> None"}, + #endif {NULL, NULL, 0} }; Index: menuedit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/menuedit.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** menuedit.py 2001/01/29 13:32:10 1.8 --- menuedit.py 2002/01/02 14:48:36 1.9 *************** *** 60,61 **** --- 60,139 ---- functions.append(f) + + # + # The following functions take an *optional* MenuRef as their first argument + # + + f = Function(ItemCount, 'CountMenuItemsWithCommandID', + (OptMenuRef, 'inMenu', InMode), + (MenuCommand, 'inCommandID', InMode), + condition='#if TARGET_API_MAC_CARBON', + ) + functions.append(f) + + f = Function(OSStatus, 'GetIndMenuItemWithCommandID', + (OptMenuRef, 'inMenu', InMode), + (MenuCommand, 'inCommandID', InMode), + (UInt32, 'inItemIndex', InMode), + (MenuRef, 'outMenu', OutMode), + (MenuItemIndex, 'outIndex', OutMode), + condition='#if TARGET_API_MAC_CARBON', + ) + functions.append(f) + + f = Function(void, 'EnableMenuCommand', + (OptMenuRef, 'inMenu', InMode), + (MenuCommand, 'inCommandID', InMode), + condition='#if TARGET_API_MAC_CARBON', + ) + functions.append(f) + + f = Function(void, 'DisableMenuCommand', + (OptMenuRef, 'inMenu', InMode), + (MenuCommand, 'inCommandID', InMode), + condition='#if TARGET_API_MAC_CARBON', + ) + functions.append(f) + + f = Function(Boolean, 'IsMenuCommandEnabled', + (OptMenuRef, 'inMenu', InMode), + (MenuCommand, 'inCommandID', InMode), + condition='#if TARGET_API_MAC_CARBON', + ) + functions.append(f) + + f = Function(OSStatus, 'SetMenuCommandMark', + (OptMenuRef, 'inMenu', InMode), + (MenuCommand, 'inCommandID', InMode), + (UniChar, 'inMark', InMode), + condition='#if TARGET_API_MAC_CARBON', + ) + functions.append(f) + + f = Function(OSStatus, 'GetMenuCommandMark', + (OptMenuRef, 'inMenu', InMode), + (MenuCommand, 'inCommandID', InMode), + (UniChar, 'outMark', OutMode), + condition='#if TARGET_API_MAC_CARBON', + ) + functions.append(f) + + f = Function(OSStatus, 'GetMenuCommandPropertySize', + (OptMenuRef, 'inMenu', InMode), + (MenuCommand, 'inCommandID', InMode), + (OSType, 'inPropertyCreator', InMode), + (OSType, 'inPropertyTag', InMode), + (ByteCount, 'outSize', OutMode), + condition='#if TARGET_API_MAC_CARBON', + ) + functions.append(f) + + f = Function(OSStatus, 'RemoveMenuCommandProperty', + (OptMenuRef, 'inMenu', InMode), + (MenuCommand, 'inCommandID', InMode), + (OSType, 'inPropertyCreator', InMode), + (OSType, 'inPropertyTag', InMode), + condition='#if TARGET_API_MAC_CARBON', + ) + functions.append(f) + Index: menusupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/menusupport.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** menusupport.py 2001/12/16 20:15:51 1.14 --- menusupport.py 2002/01/02 14:48:36 1.15 *************** *** 25,28 **** --- 25,29 ---- MenuHandle = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX) MenuRef = MenuHandle + OptMenuRef = OpaqueByValueType(OBJECTTYPE, "Opt" + OBJECTPREFIX) Handle = OpaqueByValueType("Handle", "ResObj") MenuBarHandle = OpaqueByValueType("MenuBarHandle", "ResObj") *************** *** 69,72 **** --- 70,95 ---- #define as_Menu(h) ((MenuHandle)h) #define as_Resource(h) ((Handle)h) + + + /* Alternative version of ResObj_New, which returns None for null argument */ + PyObject *OptMenuObj_New(MenuRef itself) + { + if (itself == NULL) { + Py_INCREF(Py_None); + return Py_None; + } + return MenuObj_New(itself); + } + + int OptMenuObj_Convert(PyObject *v, MenuRef *p_itself) + { + PyObject *tmp; + + if ( v == Py_None ) { + *p_itself = NULL; + return 1; + } + return MenuObj_Convert(v, p_itself); + } """ From jvr@users.sourceforge.net Wed Jan 2 14:59:05 2002 From: jvr@users.sourceforge.net (Just van Rossum) Date: Wed, 02 Jan 2002 06:59:05 -0800 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/menu _Menumodule.c,1.8,1.9 menusupport.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/menu In directory usw-pr-cvs1:/tmp/cvs-serv21804 Modified Files: _Menumodule.c menusupport.py Log Message: rectified copy/paste oversight in comment Index: _Menumodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/_Menumodule.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** _Menumodule.c 2002/01/02 14:48:36 1.8 --- _Menumodule.c 2002/01/02 14:59:02 1.9 *************** *** 52,56 **** ! /* Alternative version of ResObj_New, which returns None for null argument */ PyObject *OptMenuObj_New(MenuRef itself) { --- 52,56 ---- ! /* Alternative version of MenuObj_New, which returns None for NULL argument */ PyObject *OptMenuObj_New(MenuRef itself) { *************** *** 62,65 **** --- 62,66 ---- } + /* Alternative version of MenuObj_Convert, which returns NULL for a None argument */ int OptMenuObj_Convert(PyObject *v, MenuRef *p_itself) { Index: menusupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/menusupport.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** menusupport.py 2002/01/02 14:48:36 1.15 --- menusupport.py 2002/01/02 14:59:03 1.16 *************** *** 72,76 **** ! /* Alternative version of ResObj_New, which returns None for null argument */ PyObject *OptMenuObj_New(MenuRef itself) { --- 72,76 ---- ! /* Alternative version of MenuObj_New, which returns None for NULL argument */ PyObject *OptMenuObj_New(MenuRef itself) { *************** *** 82,85 **** --- 82,86 ---- } + /* Alternative version of MenuObj_Convert, which returns NULL for a None argument */ int OptMenuObj_Convert(PyObject *v, MenuRef *p_itself) { From jvr@users.sourceforge.net Wed Jan 2 15:11:46 2002 From: jvr@users.sourceforge.net (Just van Rossum) Date: Wed, 02 Jan 2002 07:11:46 -0800 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/app _Appmodule.c,1.5,1.6 appscan.py,1.5,1.6 appsupport.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/app In directory usw-pr-cvs1:/tmp/cvs-serv24910 Modified Files: _Appmodule.c appscan.py appsupport.py Log Message: - Added DrawThemeTextBox() - fixed GetThemeTextDimensions(): it has an in/out Point arg, not just out. Index: _Appmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/_Appmodule.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** _Appmodule.c 2001/12/18 15:38:45 1.5 --- _Appmodule.c 2002/01/02 15:11:44 1.6 *************** *** 661,664 **** --- 661,698 ---- #if TARGET_API_MAC_CARBON + static PyObject *App_DrawThemeTextBox(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OSStatus _err; + CFStringRef inString; + ThemeFontID inFontID; + ThemeDrawState inState; + Boolean inWrapToWidth; + Rect inBoundingBox; + SInt16 inJust; + if (!PyArg_ParseTuple(_args, "O&HlbO&h", + CFStringRefObj_Convert, &inString, + &inFontID, + &inState, + &inWrapToWidth, + PyMac_GetRect, &inBoundingBox, + &inJust)) + return NULL; + _err = DrawThemeTextBox(inString, + inFontID, + inState, + inWrapToWidth, + &inBoundingBox, + inJust, + NULL); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; + } + #endif + + #if TARGET_API_MAC_CARBON + static PyObject *App_TruncateThemeText(PyObject *_self, PyObject *_args) { *************** *** 703,711 **** Point ioBounds; SInt16 outBaseline; ! if (!PyArg_ParseTuple(_args, "O&Hlb", CFStringRefObj_Convert, &inString, &inFontID, &inState, ! &inWrapToWidth)) return NULL; _err = GetThemeTextDimensions(inString, --- 737,746 ---- Point ioBounds; SInt16 outBaseline; ! if (!PyArg_ParseTuple(_args, "O&HlbO&", CFStringRefObj_Convert, &inString, &inFontID, &inState, ! &inWrapToWidth, ! PyMac_GetPoint, &ioBounds)) return NULL; _err = GetThemeTextDimensions(inString, *************** *** 1205,1208 **** --- 1240,1248 ---- #if TARGET_API_MAC_CARBON + {"DrawThemeTextBox", (PyCFunction)App_DrawThemeTextBox, 1, + "(CFStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, Boolean inWrapToWidth, Rect inBoundingBox, SInt16 inJust) -> None"}, + #endif + + #if TARGET_API_MAC_CARBON {"TruncateThemeText", (PyCFunction)App_TruncateThemeText, 1, "(CFMutableStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, SInt16 inPixelWidthLimit, TruncCode inTruncWhere) -> (Boolean outTruncated)"}, *************** *** 1211,1215 **** #if TARGET_API_MAC_CARBON {"GetThemeTextDimensions", (PyCFunction)App_GetThemeTextDimensions, 1, ! "(CFStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, Boolean inWrapToWidth) -> (Point ioBounds, SInt16 outBaseline)"}, #endif --- 1251,1255 ---- #if TARGET_API_MAC_CARBON {"GetThemeTextDimensions", (PyCFunction)App_GetThemeTextDimensions, 1, ! "(CFStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, Boolean inWrapToWidth, Point ioBounds) -> (Point ioBounds, SInt16 outBaseline)"}, #endif Index: appscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/appscan.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** appscan.py 2001/12/16 20:17:56 1.5 --- appscan.py 2002/01/02 15:11:44 1.6 *************** *** 49,53 **** "appearanceThemeHasNoAccents", "appearanceBadCursorIndexErr", - "DrawThemeTextBox", # Funny void* out param ] --- 49,52 ---- *************** *** 59,62 **** --- 58,62 ---- 'GetThemeTextDimensions', 'TruncateThemeText', + 'DrawThemeTextBox', ])] *************** *** 81,84 **** --- 81,88 ---- def makerepairinstructions(self): return [ + ([("void", 'inContext', "OutMode")], + [("NULL", 'inContext', "InMode")]), + ([("Point", 'ioBounds', "OutMode")], + [("Point", 'ioBounds', "InOutMode")]), ] Index: appsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/appsupport.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** appsupport.py 2001/12/16 20:18:25 1.9 --- appsupport.py 2002/01/02 15:11:44 1.10 *************** *** 28,31 **** --- 28,33 ---- RgnHandle = FakeType("(RgnHandle)0") + NULL = FakeType("NULL") + # XXXX Should be next, but this will break a lot of code... # RgnHandle = OpaqueByValueType("RgnHandle", "OptResObj") From akuchling@users.sourceforge.net Wed Jan 2 16:38:21 2002 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Wed, 02 Jan 2002 08:38:21 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/lib-tk tkFileDialog.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory usw-pr-cvs1:/tmp/cvs-serv15628 Modified Files: tkFileDialog.py Log Message: Fix typo in label Index: tkFileDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkFileDialog.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tkFileDialog.py 2001/12/30 14:43:56 1.5 --- tkFileDialog.py 2002/01/02 16:38:19 1.6 *************** *** 139,143 **** pass ! print "open", askopenfilename(filetypes=[("all filez", "*")]).encode(enc) print "saveas", asksaveasfilename().encode(enc) --- 139,143 ---- pass ! print "open", askopenfilename(filetypes=[("all files", "*")]).encode(enc) print "saveas", asksaveasfilename().encode(enc) From jackjansen@users.sourceforge.net Wed Jan 2 22:53:40 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Wed, 02 Jan 2002 14:53:40 -0800 Subject: [Python-checkins] CVS: python/dist/src/Mac/Python macmain.c,1.72,1.73 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv4629 Modified Files: macmain.c Log Message: In MachoPython, don't simulate argc/argv unless we have argc=1 and argv[1] starts with "-psn_". This means the drag-and-drop continues to work as expected, but we can now also do /Applications/Python.app/Contents/MacOS/python script.py from the command line, which is a lot easier with debugging. Pressing