#!/usr/bin/perl -w
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
#NAME
#  ch_syllables - Print Mandarin Chinese syllables
#
#SYNOPSIS
#  ch_syllables [file]..
#
#REQUIRES
#
#DESCRIPTION
#  This is a dumb little program that just outputs possible Mandarin Chinese
#  syllables. It's the bare beginning of a couple of other programs.
#
#OPTIONS
#
#EXAMPLES
#
#FILES
#
#BUGS
#
#SEE ALSO
#
#AUTHOR
#  John Chambers <jc@trillian.mit.edu>
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #

$| = 1;
$exitstat = 0;
($P = $0) =~ s".*/"";
$V = $ENV{"V_$P"} || $ENV{"D_$P"} || 2;	# Verbose level.

@I = (  # Initial consonant
    '',
    'b',
    'c',
    'ch',
    'd',
    'f',
    'g',
    'h',
    'j',
    'k',
    'l',
    'm',
    'n',
    'p',
    'q',
    'r',
    's',
    'sh',
    't',
    'w',
    'x',
    'y',
    'z',
    'zh',
);

@V = (  # Vowel(s)
    'a',
    'ao',
    'ai',
    'e',
    'ei',
    'i',
    'ia',
    'iao',
    'ie',
    'io',
    'iu',
    'o',
    'ou',
    'u',
    'ua',
    'uai',
    'ue',
    'ui',
    'uo',
    'ü',
    'üa',
    'üe',
);

@F = (  # Final consonant
    '',
    'n',
    'ng',
    'r',
);

@T = (  # Tone
#   '',
    '1',
    '2',
    '3',
    '4',
);

for $i (@I) {
    for $v (@V) {
        for $f (@F) {
            for $t (@T) {
                print "$i$v$f$t\n";
            }
        }
    }
}

print "$P: Exit with status $exitstat.\n" if $V>1;
exit $exitstat;

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
