mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 19:34:08 +00:00 
			
		
		
		
	Added WEGetTabSize and WESetTabSize, at Just's request
This commit is contained in:
		
							parent
							
								
									f7cfb9a7a7
								
							
						
					
					
						commit
						a4f0309282
					
				
					 2 changed files with 42 additions and 0 deletions
				
			
		| 
						 | 
					@ -1694,6 +1694,38 @@ static PyObject *wasteObj_WEIsTabHooks(_self, _args)
 | 
				
			||||||
	return _res;
 | 
						return _res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static PyObject *wasteObj_WEGetTabSize(_self, _args)
 | 
				
			||||||
 | 
						wasteObject *_self;
 | 
				
			||||||
 | 
						PyObject *_args;
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						PyObject *_res = NULL;
 | 
				
			||||||
 | 
						SInt16 _rv;
 | 
				
			||||||
 | 
						if (!PyArg_ParseTuple(_args, ""))
 | 
				
			||||||
 | 
							return NULL;
 | 
				
			||||||
 | 
						_rv = WEGetTabSize(_self->ob_itself);
 | 
				
			||||||
 | 
						_res = Py_BuildValue("h",
 | 
				
			||||||
 | 
						                     _rv);
 | 
				
			||||||
 | 
						return _res;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static PyObject *wasteObj_WESetTabSize(_self, _args)
 | 
				
			||||||
 | 
						wasteObject *_self;
 | 
				
			||||||
 | 
						PyObject *_args;
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						PyObject *_res = NULL;
 | 
				
			||||||
 | 
						OSErr _err;
 | 
				
			||||||
 | 
						SInt16 tabWidth;
 | 
				
			||||||
 | 
						if (!PyArg_ParseTuple(_args, "h",
 | 
				
			||||||
 | 
						                      &tabWidth))
 | 
				
			||||||
 | 
							return NULL;
 | 
				
			||||||
 | 
						_err = WESetTabSize(tabWidth,
 | 
				
			||||||
 | 
						                    _self->ob_itself);
 | 
				
			||||||
 | 
						if (_err != noErr) return PyMac_Error(_err);
 | 
				
			||||||
 | 
						Py_INCREF(Py_None);
 | 
				
			||||||
 | 
						_res = Py_None;
 | 
				
			||||||
 | 
						return _res;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyMethodDef wasteObj_methods[] = {
 | 
					static PyMethodDef wasteObj_methods[] = {
 | 
				
			||||||
	{"WEGetText", (PyCFunction)wasteObj_WEGetText, 1,
 | 
						{"WEGetText", (PyCFunction)wasteObj_WEGetText, 1,
 | 
				
			||||||
	 "() -> (Handle _rv)"},
 | 
						 "() -> (Handle _rv)"},
 | 
				
			||||||
| 
						 | 
					@ -1839,6 +1871,10 @@ static PyMethodDef wasteObj_methods[] = {
 | 
				
			||||||
	 "() -> None"},
 | 
						 "() -> None"},
 | 
				
			||||||
	{"WEIsTabHooks", (PyCFunction)wasteObj_WEIsTabHooks, 1,
 | 
						{"WEIsTabHooks", (PyCFunction)wasteObj_WEIsTabHooks, 1,
 | 
				
			||||||
	 "() -> (Boolean _rv)"},
 | 
						 "() -> (Boolean _rv)"},
 | 
				
			||||||
 | 
						{"WEGetTabSize", (PyCFunction)wasteObj_WEGetTabSize, 1,
 | 
				
			||||||
 | 
						 "() -> (SInt16 _rv)"},
 | 
				
			||||||
 | 
						{"WESetTabSize", (PyCFunction)wasteObj_WESetTabSize, 1,
 | 
				
			||||||
 | 
						 "(SInt16 tabWidth) -> None"},
 | 
				
			||||||
	{NULL, NULL, 0}
 | 
						{NULL, NULL, 0}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -400,12 +400,18 @@ inshandler_body = """
 | 
				
			||||||
stdhand = ManualGenerator("STDObjectHandlers", stdhandlers_body)
 | 
					stdhand = ManualGenerator("STDObjectHandlers", stdhandlers_body)
 | 
				
			||||||
inshand = ManualGenerator("WEInstallObjectHandler", inshandler_body)
 | 
					inshand = ManualGenerator("WEInstallObjectHandler", inshandler_body)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Tab hook handlers. Could be parsed from WETabs.h, but this is just as simple.
 | 
				
			||||||
f = Method(OSErr, 'WEInstallTabHooks', (WEReference, 'we', InMode))
 | 
					f = Method(OSErr, 'WEInstallTabHooks', (WEReference, 'we', InMode))
 | 
				
			||||||
methods.append(f)
 | 
					methods.append(f)
 | 
				
			||||||
f = Method(OSErr, 'WERemoveTabHooks', (WEReference, 'we', InMode))
 | 
					f = Method(OSErr, 'WERemoveTabHooks', (WEReference, 'we', InMode))
 | 
				
			||||||
methods.append(f)
 | 
					methods.append(f)
 | 
				
			||||||
f = Method(Boolean, 'WEIsTabHooks', (WEReference, 'we', InMode))
 | 
					f = Method(Boolean, 'WEIsTabHooks', (WEReference, 'we', InMode))
 | 
				
			||||||
methods.append(f)
 | 
					methods.append(f)
 | 
				
			||||||
 | 
					f = Method(SInt16, 'WEGetTabSize', (WEReference, 'we', InMode))
 | 
				
			||||||
 | 
					methods.append(f)
 | 
				
			||||||
 | 
					f = Method(OSErr, 'WESetTabSize', (SInt16, 'tabWidth', InMode), (WEReference, 'we', InMode))
 | 
				
			||||||
 | 
					methods.append(f)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# add the populated lists to the generator groups
 | 
					# add the populated lists to the generator groups
 | 
				
			||||||
# (in a different wordl the scan program would generate this)
 | 
					# (in a different wordl the scan program would generate this)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue