From 08f8c6f578b885f2b98b3d096ee28f7f845acf07 Mon Sep 17 00:00:00 2001 From: Vieira Date: Mon, 7 Feb 2022 10:53:37 +0100 Subject: [PATCH] Java --- APL1.1/CM2/semaine.c | 3 - APL1.1/vieirae_CM2.tar.gz | Bin 0 -> 1164 bytes APL1.2/SCR1.2/TP11/get_numb | Bin 0 -> 16560 bytes APL1.2/SCR1.2/TP11/get_numb.c | 62 +++--- APL1.2/SCR1.2/TP11/number.dat | Bin 0 -> 688 bytes APL1.2/SCR1.2/TP11/number.dat* | 0 APL1.2/SCR1.2/TP11/numbers.dat | 0 APL1.2/SCR1.2/TP11/numbers.txt | 13 +- APL1.2/SCR1.2/TP11/put_numb | Bin 0 -> 16544 bytes APL1.2/SCR1.2/TP11/put_numb.c | 46 ++-- APL1.2/SCR1.2/TP11/store_nb_rep | Bin 0 -> 16536 bytes APL1.2/SCR1.2/TP11/store_nb_rep.c | 32 +++ APL1.2/SCR1.2/TP12/de commandes avec sed : | 237 +++++++++++++++++++++ APL1.2/SCR1.2/TP12/regexp | Bin 0 -> 16480 bytes APL1.2/SCR1.2/TP12/regexp.c | 35 +++ APL1.2/SCR1.2/TP12/td7.txt | 21 ++ APL1.2/SCR1.2/TP12/tp12.txt | 3 + APL2.1/TP1/Arguments.java | 7 + APL2.1/TP1/Demarrage.java | 20 ++ APL2.1/TP1/Somme.java | 9 + APL2.1/TP1/Tri.java | 14 ++ APL2.1/TP1/grille.java | 22 ++ APL2.1/TP2/Boutons.class | Bin 0 -> 830 bytes APL2.1/TP2/Boutons.java | 21 ++ APL2.1/TP2/Saisie.class | Bin 0 -> 889 bytes APL2.1/TP2/Saisie.java | 21 ++ APL2.1/TP2/Sirocco.class | Bin 0 -> 662 bytes APL2.1/TP2/Sirocco.java | 14 ++ 28 files changed, 513 insertions(+), 67 deletions(-) create mode 100644 APL1.1/vieirae_CM2.tar.gz create mode 100755 APL1.2/SCR1.2/TP11/get_numb create mode 100644 APL1.2/SCR1.2/TP11/number.dat create mode 100644 APL1.2/SCR1.2/TP11/number.dat* create mode 100644 APL1.2/SCR1.2/TP11/numbers.dat create mode 100755 APL1.2/SCR1.2/TP11/put_numb create mode 100755 APL1.2/SCR1.2/TP11/store_nb_rep create mode 100644 APL1.2/SCR1.2/TP11/store_nb_rep.c create mode 100644 APL1.2/SCR1.2/TP12/de commandes avec sed : create mode 100755 APL1.2/SCR1.2/TP12/regexp create mode 100644 APL1.2/SCR1.2/TP12/regexp.c create mode 100644 APL1.2/SCR1.2/TP12/td7.txt create mode 100644 APL1.2/SCR1.2/TP12/tp12.txt create mode 100644 APL2.1/TP1/Arguments.java create mode 100644 APL2.1/TP1/Demarrage.java create mode 100644 APL2.1/TP1/Somme.java create mode 100644 APL2.1/TP1/Tri.java create mode 100644 APL2.1/TP1/grille.java create mode 100644 APL2.1/TP2/Boutons.class create mode 100644 APL2.1/TP2/Boutons.java create mode 100644 APL2.1/TP2/Saisie.class create mode 100644 APL2.1/TP2/Saisie.java create mode 100644 APL2.1/TP2/Sirocco.class create mode 100644 APL2.1/TP2/Sirocco.java diff --git a/APL1.1/CM2/semaine.c b/APL1.1/CM2/semaine.c index 15028c5..f5a11ec 100644 --- a/APL1.1/CM2/semaine.c +++ b/APL1.1/CM2/semaine.c @@ -9,9 +9,6 @@ int main(int argc, char *argv[]){ int jour_lettre = 0; printf ("Entrez une date : \n"); scanf("%d/%d/%d",&jour,&mois,&annee); - time.tm_year = annee; - time.tm_mon = mois; - time.tm_mday = jour; if (time.tm_mday%6+1 == 0){ printf("C'est un Dimanche\n"); } diff --git a/APL1.1/vieirae_CM2.tar.gz b/APL1.1/vieirae_CM2.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..b2338fdc8c03de8d6e7f1a194efcb5421d2e7889 GIT binary patch literal 1164 zcmV;71atcziwFP!000001MOG+Zre5x_uqO7)OL*#I$`jLg3ag$B z3y43V8_W`X;hji_2=Ht=JrsY_np=7Njp=j_@t;_R*+b(K*;B(e9{=wM^+GrqdYN!P zB=0ZoFO?dN#Db*ohc)(bfD+D9kE6&XVHnf91pTQXz&?41l9X&*%5Aw!C`TJNOtF1{ zd(Ch}FtZh9o0H+U*tU$;{6WoV1*4YfB>_@15^@~$_GY!pmjoE*DWk~Psog3S+Va<{ zpYN`37K`QewXJLwWfK!0y-SmOwXjx4hxC?o%yAHQELcCgQS3A ztgf|&3!2HxZ|18YAl^M@E0S=0wBv)AflHkH$TpnoS$6K-5no*HN!ZyA0SnarS&Axu zeZ4ql&EA~*ciPwN{C0pLR3?(kK6pCv?xDzfF-;_4^V@Baz`z1!Rpx&FP3*n16aj0^ zG&rkD9K$9r9m^)?=S?SCN>zyd{nwd~zDIqXXk{!C&!ytjKAd#0Gpe#GOT&(;7jCcm zp&p?+M|08n+Qq-O>;DNB(fVrr->@d-{AbN)qW@2=uKzy?8hU;ENWe*i1?5nZ53~HP z%>_I{Vqcl!f5fTCXDN(FcaiTtl#5YJlIo(E1@bkQQj9B$57=dOv3DWnoC%(>U8zq< zCO^ZUP)afKU5+9DcO|Qq`y=_+*9StDJ`lF(1F5yr(5rTz&CU%mdyKWmXTz7nQfBZxa@dIlU7NXc?=&fY}zL5N1Prn$!e4I3#R^; zm^Et?cI`$DqW-m|{V0g~4}DoY07*H%MFSAuL&R|e!)W#!UXixq$LaeJivbs>P`m{Zsks(6dJ(DAII8mwW6gZ;{HrNMdQs*{seIcwwAiwZ8ZN(DgfX e=+L1Pv literal 0 HcmV?d00001 diff --git a/APL1.2/SCR1.2/TP11/get_numb b/APL1.2/SCR1.2/TP11/get_numb new file mode 100755 index 0000000000000000000000000000000000000000..609e58a50eb3701b577a45107f968a395845714a GIT binary patch literal 16560 zcmeHOeQaCR6~A^{8lZ8~(t-V78Wj^JMaz{`0SJp$Q4hyU z#Kqz)kmpKH>B9;@tI7#~CDsu?2N3;&SgC>^Q?y{@9wMS&t)f!{jDpSs{pO()$!`23 z^@EZ1<@PjmhN8)186Q9cD2z@&%uTUbsztG_5+^7x4-m2+is*NW{7#V{;}o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yu{<=!vvfq~#yFIFI;i%j`QV~FevipW?vkwq9qDUO%8f-nWGQ%Py@9u$AE;O8hPG;7?|aat8jDasp%0u1q%7g0=*c?jqL#t_s1&5GqKm~)VAwuxv4Z#Cd z?J@tT9FCjel?VUVsS>1d3nP!4NiA);j(92jaIDJyt>n)b2A#9;IF>owzvcALlRx81 zHYDWtI@6sle;#)+YHUd8_P-AJcVO(x{pa}rBeze(O{J%>6?G%vbKa4ZPqd$z&&dA@lfWw?{d>jJELdf$% zVr5^sj(7-uPJfO37$0;RL){f#eAngA`;-~q=EP7O_UEuaboui*j*;iRZ128*e@y=6 zW;C)S{04~(oPU;o0Tn!d_CKU44I_SwbQX8}PlD3ve@s)>jC}n$hP(aWg92tb@)uYv;a9eVAQ=M%i&c?wSs3f})%*pIK{ zTfm_S`}4lP6EtvaLMKOIf5vw~=kyn0GHy{gNFoFKG5W#T>CfZtLGtH*y8X*CIAbjC z|43MA@-_V3@#?94GUu>@{TG!PRl&YuaU$P)N~4Yw6z~bU;qd< int main(int argc, char* argv[]) { - - int fird,ent,ents; - off_t i; - char tst[256]; - size_t n=1,m=1; - memset(tst,0,256); + int f ,l ,x ,n; + long int i, offset; + if (argc < 3) { + fprintf (stdin,"Usage : %s \n",argv[0]); + exit(1); + } + f=open(argv[1],O_RDONLY); + if (f==1){ + perror("Opening file failed !"); + exit(2); + } + i = strtol (argv[2],NULL,0); + offset = i*sizeof(int); + l = lseek(f,offset,SEEK_SET); + if (l==-1){ + perror("lseek fails !"); + exit(3); + } + n = read(f,&x,sizeof(int)); + if(n==-1){ + perror("reading file fails !"); + exit(4); + } + if (n==0){ + printf("Out of range !\n"); + }else{ + printf("The number at offset %d is 0x%08x --> %d \n",i,x,x); + } + close(f); + exit(0); + } - if(argc!=3){ - printf("erreur : %s \n",argv[0]); - exit(-1); - } - - fird=open(argv[1],O_CREAT|O_RDONLY,0600); - if(fird==-1){ - perror("On ne peut pas ouvrir cela en O_WRONLY"); - exit(1); - } - - ent = strtol(argv[2],NULL,10); - - lseek(fird,ent*4,SEEK_SET); - i=read(fird,&ents,4); - if(i==0){ - printf("Offset is out of range!\n"); - exit(1); - } - printf("The number at offset %d is 0x%08x --> %d\n",ent,ents,ents); - - close(fird); - - return EXIT_SUCCESS; - } diff --git a/APL1.2/SCR1.2/TP11/number.dat b/APL1.2/SCR1.2/TP11/number.dat new file mode 100644 index 0000000000000000000000000000000000000000..b4903af3a467db7ff48d77f232a17d6410c64b53 GIT binary patch literal 688 ocmZQ&U|=xfVqh=^ViO=X1!6NG27z5b0AY=iqaiTxA@Cmv0LHEeAOHXW literal 0 HcmV?d00001 diff --git a/APL1.2/SCR1.2/TP11/number.dat* b/APL1.2/SCR1.2/TP11/number.dat* new file mode 100644 index 0000000..e69de29 diff --git a/APL1.2/SCR1.2/TP11/numbers.dat b/APL1.2/SCR1.2/TP11/numbers.dat new file mode 100644 index 0000000..e69de29 diff --git a/APL1.2/SCR1.2/TP11/numbers.txt b/APL1.2/SCR1.2/TP11/numbers.txt index a9c8887..be79375 100644 --- a/APL1.2/SCR1.2/TP11/numbers.txt +++ b/APL1.2/SCR1.2/TP11/numbers.txt @@ -1,5 +1,8 @@ -5 -8 -6 -4 -8 +ERWAN +LA +S +A +L +O +P +E diff --git a/APL1.2/SCR1.2/TP11/put_numb b/APL1.2/SCR1.2/TP11/put_numb new file mode 100755 index 0000000000000000000000000000000000000000..5cb6a072beb747e8e22d20312b5c7d27169ebc0e GIT binary patch literal 16544 zcmeHOeQX@X6`woX#0mK9ganSHkZl@Q=EE1~%Q7E^JAY+eIk8C`C@N%gzFWuF+!uFy za7Jx$`SiDt047X{JFiL0O<&D>DE=*2e1K zdx@5=R|o>0F;V!##@TDlCJ_pJ3nU1;HL!52&sjLXjdt<$O;IVybiRhK_e+U zu~9lDq;ji11&tvo{A}Tar~rx3ZilfcHuGXuY%j$_GA<8FBs&z*Zb8~DNISw=Ssx+A z6Pu4mn~bLugHVPk$j^*9?efyjiCt2k5bMCS>vbdgN$MMrb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-k(c>qqalVO2Mrnd&=RQ>Lo=SzL&FK)+RJAaTqv6_AgaZ B*WLgC literal 0 HcmV?d00001 diff --git a/APL1.2/SCR1.2/TP11/put_numb.c b/APL1.2/SCR1.2/TP11/put_numb.c index 910fe06..88763ba 100644 --- a/APL1.2/SCR1.2/TP11/put_numb.c +++ b/APL1.2/SCR1.2/TP11/put_numb.c @@ -5,41 +5,31 @@ #include int main(int argc, char* argv[]) { - - int fird,ent,ents; - short int i; - off_t l; - char tst[256]; - size_t n=1,m=1; + int f,n; + unsigned int x; + unsigned long int i, offset, l; memset(tst,0,256); - - if(argc!=4){ + if(argc<4){ printf("erreur : %s <32-bit int in Hex> \n",argv[0]); - exit(-1); - } - - fird=open(argv[1],O_CREAT|O_WRONLY,0600); - if(fird==-1){ - perror("On ne peut pas ouvrir cela en O_RDONLY"); exit(1); } - - ent = strtol(argv[3],NULL,16); - - l=lseek(fird,ent*4,SEEK_SET); - printf("%ld\n",l); - + f=open(argv[1],O_WRONLY); + if(f==-1){ + perror("Opening failed"); + exit(2); + } + x= (unsigned int)strtol(argv[2],NULL,16); + i= (unsigned int)strtol(argv[3],NULL,16); + offset = i*sizeof(int); + l=lseek(f,0,SEEK_END); + if (offset > l) offset =l; + l=lseek(f,offset,SEEK_SET); if(l==-1){ perror("erreur dans lseek"); exit(2); - } - - + } ents = strtol(argv[2],NULL,16); - - write(fird,&ents,4); - - close(fird); - + write(f,&x,sizeof(int)); + close(f); return EXIT_SUCCESS; } diff --git a/APL1.2/SCR1.2/TP11/store_nb_rep b/APL1.2/SCR1.2/TP11/store_nb_rep new file mode 100755 index 0000000000000000000000000000000000000000..bbb24d0542fa3025c46169f1ec4de88735a6eb07 GIT binary patch literal 16536 zcmeHOdu$xV8J~0F#5{aRA20nq~?+2&as^}bskM@pyjbX`_}fg=R0$^ z4mMQaVjOXDO)aE8q@p%deMm@EL#tM4Du`)lX!!#ORog(Ruuy2vZA#6nGKFOO`)21m z?``g?(mz@W?HApC^ZmZZ%zit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lwnVeUJaNGGN}K`ZI@Nf0lpX@#l3cb8PV}AaDDBto%9uLR037 zw;G#g-TtGRW6hkOAIIS5$MSDb!0cI$0m68m&gWpg z_AE1}d4HA5pV#$sbrfx(zc|u@%>I9cg8B|WCSE`Ax#k(VIgsj>`Tobx@g3;Mg#G#4 z-w8E=tR-g`alOpngU; +#include +#include +#define BUFSIZE 256 + +int main(int argc, char * argv[]){ + int r,x,f,y,n; + char buf[BUFSIZE]; + if(argc<2){ + fprintf(stdin,"Usage: %s \n",argv[0]); + exit(1); + } + f=open(argv[1],O_WRONLY|O_CREAT|O_TRUNC,0600); + if(f==-1){ + perror("Opening file failed !"); + exit(2); + } + write(1,"Numb --> ",9); + memset(buf,0,BUFSIZE); + while(n=read(0,buf,BUFSIZE)){ + x = (int)strtol(buf,NULL,0); + r=write(f,buf,sizeof(int)); + if(r==-1){ + perror("writing failed"); + exit(3); + } + write(1,"Numb --> ",9); + memset (buf,0,BUFSIZE); + } + close(f); + exit(0); +} diff --git a/APL1.2/SCR1.2/TP12/de commandes avec sed : b/APL1.2/SCR1.2/TP12/de commandes avec sed : new file mode 100644 index 0000000..a3b1f93 --- /dev/null +++ b/APL1.2/SCR1.2/TP12/de commandes avec sed : @@ -0,0 +1,237 @@ +SED(1) User Commands SED(1) + +NNAAMMEE + sed - stream editor for filtering and transforming text + +SSYYNNOOPPSSIISS + sseedd [_O_P_T_I_O_N]... _{_s_c_r_i_p_t_-_o_n_l_y_-_i_f_-_n_o_-_o_t_h_e_r_-_s_c_r_i_p_t_} [_i_n_p_u_t_-_f_i_l_e]... + +DDEESSCCRRIIPPTTIIOONN + _S_e_d is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). While in some ways sim‐ + ilar to an editor which permits scripted edits (such as _e_d), _s_e_d works by making only one pass over the input(s), and is consequently more efficient. But it is + _s_e_d's ability to filter text in a pipeline which particularly distinguishes it from other types of editors. + + --nn, ----qquuiieett, ----ssiilleenntt + + suppress automatic printing of pattern space + + ----ddeebbuugg + + annotate program execution + + --ee script, ----eexxpprreessssiioonn=_s_c_r_i_p_t + + add the script to the commands to be executed + + --ff script-file, ----ffiillee=_s_c_r_i_p_t_-_f_i_l_e + + add the contents of script-file to the commands to be executed + + ----ffoollllooww--ssyymmlliinnkkss + + follow symlinks when processing in place + + --ii[[SSUUFFFFIIXX]], ----iinn--ppllaaccee[=_S_U_F_F_I_X] + + edit files in place (makes backup if SUFFIX supplied) + + --ll N, ----lliinnee--lleennggtthh=_N + + specify the desired line-wrap length for the `l' command + + ----ppoossiixx + + disable all GNU extensions. + + --EE, --rr, ----rreeggeexxpp--eexxtteennddeedd + + use extended regular expressions in the script (for portability use POSIX --EE). + + --ss, ----sseeppaarraattee + + consider files as separate rather than as a single, continuous long stream. + + ----ssaannddbbooxx + + operate in sandbox mode (disable e/r/w commands). + + --uu, ----uunnbbuuffffeerreedd + + load minimal amounts of data from the input files and flush the output buffers more often + + --zz, ----nnuullll--ddaattaa + + separate lines by NUL characters + + ----hheellpp + display this help and exit + + ----vveerrssiioonn + output version information and exit + + If no --ee, ----eexxpprreessssiioonn, --ff, or ----ffiillee option is given, then the first non-option argument is taken as the sed script to interpret. All remaining arguments are names + of input files; if no input files are specified, then the standard input is read. + + GNU sed home page: . General help using GNU software: . E-mail bug reports to: . + +CCOOMMMMAANNDD SSYYNNOOPPSSIISS + This is just a brief synopsis of _s_e_d commands to serve as a reminder to those who already know _s_e_d; other documentation (such as the texinfo document) must be con‐ + sulted for fuller descriptions. + + ZZeerroo--aaddddrreessss ````ccoommmmaannddss'''' + : _l_a_b_e_l + Label for bb and tt commands. + + #_c_o_m_m_e_n_t + The comment extends until the next newline (or the end of a --ee script fragment). + + } The closing bracket of a { } block. + + ZZeerroo-- oorr OOnnee-- aaddddrreessss ccoommmmaannddss + = Print the current line number. + + a \ + + _t_e_x_t Append _t_e_x_t, which has each embedded newline preceded by a backslash. + + i \ + + _t_e_x_t Insert _t_e_x_t, which has each embedded newline preceded by a backslash. + + q [_e_x_i_t_-_c_o_d_e] + Immediately quit the _s_e_d script without processing any more input, except that if auto-print is not disabled the current pattern space will be printed. The + exit code argument is a GNU extension. + + Q [_e_x_i_t_-_c_o_d_e] + Immediately quit the _s_e_d script without processing any more input. This is a GNU extension. + + r _f_i_l_e_n_a_m_e + Append text read from _f_i_l_e_n_a_m_e. + + R _f_i_l_e_n_a_m_e + Append a line read from _f_i_l_e_n_a_m_e. Each invocation of the command reads a line from the file. This is a GNU extension. + + CCoommmmaannddss wwhhiicchh aacccceepptt aaddddrreessss rraannggeess + { Begin a block of commands (end with a }). + + b _l_a_b_e_l + Branch to _l_a_b_e_l; if _l_a_b_e_l is omitted, branch to end of script. + + c \ + + _t_e_x_t Replace the selected lines with _t_e_x_t, which has each embedded newline preceded by a backslash. + + d Delete pattern space. Start next cycle. + + D If pattern space contains no newline, start a normal new cycle as if the d command was issued. Otherwise, delete text in the pattern space up to the first + newline, and restart cycle with the resultant pattern space, without reading a new line of input. + + h H Copy/append pattern space to hold space. + + g G Copy/append hold space to pattern space. + + l List out the current line in a ``visually unambiguous'' form. + + l _w_i_d_t_h + List out the current line in a ``visually unambiguous'' form, breaking it at _w_i_d_t_h characters. This is a GNU extension. + + n N Read/append the next line of input into the pattern space. + + p Print the current pattern space. + + P Print up to the first embedded newline of the current pattern space. + + s/_r_e_g_e_x_p/_r_e_p_l_a_c_e_m_e_n_t/ + Attempt to match _r_e_g_e_x_p against the pattern space. If successful, replace that portion matched with _r_e_p_l_a_c_e_m_e_n_t. The _r_e_p_l_a_c_e_m_e_n_t may contain the special + character && to refer to that portion of the pattern space which matched, and the special escapes \1 through \9 to refer to the corresponding matching sub-ex‐ + pressions in the _r_e_g_e_x_p. + + t _l_a_b_e_l + If a s/// has done a successful substitution since the last input line was read and since the last t or T command, then branch to _l_a_b_e_l; if _l_a_b_e_l is omitted, + branch to end of script. + + T _l_a_b_e_l + If no s/// has done a successful substitution since the last input line was read and since the last t or T command, then branch to _l_a_b_e_l; if _l_a_b_e_l is omitted, + branch to end of script. This is a GNU extension. + + w _f_i_l_e_n_a_m_e + Write the current pattern space to _f_i_l_e_n_a_m_e. + + W _f_i_l_e_n_a_m_e + Write the first line of the current pattern space to _f_i_l_e_n_a_m_e. This is a GNU extension. + + x Exchange the contents of the hold and pattern spaces. + + y/_s_o_u_r_c_e/_d_e_s_t/ + Transliterate the characters in the pattern space which appear in _s_o_u_r_c_e to the corresponding character in _d_e_s_t. + +AAddddrreesssseess + _S_e_d commands can be given with no addresses, in which case the command will be executed for all input lines; with one address, in which case the command will only be + executed for input lines which match that address; or with two addresses, in which case the command will be executed for all input lines which match the inclusive + range of lines starting from the first address and continuing to the second address. Three things to note about address ranges: the syntax is _a_d_d_r_1,_a_d_d_r_2 (i.e., the + addresses are separated by a comma); the line which _a_d_d_r_1 matched will always be accepted, even if _a_d_d_r_2 selects an earlier line; and if _a_d_d_r_2 is a _r_e_g_e_x_p, it will + not be tested against the line that _a_d_d_r_1 matched. + + After the address (or address-range), and before the command, a !! may be inserted, which specifies that the command shall only be executed if the address (or ad‐ + dress-range) does nnoott match. + + The following address types are supported: + + _n_u_m_b_e_r Match only the specified line _n_u_m_b_e_r (which increments cumulatively across files, unless the --ss option is specified on the command line). + + _f_i_r_s_t~_s_t_e_p + Match every _s_t_e_p'th line starting with line _f_i_r_s_t. For example, ``sed -n 1~2p'' will print all the odd-numbered lines in the input stream, and the address + 2~5 will match every fifth line, starting with the second. _f_i_r_s_t can be zero; in this case, _s_e_d operates as if it were equal to _s_t_e_p. (This is an exten‐ + sion.) + + $ Match the last line. + + /_r_e_g_e_x_p/ + Match lines matching the regular expression _r_e_g_e_x_p. Matching is performed on the current pattern space, which can be modified with commands such as ``s///''. + + \cc_r_e_g_e_x_pcc + Match lines matching the regular expression _r_e_g_e_x_p. The cc may be any character. + + GNU _s_e_d also supports some special 2-address forms: + + 0,_a_d_d_r_2 + Start out in "matched first address" state, until _a_d_d_r_2 is found. This is similar to 1,_a_d_d_r_2, except that if _a_d_d_r_2 matches the very first line of input the + 0,_a_d_d_r_2 form will be at the end of its range, whereas the 1,_a_d_d_r_2 form will still be at the beginning of its range. This works only when _a_d_d_r_2 is a regular + expression. + + _a_d_d_r_1,+_N + Will match _a_d_d_r_1 and the _N lines following _a_d_d_r_1. + + _a_d_d_r_1,~_N + Will match _a_d_d_r_1 and the lines following _a_d_d_r_1 until the next line whose input line number is a multiple of _N. + +RREEGGUULLAARR EEXXPPRREESSSSIIOONNSS + POSIX.2 BREs _s_h_o_u_l_d be supported, but they aren't completely because of performance problems. The \\nn sequence in a regular expression matches the newline character, + and similarly for \\aa, \\tt, and other sequences. The _-_E option switches to using extended regular expressions instead; it has been supported for years by GNU sed, and + is now included in POSIX. + +BBUUGGSS + E-mail bug reports to bbuugg--sseedd@@ggnnuu..oorrgg. Also, please include the output of ``sed --version'' in the body of your report if at all possible. + +AAUUTTHHOORR + Written by Jay Fenlason, Tom Lord, Ken Pizzini, Paolo Bonzini, Jim Meyering, and Assaf Gordon. + + This sed program was built with SELinux support. SELinux is enabled on this system. + + GNU sed home page: . General help using GNU software: . E-mail bug reports to: . + +CCOOPPYYRRIIGGHHTT + Copyright © 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later . + This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. + +SSEEEE AALLSSOO + aawwkk(1), eedd(1), ggrreepp(1), ttrr(1), ppeerrllrree(1), sed.info, any of various books on _s_e_d, the _s_e_d FAQ (http://sed.sf.net/grabbag/tutorials/sedfaq.txt), + http://sed.sf.net/grabbag/. + + The full documentation for sseedd is maintained as a Texinfo manual. If the iinnffoo and sseedd programs are properly installed at your site, the command + + iinnffoo sseedd + + should give you access to the complete manual. + +sed 4.8 January 2020 SED(1) diff --git a/APL1.2/SCR1.2/TP12/regexp b/APL1.2/SCR1.2/TP12/regexp new file mode 100755 index 0000000000000000000000000000000000000000..08da540467d1891950c18cbcc93274cc59eb9d5a GIT binary patch literal 16480 zcmeHOeQX@X6`woD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k zTOwWN-j0s_?LB5sq@}AJqspTQv2;eZ`JWy$P-h-=KA|8_C0OyO6XjD8B`P`*QG$Ko z;Dbkt!PGGZK04tsC_U$3#?vWtFq(|R83@c8p2R41=-dn8;)$f0Nn4PyQ#XrQmp*W) zqv(QXE=;p8ou)R(qZxSoqiBKmtj>0nK&A=jG59&*L5)REUzDB#DG8vCjg&wloE{x^ zqJ6*}Tk%0I!J!h%9uZ;Ltp}2s@Q9rnv21751@&bTaMmdiCn(a=*?=8CjOK&U^q>gG zN0U&6;*PB}H(EA+B`6V0(Am~d6dkBEGUSM`%wgEEvQWkj54x1>4qhd|#nLM4^ClclPJ`J#)Ep6!h3e%roCV&$APN;VrX2uNRo} z`T$HMVGK8Y8U&n+vp>(jnXe;bZa>>G|2*h%ZqG8$@0s&_*4ut=!xR)Sr|i$`3+D4= z$n|^g|90|kA-i6z2#EQ;N|gD>HI3K*9>6ds93Q6yl8Ey|rEz4k0Ke;#~l zT>iX1pKriuAFPl4n7;xx*mvl)Q(PDD`Q%x=IUwqm#rE@ad<%4F!v1`2?*vU4>(SXo zTrcx?LFe`tIvF=A-c2Gi_G2CdXSYAk!@J3!+v)W$%HWK#xc$Al()5x)F*X-kv7`#s zRKM4b{k>}sY%7wRbKg@M^_!)DcTk7J|A%lb%=gXjPyD+Dw_SOv-&#B%3-q8TIM=JR TI7eRG|H(_0#n~PQk0|~Di}7YL literal 0 HcmV?d00001 diff --git a/APL1.2/SCR1.2/TP12/regexp.c b/APL1.2/SCR1.2/TP12/regexp.c new file mode 100644 index 0000000..cee1563 --- /dev/null +++ b/APL1.2/SCR1.2/TP12/regexp.c @@ -0,0 +1,35 @@ + #include + #include + #include + #include + #include + + int +main (int argc, char * argv []) +{ + regex_t regex; + int retour; + char message [128]; + + if (argc != 3) { + fprintf (stderr, "syntaxe : %s expression chaine\n", + argv [0]); + exit (1); + } + + if ((retour = regcomp (& regex, argv [1], REG_NOSUB)) != 0) { + regerror (retour, & regex, message, 128); + fprintf (stderr, "Erreur : %s\n", message); + exit (1); + } + + if (regexec (& regex, argv [2], 0, NULL, 0) == 0) + fprintf (stdout, "Correspondance !\n"); + else + fprintf (stdout, "Pas de correspondance.\n"); + + regfree (& regex); + exit (0); +} + + diff --git a/APL1.2/SCR1.2/TP12/td7.txt b/APL1.2/SCR1.2/TP12/td7.txt new file mode 100644 index 0000000..5b4392a --- /dev/null +++ b/APL1.2/SCR1.2/TP12/td7.txt @@ -0,0 +1,21 @@ +Expressions régulières : + + . -> exactement un caractère + [] -> co ̈ıncide avec n’importe quel caractère -exactement un caractère- inclus dans les [ ]. + ^ et $ début et fin de lignes + exemple : ’^..[[:digit:]]’ toutes les lignes qui commencent par deux caractère quelconques puis un chiffre. + \ -> protège un caractère, exmple \. = . + ’[^[:upper:]].$’ -> toutes les lignes qui se terminent par un caractère quelconques sauf précédée par une majuscule. + + Exercice 2 : + ’T?ST?AR’ -> ? = SAR , TSAR, STAR, TSTAR + ’(back)?(slash)?’ -> backslash, back, slash, ' ' + ’^[[:space:]]*$’ -> 0 ou un espace avant un caractère. + ’^.?..$’ , ’^..?.$’ , ’^...?$’ , ’^.{2,3}$ -> 2 ou 3 caractère sur la ligne. + ’(ding-deng-dong)+’ -> une ou plusieurs fois (ding-deng-dong) + ’^[[:space:]]+$’ -> 1 ou plusieurs fois espace + ’[$][[:digit:]]?$’ -> fini par "$" ou par "$" et un chiffre. + + Exercice 3 : + 1) c'est un .config ou .cfg ’[.](config|cfg)’ + 2) ’[$]([[:digit:]]|$)’ -> se termine par un $ sigit ou un $. \ No newline at end of file diff --git a/APL1.2/SCR1.2/TP12/tp12.txt b/APL1.2/SCR1.2/TP12/tp12.txt new file mode 100644 index 0000000..761693c --- /dev/null +++ b/APL1.2/SCR1.2/TP12/tp12.txt @@ -0,0 +1,3 @@ +grep -E : version étendue. +grep -i : ignorer les cas. +grep -v : inverser le sens, selectionner les lignes qui ne matchent pas. diff --git a/APL2.1/TP1/Arguments.java b/APL2.1/TP1/Arguments.java new file mode 100644 index 0000000..fb78268 --- /dev/null +++ b/APL2.1/TP1/Arguments.java @@ -0,0 +1,7 @@ +public class Arguments { + public static void main(String[] args) { + for(int i = 0; i < args.length; i++) { + System.out.println("Salut " + args[i]); + } +} +} diff --git a/APL2.1/TP1/Demarrage.java b/APL2.1/TP1/Demarrage.java new file mode 100644 index 0000000..402d20a --- /dev/null +++ b/APL2.1/TP1/Demarrage.java @@ -0,0 +1,20 @@ +public class Demarrage { + public static void main(String[] args) { + byte premier = 123; + short deuxieme = 124; + int troisieme = -125; + long quatre = 126L; + boolean cinq = true; + char six = 'o'; + float sept = 13.5f; + double huit = 50.0d; + System.out.println(premier); + System.out.println(deuxieme); + System.out.println(troisieme); + System.out.println(quatre); + System.out.println(cinq); + System.out.println(six); + System.out.println(sept); + System.out.println(huit); + } +} \ No newline at end of file diff --git a/APL2.1/TP1/Somme.java b/APL2.1/TP1/Somme.java new file mode 100644 index 0000000..8076ace --- /dev/null +++ b/APL2.1/TP1/Somme.java @@ -0,0 +1,9 @@ +public class Somme { + public static void main(String[] args) { + int total = 0; + for(int i = 0; i < args.length; i++) { + total = total + Integer.parseInt(args[i]);; +} + System.out.print("La somme totale est : " + total); +} +} diff --git a/APL2.1/TP1/Tri.java b/APL2.1/TP1/Tri.java new file mode 100644 index 0000000..8ff3eb4 --- /dev/null +++ b/APL2.1/TP1/Tri.java @@ -0,0 +1,14 @@ +import java.util.Arrays; +public class Tri { + public static void main(String[] args) { + int[] total = null; + total = new int[args.length]; + for(int i = 0; i < args.length; i++) { + total[i] = Integer.parseInt(args[i]); +} + Arrays.sort(total); + for(int i = 0; i < args.length; i++) { + System.out.println(total[i]); +} + } +} diff --git a/APL2.1/TP1/grille.java b/APL2.1/TP1/grille.java new file mode 100644 index 0000000..5d60350 --- /dev/null +++ b/APL2.1/TP1/grille.java @@ -0,0 +1,22 @@ + +public class grille { + public static void main(String[] args) { + for(int j = 0; j < Integer.parseInt(args[0]); j++) { + System.out.print("+"); + for(int i = 0; i < Integer.parseInt(args[0]); i++) { + System.out.print("-+"); +} + + System.out.print("\n|"); + for(int i = 0; i < Integer.parseInt(args[0]); i++) { + System.out.print(" |"); + } + System.out.print("\n"); + } + System.out.print("+"); + for(int i = 0; i < Integer.parseInt(args[0]); i++) { + System.out.print("-+"); +} +} +} + diff --git a/APL2.1/TP2/Boutons.class b/APL2.1/TP2/Boutons.class new file mode 100644 index 0000000000000000000000000000000000000000..3dbedf4c8270321857549381662c6c43682ea5c1 GIT binary patch literal 830 zcmZva-A~g{7{;Hob?u=Pwsj1diin>b9ZV+p!H^4vB$x>o7zlb{I(Eb^TT9x`q5qXP zTOx_q#=pmF<9j-WnAnSRPJiclKc2V!`TN^<04sQ*V;XZBZtF;3PA>CuxufAO$2}b? z?rV6!@laBWqsXzqVRMu?7CDwU${dg6<+6r~hQ|!*y6d^o21C*+9xy01zbP2fb=MQS z-A+RUZ=6P(h|+Ofk73$+S8q9=oO0XoPRjdH;Cd%j8L033-QZYkyHady`rXL)!X+s+ za1ApIraYgO!yZMHUu_3YM;K&j)xZ-xWyt+=z1fW@o}k`qUH`o7#VnuwabtSLu%I#qK}t^%qlOPkmMIxS4cu#Uy-cRJZi#=L|~wb^-E>Q zkcmsjuJ;-(aV*n>BHDMqkl&QGvm=KvLu5;QaJucN*7ifOcPauWa-|c+iWPb5|Km$K z%_c+f;#NAW`JGeWqh_jCB8H`h1E*RCZs-obj`g;9fO+KU|Bz1tOirEF0=>=B&S+09 z48Xq9f#Eu>Y77;O;RbHfSxSE(361u%b0m%iNY?Ev`;}#-J``K+BXth-$kYblukDhl z_c0y=gTSu6Xikj4B!M->E+}StgfbGP>_W=Sj*uylY8O;9N61$CnEKn@2GVhlocb}r p$<7!V)L~&9708c0fh|m;PP#*6@E%#TNEsl99;V38EX5~q>kry~s$>8F literal 0 HcmV?d00001 diff --git a/APL2.1/TP2/Boutons.java b/APL2.1/TP2/Boutons.java new file mode 100644 index 0000000..fd9d6b4 --- /dev/null +++ b/APL2.1/TP2/Boutons.java @@ -0,0 +1,21 @@ +import javax.swing.*; +import java.awt.*; + +public class Boutons { + public static void main(String[] args) { + JFrame fenetre = new JFrame(); + fenetre.setSize(500,300); + fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + JButton bouton1 = new JButton("Bouton1"); + fenetre.add(bouton1, BorderLayout.WEST); + JButton bouton2 = new JButton("Bouton2"); + fenetre.add(bouton2, BorderLayout.NORTH); + JButton bouton3 = new JButton("Bouton3"); + fenetre.add(bouton3, BorderLayout.EAST); + JButton bouton4 = new JButton("Bouton4"); + fenetre.add(bouton4, BorderLayout.SOUTH); + JButton bouton5 = new JButton("Bouton5"); + fenetre.add(bouton5, BorderLayout.CENTER); + fenetre.setVisible(true); + } +} \ No newline at end of file diff --git a/APL2.1/TP2/Saisie.class b/APL2.1/TP2/Saisie.class new file mode 100644 index 0000000000000000000000000000000000000000..00bad24272d0b6a12a23f779c366103925ce4565 GIT binary patch literal 889 zcmZWoYfsZq7=F&$t)naK!bR{3D%#zs;uVG(nOTCV@L_}m^~>3I#A4Tyt`p>o{3X9^ ziA($e#^0pAr$v<5ChzrmPv7T#Prv{C`VGK+JkxOj^BNX(Brq?Y1Vh$# zJh9pDwnVVaTP{V^E_XbJ8S{<3&p&d@<=&pv3Gy-SXgCs_X>zCMh$V?M zFpD{cg0zpU-XRrOFB<{x3IofyXAn;k5Acv-`W$9k9EHyV!Re#_#T$-rI}8&tVe!Mz zs{5`V$WJ{o@E9uwRkr$M7l1#P!PU`HHIX$9=~hD{qy8(R$4GnvZ#IYZfR_Zf_?8VQEgNT%X&nhZqtjt^q;7zvjtL*4%n zo$${*jCnc^dwC|)@t#g}duo~u#lF;JuO~A#9I9PS^{|EtLsi>f!pRwBgm3mUo(K;Q zufzt5|