Mud++ v0.15 "What I did to make this work under Win32" by jwo@netcom.com (version 2, started over again on 10/16/96) (covers major issues, not piddly changes) (for all the piddly changes, ask for the modified files and search for WIN32, _MSC_VER, and __SC__). 1) Started with MSVC++ 4.0 Standard Edition. 2) Renamed all the *.cc files to *.cpp files. (This is some sort of peculiarity to MSVC++) 3) Added compiler directives to many files using the #ifdef or #ifndef with the compile definition WIN32. 4) Declared bool and true/false in config.h. 5) #define(d) WIN32_LEAN_AND_MEAN and WIN32_EXTRA_LEAN preprocessor directives globally (i.e. command line) This will reduce namespace conflicts between windows and mudpp headers. May have to undefine for specific files. 6) Added #ifndef CONFIG_H to the top of config.h to prevent circular redefinition of true/false and other defines. 7) In file pc.h there is a forward declaration for class PC. Within a structure (command_type)that is forward declared just after it there is a forward declaration of a function pointer (PC::* fun)( const String & ). In order to be more compliant with ANSI C++ (spec or rfc?) the class must be defined before the declaration of the reference-to-member OR the storage allocation for the class pointers must be declared (thus the __virtual_inheritance keyword). So we end up with: class __virtual_inheritance PC; for the WIN32 version (using #defines of course :) 8) MSVC++ doesn't have arpa/*.h includes. Borrowed telnet.h from another project and created an arpa directory. 9) random.h. MSVC++ doesn't offer gettimeofday. Using _ftime instead and converting. Could also have hacked srand() and rand() standard routines into this file (maybe will do if time hack is unacceptable.) 10) cluster.cpp. using _ftime as in (9). 11) Added UFC-like versions of crypt() to the project. MSVC++ does not offer encryption. Added crypt.c, crypt_util.c, and ufc-crypt.h. Removed references to patchlevel.h from the files. 12) (intentionally blank) 13) In io.cpp there is a #define to exclude mmap (HAVE_MMAP) but not one for excluding munmap. There is one now :) 14) Added file winsock.h to WIN32 project. This is necessary for windows sockets to operate properly. Uncommented the E* macro equivalents to WSAE* equivalents. Discovered name collision with ENAMETOOLONG and ENOTEMPTY. If these are used then will have to #ifdef around them and insert the WSA equivalents. Not sure what to do about distribution of winsock.h. It is copyright Microsoft and all rights reserved. Fortunately it is a standard on windows compilers (or should be). Maybe just directions for hacking it or a diff file is in order. 15) fcntl() is not offered in WIN32. On the bright side there are non- blocking calls concerning sockets, even asynchronous calls under winsock. #define(ing) out fcntl() calls. 16) Put (bool) casts in front of !arg... tests because I was getting 'ambiguous operator' for the String class. 17) fork(), setsid() not offered in windows. This could be emulated with an exec() call into a mud++ service. The problem is that unlike fork() there is no procedure for inheriting the parent thread's streams, files, stack, heap, etc... We may have to settle for a one 'session' program in WIN32. It could be multi-threaded, OR it could be programmed as a 'service' (i.e. a daemon) up front. ---------------------end progress report 1 begin 2 ----------------- Mud++ v0.15* (progress report 2 10/22) "What I did to make this work under Win32" by jwo@netcom.com (covers major issues, not piddly changes) (for all the piddly changes, ask for the modified files and search for WIN32, _MSC_VER, and __SC__). 18) Downloaded v0.16. Diffed WIN32 files versus original v0.15. Patched v0.16 files to include WIN32 changes. --------------------------------------------------------------------- Mud++ v0.16 19) Basically cut out all support for spico/shells. Will have to reinstall later after I get the thing to compile and link. 20) Hacked the template explicit instantiator code in llist.cpp and hash.cpp. MSVC++ does it different (of course) from GNUCC or the Solaris package. --------------------------------------------------------------------- Mud++ v0.16 (progress report 3 10/22 thru 10/29) "What I did to make this work under Win32" by jwo@netcom.com (covers major issues, not piddly changes) (for all the piddly changes, ask for the modified files and search for WIN32, _MSC_VER, and __SC__). 21) WIN32 offers memory mapped files, trying to create them. Hacking CreateFile, CreateFileMapping, MapViewOfFile, CloseHandle, into the IStream class. (didn't work, sticking with mudpp code) 22) In Socket::Socket() initializer there is a call to getsockname() before the socket is bind()ed or accept()ed. This causes an error in Winsock and I have #ifdef(ed) it out for WIN32. Can't put a call to Socket::open here because it is called later. This seems to be a problem only for the master socket. I could bind() it to INADDR_ANY (0.0.0.0) but this is really meaningless. 23) sysconf() is not available in Winsock. WSADATA.iMaxSockets returned by WSAStartup() is the max number of sockets available to the entire operating system. I am not aware of a per-process method of getting available sockets. 24) Server.maxdesc is set in the Server::Server() initialization even before it is possible to initialize Winsock. This makes WSADATA.iMaxSockets invalid (or zero). Created another member function Server::setmaxdesc(int) to allow maxdesc to be set after instantiation of server, and after initialization of Winsock by WSAStartup. 25) The following UN*X I/O commands that are found to work with BSD sockets do not work with Winsock sockets. The reason is that a SOCKET in Winsock is not required to be a file descriptor: read(), write(), readv(), writev(), close(), fcntl(). Replacements that I will use: read() --> recv() (non-blocking) write()--> send() (non-blocking) close()--> closesocket() (non-blocking) fcntl()--> ioctlsocket() (writev and readv will be coded around if they are ever used) 26) Converted errno() calls germaine to Winsock to WSAGetLastError() calls. 27) Replaced call to server.sleep(PULSE) with a set of instructions designed to monitor time every game loop rather than throw the application into "sleep". WIN32's method of handling the calls to select() wouldn't reduce the amount of processing time given to the thread anyway. Probably breaking up functions that could be performed in parallel, such as input and output for each socket, into worker threads and assigning them lower priority (e.g. "nice") would serve the same function. ------------------------------------------------------------------------ Mud++ v0.16 (progress report 4 10/29/96 thru 11/17/96) "What I did to make this work under Win32" by jwo@netcom.com (covers major issues, not piddly changes) (for all the piddly changes, ask for the modified files and search for WIN32, _MSC_VER, and __SC__). 28) Ported to Symantec C++ 7.2. In doing so discovered things specific to MSVC++ and SC++. Added #ifdefs _MSC_VER and __SC__ to take care of compiler specific problems. So some of the things that I thought were endemic to WIN32 are specific compiler problems. 29) When name-mangling templated class member functions declared as "inline const", Symantec C++ 7.x has a problem at link time. Solve this by #ifdef-ing out the "inline" keyword. Probably some small performance hit is taken, but SC++ produces fast code.