mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Getting rid of all the code inside #ifdef macintosh too.
This commit is contained in:
		
							parent
							
								
									4bae2d5e46
								
							
						
					
					
						commit
						eddc1449ba
					
				
					 19 changed files with 6 additions and 458 deletions
				
			
		|  | @ -14,10 +14,6 @@ | |||
| #include "opcode.h" | ||||
| #include "structmember.h" | ||||
| 
 | ||||
| #ifdef macintosh | ||||
| #include "macglue.h" | ||||
| #endif | ||||
| 
 | ||||
| #include <ctype.h> | ||||
| 
 | ||||
| /* Turn this on if your compiler chokes on the big switch: */ | ||||
|  | @ -801,7 +797,7 @@ eval_frame(PyFrameObject *f) | |||
| 					goto on_error; | ||||
| 				} | ||||
| 			} | ||||
| #if !defined(HAVE_SIGNAL_H) || defined(macintosh) | ||||
| #if !defined(HAVE_SIGNAL_H) | ||||
| 			/* If we have true signals, the signal handler
 | ||||
| 			   will call Py_AddPendingCall() so we don't | ||||
| 			   have to call PyErr_CheckSignals().  On the  | ||||
|  |  | |||
|  | @ -3,12 +3,6 @@ | |||
| 
 | ||||
| #include "Python.h" | ||||
| 
 | ||||
| #ifdef macintosh | ||||
| extern char *PyMac_StrError(int); | ||||
| #undef strerror | ||||
| #define strerror PyMac_StrError | ||||
| #endif /* macintosh */ | ||||
| 
 | ||||
| #ifndef __STDC__ | ||||
| #ifndef MS_WINDOWS | ||||
| extern char *strerror(int); | ||||
|  |  | |||
|  | @ -11,9 +11,6 @@ | |||
| #include "eval.h" | ||||
| #include "osdefs.h" | ||||
| #include "importdl.h" | ||||
| #ifdef macintosh | ||||
| #include "macglue.h" | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_FCNTL_H | ||||
| #include <fcntl.h> | ||||
|  | @ -835,9 +832,6 @@ write_compiled_module(PyCodeObject *co, char *cpathname, long mtime) | |||
| 	fclose(fp); | ||||
| 	if (Py_VerboseFlag) | ||||
| 		PySys_WriteStderr("# wrote %s\n", cpathname); | ||||
| #ifdef macintosh | ||||
| 	PyMac_setfiletype(cpathname, 'Pyth', 'PYC '); | ||||
| #endif | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -1123,13 +1117,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf, | |||
| 		strcat(buf, "."); | ||||
| 		strcat(buf, name); | ||||
| 		strcpy(name, buf); | ||||
| #ifdef macintosh | ||||
| 		/* Freezing on the mac works different, and the modules are
 | ||||
| 		** actually on sys.path. So we don't take the quick exit but | ||||
| 		** continue with the normal flow. | ||||
| 		*/ | ||||
| 		path = NULL; | ||||
| #else | ||||
| 		if (find_frozen(name) != NULL) { | ||||
| 			strcpy(buf, name); | ||||
| 			return &fd_frozen; | ||||
|  | @ -1137,7 +1124,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf, | |||
| 		PyErr_Format(PyExc_ImportError, | ||||
| 			     "No frozen submodule named %.200s", name); | ||||
| 		return NULL; | ||||
| #endif | ||||
| 	} | ||||
| 	if (path == NULL) { | ||||
| 		if (is_builtin(name)) { | ||||
|  | @ -1233,33 +1219,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf, | |||
| 			/* no hook was successful, use builtin import */ | ||||
| 		} | ||||
| 
 | ||||
| #ifdef macintosh | ||||
| 		/*
 | ||||
| 		** Speedup: each sys.path item is interned, and | ||||
| 		** FindResourceModule remembers which items refer to | ||||
| 		** folders (so we don't have to bother trying to look | ||||
| 		** into them for resources). We only do this for string | ||||
| 		** items. | ||||
| 		*/ | ||||
| 		if (PyString_Check(PyList_GET_ITEM(path, i))) { | ||||
| 			PyString_InternInPlace(&PyList_GET_ITEM(path, i)); | ||||
| 			v = PyList_GET_ITEM(path, i); | ||||
| 			if (PyMac_FindResourceModule((PyStringObject *)v, name, buf)) { | ||||
| 				static struct filedescr resfiledescr = | ||||
| 					{"", "", PY_RESOURCE}; | ||||
| 
 | ||||
| 				Py_XDECREF(copy); | ||||
| 				return &resfiledescr; | ||||
| 			} | ||||
| 			if (PyMac_FindCodeResourceModule((PyStringObject *)v, name, buf)) { | ||||
| 				static struct filedescr resfiledescr = | ||||
| 					{"", "", PY_CODERESOURCE}; | ||||
| 
 | ||||
| 				Py_XDECREF(copy); | ||||
| 				return &resfiledescr; | ||||
| 			} | ||||
| 		} | ||||
| #endif | ||||
| 		if (len > 0 && buf[len-1] != SEP | ||||
| #ifdef ALTSEP | ||||
| 		    && buf[len-1] != ALTSEP | ||||
|  | @ -1290,10 +1249,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf, | |||
| 		} | ||||
| #endif | ||||
| #endif | ||||
| #ifdef macintosh | ||||
| 		fdp = PyMac_FindModuleExtension(buf, &len, name); | ||||
| 		if (fdp) { | ||||
| #else | ||||
| #if defined(PYOS_OS2) | ||||
| 		/* take a snapshot of the module spec for restoration
 | ||||
| 		 * after the 8 character DLL hackery | ||||
|  | @ -1331,7 +1286,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf, | |||
| 			strcpy(buf+len, fdp->suffix); | ||||
| 			if (Py_VerboseFlag > 1) | ||||
| 				PySys_WriteStderr("# trying %s\n", buf); | ||||
| #endif /* !macintosh */ | ||||
| 			filemode = fdp->mode; | ||||
| 			if (filemode[0] == 'U')  | ||||
| 				filemode = "r" PY_STDIOTEXTMODE; | ||||
|  | @ -1408,9 +1362,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf, | |||
| #elif defined(DJGPP) | ||||
| #include <dir.h> | ||||
| 
 | ||||
| #elif defined(macintosh) | ||||
| #include <TextUtils.h> | ||||
| 
 | ||||
| #elif defined(__MACH__) && defined(__APPLE__) && defined(HAVE_DIRENT_H) | ||||
| #include <sys/types.h> | ||||
| #include <dirent.h> | ||||
|  | @ -1475,24 +1426,6 @@ case_ok(char *buf, int len, int namelen, char *name) | |||
| 	} | ||||
| 	return strncmp(ffblk.ff_name, name, namelen) == 0; | ||||
| 
 | ||||
| /* macintosh */ | ||||
| #elif defined(macintosh) | ||||
| 	FSSpec fss; | ||||
| 	OSErr err; | ||||
| 
 | ||||
| 	if (Py_GETENV("PYTHONCASEOK") != NULL) | ||||
| 		return 1; | ||||
| 
 | ||||
| 	err = FSMakeFSSpec(0, 0, Pstring(buf), &fss); | ||||
| 	if (err) { | ||||
| 		PyErr_Format(PyExc_NameError, | ||||
| 		     "Can't find file for module %.100s\n(filename %.300s)", | ||||
| 		     name, buf); | ||||
| 		return 0; | ||||
| 	} | ||||
| 	return fss.name[0] >= namelen && | ||||
| 	       strncmp(name, (char *)fss.name+1, namelen) == 0; | ||||
| 
 | ||||
| /* new-fangled macintosh (macosx) */ | ||||
| #elif defined(__MACH__) && defined(__APPLE__) && defined(HAVE_DIRENT_H) | ||||
| 	DIR *dirp; | ||||
|  | @ -1709,15 +1642,6 @@ load_module(char *name, FILE *fp, char *buf, int type, PyObject *loader) | |||
| 		break; | ||||
| #endif | ||||
| 
 | ||||
| #ifdef macintosh | ||||
| 	case PY_RESOURCE: | ||||
| 		m = PyMac_LoadResourceModule(name, buf); | ||||
| 		break; | ||||
| 	case PY_CODERESOURCE: | ||||
| 		m = PyMac_LoadCodeResourceModule(name, buf); | ||||
| 		break; | ||||
| #endif | ||||
| 
 | ||||
| 	case PKG_DIRECTORY: | ||||
| 		m = load_package(name, buf); | ||||
| 		break; | ||||
|  | @ -2678,21 +2602,6 @@ imp_load_source(PyObject *self, PyObject *args) | |||
| 	return m; | ||||
| } | ||||
| 
 | ||||
| #ifdef macintosh | ||||
| static PyObject * | ||||
| imp_load_resource(PyObject *self, PyObject *args) | ||||
| { | ||||
| 	char *name; | ||||
| 	char *pathname; | ||||
| 	PyObject *m; | ||||
| 
 | ||||
| 	if (!PyArg_ParseTuple(args, "ss:load_resource", &name, &pathname)) | ||||
| 		return NULL; | ||||
| 	m = PyMac_LoadResourceModule(name, pathname); | ||||
| 	return m; | ||||
| } | ||||
| #endif /* macintosh */ | ||||
| 
 | ||||
| static PyObject * | ||||
| imp_load_module(PyObject *self, PyObject *args) | ||||
| { | ||||
|  | @ -2822,9 +2731,6 @@ static PyMethodDef imp_methods[] = { | |||
| 	{"load_dynamic",	imp_load_dynamic,	METH_VARARGS}, | ||||
| #endif | ||||
| 	{"load_package",	imp_load_package,	METH_VARARGS}, | ||||
| #ifdef macintosh | ||||
| 	{"load_resource",	imp_load_resource,	METH_VARARGS}, | ||||
| #endif | ||||
| 	{"load_source",		imp_load_source,	METH_VARARGS}, | ||||
| 	{NULL,			NULL}		/* sentinel */ | ||||
| }; | ||||
|  |  | |||
|  | @ -27,9 +27,6 @@ | |||
| #include "windows.h" | ||||
| #endif | ||||
| 
 | ||||
| #ifdef macintosh | ||||
| #include "macglue.h" | ||||
| #endif | ||||
| extern char *Py_GetPath(void); | ||||
| 
 | ||||
| extern grammar _PyParser_Grammar; /* From graminit.c */ | ||||
|  | @ -755,13 +752,6 @@ maybe_pyc_file(FILE *fp, const char* filename, const char* ext, int closeit) | |||
| 	if (strcmp(ext, ".pyc") == 0 || strcmp(ext, ".pyo") == 0) | ||||
| 		return 1; | ||||
| 
 | ||||
| #ifdef macintosh | ||||
| 	/* On a mac, we also assume a pyc file for types 'PYC ' and 'APPL' */ | ||||
| 	if (PyMac_getfiletype((char *)filename) == 'PYC ' | ||||
| 	    || PyMac_getfiletype((char *)filename) == 'APPL') | ||||
| 		return 1; | ||||
| #endif /* macintosh */ | ||||
| 
 | ||||
| 	/* Only look into the file if we are allowed to close it, since
 | ||||
| 	   it then should also be seekable. */ | ||||
| 	if (closeit) { | ||||
|  | @ -1542,11 +1532,7 @@ Py_Exit(int sts) | |||
| { | ||||
| 	Py_Finalize(); | ||||
| 
 | ||||
| #ifdef macintosh | ||||
| 	PyMac_Exit(sts); | ||||
| #else | ||||
| 	exit(sts); | ||||
| #endif | ||||
| } | ||||
| 
 | ||||
| static void | ||||
|  |  | |||
|  | @ -17,8 +17,3 @@ strerror(int err) | |||
| 	PyOS_snprintf(buf, sizeof(buf), "Unknown errno %d", err); | ||||
| 	return buf; | ||||
| } | ||||
| 
 | ||||
| #ifdef macintosh | ||||
| int sys_nerr = 0; | ||||
| char *sys_errlist[1] = 0; | ||||
| #endif | ||||
|  |  | |||
|  | @ -103,23 +103,6 @@ PyMember_GetOne(char *addr, PyMemberDef *l) | |||
| 	case T_STRING_INPLACE: | ||||
| 		v = PyString_FromString((char*)addr); | ||||
| 		break; | ||||
| #ifdef macintosh | ||||
| 	case T_PSTRING: | ||||
| 		if (*(char**)addr == NULL) { | ||||
| 			Py_INCREF(Py_None); | ||||
| 			v = Py_None; | ||||
| 		} | ||||
| 		else | ||||
| 			v = PyString_FromStringAndSize( | ||||
| 				(*(char**)addr)+1, | ||||
| 				**(unsigned char**)addr); | ||||
| 		break; | ||||
| 	case T_PSTRING_INPLACE: | ||||
| 		v = PyString_FromStringAndSize( | ||||
| 			((char*)addr)+1, | ||||
| 			*(unsigned char*)addr); | ||||
| 		break; | ||||
| #endif /* macintosh */ | ||||
| 	case T_CHAR: | ||||
| 		v = PyString_FromStringAndSize((char*)addr, 1); | ||||
| 		break; | ||||
|  | @ -168,11 +151,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) | |||
| { | ||||
| 	PyObject *oldv; | ||||
| 
 | ||||
| 	if ((l->flags & READONLY) || l->type == T_STRING | ||||
| #ifdef macintosh | ||||
| 	    || l->type == T_PSTRING | ||||
| #endif | ||||
| 		) | ||||
| 	if ((l->flags & READONLY) || l->type == T_STRING) | ||||
| 	{ | ||||
| 		PyErr_SetString(PyExc_TypeError, "readonly attribute"); | ||||
| 		return -1; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jack Jansen
						Jack Jansen