View previous topic :: View next topic |
Author |
Message |
afb
Joined: 26 Jan 2005 Posts: 137 Location: Sweden
|
Posted: Tue Mar 29, 2005 5:35 pm Post subject: Suggestion: split OS and API |
|
|
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:
|
|
Back to top |
|
|
sean
Joined: 24 Jun 2004 Posts: 609 Location: Bay Area, CA
|
Posted: Tue Mar 29, 2005 6:07 pm Post subject: |
|
|
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 |
|
|
afb
Joined: 26 Jan 2005 Posts: 137 Location: Sweden
|
Posted: Wed Mar 30, 2005 5:36 am Post subject: |
|
|
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 |
|
|
afb
Joined: 26 Jan 2005 Posts: 137 Location: Sweden
|
Posted: Wed Mar 30, 2005 5:38 am Post subject: |
|
|
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 |
|
|
sean
Joined: 24 Jun 2004 Posts: 609 Location: Bay Area, CA
|
Posted: Wed Mar 30, 2005 9:35 am Post subject: |
|
|
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 |
|
|
afb
Joined: 26 Jan 2005 Posts: 137 Location: Sweden
|
Posted: Wed Mar 30, 2005 11:56 am Post subject: |
|
|
What was extreme there ? (I listed my actual directories) |
|
Back to top |
|
|
sean
Joined: 24 Jun 2004 Posts: 609 Location: Bay Area, CA
|
Posted: Wed Mar 30, 2005 12:47 pm Post subject: |
|
|
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 |
|
|
afb
Joined: 26 Jan 2005 Posts: 137 Location: Sweden
|
Posted: Thu Mar 31, 2005 1:56 am Post subject: |
|
|
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 |
|
|
sean
Joined: 24 Jun 2004 Posts: 609 Location: Bay Area, CA
|
Posted: Thu Mar 31, 2005 9:46 am Post subject: |
|
|
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 |
|
|
afb
Joined: 26 Jan 2005 Posts: 137 Location: Sweden
|
Posted: Wed May 04, 2005 4:03 am Post subject: |
|
|
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 |
|
|
|