1 /** \file   archdep_unix.h
2  * \brief   Miscellaneous UNIX-specific stuff - header
3  *
4  * \author  Marco van den Heuvel <blackystardust68@yahoo.com>
5  */
6 
7 /*
8  * This file is part of VICE, the Versatile Commodore Emulator.
9  * See README for copyright notice.
10  *
11  *  This program is free software; you can redistribute it and/or modify
12  *  it under the terms of the GNU General Public License as published by
13  *  the Free Software Foundation; either version 2 of the License, or
14  *  (at your option) any later version.
15  *
16  *  This program is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with this program; if not, write to the Free Software
23  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24  *  02111-1307  USA.
25  *
26  */
27 
28 #ifndef VICE_ARCHDEP_UNIX_H
29 #define VICE_ARCHDEP_UNIX_H
30 
31 #define VICE_ARCHAPI_PRIVATE_API
32 #include "archapi.h"
33 #undef VICE_ARCHAPI_PRIVATE_API
34 
35 /* Default MIDI devices. */
36 #define ARCHDEP_MIDI_IN_DEV  "/dev/midi"
37 #define ARCHDEP_MIDI_OUT_DEV "/dev/midi"
38 
39 /* Filesystem dependant operators.  */
40 #define FSDEVICE_DEFAULT_DIR "."
41 #define FSDEV_DIR_SEP_STR    "/"
42 #define FSDEV_DIR_SEP_CHR    '/'
43 #define FSDEV_EXT_SEP_STR    "."
44 #define FSDEV_EXT_SEP_CHR    '.'
45 
46 /* Path separator.  */
47 #define ARCHDEP_FINDPATH_SEPARATOR_CHAR   ':'
48 #define ARCHDEP_FINDPATH_SEPARATOR_STRING ":"
49 
50 /* Modes for fopen().  */
51 #define MODE_READ              "r"
52 #define MODE_READ_TEXT         "r"
53 #define MODE_READ_WRITE        "r+"
54 #define MODE_WRITE             "w"
55 #define MODE_WRITE_TEXT        "w"
56 #define MODE_APPEND            "a"
57 #define MODE_APPEND_READ_WRITE "a+"
58 
59 /* Printer default devices.  */
60 #define ARCHDEP_PRINTER_DEFAULT_DEV1 "print.dump"
61 #define ARCHDEP_PRINTER_DEFAULT_DEV2 "|lpr"
62 #define ARCHDEP_PRINTER_DEFAULT_DEV3 "|petlp -F PS|lpr"
63 
64 /* Default RS232 devices.  */
65 #define ARCHDEP_RS232_DEV1 "/dev/ttyS0"
66 #define ARCHDEP_RS232_DEV2 "/dev/ttyS1"
67 #define ARCHDEP_RS232_DEV3 "rs232.dump"
68 #define ARCHDEP_RS232_DEV4 "|lpr"
69 
70 /* Default MIDI devices.  */
71 #define ARCHDEP_MIDI_IN_DEV  "/dev/midi"
72 #define ARCHDEP_MIDI_OUT_DEV "/dev/midi"
73 
74 /* Default location of raw disk images.  */
75 #define ARCHDEP_RAWDRIVE_DEFAULT "/dev/fd0"
76 
77 /* Access types */
78 #define ARCHDEP_R_OK R_OK
79 #define ARCHDEP_W_OK W_OK
80 #define ARCHDEP_X_OK X_OK
81 #define ARCHDEP_F_OK F_OK
82 
83 /* Standard line delimiter.  */
84 #define ARCHDEP_LINE_DELIMITER "\n"
85 
86 /* Ethernet default device */
87 #define ARCHDEP_ETHERNET_DEFAULT_DEVICE "eth0"
88 
89 /* Default sound fragment size */
90 #define ARCHDEP_SOUND_FRAGMENT_SIZE SOUND_FRAGMENT_MEDIUM
91 
92 const char *archdep_home_path(void);
93 
94 /* set this path to customize the preference storage */
95 const char *archdep_pref_path;
96 
97 #define LIBDIR VICEDIR
98 
99 #if defined(__FreeBSD__) || defined(__NetBSD__)
100 #define DOCDIR PREFIX "/share/doc/vice"
101 #else
102 #define DOCDIR LIBDIR "/doc"
103 #endif
104 
105 #define VICEUSERDIR ".vice"
106 
107 /*
108     these are used for socket send/recv. in this case we might
109     get SIGPIPE if the connection is unexpectedly closed.
110 */
111 void archdep_signals_init(int do_core_dumps);
112 void archdep_signals_pipe_set(void);
113 void archdep_signals_pipe_unset(void);
114 
115 #ifdef MACOSX_SUPPORT
116 #define MAKE_SO_NAME_VERSION_PROTO(name, version)  "lib" #name "." #version ".dylib"
117 #else
118 #define MAKE_SO_NAME_VERSION_PROTO(name, version)  "lib" #name ".so." #version
119 #endif
120 
121 /* add second level macro to allow expansion and stringification */
122 #define ARCHDEP_MAKE_SO_NAME_VERSION(n, v) MAKE_SO_NAME_VERSION_PROTO(n, v)
123 
124 #ifdef MACOSX_SUPPORT
125 #define ARCHDEP_OPENCBM_SO_NAME  "libopencbm.dylib"
126 #define ARCHDEP_LAME_SO_NAME     "libmp3lame.dylib"
127 #else
128 #define ARCHDEP_OPENCBM_SO_NAME  "libopencbm.so"
129 #define ARCHDEP_LAME_SO_NAME     "libmp3lame.so"
130 #endif
131 
132 /* what to use to return an error when a socket error happens */
133 #define ARCHDEP_SOCKET_ERROR errno
134 
135 /* Keyword to use for a static prototype */
136 #define STATIC_PROTOTYPE static
137 
138 #endif
139