Index: _old/app/Makefile
===================================================================
--- _old/app/Makefile	(revision 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -54,7 +54,5 @@
 
 .PHONY: components
-components:
-	cd $(SRC_DIR)/lib && make; cd $(CUR_DIR)
-	
+components:		
 	@for cmp in $(COMPONENTS); do\
 		cd $(SRC_DIR)/$$cmp && make && make copy; cd $(CUR_DIR); \
@@ -82,5 +80,5 @@
 .PHONY: clean_dist
 clean_dist:
-
+	rm -rf ${UTT_DIR}
 
 # ------------------------------------------------------------------
@@ -145,5 +143,4 @@
 #	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: _old/app/conf/Makefile
===================================================================
--- _old/app/conf/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/conf/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -0,0 +1,8 @@
+main:
+
+copy:
+ifdef UTT_CONF_DIR
+	cp *.conf ${UTT_CONF_DIR}
+endif
+
+clean:
Index: _old/app/conf/compiledic.conf
===================================================================
--- _old/app/conf/compiledic.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/conf/compiledic.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -0,0 +1,13 @@
+# ************************************************************
+# * 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: _old/app/conf/cor.conf
===================================================================
--- _old/app/conf/cor.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/conf/cor.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -0,0 +1,14 @@
+# ************************************************************
+# * 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: _old/app/conf/dgc.conf
===================================================================
--- _old/app/conf/dgc.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/conf/dgc.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -0,0 +1,15 @@
+# ************************************************************
+# * 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: _old/app/conf/dgp.conf
===================================================================
--- _old/app/conf/dgp.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/conf/dgp.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -0,0 +1,18 @@
+# ************************************************************
+# * 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: _old/app/conf/gph.conf
===================================================================
--- _old/app/conf/gph.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/conf/gph.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -0,0 +1,16 @@
+# ************************************************************
+# * 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: _old/app/conf/grp.conf
===================================================================
--- _old/app/conf/grp.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/conf/grp.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -0,0 +1,15 @@
+# ************************************************************
+# * 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: _old/app/conf/gue.conf
===================================================================
--- _old/app/conf/gue.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/conf/gue.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -0,0 +1,14 @@
+# ************************************************************
+# * 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: _old/app/conf/kor.conf
===================================================================
--- _old/app/conf/kor.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/conf/kor.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -0,0 +1,16 @@
+# ************************************************************
+# * 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: _old/app/conf/lem.conf
===================================================================
--- _old/app/conf/lem.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/conf/lem.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -0,0 +1,14 @@
+# ************************************************************
+# * 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: _old/app/conf/mar.conf
===================================================================
--- _old/app/conf/mar.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/conf/mar.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -0,0 +1,15 @@
+# ************************************************************
+# * 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: _old/app/conf/ser.conf
===================================================================
--- _old/app/conf/ser.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/conf/ser.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -0,0 +1,15 @@
+# ************************************************************
+# * 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: _old/app/conf/utt.conf
===================================================================
--- _old/app/conf/utt.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
+++ _old/app/conf/utt.conf	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -0,0 +1,14 @@
+# ************************************************************
+# * 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 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/common/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -1,8 +1,7 @@
-# main: cmdline.c main_template.cc
-# 	g++ -o main cmdline.c common.cc main_template.cc
+COMMON_PATH=../common
 
-# cmdline.c cmdline.h : cmdline.ggo
-# 	gengetopt -i cmdline.ggo
+include ./common.mk
 
-# cmdline.ggo: cmdline_common.ggo cmdline_program.ggo
-# 	cat cmdline_common.ggo cmdline_program.ggo > cmdline.ggo
+clean:
+	rm -f cmdline.c cmdline.h cmdline.ggo
+ 
Index: _old/app/src/compiledic/Makefile
===================================================================
--- _old/app/src/compiledic/Makefile	(revision 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/compiledic/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -1,3 +1,3 @@
-CFLAG1 = -m32 -Wno-deprecated -O3 -fpermissive
+CFLAG1 = -Wno-deprecated -O3 -fpermissive
 CFLAG_ST = -Wno-deprecated -O3 -fpermissive -static
 
@@ -6,9 +6,6 @@
 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 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/compiledic/aut2fsa.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -1,5 +1,5 @@
 
 #include <iostream>
-#include <stdlib.h>
+#include <cstdlib>
 
 #include "../lib/tfti.h"
Index: _old/app/src/cor/Makefile
===================================================================
--- _old/app/src/cor/Makefile	(revision 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/cor/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -1,4 +1,4 @@
-PAR=-Wno-deprecated -m32 -fpermissive -static
-PAR2=-c -Wno-deprecated -m32 -fpermissive
+PAR=-Wno-deprecated -fpermissive -static
+PAR2=-c -Wno-deprecated -fpermissive
 LIB_PATH=../lib
 COMMON_PATH=../common
@@ -6,6 +6,5 @@
 
 
-cor: main.cc corr.o $(LIB_PATH)/word.o \
-	$(LIB_PATH)/auttools.o cmdline.c common_cor.o common.o 
+cor: main.cc corr.o word.o 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 \
@@ -15,6 +14,5 @@
 	g++ $(PAR2) corr.cc
 
-common.o: $(COMMON_PATH)/cmdline_common.ggo $(COMMON_PATH)/common.cc \
-	 $(COMMON_PATH)/common.h
+common.o: cmdline_common
 	g++ $(PAR2) -D _CMDLINE_FILE=$(CMDLINE_FILE) $(COMMON_PATH)/common.cc
 
@@ -40,2 +38,4 @@
 	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 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/dgp/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -1,4 +1,2 @@
-
-
 SHELL = /bin/sh
 LIB_PATH=../../lib
@@ -9,10 +7,10 @@
 #vpath %.o  .
 
-CXXFLAGS = -O2 -static
+CXXFLAGS = -O2 -static -fpermissive
 
 sources = main.cc grammar.cc symbol.cc mgraph.cc sgraph.cc dgp0.cc cmdline.cc \
           $(COMMON_PATH)/common.cc global.cc
 
-bin  = dgp
+bin  = dgp dgc canonize tre
 
 # plik *.o sa umieszczane w podkatalogu o
@@ -45,6 +43,5 @@
 
 clean:
-	rm ${bin} ${objs} cmdline.cc cmdline.h
-	rm -rf *.d
+	rm ${bin} ${objs} cmdline.cc cmdline.h *.d
 
 prof: dgp
Index: ld/app/src/dgp/canonize
===================================================================
--- _old/app/src/dgp/canonize	(revision 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ 	(revision )
@@ -1,50 +1,0 @@
-#!/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: ld/app/src/dgp/dgc
===================================================================
--- _old/app/src/dgp/dgc	(revision 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ 	(revision )
@@ -1,292 +1,0 @@
-#!/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 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/dgp/grammar.hh	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -11,6 +11,4 @@
 #include "sgraph.hh"
 
-
-using namespace std;
 
 class Link
Index: _old/app/src/dgp/mgraph.hh
===================================================================
--- _old/app/src/dgp/mgraph.hh	(revision 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/dgp/mgraph.hh	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -7,7 +7,4 @@
 #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 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/dgp/sgraph.hh	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -11,6 +11,4 @@
 #include "thesymbols.hh"
 
-
-using namespace std;
 
 class MNode;
Index: _old/app/src/dgp/thesymbols.hh
===================================================================
--- _old/app/src/dgp/thesymbols.hh	(revision 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/dgp/thesymbols.hh	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -8,7 +8,4 @@
 #include <set>
 #include <bitset>
-
-
-using namespace std;
 
 typedef Symbol<1> Cat;
Index: ld/app/src/dgp/tre
===================================================================
--- _old/app/src/dgp/tre	(revision 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ 	(revision )
@@ -1,304 +1,0 @@
-#!/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 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/gue/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -1,4 +1,4 @@
-PAR=-Wno-deprecated -O3 -fpermissive -m32 -static
-PAR2=-c -Wno-deprecated -O3 -fpermissive -m32
+PAR=-Wno-deprecated -O2 -fpermissive -static
+PAR2=-c -Wno-deprecated -O2 -fpermissive
 LIB_PATH=../lib
 COMMON_PATH=../common
@@ -6,6 +6,5 @@
 
 
-gue: main.cc guess.o $(LIB_PATH)/auttools.o $(LIB_PATH)/word.o \
-      cmdline.c common_guess.o common.o
+gue: main.cc guess.o auttools.o 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 \
@@ -18,6 +17,5 @@
 	g++ $(PAR2) common_guess.cc
 
-common.o: $(COMMON_PATH)/cmdline_common.ggo $(COMMON_PATH)/common.cc \
-	 $(COMMON_PATH)/common.h
+common.o: $(COMMON_PATH)/cmdline_common.ggo cmdline_common
 	g++ $(PAR2) -D _CMDLINE_FILE=$(CMDLINE_FILE) $(COMMON_PATH)/common.cc
 
@@ -41,2 +39,5 @@
 	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 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/gue/guess.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -2,9 +2,9 @@
 #include "guess.h"
 
-#include <string.h>
+#include <cstring>
 #include <iostream>
-#include <stdlib.h>
-#include <assert.h>
-#include <time.h>
+#include <cstdlib>
+#include <cassert>
+#include <ctime>
 
 #define DICT 1
@@ -18,7 +18,5 @@
 #define PREF_SIGN '_'
 
-
 using namespace std;
-
 
 Guess::Guess(const char* suf_file)
Index: _old/app/src/kor/Makefile
===================================================================
--- _old/app/src/kor/Makefile	(revision 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/kor/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -1,4 +1,4 @@
-PAR=-Wno-deprecated -m32 -fpermissive -static
-PAR2=-c -Wno-deprecated -m32 -fpermissive
+PAR=-Wno-deprecated -fpermissive -static
+PAR2=-c -Wno-deprecated -fpermissive
 LIB_PATH=../lib
 COMMON_PATH=../common
@@ -6,20 +6,16 @@
 
 
-kor: main.cc corr.o corlist.o cmdline.o $(LIB_PATH)/word.o \
-	$(LIB_PATH)/auttools.o cmdline.c common_cor.o common.o 
+kor: main.cc corr.o corlist.o cmdline.o word.o 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.hh cmdline.h
+corr.o: corr.cc corr.h 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 $(COMMON_PATH)/common.cc \
-	 $(COMMON_PATH)/common.h
+common.o: cmdline.h $(COMMON_PATH)/cmdline_common.ggo cmdline_common
 	g++ $(PAR2) -D _CMDLINE_FILE=$(CMDLINE_FILE) $(COMMON_PATH)/common.cc
 
@@ -45,2 +41,4 @@
 	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 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/kor/corlist.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -1,8 +1,9 @@
-#include <stdio.h>
-#include <malloc.h>
+#include <cstdio>
+//#include <alloc.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 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/kor/corr.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -1,5 +1,5 @@
 //---------------------------------------------------------------------------
 #include "common_cor.h"
-#include "corr.hh"
+#include "corr.h"
 
 #define MAXPATH 256
Index: ld/app/src/kor/corr.hh
===================================================================
--- _old/app/src/kor/corr.hh	(revision 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ 	(revision )
@@ -1,39 +1,0 @@
-//---------------------------------------------------------------------------
-#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 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/kor/main.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -3,5 +3,5 @@
 #include "../lib/iotools.h"
 #include "common_cor.h"
-#include "corr.hh"
+#include "corr.h"
 #include <locale.h>
 
Index: _old/app/src/lem/Makefile
===================================================================
--- _old/app/src/lem/Makefile	(revision 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/lem/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -1,4 +1,4 @@
-PAR=-Wno-deprecated -m32 -O3 -fpermissive -static
-PAR2=-c -Wno-deprecated -m32 -O3 -fpermissive -static
+PAR=-Wno-deprecated -O2 -fpermissive -static
+PAR2=-c -Wno-deprecated -O2 -fpermissive -static
 LIB_PATH=../lib
 COMMON_PATH=../common
@@ -6,6 +6,5 @@
 
 
-lem: main.cc lem.o  $(LIB_PATH)/auttools.o $(LIB_PATH)/word.o \
-      cmdline.c common_lem.o common.o symtab.o
+lem: main.cc lem.o auttools.o 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 \
@@ -28,6 +27,5 @@
 # 	g++ $(PAR2) $(LIB_PATH)/erro.cc
 
-common.o: $(COMMON_PATH)/cmdline_common.ggo $(COMMON_PATH)/common.cc \
-	 $(COMMON_PATH)/common.h
+common.o: cmdline_common
 	g++ $(PAR2) -D _CMDLINE_FILE=$(CMDLINE_FILE) $(COMMON_PATH)/common.cc
 
@@ -38,5 +36,5 @@
 	gengetopt -i cmdline.ggo --conf-parser
 
-cmdline.ggo: cmdline_lem.ggo ../common/cmdline_common.ggo
+cmdline.ggo: cmdline_lem.ggo $(COMMON_PATH)/cmdline_common.ggo
 	cat cmdline_lem.ggo ../common/cmdline_common.ggo > cmdline.ggo
 
@@ -55,2 +53,5 @@
 	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 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/lem/lem.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -1,7 +1,10 @@
 #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 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/lib/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -1,4 +1,4 @@
-PAR=-Wno-deprecated -m32 -O3
-PAR2=-c -Wno-deprecated -m32 -O3 -fpermissive
+PAR=-Wno-deprecated -O3
+PAR2=-c -Wno-deprecated -O3 -fpermissive
 # -static
 LIB_PATH=../lib
@@ -6,10 +6,4 @@
 
 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:
@@ -20,2 +14,4 @@
 #	cp -r perl $(UTT_LIB_DIR)/
 #endif
+
+include ./lib.mk
Index: _old/app/src/lib/auttools.cc
===================================================================
--- _old/app/src/lib/auttools.cc	(revision 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/lib/auttools.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -163,2 +163,3 @@
 }
 
+
Index: _old/app/src/lib/symtab.cc
===================================================================
--- _old/app/src/lib/symtab.cc	(revision 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/lib/symtab.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -1,7 +1,8 @@
 #include "symtab.h"
 #include <values.h>
-#include <stdio.h>
-#include <malloc.h>
-#include <stdlib.h>
+#include <cstdio>
+//#include <alloc.h>
+#include <cstdlib>
+using namespace std;
 //---------------------------------------------------------------------------
 
@@ -158,5 +159,6 @@
     strncpy((char*)&i2,s+(l/2-2),sizeof(int));
     strncpy((char*)&i3,s+(l-4),sizeof(int));
-    return abs((i1+i2+i3) % _sz);
+    //return abs((i1+i2+i3) % _sz);
+    return (i1+i2+i3) % _sz;
   }
   else
Index: _old/app/src/lib/tft.h
===================================================================
--- _old/app/src/lib/tft.h	(revision 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/lib/tft.h	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -5,18 +5,17 @@
 #include <iostream>
 #include <typeinfo>
-#include <string.h>
-
-#include <stdio.h>
+#include <cstring>
+
+#include <cstdio>
 
 //#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
@@ -26,44 +25,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; };
 
@@ -73,22 +72,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];
@@ -97,13 +96,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>
@@ -118,16 +117,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)
@@ -135,26 +134,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;
 
@@ -163,11 +162,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(); }
 
@@ -203,5 +202,5 @@
 protected:
 
-  TT* tt;                // tablica przej¶æ
+  TT* tt;                // tablica przejï¿œï¿œ
 
   long prn(const I* si, long* p, O* so) const;
@@ -211,5 +210,5 @@
   void sort();
 
-  void setiotypes();     // NIE DZIA£A (dlaczego???)
+  void setiotypes();     // NIE DZIAï¿œA (dlaczego???)
 
 //  friend ostream& operator<<(ostream&,const CDFA&);
@@ -229,10 +228,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'
 */
 
@@ -291,8 +290,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>
@@ -312,11 +311,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>
@@ -349,10 +348,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
 
 */
@@ -377,11 +376,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>
@@ -412,10 +411,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>
@@ -483,8 +482,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>
@@ -527,11 +526,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>
@@ -557,11 +556,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>
@@ -583,12 +582,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>
@@ -602,5 +601,5 @@
 
   long s;
-  if(*buf)                     // pierwsze wywo³anie
+  if(*buf)                     // pierwsze wywoï¿œanie
   {
     if(!lgstpath(buf,path,start))
@@ -609,5 +608,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 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/lib/tfti.h	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -3,6 +3,7 @@
 //---------------------------------------------------------------------------
 #include <fstream>
-#include <math.h>
+#include <cmath>
 #include <iomanip>
+#include <iostream>
 //#include <typeinfo.h>
 
@@ -10,7 +11,5 @@
 //---------------------------------------------------------------------------
 
-
 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 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/lib/ttrans.h	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -3,8 +3,6 @@
 //---------------------------------------------------------------------------
 #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 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/lib/word.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -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() {
-//  sort(tab.begin(), tab.end(), Word::cmp_w); //NIE DZIALA
+  std::sort(tab.begin(), tab.end(), Word::cmp_w);
 }
 
 //---------------------------------------------------------------------------
 void Words::sort_rev() {
-//  sort(tab.begin(), tab.end(), cmp_w_rev_fun); // NIE DZIALA
+  std::sort(tab.begin(), tab.end(), cmp_w_rev_fun);
 }
 
Index: _old/app/src/lib/word.h
===================================================================
--- _old/app/src/lib/word.h	(revision 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/lib/word.h	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -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 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/tok.c/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -1,5 +1,6 @@
-PAR=-Wno-deprecated -O3
+PAR=-Wno-deprecated -O3 -fpermissive
 PAR2=-c -Wno-deprecated -O3
 LIB_PATH=../lib
+COMMON_PATH=../common
 CMDLINE_FILE='"../tok.c/cmdline.h"'
 
@@ -15,10 +16,9 @@
 	g++ $(PAR2) -D _CMDLINE_FILE=$(CMDLINE_FILE) common_tok.cc
 
-common.o: $(COMMON_PATH)/cmdline_common.ggo $(COMMON_PATH)/common.cc \
-	$(COMMON_PATH)/common.h
+common.o: cmdline_common
 	g++ $(PAR2) -D _CMDLINE_FILE=$(CMDLINE_FILE) $(COMMON_PATH)/common.cc
 
-cmdline.ggo: cmdline_tok.ggo ../common/cmdline_common.ggo
-	cat cmdline_tok.ggo ../common/cmdline_common.ggo > cmdline.ggo
+cmdline.ggo: cmdline_tok.ggo $(COMMON_PATH)/cmdline_common.ggo
+	cat cmdline_tok.ggo $(COMMON_PATH)/cmdline_common.ggo > cmdline.ggo
 
 cmdline.c cmdline.h: cmdline.ggo
@@ -32,6 +32,10 @@
 
 clean: clean.cmdline
-	rm *.o
+	rm *.o || true
+	rm tok || true
 
 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 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/tok.c/cmdline_tok.ggo	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -2,3 +2,4 @@
 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 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/tok.c/common_tok.cc	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -1,5 +1,7 @@
-#include <stdlib.h>
-#include <string.h>
+#include <cstdlib>
+#include <cstring>
 #include "common_tok.h"
+
+using namespace std;
 
 char dictionary[255];
Index: _old/app/src/tok/Makefile
===================================================================
--- _old/app/src/tok/Makefile	(revision 57728c1d40118b66361f4d949f1ad6409070f9c6)
+++ _old/app/src/tok/Makefile	(revision 1e121f45e2d091fcd34a893291b8453e350d5884)
@@ -1,5 +1,5 @@
 tok:
 
-copy:
+copy: 
 ifdef UTT_BIN_DIR
 	cp tok ${UTT_BIN_DIR}
