f2cab122e9623d61fe8f3648ad1de1f7951e30b7
3 # Copyright (C) 2003-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions are
11 # * Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # * Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in
15 # the documentation and/or other materials provided with the
17 # * Neither the author nor the names of any contributors may be used
18 # to endorse or promote products derived from this software without
19 # specific prior written permission.
21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28 # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 #----------------------------------------------------------------
36 # These are all of the public functions exported from libsndfile.
38 # Its important not to change the order they are listed in or
39 # the ordinal values in the second column.
48 ( "sf_error_str", 9 ),
49 ( "sf_error_number", 10 ),
50 ( "sf_format_check", 11 ),
51 ( "sf_read_raw", 16 ),
52 ( "sf_readf_short", 17 ),
53 ( "sf_readf_int", 18 ),
54 ( "sf_readf_float", 19 ),
55 ( "sf_readf_double", 20 ),
56 ( "sf_read_short", 21 ),
57 ( "sf_read_int", 22 ),
58 ( "sf_read_float", 23 ),
59 ( "sf_read_double", 24 ),
60 ( "sf_write_raw", 32 ),
61 ( "sf_writef_short", 33 ),
62 ( "sf_writef_int", 34 ),
63 ( "sf_writef_float", 35 ),
64 ( "sf_writef_double", 36 ),
65 ( "sf_write_short", 37 ),
66 ( "sf_write_int", 38 ),
67 ( "sf_write_float", 39 ),
68 ( "sf_write_double", 40 ),
69 ( "sf_strerror", 50 ),
70 ( "sf_get_string", 60 ),
71 ( "sf_set_string", 61 ),
72 ( "sf_version_string",68 ),
74 ( "sf_wchar_open", 71 ),
75 ( "sf_open_virtual", 80 ),
76 ( "sf_write_sync", 90 )
79 #-------------------------------------------------------------------------------
81 def linux_symbols (progname
, version
):
82 print "# Auto-generated by %s\n" %progname
83 print "libsndfile.so.%s" % version
86 for name
, ordinal
in ALL_SYMBOLS
:
87 if name
== "sf_wchar_open":
96 def darwin_symbols (progname
, version
):
97 print "# Auto-generated by %s\n" %progname
98 for name
, ordinal
in ALL_SYMBOLS
:
99 if name
== "sf_wchar_open":
105 def win32_symbols (progname
, version
, name
):
106 print "; Auto-generated by %s\n" %progname
107 print "LIBRARY %s-%s.dll" % (name
, re
.sub ("\..*", "", version
))
109 for name
, ordinal
in ALL_SYMBOLS
:
110 print "%-20s @%s" % (name
, ordinal
)
114 def os2_symbols (progname
, version
, name
):
115 print "; Auto-generated by %s\n" %progname
116 print "LIBRARY %s%s" % (name
, re
.sub ("\..*", "", version
))
117 print "INITINSTANCE TERMINSTANCE"
118 print "CODE PRELOAD MOVEABLE DISCARDABLE"
119 print "DATA PRELOAD MOVEABLE MULTIPLE NONSHARED"
121 for name
, ordinal
in ALL_SYMBOLS
:
122 if name
== "sf_wchar_open":
124 print "_%-20s @%s" % (name
, ordinal
)
128 def plain_symbols (progname
, version
, name
):
129 for name
, ordinal
in ALL_SYMBOLS
:
132 def no_symbols (os_name
):
134 print "No known way of restricting exported symbols on '%s'." % os_name
135 print "If you know a way, please contact the author."
139 #-------------------------------------------------------------------------------
141 progname
= re
.sub (".*[\\/]", "", sys
.argv
[0])
143 if len (sys
.argv
) != 3:
145 print "Usage : %s <target OS name> <libsndfile version>." % progname
147 print " Currently supported values for target OS are:"
149 print " darwin (ie MacOSX)"
150 print " win32 (ie wintendo)"
151 print " cygwin (Cygwin on wintendo)"
153 print " plain (plain list of symbols)"
157 os_name
= sys
.argv
[1]
158 version
= re
.sub ("\.[a-z0-9]+$", "", sys
.argv
[2])
160 if os_name
== "linux" or os_name
== "gnu" or os_name
== "binutils":
161 linux_symbols (progname
, version
)
162 elif os_name
== "darwin":
163 darwin_symbols (progname
, version
)
164 elif os_name
== "win32":
165 win32_symbols (progname
, version
, "libsndfile")
166 elif os_name
== "cygwin":
167 win32_symbols (progname
, version
, "cygsndfile")
168 elif os_name
== "os2":
169 os2_symbols (progname
, version
, "sndfile")
170 elif os_name
== "static":
171 plain_symbols (progname
, version
, "")