SF patch #474590 -- RISC OS support
diff --git a/RISCOS/Makefile b/RISCOS/Makefile
index e970d13..c20588b 100644
--- a/RISCOS/Makefile
+++ b/RISCOS/Makefile
@@ -4,7 +4,7 @@
 # You may need to change some of the following
 OSLIB = $(LIBSROOT).OSLib
 CLIB = $(LIBSROOT).clib
-SOCKLIB = $(LIBSROOT).netlib
+TCPIPLIB = $(LIBSROOT).TCPIPLibs
 DLKLIB = $(LIBSROOT).dlk
 ZLIB = $(LIBSROOT).zlib
 EXPAT = $(LIBSROOT).expat.lib
@@ -13,41 +13,47 @@
 MAKEDLK = $(DLKLIB).makedlk
 
 # change from time to time (don't forget to change !Boot also)
-TARGET=Python21
-BUILD=12
+TARGET=Python22
+BUILD=23
 
 
 #
 # You shouldn't need to change anything below this line
 #
-OSLIBS = OSLib:Computer,OSLib:Core,OSLib:User
-
 DLKFLAG= -DDLK
 DLKOBJS = $(DLKLIB).o.dlk_load @.o.linktab
 
-HEADERS = @,@.^.Include,@.^.Modules,@.^.Objects,@.^.Python,$(CLIB),$(OSLIBS),$(DLKLIB)
+HEADERS = @,$(TCPIPLIB),@.^.Include,@.^.Modules,@.^.Objects,@.^.Python,$(CLIB),$(OSLIB),$(DLKLIB)
 
-CC = cc -c -j$(HEADERS) $(DLKFLAG) -DRISCOS -DHAVE_CONFIG_H -wad -throwback
-#-depend !Depend
-CCEXPAT = cc -c -j$(HEADERS),$(EXPAT) $(DLKFLAG) -DHAVE_EXPAT_H -DRISCOS -DHAVE_CONFIG_H -wad -throwback
+CFLAGS = -c  $(DLKFLAG) -DRISCOS -DHAVE_CONFIG_H -wadP -throwback -APCS 3/32bit/fpe3
+
+CC = cc $(CFLAGS) -j$(HEADERS)
+CCEXPAT = cc $(CFLAGS) -j$(HEADERS),$(EXPAT) -DHAVE_EXPAT_H
 
 LINK = link
 LINKFLAGS = -aif #-NOUNUSED #-d
-LOADLIBS = $(CLIB).o.Stubs $(OSLIB).o.OSLib $(DLKOBJS)
+LOADLIBS = $(TCPIPLIB).o.unixlib $(TCPIPLIB).o.inetlib $(TCPIPLIB).o.socklib $(CLIB).o.Stubs $(OSLIB).o.OSLib32 $(DLKOBJS)
+
+LIBFILE = libfile -c 
 
 
 .c.o  :
        $(CC) -o $@ $*.c
 
+MAIN_PYTHON =\
+	@.^.Modules.o.python
+
+LIB_PYTHON =\
+	@.^.LibPython
 
 # code for main Python binary
 MODULES_STATIC =\
-	@.^.Modules.o.python\
 	@.^.Modules.o.main\
-	Modules.o.config\
+	@.Modules.o.config\
 	@.^.Modules.o.getbuildinfo\
-	Modules.o.getpath_riscos\
-	Modules.o.riscosmodule
+	@.Modules.o.getpath_riscos\
+	@.Modules.o.riscosmodule\
+	@.^.Modules.o.gcmodule
 
 
 # dynamic Modules
@@ -85,7 +91,9 @@
 	@.^.Lib.pyexpat/pyd\
 	@.^.Lib.plat-riscos.drawf/pyd\
 	@.^.Lib.plat-riscos.swi/pyd\
-	@.^.Lib._sre/pyd
+	@.^.Lib._sre/pyd\
+	@.^.Lib.xxsubtype/pyd\
+	@.^.Lib._symtable/pyd
 
 
 OBJECTS_PYTHON =\
@@ -98,6 +106,7 @@
 	@.^.Python.o.pystate\
 	@.^.Python.o.pyfpe\
 	@.^.Python.o.mystrtoul\
+	@.^.Python.o.mysnprintf\
 	@.^.Python.o.modsupport\
 	@.^.Python.o.marshal\
 	@.^.Python.o.importdl\
@@ -141,6 +150,7 @@
 	@.^.Objects.o.longobject\
 	@.^.Objects.o.listobject\
 	@.^.Objects.o.intobject\
+	@.^.Objects.o.iterobject\
 	@.^.Objects.o.funcobject\
 	@.^.Objects.o.frameobject\
 	@.^.Objects.o.floatobject\
@@ -153,7 +163,8 @@
 	@.^.Objects.o.bufferobject\
 	@.^.Objects.o.abstract\
 	@.^.Objects.o.unicodectype\
-	@.^.Objects.o.unicodeobject
+	@.^.Objects.o.unicodeobject\
+	@.^.Objects.o.descrobject
 
 
 OBJECTS_PARSER =\
@@ -183,8 +194,11 @@
        $(CC) -DBUILD=$(BUILD) -o @.^.Modules.o.getbuildinfo @.^.Modules.c.getbuildinfo
 
 
-@.^.$(TARGET):  $(OBJECTS) o.linktab
-	$(LINK) -o @.^.$(TARGET) $(OBJECTS) $(LOADLIBS)
+$(LIB_PYTHON):	$(OBJECTS)
+	$(LIBFILE) $(LIB_PYTHON) $(OBJECTS)
+
+@.^.$(TARGET):  o.linktab $(MAIN_PYTHON) $(LIB_PYTHON)
+	$(LINK) -o @.^.$(TARGET) $(MAIN_PYTHON) @.^.LibPython $(LOADLIBS)
 
 
 #########################################################################
@@ -229,7 +243,7 @@
 	$(MAKEDLK) -d @.^.Lib.cStringIO/pyd -s s.linktab -o @.^.Modules.o.cStringIO -e initcStringIO
 
 @.^.Lib.plat-riscos.drawf/pyd: Modules.o.drawfmodule #s.linktab
-	$(LINK) -aof -o Modules.o.drawflink Modules.o.drawfmodule $(OSLIB).o.OSLIB
+	$(LINK) -aof -o Modules.o.drawflink Modules.o.drawfmodule $(OSLIB).o.OSLIB32
 	$(MAKEDLK) -d @.^.Lib.plat-riscos.drawf/pyd -s s.linktab -o Modules.o.drawflink -e initdrawf
 
 @.^.Lib.errno/pyd: @.^.Modules.o.errnomodule #s.linktab
@@ -277,9 +291,6 @@
 @.^.Lib.signal/pyd: @.^.Modules.o.signalmodule s.linktab
 	$(MAKEDLK) -d @.^.Lib.signal/pyd -s s.linktab -o @.^.Modules.o.signalmodule -e initsignal
 
-#@.^.Lib.soundex/pyd: @.^.Modules.o.soundex s.linktab
-#	$(MAKEDLK) -d @.^.Lib.soundex/pyd -s s.linktab -o @.^.Modules.o.soundex -e initsoundex
-
 @.^.Lib.strop/pyd: @.^.Modules.o.stropmodule s.linktab
 	$(MAKEDLK) -d @.^.Lib.strop/pyd -s s.linktab -o @.^.Modules.o.stropmodule -e initstrop
 
@@ -287,7 +298,7 @@
 	$(MAKEDLK) -d @.^.Lib.struct/pyd -s s.linktab -o @.^.Modules.o.structmodule -e initstruct
 
 @.^.Lib.plat-riscos.swi/pyd: Modules.o.swimodule s.linktab
-	$(LINK) -aof -o Modules.o.swilink Modules.o.swimodule $(OSLIB).o.OSLIB
+	$(LINK) -aof -o Modules.o.swilink Modules.o.swimodule $(OSLIB).o.OSLIB32
 	$(MAKEDLK) -d @.^.Lib.plat-riscos.swi/pyd -s s.linktab -o Modules.o.swilink -e initswi
 
 @.^.Lib._locale/pyd: @.^.Modules.o._localemodule s.linktab
@@ -311,28 +322,33 @@
 @.^.Lib.xreadlines/pyd: @.^.Modules.o.xreadlinesmodule s.linktab
 	$(MAKEDLK) -d @.^.Lib.xreadlines/pyd -s s.linktab -o @.^.Modules.o.xreadlinesmodule -e initxreadlines
 
+@.^.Lib.xxsubtype/pyd: @.^.Modules.o.xxsubtype s.linktab
+	$(MAKEDLK) -d @.^.Lib.xxsubtype/pyd -s s.linktab -o @.^.Modules.o.xxsubtype -e initxxsubtype
+
+@.^.Lib._symtable/pyd: @.^.Modules.o.symtablemodule s.linktab
+	$(MAKEDLK) -d @.^.Lib._symtable/pyd -s s.linktab -o @.^.Modules.o.symtablemodule -e init_symtable
 
 
 ############################################################################
 # Dynamic Modules with other dependencies
 #
 @.^.Lib.select/pyd:  @.^.Modules.o.selectmodule s.linktab
-	$(LINK) -aof -o @.^.Modules.o.selectlink @.^.Modules.o.selectmodule $(SOCKLIB).o.socklib
+	$(LINK) -aof -o @.^.Modules.o.selectlink @.^.Modules.o.selectmodule $(TCPIPLIB).o.socklib
 	$(MAKEDLK) -d @.^.Lib.select/pyd -s s.linktab -o @.^.Modules.o.selectlink -e initselect
 
 @.^.Modules.o.selectmodule: @.^.Modules.c.selectmodule
-	$(CC) -I$(SOCKLIB).include -o $@ @.^.Modules.c.selectmodule
+	$(CC) -I$(TCPIPLIB).include -o $@ @.^.Modules.c.selectmodule
 
 @.^.Lib._socket/pyd: @.^.Modules.o.socketmodule s.linktab 
-	$(LINK) -aof -o @.^.Modules.o._socketlink @.^.Modules.o.socketmodule $(SOCKLIB).o.inetlib $(SOCKLIB).o.unixlib $(SOCKLIB).o.socklib
+	$(LINK) -aof -o @.^.Modules.o._socketlink @.^.Modules.o.socketmodule $(TCPIPLIB).o.inetlib $(TCPIPLIB).o.unixlib $(TCPIPLIB).o.socklib
 	$(MAKEDLK) -d @.^.Lib._socket/pyd -s s.linktab -o @.^.Modules.o._socketlink -e init_socket
 
 @.^.Modules.o.socketmodule: @.^.Modules.c.socketmodule
-	$(CC) -I$(SOCKLIB).include -o $@ @.^.Modules.c.socketmodule
+	$(CC) -I$(TCPIPLIB).include -o $@ @.^.Modules.c.socketmodule
 
 
 @.^.Lib.zlib/pyd: @.^.Modules.o.zlibmodule s.linktab
-	$(LINK) -aof -o @.^.Modules.o.zliblink @.^.Modules.o.zlibmodule $(ZLIB).zlib_lib
+	$(LINK) -aof -o @.^.Modules.o.zliblink @.^.Modules.o.zlibmodule $(ZLIB).zlib
 	$(MAKEDLK) -d @.^.Lib.zlib/pyd -s s.linktab -o @.^.Modules.o.zliblink -e initzlib
 
 @.^.Modules.o.zlibmodule: @.^.Modules.c.zlibmodule
@@ -340,9 +356,13 @@
 
 
 @.^.Lib.time/pyd: @.^.Modules.o.timemodule s.linktab @.o.sleep
-	$(LINK) -aof -o @.^.Modules.o.timelink @.^.Modules.o.timemodule @.o.sleep $(OSLIB).o.OSLib
+	$(LINK) -aof -o @.^.Modules.o.timelink @.^.Modules.o.timemodule @.o.sleep $(OSLIB).o.OSLib32
 	$(MAKEDLK) -d @.^.Lib.time/pyd -s s.linktab -o @.^.Modules.o.timelink -e inittime
 
+#@.^.Lib.time/pyd: @.Modules.o.timemodule s.linktab
+#	$(LINK) -aof -o @.Modules.o.timelink @.Modules.o.timemodule $(OSLIB).o.OSLib32
+#	$(MAKEDLK) -d @.^.Lib.time/pyd -s s.linktab -o @.Modules.o.timelink -e inittime
+
 
 @.^.Lib.pyexpat/pyd: @.^.Modules.o.pyexpat s.linktab
 	$(LINK) -aof -o @.^.Modules.o.pyexpatlink @.^.Modules.o.pyexpat $(EXPAT).expat_lib
@@ -356,7 +376,7 @@
 # dynamic linking symbol table
 #
 o.linktab: s.linktab
-	ObjAsm s.linktab o.linktab
+	ObjAsm -APCS 3/32bit s.linktab o.linktab
 
 s.linktab: $(OBJECTS)
 	$(OBJSCAN) -s s.linktab -o $(OBJECTS) $(clib).o.stubs
@@ -365,42 +385,43 @@
 # special targets
 #
 libclean:
-	create @.^.Lib.dummy/pyc
-	create @.^.Lib.dummy/pyo
-	create @.^.Lib.plat-riscos.dummy/pyc
-	create @.^.Lib.plat-riscos.dummy/pyo
-	create @.^.Lib.test.dummy/pyc
-	create @.^.Lib.test.dummy/pyo
-	wipe @.^.Lib.*/pyc ~C~V
-	wipe @.^.Lib.*/pyo ~C~V
-	wipe @.^.Lib.plat-riscos.*/pyc ~C~V
-	wipe @.^.Lib.plat-riscos.*/pyo ~C~V
-	wipe @.^.Lib.test.*/pyc ~C~V
-	wipe @.^.Lib.test.*/pyo ~C~V
+	-wipe @.^.Lib.*/pyc ~C~V
+	-wipe @.^.Lib.*/pyo ~C~V
+	-wipe @.^.Lib.plat-riscos.*/pyc ~C~V
+	-wipe @.^.Lib.plat-riscos.*/pyo ~C~V
+	-wipe @.^.Lib.test.*/pyc ~C~V
+	-wipe @.^.Lib.test.*/pyo ~C~V
+	-wipe @.^.Lib.encodings.*/pyc ~C~V
+	-wipe @.^.Lib.encodings.*/pyo ~C~V
+	-wipe @.^.Lib.curses.*/pyc ~C~V
+	-wipe @.^.Lib.curses.*/pyo ~C~V
+	-wipe @.^.Lib.xml.*/pyc ~C~V
+	-wipe @.^.Lib.xml.*/pyo ~C~V
+	-wipe @.^.Lib.xml.sax.*/pyc ~C~V
+	-wipe @.^.Lib.xml.sax.*/pyo ~C~V
+	-wipe @.^.Lib.xml.dom.*/pyc ~C~V
+	-wipe @.^.Lib.xml.dom.*/pyo ~C~V
+	-wipe @.^.Lib.xml.parsers.*/pyc ~C~V
+	-wipe @.^.Lib.xml.parsers.*/pyo ~C~V
 
 clean: libclean
-	create @.^.Objects.o.dummy
-	create @.^.Parser.o.dummy
-	create @.^.Modules.o.dummy
-	create o.dummy
-	create @.^.Python.o.dummy
-	wipe @.^.Modules.o.* ~C ~V
-	wipe @.^.Objects.o.* ~C ~V
-	wipe @.^.Parser.o.* ~C ~V
-	wipe @.^.Python.o.* ~C ~V
-	wipe o.* ~C ~V
+	-wipe @.^.Modules.o.* ~C~V
+	-wipe @.^.Objects.o.* ~C~V
+	-wipe @.^.Parser.o.* ~C~V
+	-wipe @.^.Python.o.* ~C~V
+	-wipe @.Modules.o.* ~C~V
+	-wipe @.Python.o.* ~C~V
+	-wipe @.o.* ~C ~V
 
-rebuild: clean
-	create @.^.Lib.dummy/pyd
-	create @.^.$(TARGET)
-	create @.^.Lib.plat-riscos.dummy/pyd
-	create s.linktab
-	create o.linktab
-	wipe @.^.$(TARGET) ~C~V
-	wipe @.^.Lib.*/pyd ~C ~V
-	wipe @.^.Lib.plat-riscos.*/pyd ~C~V
-	wipe s.linktab ~C~V
-	wipe o.linktab ~C~V
+rebuild: clean clean-support
+	remove @.^.$(TARGET)
+	-wipe @.^.Lib.*/pyd ~C ~V
+	-wipe @.^.Lib.plat-riscos.*/pyd ~C~V
+	remove s.linktab
+
+clean-support:
+	-wipe @.^.!* ~C~V
+	remove @.^.AddToPath
 
 cdirs:
 	cdir @.Modules.o