Browse Source

Look for extra hctdb files in same dir as hctdb scripts (#419)

Allows the hctdb_instrhelper.py script to be run from outside
utils/hct. No change in generated code.
David Peixotto 8 years ago
parent
commit
cc64547852
2 changed files with 5 additions and 2 deletions
  1. 3 1
      utils/hct/hctdb.py
  2. 2 1
      utils/hct/hctdb_instrhelp.py

+ 3 - 1
utils/hct/hctdb.py

@@ -3,6 +3,7 @@
 ###############################################################################
 ###############################################################################
 # DXIL information.                                                           #
 # DXIL information.                                                           #
 ###############################################################################
 ###############################################################################
+import os
 
 
 class db_dxil_enum_value(object):
 class db_dxil_enum_value(object):
     "A representation for a value in an enumeration type"
     "A representation for a value in an enumeration type"
@@ -1118,7 +1119,8 @@ class db_dxil(object):
         inst_starter = "* Inst: "
         inst_starter = "* Inst: "
         block_starter = "* BLOCK-BEGIN"
         block_starter = "* BLOCK-BEGIN"
         block_end = "* BLOCK-END"
         block_end = "* BLOCK-END"
-        with open("hctdb_inst_docs.txt") as ops_file:
+        thisdir = os.path.dirname(os.path.realpath(__file__))
+        with open(os.path.join(thisdir, "hctdb_inst_docs.txt")) as ops_file:
             inst_name = ""
             inst_name = ""
             inst_doc = ""
             inst_doc = ""
             inst_remarks = ""
             inst_remarks = ""

+ 2 - 1
utils/hct/hctdb_instrhelp.py

@@ -16,7 +16,8 @@ g_db_hlsl = None
 def get_db_hlsl():
 def get_db_hlsl():
     global g_db_hlsl
     global g_db_hlsl
     if g_db_hlsl is None:
     if g_db_hlsl is None:
-      with open("gen_intrin_main.txt", "r") as f:
+      thisdir = os.path.dirname(os.path.realpath(__file__))
+      with open(os.path.join(thisdir, "gen_intrin_main.txt"), "r") as f:
         g_db_hlsl = db_hlsl(f)
         g_db_hlsl = db_hlsl(f)
     return g_db_hlsl
     return g_db_hlsl