Index: _old/app/Makefile
===================================================================
--- _old/app/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/Makefile	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -54,5 +54,7 @@
 
 .PHONY: components
-components:		
+components:
+	cd $(SRC_DIR)/lib && make; cd $(CUR_DIR)
+	
 	@for cmp in $(COMPONENTS); do\
 		cd $(SRC_DIR)/$$cmp && make && make copy; cd $(CUR_DIR); \
@@ -80,5 +82,5 @@
 .PHONY: clean_dist
 clean_dist:
-	rm -rf ${UTT_DIR}
+
 
 # ------------------------------------------------------------------
@@ -143,4 +145,5 @@
 #	tar -czvf $(UTT_DIST_NAME).tgz $(UTT_DIR)
 
+
 #clean_dist:
 #	if [ -d $(UTT_DIST_DIR) ]; then rm -r $(UTT_DIST_DIR); else true; fi
Index: ld/app/conf/Makefile
===================================================================
--- _old/app/conf/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ 	(revision )
@@ -1,8 +1,0 @@
-main:
-
-copy:
-ifdef UTT_CONF_DIR
-	cp *.conf ${UTT_CONF_DIR}
-endif
-
-clean:
Index: ld/app/conf/compiledic.conf
===================================================================
--- _old/app/conf/compiledic.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ 	(revision )
@@ -1,13 +1,0 @@
-# ************************************************************
-# * This file was created automatically during installation. *
-# * If you don't need do not change it.                      *
-# *                                                          *
-# * UAM Text Tools                                           *
-# * Adam Mickiewicz University, Poland                       *
-# * http://utt.amu.edu.pl                                    *
-# ************************************************************
-#
-# All lines must looks like:
-# parameter_name [=] value
-#
-symbols = PATH_PREFIX/share/utt/pl_PL.ISO-8859-2/pl_PL.ISO-8859-2.sym
Index: ld/app/conf/cor.conf
===================================================================
--- _old/app/conf/cor.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ 	(revision )
@@ -1,14 +1,0 @@
-# ************************************************************
-# * This file was created automatically during installation. *
-# * If you don't need do not change it.                      *
-# *                                                          *
-# * UAM Text Tools                                           *
-# * Adam Mickiewicz University, Poland                       *
-# * http://utt.amu.edu.pl                                    *
-# ************************************************************
-#
-# All lines must looks like:
-# parameter_name [=] value
-#
-dictionary-home = PATH_PREFIX/share/utt
-process = W
Index: ld/app/conf/dgc.conf
===================================================================
--- _old/app/conf/dgc.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ 	(revision )
@@ -1,15 +1,0 @@
-# ************************************************************
-# * This file was created automatically during installation. *
-# * If you don't need do not change it.                      *
-# *                                                          *
-# * UAM Text Tools                                           *
-# * Adam Mickiewicz University, Poland                       *
-# * http://utt.amu.edu.pl                                    *
-# ************************************************************
-#
-# All lines must looks like:
-# parameter_name [=] value
-#
-categories = PATH_PREFIX/share/utt/cats.dgc
-grammar = PATH_PREFIX/share/utt/gram.dgc
-outputfile = PATH_PREFIX/share/utt/gram.dgp
Index: ld/app/conf/dgp.conf
===================================================================
--- _old/app/conf/dgp.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ 	(revision )
@@ -1,18 +1,0 @@
-# ************************************************************
-# * This file was created automatically during installation. *
-# * If you don't need do not change it.                      *
-# *                                                          *
-# * UAM Text Tools                                           *
-# * Adam Mickiewicz University, Poland                       *
-# * http://utt.amu.edu.pl                                    *
-# ************************************************************
-#
-# All lines must looks like:
-# parameter_name [=] value
-#
-
-grammar = PATH_PREFIX/share/utt/gram.dgp
-process = W
-process = BOS
-process = EOS
-info = d
Index: ld/app/conf/gph.conf
===================================================================
--- _old/app/conf/gph.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ 	(revision )
@@ -1,16 +1,0 @@
-# ************************************************************
-# * This file was created automatically during installation. *
-# * If you don't need do not change it.                      *
-# *                                                          *
-# * UAM Text Tools                                           *
-# * Adam Mickiewicz University, Poland                       *
-# * http://utt.amu.edu.pl                                    *
-# ************************************************************
-#
-# All lines must looks like:
-# parameter_name [=] value
-#
-process = W
-process = BOS
-process = EOS
-reset = BOS
Index: ld/app/conf/grp.conf
===================================================================
--- _old/app/conf/grp.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ 	(revision )
@@ -1,15 +1,0 @@
-# ************************************************************
-# * This file was created automatically during installation. *
-# * If you don't need do not change it.                      *
-# *                                                          *
-# * UAM Text Tools                                           *
-# * Adam Mickiewicz University, Poland                       *
-# * http://utt.amu.edu.pl                                    *
-# ************************************************************
-#
-# All lines must looks like:
-# parameter_name [=] value
-#
-macros = PATH_PREFIX/lib/utt/terms.m4
-tags=uam
-
Index: ld/app/conf/gue.conf
===================================================================
--- _old/app/conf/gue.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ 	(revision )
@@ -1,14 +1,0 @@
-# ************************************************************
-# * This file was created automatically during installation. *
-# * If you don't need do not change it.                      *
-# *                                                          *
-# * UAM Text Tools                                           *
-# * Adam Mickiewicz University, Poland                       *
-# * http://utt.amu.edu.pl                                    *
-# ************************************************************
-#
-# All lines must looks like:
-# parameter_name [=] value
-#
-dictionary-home = PATH_PREFIX/share/utt
-process = W
Index: ld/app/conf/kor.conf
===================================================================
--- _old/app/conf/kor.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ 	(revision )
@@ -1,16 +1,0 @@
-# ************************************************************
-# * This file was created automatically during installation. *
-# * If you don't need do not change it.                      *
-# *                                                          *
-# * UAM Text Tools                                           *
-# * Adam Mickiewicz University, Poland                       *
-# * http://utt.amu.edu.pl                                    *
-# ************************************************************
-#
-# All lines must looks like:
-# parameter_name [=] value
-#
-dictionary-home = PATH_PREFIX/share/utt
-weights = PATH_PREFIX/share/utt/weights.kor
-threshold = 1.0
-process=W
Index: ld/app/conf/lem.conf
===================================================================
--- _old/app/conf/lem.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ 	(revision )
@@ -1,14 +1,0 @@
-# ************************************************************
-# * This file was created automatically during installation. *
-# * If you don't need do not change it.                      *
-# *                                                          *
-# * UAM Text Tools                                           *
-# * Adam Mickiewicz University, Poland                       *
-# * http://utt.amu.edu.pl                                    *
-# ************************************************************
-#
-# All lines must looks like:
-# parameter_name [=] value
-#
-dictionary-home = PATH_PREFIX/share/utt
-process = W
Index: ld/app/conf/mar.conf
===================================================================
--- _old/app/conf/mar.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ 	(revision )
@@ -1,15 +1,0 @@
-# ************************************************************
-# * This file was created automatically during installation. *
-# * If you don't need do not change it.                      *
-# *                                                          *
-# * UAM Text Tools                                           *
-# * Adam Mickiewicz University, Poland                       *
-# * http://utt.amu.edu.pl                                    *
-# ************************************************************
-#
-# All lines must looks like:
-# parameter_name [=] value
-#
-macros = PATH_PREFIX/lib/utt/terms.m4
-tags=uam
-
Index: ld/app/conf/ser.conf
===================================================================
--- _old/app/conf/ser.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ 	(revision )
@@ -1,15 +1,0 @@
-# ************************************************************
-# * This file was created automatically during installation. *
-# * If you don't need do not change it.                      *
-# *                                                          *
-# * UAM Text Tools                                           *
-# * Adam Mickiewicz University, Poland                       *
-# * http://utt.amu.edu.pl                                    *
-# ************************************************************
-#
-# All lines must looks like:
-# parameter_name [=] value
-#
-macros = PATH_PREFIX/lib/utt/terms.m4
-flex-template = PATH_PREFIX/lib/utt/ser.l.template
-tags=uam
Index: ld/app/conf/utt.conf
===================================================================
--- _old/app/conf/utt.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ 	(revision )
@@ -1,14 +1,0 @@
-# ************************************************************
-# * This file was created automatically during installation. *
-# * If you don't need do not change it.                      *
-# *                                                          *
-# * UAM Text Tools                                           *
-# * Adam Mickiewicz University, Poland                       *
-# * http://utt.amu.edu.pl                                    *
-# ************************************************************
-#
-# All lines must looks like:
-# parameter_name [=] value
-#
-# user locale (dictionary)
-language = pl_PL.ISO-8859-2
Index: _old/app/src/common/Makefile
===================================================================
--- _old/app/src/common/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/common/Makefile	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -1,7 +1,8 @@
-COMMON_PATH=../common
+# main: cmdline.c main_template.cc
+# 	g++ -o main cmdline.c common.cc main_template.cc
 
-include ./common.mk
+# cmdline.c cmdline.h : cmdline.ggo
+# 	gengetopt -i cmdline.ggo
 
-clean:
-	rm -f cmdline.c cmdline.h cmdline.ggo
- 
+# cmdline.ggo: cmdline_common.ggo cmdline_program.ggo
+# 	cat cmdline_common.ggo cmdline_program.ggo > cmdline.ggo
Index: _old/app/src/compiledic/Makefile
===================================================================
--- _old/app/src/compiledic/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/compiledic/Makefile	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -1,3 +1,3 @@
-CFLAG1 = -Wno-deprecated -O3 -fpermissive
+CFLAG1 = -m32 -Wno-deprecated -O3 -fpermissive
 CFLAG_ST = -Wno-deprecated -O3 -fpermissive -static
 
@@ -6,6 +6,9 @@
 compiledic:
 
+
 aut2fsa: aut2fsa.cc
+	#g++ -m32 -Wno-deprecated -O3 -fpermissive -static -o aut2fsa aut2fsa.cc
 	g++ $(CFLAG1) -o aut2fsa aut2fsa.cc
+
 
 copy:
Index: _old/app/src/compiledic/aut2fsa.cc
===================================================================
--- _old/app/src/compiledic/aut2fsa.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/compiledic/aut2fsa.cc	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -1,5 +1,5 @@
 
 #include <iostream>
-#include <cstdlib>
+#include <stdlib.h>
 
 #include "../lib/tfti.h"
Index: _old/app/src/cor/Makefile
===================================================================
--- _old/app/src/cor/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/cor/Makefile	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -1,4 +1,4 @@
-PAR=-Wno-deprecated -fpermissive -static
-PAR2=-c -Wno-deprecated -fpermissive
+PAR=-Wno-deprecated -m32 -fpermissive -static
+PAR2=-c -Wno-deprecated -m32 -fpermissive
 LIB_PATH=../lib
 COMMON_PATH=../common
@@ -6,5 +6,6 @@
 
 
-cor: main.cc corr.o word.o auttools.o cmdline.c common_cor.o common.o 
+cor: main.cc corr.o $(LIB_PATH)/word.o \
+	$(LIB_PATH)/auttools.o cmdline.c common_cor.o common.o 
 	g++ $(PAR) -D _CMDLINE_FILE=$(CMDLINE_FILE) main.cc corr.o common.o \
 	$(LIB_PATH)/word.o $(LIB_PATH)/auttools.o cmdline.c common_cor.o \
@@ -14,5 +15,6 @@
 	g++ $(PAR2) corr.cc
 
-common.o: cmdline_common
+common.o: $(COMMON_PATH)/cmdline_common.ggo $(COMMON_PATH)/common.cc \
+	 $(COMMON_PATH)/common.h
 	g++ $(PAR2) -D _CMDLINE_FILE=$(CMDLINE_FILE) $(COMMON_PATH)/common.cc
 
@@ -38,4 +40,2 @@
 	rm cmdline.* || true
 
-include $(COMMON_PATH)/common.mk
-include $(LIB_PATH)/lib.mk
Index: _old/app/src/dgp/Makefile
===================================================================
--- _old/app/src/dgp/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/dgp/Makefile	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -1,2 +1,4 @@
+
+
 SHELL = /bin/sh
 LIB_PATH=../../lib
@@ -7,10 +9,10 @@
 #vpath %.o  .
 
-CXXFLAGS = -O2 -static -fpermissive
+CXXFLAGS = -O2 -static
 
 sources = main.cc grammar.cc symbol.cc mgraph.cc sgraph.cc dgp0.cc cmdline.cc \
           $(COMMON_PATH)/common.cc global.cc
 
-bin  = dgp dgc canonize tre
+bin  = dgp
 
 # plik *.o sa umieszczane w podkatalogu o
@@ -43,5 +45,6 @@
 
 clean:
-	rm ${bin} ${objs} cmdline.cc cmdline.h *.d
+	rm ${bin} ${objs} cmdline.cc cmdline.h
+	rm -rf *.d
 
 prof: dgp
Index: _old/app/src/dgp/canonize
===================================================================
--- _old/app/src/dgp/canonize	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
+++ _old/app/src/dgp/canonize	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+
+#package:	UAM TExt Tools
+#component:	canonize
+#version:	1.0
+#author:	Tomasz Obrebski
+
+use lib "/usr/local/lib/utt";
+use lib "$ENV{'HOME'}/.local/lib/utt";
+
+use strict;
+use Getopt::Long;
+use attr;
+
+
+my $help;
+
+GetOptions("help|h" => \$help);
+
+if($help)
+{
+    print <<'END'
+
+Transforms syntactic categories to their canonical form.
+
+Usage: canonize
+
+Options:
+   --help -h			Help.
+
+END
+;
+    exit 0;
+}
+
+#$|=1;
+
+my %tra;
+
+while(<>)
+{
+    s/$attr::pos_re\/$attr::avlist_re/trans($&)/ge;
+    print;
+}
+
+sub trans
+{
+    my $cat=shift;
+    exists($tra{$cat}) ? $tra{$cat} : ( $tra{$cat} = attr::canonize $cat );
+}
Index: _old/app/src/dgp/dgc
===================================================================
--- _old/app/src/dgp/dgc	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
+++ _old/app/src/dgp/dgc	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -0,0 +1,292 @@
+#!/usr/bin/perl
+
+#package:	UAM Text Tools
+#component:	dgc (dg compiler)
+#version:	1.0
+#author:	Tomasz Obrebski
+
+# wymaga niejawnie programu canonize!!!!
+use lib "/usr/local/lib/utt";
+use lib "$ENV{'HOME'}/.local/lib/utt";
+
+use strict;
+use Getopt::Long;
+use Data::Dumper;
+use attr;
+use File::HomeDir;
+
+my $systemconfigfile='/usr/local/etc/utt/dgc.conf';
+my $userconfigfile=home()."/.utt/dgc.conf";
+
+Getopt::Long::Configure('no_ignore_case_always');
+
+my $help=0;
+my $catfile=0;
+my $dicfile=0;
+my $gramfile=0;
+my $outputfile=0;
+
+#read configuration files###########################
+my $file;
+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 "categories")or($name eq "c")){
+                        $catfile=$value;
+                }
+                elsif(($name eq "dictionary")or($name eq "d")){
+                        $dicfile=$value;
+                }
+                elsif(($name eq "grammar")or($name eq "g")){
+                        $gramfile=$value;
+                }
+                elsif(($name eq "outputfile")or($name eq "o")){
+                        $outputfile=$value;
+                }
+                elsif(($name eq "help")or($name eq "h")){
+                        $help=1;
+                }
+
+        }
+        close CONFIG;
+  }
+}
+#########################################################
+
+GetOptions("help|h" => \$help,
+	   "categories|c=s" => \$catfile,
+	   "dictionary|d=s" => \$dicfile,
+	   "grammar|g=s" => \$gramfile,
+	   "outputfile|o=s" => \$outputfile);
+
+my $homedir = $ENV{'HOME'};
+$catfile =~ s/~/$homedir/;
+$dicfile =~ s/~/$homedir/;
+$gramfile =~ s/~/$homedir/;
+$outputfile =~ s/~/$homedir/;
+
+
+if($help)
+{
+    print <<'END'
+Usage: dgc [OPTIONS]
+
+Options:
+   --categories -c filename	List of syntactic categories.
+   --dictionary -d filename     Dictionary.
+   --grammar -g filename	List of grammar rules.
+   --outputfile -o filename	Output file name.
+   --help -h			Help.
+END
+;
+    exit 0;
+}
+
+die("At least one of --cats and --dic must be given.\n") if !$catfile && !$dicfile;
+
+my $ncat=0;
+my $nrole=0;
+my $nsgl=0;
+my $nleft=0;
+my $nright=0;
+my $nreq=0;
+my $nlink=0;
+my $nflag=0;
+
+my %cats;
+my %roles;
+my %agr;
+my %gov;
+
+if(!$outputfile) {
+	*OUTPUT = *STDOUT;
+}
+elsif($outputfile eq "-") {
+    *OUTPUT = *STDOUT;
+}
+else {
+	open(OUTPUT, ">$outputfile") or die("Can't open output file: $outputfile!");
+}
+
+
+loadcats($catfile) if $catfile;
+extractcats($dicfile) if $dicfile;
+
+
+my $cats_re = qr/(?:$attr::cat_re\s*(?:,\s*$attr::cat_re)*)/;
+
+# class parse_class:
+# /$attr::cat_re/g;
+
+
+if(!$gramfile) { 
+	*INPUT = *STDIN;
+}
+elsif($gramfile eq "-"){
+    *INPUT = *STDIN;
+}
+else {
+	open(INPUT, $gramfile) or die("Unable to open: $gramfile!");
+}
+
+while(<INPUT>)
+{
+    s/#.*//;
+    s/^\s+//;
+    s/\s+$//;
+    if(/^AGR\s+(\S+)\s+(\S+)$/)
+    {
+	push @{$agr{$1}}, $2;
+    }
+    elsif(/^GOV\s+(\S+)\s+(\S+)$/)
+    {
+	push @{$gov{$1}}, attr::parse($2);
+    }
+    elsif(/^ROLE\s+\S+$/)
+    {
+	$roles{$_}=1;
+	print OUTPUT "$_\n";
+    }
+    elsif(/^SGL\s+\S+$/)
+    {
+	++$nsgl;
+	print OUTPUT "$_\n";
+    }
+    elsif(/^REQ\s+(\S+)\s+(\S+)$/)
+    {
+	print OUTPUT "#$_\n";
+	my $cat = attr::parse $1;
+	for my $atomcat (keys %cats)
+	{
+	    if(attr::match @$cat, @{$cats{$atomcat}})
+	    {
+		print OUTPUT "REQ ".$atomcat." $2\n";
+		++$nreq;
+	    }
+	}
+    }
+    elsif(/^LEFT\s+\S+$/)
+    {
+	++$nleft;
+	print OUTPUT "$_\n";
+    }
+    elsif(/^RIGHT\s+\S+$/)
+    {
+	++$nright;
+	print OUTPUT "$_\n";
+    }
+    elsif(my ($hs,$ds,$r) = /^LINK\s+($cats_re)\s+($cats_re)\s+(\S+)$/)
+    {
+	print OUTPUT "#$_\n";
+	for my $h ($hs =~ /$attr::cat_re/g)
+	{
+	    for my $d ($ds =~ /$attr::cat_re/g)
+	    {
+		addlinks($h,$d,$r);
+	    }
+	}
+    }
+    elsif(/^FLAG\s+\S+$/)
+    {
+	++$nflag;
+	print OUTPUT "$_\n"
+    }
+    elsif(/^$/) {
+	# pomijamy puste linie oraz komentarze
+	}
+	else
+    {
+	print STDERR "Illegal format: $_\n";
+    }
+}
+
+
+sub addlinks
+{
+    my ($h,$d,$r) = @_;
+
+    for my $a (@{$agr{$r}}) { print OUTPUT "#AGR $r $a\n"; }
+    for my $c (@{$gov{$r}}) { print OUTPUT "#GOV $r ".attr::unparse(@$c)."\n"; }
+    my $head = attr::parse $h;
+    my $dep = attr::parse $d;
+    
+    for my $atomhead (keys %cats)
+    {
+	if(attr::match @$head, @{$cats{$atomhead}})
+	{
+	  DEP:
+	    for my $atomdep (keys %cats)
+	    {
+		next DEP if ! attr::match @$dep, @{$cats{$atomdep}};
+		
+		for my $a (@{$agr{$r}})
+		{
+		    next DEP if ! attr::agree(@{$cats{$atomhead}},@{$cats{$atomdep}},$a);
+		}
+		
+		for my $c (@{$gov{$r}})
+		{
+		    next DEP if ! attr::match(@$c,@{$cats{$atomdep}});
+		}
+		
+		print OUTPUT "LINK ";
+		print OUTPUT $atomhead." ";
+		print OUTPUT $atomdep." $r\n";
+		++$nlink;
+		
+	    }
+	}
+    }
+}
+
+
+printf STDERR "%6d CAT   statements\n", 0+keys(%cats);
+printf STDERR "%6d ROLE  statements\n", 0+keys(%roles);
+printf STDERR "%6d SGL   statements\n", $nsgl;
+printf STDERR "%6d REQ   statements\n", $nreq;
+printf STDERR "%6d LEFT  statements\n", $nleft;
+printf STDERR "%6d RIGHT statements\n", $nright;
+printf STDERR "%6d LINK  statements\n", $nlink;
+printf STDERR "%6d FLAG  statements\n", $nflag;
+
+
+sub extractcats
+{
+    my $file = shift;
+    open DICFILE, "canonize $file |";
+    while(<DICFILE>)
+    {
+	while(/,([^[:space:];]+)/g)
+	{
+	    my $cat=$1;
+	    next if !$cat || exists $cats{$cat};
+	    $ncat++;
+	    print OUTPUT "CAT $1\n";
+	    $cats{$cat}=attr::parse($cat);
+	}
+    }
+    close DICFILE;
+}
+
+
+sub loadcats
+{
+    my $file = shift;
+    open CATFILE, "canonize $file |";
+    while(<CATFILE>)
+    {
+	tr/ \t\n//d;
+	next if !$_ || exists $cats{$_};
+	print OUTPUT "CAT $_\n";
+	++$ncat;
+	$cats{$_}=attr::parse($_);
+    }
+    close CATFILE;
+}
+
Index: _old/app/src/dgp/grammar.hh
===================================================================
--- _old/app/src/dgp/grammar.hh	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/dgp/grammar.hh	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -11,4 +11,6 @@
 #include "sgraph.hh"
 
+
+using namespace std;
 
 class Link
Index: _old/app/src/dgp/mgraph.hh
===================================================================
--- _old/app/src/dgp/mgraph.hh	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/dgp/mgraph.hh	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -7,4 +7,7 @@
 #include "thesymbols.hh"
 #include "../common/common.h"
+
+
+using namespace std;
 
 class MNode
Index: _old/app/src/dgp/sgraph.hh
===================================================================
--- _old/app/src/dgp/sgraph.hh	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/dgp/sgraph.hh	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -11,4 +11,6 @@
 #include "thesymbols.hh"
 
+
+using namespace std;
 
 class MNode;
Index: _old/app/src/dgp/thesymbols.hh
===================================================================
--- _old/app/src/dgp/thesymbols.hh	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/dgp/thesymbols.hh	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -8,4 +8,7 @@
 #include <set>
 #include <bitset>
+
+
+using namespace std;
 
 typedef Symbol<1> Cat;
Index: _old/app/src/dgp/tre
===================================================================
--- _old/app/src/dgp/tre	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
+++ _old/app/src/dgp/tre	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -0,0 +1,304 @@
+#!/usr/bin/ruby -I /usr/local/lib/utt -I $HOME/.local/lib/utt
+
+$: << "#{ENV['HOME']}/.local/lib/utt"
+$: << "/usr/local/lib/utt"
+
+require 'getoptlong'
+require 'seg.rb'
+
+opts = GetoptLong.new(
+[ '--help',     '-h',   GetoptLong::NO_ARGUMENT ],
+[ '--debug',    '-d',   GetoptLong::NO_ARGUMENT ],
+[ '--format',   '-F',   GetoptLong::REQUIRED_ARGUMENT ],
+[ '--info',     '-I',   GetoptLong::REQUIRED_ARGUMENT ],
+[ '--only-trees','-t',  GetoptLong::NO_ARGUMENT ])
+
+$helptext=
+"The program generates trees from the graph output by dgp. dgp must\n"+
+"must be run with '-i ds' option.\n\n"+
+"Command:       tre [options]\n\n"+
+"Options:\n"+
+"--help         -h      Print help (this text) and exit.\n"+
+"--debug        -d      Verbose output. For developers only.\n"+
+"--format=s     -F s    Output format. Recognized values:\n"+
+"                               a       root + list of arcs\n"+
+"                               p       parenthesized notation\n"+
+"                               h       human readable indented tree format\n"+
+"                       Multiple values are allowed. (default p)\n"+
+"--info=s       -I s    Information printed. Recognized values:\n"+
+"                               n       node identifier\n"+
+"                               f       surface form\n"+
+"                               m       morphological information\n"+
+"                               l       arc labels\n"+
+"--only-trees   -t      Do not copy input. Print trees only.\n"
+
+$DEBUG=false
+$FORMAT='p'
+$INFO='DEFAULT'
+$ONLYTREES=false
+
+opts.each do |opt, arg|
+  case opt
+  when '--help'
+    print $helptext
+    exit 0
+  when '--debug'
+    $DEBUG=true
+  when '--format'
+    $FORMAT=arg
+  when '--info'
+    $INFO=arg
+  when '--only-trees'
+    $ONLYTREES=true
+  else
+    print "Unknown option #{opt}. Ignored.\n"
+  end
+end
+
+if $INFO=='DEFAULT'
+  case $FORMAT
+    when 'p','a'
+    $INFO='nl'
+    when 'h'
+    $INFO='fmnl'
+  end
+end
+
+$dgpsep=';'
+
+def tre(input)
+  $gphid=[]
+  $form=[]
+  $lem=[]
+  nodes=[]
+  count=0
+  seg=Seg.new
+  for line in input
+    print line unless $ONLYTREES
+    seg.set(line)
+    if dgp=seg['dgp']
+      if nodes==[] && seg[3]!='BOS'
+        print "A sentence must start with BOS segment. Aborting.\n"
+        return
+      end
+
+      id=dgp[/^\d+/].to_i
+
+      if gph=seg['gph']
+        $gphid[id]=gph[/^\d+/].to_i
+      else
+        print "No gph field. Aborting.\n"
+        return
+      end
+
+      $form[$gphid[id]]=seg[4]
+      $lem[$gphid[id]]=seg['lem']
+              
+      nodes[id] = [seg[1].to_i,dgp]
+
+      if seg[3]=='EOS'
+        $pref = "#{seg[1]} #{seg[2]} SYN *"
+        parsegraph(nodes)
+        printgraph if $DEBUG
+        $thetrees=[]
+        gentrees2
+        for t in $thetrees
+          count += 1
+          t1=ground(t)
+          case $FORMAT
+          when /a/
+            print "#{$pref} tre:#{count} arc:"
+            printarcs(t1[0],t1[1])
+            print "\n"
+          when /p/
+            print "#{$pref} tre:#{count} par:"
+            printpar(t1[0],t1[1])
+            print "\n"
+          when /h/
+            print "#\n# tree #{count}\n# ------\n"
+            printtree(t1[0],t1[1],0)
+          end
+        end
+        nodes=[]
+      end
+    end
+  end
+end
+
+
+def nodeinfo(id)
+  info=""
+  if $INFO =~ /n/
+    info += id.to_s                           
+    info += '.' if $INFO =~ /[fm]/
+  end
+  if $INFO =~ /f/
+    info += $form[id] 
+    info += ';' if $INFO =~ /m/
+  end
+  if $INFO =~ /m/
+    info += $lem[id]  
+  end
+  info
+end
+
+
+def printarcs(root,arcs)
+  print nodeinfo(root)
+  for a in arcs
+    print ';'
+    print "#{a[2]}:" if $INFO =~ /l/
+      print nodeinfo(a[0])+'-'+nodeinfo(a[1])
+  end
+end
+
+def printtree(root,arcs,o)
+  if o==0
+        print "# %-16s" % "root: "
+  end
+  print nodeinfo(root),"\n"
+  for arc in arcs.select{ |a| a[0]==root }.sort{|a,b| a[1]<=>b[1] }
+    print '# ',"   "*(o+1)
+    print "%-16s" % (arc[2]+": ")
+    printtree(arc[1],arcs,o+1)
+  end
+end
+
+def printpar(root,arcs)
+  print nodeinfo(root)
+  deps = arcs.select{ |a| a[0]==root }.sort{|a,b| a[1]<=>b[1] }
+  unless deps == []
+    print '('
+    cont=false
+    for arc in deps
+      if cont then print ',' else cont=true end
+      print arc[2],':' if $INFO =~ /l/
+      printpar(arc[1],arcs)
+    end
+    print ')'
+  end
+end
+
+
+def parsegraph(nodes)
+
+  $n   =nodes.length
+  $sat =[];
+
+  $vis =[];
+  $succ=[];
+  $lhs =[];
+  $arcs=[];
+  $pos=[]
+
+  for dgp in nodes
+
+    parts  = dgp[1].split($dgpsep,6)
+
+    if parts[3]==nil || parts[4]==nil || parts[5]==nil
+      $stderr.print "ERR: tre requires dgp be called with '--info s' option. Aborting.\n"
+      exit
+    end
+
+    i      = parts[0].to_i
+    $pos[i] = dgp[0].to_i
+    $sat << i if parts[1]=="s"
+    $arcs |= parts[2].split(',').map{ |a| case a 
+                                          when /\-\-(\w+)-(\d+)\/(\d+)/
+                                            [i, $2.to_i, $1, $3.to_i]
+                                          when /\+\+(\d+)-(\w+)\/(\d+)/
+                                            [$1.to_i, i, $2, $3.to_i]
+                                          end }
+    $succ |= parts[3][1..-2].split(',').map{|x| [x.to_i,i]}
+    $vis  |= parts[4][1..-2].split(',').map{|x| [x.to_i,i]} 
+    $lhs  |= parts[5][1..-2].split(',').map{|x| [x.to_i,i]} + [[i,i]]
+
+  end
+end
+
+
+def ground(t)
+  [ $gphid[t[0]] , t[1].map{|a| [$gphid[a[0]],$gphid[a[1]],a[2]]} ]
+end  
+
+
+def gentrees2()
+  $thetrees=[];
+  bos=0; eos=$n-1;
+  roots = (1...eos).select{|i| $vis.include? [i,eos]}.select{|i| $vis.include? [bos,i]}
+  if $DEBUG then print "ROOTS: #{roots.inspect}\n" end
+  for i in roots
+    $theroot=i
+    for r in buildR(i , eos, [])
+      (rmin,rmax,rtree) = r
+      buildR(bos, rmin, rtree)
+    end
+  end
+end
+
+
+def buildR(min, max, tree)
+  if $DEBUG then print "buildR--#{min}--#{max}--#{tree.inspect}\n" end
+  trees=[]
+  for a in $arcs.select{|a| a[0]==max && $vis.include?([min,a[1]]) }
+    if $DEBUG then print "ARC: #{a.inspect}\n" end
+    for r in buildR(a[1],a[3],tree+[a])
+      (rmin,rmax,rarcs) = r
+      for l in buildR(min,rmin,rarcs)
+        (lmin,lmax,larcs) = l
+        trees << [lmin,rmax,larcs]
+      end
+    end
+  end
+  for i in (0...$n).select{|i| $succ.include?([i,max])}.select{|i| $lhs.include?([min,i])}
+    for l in buildL(min,i,tree)
+      (lmin,lmax,larcs) = l
+      trees << [lmin,lmax,larcs]
+    end
+  end
+  trees  
+end
+    
+
+def buildL(min,max,tree)
+  if $DEBUG then print "buildL--#{min}--#{max}--#{tree.inspect}\n" end
+  if $pos[min]==$pos[max]
+    if min==0 && max==0
+      $thetrees.push [$theroot,tree]
+      if $DEBUG then print "adding tree: #{tree.inspect}\n" end
+    end
+    return [[max,max,tree]]
+  end
+  trees=[]
+  for arc in $arcs.select{|a| a[1]==max && $lhs.include?([min,a[0]]) }
+    if $DEBUG then print "ARC: #{arc.inspect}\n" end
+    for r in buildR(arc[3],max,tree+[arc])
+      (rmin,rmax,rarcs) = r
+      for l in buildL(min,rmin,rarcs)
+        (lmin,lmax,larcs) = l
+        trees << [lmin,lmax,larcs]
+      end
+    end
+  end
+  trees
+end
+
+
+def printgraph()
+  
+  print "N:    #{$n}\n"
+  print "SAT:  #{set_to_s($sat)}\n"
+  print "SUCC: #{rel_to_s($succ)}\n"
+  print "VIS:  #{rel_to_s($vis)}\n"
+  print "LHS:  #{rel_to_s($lhs)}\n"
+  print "ARCS: #{arcs_to_s($arcs)}\n"
+end
+
+def set_to_s(s) "{#{s.join(',')}}" end
+def rel_to_s(r) "{#{r.map{|p| "(#{p[0]},#{p[1]})"}.join(',')}}" end
+def arc_to_s(q) "-#{q[0]}-#{q[2]}-#{q[1]}/#{q[3]}" end
+def arcs_to_s(a) "{#{a.map{|q| arc_to_s(q)}.join(',')}}" end
+
+######################################################################
+
+tre($stdin)
Index: _old/app/src/gue/Makefile
===================================================================
--- _old/app/src/gue/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/gue/Makefile	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -1,4 +1,4 @@
-PAR=-Wno-deprecated -O2 -fpermissive -static
-PAR2=-c -Wno-deprecated -O2 -fpermissive
+PAR=-Wno-deprecated -O3 -fpermissive -m32 -static
+PAR2=-c -Wno-deprecated -O3 -fpermissive -m32
 LIB_PATH=../lib
 COMMON_PATH=../common
@@ -6,5 +6,6 @@
 
 
-gue: main.cc guess.o auttools.o word.o cmdline.c common_guess.o common.o
+gue: main.cc guess.o $(LIB_PATH)/auttools.o $(LIB_PATH)/word.o \
+      cmdline.c common_guess.o common.o
 	g++ $(PAR) main.cc guess.o \
 	$(LIB_PATH)/auttools.o $(LIB_PATH)/word.o cmdline.c common.o common_guess.o \
@@ -17,5 +18,6 @@
 	g++ $(PAR2) common_guess.cc
 
-common.o: $(COMMON_PATH)/cmdline_common.ggo cmdline_common
+common.o: $(COMMON_PATH)/cmdline_common.ggo $(COMMON_PATH)/common.cc \
+	 $(COMMON_PATH)/common.h
 	g++ $(PAR2) -D _CMDLINE_FILE=$(CMDLINE_FILE) $(COMMON_PATH)/common.cc
 
@@ -39,5 +41,2 @@
 	cp gue ${UTT_BIN_DIR}
 endif
-
-include $(LIB_PATH)/lib.mk
-include $(COMMON_PATH)/common.mk
Index: _old/app/src/gue/guess.cc
===================================================================
--- _old/app/src/gue/guess.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/gue/guess.cc	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -2,9 +2,9 @@
 #include "guess.h"
 
-#include <cstring>
+#include <string.h>
 #include <iostream>
-#include <cstdlib>
-#include <cassert>
-#include <ctime>
+#include <stdlib.h>
+#include <assert.h>
+#include <time.h>
 
 #define DICT 1
@@ -18,5 +18,7 @@
 #define PREF_SIGN '_'
 
+
 using namespace std;
+
 
 Guess::Guess(const char* suf_file)
Index: _old/app/src/kor/Makefile
===================================================================
--- _old/app/src/kor/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/kor/Makefile	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -1,4 +1,4 @@
-PAR=-Wno-deprecated -fpermissive -static
-PAR2=-c -Wno-deprecated -fpermissive
+PAR=-Wno-deprecated -m32 -fpermissive -static
+PAR2=-c -Wno-deprecated -m32 -fpermissive
 LIB_PATH=../lib
 COMMON_PATH=../common
@@ -6,16 +6,20 @@
 
 
-kor: main.cc corr.o corlist.o cmdline.o word.o auttools.o cmdline.c common_cor.o common.o 
+kor: main.cc corr.o corlist.o cmdline.o $(LIB_PATH)/word.o \
+	$(LIB_PATH)/auttools.o cmdline.c common_cor.o common.o 
 	g++ $(PAR) -D _CMDLINE_FILE=$(CMDLINE_FILE) main.cc corlist.o corr.o common.o \
 	$(LIB_PATH)/word.o $(LIB_PATH)/auttools.o cmdline.c common_cor.o \
 	-o kor
 
-corr.o: corr.cc corr.h cmdline.h
+corr.o: corr.cc corr.hh cmdline.h
 	g++ $(PAR2) -D _CMDLINE_FILE=$(CMDLINE_FILE) corr.cc
 	
 corlist.o: corlist.cc corlist.h cmdline.h
-	g++ $(PAR2) -D _CMDLINE_FILE=$(CMDLINE_FILE) corlist.cc	
+	g++ $(PAR2) -D _CMDLINE_FILE=$(CMDLINE_FILE) corlist.cc
+	
 
-common.o: cmdline.h $(COMMON_PATH)/cmdline_common.ggo cmdline_common
+
+common.o: cmdline.h $(COMMON_PATH)/cmdline_common.ggo $(COMMON_PATH)/common.cc \
+	 $(COMMON_PATH)/common.h
 	g++ $(PAR2) -D _CMDLINE_FILE=$(CMDLINE_FILE) $(COMMON_PATH)/common.cc
 
@@ -41,4 +45,2 @@
 	rm cmdline.* || true
 
-include $(COMMON_PATH)/common.mk
-include $(LIB_PATH)/lib.mk
Index: _old/app/src/kor/corlist.cc
===================================================================
--- _old/app/src/kor/corlist.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/kor/corlist.cc	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -1,9 +1,8 @@
-#include <cstdio>
-//#include <alloc.h>
+#include <stdio.h>
+#include <malloc.h>
 #include "corlist.h"
 
 #define min(x,y) ((x<y)?(x):(y))
 
-using namespace std;
 
 Weight CorList::GetValue(char X[100], char Y[100], Weight (*H2)[100], int i, int j)
Index: _old/app/src/kor/corr.cc
===================================================================
--- _old/app/src/kor/corr.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/kor/corr.cc	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -1,5 +1,5 @@
 //---------------------------------------------------------------------------
 #include "common_cor.h"
-#include "corr.h"
+#include "corr.hh"
 
 #define MAXPATH 256
Index: _old/app/src/kor/corr.hh
===================================================================
--- _old/app/src/kor/corr.hh	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
+++ _old/app/src/kor/corr.hh	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -0,0 +1,39 @@
+//---------------------------------------------------------------------------
+#ifndef _corr_hh
+#define _corr_hh
+//---------------------------------------------------------------------------
+
+#include "../lib/tfti.h"
+#include "../lib/word.h"
+#include "corlist.h"
+#include "../common/common.h"
+
+class Corr : public TFTiv<char,char>
+{
+private:
+  Weight H[100][100];
+  char X[100];                         // misspelled string
+  char Y[100];                         // (possibly partial) candidate string
+  int m;                               // length of X
+  int n;                               // maximal length of Y
+
+  Weight ed(int,int);
+  Weight cuted(int);
+  void recomputeH(int);
+
+
+public:
+  Weight (*H2)[100];   // moje: zmiana z int na Weight (float)
+  int t;                               // threshold
+  CorList CL;  // moje
+
+  Corr() : H2((Weight(*)[100])&H[2][2]) {};   // moje (int->float)
+  Corr(const char* a) : TFTiv<char,char>(a), H2((Weight(*)[100])&H[2][2]) { };
+
+  int correct(const char* w, Words& tab);
+  
+  int load2(char *Name);  // moje
+};
+
+//---------------------------------------------------------------------------
+#endif
Index: _old/app/src/kor/main.cc
===================================================================
--- _old/app/src/kor/main.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/kor/main.cc	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -3,5 +3,5 @@
 #include "../lib/iotools.h"
 #include "common_cor.h"
-#include "corr.h"
+#include "corr.hh"
 #include <locale.h>
 
Index: _old/app/src/lem/Makefile
===================================================================
--- _old/app/src/lem/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/lem/Makefile	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -1,4 +1,4 @@
-PAR=-Wno-deprecated -O2 -fpermissive -static
-PAR2=-c -Wno-deprecated -O2 -fpermissive -static
+PAR=-Wno-deprecated -m32 -O3 -fpermissive -static
+PAR2=-c -Wno-deprecated -m32 -O3 -fpermissive -static
 LIB_PATH=../lib
 COMMON_PATH=../common
@@ -6,5 +6,6 @@
 
 
-lem: main.cc lem.o auttools.o word.o cmdline.c common_lem.o common.o symtab.o
+lem: main.cc lem.o  $(LIB_PATH)/auttools.o $(LIB_PATH)/word.o \
+      cmdline.c common_lem.o common.o symtab.o
 	g++ $(PAR) -D _CMDLINE_FILE=$(CMDLINE_FILE) \
 	main.cc lem.o $(LIB_PATH)/auttools.o \
@@ -27,5 +28,6 @@
 # 	g++ $(PAR2) $(LIB_PATH)/erro.cc
 
-common.o: cmdline_common
+common.o: $(COMMON_PATH)/cmdline_common.ggo $(COMMON_PATH)/common.cc \
+	 $(COMMON_PATH)/common.h
 	g++ $(PAR2) -D _CMDLINE_FILE=$(CMDLINE_FILE) $(COMMON_PATH)/common.cc
 
@@ -36,5 +38,5 @@
 	gengetopt -i cmdline.ggo --conf-parser
 
-cmdline.ggo: cmdline_lem.ggo $(COMMON_PATH)/cmdline_common.ggo
+cmdline.ggo: cmdline_lem.ggo ../common/cmdline_common.ggo
 	cat cmdline_lem.ggo ../common/cmdline_common.ggo > cmdline.ggo
 
@@ -53,5 +55,2 @@
 	cp lem $(UTT_BIN_DIR)
 endif
-
-include $(COMMON_PATH)/common.mk
-include $(LIB_PATH)/lib.mk
Index: _old/app/src/lem/lem.cc
===================================================================
--- _old/app/src/lem/lem.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/lem/lem.cc	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -1,10 +1,7 @@
 #include "lem.h"
 
+#include <stdlib.h>
 #include <assert.h>
-#include <cstdlib>
 
-
-
-using namespace std;
 
 /* Znajduje opisy slownikowe dla wyrazu.
Index: _old/app/src/lib/Makefile
===================================================================
--- _old/app/src/lib/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/lib/Makefile	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -1,4 +1,4 @@
-PAR=-Wno-deprecated -O3
-PAR2=-c -Wno-deprecated -O3 -fpermissive
+PAR=-Wno-deprecated -m32 -O3
+PAR2=-c -Wno-deprecated -m32 -O3 -fpermissive
 # -static
 LIB_PATH=../lib
@@ -6,4 +6,10 @@
 
 main: auttools.o word.o copy
+
+auttools.o: auttools.h auttools.cc
+	g++ $(PAR2) auttools.cc
+
+word.o: word.h word.cc
+	g++ $(PAR2) word.cc
 
 clean:
@@ -14,4 +20,2 @@
 #	cp -r perl $(UTT_LIB_DIR)/
 #endif
-
-include ./lib.mk
Index: _old/app/src/lib/auttools.cc
===================================================================
--- _old/app/src/lib/auttools.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/lib/auttools.cc	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -163,3 +163,2 @@
 }
 
-
Index: _old/app/src/lib/symtab.cc
===================================================================
--- _old/app/src/lib/symtab.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/lib/symtab.cc	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -1,8 +1,7 @@
 #include "symtab.h"
 #include <values.h>
-#include <cstdio>
-//#include <alloc.h>
-#include <cstdlib>
-using namespace std;
+#include <stdio.h>
+#include <malloc.h>
+#include <stdlib.h>
 //---------------------------------------------------------------------------
 
@@ -159,6 +158,5 @@
     strncpy((char*)&i2,s+(l/2-2),sizeof(int));
     strncpy((char*)&i3,s+(l-4),sizeof(int));
-    //return abs((i1+i2+i3) % _sz);
-    return (i1+i2+i3) % _sz;
+    return abs((i1+i2+i3) % _sz);
   }
   else
Index: _old/app/src/lib/tft.h
===================================================================
--- _old/app/src/lib/tft.h	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/lib/tft.h	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -5,17 +5,18 @@
 #include <iostream>
 #include <typeinfo>
-#include <cstring>
-
-#include <cstdio>
+#include <string.h>
+
+#include <stdio.h>
 
 //#include "top.h"
 #include "ttrans.h"
+
 using namespace std;
 //---------------------------------------------------------------------------
 
-/// Klasa bazowa przetwornika skoï¿œczonego.
-/**
-    \remark Po co ta klasa? Co dotyczy samych przejï¿œï¿œ, przenieï¿œï¿œ do TTrans,
-    resztï¿œ wcieliï¿œ do TFT.
+/// Klasa bazowa przetwornika skoñczonego.
+/**
+    \remark Po co ta klasa? Co dotyczy samych przej¶æ, przenie¶æ do TTrans,
+    resztê wcieliæ do TFT.
 */
 class FT
@@ -25,44 +26,44 @@
 
 //print mode
-  enum OUTPUT { II,                         ///< tylko symbole wejï¿œciowe
-                OO,                         ///< tylko symbole wyjï¿œciowe
-                IOIO,                       ///< symbol wyjï¿œciowy po wejï¿œciowym
-                OIOI,                       ///< symbol wyjï¿œciowy przed wejï¿œciowym
-                IIOO,                       ///< caï¿œe wejï¿œcie, potem caï¿œe wyjï¿œcie
-                OOII                        ///< caï¿œe wyjï¿œcie, potem caï¿œe wejï¿œcie
+  enum OUTPUT { II,                         ///< tylko symbole wej¶ciowe
+                OO,                         ///< tylko symbole wyj¶ciowe
+                IOIO,                       ///< symbol wyj¶ciowy po wej¶ciowym
+                OIOI,                       ///< symbol wyj¶ciowy przed wej¶ciowym
+                IIOO,                       ///< ca³e wej¶cie, potem ca³e wyj¶cie
+                OOII                        ///< ca³e wyj¶cie, potem ca³e wej¶cie
 
               };
 
-/// maks dï¿œugoï¿œï¿œ ï¿œcieï¿œki
+/// maks d³ugo¶æ ¶cie¿ki
   static const unsigned int ftMAXPATH=500;
 
-/// maks dï¿œugoï¿œï¿œ opisu typu symbolu we/wy
-/**
-    \remark Przenieï¿œï¿œ do TTrans
+/// maks d³ugo¶æ opisu typu symbolu we/wy
+/**
+    \remark Przenie¶æ do TTrans
 */
   static const unsigned int ftTYPELEN=32;
 
-/// specjalny symbol dla wartoï¿œci 'epsilon'
-/**
-    \remark Przenieï¿œï¿œ do TTrans
+/// specjalny symbol dla warto¶ci 'epsilon'
+/**
+    \remark Przenie¶æ do TTrans
 */
   static const char ftEPSILON='~';
 
-/// specialny symbol dla wartoï¿œci 'default'
-/**
-    \remark Przenieï¿œï¿œ do TTrans
+/// specialny symbol dla warto¶ci 'default'
+/**
+    \remark Przenie¶æ do TTrans
 */
   static const char ftDEFAULT='@';
 
-/// domyï¿œlny symbol wyjï¿œciowy (true-'@', flase-'~')
-/**
-    \remark Przenieï¿œï¿œ do TTrans(???)
+/// domy¶lny symbol wyj¶ciowy (true-'@', flase-'~')
+/**
+    \remark Przenie¶æ do TTrans(???)
 */
   bool copy_default;
 
-/// tryb wyjï¿œcia
+/// tryb wyj¶cia
   OUTPUT print_mode;
 
-/// false, jeï¿œli automat nie ma przejï¿œï¿œ
+/// false, je¶li automat nie ma przej¶æ
   operator bool() { return (bool)ttn; };
 
@@ -72,22 +73,22 @@
 protected:
 
-/// liczba elementï¿œw tablicy tt
+/// liczba elementów tablicy tt
   unsigned long ttn;
 
-/// liczba stanï¿œw
+/// liczba stanów
   unsigned long states;
 
-/// liczba przejï¿œï¿œ
+/// liczba przej¶æ
   unsigned long transitions;
 
-/// typ symboli wejï¿œciowych (napis)
-/**
-    \remark Przenieï¿œï¿œ do TTrans(???)
+/// typ symboli wej¶ciowych (napis)
+/**
+    \remark Przenie¶æ do TTrans(???)
 */
   char itype[ftTYPELEN];
 
-/// typ symboli wyjï¿œciowych (napis)
-/**
-    \remark Przenieï¿œï¿œ do TTrans(???)
+/// typ symboli wyj¶ciowych (napis)
+/**
+    \remark Przenie¶æ do TTrans(???)
 */
   char otype[ftTYPELEN];
@@ -96,13 +97,13 @@
 //---------------------------------------------------------------------------
 
-/// Szablon przetwornika skoï¿œczonego
-/**
-    \param I - typ symbolu wejï¿œciowego
-    \param Ipass - typ, jaki ma byï¿œ uï¿œyty przy przekazywaniu symbolu we jako parametru
-                   do funkcji (metody), rï¿œwny \a I lub \a I&
-    \param O - typ symbolu wyjï¿œciowego
-    \param Opass - typ, jaki ma byï¿œ uï¿œyty przy przekazywaniu symbolu wy jako parametru
-                   do funkcji (metody), rï¿œwny \a O lub \a O&
-    \param - typ przejï¿œcia, musi byï¿œ podklasï¿œ TTrans
+/// Szablon przetwornika skoñczonego
+/**
+    \param I - typ symbolu wej¶ciowego
+    \param Ipass - typ, jaki ma byæ u¿yty przy przekazywaniu symbolu we jako parametru
+                   do funkcji (metody), równy \a I lub \a I&
+    \param O - typ symbolu wyj¶ciowego
+    \param Opass - typ, jaki ma byæ u¿yty przy przekazywaniu symbolu wy jako parametru
+                   do funkcji (metody), równy \a O lub \a O&
+    \param - typ przej¶cia, musi byæ podklas± TTrans
 */
 template<class I, class Ipass, class O, class Opass, class TT>
@@ -117,16 +118,16 @@
 /**
 \name Metody poziomu 1
-Poziom przejï¿œï¿œ.
+Poziom przej¶æ.
 */
 
 //@{
 
-/// Test, czy przejï¿œcie \a t akceptuje symbol \a in.
+/// Test, czy przej¶cie \a t akceptuje symbol \a in.
   bool accepts(long t, Ipass in) const;
 
-/// Test, czy lista przejï¿œï¿œ dla aktualnego stanu jest kontynuowana po \a t.
+/// Test, czy lista przej¶æ dla aktualnego stanu jest kontynuowana po \a t.
   bool continued(long t) const;
 
-/// Stan, do ktï¿œrego prowadzi przejï¿œcie \a t.
+/// Stan, do którego prowadzi przej¶cie \a t.
 /**
     \pre !empty(t)
@@ -134,26 +135,26 @@
   long next(long t) const;
 
-/// Symbol wejï¿œciowy przejï¿œcia \a t.
+/// Symbol wej¶ciowy przej¶cia \a t.
   Ipass input(long t) const;
 
-/// Symbol wyjï¿œciowy przejï¿œcia \a t.
+/// Symbol wyj¶ciowy przej¶cia \a t.
   Opass output(long t) const;
 
-/// Zwraca \c true, jeï¿œli symbolem we przejï¿œcia \a t jest epsilon.
+/// Zwraca \c true, je¶li symbolem we przej¶cia \a t jest epsilon.
   bool epsi(long t) const;
 
-/// Zwraca \c true, jeï¿œli symbolem we przejï¿œcia \a t jest symbol domyï¿œlny.
+/// Zwraca \c true, je¶li symbolem we przej¶cia \a t jest symbol domy¶lny.
   bool defi(long t) const;
 
-/// Zwraca \c true, jeï¿œli symbolem wy przejï¿œcia \a t jest epsilon.
+/// Zwraca \c true, je¶li symbolem wy przej¶cia \a t jest epsilon.
   bool epso(long t) const;
 
-/// Zwraca \c true, jeï¿œli symbolem wy przejï¿œcia \a t jest symbol domyï¿œlny.
+/// Zwraca \c true, je¶li symbolem wy przej¶cia \a t jest symbol domy¶lny.
   bool defo(long t) const;
 
-/// Indeks przejï¿œcia przez \a in.
+/// Indeks przej¶cia przez \a in.
   long tra(long t, Ipass in) const;
 
-/// Indeks przejï¿œcia przez \a in - non-deterministic.
+/// Indeks przej¶cia przez \a in - non-deterministic.
   long tra_nd(long t, Ipass in, long nth) const;
 
@@ -162,11 +163,11 @@
 /**
 \name Poziom 2
-Poziom stanï¿œw. Stan (indeks stanu) = indeks jego pierwszego przejï¿œcia
+Poziom stanów. Stan (indeks stanu) = indeks jego pierwszego przej¶cia
 */
 //@{
-/// Zwraca \c true jeï¿œli stan \a s jest pusty (nie ma z niego przejï¿œï¿œ).
+/// Zwraca \c true je¶li stan \a s jest pusty (nie ma z niego przej¶æ).
   bool empty(long s) const { return tt[s].empty(); }
 
-/// Zwraca \c true jeï¿œli stan \a s jest stanem koï¿œcowym.
+/// Zwraca \c true je¶li stan \a s jest stanem koñcowym.
   bool final(long s) const { return tt[s].final(); }
 
@@ -202,5 +203,5 @@
 protected:
 
-  TT* tt;                // tablica przejï¿œï¿œ
+  TT* tt;                // tablica przej¶æ
 
   long prn(const I* si, long* p, O* so) const;
@@ -210,5 +211,5 @@
   void sort();
 
-  void setiotypes();     // NIE DZIAï¿œA (dlaczego???)
+  void setiotypes();     // NIE DZIA£A (dlaczego???)
 
 //  friend ostream& operator<<(ostream&,const CDFA&);
@@ -228,10 +229,10 @@
 
 /**
-    stan = indeks pierwszego przejï¿œcia
-
-    state(t) = stan, do ktï¿œrego naleï¿œy t
-
-    symbol zerowy = symbol s, dla ktï¿œrego (bool)s zwraca \c false,
-    w przypadku znakï¿œw - '\0'
+    stan = indeks pierwszego przej¶cia
+
+    state(t) = stan, do którego nale¿y t
+
+    symbol zerowy = symbol s, dla którego (bool)s zwraca \c false,
+    w przypadku znaków - '\0'
 */
 
@@ -290,8 +291,8 @@
 
 /**
-    \param +t - indeks przejï¿œcia
+    \param +t - indeks przej¶cia
     \param +in - symbol we
-    \return Indeks przjï¿œcia (>=\a t) dla bieï¿œï¿œcego stanu, ktï¿œre
-    akceptuje symbol we \a in lub -1, jeï¿œli nie ma takiego przejï¿œcia
+    \return Indeks przj¶cia (>=\a t) dla bie¿±cego stanu, które
+    akceptuje symbol we \a in lub -1, je¶li nie ma takiego przej¶cia
 */
 template <class I, class Ipass, class O, class Opass, class TT>
@@ -311,11 +312,11 @@
 
 //---------------------------------------------------------------------------
-/// Indeks przejï¿œcia - wersja dla automatu niedeterministycznego.
-/**
-    \param +t  - indeks przejï¿œcia
+/// Indeks przej¶cia - wersja dla automatu niedeterministycznego.
+/**
+    \param +t  - indeks przej¶cia
     \param +in - symbol we
-    \return Indeks przjï¿œcia (>=\a t) dla bieï¿œï¿œcego stanu, ktï¿œre
-    akceptuje symbol we \a in lub -1, jeï¿œli nie ma takiego przejï¿œcia
-    Jeï¿œli nth==0, t1>=t, w przeciwnym razie t1>t.
+    \return Indeks przj¶cia (>=\a t) dla bie¿±cego stanu, które
+    akceptuje symbol we \a in lub -1, je¶li nie ma takiego przej¶cia
+    Je¶li nth==0, t1>=t, w przeciwnym razie t1>t.
 */
 template <class I, class Ipass, class O, class Opass, class TT>
@@ -348,10 +349,10 @@
 
 
-/// Funkcja przejï¿œcia.
+/// Funkcja przej¶cia.
 /**
     \param t - stan
     \param in - symbol we
-    \return Stan, do ktï¿œrego moï¿œna przejï¿œï¿œ z \a t po wpï¿œywem symbolu \a in
-    lub -1, jeï¿œli nie ma przejï¿œcia przez \a in
+    \return Stan, do którego mo¿na przej¶æ z \a t po wp³ywem symbolu \a in
+    lub -1, je¶li nie ma przej¶cia przez \a in
 
 */
@@ -376,11 +377,11 @@
 
 //----------------------------------------------------------------------------
-/// Uogï¿œlniona funkcja przejscia.
+/// Uogólniona funkcja przejscia.
 /**
     \param +s - stan
-    \param +w - wskaï¿œnik pierwszego elementu ciï¿œgu symboli we, zakoï¿œczonego symbolem zerowym
-    \param maxpath maksymalna dï¿œugoï¿œï¿œ ï¿œcieï¿œki, domyï¿œlnie ftMAXPATH
-    \return stan osiï¿œgalny z \a s pod wpï¿œywem \a w (na ï¿œcieï¿œce mogï¿œ siï¿œ pojawiï¿œ
-    epsilon-przejï¿œcia
+    \param +w - wskaŒnik pierwszego elementu ci±gu symboli we, zakoñczonego symbolem zerowym
+    \param maxpath maksymalna d³ugo¶æ ¶cie¿ki, domy¶lnie ftMAXPATH
+    \return stan osi±galny z \a s pod wp³ywem \a w (na ¶cie¿ce mog± siê pojawiæ
+    epsilon-przej¶cia
 */
 template <class I, class Ipass, class O, class Opass, class TT>
@@ -411,10 +412,10 @@
 /**
 ...
-\param +s stan, jeï¿œli -1 - poszukiwane jest nastï¿œpne rozwiï¿œzanie
-\param -c ciï¿œg symboli we ze ï¿œcieï¿œki prowadzï¿œcej z \a s do
-       stanu koï¿œcowego
-\return dï¿œugoï¿œï¿œ ciï¿œgu \a c (= dï¿œugoï¿œï¿œ ï¿œcieï¿œki)
-\remark DZIAï¿œA TYLKO DLA ZNAKï¿œW!!!
-        EPSILON-PRZEJï¿œCIA NIEDOZWOLONE!!!
+\param +s stan, je¶li -1 - poszukiwane jest nastêpne rozwi±zanie
+\param -c ci±g symboli we ze ¶cie¿ki prowadz±cej z \a s do
+       stanu koñcowego
+\return d³ugo¶æ ci±gu \a c (= d³ugo¶æ ¶cie¿ki)
+\remark DZIA£A TYLKO DLA ZNAKÓW!!!
+        EPSILON-PRZEJŠCIA NIEDOZWOLONE!!!
 */
 template <class I, class Ipass, class O, class Opass, class TT>
@@ -482,8 +483,8 @@
 /// Dopasowanie niedeterministyczne.
 /**
-    \param +w - wskaï¿œnik pierwszego elementu ciï¿œgu symboli we, zakoï¿œczonego symbolem zerowym,
-    jeï¿œli NULL - poszukiwane jest nastï¿œpne rozwiï¿œzanie
-    \param -p ciï¿œg przejï¿œï¿œ zakoï¿œczony -1
-    \return dï¿œugoï¿œï¿œ dopasowania (PO CO?)
+    \param +w - wskaŒnik pierwszego elementu ci±gu symboli we, zakoñczonego symbolem zerowym,
+    je¶li NULL - poszukiwane jest nastêpne rozwi±zanie
+    \param -p ci±g przej¶æ zakoñczony -1
+    \return d³ugo¶æ dopasowania (PO CO?)
 */
 template <class I, class Ipass, class O, class Opass, class TT>
@@ -526,11 +527,11 @@
 
 //----------------------------------------------------------------------------
-/// Najdï¿œuï¿œsze dopasowanie.
-/**
-    \param +w wskaï¿œnik pierwszego elementu ciï¿œgu symboli wejï¿œciowych
-    \param -p ï¿œcieï¿œka
-    \param -plen dï¿œugoï¿œï¿œ ï¿œcieï¿œki
-    \param +maxpath maks ddï¿œugoï¿œï¿œ ï¿œcieï¿œki, domyï¿œlnie FT::ftMAXPATH
-    \return dï¿œugoï¿œï¿œ skonsumowanego wejï¿œcia
+/// Najd³u¿sze dopasowanie.
+/**
+    \param +w wskaŒnik pierwszego elementu ci±gu symboli wej¶ciowych
+    \param -p ¶cie¿ka
+    \param -plen d³ugo¶æ ¶cie¿ki
+    \param +maxpath maks dd³ugo¶æ ¶cie¿ki, domy¶lnie FT::ftMAXPATH
+    \return d³ugo¶æ skonsumowanego wej¶cia
 */
 template <class I, class Ipass, class O, class Opass, class TT>
@@ -556,11 +557,11 @@
 
 //----------------------------------------------------------------------------
-/// Najdï¿œuï¿œsza ï¿œcieï¿œka.
-/**
-    \param +buf  wskaï¿œnik pierwszego elementu ciï¿œgu symboli wejï¿œciowych
+/// Najd³u¿sza ¶cie¿ka.
+/**
+    \param +buf  wskaŒnik pierwszego elementu ci±gu symboli wej¶ciowych
     \param -buf  pozycja jeden za skonsumowanym prefiksem
-    \param +path wskaï¿œnik pierwszego elementu wektora przejï¿œï¿œ
-    \param -path wskaï¿œnik jeden za ostatnim przejï¿œciem
-    \return dï¿œugoï¿œï¿œ skonsumowanego prefiksu (PO CO? LEPIEJ Dï¿œ ï¿œCIEï¿œKI)
+    \param +path wskaŒnik pierwszego elementu wektora przej¶æ
+    \param -path wskaŒnik jeden za ostatnim przej¶ciem
+    \return d³ugo¶æ skonsumowanego prefiksu (PO CO? LEPIEJ D£ ŠCIE¯KI)
 */
 template <class I, class Ipass, class O, class Opass, class TT>
@@ -582,12 +583,12 @@
 
 //----------------------------------------------------------------------------
-/// Najdï¿œuï¿œszy prefiks.
-/**
-    \param +buf  wskaï¿œnik pierwszego elementu ciï¿œgu symboli wejï¿œciowych
+/// Najd³u¿szy prefiks.
+/**
+    \param +buf  wskaŒnik pierwszego elementu ci±gu symboli wej¶ciowych
     \param -buf  pozycja jeden za skonsumowanym prefiksem
     \param +sep  separator
-    \return stan po przejï¿œciu przez \a sep
-    \remark Dziaï¿œa tylko dla automatï¿œw deterministycznych, minimalnych, eps-wolnych,
-              gdzie dï¿œ. ï¿œcieï¿œki == dï¿œ. dopasowania.
+    \return stan po przej¶ciu przez \a sep
+    \remark Dzia³a tylko dla automatów deterministycznych, minimalnych, eps-wolnych,
+              gdzie d³. ¶cie¿ki == d³. dopasowania.
 */
 template <class I, class Ipass, class O, class Opass, class TT>
@@ -601,5 +602,5 @@
 
   long s;
-  if(*buf)                     // pierwsze wywoï¿œanie
+  if(*buf)                     // pierwsze wywo³anie
   {
     if(!lgstpath(buf,path,start))
@@ -608,5 +609,5 @@
     more=true;
   }
-  else                         // kolejne  wywoï¿œanie
+  else                         // kolejne  wywo³anie
     --buf,--path;
   while(more)
Index: _old/app/src/lib/tfti.h
===================================================================
--- _old/app/src/lib/tfti.h	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/lib/tfti.h	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -3,7 +3,6 @@
 //---------------------------------------------------------------------------
 #include <fstream>
-#include <cmath>
+#include <math.h>
 #include <iomanip>
-#include <iostream>
 //#include <typeinfo.h>
 
@@ -11,5 +10,7 @@
 //---------------------------------------------------------------------------
 
+
 using namespace std;
+
 
 template<class I, class Ipass, class O, class Opass>
Index: _old/app/src/lib/ttrans.h
===================================================================
--- _old/app/src/lib/ttrans.h	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/lib/ttrans.h	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -3,6 +3,8 @@
 //---------------------------------------------------------------------------
 #include <iostream>
+//---------------------------------------------------------------------------
+
+
 using namespace std;
-//---------------------------------------------------------------------------
 
 //! The template for a transition with input and output symbols stored internally.
Index: _old/app/src/lib/word.cc
===================================================================
--- _old/app/src/lib/word.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/lib/word.cc	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -2,9 +2,9 @@
 #include "word.h"
 #include "auttools.h"
-//#include <istream.h>
 #include <istream>
-#include <algorithm>
+//---------------------------------------------------------------------------
+
 using namespace std;
-//---------------------------------------------------------------------------
+
 //---------------------------------------------------------------------------
 
@@ -124,10 +124,10 @@
 //---------------------------------------------------------------------------
 void Words::sort() {
-  std::sort(tab.begin(), tab.end(), Word::cmp_w);
+//  sort(tab.begin(), tab.end(), Word::cmp_w); //NIE DZIALA
 }
 
 //---------------------------------------------------------------------------
 void Words::sort_rev() {
-  std::sort(tab.begin(), tab.end(), cmp_w_rev_fun);
+//  sort(tab.begin(), tab.end(), cmp_w_rev_fun); // NIE DZIALA
 }
 
Index: _old/app/src/lib/word.h
===================================================================
--- _old/app/src/lib/word.h	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/lib/word.h	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -6,9 +6,9 @@
 //#include "erro.h"
 #include "const.h"
-//#include <iostream.h>
 #include <iostream>
+
+#include <string.h>
+
 #include <vector>
-#include <cstring>
-using namespace std;
 //---------------------------------------------------------------------------
 
Index: _old/app/src/tok.c/Makefile
===================================================================
--- _old/app/src/tok.c/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/tok.c/Makefile	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -1,6 +1,5 @@
-PAR=-Wno-deprecated -O3 -fpermissive
+PAR=-Wno-deprecated -O3
 PAR2=-c -Wno-deprecated -O3
 LIB_PATH=../lib
-COMMON_PATH=../common
 CMDLINE_FILE='"../tok.c/cmdline.h"'
 
@@ -16,9 +15,10 @@
 	g++ $(PAR2) -D _CMDLINE_FILE=$(CMDLINE_FILE) common_tok.cc
 
-common.o: cmdline_common
+common.o: $(COMMON_PATH)/cmdline_common.ggo $(COMMON_PATH)/common.cc \
+	$(COMMON_PATH)/common.h
 	g++ $(PAR2) -D _CMDLINE_FILE=$(CMDLINE_FILE) $(COMMON_PATH)/common.cc
 
-cmdline.ggo: cmdline_tok.ggo $(COMMON_PATH)/cmdline_common.ggo
-	cat cmdline_tok.ggo $(COMMON_PATH)/cmdline_common.ggo > cmdline.ggo
+cmdline.ggo: cmdline_tok.ggo ../common/cmdline_common.ggo
+	cat cmdline_tok.ggo ../common/cmdline_common.ggo > cmdline.ggo
 
 cmdline.c cmdline.h: cmdline.ggo
@@ -32,10 +32,6 @@
 
 clean: clean.cmdline
-	rm *.o || true
-	rm tok || true
+	rm *.o
 
 clean.cmdline:
 	rm cmdline.*
-
-include $(COMMON_PATH)/common.mk
-include $(LIB_PATH)/lib.mk
Index: _old/app/src/tok.c/cmdline_tok.ggo
===================================================================
--- _old/app/src/tok.c/cmdline_tok.ggo	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/tok.c/cmdline_tok.ggo	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -2,4 +2,3 @@
 version "0.1"
 
-option "dictionary"             d       "Dictionary" string typestr="FILENAME" default="cor.bin" no
 
Index: _old/app/src/tok.c/common_tok.cc
===================================================================
--- _old/app/src/tok.c/common_tok.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/tok.c/common_tok.cc	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -1,7 +1,5 @@
-#include <cstdlib>
-#include <cstring>
+#include <stdlib.h>
+#include <string.h>
 #include "common_tok.h"
-
-using namespace std;
 
 char dictionary[255];
Index: _old/app/src/tok/Makefile
===================================================================
--- _old/app/src/tok/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/src/tok/Makefile	(revision a6e708f37f1025d3fd1cd8a7fe87a6029d723cbe)
@@ -1,5 +1,5 @@
 tok:
 
-copy: 
+copy:
 ifdef UTT_BIN_DIR
 	cp tok ${UTT_BIN_DIR}
