~ubuntu-branches/ubuntu/gutsy/audacity/gutsy-backports

« back to all changes in this revision

Viewing changes to lib-src/libsndfile/src/create_symbols_file.py

  • Committer: Bazaar Package Importer
  • Author(s): John Dong
  • Date: 2008-02-18 21:58:19 UTC
  • mfrom: (13.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080218215819-tmbcf1rx238r8gdv
Tags: 1.3.4-1.1ubuntu1~gutsy1
Automated backport upload; no source changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
 
3
 
# Copyright (C) 2003,2004 Erik de Castro Lopo <erikd@mega-nerd.com>
4
 
#
5
 
# All rights reserved.
6
 
#
7
 
# Redistribution and use in source and binary forms, with or without
8
 
# modification, are permitted provided that the following conditions are
9
 
# met:
10
 
#
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
16
 
#       distribution.
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.
20
 
#
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.
32
 
 
33
 
import re, sys
34
 
 
35
 
#----------------------------------------------------------------
36
 
# These are all of the public functions exported from libsndfile.
37
 
#
38
 
# Its important not to change the order they are listed in or
39
 
# the ordinal values in the second column.
40
 
 
41
 
ALL_SYMBOLS = (
42
 
        (       "sf_command",           1       ),
43
 
        (       "sf_open",                      2       ),
44
 
        (       "sf_close",                     3       ),
45
 
        (       "sf_seek",                      4       ),
46
 
        (       "sf_error",                     7       ),
47
 
        (       "sf_perror",            8       ),
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_open_fd",           70      ),
73
 
        (       "sf_open_virtual",      80      ),
74
 
        (       "sf_write_sync",        90      )
75
 
        )
76
 
 
77
 
#-------------------------------------------------------------------------------
78
 
 
79
 
def linux_symbols (progname, version):
80
 
        print "# Auto-generated by %s\n" %progname
81
 
        print "libsndfile.so.%s" % version
82
 
        print "{"
83
 
        print "  global:"
84
 
        for name, ordinal in ALL_SYMBOLS:
85
 
                print "    %s ;" % name
86
 
        print "  local:"
87
 
        print "    * ;"
88
 
        print "} ;"
89
 
        print
90
 
        return
91
 
 
92
 
def darwin_symbols (progname, version):
93
 
        print "# Auto-generated by %s\n" %progname
94
 
        for name, ordinal in ALL_SYMBOLS:
95
 
                print "_%s" % name
96
 
        print
97
 
        return
98
 
 
99
 
def win32_symbols (progname, version, name):
100
 
        print "; Auto-generated by %s\n" %progname
101
 
        print "LIBRARY %s-%s.dll" % (name, re.sub ("\..*", "", version))
102
 
        print "EXPORTS\n"
103
 
        for name, ordinal in ALL_SYMBOLS:
104
 
                print "%-20s @%s" % (name, ordinal)
105
 
        print
106
 
        return
107
 
 
108
 
def no_symbols (os_name):
109
 
        print
110
 
        print "No known way of restricting exported symbols on '%s'." % os_name
111
 
        print "If you know a way, please contact the author."
112
 
        print
113
 
        return
114
 
 
115
 
#-------------------------------------------------------------------------------
116
 
 
117
 
progname = re.sub (".*[\\/]", "", sys.argv [0])
118
 
 
119
 
if len (sys.argv) != 3:
120
 
        print
121
 
        print "Usage : %s <target OS name> <libsndfile version>." % progname
122
 
        print
123
 
        print "    Currently supported values for target OS are:"
124
 
        print "          linux"
125
 
        print "          darwin     (ie MacOSX)"
126
 
        print "          win32      (ie wintendo)"
127
 
        print "          cygwin     (Cygwin on wintendo)"
128
 
        print
129
 
        sys.exit (1)
130
 
 
131
 
os_name = sys.argv [1]
132
 
version = re.sub ("\.[a-z0-9]+$", "", sys.argv [2])
133
 
 
134
 
if os_name == "linux":
135
 
        linux_symbols (progname, version)
136
 
elif os_name == "darwin":
137
 
        darwin_symbols (progname, version)
138
 
elif os_name == "win32":
139
 
        win32_symbols (progname, version, "libsndfile")
140
 
elif os_name == "cygwin":
141
 
        win32_symbols (progname, version, "cygsndfile")
142
 
else:
143
 
        no_symbols (os_name)
144
 
 
145
 
sys.exit (0)
146
 
 
147
 
# Do not edit or modify anything in this comment block.
148
 
# The arch-tag line is a file identity tag for the GNU Arch
149
 
# revision control system.
150
 
#
151
 
# arch-tag: 5814f35c-318f-4023-a0c3-d9cf7c9e5f6c
152