annotate PC/generrmap.c @ 78069:a8aa77458e12 3.2

Add c_size_t and c_ssize_t to the ctypes summary table.
author Antoine Pitrou <solipsis@pitrou.net>
date Thu, 12 Jul 2012 20:31:50 +0200
parents d8d8374ddbcc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
72163
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
1 #include <windows.h>
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
2 #include <fcntl.h>
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
3 #include <io.h>
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
4 #include <stdio.h>
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
5 #include <errno.h>
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
6
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
7 /* Extract the mapping of Win32 error codes to errno */
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
8
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
9 int main()
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
10 {
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 38453
diff changeset
11 int i;
72163
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
12 _setmode(fileno(stdout), O_BINARY);
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 38453
diff changeset
13 printf("/* Generated file. Do not edit. */\n");
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 38453
diff changeset
14 printf("int winerror_to_errno(int winerror)\n");
72163
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
15 printf("{\n switch(winerror) {\n");
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 38453
diff changeset
16 for(i=1; i < 65000; i++) {
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 38453
diff changeset
17 _dosmaperr(i);
72163
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
18 if (errno == EINVAL) {
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
19 /* Issue #12802 */
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
20 if (i == ERROR_DIRECTORY)
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
21 errno = ENOTDIR;
72790
d8d8374ddbcc Issue #13063: the Windows error ERROR_NO_DATA (numbered 232 and described
Antoine Pitrou <solipsis@pitrou.net>
parents: 72163
diff changeset
22 /* Issue #13063 */
d8d8374ddbcc Issue #13063: the Windows error ERROR_NO_DATA (numbered 232 and described
Antoine Pitrou <solipsis@pitrou.net>
parents: 72163
diff changeset
23 else if (i == ERROR_NO_DATA)
d8d8374ddbcc Issue #13063: the Windows error ERROR_NO_DATA (numbered 232 and described
Antoine Pitrou <solipsis@pitrou.net>
parents: 72163
diff changeset
24 errno = EPIPE;
72163
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
25 else
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
26 continue;
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
27 }
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
28 printf(" case %d: return %d;\n", i, errno);
61467
f197407bdba2 Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 38453
diff changeset
29 }
72163
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
30 printf(" default: return EINVAL;\n");
385c2ec78f16 Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
Antoine Pitrou <solipsis@pitrou.net>
parents: 61467
diff changeset
31 printf(" }\n}\n");
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
32 }