[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XTL 1.3.pl.2



> This is a development version. Changes are:
>  - several fixes by Allan Rae;
>  - some preliminary support for Windows.
>
> Disclaimer: I don't have Windows installed, so consider these
> changes as experimental. With them I try to address the sugestions
> of Asger Nielsen. If any of you are using XTL in Windows, please
> let me know what you think.

This is much better than XTL 1.2 for Windows.

I attach a patch which makes things almost compile.
It introduces a "byteswap.h" file with some dummy stubs for the byteswap
primitives.
Also, it fixes a few things in the WIN32 config-branch.

Then there are a few namespace errors corrected, and finally the
non-standard "ull" suffix for long long numbers has been replaced with
an ugly shift construct.

Finally, I add a so-called project file for the Microsoft Visual C++
compiler. This corresponds to makefiles on Unix.

However, I still have a few problems:

--
giopi.cpp
d:\test\xtl\include\xtl\giop.h(60) : error C2258: illegal pure syntax,
must be '= 0'
        d:\test\xtl\include\xtl\giop.h(197) : see reference to class
template instantiation 'GIOP_format<Buffer>' being compiled
d:\test\xtl\include\xtl\giop.h(60) : error C2252: 'preferred' : pure
specifier can only be specified for functions
        d:\test\xtl\include\xtl\giop.h(197) : see reference to class
template instantiation 'GIOP_format<Buffer>' being compiled
--

The static initialization of member variables is not supported.  Maybe
we can use an enum  or define instead?

Another problem:

--
d:\test\xtl\examples\tests\giopi.cpp(23) : error C2664: 'class
obj_input<class GIOP_format<class mem_buffer>,class no_refs> &__thiscall
obj_input<class GIOP_format<class mem_buffer>,class
no_refs>::simple(bool &)' : cannot convert parameter 1 from '
class all_tests' to 'bool &'
        A reference that is not to 'const' cannot be bound to a
non-lvalue
giopo.cpp
--

And the final problem:

--
d:\test\xtl\examples\tests\giopo.cpp(23) : error C2664: 'class
obj_output<class GIOP_format<class mem_buffer>,class no_refs>
&__thiscall obj_output<class GIOP_format<class mem_buffer>,class
no_refs>::simple(const bool &)' : cannot convert parameter 
1 from 'const class all_tests' to 'const bool &'
        Reason: cannot convert from 'const class all_tests' to 'const
bool'
        No user-defined-conversion operator available that can perform
this conversion, or the operator cannot be called
--

I do not have time to look into this in detail right now, but it seems
that we might have to add some ugly type casts.

Greets,

Asger
diff -Nur xtl-1.3.pl.2/README xtl/README
--- xtl-1.3.pl.2/README	Tue Mar 21 14:32:04 2000
+++ xtl/README	Tue Mar 21 14:35:13 2000
@@ -29,7 +29,7 @@
 
 	PPRO 200 Mhz + output -> membuffer + size ~= 280 bytes
 
-	   			       -O16   not opt
+                       -O16   not opt
              memcpy   2.8 us   2.2 us
           *XTL* XDR   9.3 us  47.7 us
  *XTL* "little" XDR   7.8 us  45.8 us
@@ -37,7 +37,7 @@
             Sun XDR  25.0 us  28.5 us
 
 For more information and to download a distribution, visit
-http:/gil.di.uminho.pt/~jop/xtl/ . 
+http://gil.di.uminho.pt/~jop/xtl/ . 
 
 Files under /include and /doc are distributed acording to
 the GNU LGPL. See COPYING.LIB for licensing details.
diff -Nur xtl-1.3.pl.2/examples/alltests.h xtl/examples/alltests.h
--- xtl-1.3.pl.2/examples/alltests.h	Thu Mar  2 16:24:18 2000
+++ xtl/examples/alltests.h	Tue Mar 21 15:02:40 2000
@@ -14,7 +14,7 @@
 #include <list>
 #include <map>
 #include <string>
-#include <pair.h>
+#include <utility>
 
 class numbers {
  private:
@@ -23,7 +23,7 @@
 	char aShort; unsigned short anUShort;
 	int anInt; unsigned int anUInt;
 	long aLong; unsigned long anULong;
-	long long aLongLong; unsigned long long anULongLong;
+	longlong aLongLong; unsignedlonglong anULongLong;
 	float aFloat;
 	double aDouble;
 
@@ -38,8 +38,8 @@
 		aShort=-3; anUShort=4;
 		anInt=-5; anUInt=6;
 		aLong=-9; anULong=10;
-		aLongLong=-11; anULongLong=123456789012ull;
-		aFloat=13.14;
+		aLongLong=-11; anULongLong= unsignedlonglong(12345678ul << 32) | 9012ul;
+		aFloat=13.14f;
 		aDouble=15.16;
 	}
 
@@ -67,7 +67,7 @@
  private:
  	char* ptr;
 	char sptr[100];
-	string cpp;
+	std::string cpp;
 
  public:
  	strings(): ptr((char*)0) {}
@@ -182,15 +182,15 @@
 
 class containers {
  private:
- 	list<int> lint;
- 	map<int,int> mint;
+	std::list<int> lint;
+	std::map<int,int> mint;
 
  public:
 	void init() {
 		for(int i=0;i<10;i++)
 			lint.insert(lint.end(),i);
 		for(int i=0;i<10;i++) 
-			mint.insert(pair<int,int>(i,i*2));
+			mint.insert(std::pair<int,int>(i,i*2));
 	}
 
 	template <class Stream>
@@ -221,7 +221,7 @@
 
 	void init() {
 		discr=1;
-		val.fval=1.1;
+		val.fval=1.1f;
 	}
 
 	template <class Stream>
diff -Nur xtl-1.3.pl.2/examples/tests/compare.cpp xtl/examples/tests/compare.cpp
--- xtl-1.3.pl.2/examples/tests/compare.cpp	Tue Nov 30 13:46:49 1999
+++ xtl/examples/tests/compare.cpp	Tue Mar 21 15:05:14 2000
@@ -9,10 +9,11 @@
 
 
 #include <xtl/objio.h>
+#include <iostream>
 
 #include "../alltests.h"
 
 void compare(const all_tests& to, const all_tests& ti) {
-	cout<<(to==ti?"PASSED":"Failed")<<endl;
+	std::cout<<(to==ti?"PASSED":"Failed")<<std::endl;
 }
 
diff -Nur xtl-1.3.pl.2/examples/tests/main.cpp xtl/examples/tests/main.cpp
--- xtl-1.3.pl.2/examples/tests/main.cpp	Thu Mar  2 16:24:18 2000
+++ xtl/examples/tests/main.cpp	Tue Mar 21 15:04:22 2000
@@ -47,6 +47,7 @@
 	xos.simple(ti);
 	buf[xmbo.size()]=0;
 	cout<<buf<<endl;
-#endif
+#endif
+	return 0;
 }
 
diff -Nur xtl-1.3.pl.2/include/xtl/byteswap.h xtl/include/xtl/byteswap.h
--- xtl-1.3.pl.2/include/xtl/byteswap.h	Thu Jan  1 01:00:00 1970
+++ xtl/include/xtl/byteswap.h	Tue Mar 21 14:58:36 2000
@@ -0,0 +1,28 @@
+#ifndef BYTESWAP_H
+#define BYTESWAP_H
+
+#ifndef XTL_CONFIG_LACK_ENDIAN_H
+
+#include <endian.h>
+#include <byteswap.h>
+
+#else
+
+unsigned short bswap_16(unsigned short b) {
+	// TODO: Use ntons
+	return b;
+}
+
+unsigned int bswap_32(unsigned int b) {
+	// TODO: Use ntonl
+	return b;
+}
+
+unsignedlonglong bswap_64(unsignedlonglong b) {
+	// TODO: Implement by hand
+	return b;
+}
+
+#endif
+
+#endif
diff -Nur xtl-1.3.pl.2/include/xtl/config.h xtl/include/xtl/config.h
--- xtl-1.3.pl.2/include/xtl/config.h	Tue Mar 21 14:32:04 2000
+++ xtl/include/xtl/config.h	Tue Mar 21 15:02:11 2000
@@ -34,13 +34,26 @@
 #	if __GNUC__ >2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >=95 ) // >= G++ 2.95
 #		define XTL_CONFIG_SIMPLE_CONTAINERS
 #	endif
+
 typedef long long longlong;
 typedef unsigned long long unsignedlonglong;
+
 #elif defined (_WIN32)
-#	define XTL_CONFIG_COMPOSITE_BUG
-#include <.h needed for INT64/UINT64>
-typedef INT64 longlong;
-typedef UINT64 unsignedlonglong;
+
+#	define XTL_CONFIG_COMPOSITE_BUG
+#   define XTL_CONFIG_LACK_ENDIAN_H
+typedef __int64  longlong;
+typedef unsigned __int64  unsignedlonglong;
+
+// Disable some stupid warnings
+#pragma warning(disable:4127 4786 4800)
+
+// Work around for broken for-scoping with Visual C++ 6.0
+#define for if(0);else for
+
+// Enable a bunch of useful warnings
+#pragma warning(3:4019 4032 4057 4061 4125 4130 4152 4189 4201 4706)
+
 #endif
 
 #endif
diff -Nur xtl-1.3.pl.2/include/xtl/giop.h xtl/include/xtl/giop.h
--- xtl-1.3.pl.2/include/xtl/giop.h	Tue Mar 21 14:32:04 2000
+++ xtl/include/xtl/giop.h	Tue Mar 21 14:53:44 2000
@@ -27,9 +27,8 @@
 
 #ifndef __XTL_GIOP
 #define __XTL_GIOP
-
-#include <endian.h>
-#include <byteswap.h>
+
+#include "byteswap.h"
 
 // This is global because g++ is buggy...
 inline void GIOP_format_n2hs(bool end, bool pref, char in[2], short* out) {
diff -Nur xtl-1.3.pl.2/include/xtl/xdr.h xtl/include/xtl/xdr.h
--- xtl-1.3.pl.2/include/xtl/xdr.h	Tue Mar 21 14:32:04 2000
+++ xtl/include/xtl/xdr.h	Tue Mar 21 14:55:41 2000
@@ -29,8 +29,7 @@
 #define __XTL_XDR
 
 #include <cstring>
-#include <endian.h>
-#include <byteswap.h>
+#include "byteswap.h"
 
 // This is global because g++ is buggy...
 #if (__BYTE_ORDER == __LITTLE_ENDIAN)
diff -Nur xtl-1.3.pl.2/xtl.dsp xtl/xtl.dsp
--- xtl-1.3.pl.2/xtl.dsp	Thu Jan  1 01:00:00 1970
+++ xtl/xtl.dsp	Tue Mar 21 15:08:52 2000
@@ -0,0 +1,281 @@
+# Microsoft Developer Studio Project File - Name="xtl" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=xtl - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "xtl.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "xtl.mak" CFG="xtl - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "xtl - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "xtl - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=xicl6.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "xtl - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GR /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x406 /d "NDEBUG"
+# ADD RSC /l 0x406 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=xilink6.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF  "$(CFG)" == "xtl - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GR /GX /ZI /Od /I "include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x406 /d "_DEBUG"
+# ADD RSC /l 0x406 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=xilink6.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF 
+
+# Begin Target
+
+# Name "xtl - Win32 Release"
+# Name "xtl - Win32 Debug"
+# Begin Group "examples"
+
+# PROP Default_Filter ""
+# Begin Group "auto"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\examples\auto\auto.cpp
+
+# PROP Exclude_From_Build 1
+
+# End Source File
+# End Group
+# Begin Group "bench"
+
+# PROP Default_Filter ""
+# Begin Group "memcpy"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\examples\bench\memcpy\tests.cpp
+
+# PROP Exclude_From_Build 1
+
+# End Source File
+# End Group
+# Begin Group "rpcgen"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\examples\bench\rpcgen\tests.c
+
+# PROP Exclude_From_Build 1
+
+# End Source File
+# End Group
+# Begin Group "vxtl"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\examples\bench\vxtl\giop.cpp
+
+# PROP Exclude_From_Build 1
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\examples\bench\vxtl\raw.cpp
+
+# PROP Exclude_From_Build 1
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\examples\bench\vxtl\xdr.cpp
+
+# PROP Exclude_From_Build 1
+
+# End Source File
+# End Group
+# Begin Group "xtl"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\examples\bench\xtl\giop.cpp
+
+# PROP Exclude_From_Build 1
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\examples\bench\xtl\raw.cpp
+
+# PROP Exclude_From_Build 1
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\examples\bench\xtl\xdr.cpp
+
+# PROP Exclude_From_Build 1
+
+# End Source File
+# End Group
+# End Group
+# Begin Group "graph"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\examples\graph\gtest.cpp
+
+# PROP Exclude_From_Build 1
+
+# End Source File
+# End Group
+# Begin Group "smart"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\examples\smart\smart.cpp
+
+# PROP Exclude_From_Build 1
+
+# End Source File
+# End Group
+# Begin Group "tests"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\examples\tests\compare.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\examples\tests\giopi.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\examples\tests\giopo.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\examples\tests\main.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\examples\tests\rawi.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\examples\tests\rawo.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\examples\tests\xdri.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\examples\tests\xdro.cpp
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\examples\alltests.h
+# End Source File
+# End Group
+# Begin Group "include"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\include\xtl\autoio.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\xtl\byteswap.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\xtl\config.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\xtl\giop.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\xtl\graphio.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\xtl\macros.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\xtl\objio.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\xtl\text.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\xtl\vobjio.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\xtl\xdr.h
+# End Source File
+# End Group
+# End Target
+# End Project