[llvm-commits] [hlvm] r38043 - in /hlvm/trunk/utils: bin/mkFuncs.pm bin/mkTokenizer tmplt/Tokenizer_Template.cpp
Reid Spencer
reid at x10sys.com
Sat Jul 7 16:59:15 PDT 2007
Author: reid
Date: Sat Jul 7 18:59:14 2007
New Revision: 38043
URL: http://llvm.org/viewvc/llvm-project?rev=38043&view=rev
Log:
Fix some bug-a-boos with handling the source directory.
Modified:
hlvm/trunk/utils/bin/mkFuncs.pm
hlvm/trunk/utils/bin/mkTokenizer
hlvm/trunk/utils/tmplt/Tokenizer_Template.cpp
Modified: hlvm/trunk/utils/bin/mkFuncs.pm
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/utils/bin/mkFuncs.pm?rev=38043&r1=38042&r2=38043&view=diff
==============================================================================
--- hlvm/trunk/utils/bin/mkFuncs.pm (original)
+++ hlvm/trunk/utils/bin/mkFuncs.pm Sat Jul 7 18:59:14 2007
@@ -1,14 +1,12 @@
#!/usr/bin/perl
+use FindBin;
+
sub get_hlvm_dir
{
- chomp(my $cwd=`pwd`);
- my $hlvmdir = $cwd;
- $hlvmdir =~ s|(.*hlvm).*|$1|;
- if (-d"$hlvmdir/AST") {
- $hlvmdir =~ s|(.*)/hlvm|$1|;
- }
- return $hlvmdir;
+ my $hlvmdir = $FindBin::Bin;
+ my $index = rindex($hlvmdir, "/utils/bin");
+ return substr($hlvmdir,0,$index);
}
sub process_file
Modified: hlvm/trunk/utils/bin/mkTokenizer
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/utils/bin/mkTokenizer?rev=38043&r1=38042&r2=38043&view=diff
==============================================================================
--- hlvm/trunk/utils/bin/mkTokenizer (original)
+++ hlvm/trunk/utils/bin/mkTokenizer Sat Jul 7 18:59:14 2007
@@ -28,26 +28,30 @@
# Usage:
# mkTokenizer -f <schema_file> <hlvm_src_root>
#
+use FindBin;
+use lib $FindBin::Bin;
+use mkFuncs;
+use File::Copy;
+
$SchemaFile = shift;
if ("$SchemaFile" eq "-f") {
$Force = 1;
$SchemaFile = shift;
}
die "USAGE: $0 <schema_file> <hlvm_src_root>\n" if -z "$SchemaFile";
-$HLVM_root = shift;
+$HLVM_root = get_hlvm_dir();
die "USAGE: $0 <schema_file> <hlvm_src_root>\n" if -z "$HLVM_root";
-print "$HLVM_root\n";
$Schema = $SchemaFile;
$Schema =~ s/\.rng//;
$Schema = substr($Schema,rindex($Schema,'/')+1);
-$PreambleFile = "$HLVM_root"."/utils/tmplt/Preamble_Code";
-$HeaderTemplate = "$HLVM_root"."/utils/tmplt/Tokenizer_Template.h";
-$HeaderFile = "$Schema"."Tokenizer.h";
-$SourceTemplate = "$HLVM_root"."/utils/tmplt/Tokenizer_Template.cpp";
-$SourceFile = "$Schema"."Tokenizer.cpp";
-$TokenHashClass = "$Schema" . "TokenHash";
-$TokenHashFile = "$TokenHashClass" . ".i";
+$PreambleFile = $HLVM_root . "/utils/tmplt/Preamble_Code";
+$HeaderTemplate = $HLVM_root . "/utils/tmplt/Tokenizer_Template.h";
+$HeaderFile = $Schema . "Tokenizer.h";
+$SourceTemplate = $HLVM_root . "/utils/tmplt/Tokenizer_Template.cpp";
+$SourceFile = $Schema . "Tokenizer.cpp";
+$TokenHashClass = $Schema . "TokenHash";
+$TokenHashFile = $TokenHashClass . ".i";
# Check the validity of the files we use/create
die "Invalid schema file name" if ! -e "$SchemaFile";
@@ -60,11 +64,6 @@
# Get the plain old schema name from the file name
-use FindBin;
-use lib $FindBin::Bin;
-use mkFuncs;
-use File::Copy;
-
sub sortUnique
{
my @list = @_;
Modified: hlvm/trunk/utils/tmplt/Tokenizer_Template.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/utils/tmplt/Tokenizer_Template.cpp?rev=38043&r1=38042&r2=38043&view=diff
==============================================================================
--- hlvm/trunk/utils/tmplt/Tokenizer_Template.cpp (original)
+++ hlvm/trunk/utils/tmplt/Tokenizer_Template.cpp Sat Jul 7 18:59:14 2007
@@ -5,8 +5,8 @@
/// @brief Implements the functions of class %SCHEMA_NAME%Tokenizer.
///////////////////////////////////////////////////////////////////////////////
-#include <hlvm/%MODULE_PATH%/%SCHEMA_NAME%Tokenizer.h>
-#include <hlvm/%MODULE_PATH%/%SCHEMA_NAME%TokenHash.i>
+#include <%MODULE_PATH%/%SCHEMA_NAME%Tokenizer.h>
+#include <%MODULE_PATH%/%SCHEMA_NAME%TokenHash.i>
namespace HLVM_%MODULE% {
More information about the llvm-commits
mailing list