]> gitweb.factorcode.org Git - factor.git/blob - basis/libc/windows/windows.factor
factor: rename files that are not loadable on mac, too
[factor.git] / basis / libc / windows / windows.factor
1 USING: alien.c-types alien.strings alien.syntax destructors
2 io.encodings.utf8 kernel libc system ;
3 IN: libc
4
5 LIBRARY: libc
6
7 ! From errno.h in msvc 10:
8 CONSTANT: EPERM           1
9 CONSTANT: ENOENT          2
10 CONSTANT: ESRCH           3
11 CONSTANT: EINTR           4
12 CONSTANT: EIO             5
13 CONSTANT: ENXIO           6
14 CONSTANT: E2BIG           7
15 CONSTANT: ENOEXEC         8
16 CONSTANT: EBADF           9
17 CONSTANT: ECHILD          10
18 CONSTANT: EAGAIN          11
19 CONSTANT: ENOMEM          12
20 CONSTANT: EACCES          13
21 CONSTANT: EFAULT          14
22 CONSTANT: EBUSY           16
23 CONSTANT: EEXIST          17
24 CONSTANT: EXDEV           18
25 CONSTANT: ENODEV          19
26 CONSTANT: ENOTDIR         20
27 CONSTANT: EISDIR          21
28 CONSTANT: ENFILE          23
29 CONSTANT: EMFILE          24
30 CONSTANT: ENOTTY          25
31 CONSTANT: EFBIG           27
32 CONSTANT: ENOSPC          28
33 CONSTANT: ESPIPE          29
34 CONSTANT: EROFS           30
35 CONSTANT: EMLINK          31
36 CONSTANT: EPIPE           32
37 CONSTANT: EDOM            33
38 CONSTANT: EDEADLK         36
39 CONSTANT: ENAMETOOLONG    38
40 CONSTANT: ENOLCK          39
41 CONSTANT: ENOSYS          40
42 CONSTANT: ENOTEMPTY       41
43
44 ! Error codes used in the Secure CRT functions
45 CONSTANT: EINVAL          22
46 CONSTANT: ERANGE          34
47 CONSTANT: EILSEQ          42
48 CONSTANT: STRUNCATE       80
49
50 ! Support EDEADLOCK for compatibility with older MS-C versions
51 ALIAS: EDEADLOCK       EDEADLK
52
53 ! POSIX SUPPLEMENT
54 CONSTANT: EADDRINUSE      100
55 CONSTANT: EADDRNOTAVAIL   101
56 CONSTANT: EAFNOSUPPORT    102
57 CONSTANT: EALREADY        103
58 CONSTANT: EBADMSG         104
59 CONSTANT: ECANCELED       105
60 CONSTANT: ECONNABORTED    106
61 CONSTANT: ECONNREFUSED    107
62 CONSTANT: ECONNRESET      108
63 CONSTANT: EDESTADDRREQ    109
64 CONSTANT: EHOSTUNREACH    110
65 CONSTANT: EIDRM           111
66 CONSTANT: EINPROGRESS     112
67 CONSTANT: EISCONN         113
68 CONSTANT: ELOOP           114
69 CONSTANT: EMSGSIZE        115
70 CONSTANT: ENETDOWN        116
71 CONSTANT: ENETRESET       117
72 CONSTANT: ENETUNREACH     118
73 CONSTANT: ENOBUFS         119
74 CONSTANT: ENODATA         120
75 CONSTANT: ENOLINK         121
76 CONSTANT: ENOMSG          122
77 CONSTANT: ENOPROTOOPT     123
78 CONSTANT: ENOSR           124
79 CONSTANT: ENOSTR          125
80 CONSTANT: ENOTCONN        126
81 CONSTANT: ENOTRECOVERABLE 127
82 CONSTANT: ENOTSOCK        128
83 CONSTANT: ENOTSUP         129
84 CONSTANT: EOPNOTSUPP      130
85 CONSTANT: EOTHER          131
86 CONSTANT: EOVERFLOW       132
87 CONSTANT: EOWNERDEAD      133
88 CONSTANT: EPROTO          134
89 CONSTANT: EPROTONOSUPPORT 135
90 CONSTANT: EPROTOTYPE      136
91 CONSTANT: ETIME           137
92 CONSTANT: ETIMEDOUT       138
93 CONSTANT: ETXTBSY         139
94 CONSTANT: EWOULDBLOCK     140
95
96 ! From signal.h in msvc 10:
97 CONSTANT: SIGINT          2
98 CONSTANT: SIGILL          4
99 CONSTANT: SIGFPE          8
100 CONSTANT: SIGSEGV         11
101 CONSTANT: SIGTERM         15
102 CONSTANT: SIGBREAK        21
103 CONSTANT: SIGABRT         22
104
105 CONSTANT: SIGABRT_COMPAT  6
106
107 LIBRARY: libc
108
109 FUNCTION: int strerror_s ( char *buffer, size_t numberOfElements, int errnum )
110
111 M: windows strerror ( errno -- str )
112     [
113         [ 1024 [ malloc &free ] keep ] dip
114         [ strerror_s drop ] 3keep 2drop
115         utf8 alien>string
116     ] with-destructors ;