From 535f0402adcb3ac3102725c4828f56819241fca7 Mon Sep 17 00:00:00 2001
From: bothorel
Date: Mon, 16 Dec 2002 17:22:00 +0000
Subject: Initial revision
---
data/transduct_exemple.xml | 25 +++++++
debian/README.debian | 6 ++
debian/changelog | 0
debian/control | 10 +++
debian/copyright | 8 ++
debian/dirs | 1 +
debian/files | 1 +
debian/rules | 53 ++++++++++++++
src/transduct | 177 +++++++++++++++++++++++++++++++++++++++++++++
9 files changed, 281 insertions(+)
create mode 100644 data/transduct_exemple.xml
create mode 100644 debian/README.debian
create mode 100644 debian/changelog
create mode 100644 debian/control
create mode 100644 debian/copyright
create mode 100644 debian/dirs
create mode 100644 debian/files
create mode 100755 debian/rules
create mode 100755 src/transduct
diff --git a/data/transduct_exemple.xml b/data/transduct_exemple.xml
new file mode 100644
index 0000000..a63aa31
--- /dev/null
+++ b/data/transduct_exemple.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/debian/README.debian b/debian/README.debian
new file mode 100644
index 0000000..ba64366
--- /dev/null
+++ b/debian/README.debian
@@ -0,0 +1,6 @@
+voiceplugin for DEBIAN
+----------------------
+
+Comments regarding the Package
+
+Gwenael Bothorel , Fri, 23 Apr 1999 16:25:58 +0200
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..e69de29
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..425ef19
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,10 @@
+Source: transduct
+Section: toccata
+Priority: extra
+Maintainer: Gwenael Bothorel
+Standards-Version: 0.0.0.0
+
+Package: transduct
+Architecture: all
+Depends:
+Description: transduct, a transductor for Ivy messages
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..ae67089
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,8 @@
+This package was debianized by Gwenael Bothorel bothorel@cena.fr on
+Fri, 23 Apr 1999 16:25:58 +0200.
+
+It was downloaded from
+
+Copyright:
+
+C.E.N.A (Centre d'Etudes de la Navigation Aérienne)
diff --git a/debian/dirs b/debian/dirs
new file mode 100644
index 0000000..e772481
--- /dev/null
+++ b/debian/dirs
@@ -0,0 +1 @@
+usr/bin
diff --git a/debian/files b/debian/files
new file mode 100644
index 0000000..ee6fda0
--- /dev/null
+++ b/debian/files
@@ -0,0 +1 @@
+transduct_0.0.0_all.deb toccata extra
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..88c103f
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,53 @@
+#!/usr/bin/make -f
+# Made with the aid of debmake, by Christoph Lameter,
+# based on the sample debian/rules file for GNU hello by Ian Jackson.
+
+package=transduct
+
+build:
+ $(checkdir)
+ touch build
+
+clean:
+ $(checkdir)
+ -rm -f build
+ -rm -f `find . -name "*~"`
+ -rm -rf debian/tmp debian/files* core debian/substvars
+
+binary-indep: checkroot build
+ $(checkdir)
+# There are no architecture-independent files to be uploaded
+# generated by this package. If there were any they would be
+# made here.
+
+binary-arch: checkroot build
+ $(checkdir)
+ -rm -rf debian/tmp
+ install -d debian/tmp
+ cd debian/tmp && install -d `cat ../dirs`
+ install -d debian/tmp/usr/lib/$(package)
+ install -m755 src/transduct debian/tmp/usr/bin/$(package)
+ install -m644 src/*.pm data/*.gif debian/tmp/usr/lib/$(package)
+ install -d debian/tmp/usr/share/man/man1
+ pod2man src/$(package) > debian/tmp/usr/share/man/man1/$(package).1
+# Must have debmake installed for this to work. Otherwise please copy
+# /usr/bin/debstd into the debian directory and change debstd to debian/debstd
+ debstd -c -d
+ dpkg-gencontrol
+ chown -R root.root debian/tmp
+ chmod -R go=rX debian/tmp
+ dpkg --build debian/tmp ..
+
+define checkdir
+ test -f debian/rules
+endef
+
+# Below here is fairly generic really
+
+binary: binary-indep binary-arch
+
+checkroot:
+ $(checkdir)
+ test root = "`whoami`"
+
+.PHONY: binary binary-arch binary-indep clean checkroot
diff --git a/src/transduct b/src/transduct
new file mode 100755
index 0000000..38561ae
--- /dev/null
+++ b/src/transduct
@@ -0,0 +1,177 @@
+#!/usr/bin/perl -w
+#
+# transduct, an Ivy transductor
+#
+# Copyright (C) 2002
+# Centre d'Études de la Navigation Aérienne
+#
+# Main
+#
+# Authors: Gwenael Bothorel
+#
+# $Id$
+#
+
+use Ivy;
+use strict;
+use Getopt::Long;
+use XML::Parser;
+require File::Basename;
+
+my $bus = ":2010";
+my $verbose = undef;
+my $filename = undef;
+my $help = undef;
+my $app_name = "TRANSDUCT";
+my $num_message = 0;
+my @outputs;
+my @outputtoggles;
+my $max_nb_parameters = 10;
+my %toggled_message;
+my $output_type = undef;
+
+my %options = ('bus=s', \$bus,
+ 'verbose', \$verbose,
+ 'file=s', \$filename,
+ 'help', \$help);
+GetOptions (%options);
+
+if ($help) {
+ Usage ();
+ exit;
+}
+
+if (! $filename) {
+ print "Transductor file is mandatory\n";
+ Usage (),
+ exit;
+}
+
+# Niveau de verbosité :
+# 0 : très verbeux
+# 1 : moins verbeux
+#
+if (defined $verbose) {
+ $verbose = 0;
+ Verbose (__LINE__, 0, "Verbose=yes");
+} else {
+ $verbose = 1;
+ Verbose (__LINE__, 0, "Verbose=no");
+}
+
+Ivy->init (-loopMode => 'LOCAL', -appName => $app_name, -ivyBus => $bus);
+my $ivy = Ivy->new (-ivyBus => $bus, -appName => $app_name);
+$ivy->start;
+
+my $p = XML::Parser->new(Style => 'Subs');
+$p->parsefile ($filename);
+
+$ivy->mainLoop;
+
+###############################################################################
+
+sub Verbose {
+ my ($line, $value, $msg) = @_;
+
+ if ($value >= $verbose) {
+ my $FILE = File::Basename::basename (__FILE__);
+ print "$FILE:$line: $msg\n";
+ }
+}
+
+sub Usage {
+ print "Usage : transduct --file transductor_file [--bus my_bus] [--verbose] [--help]\n";
+ print "Options :\n";
+ print " --file : transductor file\n";
+ print " --bus : Ivy bus\n";
+ print " --verbose : verbose mode\n";
+ print " --help : help\n";
+}
+
+sub message {
+ $num_message++;
+ Verbose (__LINE__, 0, "A new message");
+}
+
+sub input {
+ Verbose (__LINE__, 0, "A new input");
+ my ($parser, $elementname, %attrs) = @_;
+ (my $name) = $attrs{name};
+ Verbose (__LINE__, 0, "input <$name>");
+ $ivy->bindRegexp ("$name", [\&CB_Callback, $num_message]);
+ if ($attrs{type}) {
+ my $type = $attrs{type};
+ if ($type eq "toggle") {
+ $toggled_message{$num_message} = 0;
+ }
+ }
+}
+
+sub output {
+ Verbose (__LINE__, 0, "A new output");
+ $output_type="normal";
+}
+
+sub outputtoggle {
+ Verbose (__LINE__, 0, "A new outputtoggle");
+ $output_type="toggled";
+}
+
+sub item {
+ Verbose (__LINE__, 0, "A new item");
+ my ($parser, $elementname, %attrs) = @_;
+ (my $msg) = $attrs{msg};
+ Verbose (__LINE__, 0, "output item <$msg>");
+
+ if($output_type eq "normal") {
+ if (! $outputs[$num_message]) {
+ $outputs[$num_message] = $msg;
+ } else {
+ $outputs[$num_message] .= " , $msg";
+ }
+ } else {
+ if (! $outputtoggles[$num_message]) {
+ $outputtoggles[$num_message] = $msg;
+ } else {
+ $outputtoggles[$num_message] .= " , $msg";
+ }
+ }
+}
+
+sub CB_Callback {
+ my ($who, $num, @tab) = @_;
+ my $toggled = undef;
+ Verbose (__LINE__, 0, "Message num = $num");
+# for (my $i = 0; $i < $max_nb_parameters; $i++) {
+# if ($tab[$i]) {
+# print " <$tab[$i]>";
+# }
+# }
+# print "\n";
+
+ if (defined $toggled_message{$num}) {
+ if ($toggled_message{$num} == 0) {
+ Verbose (__LINE__, 0, "The toggle button was off");
+ $toggled_message{$num} = 1;
+ } else {
+ Verbose (__LINE__, 0, "The toggle button was on");
+ $toggled_message{$num} = 0;
+ my @tab_msgs = split (/ , /, $outputtoggles[$num]);
+ foreach my $item (@tab_msgs) {
+ for (my $i = 0; $i < $max_nb_parameters; $i++) {
+ $item =~ s/\$$i/$tab[$i-1]/;
+ }
+ $ivy->sendMsgs ($item);
+ }
+ return;
+ }
+ }
+
+ my @tab_msgs = split (/ , /, $outputs[$num]);
+ foreach my $item (@tab_msgs) {
+ for (my $i = 0; $i < $max_nb_parameters; $i++) {
+ $item =~ s/\$$i/$tab[$i-1]/;
+ }
+ $ivy->sendMsgs ($item);
+ }
+}
--
cgit v1.1