diff options
Diffstat (limited to 'include/libtio/native.h')
-rw-r--r-- | include/libtio/native.h | 72 |
1 files changed, 39 insertions, 33 deletions
diff --git a/include/libtio/native.h b/include/libtio/native.h index 3a120eb..083a36a 100644 --- a/include/libtio/native.h +++ b/include/libtio/native.h @@ -18,7 +18,8 @@ TIO_BEGIN_DECLS * Macros defined hereafter: * * - `LIBTIO_DISABLED_UNIX`: disable POSIX (unistd.h) support. - * - `LIBTIO_DISABLED_WINDOWS`: disable Windows API support. */ + * - `LIBTIO_DISABLED_WINDOWS`: disable Windows API support. + * - `LIBTIO_DISABLED_MACOS`: disable MacOS (OS X) support. */ # if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L # else @@ -28,43 +29,19 @@ TIO_BEGIN_DECLS # if defined(_WIN16) || defined(_WIN32) || defined(_WIN64) \ || defined(__WINDOWS__) # else -# define LIBTIO_DISABLED_WINDOWS +# define LIBTIO_DISABLED_WINDOWS 1 +# endif + +# if defined(__APPLE__) +# else +# define LIBTIO_DISABLED_MACOS 1 # endif /* --- * Native stream opening functions. * --- */ -/* UNIX streams. */ - -# ifndef LIBTIO_DISABLED_UNIX - -TIO_EXTERN(int) tio_open_unix_fd - OF((tio_stream_t **tio__streamp, int tio__fd, int tio__close)); - -/* These might not work, but we can try them on UNIX variants as they - * require the unistd.h functions at compile time. */ - -TIO_EXTERN(int) tio_list_unix_serial_ports_using_dev_serial - OF((tio_iter_t **tio__iterp)); -TIO_EXTERN(int) tio_list_unix_serial_ports_using_cu_devices - OF((tio_iter_t **tio__iterp)); - -# endif - -/* Open USB streams. */ - -# ifndef LIBTIO_DISABLED_LIBUSB -# include <libusb.h> - -TIO_EXTERN(int) tio_open_libusb - OF((tio_stream_t **streamp, int bus, int addr)); -TIO_EXTERN(int) tio_open_libusb_device - OF((tio_stream_t **streamp, libusb_device_handle *handle)); - -# endif - -/* Open standard FILE streams. */ +/* FILE streams. */ # ifndef LIBTIO_DISABLED_FILE # include <stdio.h> @@ -82,7 +59,24 @@ TIO_EXTERN(int) tio_open_stdin # endif -/* Open Windows handles. */ +/* UNIX-specific streams and listings. */ + +# ifndef LIBTIO_DISABLED_UNIX + +TIO_EXTERN(int) tio_open_unix_fd + OF((tio_stream_t **tio__streamp, int tio__fd, int tio__close)); + +/* These might not work, but we can try them on UNIX variants as they + * require the unistd.h functions at compile time. */ + +TIO_EXTERN(int) tio_list_unix_serial_ports_using_dev_serial + OF((tio_iter_t **tio__iterp)); +TIO_EXTERN(int) tio_list_unix_serial_ports_using_cu_devices + OF((tio_iter_t **tio__iterp)); + +# endif + +/* MS-Windows specific streams and port/device listing. */ # ifndef LIBTIO_DISABLED_WINDOWS # include <windows.h> @@ -99,6 +93,18 @@ TIO_EXTERN(int) tio_list_windows_serial_ports # endif +/* libusb stream. */ + +# ifndef LIBTIO_DISABLED_LIBUSB +# include <libusb.h> + +TIO_EXTERN(int) tio_open_libusb + OF((tio_stream_t **streamp, int bus, int addr)); +TIO_EXTERN(int) tio_open_libusb_device + OF((tio_stream_t **streamp, libusb_device_handle *handle)); + +# endif + TIO_END_DECLS TIO_END_NAMESPACE |