1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2015-2017 L-SMASH project
6 * Authors: Derek Buitenhuis <derek.buitenhuis@gmail.com>
8 * Permission to use, copy, modify, and/or distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies.
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 *****************************************************************************/
21 /* This file is available under an ISC license. */
24 using System
.Text
.RegularExpressions
;
26 namespace dllexportgen
30 static void Main(string[] args
)
32 var sw
= new StreamReader(args
[0] + "\\lsmash.h");
33 var so
= new StreamWriter(args
[0] + "\\lsmash.def");
36 so
.WriteLine("EXPORTS");
38 while (!sw
.EndOfStream
)
40 var funcregex
= new Regex("^\\($");
41 var typeregex
= new Regex("^DEFINE_(ISOM|QTFF)_CODEC_TYPE\\(");
43 string line
= sw
.ReadLine();
45 if (funcregex
.IsMatch(line
) && prevline
!= "")
47 /* Export all public API functions. */
48 var sub
= new Regex(".+\\s+\\*{0,1}(.+)");
49 string newline
= sub
.Replace(prevline
, "$1");
52 so
.WriteLine(newline
);
54 else if (typeregex
.IsMatch(line
))
56 /* Export all codec types. */
57 var sub
= new Regex("^.+\\s+((ISOM|QT|LSMASH)_CODEC_TYPE_.+?),\\s+.+");
58 string newline
= sub
.Replace(line
, "$1");
61 so
.WriteLine(newline
);
69 /* Non-public symbols for the cli apps. */
70 so
.Write("lsmash_importer_open\n" +
71 "lsmash_importer_get_access_unit\n" +
72 "lsmash_importer_close\n" +
73 "lsmash_importer_get_track_count\n" +
74 "lsmash_importer_get_last_delta\n" +
75 "lsmash_importer_construct_timeline\n" +
76 "lsmash_duplicate_summary\n" +
77 "lsmash_string_from_wchar\n" +
78 "lsmash_win32_fopen");