Revision: 72381
          http://sourceforge.net/p/brlcad/code/72381
Author:   starseeker
Date:     2019-02-09 16:46:29 +0000 (Sat, 09 Feb 2019)
Log Message:
-----------
Start adding the very minimal bits needed for view related commands.  rt 
doesn't work because it still needs Tcl at the moment.

Modified Paths:
--------------
    brlcad/trunk/src/gtools/gsh.cxx

Modified: brlcad/trunk/src/gtools/gsh.cxx
===================================================================
--- brlcad/trunk/src/gtools/gsh.cxx     2019-02-09 14:18:59 UTC (rev 72380)
+++ brlcad/trunk/src/gtools/gsh.cxx     2019-02-09 16:46:29 UTC (rev 72381)
@@ -87,6 +87,14 @@
        bu_exit(EXIT_FAILURE, "ERROR, could not load libged: %s\n", 
bu_dlerror());
     }
 
+    /* If we hope to do any drawing, for the moment we need to initialize the 
LIBRT global */
+    BU_LIST_INIT(&RTG.rtg_vlfree);
+
+    /* Need a view for commands that expect a view */
+    struct bview *gsh_view;
+    BU_GET(gsh_view, struct bview);
+    ged_view_init(gsh_view);
+
     /* See if we've been told to pre-load a specific .g file. */
     if (argc) {
        if (!bu_file_exists(argv[0], NULL)) {
@@ -100,6 +108,7 @@
            bu_dlclose(libged);
            bu_exit(EXIT_FAILURE, "Could not open %s as a .g file\n", argv[0]) ;
        } else {
+           gedp->ged_gvp = gsh_view;
            bu_vls_sprintf(&open_gfile, "%s", argv[0]);
        }
     }
@@ -145,8 +154,15 @@
            if (ac > 1) {
                if (gedp) ged_close(gedp);
                gedp = ged_open("db", av[1], 0);
-               bu_vls_sprintf(&open_gfile, "%s", av[1]);
-               printf("Opened file %s\n", bu_vls_addr(&open_gfile));
+               if (!gedp) {
+                   bu_vls_free(&msg);
+                   bu_dlclose(libged);
+                   bu_exit(EXIT_FAILURE, "Could not open %s as a .g file\n", 
av[1]) ;
+               } else {
+                   gedp->ged_gvp = gsh_view;
+                   bu_vls_sprintf(&open_gfile, "%s", av[1]);
+                   printf("Opened file %s\n", bu_vls_addr(&open_gfile));
+               }
            } else {
                printf("Error: invalid ged_open call\n");
            }
@@ -192,6 +208,7 @@
     }
 
 done:
+    BU_PUT(gsh_view, struct bview);
     bu_dlclose(libged);
     if (gedp) ged_close(gedp);
     linenoiseHistoryFree();

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to