[Python-checkins] CVS: python/dist/src/Mac/Python macmain.c,1.66,1.67
Jack Jansen
jackjansen@users.sourceforge.net
Sat, 01 Sep 2001 15:37:50 -0700
Update of /cvsroot/python/python/dist/src/Mac/Python
In directory usw-pr-cvs1:/tmp/cvs-serv17631/Python/Mac/Python
Modified Files:
macmain.c
Log Message:
Added preferences/startup options for division warning
and accepting unix-style newlines on input.
Also (finally) added a startup option to get -vv behaviour.
Moved __convert_to_newlines to main.c because that's easier with the newline option.
Index: macmain.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Python/macmain.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -d -r1.66 -r1.67
*** macmain.c 2001/08/03 13:31:36 1.66
--- macmain.c 2001/09/01 22:37:48 1.67
***************
*** 63,69 ****
"Type \"copyright\", \"credits\" or \"license\" for more information."
-
- extern int Py_DebugFlag; /* For parser.c, declared in pythonrun.c */
- extern int Py_VerboseFlag; /* For import.c, declared in pythonrun.c */
short PyMac_AppRefNum; /* RefNum of application resource fork */
--- 63,66 ----
***************
*** 160,163 ****
--- 157,161 ----
SET_OPT_ITEM(OPT_INSPECT, inspect);
SET_OPT_ITEM(OPT_VERBOSE, verbose);
+ /* OPT_VERBOSEVERBOSE is default off */
SET_OPT_ITEM(OPT_OPTIMIZE, optimize);
SET_OPT_ITEM(OPT_UNBUFFERED, unbuffered);
***************
*** 174,178 ****
SET_OPT_ITEM(OPT_TABWARN, tabwarn);
SET_OPT_ITEM(OPT_NOSITE, nosite);
! SET_OPT_ITEM(OPT_NONAVSERV, nonavservice);
/* The rest are not settable interactively */
--- 172,177 ----
SET_OPT_ITEM(OPT_TABWARN, tabwarn);
SET_OPT_ITEM(OPT_NOSITE, nosite);
! SET_OPT_ITEM(OPT_DIVISIONWARN, divisionwarn);
! SET_OPT_ITEM(OPT_UNIXNEWLINES, unixnewlines);
/* The rest are not settable interactively */
***************
*** 220,223 ****
--- 219,232 ----
OPT_ITEM(OPT_INSPECT, inspect);
OPT_ITEM(OPT_VERBOSE, verbose);
+ if ( item == OPT_VERBOSEVERBOSE ) {
+ if ( p->verbose == 2 )
+ p->verbose = 1;
+ else
+ p->verbose = 2;
+ GetDialogItem(dialog, OPT_VERBOSE, &type, (Handle *)&handle, &rect);
+ SetControlValue(handle, 1);
+ }
+ GetDialogItem(dialog, OPT_VERBOSEVERBOSE, &type, (Handle *)&handle, &rect);
+ SetControlValue(handle, p->verbose == 2);
OPT_ITEM(OPT_OPTIMIZE, optimize);
OPT_ITEM(OPT_UNBUFFERED, unbuffered);
***************
*** 237,241 ****
OPT_ITEM(OPT_TABWARN, tabwarn);
OPT_ITEM(OPT_NOSITE, nosite);
! OPT_ITEM(OPT_NONAVSERV, nonavservice);
#undef OPT_ITEM
--- 246,251 ----
OPT_ITEM(OPT_TABWARN, tabwarn);
OPT_ITEM(OPT_NOSITE, nosite);
! OPT_ITEM(OPT_DIVISIONWARN, divisionwarn);
! OPT_ITEM(OPT_UNIXNEWLINES, unixnewlines);
#undef OPT_ITEM
***************
*** 316,319 ****
--- 326,330 ----
Py_NoSiteFlag = PyMac_options.nosite;
Py_TabcheckFlag = PyMac_options.tabwarn;
+ Py_DivisionWarningFlag = PyMac_options.divisionwarn;
if ( PyMac_options.noargs ) {
/* don't process events at all without the scripts permission */
***************
*** 675,677 ****
{
return (int)PyMac_options.delayconsole;
! }
\ No newline at end of file
--- 686,708 ----
{
return (int)PyMac_options.delayconsole;
! }
!
! #ifndef WITHOUT_UNIX_NEWLINES
! /*
! ** Experimental feature (for 2.2a2): optionally allow unix newlines
! ** as well as Mac newlines on input. We replace a lowlevel
! ** MSL routine to accomplish this.
! */
! void
! __convert_to_newlines(unsigned char * buf, size_t * n_ptr)
! {
! unsigned char *p;
! size_t n = *n_ptr;
!
! for(p=buf; n > 0; p++, n--)
! if ( *p == '\r' ) *p = '\n';
! else if ( *p == '\n' && !PyMac_options.unixnewlines )
! *p = '\r';
! }
! #endif /* WITHOUT_UNIX_NEWLINES */
!