propose to rename natPlainSocketImpl to natPosixPlainSocketImpl

Adam Megacz gcj@lists.megacz.com
Fri Feb 1 15:32:00 GMT 2002


Bryce McKinlay <bryce@waitaki.otago.ac.nz> writes:
> >As far as I can tell, the code overlap rules aren't too simple. If you
> >force each platform to have a seperate file, you wind up with a lot of
> >code duplication. By keeping all the code for java.io.File in one
> >place, you can use #ifdefs to control code sharing -- sometimes Win32
> >and POSIX use the same code, other times they don't.

> In cases where much of the implementation is the same, but a few key 
> functions are different (eg natSystem.cc), an alternative would be to 
> have a .cc and .h file at the top level (posix.cc/posix.h, 
> win32.cc/win32.h, etc) which contain implementations of various 
> platform-specific functions, much the same way as the threads/GC 
> interface works currently.

You're saying roll all the platform specific stuff into one file per
platform? I like it. So win32.cc would contain code formerly found
int:

  natWin32Process.cc
  natWin32Socket.cc
  natFileDescriptorWin32.cc
  win32-threads.cc
  portions of prims.cc for which it makes sense to do this [win32_exception_handler()]

Common code would remain in natXXX.cc

This also eliminates the symlink games, and makes porting very
straightforward (just copy posix.cc and rewrite each function from top
to bottom). Heck, there couled even be a template file
"newplatform.cc" with super-verbose comments and empty function bodies
to walk somebody through the porting work.

Code duplication wouldn't be a big issue, even in the case of
"subflavors", since a given platform is usually a subflavor of only
one other platform. So ECOS would be handled as a bunch of ifdef's in
posix.cc. I don't think we're ever going to find a platform that uses
winsock for networking and pthreads for condition variables =)

Would it make sense to have a directory to hold these files?
libjava/plat/*?

I'll volunteer to prepare patches for this as part of my win32 work if
it's agreeable.

  - a



More information about the Java mailing list