Mercurial > minori
annotate dep/animia/src/fd.cc @ 150:ffa535b6d630
*: avoid usage of std::[pair,tuple]
https://arne-mertz.de/2017/03/smelly-pair-tuple/
it's better to use real structures and such where variables are easily known...
also apparently using [] on structs is actually valid? I had no idea.
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Tue, 14 Nov 2023 16:27:33 -0500 |
parents | d8a61e7e2a36 |
children | 8700806c2cc2 |
rev | line source |
---|---|
150
ffa535b6d630
*: avoid usage of std::[pair,tuple]
Paper <mrpapersonic@gmail.com>
parents:
146
diff
changeset
|
1 #include "animia/os.h" |
146
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
2 #include "animia/fd.h" |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
3 |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
4 #ifdef ANIMIA_ON_WIN32 |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
5 # include "animia/fd/win32.h" |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
6 #elif defined(ANIMIA_ON_LINUX) |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
7 # include "animia/fd/linux.h" |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
8 #elif defined(ANIMIA_ON_UNIX) |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
9 # include "animia/fd/bsd.h" |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
10 #endif |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
11 |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
12 namespace animia::internal { |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
13 |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
14 /* really stupid hack to get fd to point to the right |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
15 thing */ |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
16 #ifdef ANIMIA_ON_WIN32 |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
17 win32::Win32FdTools os_fd; |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
18 #elif defined(ANIMIA_ON_LINUX) |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
19 linux::LinuxFdTools os_fd; |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
20 #elif defined(ANIMIA_ON_UNIX) |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
21 unix::UnixFdTools os_fd; |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
22 #else |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
23 BaseFdTools os_fd; |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
24 #endif |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
25 |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
26 BaseFdTools& fd = os_fd; |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
27 |
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
28 } |