Deprecate std.c.* and move all remaining declarations to core.stdc.*

This commit is contained in:
Joakim 2014-09-17 12:44:13 -05:00
parent a5cd0d85ff
commit 093d636de4
41 changed files with 176 additions and 750 deletions

View file

@ -116,7 +116,7 @@ alias socket_t curl_socket_t;
/// jdrewsen - Would like to get socket error constant from std.socket by it is private atm. /// jdrewsen - Would like to get socket error constant from std.socket by it is private atm.
version(Windows) { version(Windows) {
private import std.c.windows.windows, std.c.windows.winsock; private import core.sys.windows.windows, std.c.windows.winsock;
enum CURL_SOCKET_BAD = SOCKET_ERROR; enum CURL_SOCKET_BAD = SOCKET_ERROR;
} }
version(Posix) enum CURL_SOCKET_BAD = -1; version(Posix) enum CURL_SOCKET_BAD = -1;

View file

@ -1,5 +1,7 @@
/** /**
* $(RED Deprecated. Please use $(D core.stdc.fenv) instead. This module will
* be removed in December 2015.)
* C's <fenv.h> * C's <fenv.h>
* Authors: Walter Bright, Digital Mars, http://www.digitalmars.com * Authors: Walter Bright, Digital Mars, http://www.digitalmars.com
* License: Public Domain * License: Public Domain
@ -7,6 +9,7 @@
* WIKI=Phobos/StdCFenv * WIKI=Phobos/StdCFenv
*/ */
deprecated("Please import core.stdc.fenv instead. This module will be removed in December 2015.")
module std.c.fenv; module std.c.fenv;
public import core.stdc.fenv; public import core.stdc.fenv;

View file

@ -4,41 +4,11 @@
* This module is just for making std.socket work under FreeBSD, and these * This module is just for making std.socket work under FreeBSD, and these
* definitions should actually be in druntime. (core.sys.posix.netdb or sth) * definitions should actually be in druntime. (core.sys.posix.netdb or sth)
*/ */
deprecated("Please import the core.sys.posix.* modules you need instead. This module will be removed in April 2015.")
module std.c.freebsd.socket; module std.c.freebsd.socket;
public import core.sys.posix.netdb; public import core.sys.posix.netdb;
import core.sys.posix.sys.socket; public import core.sys.posix.sys.socket : AF_APPLETALK, AF_IPX, SOCK_RDM, MSG_NOSIGNAL;
public import core.sys.posix.netinet.in_ : IPPROTO_IGMP, IPPROTO_GGP,
extern(C): IPPROTO_PUP, IPPROTO_IDP, IPPROTO_ND,
IPPROTO_MAX, INADDR_LOOPBACK, INADDR_NONE;
enum // <sys/socket.h> __BSD_VISIBLE
{
AF_APPLETALK = 16,
AF_IPX = 23,
}
enum // <sys/socket.h> __BSD_VISIBLE
{
SOCK_RDM = 4,
}
enum // <sys/socket.h> __BSD_VISIBLE
{
MSG_NOSIGNAL = 0x20000,
}
enum // <netinet/in.h> __BSD_VISIBLE
{
IPPROTO_IGMP = 2,
IPPROTO_GGP = 3,
IPPROTO_PUP = 12,
IPPROTO_IDP = 22,
IPPROTO_ND = 77,
IPPROTO_MAX = 256,
}
enum // <netinet/in.h>
{
INADDR_LOOPBACK = 0x7f000001,
INADDR_NONE = 0xffffffff,
}

View file

@ -6,9 +6,10 @@
* countries. * countries.
*/ */
deprecated("Please import the core.sys.posix.* modules you need instead. This module will be removed in April 2015.")
module std.c.linux.linux; module std.c.linux.linux;
public import std.c.linux.pthread; public import core.sys.posix.pthread;
extern (C) extern (C)
{ {
@ -17,7 +18,6 @@ extern (C)
void* __libc_stack_end; void* __libc_stack_end;
int __data_start; int __data_start;
int _end; int _end;
int timezone;
void *_deh_beg; void *_deh_beg;
void *_deh_end; void *_deh_end;

View file

@ -10,6 +10,7 @@
* Put them separate so they'll be externed - do not link in linuxextern.o * Put them separate so they'll be externed - do not link in linuxextern.o
*/ */
deprecated("Please remove this import. This module is empty and will be removed in April 2015.")
module std.c.linux.linuxextern; module std.c.linux.linuxextern;
// No longer needed since "extern" storage class // No longer needed since "extern" storage class

View file

@ -3,10 +3,9 @@
* Placed into public domain. * Placed into public domain.
*/ */
deprecated("Please import core.sys.posix.pthread or the other core.sys.posix.* modules you need instead. This module will be removed in April 2015.")
module std.c.linux.pthread; module std.c.linux.pthread;
import std.c.linux.linux; import std.c.linux.linux;
extern (C):
public import core.sys.posix.pthread; public import core.sys.posix.pthread;

View file

@ -4,6 +4,7 @@
*/ */
deprecated("Please import the core.sys.posix.* modules you need instead. This module will be removed in April 2015.")
module std.c.linux.socket; module std.c.linux.socket;
private import core.stdc.stdint; private import core.stdc.stdint;
@ -16,31 +17,6 @@ public import core.sys.posix.sys.socket;
extern(C): extern(C):
enum: int
{
AF_IPX = 4,
AF_APPLETALK = 5,
PF_IPX = AF_IPX,
PF_APPLETALK = AF_APPLETALK,
}
enum: int
{
SOCK_RDM = 4,
}
enum: int
{
IPPROTO_IGMP = 2,
IPPROTO_GGP = 3,
IPPROTO_PUP = 12,
IPPROTO_IDP = 22,
IPPROTO_ND = 77,
IPPROTO_RAW = 255,
IPPROTO_MAX = 256,
}
int gethostbyname_r(in char* name, hostent* ret, void* buf, size_t buflen, hostent** result, int* h_errnop); int gethostbyname_r(in char* name, hostent* ret, void* buf, size_t buflen, hostent** result, int* h_errnop);
int gethostbyname2_r(in char* name, int af, hostent* ret, void* buf, size_t buflen, hostent** result, int* h_errnop); int gethostbyname2_r(in char* name, int af, hostent* ret, void* buf, size_t buflen, hostent** result, int* h_errnop);
@ -51,11 +27,6 @@ enum: int
SD_BOTH = 2, SD_BOTH = 2,
} }
enum: int
{
MSG_NOSIGNAL = 0x4000,
}
enum: int enum: int
{ {
IP_MULTICAST_LOOP = 34, IP_MULTICAST_LOOP = 34,
@ -86,13 +57,6 @@ enum: int
IPV6_XFRM_POLICY = 35, IPV6_XFRM_POLICY = 35,
} }
enum: uint
{
INADDR_LOOPBACK = 0x7F000001,
INADDR_BROADCAST = 0xFFFFFFFF,
INADDR_NONE = 0xFFFFFFFF,
}
enum: int enum: int
{ {
TCP_NODELAY = 1, // Don't delay send to coalesce packets TCP_NODELAY = 1, // Don't delay send to coalesce packets

View file

@ -1,7 +1,6 @@
deprecated("Please import core.sys.posix.termios instead. This module will be removed in April 2015.")
module std.c.linux.termios; module std.c.linux.termios;
extern (C):
public import core.sys.posix.termios; public import core.sys.posix.termios;

View file

@ -1,4 +1,6 @@
/** /**
* $(RED Deprecated. Please use $(D core.sys.linux.tipc) instead. This module
* will be removed in December 2015.)
* Interface for Linux TIPC sockets, /usr/include/linux/tipc.h * Interface for Linux TIPC sockets, /usr/include/linux/tipc.h
* *
* Copyright: Public Domain * Copyright: Public Domain
@ -6,206 +8,7 @@
* Authors: Leandro Lucarella * Authors: Leandro Lucarella
*/ */
deprecated("Please import core.sys.linux.tipc instead. This module will be removed in December 2015.")
module std.c.linux.tipc; module std.c.linux.tipc;
version (linux): public import core.sys.linux.tipc;
extern (C):
struct tipc_portid
{
uint ref_;
uint node;
}
struct tipc_name
{
uint type;
uint instance;
}
struct tipc_name_seq
{
uint type;
uint lower;
uint upper;
}
struct tipc_subscr
{
tipc_name_seq seq;
uint timeout;
uint filter;
ubyte[8] usr_handle;
}
struct tipc_event
{
uint event;
uint found_lower;
uint found_upper;
tipc_portid port;
tipc_subscr s;
}
struct sockaddr_tipc
{
ushort family;
ubyte addrtype;
byte scope_;
union Addr
{
tipc_portid id;
tipc_name_seq nameseq;
static struct Name
{
tipc_name name;
uint domain;
}
Name name;
}
Addr addr;
}
uint tipc_addr(uint zone, uint cluster, uint node)
{
return (zone << 24) | (cluster << 12) | node;
}
unittest
{
assert (tipc_addr(0, 0, 0) == 0);
assert (tipc_addr(1, 1, 1) == 16781313);
assert (tipc_addr(2, 1, 27) == 33558555);
assert (tipc_addr(3, 1, 63) == 50335807);
}
uint tipc_zone(uint addr)
{
return addr >> 24;
}
unittest
{
assert (tipc_zone(0u) == 0);
assert (tipc_zone(16781313u) == 1);
assert (tipc_zone(33558555u) == 2);
assert (tipc_zone(50335807u) == 3);
}
uint tipc_cluster(uint addr)
{
return (addr >> 12) & 0xfff;
}
unittest
{
assert (tipc_cluster(0u) == 0);
assert (tipc_cluster(16781313u) == 1);
assert (tipc_cluster(33558555u) == 1);
assert (tipc_cluster(50335807u) == 1);
}
uint tipc_node(uint addr)
{
return addr & 0xfff;
}
unittest
{
assert (tipc_node(0u) == 0);
assert (tipc_node(16781313u) == 1);
assert (tipc_node(33558555u) == 27);
assert (tipc_node(50335807u) == 63);
}
enum: int
{
TIPC_CFG_SRV = 0,
TIPC_TOP_SRV = 1,
TIPC_RESERVED_TYPES = 64,
}
enum: int
{
TIPC_ZONE_SCOPE = 1,
TIPC_CLUSTER_SCOPE = 2,
TIPC_NODE_SCOPE = 3,
}
enum: int
{
TIPC_MAX_USER_MSG_SIZE = 66000,
}
enum: int
{
TIPC_LOW_IMPORTANCE = 0,
TIPC_MEDIUM_IMPORTANCE = 1,
TIPC_HIGH_IMPORTANCE = 2,
TIPC_CRITICAL_IMPORTANCE = 3,
}
enum: int
{
TIPC_OK = 0,
TIPC_ERR_NO_NAME = 1,
TIPC_ERR_NO_PORT = 2,
TIPC_ERR_NO_NODE = 3,
TIPC_ERR_OVERLOAD = 4,
TIPC_CONN_SHUTDOWN = 5,
}
enum: int
{
TIPC_SUB_PORTS = 0x01,
TIPC_SUB_SERVICE = 0x02,
TIPC_SUB_CANCEL = 0x04,
}
version (none) enum: int
{
TIPC_SUB_NO_BIND_EVTS = 0x04,
TIPC_SUB_NO_UNBIND_EVTS = 0x08,
TIPC_SUB_SINGLE_EVT = 0x10,
}
enum: int
{
TIPC_WAIT_FOREVER = ~0,
}
enum: int
{
TIPC_PUBLISHED = 1,
TIPC_WITHDRAWN = 2,
TIPC_SUBSCR_TIMEOUT = 3,
}
enum: int
{
AF_TIPC = 30,
PF_TIPC = 30,
SOL_TIPC = 271,
TIPC_ADDR_NAMESEQ = 1,
TIPC_ADDR_MCAST = 1,
TIPC_ADDR_NAME = 2,
TIPC_ADDR_ID = 3,
}
enum: int
{
TIPC_ERRINFO = 1,
TIPC_RETDATA = 2,
TIPC_DESTNAME = 3,
}
enum: int
{
TIPC_IMPORTANCE = 127,
TIPC_SRC_DROPPABLE = 128,
TIPC_DEST_DROPPABLE = 129,
TIPC_CONN_TIMEOUT = 130,
}

View file

@ -1,4 +1,6 @@
/** /**
* $(RED Deprecated. Please use $(D core.stdc.locale) instead. This module will
* be removed in December 2015.)
* C's &lt;locale.h&gt; * C's &lt;locale.h&gt;
* License: Public Domain * License: Public Domain
* Standards: * Standards:
@ -6,6 +8,7 @@
* Macros: * Macros:
* WIKI=Phobos/StdCLocale * WIKI=Phobos/StdCLocale
*/ */
deprecated("Please import core.stdc.locale instead. This module will be removed in December 2015.")
module std.c.locale; module std.c.locale;
public import core.stdc.locale; public import core.stdc.locale;

View file

@ -1,5 +1,7 @@
/** /**
* $(RED Deprecated. Please use $(D core.stdc.math) instead. This module will
* be removed in December 2015.)
* C's &lt;math.h&gt; * C's &lt;math.h&gt;
* Authors: Walter Bright, Digital Mars, www.digitalmars.com * Authors: Walter Bright, Digital Mars, www.digitalmars.com
* License: Public Domain * License: Public Domain
@ -7,6 +9,7 @@
* WIKI=Phobos/StdCMath * WIKI=Phobos/StdCMath
*/ */
deprecated("Please import core.stdc.math instead. This module will be removed in December 2015.")
module std.c.math; module std.c.math;
public import core.stdc.math; public import core.stdc.math;

View file

@ -4,6 +4,7 @@
*/ */
deprecated("Please import the core.sys.posix.* modules you need instead. This module will be removed in April 2015.")
module std.c.osx.socket; module std.c.osx.socket;
private import core.stdc.stdint; private import core.stdc.stdint;
@ -16,35 +17,7 @@ public import core.sys.posix.sys.socket;
extern(C): extern(C):
enum: int // Not defined in OSX, so these will be removed at the end of deprecation
{
AF_IPX = 23,
AF_APPLETALK = 16,
PF_IPX = AF_IPX,
PF_APPLETALK = AF_APPLETALK,
}
enum: int
{
SOCK_RDM = 4,
}
enum: int
{
IPPROTO_IGMP = 2,
IPPROTO_GGP = 3,
IPPROTO_PUP = 12,
IPPROTO_IDP = 22,
IPPROTO_ND = 77,
IPPROTO_RAW = 255,
IPPROTO_MAX = 256,
}
int gethostbyname_r(in char* name, hostent* ret, void* buf, size_t buflen, hostent** result, int* h_errnop);
int gethostbyname2_r(in char* name, int af, hostent* ret, void* buf, size_t buflen, hostent** result, int* h_errnop);
// Not defined in OSX, but we'll use them anyway
enum: int enum: int
{ {
SD_RECEIVE = 0, SD_RECEIVE = 0,
@ -81,10 +54,3 @@ enum: int
IPV6_IPSEC_POLICY = 28, IPV6_IPSEC_POLICY = 28,
//IPV6_XFRM_POLICY = 35, //IPV6_XFRM_POLICY = 35,
} }
enum: uint
{
INADDR_LOOPBACK = 0x7F000001,
INADDR_BROADCAST = 0xFFFFFFFF,
INADDR_NONE = 0xFFFFFFFF,
}

View file

@ -1,5 +1,7 @@
/** /**
* $(RED Deprecated. Please use $(D core.stdc.stdlib) or the core.sys.posix.*
* modules you need instead. This module will be removed in December 2015.)
* C's &lt;process.h&gt; * C's &lt;process.h&gt;
* Authors: Walter Bright, Digital Mars, www.digitalmars.com * Authors: Walter Bright, Digital Mars, www.digitalmars.com
* License: Public Domain * License: Public Domain
@ -7,39 +9,44 @@
* WIKI=Phobos/StdCProcess * WIKI=Phobos/StdCProcess
*/ */
deprecated("Please import core.stdc.stdlib or the core.sys.posix.* modules you need instead. This module will be removed in December 2015.")
module std.c.process; module std.c.process;
private import std.c.stddef; private import core.stdc.stddef;
public import core.stdc.stdlib : exit, abort, system;
extern (C): extern (C):
void exit(int); //These declarations are not defined or used elsewhere.
void _c_exit(); void _c_exit();
void _cexit(); void _cexit();
void _exit(int);
void abort();
void _dodtors(); void _dodtors();
int getpid(); int getpid();
enum { WAIT_CHILD, WAIT_GRANDCHILD }
int cwait(int *,int,int);
int wait(int *);
int execlpe(in char *, in char *,...);
int system(in char *); //These constants are undefined elsewhere and only used in the deprecated part
//of std.process.
enum { _P_WAIT, _P_NOWAIT, _P_OVERLAY }; enum { _P_WAIT, _P_NOWAIT, _P_OVERLAY };
//These declarations are defined for Posix in core.sys.posix.unistd but unused
//from here.
void _exit(int);
int execl(in char *, in char *,...); int execl(in char *, in char *,...);
int execle(in char *, in char *,...); int execle(in char *, in char *,...);
int execlp(in char *, in char *,...); int execlp(in char *, in char *,...);
int execlpe(in char *, in char *,...);
//All of these except for execvpe are defined for Posix in core.sys.posix.unistd
//and only used in the old part of std.process.
int execv(in char *, in char **); int execv(in char *, in char **);
int execve(in char *, in char **, in char **); int execve(in char *, in char **, in char **);
int execvp(in char *, in char **); int execvp(in char *, in char **);
int execvpe(in char *, in char **, in char **); int execvpe(in char *, in char **, in char **);
//All these Windows declarations are not publicly defined elsewhere and only
enum { WAIT_CHILD, WAIT_GRANDCHILD } //spawnvp is used once in a deprecated function in std.process.
int cwait(int *,int,int);
int wait(int *);
version (Windows) version (Windows)
{ {
uint _beginthread(void function(void *),uint,void *); uint _beginthread(void function(void *),uint,void *);

View file

@ -1,5 +1,7 @@
/** /**
* $(RED Deprecated. Please use $(D core.stdc.stdarg) instead. This module will
* be removed in December 2015.)
* C's &lt;stdarg.h&gt; * C's &lt;stdarg.h&gt;
* Authors: Hauke Duden and Walter Bright, Digital Mars, www.digitalmars.com * Authors: Hauke Duden and Walter Bright, Digital Mars, www.digitalmars.com
* License: Public Domain * License: Public Domain
@ -9,6 +11,7 @@
/* This is for use with extern(C) variable argument lists. */ /* This is for use with extern(C) variable argument lists. */
deprecated("Please import core.stdc.stdarg instead. This module will be removed in December 2015.")
module std.c.stdarg; module std.c.stdarg;
public import core.stdc.stdarg; public import core.stdc.stdarg;

View file

@ -1,5 +1,7 @@
/** /**
* $(RED Deprecated. Please use $(D core.stdc.stddef) instead. This module will
* be removed in December 2015.)
* C's &lt;stddef.h&gt; * C's &lt;stddef.h&gt;
* Authors: Walter Bright, Digital Mars, http://www.digitalmars.com * Authors: Walter Bright, Digital Mars, http://www.digitalmars.com
* License: Public Domain * License: Public Domain
@ -7,6 +9,7 @@
* WIKI=Phobos/StdCStddef * WIKI=Phobos/StdCStddef
*/ */
deprecated("Please import core.stdc.stddef instead. This module will be removed in December 2015.")
module std.c.stddef; module std.c.stddef;
public import core.stdc.stddef; public import core.stdc.stddef;

View file

@ -1,5 +1,7 @@
/** /**
* $(RED Deprecated. Please use $(D core.stdc.stdio) instead. This module will
* be removed in December 2015.)
* C's &lt;stdio.h&gt; for the D programming language * C's &lt;stdio.h&gt; for the D programming language
* Authors: Walter Bright, Digital Mars, http://www.digitalmars.com * Authors: Walter Bright, Digital Mars, http://www.digitalmars.com
* License: Public Domain * License: Public Domain
@ -9,13 +11,7 @@
deprecated("Please import core.stdc.stdio instead. This module will be removed in December 2015.")
module std.c.stdio; module std.c.stdio;
public import core.stdc.stdio; public import core.stdc.stdio;
extern (C):
version (Windows)
{
extern shared ubyte[_NFILE] __fhnd_info;
}

View file

@ -1,4 +1,6 @@
/** /**
* $(RED Deprecated. Please use $(D core.stdc.stdlib) or $(D core.sys.posix.stdlib)
* instead. This module will be removed in December 2015.)
* C's &lt;stdlib.h&gt; * C's &lt;stdlib.h&gt;
* D Programming Language runtime library * D Programming Language runtime library
* Authors: Walter Bright, Digital Mars, http://www.digitalmars.com * Authors: Walter Bright, Digital Mars, http://www.digitalmars.com
@ -8,11 +10,8 @@
*/ */
deprecated("Please import core.stdc.stdlib or core.sys.posix.stdlib instead. This module will be removed in December 2015.")
module std.c.stdlib; module std.c.stdlib;
public import core.stdc.stdlib; public import core.stdc.stdlib;
version(Posix) public import core.sys.posix.stdlib: setenv, unsetenv;
extern (C):
int setenv(const char*, const char*, int); /// extension to ISO C standard, not available on all platforms
int unsetenv(const char*); /// extension to ISO C standard, not available on all platforms

View file

@ -1,5 +1,7 @@
/** /**
* $(RED Deprecated. Please use $(D core.stdc.string) instead. This module will
* be removed in December 2015.)
* C's &lt;string.h&gt; * C's &lt;string.h&gt;
* Authors: Walter Bright, Digital Mars, http://www.digitalmars.com * Authors: Walter Bright, Digital Mars, http://www.digitalmars.com
* License: Public Domain * License: Public Domain
@ -7,7 +9,7 @@
* WIKI=Phobos/StdCString * WIKI=Phobos/StdCString
*/ */
deprecated("Please import core.stdc.string instead. This module will be removed in December 2015.")
module std.c.string; module std.c.string;
deprecated("Please import core.stdc.string instead.")
public import core.stdc.string; public import core.stdc.string;

View file

@ -1,5 +1,7 @@
/** /**
* $(RED Deprecated. Please use $(D core.stdc.time) instead. This module will
* be removed in December 2015.)
* C's &lt;time.h&gt; * C's &lt;time.h&gt;
* Authors: Walter Bright, Digital Mars, www.digitalmars.com * Authors: Walter Bright, Digital Mars, www.digitalmars.com
* License: Public Domain * License: Public Domain
@ -7,6 +9,7 @@
* WIKI=Phobos/StdCTime * WIKI=Phobos/StdCTime
*/ */
deprecated("Please import core.stdc.time instead. This module will be removed in December 2015.")
module std.c.time; module std.c.time;
public import core.stdc.time; public import core.stdc.time;

View file

@ -1,5 +1,7 @@
/** /**
* $(RED Deprecated. Please use $(D core.stdc.wchar_) instead. This module will
* be removed in December 2015.)
* C's &lt;wchar.h&gt; * C's &lt;wchar.h&gt;
* Authors: Walter Bright, Digital Mars, www.digitalmars.com * Authors: Walter Bright, Digital Mars, www.digitalmars.com
* License: Public Domain * License: Public Domain
@ -7,6 +9,7 @@
* WIKI=Phobos/StdCWchar * WIKI=Phobos/StdCWchar
*/ */
deprecated("Please import core.stdc.wchar_ instead. This module will be removed in December 2015.")
module std.c.wcharh; module std.c.wcharh;
public import core.stdc.wchar_; public import core.stdc.wchar_;

View file

@ -1,260 +1,4 @@
deprecated("Please import core.sys.windows.com instead. This module will be removed in April 2015.")
module std.c.windows.com; module std.c.windows.com;
version (Windows):
pragma(lib,"uuid"); public import core.sys.windows.com;
import core.atomic;
import std.c.windows.windows;
import std.string;
alias WCHAR OLECHAR;
alias LPOLESTR = OLECHAR*;
alias LPCOLESTR = OLECHAR*;
enum
{
rmm = 23, // OLE 2 version number info
rup = 639,
}
enum : int
{
S_OK = 0,
S_FALSE = 0x00000001,
NOERROR = 0,
E_NOTIMPL = cast(int)0x80004001,
E_NOINTERFACE = cast(int)0x80004002,
E_POINTER = cast(int)0x80004003,
E_ABORT = cast(int)0x80004004,
E_FAIL = cast(int)0x80004005,
E_HANDLE = cast(int)0x80070006,
CLASS_E_NOAGGREGATION = cast(int)0x80040110,
E_OUTOFMEMORY = cast(int)0x8007000E,
E_INVALIDARG = cast(int)0x80070057,
E_UNEXPECTED = cast(int)0x8000FFFF,
}
struct GUID { // size is 16
align(1):
DWORD Data1;
WORD Data2;
WORD Data3;
BYTE[8] Data4;
}
enum
{
CLSCTX_INPROC_SERVER = 0x1,
CLSCTX_INPROC_HANDLER = 0x2,
CLSCTX_LOCAL_SERVER = 0x4,
CLSCTX_INPROC_SERVER16 = 0x8,
CLSCTX_REMOTE_SERVER = 0x10,
CLSCTX_INPROC_HANDLER16 = 0x20,
CLSCTX_INPROC_SERVERX86 = 0x40,
CLSCTX_INPROC_HANDLERX86 = 0x80,
CLSCTX_INPROC = (CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER),
CLSCTX_ALL = (CLSCTX_INPROC_SERVER| CLSCTX_INPROC_HANDLER| CLSCTX_LOCAL_SERVER),
CLSCTX_SERVER = (CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER),
}
enum
{
COINIT_APARTMENTTHREADED = 0x2,
COINIT_MULTITHREADED = 0x0,
COINIT_DISABLE_OLE1DDE = 0x4,
COINIT_SPEED_OVER_MEMORY = 0x8
}
alias COINIT = DWORD;
enum RPC_E_CHANGED_MODE = 0x80010106;
alias IID = const(GUID);
alias CLSID = const(GUID);
extern (C)
{
extern IID IID_IUnknown;
extern IID IID_IClassFactory;
extern IID IID_IMarshal;
extern IID IID_IMallocSpy;
extern IID IID_IStdMarshalInfo;
extern IID IID_IExternalConnection;
extern IID IID_IMultiQI;
extern IID IID_IEnumUnknown;
extern IID IID_IBindCtx;
extern IID IID_IEnumMoniker;
extern IID IID_IRunnableObject;
extern IID IID_IRunningObjectTable;
extern IID IID_IPersist;
extern IID IID_IPersistStream;
extern IID IID_IMoniker;
extern IID IID_IROTData;
extern IID IID_IEnumString;
extern IID IID_ISequentialStream;
extern IID IID_IStream;
extern IID IID_IEnumSTATSTG;
extern IID IID_IStorage;
extern IID IID_IPersistFile;
extern IID IID_IPersistStorage;
extern IID IID_ILockBytes;
extern IID IID_IEnumFORMATETC;
extern IID IID_IEnumSTATDATA;
extern IID IID_IRootStorage;
extern IID IID_IAdviseSink;
extern IID IID_IAdviseSink2;
extern IID IID_IDataObject;
extern IID IID_IDataAdviseHolder;
extern IID IID_IMessageFilter;
extern IID IID_IRpcChannelBuffer;
extern IID IID_IRpcProxyBuffer;
extern IID IID_IRpcStubBuffer;
extern IID IID_IPSFactoryBuffer;
extern IID IID_IPropertyStorage;
extern IID IID_IPropertySetStorage;
extern IID IID_IEnumSTATPROPSTG;
extern IID IID_IEnumSTATPROPSETSTG;
extern IID IID_IFillLockBytes;
extern IID IID_IProgressNotify;
extern IID IID_ILayoutStorage;
extern IID GUID_NULL;
extern IID IID_IRpcChannel;
extern IID IID_IRpcStub;
extern IID IID_IStubManager;
extern IID IID_IRpcProxy;
extern IID IID_IProxyManager;
extern IID IID_IPSFactory;
extern IID IID_IInternalMoniker;
extern IID IID_IDfReserved1;
extern IID IID_IDfReserved2;
extern IID IID_IDfReserved3;
extern IID IID_IStub;
extern IID IID_IProxy;
extern IID IID_IEnumGeneric;
extern IID IID_IEnumHolder;
extern IID IID_IEnumCallback;
extern IID IID_IOleManager;
extern IID IID_IOlePresObj;
extern IID IID_IDebug;
extern IID IID_IDebugStream;
extern IID IID_StdOle;
extern IID IID_ICreateTypeInfo;
extern IID IID_ICreateTypeInfo2;
extern IID IID_ICreateTypeLib;
extern IID IID_ICreateTypeLib2;
extern IID IID_IDispatch;
extern IID IID_IEnumVARIANT;
extern IID IID_ITypeComp;
extern IID IID_ITypeInfo;
extern IID IID_ITypeInfo2;
extern IID IID_ITypeLib;
extern IID IID_ITypeLib2;
extern IID IID_ITypeChangeEvents;
extern IID IID_IErrorInfo;
extern IID IID_ICreateErrorInfo;
extern IID IID_ISupportErrorInfo;
extern IID IID_IOleAdviseHolder;
extern IID IID_IOleCache;
extern IID IID_IOleCache2;
extern IID IID_IOleCacheControl;
extern IID IID_IParseDisplayName;
extern IID IID_IOleContainer;
extern IID IID_IOleClientSite;
extern IID IID_IOleObject;
extern IID IID_IOleWindow;
extern IID IID_IOleLink;
extern IID IID_IOleItemContainer;
extern IID IID_IOleInPlaceUIWindow;
extern IID IID_IOleInPlaceActiveObject;
extern IID IID_IOleInPlaceFrame;
extern IID IID_IOleInPlaceObject;
extern IID IID_IOleInPlaceSite;
extern IID IID_IContinue;
extern IID IID_IViewObject;
extern IID IID_IViewObject2;
extern IID IID_IDropSource;
extern IID IID_IDropTarget;
extern IID IID_IEnumOLEVERB;
}
extern (System)
{
export
{
DWORD CoBuildVersion();
int StringFromGUID2(GUID *rguid, LPOLESTR lpsz, int cbMax);
/* init/uninit */
HRESULT CoInitialize(LPVOID pvReserved);
HRESULT CoInitializeEx(LPVOID pvReserved, DWORD dwCoInit);
void CoUninitialize();
DWORD CoGetCurrentProcess();
HRESULT CoCreateInstance(const(CLSID) *rclsid, IUnknown UnkOuter,
DWORD dwClsContext, const(IID)* riid, void* ppv);
//HINSTANCE CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree);
void CoFreeLibrary(HINSTANCE hInst);
void CoFreeAllLibraries();
void CoFreeUnusedLibraries();
}
interface IUnknown
{
HRESULT QueryInterface(const(IID)* riid, void** pvObject);
ULONG AddRef();
ULONG Release();
}
interface IClassFactory : IUnknown
{
HRESULT CreateInstance(IUnknown UnkOuter, IID* riid, void** pvObject);
HRESULT LockServer(BOOL fLock);
}
class ComObject : IUnknown
{
extern (System):
HRESULT QueryInterface(const(IID)* riid, void** ppv)
{
if (*riid == IID_IUnknown)
{
*ppv = cast(void*)cast(IUnknown)this;
AddRef();
return S_OK;
}
else
{ *ppv = null;
return E_NOINTERFACE;
}
}
ULONG AddRef()
{
return atomicOp!"+="(*cast(shared)&count, 1);
}
ULONG Release()
{
LONG lRef = atomicOp!"-="(*cast(shared)&count, 1);
if (lRef == 0)
{
// free object
// If we delete this object, then the postinvariant called upon
// return from Release() will fail.
// Just let the GC reap it.
//delete this;
return 0;
}
return cast(ULONG)lRef;
}
LONG count = 0; // object reference count
}
}

View file

@ -2,49 +2,7 @@
/// Placed into public domain /// Placed into public domain
/// Author: Walter Bright /// Author: Walter Bright
deprecated("Please import core.sys.windows.stat instead. This module will be removed in April 2015.")
module std.c.windows.stat; module std.c.windows.stat;
version (Windows):
extern (C) nothrow @nogc: public import core.sys.windows.stat;
// linux version is in std.c.linux.linux
const S_IFMT = 0xF000;
const S_IFDIR = 0x4000;
const S_IFCHR = 0x2000;
const S_IFIFO = 0x1000;
const S_IFREG = 0x8000;
const S_IREAD = 0x0100;
const S_IWRITE = 0x0080;
const S_IEXEC = 0x0040;
const S_IFBLK = 0x6000;
const S_IFNAM = 0x5000;
@safe pure
{
int S_ISREG(int m) { return (m & S_IFMT) == S_IFREG; }
int S_ISBLK(int m) { return (m & S_IFMT) == S_IFBLK; }
int S_ISNAM(int m) { return (m & S_IFMT) == S_IFNAM; }
int S_ISDIR(int m) { return (m & S_IFMT) == S_IFDIR; }
int S_ISCHR(int m) { return (m & S_IFMT) == S_IFCHR; }
}
struct struct_stat
{
short st_dev;
ushort st_ino;
ushort st_mode;
short st_nlink;
ushort st_uid;
ushort st_gid;
short st_rdev;
short dummy;
int st_size;
int st_atime;
int st_mtime;
int st_ctime;
}
int stat(char *, struct_stat *);
int fstat(int, struct_stat *);
int _wstat(wchar *, struct_stat *);

View file

@ -2,7 +2,7 @@
/* Windows is a registered trademark of Microsoft Corporation in the United /* Windows is a registered trademark of Microsoft Corporation in the United
States and other countries. */ States and other countries. */
deprecated("Please import core.sys.windows.windows instead. This module will be removed in April 2015.")
module std.c.windows.windows; module std.c.windows.windows;
version (Windows):
public import core.sys.windows.windows; public import core.sys.windows.windows;

View file

@ -5,8 +5,8 @@
* current standards. It will remain until we have a suitable replacement, * current standards. It will remain until we have a suitable replacement,
* but be aware that it will not remain long term.) * but be aware that it will not remain long term.)
* *
* The std.cstream module bridges std.c.stdio (or std.stdio) and std.stream. * The std.cstream module bridges core.stdc.stdio (or std.stdio) and std.stream.
* Both std.c.stdio and std.stream are publicly imported by std.cstream. * Both core.stdc.stdio and std.stream are publicly imported by std.cstream.
* *
* Macros: * Macros:
* WIKI=Phobos/StdCstream * WIKI=Phobos/StdCstream
@ -23,8 +23,8 @@
*/ */
module std.cstream; module std.cstream;
public import core.stdc.stdio;
public import std.stream; public import std.stream;
public import std.c.stdio;
version(unittest) import std.stdio; version(unittest) import std.stdio;
import std.algorithm; import std.algorithm;
@ -103,7 +103,7 @@ class CFile : Stream {
* Ditto * Ditto
*/ */
override char ungetc(char c) { override char ungetc(char c) {
return cast(char)std.c.stdio.ungetc(c,cfile); return cast(char)core.stdc.stdio.ungetc(c,cfile);
} }
/** /**
@ -227,24 +227,24 @@ class CFile : Stream {
} }
/** /**
* CFile wrapper of std.c.stdio.stdin (not seekable). * CFile wrapper of core.stdc.stdio.stdin (not seekable).
*/ */
__gshared CFile din; __gshared CFile din;
/** /**
* CFile wrapper of std.c.stdio.stdout (not seekable). * CFile wrapper of core.stdc.stdio.stdout (not seekable).
*/ */
__gshared CFile dout; __gshared CFile dout;
/** /**
* CFile wrapper of std.c.stdio.stderr (not seekable). * CFile wrapper of core.stdc.stdio.stderr (not seekable).
*/ */
__gshared CFile derr; __gshared CFile derr;
shared static this() { shared static this() {
// open standard I/O devices // open standard I/O devices
din = new CFile(std.c.stdio.stdin,FileMode.In); din = new CFile(core.stdc.stdio.stdin,FileMode.In);
dout = new CFile(std.c.stdio.stdout,FileMode.Out); dout = new CFile(core.stdc.stdio.stdout,FileMode.Out);
derr = new CFile(std.c.stdio.stderr,FileMode.Out); derr = new CFile(core.stdc.stdio.stderr,FileMode.Out);
} }

View file

@ -317,7 +317,7 @@ $(I FormatChar):
Examples: Examples:
------------------------- -------------------------
import std.c.stdio; import core.stdc.stdio;
import std.format; import std.format;
void main() void main()
@ -2830,7 +2830,7 @@ if (is(T == interface) && (hasToString!(T, Char) || !is(BuiltinTypeOf!T)) && !is
{ {
version (Windows) version (Windows)
{ {
import std.c.windows.com : IUnknown; import core.sys.windows.com : IUnknown;
static if (is(T : IUnknown)) static if (is(T : IUnknown))
{ {
formatValue(w, *cast(void**)&val, f); formatValue(w, *cast(void**)&val, f);
@ -2870,7 +2870,7 @@ unittest
version (Windows) version (Windows)
{ {
import core.sys.windows.windows : HRESULT; import core.sys.windows.windows : HRESULT;
import std.c.windows.com : IUnknown, IID; import core.sys.windows.com : IUnknown, IID;
interface IUnknown2 : IUnknown { } interface IUnknown2 : IUnknown { }
@ -3391,7 +3391,7 @@ unittest
stream.clear(); stream.clear();
formattedWrite(stream, "%g %A %s", 1.67, -1.28, float.nan); formattedWrite(stream, "%g %A %s", 1.67, -1.28, float.nan);
// std.c.stdio.fwrite(stream.data.ptr, stream.data.length, 1, stderr); // core.stdc.stdio.fwrite(stream.data.ptr, stream.data.length, 1, stderr);
/* The host C library is used to format floats. C99 doesn't /* The host C library is used to format floats. C99 doesn't
* specify what the hex digit before the decimal point is for * specify what the hex digit before the decimal point is for
@ -3536,7 +3536,7 @@ unittest
assert(stream.data == "0.00001000"); assert(stream.data == "0.00001000");
//return; //return;
//std.c.stdio.fwrite(stream.data.ptr, stream.data.length, 1, stderr); //core.stdc.stdio.fwrite(stream.data.ptr, stream.data.length, 1, stderr);
s = "helloworld"; s = "helloworld";
string r; string r;
@ -3721,7 +3721,7 @@ here:
//immutable(char[5])[int] aa = ([3:"hello", 4:"betty"]); //immutable(char[5])[int] aa = ([3:"hello", 4:"betty"]);
//stream.clear(); formattedWrite(stream, "%s", aa.values); //stream.clear(); formattedWrite(stream, "%s", aa.values);
//std.c.stdio.fwrite(stream.data.ptr, stream.data.length, 1, stderr); //core.stdc.stdio.fwrite(stream.data.ptr, stream.data.length, 1, stderr);
//assert(stream.data == "[[h,e,l,l,o],[b,e,t,t,y]]"); //assert(stream.data == "[[h,e,l,l,o],[b,e,t,t,y]]");
//stream.clear(); formattedWrite(stream, "%s", aa); //stream.clear(); formattedWrite(stream, "%s", aa);
//assert(stream.data == "[3:[h,e,l,l,o],4:[b,e,t,t,y]]"); //assert(stream.data == "[3:[h,e,l,l,o],4:[b,e,t,t,y]]");

View file

@ -2324,7 +2324,7 @@ pure nothrow
version(unittest) version(unittest)
{ {
import std.c.stdio; import core.stdc.stdio;
} }
unittest unittest

View file

@ -32,7 +32,7 @@ import std.internal.cstring;
version (Windows) version (Windows)
{ {
private import std.c.windows.windows; private import core.sys.windows.windows;
private import std.utf; private import std.utf;
} }
else version (Posix) else version (Posix)
@ -607,7 +607,7 @@ unittest
const size_t K = 1024; const size_t K = 1024;
size_t win = 64*K; // assume the page size is 64K size_t win = 64*K; // assume the page size is 64K
version(Windows) { version(Windows) {
/+ these aren't defined in std.c.windows.windows so let's use default /+ these aren't defined in core.sys.windows.windows so let's use default
SYSTEM_INFO sysinfo; SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo); GetSystemInfo(&sysinfo);
win = sysinfo.dwAllocationGranularity; win = sysinfo.dwAllocationGranularity;

View file

@ -34,13 +34,13 @@ import std.exception;
import std.random; import std.random;
import std.string; import std.string;
import std.range; import std.range;
import std.c.stdlib;
import std.functional; import std.functional;
import std.typetuple; import std.typetuple;
import std.complex; import std.complex;
import core.bitop; import core.bitop;
import core.exception; import core.exception;
import core.stdc.stdlib;
version(unittest) version(unittest)
{ {

View file

@ -19,11 +19,11 @@ module std.outbuffer;
private private
{ {
import core.memory; import core.memory;
import core.stdc.stdarg;
import core.stdc.stdio;
import core.stdc.stdlib;
import std.algorithm; import std.algorithm;
import std.string; import std.string;
import std.c.stdio;
import std.c.stdlib;
import std.c.stdarg;
} }
/********************************************* /*********************************************

View file

@ -1186,7 +1186,7 @@ immutable(C)[] buildNormalizedPath(C)(const(C[])[] paths...)
@trusted pure nothrow @trusted pure nothrow
if (isSomeChar!C) if (isSomeChar!C)
{ {
import std.c.stdlib; import core.stdc.stdlib;
auto paths2 = new const(C)[][](paths.length); auto paths2 = new const(C)[][](paths.length);
//(cast(const(C)[]*)alloca((const(C)[]).sizeof * paths.length))[0 .. paths.length]; //(cast(const(C)[]*)alloca((const(C)[]).sizeof * paths.length))[0 .. paths.length];

View file

@ -3058,10 +3058,8 @@ Distributed under the Boost Software License, Version 1.0.
import core.stdc.stdlib; import core.stdc.stdlib;
import std.c.stdlib;
import core.stdc.errno; import core.stdc.errno;
import core.thread; import core.thread;
import std.c.process;
import core.stdc.string; import core.stdc.string;
version (Windows) version (Windows)
@ -3091,7 +3089,7 @@ version (unittest)
in turn signal an error in command's execution). in turn signal an error in command's execution).
Note: On Unix systems, the homonym C function (which is accessible Note: On Unix systems, the homonym C function (which is accessible
to D programs as $(LINK2 std_c_process.html, std.c._system)) to D programs as $(LINK2 core_stdc_stdlib.html, core.stdc.stdlib._system))
returns a code in the same format as $(LUCKY waitpid, waitpid), returns a code in the same format as $(LUCKY waitpid, waitpid),
meaning that C programs must use the $(D WEXITSTATUS) macro to meaning that C programs must use the $(D WEXITSTATUS) macro to
extract the actual exit code from the $(D system) call. D's $(D extract the actual exit code from the $(D system) call. D's $(D
@ -3101,8 +3099,8 @@ version (unittest)
deprecated("Please use wait(spawnShell(command)) or executeShell(command) instead") deprecated("Please use wait(spawnShell(command)) or executeShell(command) instead")
int system(string command) int system(string command)
{ {
if (!command.ptr) return std.c.process.system(null); if (!command.ptr) return core.stdc.stdlib.system(null);
immutable status = std.c.process.system(command.tempCString()); immutable status = core.stdc.stdlib.system(command.tempCString());
if (status == -1) return status; if (status == -1) return status;
version (Posix) version (Posix)
{ {
@ -3138,14 +3136,16 @@ private void toAStringz(in string[] a, const(char)**az)
// //
// toAStringz(argv, argv_); // toAStringz(argv, argv_);
// //
// return std.c.process.spawnvp(mode, pathname.tempCString(), argv_); // return spawnvp(mode, pathname.tempCString(), argv_);
// } // }
//} //}
// Incorporating idea (for spawnvp() on Posix) from Dave Fladebo // Incorporating idea (for spawnvp() on Posix) from Dave Fladebo
alias P_WAIT = std.c.process._P_WAIT; enum { _P_WAIT, _P_NOWAIT, _P_OVERLAY };
alias P_NOWAIT = std.c.process._P_NOWAIT; version(Windows) extern(C) int spawnvp(int, in char *, in char **);
alias P_WAIT = _P_WAIT;
alias P_NOWAIT = _P_NOWAIT;
deprecated("Please use spawnProcess instead") deprecated("Please use spawnProcess instead")
int spawnvp(int mode, string pathname, string[] argv) int spawnvp(int mode, string pathname, string[] argv)
@ -3160,7 +3160,7 @@ int spawnvp(int mode, string pathname, string[] argv)
} }
else version (Windows) else version (Windows)
{ {
return std.c.process.spawnvp(mode, pathname.tempCString(), argv_); return spawnvp(mode, pathname.tempCString(), argv_);
} }
else else
static assert(0, "spawnvp not implemented for this OS."); static assert(0, "spawnvp not implemented for this OS.");
@ -3179,7 +3179,7 @@ int _spawnvp(int mode, in char *pathname, in char **argv)
if(!pid) if(!pid)
{ // child { // child
std.c.process.execvp(pathname, argv); core.sys.posix.unistd.execvp(pathname, argv);
goto Lerror; goto Lerror;
} }
else if(pid > 0) else if(pid > 0)
@ -3343,13 +3343,22 @@ else
else static assert (false, "Unsupported platform"); else static assert (false, "Unsupported platform");
} }
// Move these C declarations to druntime if we decide to keep the D wrappers
extern(C)
{
int execv(in char *, in char **);
int execve(in char *, in char **, in char **);
int execvp(in char *, in char **);
version(Windows) int execvpe(in char *, in char **, in char **);
}
private int execv_(in string pathname, in string[] argv) private int execv_(in string pathname, in string[] argv)
{ {
auto argv_ = cast(const(char)**)alloca((char*).sizeof * (1 + argv.length)); auto argv_ = cast(const(char)**)alloca((char*).sizeof * (1 + argv.length));
toAStringz(argv, argv_); toAStringz(argv, argv_);
return std.c.process.execv(pathname.tempCString(), argv_); return execv(pathname.tempCString(), argv_);
} }
private int execve_(in string pathname, in string[] argv, in string[] envp) private int execve_(in string pathname, in string[] argv, in string[] envp)
@ -3360,7 +3369,7 @@ private int execve_(in string pathname, in string[] argv, in string[] envp)
toAStringz(argv, argv_); toAStringz(argv, argv_);
toAStringz(envp, envp_); toAStringz(envp, envp_);
return std.c.process.execve(pathname.tempCString(), argv_, envp_); return execve(pathname.tempCString(), argv_, envp_);
} }
private int execvp_(in string pathname, in string[] argv) private int execvp_(in string pathname, in string[] argv)
@ -3369,7 +3378,7 @@ private int execvp_(in string pathname, in string[] argv)
toAStringz(argv, argv_); toAStringz(argv, argv_);
return std.c.process.execvp(pathname.tempCString(), argv_); return execvp(pathname.tempCString(), argv_);
} }
private int execvpe_(in string pathname, in string[] argv, in string[] envp) private int execvpe_(in string pathname, in string[] argv, in string[] envp)
@ -3415,7 +3424,7 @@ else version(Windows)
toAStringz(argv, argv_); toAStringz(argv, argv_);
toAStringz(envp, envp_); toAStringz(envp, envp_);
return std.c.process.execvpe(pathname.tempCString(), argv_, envp_); return execvpe(pathname.tempCString(), argv_, envp_);
} }
else else
{ {
@ -3513,7 +3522,7 @@ deprecated unittest
/** /**
Gets the value of environment variable $(D name) as a string. Calls Gets the value of environment variable $(D name) as a string. Calls
$(LINK2 std_c_stdlib.html#_getenv, std.c.stdlib._getenv) $(LINK2 core_stdc_stdlib.html#_getenv, core.stdc.stdlib._getenv)
internally. internally.
$(RED Deprecated. Please use $(LREF environment.opIndex) or $(RED Deprecated. Please use $(LREF environment.opIndex) or
@ -3537,8 +3546,8 @@ string getenv(in char[] name) nothrow
Sets the value of environment variable $(D name) to $(D value). If the Sets the value of environment variable $(D name) to $(D value). If the
value was written, or the variable was already present and $(D value was written, or the variable was already present and $(D
overwrite) is false, returns normally. Otherwise, it throws an overwrite) is false, returns normally. Otherwise, it throws an
exception. Calls $(LINK2 std_c_stdlib.html#_setenv, exception. Calls $(LINK2 core_sys_posix_stdlib.html#_setenv,
std.c.stdlib._setenv) internally. core.sys.posix.stdlib._setenv) internally.
$(RED Deprecated. Please use $(LREF environment.opIndexAssign) instead. $(RED Deprecated. Please use $(LREF environment.opIndexAssign) instead.
This function will be removed in August 2015.) This function will be removed in August 2015.)
@ -3549,12 +3558,12 @@ else version(Posix)
void setenv(in char[] name, in char[] value, bool overwrite) void setenv(in char[] name, in char[] value, bool overwrite)
{ {
errnoEnforce( errnoEnforce(
std.c.stdlib.setenv(name.tempCString(), value.tempCString(), overwrite) == 0); core.sys.posix.stdlib.setenv(name.tempCString(), value.tempCString(), overwrite) == 0);
} }
/** /**
Removes variable $(D name) from the environment. Calls $(LINK2 Removes variable $(D name) from the environment. Calls $(LINK2
std_c_stdlib.html#_unsetenv, std.c.stdlib._unsetenv) internally. core_sys_posix_stdlib.html#_unsetenv, core.sys.posix.stdlib._unsetenv) internally.
$(RED Deprecated. Please use $(LREF environment.remove) instead. $(RED Deprecated. Please use $(LREF environment.remove) instead.
This function will be removed in August 2015.) This function will be removed in August 2015.)
@ -3564,7 +3573,7 @@ else version(Posix)
deprecated("Please use environment.remove instead") deprecated("Please use environment.remove instead")
void unsetenv(in char[] name) void unsetenv(in char[] name)
{ {
errnoEnforce(std.c.stdlib.unsetenv(name.tempCString()) == 0); errnoEnforce(core.sys.posix.stdlib.unsetenv(name.tempCString()) == 0);
} }
version (Posix) deprecated unittest version (Posix) deprecated unittest

View file

@ -56,9 +56,9 @@ Distributed under the Boost Software License, Version 1.0.
*/ */
module std.random; module std.random;
import std.algorithm, std.c.time, std.conv, std.exception, import std.algorithm, std.conv, std.exception,
std.math, std.numeric, std.range, std.traits, std.math, std.numeric, std.range, std.traits,
core.thread, core.time; core.stdc.time, core.thread, core.time;
import std.string : format; import std.string : format;
version(unittest) import std.typetuple; version(unittest) import std.typetuple;

View file

@ -62,7 +62,7 @@
module std.signals; module std.signals;
import std.stdio; import std.stdio;
import std.c.stdlib : calloc, realloc, free; import core.stdc.stdlib : calloc, realloc, free;
import core.exception : onOutOfMemoryError; import core.exception : onOutOfMemoryError;
// Special function for internal use only. // Special function for internal use only.
@ -141,7 +141,7 @@ void main()
mixin template Signal(T1...) mixin template Signal(T1...)
{ {
static import std.c.stdlib; static import core.stdc.stdlib;
static import core.exception; static import core.exception;
/*** /***
* A slot is implemented as a delegate. * A slot is implemented as a delegate.
@ -179,7 +179,7 @@ mixin template Signal(T1...)
if (slots.length == 0) if (slots.length == 0)
{ {
len = 4; len = 4;
auto p = std.c.stdlib.calloc(slot_t.sizeof, len); auto p = core.stdc.stdlib.calloc(slot_t.sizeof, len);
if (!p) if (!p)
core.exception.onOutOfMemoryError(); core.exception.onOutOfMemoryError();
slots = (cast(slot_t*)p)[0 .. len]; slots = (cast(slot_t*)p)[0 .. len];
@ -187,7 +187,7 @@ mixin template Signal(T1...)
else else
{ {
len = len * 2 + 4; len = len * 2 + 4;
auto p = std.c.stdlib.realloc(slots.ptr, slot_t.sizeof * len); auto p = core.stdc.stdlib.realloc(slots.ptr, slot_t.sizeof * len);
if (!p) if (!p)
core.exception.onOutOfMemoryError(); core.exception.onOutOfMemoryError();
slots = (cast(slot_t*)p)[0 .. len]; slots = (cast(slot_t*)p)[0 .. len];
@ -261,7 +261,7 @@ mixin template Signal(T1...)
rt_detachDisposeEvent(o, &unhook); rt_detachDisposeEvent(o, &unhook);
} }
} }
std.c.stdlib.free(slots.ptr); core.stdc.stdlib.free(slots.ptr);
slots = null; slots = null;
} }
} }

View file

@ -45,7 +45,7 @@
module std.socket; module std.socket;
import core.stdc.stdint, core.stdc.string, std.string, std.c.stdlib, std.conv; import core.stdc.stdint, core.stdc.string, std.string, core.stdc.stdlib, std.conv;
import core.stdc.config; import core.stdc.config;
import core.time : dur, Duration; import core.time : dur, Duration;
@ -62,7 +62,7 @@ version(Windows)
pragma (lib, "ws2_32.lib"); pragma (lib, "ws2_32.lib");
pragma (lib, "wsock32.lib"); pragma (lib, "wsock32.lib");
private import std.c.windows.windows, std.c.windows.winsock, std.windows.syserror; private import core.sys.windows.windows, std.c.windows.winsock, std.windows.syserror;
private alias _ctimeval = std.c.windows.winsock.timeval; private alias _ctimeval = std.c.windows.winsock.timeval;
private alias _clinger = std.c.windows.winsock.linger; private alias _clinger = std.c.windows.winsock.linger;
@ -78,33 +78,13 @@ version(Windows)
else version(Posix) else version(Posix)
{ {
version(linux) version(linux)
import std.c.linux.socket : AF_IPX, AF_APPLETALK, SOCK_RDM,
IPPROTO_IGMP, IPPROTO_GGP, IPPROTO_PUP, IPPROTO_IDP,
SD_RECEIVE, SD_SEND, SD_BOTH, MSG_NOSIGNAL, INADDR_NONE,
TCP_KEEPIDLE, TCP_KEEPINTVL;
else version(OSX)
import std.c.osx.socket : AF_IPX, AF_APPLETALK, SOCK_RDM,
IPPROTO_IGMP, IPPROTO_GGP, IPPROTO_PUP, IPPROTO_IDP,
SD_RECEIVE, SD_SEND, SD_BOTH, INADDR_NONE;
else version(FreeBSD)
{ {
import core.sys.posix.sys.socket; enum : int
import core.sys.posix.sys.select;
import std.c.freebsd.socket;
private enum SD_RECEIVE = SHUT_RD;
private enum SD_SEND = SHUT_WR;
private enum SD_BOTH = SHUT_RDWR;
}
else version(Android)
{ {
import core.sys.posix.sys.socket; TCP_KEEPIDLE = 4,
import core.sys.posix.sys.select; TCP_KEEPINTVL = 5
private enum SD_RECEIVE = SHUT_RD; }
private enum SD_SEND = SHUT_WR;
private enum SD_BOTH = SHUT_RDWR;
} }
else
static assert(false);
import core.sys.posix.netdb; import core.sys.posix.netdb;
import core.sys.posix.sys.un : sockaddr_un; import core.sys.posix.sys.un : sockaddr_un;
@ -114,7 +94,7 @@ else version(Posix)
private import core.sys.posix.netinet.tcp; private import core.sys.posix.netinet.tcp;
private import core.sys.posix.netinet.in_; private import core.sys.posix.netinet.in_;
private import core.sys.posix.sys.time; private import core.sys.posix.sys.time;
//private import core.sys.posix.sys.select; private import core.sys.posix.sys.select;
private import core.sys.posix.sys.socket; private import core.sys.posix.sys.socket;
private alias _ctimeval = core.sys.posix.sys.time.timeval; private alias _ctimeval = core.sys.posix.sys.time.timeval;
private alias _clinger = core.sys.posix.sys.socket.linger; private alias _clinger = core.sys.posix.sys.socket.linger;
@ -124,6 +104,12 @@ else version(Posix)
enum socket_t : int32_t { init = -1 } enum socket_t : int32_t { init = -1 }
private const int _SOCKET_ERROR = -1; private const int _SOCKET_ERROR = -1;
private enum : int
{
SD_RECEIVE = SHUT_RD,
SD_SEND = SHUT_WR,
SD_BOTH = SHUT_RDWR
}
private int _lasterr() nothrow @nogc private int _lasterr() nothrow @nogc
{ {

View file

@ -1,7 +1,7 @@
// Written in the D programming language. // Written in the D programming language.
/** /**
Standard I/O functions that extend $(B std.c.stdio). $(B std.c.stdio) Standard I/O functions that extend $(B core.stdc.stdio). $(B core.stdc.stdio)
is $(D_PARAM public)ally imported when importing $(B std.stdio). is $(D_PARAM public)ally imported when importing $(B std.stdio).
Source: $(PHOBOSSRC std/_stdio.d) Source: $(PHOBOSSRC std/_stdio.d)
@ -18,7 +18,7 @@ module std.stdio;
public import core.stdc.stdio, std.string : KeepTerminator; public import core.stdc.stdio, std.string : KeepTerminator;
import core.vararg; import core.vararg;
static import std.c.stdio; static import core.stdc.stdio;
import std.stdiobase; import std.stdiobase;
import core.stdc.errno, core.stdc.stddef, core.stdc.stdlib, core.memory, import core.stdc.errno, core.stdc.stddef, core.stdc.stdlib, core.memory,
core.stdc.string, core.stdc.wchar_, core.exception; core.stdc.string, core.stdc.wchar_, core.exception;
@ -34,7 +34,7 @@ else version (CRuntime_DigitalMars)
{ {
// Specific to the way Digital Mars C does stdio // Specific to the way Digital Mars C does stdio
version = DIGITAL_MARS_STDIO; version = DIGITAL_MARS_STDIO;
import std.c.stdio : __fhnd_info, FHND_WCHAR, FHND_TEXT; import core.stdc.stdio : __fhnd_info, FHND_WCHAR, FHND_TEXT;
} }
version (Posix) version (Posix)
@ -636,7 +636,7 @@ Throws: $(D ErrnoException) on error.
return; return;
} }
} }
//fprintf(std.c.stdio.stderr, ("Closing file `"~name~"`.\n\0").ptr); //fprintf(core.stdc.stdio.stderr, ("Closing file `"~name~"`.\n\0").ptr);
errnoEnforce(.fclose(_p.handle) == 0, errnoEnforce(.fclose(_p.handle) == 0,
"Could not close file `"~_name~"'"); "Could not close file `"~_name~"'");
} }
@ -1521,7 +1521,7 @@ Returns the $(D FILE*) corresponding to this object.
unittest unittest
{ {
assert(stdout.getFP() == std.c.stdio.stdout); assert(stdout.getFP() == core.stdc.stdio.stdout);
} }
/** /**
@ -3165,7 +3165,7 @@ private FILE* fopen(in char[] name, in char[] mode = "r") @trusted nothrow @nogc
version (Posix) version (Posix)
{ {
/*********************************** /***********************************
* Convenience function that forwards to $(D std.c.stdio.popen) * Convenience function that forwards to $(D core.stdc.stdio.popen)
* with appropriately-constructed C-style strings. * with appropriately-constructed C-style strings.
*/ */
FILE* popen(in char[] name, in char[] mode = "r") @trusted nothrow @nogc FILE* popen(in char[] name, in char[] mode = "r") @trusted nothrow @nogc
@ -3177,7 +3177,7 @@ version (Posix)
} }
/* /*
* Convenience function that forwards to $(D std.c.stdio.fwrite) * Convenience function that forwards to $(D core.stdc.stdio.fwrite)
* and throws an exception upon error * and throws an exception upon error
*/ */
private void binaryWrite(T)(FILE* f, T obj) private void binaryWrite(T)(FILE* f, T obj)
@ -4076,14 +4076,17 @@ version(linux)
{ {
File openNetwork(string host, ushort port) File openNetwork(string host, ushort port)
{ {
static import linux = std.c.linux.linux; static import sock = core.sys.posix.sys.socket;
static import sock = std.c.linux.socket; static import core.sys.posix.unistd;
import core.stdc.string : memcpy; import core.stdc.string : memcpy;
import core.sys.posix.arpa.inet : htons;
import core.sys.posix.netdb : gethostbyname;
import core.sys.posix.netinet.in_ : sockaddr_in;
import std.conv : to; import std.conv : to;
import std.exception : enforce; import std.exception : enforce;
import std.internal.cstring : tempCString; import std.internal.cstring : tempCString;
auto h = enforce( sock.gethostbyname(host.tempCString()), auto h = enforce( gethostbyname(host.tempCString()),
new StdioException("gethostbyname")); new StdioException("gethostbyname"));
int s = sock.socket(sock.AF_INET, sock.SOCK_STREAM, 0); int s = sock.socket(sock.AF_INET, sock.SOCK_STREAM, 0);
@ -4091,17 +4094,16 @@ version(linux)
scope(failure) scope(failure)
{ {
linux.close(s); // want to make sure it doesn't dangle if // want to make sure it doesn't dangle if something throws. Upon
// something throws. Upon normal exit, the // normal exit, the File struct's reference counting takes care of
// File struct's reference counting takes // closing, so we don't need to worry about success
// care of closing, so we don't need to core.sys.posix.unistd.close(s);
// worry about success
} }
sock.sockaddr_in addr; sockaddr_in addr;
addr.sin_family = sock.AF_INET; addr.sin_family = sock.AF_INET;
addr.sin_port = sock.htons(port); addr.sin_port = htons(port);
core.stdc.string.memcpy(&addr.sin_addr.s_addr, h.h_addr, h.h_length); core.stdc.string.memcpy(&addr.sin_addr.s_addr, h.h_addr, h.h_length);
enforce(sock.connect(s, cast(sock.sockaddr*) &addr, addr.sizeof) != -1, enforce(sock.connect(s, cast(sock.sockaddr*) &addr, addr.sizeof) != -1,

View file

@ -389,7 +389,7 @@ interface OutputStream {
// not really abstract, but its instances will do nothing useful // not really abstract, but its instances will do nothing useful
class Stream : InputStream, OutputStream { class Stream : InputStream, OutputStream {
private import std.string, std.digest.crc, std.c.stdlib, std.c.stdio; private import std.string, std.digest.crc, core.stdc.stdlib, core.stdc.stdio;
// stream abilities // stream abilities
bool readable = false; /// Indicates whether this stream can be read from. bool readable = false; /// Indicates whether this stream can be read from.
@ -1913,7 +1913,7 @@ enum FileMode {
} }
version (Windows) { version (Windows) {
private import std.c.windows.windows; private import core.sys.windows.windows;
extern (Windows) { extern (Windows) {
void FlushFileBuffers(HANDLE hFile); void FlushFileBuffers(HANDLE hFile);
DWORD GetFileType(HANDLE hFile); DWORD GetFileType(HANDLE hFile);

View file

@ -15,7 +15,7 @@ module std.syserror;
deprecated("Please use std.windows.syserror.sysErrorString instead") deprecated("Please use std.windows.syserror.sysErrorString instead")
class SysError class SysError
{ {
private import std.c.stdio; private import core.stdc.stdio;
private import core.stdc.string; private import core.stdc.string;
private import std.string; private import std.string;

View file

@ -32,7 +32,7 @@ debug(uri) private import std.stdio;
/* ====================== URI Functions ================ */ /* ====================== URI Functions ================ */
private import std.ascii; private import std.ascii;
private import std.c.stdlib; private import core.stdc.stdlib;
private import std.utf; private import std.utf;
private import std.traits : isSomeChar; private import std.traits : isSomeChar;
import core.exception : OutOfMemoryError; import core.exception : OutOfMemoryError;

View file

@ -19,7 +19,7 @@ module std.windows.charset;
version (Windows): version (Windows):
private import std.conv; private import std.conv;
private import std.c.windows.windows; private import core.sys.windows.windows;
private import std.windows.syserror; private import std.windows.syserror;
private import std.utf; private import std.utf;
private import std.string; private import std.string;

View file

@ -1,7 +1,7 @@
// Written in the D programming language. // Written in the D programming language.
deprecated("Please import core.sys.windows.com instead. This module will be removed in April 2015.")
module std.windows.iunknown; module std.windows.iunknown;
version (Windows):
// Replaced by: // Replaced by:
public import std.c.windows.com; public import core.sys.windows.com;

View file

@ -41,7 +41,7 @@ version (Windows):
import std.array; import std.array;
import std.system : Endian, endian; import std.system : Endian, endian;
import std.exception; import std.exception;
import std.c.windows.windows; import core.sys.windows.windows;
import std.windows.syserror; import std.windows.syserror;
import std.conv; import std.conv;
import std.utf : toUTF8, toUTF16; import std.utf : toUTF8, toUTF16;