Projet mkd/pascal.c

De Wiki EELL.

(Différences entre les versions)
m
m (Fichiers de la fonction pascal_() : Mise à jour)
 
(5 versions intermédiaires masquées)
Ligne 1 : Ligne 1 :
<small>[[Projet mkd/Fichiers en développement|Retour aux fichiers en développement &rarr;]]</small>
<small>[[Projet mkd/Fichiers en développement|Retour aux fichiers en développement &rarr;]]</small>
-
: pascal.inc.c : Ce fichier est à revoir, il n'est pas indépendant
 
-
<pre>
 
-
/*E �C�*/
 
-
/** #########################################
 
-
    #                PASCAL                #
 
-
    ######################################### */
 
-
/*  maj R3.0  09/06/89 */
 
-
/*P maj R3.1  30/12/90 par JPL */
 
-
/*P maj R3.11 09/01/91 par JPL */
 
-
void pascal_(FILE * pfdoc, FILE * pnfile)
+
Prise en compte des parenthèse curly { } et des parenthèses étoilées (* *).<br />
-
// FILE *pfdoc, *pnfile;
+
Les commentaires peuvent être imbriqués mais pas accolés pour la même commande d'extraction.
-
    { /*S pascal */
+
-
    extern unsigned char l,n,p,s,t; /*P rappels */
+
-
    extern char codes[];
+
-
    unsigned int i, tab;
+
-
    unsigned num;
+
-
    long ll,nl;
+
-
    register int c1;
+
-
    int c2,c3;
+
-
     num = 0;
+
Take into account the curly { } and starry (* *) brackets.<br />
-
     c1 = c2 = c3 = STX; /* Start Text */
+
Comments can be nested but non-contiguous for the same extraction command.
 +
 
 +
== Fichiers de la fonction pascal_() ==
 +
{{Boîte déroulante/début|titre=pascal.c,pascal.cc,pascal.inc.cc}}
 +
<pre style="color:red">
 +
/*P
 +
FILE NAME: pascal.c for konsole pascal.cc for individual compilation in
 +
  c++ or pascal.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 Update
 +
Date: 30/12/1990 by JPL Udate for R3.11
 +
Date: 09/01/1991 by JPL mkdoc 3.11 for PC and UNIX
 +
Date: 12/02/1991 by JPL mkdoc 3.12 for PC and UNIX
 +
...
 +
Date: 06/05/2013 by Clara update for R 2013-05
 +
 
 +
*/
 +
// Date: ../../.... by ... purpose of the modification ....
 +
 
 +
/*T
 +
FILE NAME: pascal.c for konsole pascal.cc for individual compilation in
 +
  c++ or pascal.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 pascal_
 +
-----------------------------------------------------------------------------
 +
FILE NAME: pascal.c for konsole pascal.cc for individual compilation in
 +
  c++ or pascal.inc.cc to include file in sources files with gtkmm
 +
 
 +
FUNTION NAME:
 +
  pascal_
 +
 +
SYNOPSIS, SYNTAX:
 +
  #include "/usr/include/mkd/version.h"    // IMPORTANT: Compilation directives
 +
  #include "/usr/include/mkd/pascal.h"    // or mkd.h
 +
  int pascal_(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 pascal_ 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:
 +
   
 +
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 April 2013
 +
 
 +
BUGS:
 +
  See bugs reports http://edeulo.free.fr/phpBB3
 +
 
 +
SEE ALSO MANUAL:
 +
  Man(3) attached in English.
 +
  Command line : man 3 pascal_
 +
 +
*/
 +
 
 +
/*H 
 +
// File: pascal.c (Comments for UTF-8 text editor)
 +
void pascal_ (FILE * pfdoc, FILE * pnfile);
 +
*/
 +
</pre>
 +
<pre style="color:blue">
 +
#include "version.h"
 +
#include "pascal.h"
 +
 
 +
void pascal_ (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 pascal */
 +
        extern unsigned char l,n,p,s,t; /*P rappels */
 +
        extern char codes[];
 +
        unsigned int i;
 +
        unsigned num, curly; // curly brace = '{'
 +
        long ll,nl;
 +
        register int c1;
 +
        int c2,c3;
 +
/*O    initialisation des variables */
 +
        num = 0;
 +
        curly = 0;
 +
        c1 = c2 = c3 = STX; /* Start Text */
/*O    tant que pas fin de fichier source */
/*O    tant que pas fin de fichier source */
         while ( c1 != EOF && c2 != EOF && c3 != EOF )
         while ( c1 != EOF && c2 != EOF && c3 != EOF )
         { /*S tq !EOF */
         { /*S tq !EOF */
 +
//O ----GET NEXT CHAR ---------------------------------------------------------
 +
/*O      si debut de texte faire c1=LF */
/*O      si debut de texte faire c1=LF */
           if (c1==STX) c1='\n';
           if (c1==STX) c1='\n';
Ligne 32 : Ligne 199 :
           else c1=getc(pnfile);
           else c1=getc(pnfile);
/*O      si le char est NL : */
/*O      si le char est NL : */
 +
          if (c1==EOF) break;
           if(c1=='\n')
           if(c1=='\n')
           { /*S*/
           { /*S*/
-
/*O          incr‚menter le num‚ro de ligne */
+
/*O          incrémenter le numéro de ligne */
               num++;
               num++;
-
/*O          reperer la position suivant NL dans nl et mettre nb tabulations 0 */
+
/*O          repérer la position suivant NL dans nl et mettre nb tabulations à 0 */
               nl=ftell(pnfile);
               nl=ftell(pnfile);
-
              tab=0;
 
           } /*S*/
           } /*S*/
-
/*O------ decodage Pascal ---------------------------------------------------*/
+
//O ----FIND IF NEXT CHAR BEGIN A COMMENT -------------------------------------
-
/*O         si le char est '{' ou si le char est '(' suivi de '*' */
+
 
-
              if( (c1=='{') || (c1=='(' && (c2=getc(pnfile))=='*') )
+
/*O       si le char est '{' ou si le char est '(' suivi de '*' */
-
/*O         alors: */
+
          if( c1=='{' || (c1=='(' && (c2=getc(pnfile))=='*') )
-
              { /*S char = d‚but commentaire */
+
/*O       décoder le commentaire */
 +
          { /*S char = début commentaire */
               c3=getc(pnfile);
               c3=getc(pnfile);
-
/*O             si codes[0]=0 ou si d‚but de commentaire est suivi par c3 char code utilisateur */
+
/*O         si codes[0]=0 ou si le début de commentaire est suivi par 'Code' d'extraction */
-
                if(!codes[0]||
+
              if(!codes[0]||
-
                    c3 == codes[0] ||
+
                c3 == codes[0] ||
-
                    c3 == codes[1] ||
+
                c3 == codes[1] ||
-
                    c3 == codes[2] ||
+
                c3 == codes[2] ||
-
                    c3 == codes[3] ||
+
                c3 == codes[3] ||
-
                    c3 == codes[4]
+
                c3 == codes[4]
-
                  )
+
                )
-
/*O          alors: */
+
/*O          alors, extraire le commentaire */
-
                { /*S traiter le commentaire */
+
              { /*S traiter le commentaire */
-
/*O            reperer la position commentaire dans la ligne */
+
 
 +
//O ----YES THE COMMENT MUST BE EXTRACTED -------------------------------------
 +
 
 +
                if ( c1== '{' ) curly = 1;
 +
                else  curly = 0;
 +
                //T fprintf(pfdoc,"\ncurly = %d\n",curly); //T
 +
/*O            repérer la position commentaire dans la ligne */
                 if(!codes[0]) ungetc(c3,pnfile);
                 if(!codes[0]) ungetc(c3,pnfile);
                 ll=ftell(pnfile);
                 ll=ftell(pnfile);
-
/*O            si option n ins‚rer le num‚ro de ligne */
+
/*O            si option n insérer le numéro de ligne */
                 if(n)
                 if(n)
-
                    { /*S*/
+
                { /*S*/
                     fprintf(pfdoc,"%5d ",num);
                     fprintf(pfdoc,"%5d ",num);
                     if(s)  printf("%5d ",num);
                     if(s)  printf("%5d ",num);
-
                    } /*S*/
+
                } /*S*/
-
/*O            si pas option t */
+
/*O            se positionner en dédut de ligne */
-
                if(!t)
+
                fseek(pnfile,nl,0);
-
                    { /*S!t*/
+
                /*w ou: fseek(pnfile,(nl-ftell(pnfile)),1); */
-
/*O                se positionner en dedut de ligne */
+
/*O             copier la ligne jusqu'au commentaire, dans le fichier doc */
-
                    fseek(pnfile,nl,0);
+
                for(i=(int)(ll-nl);i>0;--i)
-
                    /*w ou: fseek(pnfile,(nl-ftell(pnfile)),1); */
+
                 { /*S beginning line */
-
/*O               copier la ligne jusqu'au commentaire, dans le fichier doc */
+
-
                    for(i=(int)(ll-nl);i>0;--i)
+
-
                      { /*S*/
+
-
                      c1=getc(pnfile);
+
-
                      putc(c1,pfdoc);
+
-
                      if(s)putch(c1);
+
-
                      } /*S*/
+
-
                    } /*S!t*/
+
-
/*O            sinon: (option t) */
+
-
                 else
+
-
                    { /*St*/
+
-
/*O                copier autant de tab que dans le source */
+
-
                    for(i=0;i<tab;i++)
+
-
                      { /*S*/
+
-
                      putc('\t',pfdoc);
+
-
                      if(s)putch('\t');
+
-
                      } /*S*/
+
-
/*O                puis copier des blancs jusqu'a la position commentaire */
+
-
                    for(i=(int)(ll-nl-tab);i>0;i--)
+
-
                      { /*S*/
+
-
                      putc(' ',pfdoc);
+
-
                      if(s)putch(' ');
+
-
                      } /*S*/
+
-
                    } /*St*/
+
 +
//O ----WRITE THE BEGINNING OF LINE -------------------------------------------
-
/*O               puis tq ne rencontre pas le char '}' ou '*' suivi de ')', copier le commentaire */
+
                    c1=getc(pnfile);
-
                    while ( !(
+
                    if (c1==EOF) break;
-
                                            (c1=getc(pnfile)) == '}' ||
+
                    if (t) // option t is true replace with spaces or tabs
-
                              ( c1=='*' && (c2=getc(pnfile)) == ')' )
+
                    { /*S t / */
-
                            ) )
+
                      if(c1=='\t') // tab
-
                    { /*S commentaire seul */
+
                      {
-
                      if (c1=='*') ungetc(c2,pnfile);
+
                          putc('\t',pfdoc); // tabulation
-
                       putc(c1,pfdoc);
+
                          if(s) putch('\t');
-
                      if(s)putch(c1);
+
                      }
-
/*O                   si option n et NL ajouter le num‚ro de ligne */
+
                      else // not tab
-
                      if(n && c1=='\n')
+
                      {
-
                      { /*S*/
+
                          putc(' ', pfdoc); // replace with space
 +
                          if(s) putch(' ');
 +
                      }
 +
                    } /*S t / */
 +
                      else // t not true: extract the full line
 +
                      {
 +
                          putc(c1,pfdoc);  // option t is not true
 +
                          if (s) putch(c1);
 +
                      }
 +
                } /*S beginning line */
 +
 
 +
//O ----EXTRACT THE BLOCK -----------------------------------------------------
 +
 
 +
/*O            tq ne rencontre pas '}' si curly vrai,
 +
                ou '*' suivi de ')', copier le commentaire */
 +
                //P C2 pas testé si curly vrai
 +
                while ( !(
 +
                            ( (c1=getc(pnfile)) == '}' && curly )  ||
 +
                            (c1=='*' && (c2=getc(pnfile)) == ')')
 +
                          )
 +
                      )
 +
                { /*S commentaire */
 +
                    if (c1=='*') ungetc(c2,pnfile); //w vérifier avec la ligne 299
 +
                    if (c1 == 0x0A)
 +
                    {
 +
                       c2=getc(pnfile);
 +
                      if (c2 == EOF) break;
 +
                      else ungetc(c2,pnfile); // rewind if it is not EOF
 +
                    }
 +
                    putc(c1,pfdoc);
 +
                    if(s)putch(c1);
 +
/*O               si option n et NL ajouter le numéro de ligne */
 +
                    if(n && c1=='\n')
 +
                    { /*S*/
                       num++;
                       num++;
-
                       fprintf(pfdoc,"%5d ",num);
+
                       fprintf(pfdoc,"%5d -",num);
                       if(s)  printf("%5d ",num);
                       if(s)  printf("%5d ",num);
-
                      } /*S*/
+
                    } /*S*/
-
                    } /*S commentaire seul */
+
                } /*S commentaire */
 +
//O ----EXTRACT THE END OF THE LINE ifdef FULL_LINE ---------------------------
-
#ifdef FULL_LINE     /*O *** FULL_LINE *** */
+
#ifdef FULL_LINE   /*O *** FULL_LINE *** */
-
/*O               si pas option t */
+
/*O             si pas option t */
-
                    if(!t)
+
                if(!t)
 +
                { /*S*/
 +
/*O                copier les chars y compris code fin de comm. jusqu'en fin de ligne */
 +
                    if(c1=='*') ungetc(c2,pnfile); //w vérifier avec la ligne 274
 +
                    ungetc(c1,pnfile);
 +
                    while ( (c1=getc(pnfile)) != '\n' && c1 != EOF )
                     { /*S*/
                     { /*S*/
-
/*O                  copier les chars y compris code fin de comm. jusqu'en fin de ligne */
 
-
                      if(c1=='*') ungetc(c2,pnfile);
 
-
                      ungetc(c1,pnfile);
 
-
                      while ( (c1=getc(pnfile)) != '\n' )
 
-
                      { /*S*/
 
                       putc(c1,pfdoc);
                       putc(c1,pfdoc);
                       if(s)putch(c1);
                       if(s)putch(c1);
-
                      } /*S*/
 
                     } /*S*/
                     } /*S*/
-
/*O               sinon (option t) */
+
                    if (c1 ==EOF) break;
-
                    else
+
                } /*S*/
-
#endif               /*O *** END FULL_LINE *** */
+
/*O             sinon (option t) */
 +
                else
 +
#endif         /*O *** END FULL_LINE *** */
 +
 
 +
//O ----END OF EXTRACT THE END OF THE LINE ifdef FULL_LINE,GO TO NEXT CHAR ----
 +
 
 +
                { /*S option t */
 +
/*O                aller au bout de la ligne sans copier, sauf les 'retour chariot' */
 +
                    while ( (c1=getc(pnfile)) != '\n' && c1 != EOF )
 +
                    if( c1=='\r' )
                     { /*S*/
                     { /*S*/
-
/*O                  aller au bout de la ligne sans copier, sauf les 'retour chariot' */
+
                       putc( c1, pfdoc );
-
                       while ( (c1=getc(pnfile)) != '\n' )
+
                      if(s) putch( c1 );
-
                          if( c1=='\r' )
+
-
                          { /*S*/
+
-
                            putc( c1, pfdoc );
+
-
                            if(s) putch( c1 );
+
-
                          } /*S*/
+
                     } /*S*/
                     } /*S*/
-
                     putc(c1,pfdoc);if(s)puts("");  /*O copier NL (Cr/Lf ‚cran)*/
+
                     if ( c1==EOF) break; // case of EOF followed by NL
-
                    ungetc(c1,pnfile);              /*O revenir sur NL */
+
                 } /*S option t */
-
                 } /*S traiter le commentaire */
+
-
/*O             sinon: */
+
                if (c1 == '\n')
-
                else
+
                { /*S NL */
-
                { /*S pas le cas commentaire */
+
                    putc(c1,pfdoc);    // copy NL to target file
 +
                    if(s)puts("");    // copy NL (Cr/Lf stdout)                   
 +
                    ungetc(c1,pnfile); // revenir sur NL
 +
                } /*S NL */
 +
              } /*S traiter le commentaire */
 +
 
 +
//O ----NO THE COMMENT MUST BE NOT EXTRACTED ----------------------------------
 +
 
 +
/*O          sinon: */
 +
              else
 +
              { /*S pas le cas commentaire */
                 ungetc(c3,pnfile);
                 ungetc(c3,pnfile);
                 if (c1=='(') ungetc( c2, pnfile );
                 if (c1=='(') ungetc( c2, pnfile );
-
                } /*S pas le cas commentaire */
+
              } /*S pas le cas commentaire */
-
              } /*S char = d‚but commentaire */
+
          } /*S char = début commentaire */
-
/*O          sinon: si char='\t' incrementer tab */
+
-
              else if(c1=='\t')tab++;
+
         } /*S tq !EOF */
         } /*S tq !EOF */
     } /*S pascal */
     } /*S pascal */
</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}}
 +
* Fichier MAKE_Tests_U
 +
<pre style color="black">
 +
#!/bin/bash
 +
#O ../../mkd tests under Linux.
 +
#O Epreuve de vérification de la fonction pas_() avec ../../mkd
 +
 +
#O    Copy trinoms.pas in target created file
 +
      cat trinoms.pas > trinoms.tstpas
 +
 +
#O    Test options -nstv with source "trinoms.pas" and target "*.tstpas"
 +
#O    - and screen redirection to tstpas.screen
 +
 +
#O 1: Test de l'option -s append target
 +
      echo "------------------------------------------------------------------" >> trinoms.tstpas
 +
      echo "1: Test de l'option -s append target" >> trinoms.tstpas
 +
      ../../mkd -savP DHOPS trinoms.pas *.tstpas > tstpas.screen
 +
 +
#O 1: Test option -t
 +
      echo "------------------------------------------------------------------" >> trinoms.tstpas
 +
      echo "1: Test option -t" >> trinoms.tstpas
 +
      ../../mkd -tavP DHOPS trinoms.pas *.tstpas # >> tstpas.screen
 +
 +
#O 1: Test option -n, with append files target and screen
 +
      echo "------------------------------------------------------------------" >> trinoms.tstpas
 +
      echo "1: Test option -n, with append files target and screen" >> trinoms.tstpas
 +
      ../../mkd -navP DHOPS trinoms.pas *.tstpas # >> tstpas.screen
 +
 +
#O 2: Test options -ns, with append files target and screen
 +
      echo "------------------------------------------------------------------" >> trinoms.tstpas
 +
      echo "------------------------------------------------------------------" >> trinoms.tstpas
 +
      echo "------------------------------------------------------------------" >> trinoms.tstpas
 +
      echo "2: Test options -ns, with append files target and screen" >> trinoms.tstpas
 +
      ../../mkd -nsavP DHOPS trinoms.pas *.tstpas >> tstpas.screen
 +
 +
#O 2: Test options -nt, with append files target and screen
 +
      echo "------------------------------------------------------------------" >> trinoms.tstpas
 +
      echo "2: Test options -nt, with append files target and screen" >> trinoms.tstpas
 +
      ../../mkd -ntavP DHOPS trinoms.pas *.tstpas >> tstpas.screen
 +
 +
#O 2: Test options -nst, with append files target and screen
 +
      echo "------------------------------------------------------------------" >> trinoms.tstpas
 +
      echo "2: Test options -nst, with append files target and screen" >> trinoms.tstpas
 +
      ../../mkd -nstavP DHOPS trinoms.pas *.tstpas >> tstpas.screen
 +
 +
#O 5: Independant test with -nstv "trinoms.pas" and target "*.tstpaslastline1"
 +
      ../../mkd -nstvwP S trinoms.pas *.tstpaslastline1 > tstpaslastline.screen1
 +
 +
#O 5: Independant test with -nstv "trinomsc2" and target file "*.tstpaslastline2"
 +
      ../../mkd -nstvwP DHOPS trinoms2.pas trinoms.tstpaslastblock > tstpaslastblock.screen2 #w bug ?
 +
 +
#O 5: Independant test with -nstv "trinomsc3" and target file "*.tstpaslastline2"
 +
      ../../mkd -nstvaP DHOPS trinoms3.pas trinoms.tstpaslastblock >> tstpaslastblock.screen2 #w bug ?
 +
 +
#O 5: Independant test with -nstv "trinomsc4" and target file "*.tstpaslastline2"
 +
      ../../mkd -nstvaP DHOPS trinoms4.pas trinoms.tstpaslastblock >> tstpaslastblock.screen2 #w bug ?
 +
 +
 +
#O    Break with gedit "trinoms.tstpas", "tstpas.screen"
 +
      gedit trinoms.tstpas tstpas.screen trinoms.tstpaslastline1 tstpaslastline.screen1 trinoms.tstpaslastblock tstpaslastblock.screen2
 +
 +
#w bug      gedit trinoms.pas.tstpaslastline2 #bug in version < 2012
 +
 +
#O    Erase trinoms.tstpas
 +
</pre>
 +
 +
* Fichier CLEAN_Tests_U
 +
<pre>
 +
#!/bin/bash
 +
#O File Tests_Clean
 +
#O Force delete files created with mkd "tests" under Linux.
 +
      rm -f trinoms.tstpas
 +
      rm -f tstpas.screen
 +
      rm -f trinoms.tstpaslastline1
 +
      rm -f tstpaslastline.screen1
 +
      rm -f trinoms.tstpaslastblock
 +
      rm -f tstpaslastblock.screen2
 +
      rm -f *.doc
 +
</pre>
 +
{{Boîte déroulante/fin}}
 +
 +
== Analyse des tests konsole ==
 +
 +
{{Boîte déroulante/début|titre=Analysis 2013-05-07}}
 +
<pre style color="black">
 +
Fichier Analysis texte UTF-8
 +
Analyse du : 7 mai 2013 par Clara pour le retour à la conception détaillée.
 +
-------------------------------------------------------------------------------
 +
Résultats du test unitaire de la fonction pascal_() du fichier pascal.c
 +
intégrée à la commande mkd 2013: version alpha
 +
.
 +
Ce test est effectué avec la version mkd 2013 alpha pour évaluer les
 +
modifications à effectuer dans cette même version.
 +
.
 +
    D'après les directives et les fichiers d'analyse trinoms.tstpas,
 +
    tstpas.screen, trinoms.tstlasline1, tstlaslinescreen1, trinom.tstlastbloc
 +
    tstlastblock.screen2
 +
.
 +
    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 (lignes et blocs). 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.
 +
    -- 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 test des blocs, fait apparaîre des résultats conformes en fin
 +
      de fichier avec différents blocs (*... sans NL, {... sans NL en fin de
 +
      fichier
 +
.
 +
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 commande ../../mkd -sP '**' trinoms2.pas permet aussi de contrôler les
 +
    commentaires imbrqués et la fin de fichier sur un commentaire non fermé.
 +
    - Les résultas sont conformes aux directives.
 +
</pre>
 +
{{Boîte déroulante/fin}}
 +
 +
== Fichiers sources des tests ==
 +
 +
{{Boîte déroulante/début|titre=trinoms*.pas}}
 +
 +
* Fichier trinoms.pas
 +
<pre style = "color:black">
 +
 +
(*D
 +
(1 tab) test de tabulation pour mkd
 +
  **************************************************************************
 +
  *                                                                        *
 +
  * PROJET: Tri de noms                                                    *
 +
  *                                                                        *
 +
  * Titre :                  Trinoms          Préfixe global: ....      *
 +
  *                                                                        *
 +
  * Programme de tri de trois noms par ordre alphabétique.                *
 +
  * Mises à Jour du Module:                                                *
 +
  *    26/11/90 par JPL                                                    *
 +
  *                                                                        *
 +
  **************************************************************************
 +
  * PROGRAMMATION :                                                        *
 +
  *                                                                        *
 +
  * Dossier de conception : cours de Monsieur Jean BARRIER                *
 +
  * Environnement : DOS 3.3, Turbo Pascal 5                                *
 +
  * Sauvegarde : B:\PF\TRINOMS.PAS                                        *
 +
  *                                                                        *
 +
  **************************************************************************
 +
  *                                                                        *
 +
  * VERSION :  Date    Auteur  Commentaire                                *
 +
  * ---------------------------------------------------------------------- *
 +
  * 1.0      26/11/90  JPL    Version d'essai et d'évaluation de turbo 5  *
 +
  **************************************************************************
 +
  * STRUCTURE DU MODULE :                                                  *
 +
  *                                                                        *
 +
  *  1: Environnement :                                                    *
 +
  *    1.1 : Variables Publiques.                                        *
 +
  *    1.2 : Variables Globales Privées.                                  *
 +
  *                                                                        *
 +
  *  2: Programme principal: test du module                                *
 +
  *                                                                        *
 +
  **************************************************************************
 +
*)
 +
 +
{D
 +
  **************************************************************************
 +
  *                                                                        *
 +
  *    1.1 : Variables Publiques.                                        *
 +
  *                                                                        *
 +
  **************************************************************************
 +
}
 +
  USES Crt;        {D}
 +
 +
 +
 +
 +
{H
 +
  **************************************************************************
 +
  *                                                                        *
 +
  *    1.2 : Variables Globales Privées.                                  *
 +
  *                                                                        *
 +
  **************************************************************************
 +
}
 +
  VAR              {H}
 +
      Nom1 : STRING; {H}
 +
      Nom2 : STRING; {H}
 +
      Nom3 : STRING; {H}
 +
 +
(*O
 +
  **************************************************************************
 +
  * * 2: Programme principal: test du module                              *
 +
  * *      Fonction :                                                    *
 +
  * *          Lire 3 noms commençant par des lettres differentes frappées *
 +
  * *          au clavier, puis les afficherà l'écran, dans l'ordre        *
 +
  * *          alphabétique                                                *
 +
  * *      Entrez  : 3 noms au clavier.                                  *
 +
  * *      Sortie  : affichage à l'écran, dans l'ordre alphabétique      *
 +
  **************************************************************************
 +
}
 +
(*O Trinoms *)
 +
    BEGIN {S Trinoms }
 +
(*O    afficher "entrer un nom : " *)
 +
        Write( 'entrer un nom : ' );
 +
(*O    lire Nom1 *)
 +
        ReadLn( Nom1 );
 +
(*O    afficher "encore un    : " *)
 +
        Write( 'encore un    : ' );
 +
(*O    lire Nom2 *)
 +
        ReadLn( Nom2 );
 +
(*O    afficher "un dernier    : " *)
 +
        Write( 'un dernier    : ' );
 +
(*O    lire Nom3 *)
 +
        ReadLn( Nom3 );
 +
 +
(*O    SI Nom1 < Nom2 et Nom1 < Nom3 *)
 +
        IF ( Nom1 < Nom2 ) AND ( Nom1 < Nom3 )
 +
(*O    ALORS : (Nom1 est le premier) *)
 +
        THEN
 +
        BEGIN {S}
 +
(*O      afficher Nom1 *)
 +
          Write( Nom1, ' ' );
 +
 +
(*P * * Variante 1 du SI ALORS SINON à utiliser avec modération : *)
 +
 +
(*O      SI Nom2 < Nom3 ALORS afficher Nom2 puis Nom3 SINON afficher Nom3 puis Nom2 *)
 +
          IF ( Nom2 < Nom3 ) THEN Writeln( Nom2, ' ', Nom3 ) ELSE Writeln( Nom3, ' ', Nom2 );
 +
 +
        END {S}
 +
 +
(*O    SINON : (Nom1 n'est pas le premier....) *)
 +
        ELSE
 +
        BEGIN {S}
 +
(*O      SI Nom2 < Nom3 *)
 +
          IF ( Nom2 < Nom3 )
 +
(*O      ALORS : *)
 +
          THEN
 +
          BEGIN {S then Nom2 < Nom3 }
 +
(*O          afficher Nom2 *)
 +
              Write( Nom2, ' ' );
 +
 +
(*P * * Variante 2 du SI ALORS SINON à éviter : *)
 +
 +
</pre>
 +
 +
* Fichier trinoms2.pas
 +
<pre style = "color:blue">
 +
{T Fichier trinoms2.pas Test de la dernière ligne }
 +
{S Essayer la commande ../../mkd -sP '**' trinoms2.pas }
 +
(*O Fin Trinoms *)
 +
{T (*O Commentaire imbriqué *) }
 +
(*T {O Commentaire imbriqué } *)
 +
    END. {S Trinoms
 +
</pre>
 +
 +
* Fichier trinoms3.pas
 +
<pre style = "color:red">
 +
{Test de la dernière ligne}
 +
(*O Fin Trinoms *)
 +
    END. (*S Trinom
 +
</pre>
 +
 +
* Fichier trinoms4.pas
 +
<pre style = "color:green">
 +
{Test de la dernière ligne}
 +
(*O Fin Trinoms *)
 +
    END. (*S Trinoms}
 +
</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:52

Retour aux fichiers en développement →

Prise en compte des parenthèse curly { } et des parenthèses étoilées (* *).
Les commentaires peuvent être imbriqués mais pas accolés pour la même commande d'extraction.

Take into account the curly { } and starry (* *) brackets.
Comments can be nested but non-contiguous for the same extraction command.

Sommaire

Fichiers de la fonction pascal_()

Fichier de commande des tests

Analyse des tests konsole

Fichiers sources des tests

Outils personnels