read: Fix a possible infinite loop of isom_read_skip_box_extra_bytes().
[L-SMASH.git] / windows / dllexportgen.cs
blob684e087799ffab4a4df1b6180f078f14814725ad
1 using System.IO;
2 using System.Text.RegularExpressions;
4 namespace dllexportgen
6 class dllexportgen
8 static void Main(string[] args)
10 var sw = new StreamReader(args[0] + "\\lsmash.h");
11 var so = new StreamWriter(args[0] + "\\lsmash.def");
12 string prevline = "";
14 so.WriteLine("EXPORTS");
16 while (!sw.EndOfStream)
18 var funcregex = new Regex("^\\($");
19 var typeregex = new Regex("^DEFINE_(ISOM|QTFF)_CODEC_TYPE\\(");
21 string line = sw.ReadLine();
23 if (funcregex.IsMatch(line) && prevline != "")
25 /* Export all public API functions. */
26 var sub = new Regex(".+\\s+\\*{0,1}(.+)");
27 string newline = sub.Replace(prevline, "$1");
29 so.Write(" ");
30 so.WriteLine(newline);
32 else if (typeregex.IsMatch(line))
34 /* Export all codec types. */
35 var sub = new Regex("^.+\\s+((ISOM|QT|LSMASH)_CODEC_TYPE_.+?),\\s+.+");
36 string newline = sub.Replace(line, "$1");
38 so.Write(" ");
39 so.WriteLine(newline);
42 prevline = line;
45 sw.Close();
47 /* Non-public symbols for the cli apps. */
48 so.Write("lsmash_importer_open\n" +
49 "lsmash_importer_get_access_unit\n" +
50 "lsmash_importer_close\n" +
51 "lsmash_importer_get_track_count\n" +
52 "lsmash_importer_get_last_delta\n" +
53 "lsmash_importer_construct_timeline\n" +
54 "lsmash_duplicate_summary\n" +
55 "lsmash_string_from_wchar\n" +
56 "lsmash_win32_fopen");
58 so.Flush();
59 so.Close();