Fresco/Babylon/demo Makefile.in,NONE,1.1 dump_blocks.cc,NONE,1.1 dump_compexclude.cc,NONE,1.1 dump_ea.cc,NONE,1.1 dump_lb.cc,NONE,1.1 dump_props.cc,NONE,1.1 dump_ucd.cc,NONE,1.1 normalize.cc,NONE,1.1

Tobias Hunger <[email protected]> Fri, 01 Aug 2003 11:47:13 -0500
Newsgroups gmane.comp.video.fresco.cvs
Message-ID <[email protected]>
Update of /cvs/fresco/Fresco/Babylon/demo
In directory purcel:/tmp/cvs-serv24256/Babylon/demo

Added Files:
	Makefile.in dump_blocks.cc dump_compexclude.cc dump_ea.cc 
	dump_lb.cc dump_props.cc dump_ucd.cc normalize.cc 
Log Message:
Babylon work over:
 * Use iconv to convert characters to/from Babylon
 * Updtae to Unicode Version 4.0
 * Added unit tests (some fail for now, still need to work on that)

 * Removed the VisualTextBuffer from the CommandKit: I still like the idea,
   unfortunately it won't work out in the real world:-|

 * Updated code to the changed Babylon interfaces whereever needed.


--- NEW FILE: Makefile.in ---
# $Id: Makefile.in,v 1.1 2003/08/01 16:47:09 tobias Exp $
#
# This source file is a part of the Fresco Project.
# Copyright (C) 1999-2003 Stefan Seefeld <[email protected]> and
#                         Tobias Hunger <[email protected]>
# http://www.fresco.org
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
# MA 02139, USA.

SHELL		:= /bin/sh

top_srcdir	:= @top_srcdir@
top_builddir	:= @top_builddir@
srcdir		:= @srcdir@
cdir		:= $(top_builddir)/config
hdir		:= $(top_srcdir)/include/Babylon
docdir		:= $(top_builddir)/share/doc/Babylon

include $(cdir)/local.mk

CXXFLAGS	+= $(SO_CXXFLAGS)
LDFLAGS		+= $(SO_LDFLAGS)
CPPFLAGS        += -DRC_MODULEPATH='"$(libdir)/Babylon"'

SRC		:= dump_blocks.cc dump_ucd.cc dump_lb.cc dump_ea.cc \
		   dump_compexclude.cc dump_props.cc normalize.cc
HDR		:= 
DEP		:= $(patsubst %.cc, %.d, $(SRC))
OBJ		:= $(patsubst %.cc, %.o, $(SRC))
HSYN		:= $(patsubst %, %.syn, $(HDR))
SSYN		:= $(patsubst %, %.syn, $(SRC))
SYN		:= $(HSYN) $(SSYN)
XREF		:= $(patsubst %, %.xref, $(HDR))
XREF		+= $(patsubst %, %.xref, $(SRC))

TARGETS		:= $(patsubst %.cc, $(top_builddir)/bin/%, $(SRC))
MANUAL		:= $(docdir)/html

vpath %.hh  $(hdir)
vpath %.cc  $(srcdir)

.FORCE:

.PHONY: depend doc install install-doc uninstall clean distclean maintainer-clean dist

all:	$(TARGETS)

$(top_builddir)/bin/dump_blocks : dump_blocks.o
	@echo linking $(@F)
	$(CXX) -L../lib -lBabylon $(LIBS) -o $@ $<

$(top_builddir)/bin/dump_ucd : dump_ucd.o
	@echo linking $(@F)
	$(CXX) -L../lib -lBabylon $(LIBS) -o $@ $<

$(top_builddir)/bin/dump_lb : dump_lb.o
	@echo linking $(@F)
	$(CXX) -L../lib -lBabylon $(LIBS) -o $@ $<

$(top_builddir)/bin/dump_ea : dump_ea.o
	@echo linking $(@F)
	$(CXX) -L../lib -lBabylon $(LIBS) -o $@ $<

$(top_builddir)/bin/dump_compexclude : dump_compexclude.o
	@echo linking $(@F)
	$(CXX) -L../lib -lBabylon $(LIBS) -o $@ $<

$(top_builddir)/bin/dump_props : dump_props.o
	@echo linking $(@F)
	$(CXX) -L../lib -lBabylon $(LIBS) -o $@ $<

$(top_builddir)/bin/normalize : normalize.o
	@echo linking $(@F)
	$(CXX) -L../lib -lBabylon $(LIBS) -o $@ $<

$(top_builddir)/bin/bidir : bidir.o
	@echo linking $(@F)
	$(CXX) -L../lib -lBabylon $(LIBS) -o $@ $<

depend: $(DEP)

xref:

doc:

$(MANUAL):

install:	all

install-doc:

uninstall:

build-tests: all

run-tests: build-tests

clean:	
	rm -f $(TARGET)
	rm -f *.o *.d *.syn

distclean:	clean
	rm -f Makefile

maintainer-clean: distclean

%.d:	%.cc %.hh
	@echo generating dependencies for $(<F)
	$(SHELL) -ec '$(CXX) $(DEPFLAGS) $(CPPFLAGS) $< | sed "s/$*\\.o[ :]*/$*\\.d $*\\.o : /g" > $@'

%.o:	%.cc
	@echo compiling $(@F)
	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@

ifneq (,$(findstring depend, $(MAKECMDGOALS)))
$(DEP): %.d:	.FORCE
endif

ifeq (,$(filter $(MAKECMDGOALS), depend doc install-doc clean distclean maintainer-clean))
-include $(DEP)
endif

--- NEW FILE: dump_blocks.cc ---
/*$Id: dump_blocks.cc,v 1.1 2003/08/01 16:47:09 tobias Exp $
 *
 * This source file is a part of the Fresco Project.
 * Copyright (C) 1999-2003 Tobias Hunger <[email protected]>
 * http://www.fresco.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
 * MA 02139, USA.
 */

#include <Babylon/Char.hh>
#include <Babylon/String.hh>
#include <Babylon/internal/Dictionary.hh>
#include <Prague/Sys/Path.hh>
#include <iostream>
#include <iomanip>

using namespace Babylon;

void output_char(std::ostream & out, Char a)
{
    out.setf(std::ios::uppercase);
    out << std::hex << std::setfill('0');
    if (a.value() <= 0xFFFF)
        out << std::setw(4) << a.value();
    else if (a.value() <= 0xFFFFF)
        out << std::setw(5) << a.value();
    else if (a.value() <= 0xFFFFFF)
        out << std::setw(6) << a.value();
    else if (a.value() <= 0xFFFFFFF)
        out << std::setw(7) << a.value();
    else
        out << std::setw(8) << a.value();
}

int main(int argc, char** argv)
{
    try
    {
	if (argc == 2) Babylon::override_path(std::string(argv[1]));
	
	for(Char A(UC_NULL);
	    A.value() != UC_MAX_DEFINED;
	    A = Dictionary::instance()->start_of_next_block(A.value()))
	{
	    output_char(std::cout,
			Char(Dictionary::instance()->
			     first_letter_of_block(A.value())));
	    std::cout << "..";
	    output_char(std::cout,
			Char(Dictionary::instance()->
			     last_letter_of_block(A.value())));
	    std::cout << "; "
		      << A.blockname() << std::endl;
	}
    }
    catch(std::runtime_error &e)
    {
	std::cout << "Caught an runtime exception: " << e.what()
		  << std::endl;
    }
    catch(std::exception &e)
    {
	std::cout << "Caught an exception: " << e.what()
		  << std::endl;
    }
    catch(...)
    {
	std::cout << "Some exception happened!" << std::endl;
    }
}

--- NEW FILE: dump_compexclude.cc ---
/*$Id:
 *
 * This source file is a part of the Fresco Project.
 * Copyright (C) 2003 Tobias Hunger <[email protected]>
 * http://www.fresco.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
 * MA 02139, USA.
 */

#include <Babylon/Char.hh>
#include <Prague/Sys/Path.hh>
#include <iostream>
#include <iomanip>

using namespace Babylon;

void output_char(std::ostream & out, Char a)
{
    out.setf(std::ios::uppercase);
    out << std::hex << std::setfill('0');
    if (a.value() <= 0xFFFF)
        out << std::setw(4) << a.value();
    else if (a.value() <= 0xFFFFF)
        out << std::setw(5) << a.value();
    else if (a.value() <= 0xFFFFFF)
        out << std::setw(6) << a.value();
    else if (a.value() <= 0xFFFFFFF)
        out << std::setw(7) << a.value();
    else
        out << std::setw(8) << a.value();
}

int main(int argc, char** argv)
{
    try
    {
	if (argc == 2) Babylon::override_path(std::string(argv[1]));

	for (Char A(UC_NULL); A.value() < 0x110000; ++A)
	    if (A.exclude_from_composition())
	    {
		output_char(std::cout, A);
		std::cout << std::endl;
	    }
	    else if (A.is_Full_Composition_Exclusion())
	    {
		std::cout << "# ";
		output_char(std::cout, A);
		std::cout << std::endl;
	    }
	 
    }
    catch(std::runtime_error &e)
    {
	std::cout << "Caught an runtime exception: " << e.what()
		  << std::endl;
    }
    catch(std::exception &e)
    {
	std::cout << "Caught an exception: " << e.what()
		  << std::endl;
    }
    catch(...)
    {
	std::cout << "Some exception happened!" << std::endl;
    }
}

--- NEW FILE: dump_ea.cc ---
/*
 *$Id: dump_ea.cc,v 1.1 2003/08/01 16:47:09 tobias Exp $
 *
 * This source file is a part of the Fresco Project.
 * Copyright (C) 1999-2003 Tobias Hunger <[email protected]>
 * http://www.fresco.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
 * MA 02139, USA.
 */

#include <Babylon/Char.hh>
#include <Prague/Sys/Path.hh>
#include <iostream>
#include <iomanip>

using namespace Babylon;

void output_char(std::ostream & out, Char a)
{
    out.setf(std::ios::uppercase);
    out << std::hex << std::setfill('0');
    if (a.value() <= 0xFFFF)
        out << std::setw(4) << a.value();
    else if (a.value() <= 0xFFFFF)
        out << std::setw(5) << a.value();
    else if (a.value() <= 0xFFFFFF)
        out << std::setw(6) << a.value();
    else if (a.value() <= 0xFFFFFFF)
        out << std::setw(7) << a.value();
    else
        out << std::setw(8) << a.value();
}

void output(std::ostream & out, Char s, EA_Width c)
{
    output_char(out, s);
    out << ";";
    switch (s.EA_width())
    {
    case EA_WIDTH_W:
	out << "W";
	break;
    case EA_WIDTH_F:
	out << "F";
	break;
    case EA_WIDTH_Na:
	out << "Na";
	break;
    case EA_WIDTH_H:
	out << "H";
	break;
    case EA_WIDTH_A:
	out << "A";
	break;
    case EA_WIDTH_N:
	out << "N";
	break;
    default:
	out << "UNKNOWN";
    }
    out << std::endl;
}

int main(int argc, char** argv)
{
    try
    {
	if (argc == 2) Babylon::override_path(std::string(argv[1]));
	
	for (Char A(UC_NULL); A.value() < 0x110000; ++A)
	{
	    if (A.EA_width() == EA_WIDTH_MAX) continue;
	    output(std::cout, A, A.EA_width());
	}
    }
    catch(std::runtime_error &e)
    {
	std::cout << "Caught an runtime exception: " << e.what()
		  << std::endl;
    }
    catch(std::exception &e)
    {
	std::cout << "Caught an exception: " << e.what()
		  << std::endl;
    }
    catch(...)
    {
	std::cout << "Some exception happened!" << std::endl;
    }
}

--- NEW FILE: dump_lb.cc ---
/*
 *$Id: dump_lb.cc,v 1.1 2003/08/01 16:47:09 tobias Exp $
 *
 * This source file is a part of the Fresco Project.
 * Copyright (C) 1999-2003 Tobias Hunger <[email protected]>
 * http://www.fresco.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
 * MA 02139, USA.
 */

#include <Babylon/Char.hh>
#include <Prague/Sys/Path.hh>
#include <iostream>
#include <iomanip>

using namespace Babylon;

void output_char(std::ostream & out, Char a)
{
    out.setf(std::ios::uppercase);
    out << std::hex << std::setfill('0');
    if (a.value() <= 0xFFFF)
        out << std::setw(4) << a.value();
    else if (a.value() <= 0xFFFFF)
        out << std::setw(5) << a.value();
    else if (a.value() <= 0xFFFFFF)
        out << std::setw(6) << a.value();
    else if (a.value() <= 0xFFFFFFF)
        out << std::setw(7) << a.value();
    else
        out << std::setw(8) << a.value();
}

void output_range(std::ostream & out, Char s, Char e, Line_Break c)
{
    if (s == e) output_char(out, s);
    else
    {
	output_char(out, s);
	out << "..";
	output_char(out, e);
    }
    out << ";";
    switch (c)
    {
    case LB_BK:
	out << "BK";
	break;
    case LB_CR:
	out << "CR";
	break;
    case LB_LF:
	out << "LF";
	break;
    case LB_CM:
	out << "CM";
	break;
    case LB_SG:
	out << "SG";
	break;
    case LB_GL:
	out << "GL";
	break;
    case LB_CB:
	out << "CB";
	break;
    case LB_SP:
	out << "SP";
	break;
    case LB_ZW:
	out << "ZW";
	break;
    case LB_NL:
	out << "NL";
	break;
    case LB_WJ:
	out << "WJ";
	break;
    case LB_XX:
	out << "XX";
	break;
    case LB_OP:
	out << "OP";
	break;
    case LB_CL:
	out << "CL";
	break;
    case LB_QU:
	out << "QU";
	break;
    case LB_NS:
	out << "NS";
	break;
    case LB_EX:
	out << "EX";
	break;
    case LB_SY:
	out << "SY";
	break;
    case LB_IS:
	out << "IS";
	break;
    case LB_PR:
	out << "PR";
	break;
    case LB_PO:
	out << "PO";
	break;
    case LB_NU:
	out << "NU";
	break;
    case LB_AL:
	out << "AL";
	break;
    case LB_ID:
	out << "ID";
	break;
    case LB_IN:
	out << "IN";
	break;
    case LB_HY:
	out << "HY";
	break;
    case LB_BB:
	out << "BB";
	break;
    case LB_BA:
	out << "BA";
	break;
    case LB_SA:
	out << "SA";
	break;
    case LB_AI:
	out << "AI";
	break;
    case LB_B2:
	out << "B2";
	break;
    default:
	out << "UNKNOWN";
    }
    out << std::endl;
}

int main(int argc, char** argv)
{
    try
    {
	if (argc == 2) Babylon::override_path(std::string(argv[1]));
	
	for (Char A(UC_NULL); A.value() < 0x110000; ++A)
	{
	    if (!A.is_defined()) continue;
	    if (A.value() == 0x3400)
	    {
		output_range(std::cout, A, 0x4DB5, A.linebreak());
		A = 0x4DB5;
		continue;
	    }
	    if (A.value() == 0x4E00)
	    {
		output_range(std::cout, A, 0x9FA5, A.linebreak());
		A = 0x9FA5;
		continue;
	    }
	    if (A.value() == 0xAC00)
	    {
		output_range(std::cout, A, 0xD7A3, A.linebreak());
		A = 0xD7A3;
		continue;
	    }
	    if (A.value() == 0xD800)
	    {
		output_range(std::cout, A, 0xDB7F, A.linebreak());
		A = 0xDB7F;
		continue;
	    }
	    if (A.value() == 0xDB80)
	    {
		output_range(std::cout, A, 0xDBFF, A.linebreak());
		A = 0xDBFF;
		continue;
	    }
	    if (A.value() == 0xDC00)
	    {
		output_range(std::cout, A, 0xDFFF, A.linebreak());
		A = 0xDFFF;
		continue;
	    }
	    if (A.value() == 0xE000)
	    {
		output_range(std::cout, A, 0xF8FF, A.linebreak());
		A = 0xF8FF;
		continue;
	    }
	    if (A.value() == 0x20000)
	    {
		output_range(std::cout, A, 0x2A6D6, A.linebreak());
		A = 0x2A6D6;
		continue;
	    }
	    if (A.value() == 0xF0000)
	    {
		output_range(std::cout, A, 0xFFFFD, A.linebreak());
		A = 0xFFFFD;
		continue;
	    }
	    if (A.value() == 0x100000)
	    {
		output_range(std::cout, A, 0x10FFFD, A.linebreak());
		A = 0x10FFFD;
		continue;
	    }
	    output_range(std::cout, A, A, A.linebreak());
	}
    }
    catch(std::runtime_error &e)
    {
	std::cout << "Caught an runtime exception: " << e.what()
		  << std::endl;
    }
    catch(std::exception &e)
    {
	std::cout << "Caught an exception: " << e.what()
		  << std::endl;
    }
    catch(...)
    {
	std::cout << "Some exception happened!" << std::endl;
    }
}

--- NEW FILE: dump_props.cc ---
/*$Id:
 *
 * This source file is a part of the Fresco Project.
 * Copyright (C) 2003 Tobias Hunger <[email protected]>
 * http://www.fresco.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
 * MA 02139, USA.
 */

#include <Babylon/Char.hh>
#include <Prague/Sys/Path.hh>
#include <sstream>
#include <iostream>
#include <iomanip>

using namespace Babylon;

class Property
{
  public:
    virtual std::string property() = 0;
    virtual bool get(Char) = 0;
};

// Properties
class White_Space : public Property
{
  public:
    std::string property() { return std::string("White_Space"); }
    bool get(Char a) { return a.is_White_Space(); }
};

class Bidi_Control : public Property
{
  public:
    std::string property() { return std::string("Bidi_Control"); }
    bool get(Char a) { return a.is_Bidi_Control(); }
};

class Join_Control : public Property
{
  public:
    std::string property() { return std::string("Join_Control"); }
    bool get(Char a) { return a.is_Join_Control(); }
};

class Dash : public Property
{
  public:
    std::string property() { return std::string("Dash"); }
    bool get(Char a) { return a.is_Dash(); }
};

class Hyphen : public Property
{
  public:
    std::string property() { return std::string("Hyphen"); }
    bool get(Char a) { return a.is_Hyphen(); }
};

class Quotation_Mark : public Property
{
  public:
    std::string property() { return std::string("Quotation_Mark"); }
    bool get(Char a) { return a.is_Quotation_Mark(); }
};

class Terminal_Punctuation : public Property
{
  public:
    std::string property() { return std::string("Terminal_Punctuation"); }
    bool get(Char a) { return a.is_Terminal_Punctuation(); }
};

class Other_Math : public Property
{
  public:
    std::string property() { return std::string("Other_Math"); }
    bool get(Char a) { return a.is_Other_Math(); }
};

class Hex_Digit : public Property
{
  public:
    std::string property() { return std::string("Hex_Digit"); }
    bool get(Char a) { return a.is_Hex_Digit(); }
};

class ASCII_Hex_Digit : public Property
{
  public:
    std::string property() { return std::string("ASCII_Hex_Digit"); }
    bool get(Char a) { return a.is_ASCII_Hex_Digit(); }
};

class Other_Alphabetic : public Property
{
  public:
    std::string property() { return std::string("Other_Alphabetic"); }
    bool get(Char a) { return a.is_Other_Alphabetic(); }
};

class Ideographic : public Property
{
  public:
    std::string property() { return std::string("Ideographic"); }
    bool get(Char a) { return a.is_Ideographic(); }
};

class Diacritic : public Property
{
  public:
    std::string property() { return std::string("Diacritic"); }
    bool get(Char a) { return a.is_Diacritic(); }
};

class Extender : public Property
{
  public:
    std::string property() { return std::string("Extender"); }
    bool get(Char a) { return a.is_Extender(); }
};

class Other_Lowercase : public Property
{
  public:
    std::string property() { return std::string("Other_Lowercase"); }
    bool get(Char a) { return a.is_Other_Lowercase(); }
};

class Other_Uppercase : public Property
{
  public:
    std::string property() { return std::string("Other_Uppercase"); }
    bool get(Char a) { return a.is_Other_Uppercase(); }
};

class Noncharacter_Code_Point : public Property
{
  public:
    std::string property() { return std::string("Noncharacter_Code_Point"); }
    bool get(Char a) { return a.is_Noncharacter_Code_Point(); }
};

class Other_Grapheme_Extend : public Property
{
  public:
    std::string property() { return std::string("Other_Grapheme_Extend"); }
    bool get(Char a) { return a.is_Other_Grapheme_Extend(); }
};

class Grapheme_Link : public Property
{
  public:
    std::string property() { return std::string("Grapheme_Link"); }
    bool get(Char a) { return a.is_Grapheme_Link(); }
};

class IDS_Binary_Operator : public Property
{
  public:
    std::string property() { return std::string("IDS_Binary_Operator"); }
    bool get(Char a) { return a.is_IDS_Binary_Operator(); }
};

class IDS_Trinary_Operator : public Property
{
  public:
    std::string property() { return std::string("IDS_Trinary_Operator"); }
    bool get(Char a) { return a.is_IDS_Trinary_Operator(); }
};

class Radical : public Property
{
  public:
    std::string property() { return std::string("Radical"); }
    bool get(Char a) { return a.is_Radical(); }
};

class Unified_Ideograph : public Property
{
  public:
    std::string property() { return std::string("Unified_Ideograph"); }
    bool get(Char a) { return a.is_Unified_Ideograph(); }
};

class Other_Default_Ignorable_Code_Point : public Property
{
  public:
    std::string property() { return std::string("Other_Default_Ignorable_Code_Point"); }
    bool get(Char a) { return a.is_Other_Default_Ignorable_Code_Point(); }
};

class Deprecated : public Property
{
  public:
    std::string property() { return std::string("Deprecated"); }
    bool get(Char a) { return a.is_Deprecated(); }
};

class Soft_Dotted : public Property
{
  public:
    std::string property() { return std::string("Soft_Dotted"); }
    bool get(Char a) { return a.is_Soft_Dotted(); }
};

class Logical_Order_Exception : public Property
{
  public:
    std::string property() { return std::string("Logical_Order_Exception"); }
    bool get(Char a) { return a.is_Logical_Order_Exception(); }
};

class Other_ID_Start : public Property
{
  public:
    std::string property() { return std::string("Other_ID_Start"); }
    bool get(Char a) { return a.is_Other_ID_Start(); }
};

// Derived Properties
class Math : public Property
{
  public:
    std::string property() { return std::string("Math"); }
    bool get(Char a) { return a.is_Math(); }
};

class Alphabetic : public Property
{
  public:
    std::string property() { return std::string("Alphabetic"); }
    bool get(Char a) { return a.is_Alphabetic(); }
};

class Lowercase : public Property
{
  public:
    std::string property() { return std::string("Lowercase"); }
    bool get(Char a) { return a.is_Lowercase(); }
};

class Uppercase : public Property
{
  public:
    std::string property() { return std::string("Uppercase"); }
    bool get(Char a) { return a.is_Uppercase(); }
};

class ID_Start : public Property
{
  public:
    std::string property() { return std::string("ID_Start"); }
    bool get(Char a) { return a.is_ID_Start(); }
};

class ID_Continue : public Property
{
  public:
    std::string property() { return std::string("ID_Continue"); }
    bool get(Char a) { return a.is_ID_Continue(); }
};

class XID_Start : public Property
{
  public:
    std::string property() { return std::string("XID_Start"); }
    bool get(Char a) { return a.is_XID_Start(); }
};

class XID_Continue : public Property
{
  public:
    std::string property() { return std::string("XID_Continue"); }
    bool get(Char a) { return a.is_XID_Continue(); }
};

class Default_Ignorable_Code_Point : public Property
{
  public:
    std::string property() { return std::string("Default_Ignorable_Code_Point"); }
    bool get(Char a) { return a.is_Default_Ignorable_Code_Point(); }
};

class Grapheme_Extend : public Property
{
  public:
    std::string property() { return std::string("Grapheme_Extend"); }
    bool get(Char a) { return a.is_Grapheme_Extend(); }
};

class Grapheme_Base : public Property
{
  public:
    std::string property() { return std::string("Grapheme_Base"); }
    bool get(Char a) { return a.is_Grapheme_Base(); }
};

class FC_NFKC_Closure : public Property
{
  public:
    std::string property() { return std::string("FC_NFKC_Closure"); }
    bool get(Char a) { return a.is_FC_NFKC_Closure(); }
};

class Full_Composition_Exclusion : public Property
{
  public:
    std::string property() { return std::string("Full_Composition_Exclusion"); }
    bool get(Char a) { return a.is_Full_Composition_Exclusion(); }
};

class NFD_QuickCheck : public Property
{
  public:
    std::string property() { return std::string("NFD_QuickCheck"); }
    bool get(Char a) { return a.is_NFD_QuickCheck(); }
};

class NFC_QuickCheck : public Property
{
  public:
    std::string property() { return std::string("NFC_QuickCheck"); }
    bool get(Char a) { return a.is_NFC_QuickCheck(); }
};

class NFKD_QuickCheck : public Property
{
  public:
    std::string property() { return std::string("NFKD_QuickCheck"); }
    bool get(Char a) { return a.is_NFKD_QuickCheck(); }
};

class NFKC_QuickCheck : public Property
{
  public:
    std::string property() { return std::string("NFKC_QuickCheck"); }
    bool get(Char a) { return a.is_NFKC_QuickCheck(); }
};

class Expands_On_NFD : public Property
{
  public:
    std::string property() { return std::string("Expands_On_NFD"); }
    bool get(Char a) { return a.is_Expands_On_NFD(); }
};

class Expands_On_NFC : public Property
{
  public:
    std::string property() { return std::string("Expands_On_NFC"); }
    bool get(Char a) { return a.is_Expands_On_NFC(); }
};

class Expands_On_NFKD : public Property
{
  public:
    std::string property() { return std::string("Expands_On_NFKD"); }
    bool get(Char a) { return a.is_Expands_On_NFKD(); }
};

class Expands_On_NFKC : public Property
{
  public:
    std::string property() { return std::string("Expands_On_NFKC"); }
    bool get(Char a) { return a.is_Expands_On_NFKC(); }
};

// Further Properties
class Space : public Property
{
  public:
    std::string property() { return std::string("Space"); }
    bool get(Char a) { return a.is_Space(); }
};

class Punctuation : public Property
{
  public:
    std::string property() { return std::string("Punctuation"); }
    bool get(Char a) { return a.is_Punctuation(); }
};

class Line_Separator : public Property
{
  public:
    std::string property() { return std::string("Line_Separator"); }
    bool get(Char a) { return a.is_Line_Separator(); }
};

class Paragraph_Separator : public Property
{
  public:
    std::string property() { return std::string("Paragraph_Separator"); }
    bool get(Char a) { return a.is_Paragraph_Separator(); }
};

class Currency_Symbol : public Property
{
  public:
    std::string property() { return std::string("Currency_Symbol"); }
    bool get(Char a) { return a.is_Currency_Symbol(); }
};

class Bidi_Left_to_Right : public Property
{
  public:
    std::string property() { return std::string("Bidi_Left_to_Right"); }
    bool get(Char a) { return a.is_Bidi_Left_to_Right(); }
};

class Bidi_European_Digit : public Property
{
  public:
    std::string property() { return std::string("Bidi_European_Digit"); }
    bool get(Char a) { return a.is_Bidi_European_Digit(); }
};

class Bidi_Eur_Num_Separator : public Property
{
  public:
    std::string property() { return std::string("Bidi_Eur_Num_Separator"); }
    bool get(Char a) { return a.is_Bidi_Eur_Num_Separator(); }
};

class Bidi_Eur_Num_Terminator : public Property
{
  public:
    std::string property() { return std::string("Bidi_Eur_Num_Terminator"); }
    bool get(Char a) { return a.is_Bidi_Eur_Num_Terminator(); }
};

class Bidi_Arabic_Digit : public Property
{
  public:
    std::string property() { return std::string("Bidi_Arabic_Digit"); }
    bool get(Char a) { return a.is_Bidi_Arabic_Digit(); }
};

class Bidi_Common_Separator : public Property
{
  public:
    std::string property() { return std::string("Bidi_Common_Separator"); }
    bool get(Char a) { return a.is_Bidi_Common_Separator(); }
};

class Bidi_Block_Separator : public Property
{
  public:
    std::string property() { return std::string("Bidi_Block_Separator"); }
    bool get(Char a) { return a.is_Bidi_Block_Separator(); }
};

class Bidi_Segment_Separator : public Property
{
  public:
    std::string property() { return std::string("Bidi_Segment_Separator"); }
    bool get(Char a) { return a.is_Bidi_Segment_Separator(); }
};

class Bidi_Whitespace : public Property
{
  public:
    std::string property() { return std::string("Bidi_Whitespace"); }
    bool get(Char a) { return a.is_Bidi_Whitespace(); }
};

class Bidi_Non_spacing_Mark : public Property
{
  public:
    std::string property() { return std::string("Bidi_Non_spacing_Mark"); }
    bool get(Char a) { return a.is_Bidi_Non_spacing_Mark(); }
};

class Bidi_Boundary_Neutral : public Property
{
  public:
    std::string property() { return std::string("Bidi_Boundary_Neutral"); }
    bool get(Char a) { return a.is_Bidi_Boundary_Neutral(); }
};

class Bidi_PDF : public Property
{
  public:
    std::string property() { return std::string("Bidi_PDF"); }
    bool get(Char a) { return a.is_Bidi_PDF(); }
};

class Bidi_Embedding_or_Override : public Property
{
  public:
    std::string property() { return std::string("Bidi_Embedding_or_Override"); }
    bool get(Char a) { return a.is_Bidi_Embedding_or_Override(); }
};

class Bidi_Other_Neutral : public Property
{
  public:
    std::string property() { return std::string("Bidi_Other_Neutral"); }
    bool get(Char a) { return a.is_Bidi_Other_Neutral(); }
};

class Virama : public Property
{
  public:
    std::string property() { return std::string("Virama"); }
    bool get(Char a) { return a.is_Virama(); }
};

class Printable : public Property
{
  public:
    std::string property() { return std::string("Printable"); }
    bool get(Char a) { return a.is_Printable(); }
};

class Titlecase : public Property
{
  public:
    std::string property() { return std::string("Titlecase"); }
    bool get(Char a) { return a.is_Titlecase(); }
};

class Private_Use : public Property
{
  public:
    std::string property() { return std::string("Private_Use"); }
    bool get(Char a) { return a.is_Private_Use(); }
};

Property * get_property(const std::string & p)
{
    // Properties
    if (p == "White_Space") return new White_Space();
    if (p == "Bidi_Control") return new Bidi_Control();
    if (p == "Join_Control") return new Join_Control();
    if (p == "Dash") return new Dash();
    if (p == "Hyphen") return new Hyphen();
    if (p == "Quotation_Mark") return new Quotation_Mark();
    if (p == "Terminal_Punctuation") return new Terminal_Punctuation();
    if (p == "Other_Math") return new Other_Math();
    if (p == "Hex_Digit") return new Hex_Digit();
    if (p == "ASCII_Hex_Digit") return new ASCII_Hex_Digit();
    if (p == "Other_Alphabetic") return new Other_Alphabetic();
    if (p == "Ideographic") return new Ideographic();
    if (p == "Diacritic") return new Diacritic();
    if (p == "Extender") return new Extender();
    if (p == "Other_Lowercase") return new Other_Lowercase();
    if (p == "Other_Uppercase") return new Other_Uppercase();
    if (p == "Noncharacter_Code_Point") return new Noncharacter_Code_Point();
    if (p == "Other_Grapheme_Extend") return new Other_Grapheme_Extend();
    if (p == "Grapheme_Link") return new Grapheme_Link();
    if (p == "IDS_Binary_Operator") return new IDS_Binary_Operator();
    if (p == "IDS_Trinary_Operator") return new IDS_Trinary_Operator();
    if (p == "Radical") return new Radical();
    if (p == "Unified_Ideograph") return new Unified_Ideograph();
    if (p == "Other_Default_Ignorable_Code_Point") return new Other_Default_Ignorable_Code_Point();
    if (p == "Deprecated") return new Deprecated();
    if (p == "Soft_Dotted") return new Soft_Dotted();
    if (p == "Logical_Order_Exception") return new Logical_Order_Exception();
    if (p == "Other_ID_Start") return new Other_ID_Start();
    // Derived Properties
    if (p == "Math") return new Math();
    if (p == "Alphabetic") return new Alphabetic();
    if (p == "Lowercase") return new Lowercase();
    if (p == "Uppercase") return new Uppercase();
    if (p == "ID_Start") return new ID_Start();
    if (p == "ID_Continue") return new ID_Continue();
    if (p == "XID_Start") return new XID_Start();
    if (p == "XID_Continue") return new XID_Continue();
    if (p == "Default_Ignorable_Code_Point") return new Default_Ignorable_Code_Point();
    if (p == "Grapheme_Extend") return new Grapheme_Extend();
    if (p == "Grapheme_Base") return new Grapheme_Base();
    if (p == "FC_NFKC_Closure") return new FC_NFKC_Closure();
    if (p == "Full_Composition_Exclusion") return new Full_Composition_Exclusion();
    if (p == "NFD_QuickCheck") return new NFD_QuickCheck();
    if (p == "NFC_QuickCheck") return new NFC_QuickCheck();
    if (p == "NFKD_QuickCheck") return new NFKD_QuickCheck();
    if (p == "NFKC_QuickCheck") return new NFKC_QuickCheck();
    if (p == "Expands_On_NFD") return new Expands_On_NFD();
    if (p == "Expands_On_NFC") return new Expands_On_NFC();
    if (p == "Expands_On_NFKD") return new Expands_On_NFKD();
    if (p == "Expands_On_NFKC") return new Expands_On_NFKC();
    // Further Properties
    if (p == "Space") return new Space();
    if (p == "Punctuation") return new Punctuation();
    if (p == "Line_Separator") return new Line_Separator();
    if (p == "Paragraph_Separator") return new Paragraph_Separator();
    if (p == "Currency_Symbol") return new Currency_Symbol();
    if (p == "Bidi_Left_to_Right") return new Bidi_Left_to_Right();
    if (p == "Bidi_European_Digit") return new Bidi_European_Digit();
    if (p == "Bidi_Eur_Num_Separator") return new Bidi_Eur_Num_Separator();
    if (p == "Bidi_Eur_Num_Terminator") return new Bidi_Eur_Num_Terminator();
    if (p == "Bidi_Arabic_Digit") return new Bidi_Arabic_Digit();
    if (p == "Bidi_Common_Separator") return new Bidi_Common_Separator();
    if (p == "Bidi_Block_Separator") return new Bidi_Block_Separator();
    if (p == "Bidi_Segment_Separator") return new Bidi_Segment_Separator();
    if (p == "Bidi_Whitespace") return new Bidi_Whitespace();
    if (p == "Bidi_Non_spacing_Mark") return new Bidi_Non_spacing_Mark();
    if (p == "Bidi_Boundary_Neutral") return new Bidi_Boundary_Neutral();
    if (p == "Bidi_PDF") return new Bidi_PDF();
    if (p == "Bidi_Embedding_or_Override") return new Bidi_Embedding_or_Override();
    if (p == "Bidi_Other_Neutral") return new Bidi_Other_Neutral();
    if (p == "Virama") return new Virama();
    if (p == "Printable") return new Printable();
    if (p == "Titlecase") return new Titlecase();
    if (p == "Private_Use") return new Private_Use();
    return 0;
}

void output_char(std::ostream & out, const Char s)
{
    out.setf(std::ios::uppercase);
    out << std::hex << std::setfill('0');
    if (s.value() <= 0xFFFF)
        out << std::setw(4) << s.value();
    else if (s.value() <= 0xFFFFF)
        out << std::setw(5) << s.value();
    else if (s.value() <= 0xFFFFFF)
        out << std::setw(6) << s.value();
    else if (s.value() <= 0xFFFFFFF)
        out << std::setw(7) << s.value();
    else
        out << std::setw(8) << s.value();
}

int main(int argc, char** argv)
{
    try
    {
	std::string property_str;
	if (argc == 3)
	{
	    Babylon::override_path(std::string(argv[1]));
	    property_str = argv[2];
	}
	else if (argc == 2)
	    property_str = argv[1];
	else
	{
	    std::cerr << "Usage: " << argv[0]
		      << " [module_path] property" << std::endl;
	    exit(1);
	}
	Property * p = get_property(property_str);
	if (!p)
	{
	    std::cout << "Unknown Property!" << std::endl;
	    exit(2);
	}

	Char start(UC_NULL);
	for (Char A(UC_NULL); A.value() < 0x110000; ++A)
	    if (p->get(A))
	    {
		output_char(std::cout, A);
		std::cout << std::endl;
	    }
    }
    catch(std::runtime_error &e)
    {
	std::cout << "Caught an runtime exception: " << e.what()
		  << std::endl;
    }
    catch(std::exception &e)
    {
	std::cout << "Caught an exception: " << e.what()
		  << std::endl;
    }
    catch(...)
    {
	std::cout << "Some exception happened!" << std::endl;
    }
}

--- NEW FILE: dump_ucd.cc ---
/*$Id: dump_ucd.cc,v 1.1 2003/08/01 16:47:09 tobias Exp $
 *
 * This source file is a part of the Fresco Project.
 * Copyright (C) 1999-2003 Tobias Hunger <[email protected]>
 * http://www.fresco.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
 * MA 02139, USA.
 */

#include <Babylon/Babylon.hh>
#include <Prague/Sys/Path.hh>
#include <iostream>
#include <iomanip>

using namespace Babylon;

void output_char(std::ostream & out, Char a)
{
    out.setf(std::ios::uppercase);
    out << std::hex << std::setfill('0');
    if (a.value() <= 0xFFFF)
        out << std::setw(4) << a.value();
    else if (a.value() <= 0xFFFFF)
        out << std::setw(5) << a.value();
    else if (a.value() <= 0xFFFFFF)
        out << std::setw(6) << a.value();
    else if (a.value() <= 0xFFFFFFF)
        out << std::setw(7) << a.value();
    else
        out << std::setw(8) << a.value();
}

Char skip_to(Char a)
{
    if (a.value() >= 0x3400 && a.value() < 0x4DB5)
	return Char(0x4DB5 - 1);
    if (a.value() >= 0x4E00 && a.value() < 0x9FA5)
	return Char(0x9FA5 - 1);
    if (a.value() >= 0xAC00 && a.value() < 0xD7A3)
	return Char(0xD7A3 - 1);
    if (a.value() >= 0xD800 && a.value() < 0xDB7F)
	return Char(0xDB7F - 1);
    if (a.value() >= 0xDB80 && a.value() < 0xDBFF)
	return Char(0xDBFF - 1);
    if (a.value() >= 0xDC00 && a.value() < 0xDFFF)
	return Char(0xDFFF - 1);
    if (a.value() >= 0xE000 && a.value() < 0xF8FF)
	return Char(0xF8FF - 1);
    if (a.value() >= 0x20000 && a.value() < 0x2A6D6)
	return Char(0x2A6D6 - 1);
    if (a.value() >= 0xF0000 && a.value() < 0xFFFFD)
	return Char(0xFFFFD - 1);
    if (a.value() >= 0x100000 && a.value() < 0x10FFFD)
	return Char(0x10FFFD - 1);

    return a;
}


int main(int argc, char** argv)
{
    if (argc == 2) Babylon::override_path(std::string(argv[1]));

    std::cout.setf(std::ios::uppercase);

    for (Char A(UC_NULL); A.value() < 0x110000; ++A)
    {
	try
	{
	    if (!A.is_defined()) continue;

	    // code value
	    output_char(std::cout, A); std::cout << ";";
	    // character name
	    std::cout << ";";

	    // Gen_Cat
	    switch(A.category()) {
	    case CAT_Lu: std::cout << "Lu;"; break;
	    case CAT_Ll: std::cout << "Ll;"; break;
	    case CAT_Lt: std::cout << "Lt;"; break;
	    case CAT_Mn: std::cout << "Mn;"; break;
	    case CAT_Mc: std::cout << "Mc;"; break;
	    case CAT_Me: std::cout << "Me;"; break;
	    case CAT_Nd: std::cout << "Nd;"; break;
	    case CAT_Nl: std::cout << "Nl;"; break;
	    case CAT_No: std::cout << "No;"; break;
	    case CAT_Zs: std::cout << "Zs;"; break;
	    case CAT_Zl: std::cout << "Zl;"; break;
	    case CAT_Zp: std::cout << "Zp;"; break;
	    case CAT_Cc: std::cout << "Cc;"; break;
	    case CAT_Cf: std::cout << "Cf;"; break;
	    case CAT_Cs: std::cout << "Cs;"; break;
	    case CAT_Co: std::cout << "Co;"; break;
	    case CAT_Cn: std::cout << "Cn;"; break;
	    case CAT_Lm: std::cout << "Lm;"; break;
	    case CAT_Lo: std::cout << "Lo;"; break;
	    case CAT_Pc: std::cout << "Pc;"; break;
	    case CAT_Pd: std::cout << "Pd;"; break;
	    case CAT_Ps: std::cout << "Ps;"; break;
	    case CAT_Pe: std::cout << "Pe;"; break;
	    case CAT_Pi: std::cout << "Pi;"; break;
	    case CAT_Pf: std::cout << "Pf;"; break;
	    case CAT_Po: std::cout << "Po;"; break;
	    case CAT_Sm: std::cout << "Sm;"; break;
	    case CAT_Sc: std::cout << "Sc;"; break;
	    case CAT_Sk: std::cout << "Sk;"; break;
	    case CAT_So: std::cout << "So;"; break;
	    default:     std::cout << "UNDEFINED;";
	    }
	    // comp_class
	    std::cout << std::dec << A.comb_class() << ";";
	    // Bidir_Props
	    switch(A.direction()) {
	    case BIDIR_L:   std::cout << "L;"; break;
	    case BIDIR_LRE: std::cout << "LRE;"; break;
	    case BIDIR_LRO: std::cout << "LRO;"; break;
	    case BIDIR_R:   std::cout << "R;"; break;
	    case BIDIR_AL:  std::cout << "AL;"; break;
	    case BIDIR_RLE: std::cout << "RLE;"; break;
	    case BIDIR_RLO: std::cout << "RLO;"; break;
	    case BIDIR_PDF: std::cout << "PDF;"; break;
	    case BIDIR_EN:  std::cout << "EN;"; break;
	    case BIDIR_ES:  std::cout << "ES;"; break;
	    case BIDIR_ET:  std::cout << "ET;"; break;
	    case BIDIR_AN:  std::cout << "AN;"; break;
	    case BIDIR_CS:  std::cout << "CS;"; break;
	    case BIDIR_NSM: std::cout << "NSM;"; break;
	    case BIDIR_BN:  std::cout << "BN;"; break;
	    case BIDIR_B:   std::cout << "B;"; break;
	    case BIDIR_S:   std::cout << "S;"; break;
	    case BIDIR_WS:  std::cout << "WS;"; break;
	    case BIDIR_ON:  std::cout << "ON;"; break;
	    default:        std::cout << "UNDEFINED;";
	    }
	    // Char_Decomp_Type
	    if (A >= 0xAC00 && A <= 0xD7A3)
	    {
		// The values in this area are
		// determined algorithmically
		// and not included in the file
		std::cout << ";";
	    }
	    else
	    {
		bool needSpace = 1;
		switch(A.decomp_type()) {
		case DECOMP_CANONICAL: std::cout << ""; needSpace = 0; break;
		case DECOMP_FONT:      std::cout << "<font>"; break;
		case DECOMP_NOBREAK:   std::cout << "<noBreak>"; break;
		case DECOMP_INITIAL:   std::cout << "<initial>"; break;
		case DECOMP_MEDIAL:    std::cout << "<medial>"; break;
		case DECOMP_FINAL:     std::cout << "<final>"; break;
		case DECOMP_ISOLATED:  std::cout << "<isolated>"; break;
		case DECOMP_CIRCLE:    std::cout << "<circle>"; break;
		case DECOMP_SUPER:     std::cout << "<super>"; break;
		case DECOMP_SUB:       std::cout << "<sub>"; break;
		case DECOMP_VERTICAL:  std::cout << "<vertical>"; break;
		case DECOMP_WIDE:      std::cout << "<wide>"; break;
		case DECOMP_NARROW:    std::cout << "<narrow>"; break;
		case DECOMP_SMALL:     std::cout << "<small>"; break;
		case DECOMP_SQUARE:    std::cout << "<square>"; break;
		case DECOMP_FRACTION:  std::cout << "<fraction>"; break;
		case DECOMP_COMPAT:    std::cout << "<compat>"; break;
		default:               std::cout << "UNDEFINED";
		}
		// Decomp String
		{
		    String us(A.decompose());
		    if (us[0] == A)
                        std::cout << ";";
		    else
		    {
			if (needSpace) std::cout << " ";
			for (unsigned long i = 0; i < us.length(); i++)
			{
			    output_char(std::cout, us[i]);
			    
			    if ( i == ( us.length() - 1 ) )
				std::cout << ";";
			    else
				std::cout << " ";
			}
		    }
		}
	    }
	    // Dec_Digit_Value
	    try
	    {
		std::cout << std::setprecision(6) << std::fixed
			  << float(A.dec_digit_value());
	    }
	    catch (Undefined_Property & p) { }
	    std::cout << ";";
	    // Digit_Value
	    try
	    {
		std::cout << std::setprecision(6) << std::fixed
			  << float(A.digit_value());
	    }
	    catch (Undefined_Property & p) { }
	    std::cout << ";";
	    // Numeric_Value
	    try
	    {
		std::cout << std::setprecision(6) << std::fixed
			  << float(A.numeric_value());
	    }
	    catch (Undefined_Property & p) { }
	    std::cout << ";";
	    // Is_Mirrored
	    if (A.must_mirror()) std::cout << "Y;";
	    else std::cout << "N;";
	    // Comment and Unicode 1.0 name
	    std::cout << ";;";
	    
	    // Uppercase
	    if (A.uppercase() != A)
		output_char(std::cout, A.uppercase());
	    std::cout << ";";
	    // Lowercase
	    if (A.lowercase() != A)
		output_char(std::cout, A.lowercase());
	    std::cout << ";";
	    // Titlecase
	    if (A.titlecase() != A)
		output_char(std::cout, A.titlecase());
	    
	    std::cout << std::endl;
	    A = skip_to(A);
	}
	catch(std::runtime_error &e)
	{
	    std::cout << "Caught an runtime exception: " << e.what()
		      << std::endl;
	}
	catch(std::exception &e)
	{
	    std::cout << "Caught an exception: " << e.what()
		      << std::endl;
	}
	catch(...)
	{
	    std::cout << "Some exception happened!" << std::endl;
	}
    }
	
    return 0;
}

--- NEW FILE: normalize.cc ---
/*$Id: normalize.cc,v 1.1 2003/08/01 16:47:09 tobias Exp $
 *
 * This source file is a part of the Fresco Project.
 * Copyright (C) 1999-2003 Tobias Hunger <[email protected]>
 * http://www.fresco.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
 * MA 02139, USA.
 */

#include <Babylon/String.hh>
#include <iostream>
#include <iomanip>
#include <sstream>

using namespace Babylon;

void output_char(std::ostream & out, Char a)
{
    out.setf(std::ios::uppercase);
    out << std::hex << std::setfill('0');
    if (a.value() <= 0xFFFF)
        out << std::setw(4) << a.value();
    else if (a.value() <= 0xFFFFF)
        out << std::setw(5) << a.value();
    else if (a.value() <= 0xFFFFFF)
        out << std::setw(6) << a.value();
    else if (a.value() <= 0xFFFFFFF)
        out << std::setw(7) << a.value();
    else
        out << std::setw(8) << a.value();
}

int dump_norms(const String & s)
{
    for (String::const_iterator i = s.begin(); i != s.end(); ++i)
    {
	if (i != s.begin()) std::cout << " ";
	output_char(std::cout, *i);
    }
    std::cout << ";";

    String t;

    t = s.get_normalized(NORM_C);
    for (String::const_iterator i = t.begin(); i != t.end(); ++i)
    {
	if (i != t.begin()) std::cout << " ";
	output_char(std::cout, *i);
    }
    std::cout << ";";

    t = s.get_normalized(NORM_D);
    for (String::const_iterator i = t.begin(); i != t.end(); ++i)
    {
	if (i != t.begin()) std::cout << " ";
	output_char(std::cout, *i);
    }
    std::cout << ";";

    t = s.get_normalized(NORM_KC);
    for (String::const_iterator i = t.begin(); i != t.end(); ++i)
    {
	if (i != t.begin()) std::cout << " ";
	output_char(std::cout, *i);
    }
    std::cout << ";";

    t = s.get_normalized(NORM_KD);

    for (String::const_iterator i = t.begin(); i != t.end(); ++i)
    {
	if (i != t.begin()) std::cout << " ";
	output_char(std::cout, *i);
    }
    std::cout << ";" << std::endl << std::flush;
}

int main(int argc, char** argv)
{
    std::string in;
    {
	if (argc == 1)
	{
	    std::cout << "usage : " << argv[0]
		      << " norm-string-in-hex [override path]" << std::endl;
	    std::cout << "- or -: " << argv[0]
		      << " interactive [override-path]" << std::endl;
	    exit(1);
	}
	if (argc >= 2)
	    in = argv[1];
	if (argc == 3)
	    Babylon::override_path(std::string(argv[2]));
    }

    if ("interactive" == in)
    {
	while ("quit" != in)
	{
	    if ("interactive" != in)
	    {
		String s;
		Norm n;
		if (('A' >= in[0] && 'F' <= in[0]) ||
		    ('0' >= in[0] && '9' <= in[0]))
		    n = NORM_NONE;
		else if ('n' == in [0])
		{
		    n = NORM_NONE;
		    in.erase(0, 1);
		}
		else if ('k' == in[0])
		{
		    n = Norm(n | NORM_MASK_K);
		    in.erase(0, 1);
		}
		if ('c' == in[0])
		{
		    n = Norm(n | NORM_MASK_C);
		    in.erase(0, 1);
		}
		else if ('d' == in[0])
		    in.erase(0, 1);

		std::istringstream stream(in);
		UCS4 c;
		
		while (stream >> std::hex >> c) s.push_back(Char(c));
		s.override_norm(n);

		dump_norms(s);
	    }
	    char chars[1024];
	    std::cin.getline(chars, sizeof(chars));
	    chars[1023] = '\0';
	    in.assign(chars);
	}
    }
    else
    {
	String s;
	std::istringstream stream(in);
	UCS4 c;
	
	while (stream >> std::hex >> c) s.push_back(Char(c));

	dump_norms(s);
    }

    return 0;
}