LEF/DEF suffixes can be configured

The way to specify them is through the following
environment variables:

$KLAYOUT_LEF_FORMAT - LEF suffixes (default: "*.lef *.LEF *.lef.gz *.LEF.gz")
$KLAYOUT_DEF_FORMAT - DEF suffixes (default: "*.def *.DEF *.def.gz *.DEF.gz")

The string is a space-separated list of simple
match pattern. Only "*.xyz"-style pattern are allowed
currently.
This commit is contained in:
Matthias Koefferlein 2026-03-20 16:48:35 +01:00
parent 2dfcc9293e
commit 94908162d6
1 changed files with 21 additions and 3 deletions

View File

@ -24,6 +24,7 @@
#include "tlTimer.h"
#include "tlStream.h"
#include "tlFileUtils.h"
#include "tlEnv.h"
#include "dbReader.h"
#include "dbStream.h"
@ -40,14 +41,31 @@ namespace db
// ---------------------------------------------------------------
// Plugin for the stream reader
static std::string lef_file_formats ()
{
static std::string s;
if (s.empty ()) {
s = tl::get_env ("KLAYOUT_LEF_FORMAT", "*.lef *.LEF *.lef.gz *.LEF.gz");
}
return s;
}
static std::string def_file_formats ()
{
static std::string s;
if (s.empty ()) {
s = tl::get_env ("KLAYOUT_DEF_FORMAT", "*.def *.DEF *.def.gz *.DEF.gz");
}
return s;
}
/**
* @brief Determines the format of the given stream
* Returns true, if the stream has LEF format
*/
static bool is_lef_format (const std::string &fn)
{
static std::string lef_format ("LEF files (*.lef *.LEF *.lef.gz *.LEF.gz)");
return tl::match_filename_to_format (fn, lef_format);
return tl::match_filename_to_format (fn, std::string ("LEF files (") + lef_file_formats () + ")");
}
// ---------------------------------------------------------------
@ -253,7 +271,7 @@ class LEFDEFFormatDeclaration
virtual std::string format_name () const { return "LEFDEF"; }
virtual std::string format_desc () const { return "LEF/DEF"; }
virtual std::string format_title () const { return "LEF/DEF (unified reader)"; }
virtual std::string file_format () const { return "LEF/DEF files (*.lef *.LEF *.lef.gz *.LEF.gz *.def *.DEF *.def.gz *.DEF.gz)"; }
virtual std::string file_format () const { return std::string ("LEF/DEF files (") + lef_file_formats () + " " + def_file_formats () + ")"; }
virtual bool detect (tl::InputStream &stream) const
{