]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
valac: Add --symbols option
authorJürg Billeter <j@bitron.ch>
Tue, 15 Dec 2009 19:06:05 +0000 (20:06 +0100)
committerJürg Billeter <j@bitron.ch>
Tue, 15 Dec 2009 19:06:05 +0000 (20:06 +0100)
Writes the name of each exported function to the specified file.

Based on patch by Haakon Sporsheim, fixes bug 586494.

codegen/valaccodebasemodule.vala
compiler/valacompiler.vala
vala/valacodecontext.vala

index 0a7779f33f51f73ae7b344153ed0cae6173f0ffc..3ca3c6fac43b0f3b4a752be0ebc67ed74ac80173 100644 (file)
@@ -364,6 +364,21 @@ internal class Vala.CCodeBaseModule : CCodeModule {
                        }
                }
 
+               // generate symbols file for public API
+               if (context.symbols_filename != null) {
+                       var stream = FileStream.open (context.symbols_filename, "w");
+
+                       foreach (CCodeNode node in header_declarations.type_member_declaration.get_children ()) {
+                               if (node is CCodeFunction) {
+                                       var func = (CCodeFunction) node;
+                                       stream.puts (func.name);
+                                       stream.putc ('\n');
+                               }
+                       }
+
+                       stream = null;
+               }
+
                // generate C header file for public API
                if (context.header_filename != null) {
                        var writer = new CCodeWriter (context.header_filename);
index 3f37fbd6caa941f1721ba0e6df898899733af0e7..bddaa1f4984bee915ad7e9442d7c3555bb02b68e 100644 (file)
@@ -49,6 +49,7 @@ class Vala.Compiler {
        static bool use_header;
        static string internal_header_filename;
        static string internal_vapi_filename;
+       static string symbols_filename;
        static string includedir;
        static bool compile_only;
        static string output;
@@ -94,6 +95,7 @@ class Vala.Compiler {
                { "includedir", 0, 0, OptionArg.FILENAME, ref includedir, "Directory used to include the C header file", "DIRECTORY" },
                { "internal-header", 'h', 0, OptionArg.FILENAME, ref internal_header_filename, "Output internal C header file", "FILE" },
                { "internal-vapi", 0, 0, OptionArg.FILENAME, ref internal_vapi_filename, "Output vapi with internal api", "FILE" },
+               { "symbols", 0, 0, OptionArg.FILENAME, ref symbols_filename, "Output symbols file", "FILE" },
                { "compile", 'c', 0, OptionArg.NONE, ref compile_only, "Compile but do not link", null },
                { "output", 'o', 0, OptionArg.FILENAME, ref output, "Place output in file FILE", "FILE" },
                { "debug", 'g', 0, OptionArg.NONE, ref debug, "Produce debug information", null },
@@ -218,6 +220,7 @@ class Vala.Compiler {
                }
                context.use_header = use_header;
                context.internal_header_filename = internal_header_filename;
+               context.symbols_filename = symbols_filename;
                context.includedir = includedir;
                context.output = output;
                if (basedir == null) {
index 5f573231ca1fbb9f50ab97f68134e4df2237f88c..e9e694df7c7e9f02da1c465aa36b667a648d09bc 100644 (file)
@@ -78,6 +78,11 @@ public class Vala.CodeContext {
         */
        public string? includedir { get; set; }
 
+       /**
+        * Output symbols file.
+        */
+       public string? symbols_filename { get; set; }
+
        /**
         * Compile but do not link.
         */