Index: trunk/Eval/COS/README
===================================================================
--- trunk/Eval/COS/README	(revision 989)
+++ trunk/Eval/COS/README	(revision 989)
@@ -0,0 +1,4 @@
+ ------ Programmes pour tester differents aspects des OS/compilateurs ----
+1/ ttsz.cc : Taille des entiers et byte-swap
+2/ lance.cc .h : Gestion des exceptions
+3/ consopeg.cc : Appel des constructeurs et operateurs egal
Index: trunk/Eval/COS/consopeg.cc
===================================================================
--- trunk/Eval/COS/consopeg.cc	(revision 989)
+++ trunk/Eval/COS/consopeg.cc	(revision 989)
@@ -0,0 +1,178 @@
+#include<stdlib.h>
+#include<stdio.h>
+#include<string.h>
+
+/*   Tout est public dans cette classe   */
+
+class BToto
+{
+public:
+static int nb;
+static int cons, dest, conscpy, opeg;
+
+  static void InfoCons();
+
+  float px,py;
+  int id;
+
+  BToto(int oid=0, float x=1., float y=2.);
+  BToto(BToto const & bt);
+ ~BToto(void);
+  
+
+/*  Les methodes virtuelles sont la pour pouvoir etre utilisees  */
+/*  par les classes derivees de celle la par defaut.             */
+  void Set(float a=0., float b=0.);
+  BToto& operator=(const BToto& bt);
+  virtual  BToto Scale(float sc);
+  virtual  int  GetId() { return id; } ; 
+  virtual  void Display();
+  virtual  char * ClassNom() { return "BToto"; } ;
+
+};
+
+int BToto::nb = 0;
+int BToto::cons = 0;
+int BToto::dest = 0;
+int BToto::conscpy = 0;
+int BToto::opeg = 0;
+
+void BToto::InfoCons()
+{
+  printf("BToto::InfoCons() NbConsCall= %d  NbCopyConsCall= %d NbDestCall= %d NbOpegal=%d \n", cons, conscpy, dest, opeg);
+}
+
+BToto::BToto(int oid, float x, float y)
+{
+  cons++;
+nb += 10;
+ if (oid == 0) oid = nb;
+printf("BToto::BToto(int oid) : %d -Pointer= %lx\n", oid,(long)this);
+px = x; py = y;
+id = oid;
+}
+
+BToto::BToto(BToto const & b)
+{
+  conscpy++;
+printf("BToto::BToto(BToto const & : %d -Pointer= %lx ) Pointer= %lx\n", 
+       b.id,(long)(&b),(long)this);
+id = b.id;
+px = b.px;
+py = b.py;
+} 
+
+BToto::~BToto(void)
+{
+  dest++;
+printf("BToto::~BToto: %d \n", id);
+return;
+}
+
+void BToto::Set(float a, float b)
+{
+px = a;  py = b;
+return;
+}
+
+BToto BToto::Scale(float sc)
+{
+printf("BToto::Scale : %d -Pointer= %lx\n", id,(long)this);
+  
+ BToto ret(*this);
+  ret.px *= sc;
+  ret.py *= sc;
+  return(ret);
+}
+
+BToto& BToto::operator=(const BToto& b)
+{
+  opeg++;
+printf("BToto::Operateur= (BToto const & : %d -Pointer= %lx ) Pointer= %lx\n", 
+       b.id,(long)(&b),(long)this);
+id = b.id;
+px = b.px;
+py = b.py;
+return(*this);
+}
+
+
+void BToto::Display()
+{
+printf("BToto::Display()  %g %g (Id= %d) Point=%lx\n", px, py, id,(long)this);
+return;
+}
+
+
+class PointBToto
+{
+public:
+static int num;
+  PointBToto();
+  virtual ~PointBToto();
+  operator BToto ();
+
+    BToto * bt;
+};
+
+
+int PointBToto::num = 0;
+PointBToto::PointBToto()
+{
+  num++;
+  bt = new BToto(10000*num, num*3., num*6.);
+}
+
+PointBToto::~PointBToto()
+{
+  delete bt;
+}
+
+PointBToto::operator BToto ()
+{
+  printf("PointBToto::operator BToto %d \n", bt->GetId());
+  return(*bt);
+}
+
+void test_cons();
+
+main(int narg, char *arg[])
+{
+  printf(" ---- Programme test constructeur et operateur egal ----- \n");
+  test_cons();
+  printf("> BToto::InfoCons() \n");
+  BToto::InfoCons();
+}
+
+void test_cons()
+{
+  printf("> BToto b1; b1.Display(); \n");
+  BToto b1;
+  b1.Display();
+  printf("> BToto b2(344, 5, 15.); b2.Display(); b1 = b2; b1.Display(); \n");
+  BToto b2(344, 5, 15.);
+  b2.Display();
+  b1 = b2;
+  b1.Display();
+  printf("> BToto b3(666, 8., 16.); BToto b4 = b3.Scale(2.); b4.Display(); \n");
+  BToto b3(666, 8., 16.);
+  BToto b4 = b3.Scale(2.);
+  b4.Display();
+  printf("> BToto b5(788, 10., 20.); BToto b6; b6 = b5.Scale(3.); b6.Display(); \n");
+  BToto b5(788, 10., 20.);
+  BToto b6;
+  b6 = b5.Scale(3.);
+  b6.Display();
+  printf("> PointBToto pb1;  ((BToto)pb1).Display(); \n");
+  PointBToto pb1; 
+  ((BToto)pb1).Display();
+  printf("> PointBToto pb2;  BToto bb1 = pb1;  bb1.Display(); \n");
+  PointBToto pb2;
+  BToto bb1 = pb1; 
+  bb1.Display();
+}
+
+
+
+
+
Index: trunk/Eval/COS/lance.cc
===================================================================
--- trunk/Eval/COS/lance.cc	(revision 989)
+++ trunk/Eval/COS/lance.cc	(revision 989)
@@ -0,0 +1,108 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "lance.h"
+
+
+
+Toto::Toto(int n)
+{
+  if (n < 1)  throw(myException(ExcLongMessage("Toto::Toto() Size<1")) );
+  size = n;
+  data = new double[n];
+  for(int k=0; k<n; k++) data[k] = k;
+}
+
+Toto::~Toto()
+{
+  delete[] data;
+}
+
+
+int lance(int a, long sz);
+int main(int narg, char *arg[])
+{
+  if (narg < 3) {
+    cout << " Usage: lance 0/1/2/3/5 size \n" 
+	 << "  0: Rien, 1: throw myException, 2: throw int \n" 
+	 << "  3: throw exception 4: new double[size] " 
+	 << "  5: class toto+acces aux elts"  << endl;
+    return(0);
+  }
+
+  int rc,a;
+  long sz;
+  a = atoi(arg[1]);
+  sz = atoi(arg[2]);
+  cout << "\n ---- Lance , test exeception, a=" << a << " Sz=" << sz << endl; 
+  try {
+    rc = lance(a, sz);
+    cout << " Return Code from lance= " << rc << endl;
+  }
+  catch(myException exc){
+    cerr << " Catched myException : msg= " << exc.Msg() << endl;
+    rc = 77;
+  }
+  catch (int ie) {
+    cerr << "  Catched exception - integer= " << ie << endl;
+    rc = 78;
+  }
+  catch(exception exc){
+  // Classe de base des exception standard - 
+  // La methode what() n'est pas forcement conforme a la norme 
+    string msg = exc.what();
+    cerr << " Catched exception : msg= " << msg << endl;
+    rc = 98;
+  }
+  catch (...) {
+    cerr << " Catched Unknown exception ! " << endl;
+    rc = 99;
+  }
+
+  cout << " ------ Exiting from lance ----------------- \n" << endl;
+  exit(rc);
+}
+
+
+int lance(int a, long sz)
+{
+  int rc = 0;
+  char buff[128];
+  double *d;
+  switch(a){
+  case 0:
+    cout << " lance-0 / OK " << endl;
+    break;
+  case 1:
+    cout << " lance-1 / throw myException " << endl;
+    sprintf(buff,"lance() - File=%s Line=%d",__FILE__,__LINE__);
+    throw myException(buff);
+    break;
+  case 2:
+    cout << " lance-2 / throw integer 2001 " << endl;
+    rc = 2001;
+    throw rc;
+    break;
+  case 3:
+    cout << " lance-3 / throw execption " << endl;
+    throw exception();
+    break;
+  case 4:
+    cout << " lance-4 / new double[ " << sz << " ]" << endl;
+    d = new double[sz];
+    rc = 4;
+    break;
+  case 5:
+    {
+    cout << " lance-5 / Toto( " << sz << " )" << endl;
+    Toto t(sz);
+    double s=0.;
+    for(int kk=0; kk<=sz; kk++)   s+= t.Value(kk);
+    cout << " Somme= " << s << endl;
+    }
+  default:
+    rc = 9;
+    break;
+  }
+  return(rc);
+}
Index: trunk/Eval/COS/lance.h
===================================================================
--- trunk/Eval/COS/lance.h	(revision 989)
+++ trunk/Eval/COS/lance.h	(revision 989)
@@ -0,0 +1,39 @@
+#include <iostream.h>
+#include <exception>
+#include <string>
+
+#define ExcLongMessage(a) BuildFLExcMsg(a,__FILE__,__LINE__)
+
+inline string BuildFLExcMsg(const char * s, const char *file, int line)
+{
+  char buff[32];
+  sprintf(buff," Line=%d", line);
+  string rs=s;
+  rs += " File="; rs += file; rs += buff;
+  return(rs);
+}
+
+class myException  {
+public:
+  myException(const char * s) {_msg= s;}
+  myException(string const & s) {_msg =s; }
+  //  ~myExecption() {}
+  string Msg() { return _msg; }
+private:
+  string _msg;
+};
+
+
+class Toto {
+public:
+  Toto(int n);
+  virtual ~Toto();
+  inline double Value(int k)
+    { if ((k<0) || (k>=size) ) 
+      throw( myException(ExcLongMessage("Toto::Value()-OutOfBound")) ) ;
+    else return(data[k]);
+    }
+protected:
+  int size;
+  double * data;  
+};
Index: trunk/Eval/COS/ttsz.c
===================================================================
--- trunk/Eval/COS/ttsz.c	(revision 989)
+++ trunk/Eval/COS/ttsz.c	(revision 989)
@@ -0,0 +1,28 @@
+#include <stdio.h>
+
+/*  programme pour imprimer les tailles des types et le 
+    byte-swap                                            */
+
+main(int narg, char* arg)
+{
+int i,k;
+char* pc;
+
+printf(" Sizeof short int = %d \n", (int)(sizeof(short int)));
+printf(" Sizeof int = %d \n", (int)(sizeof(int)));
+printf(" Sizeof long = %d \n", (int)(sizeof(long)));
+printf(" Sizeof long long = %d \n", (int)(sizeof(long long)));
+printf(" Sizeof float = %d \n", (int)(sizeof(float)));
+printf(" Sizeof double = %d \n", (int)(sizeof(double)));
+printf(" Sizeof long double = %d \n", (int)(sizeof(long double)));
+
+
+i = 65;
+pc = (char *)(&i);
+for(k=0; k<4; k++)  { printf("I=%d  B%d = %d \n", i, k, (int)(*pc)); pc++; }
+i = 65*65536+16;
+pc = (char *)(&i);
+for(k=0; k<4; k++)  { printf("I=%d  B%d = %d \n", i, k, (int)(*pc)); pc++; }
+
+exit(0);
+}
