summaryrefslogtreecommitdiff
path: root/2003/i/buzz/src/busp/test_busp.cc
diff options
context:
space:
mode:
Diffstat (limited to '2003/i/buzz/src/busp/test_busp.cc')
-rw-r--r--2003/i/buzz/src/busp/test_busp.cc45
1 files changed, 27 insertions, 18 deletions
diff --git a/2003/i/buzz/src/busp/test_busp.cc b/2003/i/buzz/src/busp/test_busp.cc
index ef15858..81bc21a 100644
--- a/2003/i/buzz/src/busp/test_busp.cc
+++ b/2003/i/buzz/src/busp/test_busp.cc
@@ -3,6 +3,7 @@
// Copyright (C) 2003 Nicolas Schodet
//
#include "busp.h"
+#include "erreur/erreur.h"
#include <iostream>
#include <cstdlib>
@@ -10,25 +11,33 @@
int
main (int argc, char **argv)
{
- Busp busp;
- int addr, data;
- switch (argc)
+ try
{
- case 3:
- // Ecriture.
- addr = strtol (argv[1], 0, 0);
- data = strtol (argv[2], 0, 0);
- cout << "write " << addr << " " << data << endl;
- busp.write (addr, data);
- break;
- case 2:
- // Lecture.
- addr = strtol (argv[1], 0, 0);
- cout << "read " << addr << " = " << busp.read (addr) << endl;
- break;
- default:
- cerr << argv[0] << ": teste le bus parallèle." << endl
- << "\t" << argv[0] << " adresse [donnée]" << endl;
+ Busp busp;
+ int addr, data;
+ switch (argc)
+ {
+ case 3:
+ // Ecriture.
+ addr = strtol (argv[1], 0, 0);
+ data = strtol (argv[2], 0, 0);
+ cout << "write " << addr << " " << data << endl;
+ busp.write (addr, data);
+ break;
+ case 2:
+ // Lecture.
+ addr = strtol (argv[1], 0, 0);
+ cout << "read " << addr << " = " << busp.read (addr) << endl;
+ break;
+ default:
+ cerr << argv[0] << ": teste le bus parallèle." << endl
+ << "\t" << argv[0] << " adresse [donnée]" << endl;
+ return 1;
+ }
+ }
+ catch (const std::exception &e)
+ {
+ cerr << e.what ();
return 1;
}
return 0;