Index: p/src/gph/Makefile
===================================================================
--- app/src/gph/Makefile	(revision 8d3e6ab33b2b6727eb54bb3498a0ba2af9ca9ea1)
+++ 	(revision )
@@ -1,9 +1,0 @@
-
-gph:
-
-copy:
-ifdef UTT_BIN_DIR
-	cp gph ${UTT_BIN_DIR}
-endif
-
-clean:
Index: p/src/gph/gph
===================================================================
--- app/src/gph/gph	(revision 3748bd1db46143a281581cb44dc804da0190cbc2)
+++ 	(revision )
@@ -1,162 +1,0 @@
-#!/usr/bin/perl
-
-#package:	UAM Text Tools
-#component:	gph
-#version:	1.0
-#author:	Tomasz Obrebski
-
-use strict;
-use Getopt::Long;
-use File::HomeDir;
-
-
-
-
-
-my $systemconfigfile='/usr/local/etc/utt/gph.conf';
-my $userconfigfile=home()."/.utt/gph.conf";
-
-Getopt::Long::Configure('no_ignore_case_always');
-
-my $help=0;
-my $inputfile=0;
-my $outputfile=0;
-my @process=();
-my $reset;
-my $interactive=0;
-
-#read configuration files###########################
-my $file;
-my @process_conf=();
-foreach $file ($systemconfigfile, $userconfigfile){
-  if(open(CONFIG, $file)){
-        while (<CONFIG>) {
-                chomp;
-                s/#.*//;
-                s/^\s+//;
-                s/\s+$//;
-                next unless length;
-                my ($name, $value) = split(/\s*=\s*/, $_, 2);
-                if(($name eq "inputfile")or($name eq "f")){
-                        $inputfile=$value;
-                }
-                elsif(($name eq "outputfile")or($name eq "o")){
-                        $outputfile=$value;
-                }
-                elsif(($name eq "process")or($name eq "p")){
-                        push @process_conf, $value;
-                }
-                elsif(($name eq "reset")or($name eq "r")){
-                        $reset=$value;
-                }
-                elsif(($name eq "interactive")or($name eq "i")){
-                        $interactive=1;
-                }
-                elsif(($name eq "help")or($name eq "h")){
-                        $help=1;
-                }
-
-        }
-        close CONFIG;
-  }
-}
-#########################################################
-
-
-
-GetOptions("process|p=s" => \@process,
-           "inputfile|f=s" => \$inputfile,
-           "outputfile|o=s" => \$outputfile,
-	   "help|h" => \$help,
-	   "reset|r=s" => \$reset,
-	   "interactive|i" => \$interactive);
-
-@process = @process_conf if @process<1;
-
-if($help)
-{
-    print <<'END'
-Usage: gph [OPTIONS]
-
-Options:
-   --process=TYPE -p TYPE    Process segments of type TYPE.
-   --reset=TYPE -r TYPE      Start new graph at tags of type TYPE.
-   --inputfile=FILE -f FILE  Input file.
-   --outputfile=FILE -o FILE Output file.
-   --interactive -i          Toggle interactive mode (default=off).
-END
-;
-    exit 0;
-}
-
-
-$|=1 if $interactive;
-
-
-if(!$inputfile or $inputfile eq "-") {
-	*INPUT = *STDIN;
-}
-else {
-	open(INPUT, "$inputfile") or die("Can't open input file: $inputfile!");
-}
-
-if(!$outputfile or $outputfile eq "-") {
-	*OUTPUT = *STDOUT;
-}
-else {
-	open(OUTPUT, "$outputfile") or die("Can't open output file: $outputfile!");
-}
-
-my @prev;
-my $n=0;
-
-while(<INPUT>)
-{
-    chomp;
-    my $do=0;
-
-    my @line = split /\s+/;
-
-    if($line[2] eq $reset)
-    {
-	$n=0;
-	@prev = ();
-    }
-
-    for my $p (@process)
-    {
-	$do=1 if $line[2] eq $p;
-    }
-
-	my $gph = '';
-    if($do)
-    {
-	my @preds = ();
-	shift @prev while @prev+0 && $prev[0]->[1] + $prev[0]->[2] < $line[0];
-	for my $p (@prev)
-	{
-	    push(@preds, $p->[0]) if $p->[1] + $p->[2] == $line[0];
-	}
-	push @prev, [$n, $line[0], $line[1]];
-	
-	$gph=' gph:'.$n.':'.join(',',@preds);
-
-	$n++;
-    }
-    else
-    {
-	for my $p (@prev)
-	{
-	    if($p->[1]+$p->[2] == $line[0])
-	    {
-		$p->[2] += $line[1];
-	    }
-	}
-
-	$gph='';
-
-    }
-
-    print OUTPUT $_.$gph."\n";    
-}
-
Index: auto/defaults
===================================================================
--- auto/defaults	(revision 44f59b8b510ac7c3b21f669b0d25ed4cb4201f3f)
+++ auto/defaults	(revision e4cec26b9f4157c18cc9809b9570c3f2eb14cc03)
@@ -20,4 +20,6 @@
 DEFAULT_SORT='/usr/bin/sort'
 DEFAULT_PR='/usr/bin/pr'
+DEFAULT_CP='/bin/cp'
+DEFAULT_CHMOD='/bin/chmod'
 
 DEFAULT_CFLAGS='-g -O2 -Wall'
@@ -25,4 +27,5 @@
 DEFAULT_LDLIBS=''
 DEFAULT_BFLAGS=''
+DEFAULT_FFLAGS=''
 
 DEFAULT_DESTDIR=
Index: auto/options
===================================================================
--- auto/options	(revision 44f59b8b510ac7c3b21f669b0d25ed4cb4201f3f)
+++ auto/options	(revision e4cec26b9f4157c18cc9809b9570c3f2eb14cc03)
@@ -23,4 +23,6 @@
 if [ -z "$SORT" ];              then SORT=$DEFAULT_SORT;                            fi
 if [ -z "$PR" ];                then PR=$DEFAULT_PR;                                fi
+if [ -z "$CP" ];                then CP=$DEFAULT_CP;                                fi
+if [ -z "$CHMOD" ];             then CHMOD=$DEFAULT_CHMOD;                          fi
 
 if [ -z "$CFLAGS" ];            then CFLAGS=$DEFAULT_CFLAGS;                        fi
@@ -28,4 +30,5 @@
 if [ -z "$LDLIBS" ];            then LDLIBS=$DEFAULT_LDLIBS;                        fi
 if [ -z "$BFLAGS" ];            then BFLAGS=$DEFAULT_BFLAGS;                        fi
+if [ -z "$FFLAGS" ];            then FFLAGS=$DEFAULT_FFLAGS;                        fi
 
 if [ -z "$DESTDIR" ];           then DESTDIR=$DEFAULT_DESTDIR;                      fi
@@ -75,4 +78,6 @@
     SORT=*)             SORT="$value"                             ;;
     PR=*)               PR="$value"                               ;;
+    CP=*)               CP="$value"                               ;;
+    CHMOD=*)            CHMOD="$value"                            ;;
 
     CFLAGS=*)           CFLAGS="$value"                           ;;
@@ -80,4 +85,5 @@
     LDLIBS=*)           LDLIBS="$value"                           ;;
     BFLAGS=*)           BFLAGS="$value"                           ;;
+    FFLAGS=*)           FFLAGS="$value"                           ;;
   esac
 done
@@ -128,4 +134,6 @@
   SORT                  sort command
   PR                    pr command
+  CP                    cp command
+  CHMOD                 chmod command
 
   CFLAGS                C compiler flags
@@ -134,4 +142,5 @@
   LDLIBS                libraries to pass to the linker, e.g. -l<library>
   BFLAGS                Bison compiler flags
+  FFLAGS                Flex compiler flags
 
 Use these variables to override default values.
Index: auto/output/Makefile
===================================================================
--- auto/output/Makefile	(revision 9e0afb505e266b0a64e2c91b685b3361c9c3bfb3)
+++ auto/output/Makefile	(revision e4cec26b9f4157c18cc9809b9570c3f2eb14cc03)
@@ -17,4 +17,6 @@
 SORT = $SORT
 PR = $PR
+CP = $CP
+CHMOD = $CHMOD
 
 CFLAGS = $CFLAGS
@@ -22,4 +24,5 @@
 LDLIBS = $LDLIBS
 BFLAGS = $BFLAGS
+FFLAGS = $FFLAGS
 
 DESTDIR = $DESTDIR
@@ -43,5 +46,5 @@
 VPATH = ./src
 
-PROGRAMS = tok sen fla
+PROGRAMS = tok sen fla gph
 
 TOK_OBJ_FILES = tok.o tok_cmdline.o
@@ -54,4 +57,6 @@
 
 FLA_OBJ_FILES = fla.o
+
+GPH_PERL_FILES = gph.pl
 
 CONFIG_FILES = src/config.h Makefile
@@ -107,11 +112,15 @@
 
 %.c: %.ggo
-	gengetopt --input $< --file-name \$(basename \$@) --conf-parser
+	gengetopt --input \$< --file-name \$(basename \$@) --conf-parser
 
 %.h: %.ggo
-	gengetopt --input $< --file-name \$(basename \$@) --conf-parser
+	gengetopt --input \$< --file-name \$(basename \$@) --conf-parser
 
 %: %.o
 	\$(CC) \$? -o \$@ \$(ALL_LDFLAGS) \$(ALL_CFLAGS) \$(ALL_LDLIBS)
+
+%: %.pl
+	\$(CP) \$< \$@
+	\$(CHMOD) a+x \$@
 
 tok: \$(TOK_OBJ_FILES)
Index: auto/summary
===================================================================
--- auto/summary	(revision 44f59b8b510ac7c3b21f669b0d25ed4cb4201f3f)
+++ auto/summary	(revision e4cec26b9f4157c18cc9809b9570c3f2eb14cc03)
@@ -38,4 +38,6 @@
   SORT            : $SORT
   PR              : $PR
+  CP              : $CP
+  CHMOD           : $CHMOD
 
   CFLAGS          : $CFLAGS
@@ -43,4 +45,5 @@
   LDLIBS          : $LDLIBS
   BFLAGS          : $BFLAGS
+  FFLAGS          : $FFLAGS
 
 SUMMARY_END
Index: src/gph.pl
===================================================================
--- src/gph.pl	(revision e4cec26b9f4157c18cc9809b9570c3f2eb14cc03)
+++ src/gph.pl	(revision e4cec26b9f4157c18cc9809b9570c3f2eb14cc03)
@@ -0,0 +1,162 @@
+#!/usr/bin/perl
+
+#package:	UAM Text Tools
+#component:	gph
+#version:	1.0
+#author:	Tomasz Obrebski
+
+use strict;
+use Getopt::Long;
+use File::HomeDir;
+
+
+
+
+
+my $systemconfigfile='/usr/local/etc/utt/gph.conf';
+my $userconfigfile=home()."/.utt/gph.conf";
+
+Getopt::Long::Configure('no_ignore_case_always');
+
+my $help=0;
+my $inputfile=0;
+my $outputfile=0;
+my @process=();
+my $reset;
+my $interactive=0;
+
+#read configuration files###########################
+my $file;
+my @process_conf=();
+foreach $file ($systemconfigfile, $userconfigfile){
+  if(open(CONFIG, $file)){
+        while (<CONFIG>) {
+                chomp;
+                s/#.*//;
+                s/^\s+//;
+                s/\s+$//;
+                next unless length;
+                my ($name, $value) = split(/\s*=\s*/, $_, 2);
+                if(($name eq "inputfile")or($name eq "f")){
+                        $inputfile=$value;
+                }
+                elsif(($name eq "outputfile")or($name eq "o")){
+                        $outputfile=$value;
+                }
+                elsif(($name eq "process")or($name eq "p")){
+                        push @process_conf, $value;
+                }
+                elsif(($name eq "reset")or($name eq "r")){
+                        $reset=$value;
+                }
+                elsif(($name eq "interactive")or($name eq "i")){
+                        $interactive=1;
+                }
+                elsif(($name eq "help")or($name eq "h")){
+                        $help=1;
+                }
+
+        }
+        close CONFIG;
+  }
+}
+#########################################################
+
+
+
+GetOptions("process|p=s" => \@process,
+           "inputfile|f=s" => \$inputfile,
+           "outputfile|o=s" => \$outputfile,
+	   "help|h" => \$help,
+	   "reset|r=s" => \$reset,
+	   "interactive|i" => \$interactive);
+
+@process = @process_conf if @process<1;
+
+if($help)
+{
+    print <<'END'
+Usage: gph [OPTIONS]
+
+Options:
+   --process=TYPE -p TYPE    Process segments of type TYPE.
+   --reset=TYPE -r TYPE      Start new graph at tags of type TYPE.
+   --inputfile=FILE -f FILE  Input file.
+   --outputfile=FILE -o FILE Output file.
+   --interactive -i          Toggle interactive mode (default=off).
+END
+;
+    exit 0;
+}
+
+
+$|=1 if $interactive;
+
+
+if(!$inputfile or $inputfile eq "-") {
+	*INPUT = *STDIN;
+}
+else {
+	open(INPUT, "$inputfile") or die("Can't open input file: $inputfile!");
+}
+
+if(!$outputfile or $outputfile eq "-") {
+	*OUTPUT = *STDOUT;
+}
+else {
+	open(OUTPUT, "$outputfile") or die("Can't open output file: $outputfile!");
+}
+
+my @prev;
+my $n=0;
+
+while(<INPUT>)
+{
+    chomp;
+    my $do=0;
+
+    my @line = split /\s+/;
+
+    if($line[2] eq $reset)
+    {
+	$n=0;
+	@prev = ();
+    }
+
+    for my $p (@process)
+    {
+	$do=1 if $line[2] eq $p;
+    }
+
+	my $gph = '';
+    if($do)
+    {
+	my @preds = ();
+	shift @prev while @prev+0 && $prev[0]->[1] + $prev[0]->[2] < $line[0];
+	for my $p (@prev)
+	{
+	    push(@preds, $p->[0]) if $p->[1] + $p->[2] == $line[0];
+	}
+	push @prev, [$n, $line[0], $line[1]];
+	
+	$gph=' gph:'.$n.':'.join(',',@preds);
+
+	$n++;
+    }
+    else
+    {
+	for my $p (@prev)
+	{
+	    if($p->[1]+$p->[2] == $line[0])
+	    {
+		$p->[2] += $line[1];
+	    }
+	}
+
+	$gph='';
+
+    }
+
+    print OUTPUT $_.$gph."\n";    
+}
+
