Textantrieb | UText/1 | UText/1.2 Manual

UText Installation

License

Universal-Text Interpreter. Copyright © 2004-2022 Francesc Hervada-Sala. All rights reserved. This programm is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Files

Last version (May 22nd, 2022): UText v. 1.2.31

A zip file for Unix or Windows may be requested from the author.

The files for Windows are the same, the difference being only in line breaks.

Requirements

This software requires Perl 5.8.8 or above. Any standard installation already contains the required modules. (Modules: showhide URI::URL, Tie::File, File::Temp, POSIX, Time::Local, File::Spec, File::Basename, Cwd; in the UText Shell also Term::ReadLine)

Optional modules:

1. OpenDocument Format

The Perl module OpenOffice::OODoc is required by the optional add-in module odt, which reads word processor files in OpenDocument Format. It is not required if you do not load this add-in.

2. ReadLine

The UText Shell uses the Perl module Term::ReadLine that is part of the core Perl installation. If you want to get command history functionality in the UText Shell, you must have one of the various optional readline Perl packages installed, for example Term::ReadLine::Gnu. For installation instructions check your operating system distribution. Installing from CPAN can be done this way:

perl -MCPAN -e shell
install Term::ReadLine::Gnu

See CPAN for more information.

Install Steps

Download the installation .zip file and extract it.

unzip utext-1.2.zip

Move the extracted folder UText to your Perl library folder. Example in Linux:

sudo cp UText/ /usr/share/perl5/vendor_perl/

You might want to put either the above folder in PATH or set a symbolic link to the UText shell.

ln -s /usr/share/perl5/vendor_perl/UText/utshell.pl ut

The following was installed:

1. The UText shell utshell.pl for interactive sessions.

2. A Perl class UText that ist available in Perl scripts.

3. A directory samples with some UText and Perl scripts.

Sample Shell usage

The code entered by the user is preceded by the UText Shell prompt ut> (or, for multiple line inputs, by ut>...), the rest is output by UText.

First sample. A unit named a with type string is defined and three times instantiated, each with a particular string instance. Then all instances of this type are queried.

$ ut
Universal-Text Interpreter v1.2.24; +http://textantrieb.de
(c) 2004-2021 Francesc Hervada-Sala
Welcome to the UText Shell. Enter '.' to quit, 'help' for usage.
ut> feed begin
ut...> ^a :string
ut...> ~a "one"
ut...> ~a "two"
ut...> ~a "three"
ut...> end
ut> select a
~a "one"
~a "two"
~a "three"
ut> .
$

Second sample. A file in Universal-Text Language (UTL) is read, which defines a unit family and contains data about some particular families. Then a query is run that returns all defined families sorted by family name and prints for each of them the family name at a separate line. After that the results of the query are saved as a file named families.txt, the UText shell is exited and after returning to the operating system shell the content of the created file is shown.

~$ cd samples
~$ /usr/share/perl5/vendor_perl/UText/utshell.pl
Universal-Text Interpreter v1.2.24; +http://textantrieb.de
(c) 2004-2021 Francesc Hervada-Sala
Welcome to the UText Shell. Enter '.' to quit, 'help' for usage.
ut> read geneaweb.utl
ut> select <family do ln v name
Clark
Smith
Smith
Smithereen
Smithers
ut> save families.txt
Creating file families.txt
ut> .
~$ cat families.txt
Clark
Smith
Smith
Smithereen
Smithers

Sample Perl usage

Apart from the shell, the Universal-Text Interpreter can be used also directly in Perl scripts.

Something similar to the above first shell sample could be done this way in Perl:

#!/usr/bin/perl
use UText::UText;
$ut = new UText;
$ut->read(<<'END');
^a :string
~a "one"
~a "two"
~a "three"
END
$ut->foreach('a', sub { print '>',$ut->getVar(),"<\n"; });
$ut=undef;

And the query of the above second sample can be done this way:

use UText::UText;
$ut=new UText;
$ut->readfile('geneaweb.utl');
print $ut->foreach('<family','[v name][lf]');
$ut=undef;

There are some UText Shell and Perl script examples at the directory samples included in the distribution .zip file.