Projet mkd/shell.c
De Wiki EELL.
(Différences entre les versions)
JPL (discuter | contributions) m |
JPL (discuter | contributions) m (→Fichiers de la fonction shell_() : Mise à jour) |
||
| (2 versions intermédiaires masquées) | |||
| Ligne 1 : | Ligne 1 : | ||
<small>[[Projet mkd/Fichiers en développement|Retour aux fichiers en développement →]]</small> | <small>[[Projet mkd/Fichiers en développement|Retour aux fichiers en développement →]]</small> | ||
| - | + | ||
| - | + | == Fichiers de la fonction shell_() == | |
| - | + | ||
| - | + | Ce programme copie les commentaires des lignes contenant le caractère # suivi par un des caractères 'Codes' entrés en paramètre. Si le caractère '#' est précédé de \ ou si il est intégré dans une chaîne, alors il n'est pas considéré comme début de commentaire. | |
| - | + | ||
| - | + | {{Boîte déroulante/début|titre=shell.c, shell.cc, shell.inc.cc}} | |
| - | + | <pre style="color:red"> | |
| - | + | /*P | |
| - | + | FILE NAME: shell.c for konsole shell.cc for individual compilation in | |
| - | + | c++ or shell.inc.cc to include file in sources files with gtkmm | |
| - | + | ||
| - | + | PROJECT: mkd | |
| - | + | mkd is a UNIX command to extract pre-encoded comments lines to generate the | |
| + | software documentation according to ISO standards. | ||
| + | mkd is the abbreviation of make documentation. This command was originally | ||
| + | known under the name mkdoc (make documentation). | ||
| + | This command is not integrated into the standard distributions of Unix / Linux | ||
| + | |||
| + | INITIAL PROJECT: | ||
| + | mkdoc 1989 for MS-DOS and UNIX now obsolete. CEM - University of Montpellier II | ||
| + | |||
| + | ADMINISTRATIVE RECORD: | ||
| + | extractdoc 04/12/2009 | ||
| + | |||
| + | FILE UPDATE: | ||
| + | Date: ../../1986 by JPL Initial programming for MSDOS and UNIX on SUN | ||
| + | Date: 09/06/1989 by JPL | ||
| + | Date: 03/01/1991 by JPL mkdoc 3.11 for PC and UNIX | ||
| + | Date: ../../1991 by JPL mkdoc 3.12 for PC and UNIX | ||
| + | Date: 09/05/2013 by Clara for mkd 13.05 alpha | ||
*/ | */ | ||
| + | // Date: ../../.... by ... purpose of the modification .... | ||
| + | |||
| + | /*T | ||
| + | FILE NAME: shell.c for konsole shell.cc for individual compilation in | ||
| + | c++ or shell.inc.cc to include file in sources files with gtkmm | ||
| + | |||
| + | |||
| + | Directives de tests unitaires version alpha 2013 | ||
| + | Généralités pour tous les modules. | ||
| + | ------------------------------------------------- | ||
| + | Vérifiez les options n, s et t séparément: | ||
| + | Vérifiez que la numérotation des lignes est correcte dans tous les cas de | ||
| + | décodage (lignes et blocs). n, ns. nt, nst. | ||
| + | Vérifiez que le texte reste à la bonne place dans tous les cas de décodage: | ||
| + | toute la ligne (dans la cas de la directive de compilation FULL_LINE), ou | ||
| + | texte seul. | ||
| + | -- Vérifiez que les tabulations sont bien prises en charge dans tous les | ||
| + | cas, décodage des lignes et des blocs. | ||
| + | -- Vérifiez de même pour les espaces. | ||
| + | La fonction doit être éprouvée de telle sorte qu'un commentaire qui se | ||
| + | termine par le caractère de fin de fichier soit entièrement copié dans le | ||
| + | fichier cible. | ||
| + | Le caractère de fin de fichier décodé avant le(les) caractère(s) de fin de | ||
| + | commentaire doit être remplacé par un caractère de fin de ligne 0x0A. Noter | ||
| + | que le caractère 0x0A précédant EOF est considéré comme fin de ligne. | ||
| + | |||
| + | Le caractère de fin de fichier (EOF 0xFF) NE DOIT JAMAIS APPARAÎTRE DANS LE | ||
| + | TEXTE DU FICHIER CIBLE. | ||
| + | Ceci provoquait un bug dans la version Alpha de l'application fenêtrée | ||
| + | mkdbasicw à l'étape du test d'intégration. | ||
| + | |||
| + | Vérifiez que l'extraction de tous les commentaires avec pour code de | ||
| + | décodage '**' soient copiés et que ceux-ci soient à la bonne place. | ||
| + | |||
| + | */ | ||
| + | |||
| + | |||
| + | /*D | ||
| + | function shell_ | ||
| + | ----------------------------------------------------------------------------- | ||
| + | FILE NAME: shell.c for konsole shell.cc for individual compilation in | ||
| + | c++ or shell.inc.cc to include file in sources files with gtkmm | ||
| + | |||
| + | FUNTION NAME: | ||
| + | shell_ | ||
| + | |||
| + | SYNOPSIS, SYNTAX: | ||
| + | #include "/usr/include/mkd/version.h" // IMPORTANT: Compilation directives | ||
| + | #include "/usr/include/mkd/shell.h" // or mkd.h | ||
| + | int shell_(FILE * pfdoc, FILE * pnfile); | ||
| + | FILE * pfdoc: pointer of the target stream opened by the calling function | ||
| + | FILE * pnfile: pointer of the source stream opened by the calling function | ||
| + | |||
| + | ACTION, DESCRIPTION: | ||
| + | The shell_ function reads the source file (pnfile) transmitted from the | ||
| + | calling function, and decodes the comments pre-encoded in lines or | ||
| + | blocks. and then writing this comments to a target file (pfdoc). | ||
| + | Pre-coded characters are defined in a external global table 'Codes'; | ||
| + | |||
| + | The golbal variables are 'Codes' and 'Options'. | ||
| + | The 'Codes': table of 5 characters: | ||
| + | extern char codes[]; | ||
| + | They must be defined in the calling function: | ||
| + | char codes[5] = {0,0,0,0,0}; | ||
| + | The 'Options': n,s,t,v: | ||
| + | extern unsigned char n,s,t; | ||
| + | They must be defined in the calling function: | ||
| + | unsigned char n=0,s=0,t=0; | ||
| + | With the options: | ||
| + | -n: The transcript is preceded by line number. This allows to easily | ||
| + | reach the commented line. | ||
| + | -s: Add the comment to the stdout to use shell redirections > , >> , | ||
| + | or ||. | ||
| + | -t: With the t option only the commented text is extracted. | ||
| + | Without the t option the entire line or block is copied. | ||
| + | The t option permit to generate directly exploitable and publishable | ||
| + | documents. | ||
| + | |||
| + | Remarks: | ||
| + | Ce programme copie les commentaires des lignes contenant le caractère # | ||
| + | suivi par un des caractères 'Codes' entrés en paramètre. Si le caractère | ||
| + | '#' est précédé de \ ou si il est intégré dans une chaîne, alors il n'est | ||
| + | pas considéré comme début de commentaire. | ||
| + | |||
| + | |||
| + | CONFORMING TO: | ||
| + | POSIX, ANSI C, BSD, ISO/IEC 9899:2011; gcc, MS-Vc10; UTF-8. | ||
| + | |||
| + | PORTABILITY, | ||
| + | LINUX-Debian-systems, LINUX-Red-Hat, UNIX, gcc. | ||
| + | Microsoft Visual studio under Windows : x86(Win32) x64(Win32 and WIN64) | ||
| + | |||
| + | RETURN VALUE: | ||
| + | Nothing. | ||
| + | |||
| + | COPYRIGHT: | ||
| + | © EELL, Éditeurs Européens de Logiciels Libres, EUPL 2007. | ||
| + | Association à but non lucratif selon l'Article 11 de la convention | ||
| + | européenne des droits de l'homme. | ||
| + | Concédée sous licence EUPL, version 1.1 ou – dès leur approbation par la | ||
| + | Commission européenne - versions ultérieures de l’EUPL (la «Licence»). | ||
| + | Vous ne pouvez utiliser la présente œuvre que conformément à la Licence. | ||
| + | Vous pouvez obtenir une copie de la Licence à l’adresse suivante: | ||
| + | http://ec.europa.eu/idabc/eupl5 | ||
| + | Sauf obligation légale ou contractuelle écrite, le logiciel distribué sous la | ||
| + | Licence est distribué «en l’état», SANS GARANTIES OU CONDITIONS QUELLES | ||
| + | QU’ELLES SOIENT, expresses ou implicites. | ||
| + | Consultez la Licence pour les autorisations et les restrictions linguistiques | ||
| + | spécifiques relevant de la Licence. | ||
| + | La Licence est totalement compatible avec la licence GNU. | ||
| + | |||
| + | AUTHORS: | ||
| + | © Contact: http://edeulo.free.fr/contacts/formmail.php | ||
| + | Designer: intial JP Louyot (JPL) | ||
| + | Updates : JPL and Clara Jimenez | ||
| + | Translations: Alizée, Clara, Luca, JPL, JPT, Martine | ||
| + | |||
| + | RESSOURCES: | ||
| + | gtkmm with mkdw future widowed version. | ||
| + | |||
| + | NOTES: | ||
| + | Update May 2013 | ||
| + | |||
| + | BUGS: | ||
| + | See bugs reports http://edeulo.free.fr/phpBB3 | ||
| + | |||
| + | SEE ALSO MANUAL: | ||
| + | Man(3) attached in English. | ||
| + | Command line : man 3 shell_ | ||
| + | |||
| + | */ | ||
| + | |||
| + | /*H | ||
| + | // File: shell.c (Comments for UTF-8 text editor) | ||
| + | void shell_ (FILE * pfdoc, FILE * pnfile); | ||
| + | */ | ||
| + | </pre> | ||
| + | <pre style="color:blue"> | ||
| + | #include "version.h" | ||
| + | #include "shell.h" | ||
| + | |||
| + | void shell_ (FILE * pfdoc, FILE * pnfile) | ||
| + | //O FILE * pfdoc: pointer of the target stream opened by the calling function | ||
| + | //O FILE * pnfile: pointer of the source stream opened by the calling function | ||
| - | |||
| - | |||
{ /*S shell */ | { /*S shell */ | ||
| - | + | extern unsigned char n,s,t; | |
| - | + | extern char codes[]; | |
| - | + | unsigned int i,tab; | |
| - | + | unsigned int num; | |
| - | + | long ll,nl,lc; | |
| - | + | register int c1; | |
| - | + | int c2; | |
num = 0; | num = 0; | ||
| Ligne 32 : | Ligne 191 : | ||
while ( c1 != EOF && c2 != EOF ) | while ( c1 != EOF && c2 != EOF ) | ||
{ /*S tq !EOF */ | { /*S tq !EOF */ | ||
| - | /*O si | + | /*O si début de texte faire c1=LF */ |
if (c1==STX) c1='\n'; | if (c1==STX) c1='\n'; | ||
| - | /*O sinon prendre pour c1 le char | + | /*O sinon prendre pour c1 le char suivant */ |
else c1=getc(pnfile); | else c1=getc(pnfile); | ||
| - | /*O si le char est NL | + | if (c1==EOF) break; |
| + | /*O si le char est NL repérer la position qui suit 'NL' dans nl */ | ||
if(c1=='\n') | if(c1=='\n') | ||
{ /*S*/ | { /*S*/ | ||
| Ligne 45 : | Ligne 205 : | ||
else | else | ||
{ /*S !NL */ | { /*S !NL */ | ||
| - | /*O si le char est '\t' | + | |
| + | /*O si le char est '\t' incrémenter tab */ | ||
if (c1=='\t')tab++; | if (c1=='\t')tab++; | ||
| + | |||
/*O sinon si le char est '\"' */ | /*O sinon si le char est '\"' */ | ||
else if (c1=='\"') | else if (c1=='\"') | ||
/*O alors aller jusqu'au prochain '\"' */ | /*O alors aller jusqu'au prochain '\"' */ | ||
{ /*S string */ | { /*S string */ | ||
| - | /*O tant que le | + | /*O tant que le caractère suivant n'est pas " */ |
while ((c1=getc(pnfile))!='\"') | while ((c1=getc(pnfile))!='\"') | ||
{ /*S*/ | { /*S*/ | ||
| - | /*O si le char est EOF | + | /*O si le char est EOF quitter la boucle */ |
| - | if (c1==EOF) | + | if (c1==EOF)break; |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
} /*S*/ | } /*S*/ | ||
} /*S string */ | } /*S string */ | ||
| Ligne 70 : | Ligne 228 : | ||
/*O alors simuler un espace */ | /*O alors simuler un espace */ | ||
c1=' '; | c1=' '; | ||
| - | /*O sinon revenir en | + | /*O sinon revenir en arrière */ |
else | else | ||
{ /*S*/ | { /*S*/ | ||
| - | + | ungetc(c1,pnfile); | |
| - | + | c1='\\'; | |
} /*S*/ | } /*S*/ | ||
} /*S*/ | } /*S*/ | ||
| Ligne 83 : | Ligne 241 : | ||
/*O si codes[0]=0 (all chars) ou si suivi par c2 (char code utilisateur) */ | /*O si codes[0]=0 (all chars) ou si suivi par c2 (char code utilisateur) */ | ||
c2=getc(pnfile); | c2=getc(pnfile); | ||
| - | if ( | + | if ( codes[0] == 0 || |
c2 == codes[0] || | c2 == codes[0] || | ||
c2 == codes[1] || | c2 == codes[1] || | ||
| Ligne 92 : | Ligne 250 : | ||
/*O alors: */ | /*O alors: */ | ||
{ /*S comment*/ | { /*S comment*/ | ||
| - | /*O | + | /*O repérer la position commentaire */ |
| - | ungetc(c2,pnfile); | + | //w ungetc(c2,pnfile); |
ll=ftell(pnfile); | ll=ftell(pnfile); | ||
| - | /*O si option n | + | /*O si option n insérer le numéro de ligne */ |
if(n) | if(n) | ||
{ /*S*/ | { /*S*/ | ||
| Ligne 101 : | Ligne 259 : | ||
if(s) printf( "%5d ", num ); | if(s) printf( "%5d ", num ); | ||
} /*S*/ | } /*S*/ | ||
| + | /*O se positionner en dédut de ligne */ | ||
| + | fseek(pnfile,nl,0); | ||
| + | /*w ou: fseek(pnfile,(nl-ftell(pnfile)),1); */ | ||
| + | |||
/*O si pas option t */ | /*O si pas option t */ | ||
if(!t) | if(!t) | ||
{ /*S*/ | { /*S*/ | ||
| - | |||
| - | |||
| - | |||
/*O copier toute la ligne tq pas LF, dans le fichier doc */ | /*O copier toute la ligne tq pas LF, dans le fichier doc */ | ||
| - | while ( (c1=getc(pnfile)) != '\n') | + | while ( (c1=getc(pnfile)) != '\n' && c1 !=EOF) |
{ /*S*/ | { /*S*/ | ||
| - | + | putc(c1,pfdoc); | |
| - | + | if(s)putch(c1); | |
} /*S*/ | } /*S*/ | ||
| + | if (c1==EOF) break; | ||
} /*S*/ | } /*S*/ | ||
| + | |||
/*O sinon: */ | /*O sinon: */ | ||
| - | + | if(t) /*P option t */ | |
| - | { /*S*/ | + | { /*S t */ |
| - | /*O copier | + | /*O copier le début de ligne avec des tabulations et des espaces */ |
| - | for( | + | for(lc=nl;lc<ll;lc++) |
| - | { /*S*/ | + | { /*S first */ |
| - | + | c1=getc(pnfile); | |
| - | + | if (c1==EOF) break; | |
| - | + | //if(t) | |
| - | + | { /*S t */ | |
| - | + | if (c1=='\t') | |
| - | + | { | |
| - | + | putc('\t',pfdoc); // tab to target | |
| - | + | if(s)putch('\t'); // tab to stdout | |
| - | + | } | |
| - | + | else | |
| - | /*O | + | { |
| - | while ( (c1=getc(pnfile)) != '\n' ) | + | putc(' ',pfdoc); // blank to target |
| + | if(s)putch(' '); // blank to stdout | ||
| + | } | ||
| + | } /*S t */ | ||
| + | } /*S first */ | ||
| + | /*O copier la suite du commentaire jusqu'à la nouvelle ligne */ | ||
| + | while ( (c1=getc(pnfile)) != '\n' && c1!=EOF ) | ||
{ /*S*/ | { /*S*/ | ||
/*O copier le commentaire ( y compris '\r' sous DOS ) */ | /*O copier le commentaire ( y compris '\r' sous DOS ) */ | ||
| - | putc(c1,pfdoc); | + | { |
| - | + | putc(c1,pfdoc); | |
| + | if(s)putch(c1); | ||
| + | } | ||
} /*S*/ | } /*S*/ | ||
| + | if(c1==EOF) break; | ||
} /*S*/ | } /*S*/ | ||
| - | putc( c1, pfdoc); if(s) putch( c1 ); / | + | putc( c1, pfdoc); // c1=NL |
| - | ungetc(c1,pnfile); | + | if(s) putch( c1 ); // copier NL */ |
| + | ungetc(c1,pnfile); // revenir sur NL | ||
} /*S comment */ | } /*S comment */ | ||
/*O sinon: */ | /*O sinon: */ | ||
else | else | ||
{ | { | ||
| - | + | ungetc(c2,pnfile); | |
} | } | ||
} /*S char = # */ | } /*S char = # */ | ||
| Ligne 151 : | Ligne 322 : | ||
} /*S tq !EOF */ | } /*S tq !EOF */ | ||
</pre> | </pre> | ||
| + | {{Boîte déroulante/fin}} | ||
| + | |||
| + | == Fichier de commande des tests == | ||
| + | {{Boîte déroulante/début|titre=MAKE_Tests_U, CLEAN_Tests_U}} | ||
| + | * MAKE_Tests_U | ||
| + | <pre style="color:blue"> | ||
| + | #!/bin/bash | ||
| + | #O ../../mkd tests under Linux. | ||
| + | #O Epreuve de vérification de la fonction cpp_() avec ../../mkd | ||
| + | |||
| + | #O Copy Test_cpp_U.cc in target created file | ||
| + | cat MAKE_Tests_cpp_U > Tests_cpp_U.tstshell | ||
| + | |||
| + | #O Test options -nstv with source "MAKE_Tests_cpp_U" and target "*.tstshell" | ||
| + | #O - and screen redirection to tstshell.screen | ||
| + | |||
| + | #O 1: Test de l'option -s append target | ||
| + | echo "------------------------------------------------------------------" >> Tests_cpp_U.tstshell | ||
| + | echo "1: Test de l'option -s append target" >> Tests_cpp_U.tstshell | ||
| + | ../../mkd -savS O MAKE_Tests_cpp_U *.tstshell > tstshell.screen | ||
| + | |||
| + | #O 1: Test option -t | ||
| + | echo "------------------------------------------------------------------" >> Tests_cpp_U.tstshell | ||
| + | echo "1: Test option -t" >> Tests_cpp_U.tstshell | ||
| + | ../../mkd -tavS O MAKE_Tests_cpp_U *.tstshell # >> tstshell.screen | ||
| + | |||
| + | #O 1: Test option -n, with append files target and screen | ||
| + | echo "------------------------------------------------------------------" >> Tests_cpp_U.tstshell | ||
| + | echo "1: Test option -n, with append files target and screen" >> Tests_cpp_U.tstshell | ||
| + | ../../mkd -navS O MAKE_Tests_cpp_U *.tstshell # >> tstshell.screen | ||
| + | |||
| + | #O 2: Test options -ns, with append files target and screen | ||
| + | echo "------------------------------------------------------------------" >> Tests_cpp_U.tstshell | ||
| + | echo "------------------------------------------------------------------" >> Tests_cpp_U.tstshell | ||
| + | echo "------------------------------------------------------------------" >> Tests_cpp_U.tstshell | ||
| + | echo "2: Test options -ns, with append files target and screen" >> Tests_cpp_U.tstshell | ||
| + | ../../mkd -nsavS O MAKE_Tests_cpp_U *.tstshell >> tstshell.screen | ||
| + | |||
| + | #O 2: Test options -nt, with append files target and screen | ||
| + | echo "------------------------------------------------------------------" >> Tests_cpp_U.tstshell | ||
| + | echo "2: Test options -nt, with append files target and screen" >> Tests_cpp_U.tstshell | ||
| + | ../../mkd -ntavS O MAKE_Tests_cpp_U *.tstshell >> tstshell.screen | ||
| + | |||
| + | #O 2: Test options -nst, with append files target and screen | ||
| + | echo "------------------------------------------------------------------" >> Tests_cpp_U.tstshell | ||
| + | echo "2: Test options -nst, with append files target and screen" >> Tests_cpp_U.tstshell | ||
| + | ../../mkd -nstavS O MAKE_Tests_cpp_U *.tstshell >> tstshell.screen | ||
| + | |||
| + | #O 5: Independant test with -nstv "Test_cpp_U.cc" and target "*.tstshelllastline" | ||
| + | ../../mkd -nstvwS T MAKE_Tests_cpp_U tstshelllastline > tstshelllastline.screen | ||
| + | |||
| + | #O 5: Independant test with -nstv "Test_cpp_U.c2" and target file "*.tstshelllastline" | ||
| + | ../../mkd -nsvaS '**' MAKE_Tests_cpp_U tstshelllastline >> tstshelllastline.screen | ||
| + | |||
| + | |||
| + | |||
| + | #O Break with gedit "Tests_cpp_U.tstshell", "tstshell.screen" | ||
| + | gedit Tests_cpp_U.tstshell tstshell.screen tstshelllastline tstshelllastline.screen | ||
| + | |||
| + | |||
| + | #T test tab and lastline | ||
| + | </pre> | ||
| + | |||
| + | * CLEAN_Tests_U | ||
| + | <pre style="color:orange"> | ||
| + | #!/bin/dash | ||
| + | #O File Tests_Clean | ||
| + | #O Force delete files created with mkd "tests" under Linux. | ||
| + | rm -f Tests_cpp_U.tstshell | ||
| + | rm -f tstshell.screen | ||
| + | rm -f tstshelllastline | ||
| + | rm -f tstshelllastline.screen | ||
| + | rm -f *.doc | ||
| + | </pre> | ||
| + | {{Boîte déroulante/fin}} | ||
| + | |||
| + | == Analyse des tests Konsole == | ||
| + | {{Boîte déroulante/début|titre=Analysis 2013-05-09}} | ||
| + | <pre style="color:black"> | ||
| + | Fichier Analysis texte UTF-8 | ||
| + | Analyse du : 9 mai 2013 par Clara pour le retour à la conception détaillée. | ||
| + | ------------------------------------------------------------------------------- | ||
| + | Résultats du test unitaire de la fonction shell_() du fichier shell.c intégrée | ||
| + | à la commande mkd 2013 alpha 05 | ||
| + | . | ||
| + | Ce test est effectué avec la version mkd 2013 alpha pour évaluer les | ||
| + | modifications à effectuer dans la version alpha 2013. | ||
| + | . | ||
| + | D'après les directives et les fichiers d'analyse Tests_cpp_U.tstshell, | ||
| + | tstshell.screen, tstshelllastline et tstshelllastline.screen | ||
| + | . | ||
| + | Directives de tests unitaires version alpha 2013: | ||
| + | ------------------------------------------------- | ||
| + | 1: Vérifiez les options n, s et t séparément: | ||
| + | - les essais séparés fonctionnent correctement et sont conformes | ||
| + | . | ||
| + | 2: Vérifiez que la numérotation des lignes est correcte dans tous les cas de | ||
| + | décodage des lignes. n, ns. nt, nst. | ||
| + | - Les essais réalisés ont été conformes | ||
| + | . | ||
| + | 3: Vérifiez que le texte reste à la bonne place dans tous les cas de décodage: | ||
| + | toute la ligne (dans la cas de la directive de compilation FULL_LINE), ou | ||
| + | texte seul. | ||
| + | - Le résultat est conforme (Sans de numérotation des lignes) | ||
| + | . | ||
| + | 4: -- Vérifiez que les tabulations sont bien prises en charge dans tous les | ||
| + | cas d'extraction des lignes. | ||
| + | -- Vérifiez de même pour les espaces. | ||
| + | - Les résultas sont conformes. Il est à noter que les tabulations créent un | ||
| + | décalage du texte avec l'option -n numéroation | ||
| + | . | ||
| + | 5: La fonction doit être éprouvée de telle sorte qu'un commentaire qui se | ||
| + | termine par le caractère de fin de fichier soit entièrement copié dans le | ||
| + | fichier cible. | ||
| + | Le caractère de fin de fichier décodé avant le(les) caractère(s) de fin de | ||
| + | commentaire doit être remplacé par un caractère de fin de ligne 0xOA. | ||
| + | - Le fichier tstshelllastline commentaire ligne; fait apparaître | ||
| + | une fin de fichier conforme. | ||
| + | . | ||
| + | 6: Le caractère de fin de fichier (EOF) NE DOIT JAMAIS APPARAÎTRE DANS LE | ||
| + | TEXTE DU FICHIER CIBLE. | ||
| + | Ceci provoquait un bug dans la version Alpha de l'application fenêtrée | ||
| + | mkdcppw à l'étape du test d'intégration. | ||
| + | - La réponse est incluse dans les tests 5: | ||
| + | - Nous avons constaté que EOF est précédé du caractère OxOA (New Line) | ||
| + | - Tous les caractères sont recopiés octets par octets. La commande mkd | ||
| + | ignore le format du texte recopié. Il n'en est pas de même pour mkdcppw | ||
| + | qui ne reconnaît que les caractères UTF-8 nécessaires à l'impression. | ||
| + | . | ||
| + | 7: La fin de fichier a été testée avec les codes '**' et le caractère 0xOA | ||
| + | précède bien la fin du fichier sans retour à la ligne. | ||
| + | Le caractère # à l'itérieur d'une chaîne de caractères n'est pas interprété | ||
| + | comme un début de commentaire conformémént aux directives. | ||
| + | De même,\#T n'est pas interprété par mkd comme étant un commentaire shell. | ||
| + | </pre> | ||
| + | {{Boîte déroulante/fin}} | ||
| + | |||
| + | == Fichier source des tests == | ||
| + | {{Boîte déroulante/début|titre=MAKE_Tests_cpp_U}} | ||
| + | <pre style="color:blue"> | ||
| + | #!/bin/bash | ||
| + | #O ../../mkd tests under Linux. | ||
| + | #O Epreuve de vérification de la fonction cpp_() avec ../../mkd | ||
| + | |||
| + | #O Copy Test_cpp_U.cc in target created file | ||
| + | cat Test_cpp_U.cc > Test_cpp_U.tstcpp | ||
| + | |||
| + | #O Test options -nstv with source "Test_cpp_U.cc" and target "*.tstcpp" | ||
| + | #O - and screen redirection to tstcpp.screen | ||
| + | |||
| + | #O 1: Test de l'option -s append target | ||
| + | echo "------------------------------------------------------------------" >> Test_cpp_U.tstcpp | ||
| + | echo "1: Test de l'option -s append target" >> Test_cpp_U.tstcpp | ||
| + | ../../mkd -savC T Test_cpp_U.cc *.tstcpp > tstcpp.screen | ||
| + | |||
| + | #O 1: Test option -t | ||
| + | echo "------------------------------------------------------------------" >> Test_cpp_U.tstcpp | ||
| + | echo "1: Test option -t" >> Test_cpp_U.tstcpp | ||
| + | ../../mkd -tavC T Test_cpp_U.cc *.tstcpp # >> tstcpp.screen | ||
| + | |||
| + | #O 1: Test option -n, with append files target and screen | ||
| + | echo "------------------------------------------------------------------" >> Test_cpp_U.tstcpp | ||
| + | echo "1: Test option -n, with append files target and screen" >> Test_cpp_U.tstcpp | ||
| + | ../../mkd -navC T Test_cpp_U.cc *.tstcpp # >> tstcpp.screen | ||
| + | |||
| + | #O 2: Test options -ns, with append files target and screen | ||
| + | echo "------------------------------------------------------------------" >> Test_cpp_U.tstcpp | ||
| + | echo "------------------------------------------------------------------" >> Test_cpp_U.tstcpp | ||
| + | echo "------------------------------------------------------------------" >> Test_cpp_U.tstcpp | ||
| + | echo "2: Test options -ns, with append files target and screen" >> Test_cpp_U.tstcpp | ||
| + | ../../mkd -nsavC T Test_cpp_U.cc *.tstcpp >> tstcpp.screen | ||
| + | |||
| + | #O 2: Test options -nt, with append files target and screen | ||
| + | echo "------------------------------------------------------------------" >> Test_cpp_U.tstcpp | ||
| + | echo "2: Test options -nt, with append files target and screen" >> Test_cpp_U.tstcpp | ||
| + | ../../mkd -ntavC T Test_cpp_U.cc *.tstcpp >> tstcpp.screen | ||
| + | |||
| + | #O 2: Test options -nst, with append files target and screen | ||
| + | echo "------------------------------------------------------------------" >> Test_cpp_U.tstcpp | ||
| + | echo "2: Test options -nst, with append files target and screen" >> Test_cpp_U.tstcpp | ||
| + | ../../mkd -nstavC T Test_cpp_U.cc *.tstcpp >> tstcpp.screen | ||
| + | |||
| + | #O 5: Independant test with -nstv "Test_cpp_U.cc" and target "*.tstcpplastline1" | ||
| + | ../../mkd -nstvwC S Test_cpp_U.cc *.tstcpplastline1 > tstcpplastline.screen1 | ||
| + | |||
| + | #O 5: Independant test with -nstv "Test_cpp_U.c2" and target file "*.tstcpplastline2" | ||
| + | ../../mkd -nstvwC T Test_cpp_U.c2 *.tstcpplastblock > tstcpplastblock.screen2 #w bug ? | ||
| + | |||
| + | #O 5: Independant test with -nstv "Test_cpp_U.c3" and target file "*.tstcpplastline2" | ||
| + | ../../mkd -nstvaC T Test_cpp_U.c3 *.tstcpplastblock >> tstcpplastblock.screen2 #w bug ? | ||
| + | |||
| + | #O 5: Independant test with -nstv "Test_cpp_U.c4" and target file "*.tstcpplastline2" | ||
| + | ../../mkd -nstvaC T Test_cpp_U.c4 *.tstcpplastblock >> tstcpplastblock.screen2 #w bug ? | ||
| + | |||
| + | |||
| + | #O Break with gedit "Test_cpp_U.tstcpp", "tstcpp.screen" | ||
| + | gedit Test_cpp_U.tstcpp tstcpp.screen Test_cpp_U.tstcpplastline1 tstcpplastline.screen1 Test_cpp_U.tstcpplastblock tstcpplastblock.screen2 | ||
| + | |||
| + | "#T chaîne " #T "#T" n'est pas reconnu comme un commentaire | ||
| + | \#T n'est pas interprété comme étant un commentaire par mkd | ||
| + | #TTest 2 tabs and lastline without NL | ||
| + | </pre> | ||
| + | {{Boîte déroulante/fin}} | ||
| + | |||
[[Catégorie:Générateurs de documentation]] | [[Catégorie:Générateurs de documentation]] | ||
Version actuelle en date du 11 mai 2013 à 13:48
Retour aux fichiers en développement →
Sommaire[masquer] |
Fichiers de la fonction shell_()
Ce programme copie les commentaires des lignes contenant le caractère # suivi par un des caractères 'Codes' entrés en paramètre. Si le caractère '#' est précédé de \ ou si il est intégré dans une chaîne, alors il n'est pas considéré comme début de commentaire.

