FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Suggestion: split OS and API

 
Post new topic   Reply to topic     Forum Index -> Ares
View previous topic :: View next topic  
Author Message
afb



Joined: 26 Jan 2005
Posts: 137
Location: Sweden

PostPosted: Tue Mar 29, 2005 5:35 pm    Post subject: Suggestion: split OS and API Reply with quote

Currently, Phobos/Ares is divided by operating system.
(notably: windows and linux, even if unix is used in Ares)

It would make sense to minimize that, and instead focus
on the two main APIs being used: Win32 and Posix...

(Note that Win32 APIs can be used on Linux, with "Wine".
And that e.g. Linux and Darwin can share a lot of code)

See http://www.prowiki.org/wiki4d/wiki.cgi?DocComments/Version

OS:

  • Windows
  • linux
  • cygwin
  • darwin
  • freebsd
  • solaris


API:

  • win32
  • posix
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Tue Mar 29, 2005 6:07 pm    Post subject: Reply with quote

It's a good idea, though we may be stuck with doing both. The standard C headers, at least, will need to be OS dependent rather than API dependent.
Back to top
View user's profile Send private message
afb



Joined: 26 Jan 2005
Posts: 137
Location: Sweden

PostPosted: Wed Mar 30, 2005 5:36 am    Post subject: Reply with quote

Oh, we probably would be stuck with both still...
Just that it could lessen some of the redundancy
between the various UNIX platforms outside Linux.

There could also be need for a "macosx" directory,
for adding mappings to the functions outside Darwin.
(since "darwin" is just the BSD subset of Mac OS X)

And the C library just lives in "std.c.*", so it's outside
both of the OS and the API hierarchies anyway....
Back to top
View user's profile Send private message
afb



Joined: 26 Jan 2005
Posts: 137
Location: Sweden

PostPosted: Wed Mar 30, 2005 5:38 am    Post subject: Reply with quote

For reference, here is the directories from GDC on Mac OS X:

Code:

/opt/gdc/include/d/etc
/opt/gdc/include/d/etc/c
/opt/gdc/include/d/gcc
/opt/gdc/include/d/std
/opt/gdc/include/d/std/c
/opt/gdc/include/d/std/c/darwin
/opt/gdc/include/d/std/c/linux
/opt/gdc/include/d/std/c/mach
/opt/gdc/include/d/std/c/windows
/opt/gdc/include/d/std/typeinfo
/opt/gdc/include/d/std/windows


etc/c only holds zlib.d, which is now "on the run" from std.c.zlib,
and when it's returned to the proper place - etc will be empty...
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Wed Mar 30, 2005 9:35 am    Post subject: Reply with quote

That seems a bit extreme. It would be nice to have a single instance of each header name whenever possible. I'd expect to only have one pthread.d for example.
Back to top
View user's profile Send private message
afb



Joined: 26 Jan 2005
Posts: 137
Location: Sweden

PostPosted: Wed Mar 30, 2005 11:56 am    Post subject: Reply with quote

What was extreme there ? (I listed my actual directories)
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Wed Mar 30, 2005 12:47 pm    Post subject: Reply with quote

Why have a darwin directory, linux directory, and a mach directory? And why all on the same level? Is it really necessary that there be functionality specific to each of those designations?
Back to top
View user's profile Send private message
afb



Joined: 26 Jan 2005
Posts: 137
Location: Sweden

PostPosted: Thu Mar 31, 2005 1:56 am    Post subject: Reply with quote

sean wrote:
Why have a darwin directory, linux directory, and a mach directory? And why all on the same level? Is it really necessary that there be functionality specific to each of those designations?


That's how the current Phobos works, it is split on OS...
For GDC, that means that it'll have 4 extra directories.

# Windows
# linux
# darwin
# freebsd
# cygwin
# solaris

And you also need to have the similiar OS-based versioning in
all source code using them, which is why I posted this thread ?

Code:

version (Windows)
   private import std.c.windows.windows;
else version (linux)
   private import std.c.linux.linux;
else version (darwin)
   private import std.c.darwin.darwin;
else static assert (0);


Didn't bother copy/pasting the other three, I'm sure you understand.
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Thu Mar 31, 2005 9:46 am    Post subject: Reply with quote

Gotcha. The wording of your last post threw me a bit. I agree that having things be OS specific is a bad idea.
Back to top
View user's profile Send private message
afb



Joined: 26 Jan 2005
Posts: 137
Location: Sweden

PostPosted: Wed May 04, 2005 4:03 am    Post subject: Reply with quote

GDC has now switched to using Unix
and std.c.unix, instead of several...

So instead of "version(linux)", it is "version(Unix)"
and instead of "std.c.linux.linux" it is "std.c.unix"
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Ares All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group