Revision: 76409
          http://sourceforge.net/p/brlcad/code/76409
Author:   starseeker
Date:     2020-07-22 12:24:19 +0000 (Wed, 22 Jul 2020)
Log Message:
-----------
List the commands known to the ged plugin system

Modified Paths:
--------------
    brlcad/branches/gedplugins/src/libged/tests/CMakeLists.txt

Added Paths:
-----------
    brlcad/branches/gedplugins/src/libged/tests/plugins.c

Modified: brlcad/branches/gedplugins/src/libged/tests/CMakeLists.txt
===================================================================
--- brlcad/branches/gedplugins/src/libged/tests/CMakeLists.txt  2020-07-22 
12:13:17 UTC (rev 76408)
+++ brlcad/branches/gedplugins/src/libged/tests/CMakeLists.txt  2020-07-22 
12:24:19 UTC (rev 76409)
@@ -4,6 +4,8 @@
 BRLCAD_ADDEXEC(ged_test_list test_list.c libged TEST)
 add_test(NAME ged_test_list COMMAND ged_test_list 2)
 
+BRLCAD_ADDEXEC(ged_test_plugins plugins.c libged TEST)
+
 # Note: it is particularly important that the lint tests in particular are kept
 # in a separate file, since its bad input examples stand an excellent chance of
 # breaking commands.

Added: brlcad/branches/gedplugins/src/libged/tests/plugins.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/tests/plugins.c                       
        (rev 0)
+++ brlcad/branches/gedplugins/src/libged/tests/plugins.c       2020-07-22 
12:24:19 UTC (rev 76409)
@@ -0,0 +1,64 @@
+/*                        P L U G I N S . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2019-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+
+#include "common.h"
+
+#include <stdio.h>
+#include <bu.h>
+#include <ged.h>
+
+int
+main(int ac, char *av[]) {
+    struct ged *gbp;
+
+    bu_setprogname(av[0]);
+
+    if (ac != 2) {
+       printf("Usage: %s file.g\n", av[0]);
+       return 1;
+    }
+    if (!bu_file_exists(av[1], NULL)) {
+       printf("ERROR: [%s] does not exist, expecting .g file\n", av[1]);
+       return 2;
+    }
+
+    gbp = ged_open("db", av[1], 1);
+
+    const char * const *ged_cmds = NULL;
+    size_t ged_cmd_cnt = ged_cmd_list(&ged_cmds);
+
+    for (size_t i = 0; i < ged_cmd_cnt; i++) {
+       bu_log("%s\n", ged_cmds[i]);
+    }
+
+    ged_close(gbp);
+    BU_PUT(gbp, struct ged);
+    return 0;
+}
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */


Property changes on: brlcad/branches/gedplugins/src/libged/tests/plugins.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to