Revision: 77689
          http://sourceforge.net/p/brlcad/code/77689
Author:   starseeker
Date:     2020-11-04 21:33:31 +0000 (Wed, 04 Nov 2020)
Log Message:
-----------
Something isn't quite right with the build logic for header geneneration here - 
Windows isn't succeeding in its first pass, but does on its second.  That 
probably means there is some sort of dependency issue, but the error message is 
less than informative.  This isn't the first time this step has caused problems 
over the years... rather than trying to depend on a working Tcl/Tk stack for a 
simple quoting job, just use some basic (and self-contained) C++ to do the work.

Modified Paths:
--------------
    brlcad/branches/extbuild/src/other/tktable/CMakeLists.txt
    brlcad/branches/extbuild/src/other/tktable.dist

Added Paths:
-----------
    brlcad/branches/extbuild/src/other/tktable/tktable_hdr.cxx

Removed Paths:
-------------
    brlcad/branches/extbuild/src/other/tktable/misc/

Modified: brlcad/branches/extbuild/src/other/tktable/CMakeLists.txt
===================================================================
--- brlcad/branches/extbuild/src/other/tktable/CMakeLists.txt   2020-11-04 
20:55:25 UTC (rev 77688)
+++ brlcad/branches/extbuild/src/other/tktable/CMakeLists.txt   2020-11-04 
21:33:31 UTC (rev 77689)
@@ -32,12 +32,14 @@
 
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TKTABLE_CFLAGS}")
 
+add_executable(tktable_hdr tktable_hdr.cxx)
+
 add_custom_command(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/tkTable.tcl.h
-  COMMAND ${TCL_TCLSH} ${CMAKE_CURRENT_SOURCE_DIR}/misc/tkTable_header.tcl 
${CMAKE_CURRENT_SOURCE_DIR}/library/tkTable.tcl 
${CMAKE_CURRENT_BINARY_DIR}/tkTable.tcl.h.new
+  COMMAND tktable_hdr ${CMAKE_CURRENT_SOURCE_DIR}/library/tkTable.tcl 
${CMAKE_CURRENT_BINARY_DIR}/tkTable.tcl.h.new
   COMMAND ${CMAKE_COMMAND} -E copy_if_different 
${CMAKE_CURRENT_BINARY_DIR}/tkTable.tcl.h.new 
${CMAKE_CURRENT_BINARY_DIR}/tkTable.tcl.h
   COMMAND ${CMAKE_COMMAND} -E remove 
${CMAKE_CURRENT_BINARY_DIR}/tkTable.tcl.h.new
-  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/library/tkTable.tcl 
${CMAKE_CURRENT_SOURCE_DIR}/misc/tkTable_header.tcl ${TCL_TCLSH}
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/library/tkTable.tcl tktable_hdr
   )
 add_custom_target(tktable_header_gen ALL DEPENDS 
${CMAKE_CURRENT_BINARY_DIR}/tkTable.tcl.h)
 

Added: brlcad/branches/extbuild/src/other/tktable/tktable_hdr.cxx
===================================================================
--- brlcad/branches/extbuild/src/other/tktable/tktable_hdr.cxx                  
        (rev 0)
+++ brlcad/branches/extbuild/src/other/tktable/tktable_hdr.cxx  2020-11-04 
21:33:31 UTC (rev 77689)
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2018-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <cstdio>
+#include <fstream>
+#include <iostream>
+#include <string>
+
+int
+main(int argc, const char *argv[])
+{
+    if (argc < 3) {
+       std::cerr << "Usage: tktable_hdr ifile ofile\n";
+       return -1;
+    }
+
+    std::ifstream fs;
+    fs.open(argv[1]);
+    if (!fs.is_open()) {
+       std::cerr << "Unable to open input file " << argv[1] << "\n";
+    }
+
+    std::ofstream ofile;
+    ofile.open(argv[2], std::fstream::trunc);
+    if (!ofile.is_open()) {
+       std::cerr << "Unable to open output file " << argv[2] << " for 
writing!\n";
+       return -1;
+    }
+
+    std::string sline;
+    while (std::getline(fs, sline)) {
+       if (!sline.length()) {
+           continue;
+       }
+       if (sline[0] == '#') {
+           continue;
+       }
+       std::string nline;
+       for (int i = 0; i < sline.length(); i++) {
+           if (sline[i] == '\\') {
+               nline.append("\\\\");
+           } else if (sline[i] == '"') {
+               nline.append("\\\"");
+           } else {
+               nline.push_back(sline[i]);
+           }
+       }
+       ofile << "\"" << nline << "\\n\"\n";
+    }
+    fs.close();
+
+    ofile.close();
+
+    return 0;
+}
+
+// Local Variables:
+// tab-width: 8
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: t
+// c-file-style: "stroustrup"
+// End:
+// ex: shiftwidth=4 tabstop=8
+


Property changes on: brlcad/branches/extbuild/src/other/tktable/tktable_hdr.cxx
___________________________________________________________________
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
Modified: brlcad/branches/extbuild/src/other/tktable.dist
===================================================================
--- brlcad/branches/extbuild/src/other/tktable.dist     2020-11-04 20:55:25 UTC 
(rev 77688)
+++ brlcad/branches/extbuild/src/other/tktable.dist     2020-11-04 21:33:31 UTC 
(rev 77689)
@@ -20,5 +20,5 @@
 mac/mac_tkTable.mcp.xml
 mac/mac_tkTable.r
 mac/mac_tkTable_prefix.h
-misc/tkTable_header.tcl
+tktable_hdr.cxx
 )

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