X-From-Line: clanlib-devel-bounces+grumbel=gmx.net@clanlib.org Thu Sep 11 08:20:24 2003 Delivered-To: postmaster@penpen Received: from pop.gmx.net (213.165.64.20) by penpen with POP3 for ; 11 Sep 2003 08:20:24 -0000 Return-Path: X-Flags: 0000 Delivered-To: GMX delivery to grumbel@gmx.net Received: (qmail 908 invoked by uid 65534); 11 Sep 2003 05:04:32 -0000 Received: from vacuum1.xentive.com (EHLO vacuum1.xentive.com) (195.249.47.163) by mx0.gmx.net (mx002) with SMTP; 11 Sep 2003 07:04:32 +0200 Received: (qmail 15148 invoked from network); 11 Sep 2003 05:04:32 -0000 Received: from unknown (HELO dark.clansoft.dk) (217.116.224.121) by 192.168.2.2 with RC4-SHA encrypted SMTP; 11 Sep 2003 05:04:32 -0000 Received: from dark.clansoft.dk ([127.0.0.1] ident=list) by dark.clansoft.dk with esmtp (Exim 4.22) id 19xJDf-00033S-BW for grumbel@gmx.net; Thu, 11 Sep 2003 06:38:11 +0200 Received: from postal.argia.net ([209.168.125.63]) by dark.clansoft.dk with smtp (Exim 4.22) id 19xJDS-00032L-1J for clanlib-devel@clanlib.org; Thu, 11 Sep 2003 06:37:58 +0200 Received: (qmail 14506 invoked from network); 11 Sep 2003 04:37:53 -0000 Received: from unknown (HELO gyro) (64.91.121.2) by mail.argia.net with SMTP; 11 Sep 2003 04:37:53 -0000 From: David Simon To: clanlib-devel@clanlib.org Date: Wed, 10 Sep 2003 21:37:51 -0700 User-Agent: KMail/1.4.1 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="------------Boundary-00=_3V81W2X4PGTD5ENKVZQ0" X-Gnus-Mail-Source: file:/home/ingo/.procmaildir/incoming Message-Id: <200309102137.51934.davids@argia.net> Subject: [Clanlib-devel] Smart pointers minor patch X-BeenThere: clanlib-devel@clanlib.org X-Mailman-Version: 2.1.2 Precedence: list Reply-To: davids@argia.net, clanlib-devel@clanlib.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: clanlib-devel-bounces+grumbel=gmx.net@clanlib.org Errors-To: clanlib-devel-bounces+grumbel=gmx.net@clanlib.org X-GMX-Antivirus: -1 (not scanned, may not use virus scanner) X-GMX-Antispam: 0 (Mail was not recognized as spam) X-Spam-Status: No, hits=0.8 required=5.0 tests=HTML_00_10,HTML_MESSAGE,PATCH_UNIFIED_DIFF,USER_AGENT_KMAIL version=2.55 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) Lines: 336 Xref: penpen.localdomain ClanLib.Devel:7000 --------------Boundary-00=_3V81W2X4PGTD5ENKVZQ0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8bit The patch fixes an API issue, fixes a documentation bug, adds the pointers to autounderwear, and fixes an unrelated Linux build bug. Also, please add the test in, it only needs to be linked with App and Core. --------------Boundary-00=_3V81W2X4PGTD5ENKVZQ0 Content-Type: text/x-diff; charset="us-ascii"; name="pointers2.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="pointers2.patch" ? Examples/Resources/resources.bin ? Sources/Application/Unix/.deps ? Sources/Application/Unix/.dirstamp ? Sources/Application/Unix/clanapp.lo ? Sources/Application/Win32/.deps ? Sources/Display/Providers/.deps ? Sources/Display/Providers/.dirstamp ? Sources/Display/Providers/.libs ? Sources/Display/Providers/jpeg_provider.lo ? Sources/Display/Providers/jpeg_provider_generic.lo ? Sources/Display/Providers/pcx_provider.lo ? Sources/Display/Providers/pcx_provider_generic.lo ? Sources/Display/Providers/png_provider.lo ? Sources/Display/Providers/png_provider_generic.lo ? Sources/Display/Providers/provider_factory.lo ? Sources/Display/Providers/provider_type.lo ? Sources/Display/Providers/targa_provider.lo ? Sources/Display/Providers/targa_provider_generic.lo ? Sources/Display/Win32/.deps ? Sources/Display/X11/.deps ? Sources/Display/X11/.dirstamp ? Sources/Display/X11/.libs ? Sources/Display/X11/font_x11.lo ? Sources/Display/X11/input_device_x11keyboard.lo ? Sources/Display/X11/input_device_x11mouse.lo ? Sources/GL/GLX/.deps ? Sources/GL/GLX/.dirstamp ? Sources/GL/GLX/.libs ? Sources/GL/GLX/display_window_opengl.lo ? Sources/GL/WGL/.deps ? Sources/Network/Browse/.deps ? Sources/Network/Browse/.dirstamp ? Sources/Network/Browse/.libs ? Sources/Network/Browse/browse_client.lo ? Sources/Network/Browse/browse_client_generic.lo ? Sources/Network/Browse/browse_master.lo ? Sources/Network/Browse/browse_master_generic.lo ? Sources/Network/Browse/browse_server.lo ? Sources/Network/Browse/browse_server_generic.lo ? Sources/Network/Browse/server_database.lo ? Sources/Network/IRC/.deps ? Sources/Network/IRC/.dirstamp ? Sources/Network/IRC/.libs ? Sources/Network/IRC/irc_connection.lo ? Sources/Network/IRC/irc_connection_generic.lo ? Sources/Network/NetObjects/.deps ? Sources/Network/NetObjects/.dirstamp ? Sources/Network/NetObjects/.libs ? Sources/Network/NetObjects/netobject_client.lo ? Sources/Network/NetObjects/netobject_client_generic.lo ? Sources/Network/NetObjects/netobject_controller.lo ? Sources/Network/NetObjects/netobject_controller_generic.lo ? Sources/Network/NetObjects/netobject_server.lo ? Sources/Network/NetObjects/netobject_server_generic.lo ? Sources/Network/NetSession/.deps ? Sources/Network/NetSession/.dirstamp ? Sources/Network/NetSession/.libs ? Sources/Network/NetSession/inputsource_netpacket.lo ? Sources/Network/NetSession/inputsource_netpacket_generic.lo ? Sources/Network/NetSession/inputsource_netstream.lo ? Sources/Network/NetSession/netcomputer.lo ? Sources/Network/NetSession/netcomputer_generic.lo ? Sources/Network/NetSession/netgroup.lo ? Sources/Network/NetSession/netpacket.lo ? Sources/Network/NetSession/netpacket_generic.lo ? Sources/Network/NetSession/netsession.lo ? Sources/Network/NetSession/netsession_generic.lo ? Sources/Network/NetSession/netstream.lo ? Sources/Network/NetSession/netstream_generic.lo ? Sources/Network/NetSession/outputsource_netpacket.lo ? Sources/Network/NetSession/outputsource_netpacket_generic.lo ? Sources/Network/NetSession/outputsource_netstream.lo ? Sources/Network/NetVariables/.deps ? Sources/Network/NetVariables/.dirstamp ? Sources/Network/NetVariables/netvariables.lo ? Sources/Network/Socket/.deps ? Sources/Network/Socket/.dirstamp ? Sources/Network/Socket/.libs ? Sources/Network/Socket/event_trigger_socket.lo ? Sources/Network/Socket/inputsource_socket.lo ? Sources/Network/Socket/ip_address.lo ? Sources/Network/Socket/ip_address_getaddr.lo ? Sources/Network/Socket/ip_address_getsock.lo ? Sources/Network/Socket/outputsource_socket.lo ? Sources/Network/Socket/socket.lo ? Sources/Network/Socket/socket_generic.lo ? Sources/Network/Socket/socket_select.lo ? Sources/Sound/SoundFilters/.deps ? Sources/Sound/SoundFilters/.dirstamp ? Sources/Sound/SoundFilters/echofilter_generic.lo ? Sources/Sound/SoundFilters/fadefilter_generic.lo ? Sources/Sound/SoundFilters/inverse_echofilter_generic.lo ? Sources/Sound/SoundProviders/.deps ? Sources/Sound/SoundProviders/.dirstamp ? Sources/Sound/SoundProviders/.libs ? Sources/Sound/SoundProviders/soundprovider_factory.lo ? Sources/Sound/SoundProviders/soundprovider_raw.lo ? Sources/Sound/SoundProviders/soundprovider_raw_session.lo ? Sources/Sound/SoundProviders/soundprovider_type.lo ? Sources/Sound/SoundProviders/soundprovider_wave.lo ? Sources/Sound/SoundProviders/soundprovider_wave_session.lo ? Sources/Sound/Unix/.deps ? Sources/Sound/Unix/.dirstamp ? Sources/Sound/Unix/.libs ? Sources/Sound/Unix/soundoutput_oss.lo ? Sources/Sound/Win32/.deps ? Tests/FontTest/Intermediate ? Tests/FontTest/fonttest ? Tests/TextStylerTest/ts Index: Documentation/Overview/pointers.xml =================================================================== RCS file: /var/lib/cvs/Libs/ClanLib-0.7/Documentation/Overview/pointers.xml,v retrieving revision 1.1 diff -u -3 -p -u -r1.1 pointers.xml --- Documentation/Overview/pointers.xml 10 Sep 2003 11:31:23 -0000 1.1 +++ Documentation/Overview/pointers.xml 11 Sep 2003 04:35:53 -0000 @@ -43,9 +43,9 @@ give the classes you plan to do this wit CL_SharedPtr d = new MaBob; //Works just like it would with a regular Thing* -

Preparing classes for use in CL_UniquableSharedPtr, CL_LazyCopyPtr, and CL_OwningPtr

+

Preparing classes for use in CL_LazyCopyPtr and CL_OwningPtr

-

To make your classes usable in the other three ClanLib smart pointer types, it's important that the classes you +

To make your classes usable in the other two ClanLib smart pointer types, it's important that the classes you use in the smart pointers descend (directly or indirectly) from CL_Clonable, and implement a very specific clone() method at the start of their definitions. For example, if you have a class called Thing, and intended to use it in a smart pointer, it would look like so:

@@ -95,19 +95,6 @@ a = new Thing(2); //The older Thing(1) i a = 0; //Now the Thing(2) is also safely destroyed -

CL_UniquableSharedPtr : Uniquable Sharing Pointer

- -

CL_UniquableSharedPtr has very similar functionality to CL_SharedPtr, but has an additional method, uniquify(). This -method causes the CL_UniquableSharedPtr to branch off its own copy of the data and start a new, different shared cache -with it.

- - -CL_UniquableSharedPtr a = new Thing; -CL_UniquableSharedPtr b = a; //There's only one instance of Thing being pointed to by both a and b -CL_UniquableSharedPtr c = b; //Still only one instance of Thing, being pointed to by all three pointers -b.uniquify(); //Now there's two instances of Thing, one pointed to by a and c, the other pointed to by b - -

CL_LazyCopyPtr : Copy-on-write Pointer

CL_LazyCopyPtr has the same usage semantics as CL_OwningPtr; you can replace the text CL_OwningPtr with CL_LazyCopyPtr in your Index: Examples/Font/font.cpp =================================================================== RCS file: /var/lib/cvs/Libs/ClanLib-0.7/Examples/Font/font.cpp,v retrieving revision 1.11 diff -u -3 -p -u -r1.11 font.cpp --- Examples/Font/font.cpp 5 Sep 2003 20:10:33 -0000 1.11 +++ Examples/Font/font.cpp 11 Sep 2003 04:35:53 -0000 @@ -36,9 +36,9 @@ public: // Draw the text with its upper-left corner at 25, 25 font1.draw(25, 25, "ClanLib: Phear the Power!"); - - font2.draw(5, 155, "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZzĈĉĜĝĊċ0123456789[]()!#$&%/\\=-+~'`\".,:;*?"); - + + font2.draw(25, 155, "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZzĈĉĜĝĊċ0123456789[]()!#$&%/\\=-+~'`\";.,:;*?"); + CL_Display::flip(); CL_System::keep_alive(15); } Index: Examples/Font/font.xml =================================================================== RCS file: /var/lib/cvs/Libs/ClanLib-0.7/Examples/Font/font.xml,v retrieving revision 1.6 diff -u -3 -p -u -r1.6 font.xml --- Examples/Font/font.xml 4 Sep 2003 21:52:42 -0000 1.6 +++ Examples/Font/font.xml 11 Sep 2003 04:35:53 -0000 @@ -4,7 +4,7 @@ - + @@ -12,8 +12,9 @@ - + + Index: Examples/Font/font1.tga =================================================================== RCS file: /var/lib/cvs/Libs/ClanLib-0.7/Examples/Font/font1.tga,v retrieving revision 1.1 diff -u -3 -p -u -r1.1 font1.tga Binary files /tmp/cvsobgnUW and font1.tga differ Index: Examples/Font/font2.tga =================================================================== RCS file: /var/lib/cvs/Libs/ClanLib-0.7/Examples/Font/font2.tga,v retrieving revision 1.1 diff -u -3 -p -u -r1.1 font2.tga Binary files /tmp/cvsh4t0AT and font2.tga differ Index: Sources/API/Makefile.am =================================================================== RCS file: /var/lib/cvs/Libs/ClanLib-0.7/Sources/API/Makefile.am,v retrieving revision 1.48 diff -u -3 -p -u -r1.48 Makefile.am --- Sources/API/Makefile.am 8 Sep 2003 20:25:51 -0000 1.48 +++ Sources/API/Makefile.am 11 Sep 2003 04:35:54 -0000 @@ -216,6 +216,10 @@ clanCore_includes = \ Core/System/cl_assert.h \ Core/System/log.h \ Core/System/cl_library.h \ + Core/System/clonable.h \ + Core/System/lazycopyptr.h \ + Core/System/owningptr.h \ + Core/System/sharedptr.h \ Core/Resources/resource.h \ Core/Resources/resourcetype_boolean.h \ Core/Resources/resourcetype_integer.h \ Index: Sources/API/core.h =================================================================== RCS file: /var/lib/cvs/Libs/ClanLib-0.7/Sources/API/core.h,v retrieving revision 1.57 diff -u -3 -p -u -r1.57 core.h --- Sources/API/core.h 8 Sep 2003 20:23:31 -0000 1.57 +++ Sources/API/core.h 11 Sep 2003 04:35:54 -0000 @@ -61,6 +61,10 @@ #include "Core/System/cl_library.h" #include "Core/System/crash_reporter.h" #include "Core/System/call_stack.h" +#include "Core/System/clonable.h" +#include "Core/System/lazycopyptr.h" +#include "Core/System/owningptr.h" +#include "Core/System/sharedptr.h" #include "Core/IOData/datatypes.h" #include "Core/IOData/cl_endian.h" Index: Sources/API/Core/System/lazycopyptr.h =================================================================== RCS file: /var/lib/cvs/Libs/ClanLib-0.7/Sources/API/Core/System/lazycopyptr.h,v retrieving revision 1.1 diff -u -3 -p -u -r1.1 lazycopyptr.h --- Sources/API/Core/System/lazycopyptr.h 10 Sep 2003 11:31:24 -0000 1.1 +++ Sources/API/Core/System/lazycopyptr.h 11 Sep 2003 04:35:54 -0000 @@ -1,4 +1,4 @@ - /* $Id: lazycopyptr.h,v 1.1 2003/09/10 11:31:24 mbn Exp $ +/* $Id: lazycopyptr.h,v 1.1 2003/09/10 11:31:24 mbn Exp $ ** ** ClanLib Game SDK ** Copyright (C) 2003 The ClanLib Team Index: Sources/API/Core/System/owningptr.h =================================================================== RCS file: /var/lib/cvs/Libs/ClanLib-0.7/Sources/API/Core/System/owningptr.h,v retrieving revision 1.1 diff -u -3 -p -u -r1.1 owningptr.h --- Sources/API/Core/System/owningptr.h 10 Sep 2003 11:31:24 -0000 1.1 +++ Sources/API/Core/System/owningptr.h 11 Sep 2003 04:35:54 -0000 @@ -39,7 +39,7 @@ template cl //- the CL_OwningPtr takes full control over that data. The original pointer shouldn't //- be used to access or delete the data anymore; instead, use the CL_OwningPtr.

CL_OwningPtr() : ptr(0) {} - CL_OwningPtr(CL_OwningPtr& other) : ptr((T*)(other.ptr->clone())) {} + CL_OwningPtr(const CL_OwningPtr& other) : ptr((T*)(other.ptr->clone())) {} CL_OwningPtr(T* t) : ptr(t) {} ~CL_OwningPtr() {delete ptr;} Index: Sources/API/Core/System/sharedptr.h =================================================================== RCS file: /var/lib/cvs/Libs/ClanLib-0.7/Sources/API/Core/System/sharedptr.h,v retrieving revision 1.1 diff -u -3 -p -u -r1.1 sharedptr.h --- Sources/API/Core/System/sharedptr.h 10 Sep 2003 11:31:24 -0000 1.1 +++ Sources/API/Core/System/sharedptr.h 11 Sep 2003 04:35:54 -0000 @@ -41,7 +41,7 @@ template cl //- the CL_SharedPtr takes full control over that data. The original pointer shouldn't //- be used to access or delete the data anymore; instead, use the CL_SharedPtr.

CL_SharedPtr() : ptr(0) {} - CL_SharedPtr(CL_SharedPtr& other) : ptr(other.ptr), pRefCnt(other.pRefCnt) {increment();} + CL_SharedPtr(const CL_SharedPtr& other) : ptr(other.ptr), pRefCnt(other.pRefCnt) {increment();} CL_SharedPtr(T* t) : ptr(t), pRefCnt(new unsigned int(1)) {} ~CL_SharedPtr() {decrement();} Index: Sources/Network/Socket/socket.cpp =================================================================== RCS file: /var/lib/cvs/Libs/ClanLib-0.7/Sources/Network/Socket/socket.cpp,v retrieving revision 1.17 diff -u -3 -p -u -r1.17 socket.cpp --- Sources/Network/Socket/socket.cpp 9 Sep 2003 12:32:22 -0000 1.17 +++ Sources/Network/Socket/socket.cpp 11 Sep 2003 04:35:54 -0000 @@ -33,6 +33,7 @@ #include "socket_generic.h" #include "API/Core/System/error.h" +#include "API/Core/System/log.h" #include // No socklen_t on MacOSX --------------Boundary-00=_3V81W2X4PGTD5ENKVZQ0 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Clanlib-devel mailing list Clanlib-devel@clanlib.org http://clanlib.org/mailman/listinfo/clanlib-devel --------------Boundary-00=_3V81W2X4PGTD5ENKVZQ0--