* Got entirely rid of path.py.
* Many modules: fixes for new, stricter, argument passing rules
  (most changes were automatic ones -- not all of this is tested!).
* gwin.py: now uses mainloop.py for its main loop and window admin.
* mainloop.py: always call dispatch() with event as a tuple!
* Fix bug in pdb's 'clear' command -- don't set the bpt but clear it!
diff --git a/Lib/lib-stdwin/gwin.py b/Lib/lib-stdwin/gwin.py
index 12ed90b..626c8fa 100644
--- a/Lib/lib-stdwin/gwin.py
+++ b/Lib/lib-stdwin/gwin.py
@@ -2,16 +2,11 @@
 # Generic stdwin windows
 
 # This is used as a base class from which to derive other window types.
-# The mainloop() function here is an event dispatcher for all window types.
-
-# XXX This is really obsoleted by "mainloop.py".
-# XXX Also you should to it class-oriented...
+# XXX DON'T USE THIS CODE ANY MORE!  It is ages old!
 
 import stdwin, stdwinq
 from stdwinevents import *
-
-windows = []				# List of open windows
-
+from mainloop import mainloop, register, unregister, windows
 
 # Open a window
 
@@ -37,16 +32,11 @@
 	w.backspace = backspace
 	w.arrow = arrow
 	w.kleft = w.kup = w.kright = w.kdown = nop
-	windows.append(w)
+	w.dispatch = treatevent
+	register(w)
 	return w
 
 
-# Generic event dispatching
-
-def mainloop():				# Handle events until no windows left
-	while windows:
-		treatevent(stdwinq.getevent())
-
 def treatevent(e):			# Handle a stdwin event
 	type, w, detail = e
 	if type == WE_DRAW:
@@ -95,10 +85,9 @@
 # Methods
 
 def close(w):				# Close method
-	for i in range(len(windows)):
-		if windows[i] is w:
-			del windows[i]
-			break
+	unregister(w)
+	del w.close	# Delete our close function
+	w.close()	# Call the close method
 
 def arrow(w, detail):			# Arrow key method
 	if detail == WC_LEFT:
@@ -118,4 +107,4 @@
 def backspace(w): w.char(w, '\b')
 def m2down(w, detail): w.mdown(w, detail)
 def m2up(w, detail): w.mup(w, detail)
-def nop(args): pass
+def nop(*args): pass