Projet mkd/mkd.c
De Wiki EELL.
(Différences entre les versions)
JPL (discuter | contributions) m (→cpp.c) |
JPL (discuter | contributions) m (Pas fini mis en commentaire) |
||
(5 versions intermédiaires masquées) | |||
Ligne 1 : | Ligne 1 : | ||
- | {{Modèle:Pas fini/autre}} | + | <!--{{Modèle:Pas fini/autre}}--> |
<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> | ||
== version.h == | == version.h == | ||
- | <pre> | + | {{Boîte déroulante/début|titre=version.h Updated 11 may 2013}} |
- | + | <pre style="color:red"> | |
/* | /* | ||
* © mkd, version 2009.12 et ultérieures | * © mkd, version 2009.12 et ultérieures | ||
Ligne 11 : | Ligne 11 : | ||
* Concédée sous licence EUPL, version 1.1 ou – dès leur approbation par la | * 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»). | * Commission européenne - versions ultérieures de l’EUPL (la «Licence»). | ||
- | * Vous ne pouvez utiliser la présente | + | * Vous ne pouvez utiliser la présente œuvre que conformément à la Licence. |
* Vous pouvez obtenir une copie de la Licence à l’adresse suivante: | * Vous pouvez obtenir une copie de la Licence à l’adresse suivante: | ||
* | * | ||
Ligne 27 : | Ligne 27 : | ||
PROJET INITIAL: mkd console linux & MSDOS | PROJET INITIAL: mkd console linux & MSDOS | ||
DOSSIER INITIAL : mkdoc3.12 Centre d'Electronique de Montpellier | DOSSIER INITIAL : mkdoc3.12 Centre d'Electronique de Montpellier | ||
- | PROGRAMMEUR: | + | PROGRAMMEUR: JPL |
DATE: 18/12/2009 | DATE: 18/12/2009 | ||
MODIFICATIONS: | MODIFICATIONS: | ||
- | le: | + | le: 09/01/2011 par JPL objet: Ajouté l'option de compilation pour MSDEV41 |
- | le: | + | le: 10/01/2012 par JPL objet: Ajouté la définition std_C pour compilation UNIX STD |
+ | le: 25/03/2012 par Clara objet: internationalisation | ||
+ | le: 27/03/2012 par jpl objet: internationalisation en utf-8 | ||
+ | le: 10/04/2013 par Cardabela: Modification mineure. Alignement des commentaires. | ||
+ | le: 11/05/2013 par jpl mise à jour des définitions CD* pour tri.c | ||
*/ | */ | ||
- | /*E | + | // le: ../../.. par .............. objet de la modification .... |
+ | |||
+ | /*E ?C?*/ | ||
/**# MKD.C ############################*/ /*H*/ | /**# MKD.C ############################*/ /*H*/ | ||
/*U UTILISATEURS */ /*H*/ | /*U UTILISATEURS */ /*H*/ | ||
Ligne 43 : | Ligne 49 : | ||
/**####################################*/ /*H*/ | /**####################################*/ /*H*/ | ||
- | //#define UNIX /*O UNIX version */ /* Delete this line for PC version */ | + | // define VERSION line 173 |
+ | |||
+ | #define UNIX /*O UNIX version */ /* Delete this line for PC version */ | ||
+ | //#define GTKMM /*O Version fenêtrée avec gtkmm pour mkdcppw uniquement */ | ||
#ifndef UNIX /*H*/ | #ifndef UNIX /*H*/ | ||
#define PC /*O version de compilation PC */ /*H*/ | #define PC /*O version de compilation PC */ /*H*/ | ||
- | /*#define PC_ONLY*/ /*H find_ ne | + | /*#define PC_ONLY*/ /*H find_ ne reconnaît pas: .s .f .p .sh .csh */ |
#define NL "\r\n" /*H*/ | #define NL "\r\n" /*H*/ | ||
- | #define VC10 | + | //#define VC10 /*O Microsoft Visual C 10.- */ |
+ | #define MSDEV41 | ||
#endif /*H*/ | #endif /*H*/ | ||
/*H*/ | /*H*/ | ||
#ifdef UNIX /*H*/ | #ifdef UNIX /*H*/ | ||
- | #define UNIX_ONLY | + | // #define UNIX_ONLY /*H find_ ne reconnaît pas: .BAS .PAS .FOR ... */ |
- | + | ||
#endif /*H*/ | #endif /*H*/ | ||
/*H*/ | /*H*/ | ||
/*H #D *************************************************************************************/ | /*H #D *************************************************************************************/ | ||
- | /*H *** #Define OPTIONS DE COMPILATION: options par | + | /*H *** #Define OPTIONS DE COMPILATION: options par défaut, redéfinissables: ************** |
(#D pour l'extraction des options de compilation en ligne avec l'option CD3='#') */ | (#D pour l'extraction des options de compilation en ligne avec l'option CD3='#') */ | ||
/*H****************** #Define 'l' (ligne) commence par #define en 1ère colonne : ***********/ | /*H****************** #Define 'l' (ligne) commence par #define en 1ère colonne : ***********/ | ||
- | #define CD1 '%' /*H #Define Option CD1 en | + | #define CD1 '%' /*H #Define Option CD1 en 1ère colonne prend fin avec NL */ |
- | #define CD2 ' | + | #define CD2 '<' /*H #Define Option CD2 en 1ère colonne prend fin avec NL */ |
- | #define CD3 ' | + | #define CD3 '!' /*H #Define Option CD3 dans la ligne prend fin avec NL */ |
+ | /*H #Define Option '!' commentaire Fortran 90 et ultérieurs */ | ||
/*H #Define Option '%' commentaire postcript */ | /*H #Define Option '%' commentaire postcript */ | ||
/*H #Define Option '#' commentaire shell ou pour Makefile voir option S | /*H #Define Option '#' commentaire shell ou pour Makefile voir option S | ||
- | + | ( le commentaire se termine avec new_line ) */ | |
/*H #Define Option '\'' commentaires Basic */ | /*H #Define Option '\'' commentaires Basic */ | ||
/*H #Define Option ';' commentaires assembleur */ | /*H #Define Option ';' commentaires assembleur */ | ||
Ligne 78 : | Ligne 88 : | ||
- | + | ||
- | + | /*H*/ | |
- | + | #define VERSION "13.05 alpha1" /*H*/ | |
- | + | /*H*/ | |
- | + | #define MAX 85 /*H longueur des buffers des path source et doc */ | |
- | + | #define STX 0x2 /*H Start Text */ | |
- | + | #include <stdio.h> /*H*/ | |
- | + | /*H*/ | |
- | + | #ifdef PC /*H*/ | |
- | + | #include <conio.h> /*H*/ | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | #define VERSION " | + | |
- | + | ||
- | #define MAX 85 | + | |
- | #define STX 0x2 | + | |
- | #include <stdio.h> | + | |
- | + | ||
- | #ifdef PC | + | |
- | #include <conio.h> | + | |
#include <process.h> /*H*/ | #include <process.h> /*H*/ | ||
- | #include <io.h> | + | #include <io.h> /*H*/ |
- | #endif | + | #endif /*H*/ |
- | #ifdef VC10 | + | #ifdef VC10 /*H Microsoft Visual C 10.- */ |
#define putch _putch /*H ISO C++ */ | #define putch _putch /*H ISO C++ */ | ||
#define getch _getch /*H ISO C++ */ | #define getch _getch /*H ISO C++ */ | ||
#define access _access /*H ISO C++ */ | #define access _access /*H ISO C++ */ | ||
- | #endif | + | #endif /*H*/ |
- | + | /*H*/ | |
- | #ifdef | + | #ifdef MSDEV41 /*H*/ |
- | /*#define getch() getchar()*/ | + | //#define STD_C /*H SVr4, 4.3BSD, C89, C99.*/ |
+ | #include <string.h> /*H*/ | ||
+ | #endif /*H*/ | ||
+ | /*H*/ | ||
+ | #ifdef UNIX /*H*/ | ||
+ | #define NL "\n" /*H*/ | ||
+ | #define exit return | ||
+ | #define bool int | ||
+ | //#define STD_C /*H SVr4, 4.3BSD, C89, C99.*/ | ||
+ | //#define getch() getchar()*/ defined in mkd.c | ||
#define putch putchar /*H*/ | #define putch putchar /*H*/ | ||
- | #include <signal.h> | + | #include <signal.h> /*H*/ |
#include <sys/file.h> /*H*/ | #include <sys/file.h> /*H*/ | ||
- | #endif | + | #include <string.h> /*H*/ |
+ | #endif /*H*/ | ||
</pre> | </pre> | ||
+ | {{Boîte déroulante/fin}} | ||
+ | == mkd.h == | ||
+ | <pre style="color:green"> | ||
+ | // asm.cpp: | ||
+ | extern int asm_(FILE *pfdoc, FILE *pnfile); | ||
+ | |||
+ | // File: basic.c | ||
+ | void basic_ (FILE * pfdoc, FILE * pnfile); | ||
- | + | ||
- | + | // File: cpp.c | |
- | / | + | extern int cpp_ (FILE * pfdoc, FILE * pnfile); |
- | + | ||
- | * | + | // File: fortran.c |
- | + | void fortran_ (FILE * pfdoc, FILE * pnfile); | |
- | * | + | |
- | + | // File: pascal.c (Comments for UTF-8 text editor) | |
- | + | void pascal_ (FILE * pfdoc, FILE * pnfile); | |
- | + | ||
- | + | ||
- | * | + | |
- | + | ||
- | * | + | |
- | + | ||
- | * | + | |
- | * | + | |
- | + | ||
- | + | ||
- | + | // File: shell.c (Comments for UTF-8 text editor) | |
- | + | void shell_ (FILE * pfdoc, FILE * pnfile); | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | // | + | // File: tri.c |
- | + | void tri_ (FILE * pfdoc, FILE * pnfile); | |
</pre> | </pre> | ||
+ | == mkd.c == | ||
+ | {{Boîte déroulante/début|titre=mkd.c ; Update 11 may 2013}} | ||
+ | <pre style="color:red"> | ||
+ | /*D | ||
+ | COPYRIGHT: | ||
+ | © Contact: http://edeulo.free.fr/contacts/formmail.php | ||
+ | © EELL, Éditeurs Européens de Logiciels Libres, 2007 | ||
+ | Association à but non lucratif selon l'Article 11 de la convention européenne | ||
+ | des droits de l'homme. | ||
- | + | AUTHORS: | |
- | + | Designer: intial JP Louyot (JPL) | |
- | + | Updates : JPL and Clara Jimenez | |
- | + | Tranlations: Alizée, Clara, JPL, JPT, Luca | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
*/ | */ | ||
- | |||
/*P | /*P | ||
NOM DU FICHIER: mkd.c | NOM DU FICHIER: mkd.c | ||
PROJET INITIAL: mkd console linux & Windows 7 | PROJET INITIAL: mkd console linux & Windows 7 | ||
DOSSIER INITIAL : mkdoc3.12 Centre d'Electronique de Montpellier | DOSSIER INITIAL : mkdoc3.12 Centre d'Electronique de Montpellier | ||
- | PROGRAMMEUR: | + | PROGRAMMEUR: Jean-Paul LOUYOT |
DATE: 18/12/2009 | DATE: 18/12/2009 | ||
MODIFICATIONS: | MODIFICATIONS: | ||
- | le: 10/03/2010 par JPL | + | le: 10/03/2010 par JPL : Mise à jour pour Visual C 10 |
- | le: | + | le: 25/03/2012 par Clara : internationalisation |
+ | le: 31/03/2012 par jpl : internationalisation. Conversion du fichier | ||
+ | au format UTF-8 | ||
+ | le: 18/04/2013 par jpl : mise à jour pour version 2013 alpha | ||
+ | le: 11/05/2013 par jpl : pour compilation avec les fichiers mis à jour | ||
*/ | */ | ||
+ | // le: ../../.. par | ||
+ | </pre> | ||
+ | <pre style="color:blue"> | ||
#include "version.h" | #include "version.h" | ||
#include "strings.h" | #include "strings.h" | ||
#include "mkd.h" | #include "mkd.h" | ||
- | + | #include "internationalisation.h" | |
unsigned char A,B,C,F,P,S,a,f,j,l,n,p,s,t,v,w; /*P ajout n et v version 3.1 */ | unsigned char A,B,C,F,P,S,a,f,j,l,n,p,s,t,v,w; /*P ajout n et v version 3.1 */ | ||
Ligne 286 : | Ligne 202 : | ||
- | // #include "asm.inc.c" | + | // #include "asm.inc.c" //P old version see asm.c |
- | #include "basic.inc.c" | + | // #include "basic.inc.c" //P old version see basic.c |
- | // #include "c.inc.c" | + | // #include "c.inc.c" //P old version see cpp.c |
- | #include "fortran.inc.c" | + | // #include "fortran.inc.c" //P old version see fortran.c |
- | #include "pascal.inc.c" | + | // #include "pascal.inc.c" //P old version see pascal.c |
- | #include "shell.inc.c" | + | // #include "shell.inc.c" //P old version see shell.c |
- | #include "tri.inc.c" | + | // #include "tri.inc.c" //P old version see tri.c |
- | int tolower( | + | int tolower(int c) |
// char c; | // char c; | ||
{ | { | ||
- | + | if( c >='A' && c <='Z' ) c=(c-'A')+'a'; | |
- | + | return(c); | |
} | } | ||
- | + | int toupper(int c) | |
- | int toupper( | + | |
// char c; | // char c; | ||
{ | { | ||
- | + | if( c >='a' && c <='z' ) c=(c-'a')+'A'; | |
- | + | return(c); | |
} | } | ||
- | |||
- | |||
#ifdef UNIX | #ifdef UNIX | ||
- | int getch() | + | int getch() |
{ | { | ||
- | + | int c; | |
- | + | c=getc(stdin); | |
- | + | if (c=='\r')c='\n'; | |
- | + | return(c); | |
} | } | ||
+ | #define exit return //P c++ | ||
#endif | #endif | ||
Ligne 331 : | Ligne 245 : | ||
- | int main (int argc, char * argv[]) | + | int main (int argc, char * argv[]) |
// int argc; | // int argc; | ||
// char *argv[]; | // char *argv[]; | ||
- | + | { /*S main */ | |
- | + | //O Internationalization Initialization | |
- | + | // i18n: initializes the entire current locale of the program as per | |
- | + | // environment variables set by the user | |
- | + | setlocale( LC_ALL, "" ); | |
- | + | // i18n: Indicate the path of the i18n catalog file | |
- | + | bindtextdomain( "mkd", "/usr/share/locale" ); | |
- | + | // i18n: sets the message domain | |
- | + | textdomain( "mkd" ); | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | char *fprj; // nom du fichier de projet s'il existe | |
- | + | char fdoc[MAX]; // nom du fichier cible | |
- | + | char fsrc[MAX]; // nom du fichier source | |
+ | extern char codes[]; // codes | ||
+ | extern unsigned char A,B,C,F,P,S,a,f,j,l,n,p,s,t,v,w; // booléennes | ||
+ | int i,k; // compteurs | ||
+ | char isource; // position nom du fichier source dans path source | ||
+ | char itarget; // position fin du path_target avec '*' ou ':'(PC) | ||
+ | char ktar; // position du '.' dans p_target | ||
+ | static char O; // booléen =1 si option validée | ||
+ | static char L; // booléen =1 si option langage | ||
+ | register int c; // char (variable) | ||
+ | int c1; // char (variable) pour version PC | ||
+ | int ret = 0; // essai | ||
+ | FILE *pfprj; // fichier de projet */ | ||
+ | FILE *pnfile; // fichier source | ||
+ | FILE *pfdoc; // fichier cible | ||
/*##########################################################################*/ | /*##########################################################################*/ | ||
/*O si argc < 3 ou arc > 5: */ | /*O si argc < 3 ou arc > 5: */ | ||
- | |||
/*##########################################################################*/ | /*##########################################################################*/ | ||
/*O alors ecrire 'USAGE', donner la syntaxe puis quitter */ | /*O alors ecrire 'USAGE', donner la syntaxe puis quitter */ | ||
- | + | if ( argc < 3 || argc > 5 ) | |
+ | { //S argc <3 ou argc > 5 : syntaxe | ||
#ifdef PC | #ifdef PC | ||
- | ret = printf("mkd PC version, Release %s, USAGE:\n",VERSION); | + | ret = printf(gettext("mkd PC version, Release %s, USAGE:\n"),VERSION); |
- | printf("syntax: mkd [-ABCFPSafjlnpstvw] char_codes path_source [path_target]\n"); | + | printf(gettext("syntax: mkd [-ABCFPSafjlnpstvw] char_codes path_source [path_target]\n")); |
- | puts (" or: mkd ? .See also mkd.doc or manual."); | + | puts (gettext(" or: mkd ? .See also mkd.doc or manual.")); |
#endif | #endif | ||
#ifdef UNIX | #ifdef UNIX | ||
- | printf(" | + | printf(gettext("mkd UNIX version, Release %s, USAGE:\n"),VERSION); |
- | printf("syntax: | + | printf(gettext("syntax: mkd [-ABCFPSafjlnpstvw] char_codes path_source [path_target]\n")); |
- | puts (" or: | + | puts (gettext(" or: mkd \\? .See also nanual: \'man mkd\'")); |
#endif | #endif | ||
if( argc==2 && argv[1][0]=='?' ) | if( argc==2 && argv[1][0]=='?' ) | ||
- | + | { //S argc=2 et ? | |
- | printf(" --> options:\n"); | + | printf(gettext(" --> options:\n")); |
- | printf(" -A decode Assembler comment style only\n"); | + | printf(gettext(" -A decode Assembler comment style only\n")); |
/* #ifndef UNIX_ONLY */ | /* #ifndef UNIX_ONLY */ | ||
- | printf(" -B Basic style\n"); | + | printf(gettext(" -B Basic style\n")); |
/* #endif */ | /* #endif */ | ||
- | printf(" -C C++ style\n"); | + | printf(gettext(" -C C++ style\n")); |
- | printf(" -F Fortran style\n"); | + | printf(gettext(" -F Fortran 77 style\n")); |
- | printf(" -P Pascal style\n"); | + | printf(gettext(" -P Pascal style\n")); |
/* #ifndef PC_ONLY */ | /* #ifndef PC_ONLY */ | ||
- | printf(" -S Shell style\n"); | + | printf(gettext(" -S Shell style\n")); |
/* #endif */ | /* #endif */ | ||
- | printf(" -a append target file\n"); | + | printf(gettext(" -a append target file\n")); |
- | printf(" -f:\n"); | + | printf(gettext(" -f:\n")); |
#ifndef UNIX_ONLY | #ifndef UNIX_ONLY | ||
- | printf(" find language ( .ASM .BAS .C .FOR .PAS .PRO )\n"); | + | printf(gettext(" find language ( .ASM .BAS .C .FOR .PAS .PRO )\n")); |
#endif | #endif | ||
#ifndef PC_ONLY | #ifndef PC_ONLY | ||
- | printf(" find language ( .s .S .c .h .i .f .F .r .p .sh .csh )\n"); | + | printf(gettext(" find language ( .s .S .c .h .i .f .F .r .p .sh .csh )\n")); |
#endif | #endif | ||
- | printf(" -j use only with project sources file.\n"); | + | printf(gettext(" -j use only with project sources file.\n")); |
- | printf(" -l and p; line: (compil.: %c or %c in first column or %c in line)\n",CD1,CD2,CD3); | + | printf(gettext(" -l and p; line: (compil.: %c or %c in first column or %c in line)\n"),CD1,CD2,CD3); |
- | printf(" page: (compil.: begin with %c and end with %c)\n",CD4,CD5); | + | printf(gettext(" page: (compil.: begin with %c and end with %c)\n"),CD4,CD5); |
- | printf(" -n insert line number\n"); | + | printf(gettext(" -n insert line number\n")); |
- | printf(" -s copy and add to screen\n"); | + | printf(gettext(" -s copy and add to screen\n")); |
- | printf(" -t copy the comment only\n"); | + | printf(gettext(" -t copy the comment only\n")); |
- | printf(" -v verbose\n"); | + | printf(gettext(" -v verbose\n")); |
- | printf(" -w overwrite (default option: switch off)\n"); | + | printf(gettext(" -w overwrite (default option: switch off)\n")); |
- | printf(" --> char_codes: all ASCII "); | + | printf(gettext(" --> char_codes: all ASCII ")); |
#ifdef PC | #ifdef PC | ||
- | printf("except space:' ' (5 char max)\n"); | + | printf(gettext("except space:' ' (5 char max)\n")); |
- | printf(" example codes = UM or *OPTw or *HOS or ** for all\n"); | + | printf(gettext(" example codes = UM or *OPTw or *HOS or ** for all\n")); |
#endif | #endif | ||
#ifdef UNIX | #ifdef UNIX | ||
- | printf(" (5 char max)\n"); | + | printf(gettext(" (5 char max)\n")); |
- | printf(" example codes = UM or \\*OPTw or '* HOS' or '**' for all\n"); | + | printf(gettext(" example codes = UM or \\*OPTw or '* HOS' or '**' for all\n")); |
#endif | #endif | ||
- | printf(" --> path_source: source file (option j: if it is a project file) \n"); | + | printf(gettext(" --> path_source: source file (option j: if it is a project file) \n")); |
- | printf(" --> path_target: target file\n"); | + | printf(gettext(" --> path_target: target file\n")); |
#ifdef UNIX | #ifdef UNIX | ||
- | printf("Example: | + | printf(gettext("Example: mkd -Csnv '*S' file.c \\*.verif_struct\n")); |
#endif | #endif | ||
#ifdef PC | #ifdef PC | ||
- | printf("Example: mkd -Cs *Snv file.c *.str\n"); | + | printf(gettext("Example: mkd -Cs *Snv file.c *.str\n")); |
#endif | #endif | ||
- | printf(".Exit 2\n"); | + | printf(gettext(".Exit 2\n")); |
- | exit(2); /* Pour un | + | exit(2); /* Pour un contrôle éventuel (make) */ |
- | + | } //S argc=2 et ? | |
- | + | } //S argc <3 ou argc > 5 : syntaxe | |
- | + | ||
- | /*O sinon | + | /*O sinon exécuter la suite de la commande: */ |
else | else | ||
{ /*S corps */ | { /*S corps */ | ||
Ligne 444 : | Ligne 365 : | ||
/*www n'est pas utile lorsque break est 'on' avant lancement de mkd | /*www n'est pas utile lorsque break est 'on' avant lancement de mkd | ||
- | + | éliminer cette procédure évite la recherche de command.com sur disque. | |
#ifdef PC | #ifdef PC | ||
c=system("BREAK ON"); | c=system("BREAK ON"); | ||
Ligne 452 : | Ligne 373 : | ||
/*O init fsrc & fdoc buffers */ | /*O init fsrc & fdoc buffers */ | ||
for(i=0;i<MAX;fsrc[i]='\0',fdoc[i]='\0',++i); | for(i=0;i<MAX;fsrc[i]='\0',fdoc[i]='\0',++i); | ||
- | /*O init options par | + | /*O init options par défaut */ |
{A=0;B=0;C=0;F=0;P=0;S=0;a=0;f=0;j=0;l=0;n=0,p=0;s=0;t=0;v=0;w=0;} /*O*/ | {A=0;B=0;C=0;F=0;P=0;S=0;a=0;f=0;j=0;l=0;n=0,p=0;s=0;t=0;v=0;w=0;} /*O*/ | ||
O=0; /* Option=0 */ | O=0; /* Option=0 */ | ||
Ligne 458 : | Ligne 379 : | ||
if (argc>3) | if (argc>3) | ||
{ /*S argc>3 */ | { /*S argc>3 */ | ||
- | /*O si en | + | /*O si en 2ème paramètre 1er char = '-' décoder les options */ |
if( argv[1][0]=='-') | if( argv[1][0]=='-') | ||
{ /*S*/ | { /*S*/ | ||
- | /*O initialiser les | + | /*O initialiser les paramètres du tant que */ |
O=1; /* Option=1 */ | O=1; /* Option=1 */ | ||
c=1; | c=1; | ||
i=1; | i=1; | ||
- | /*O tant que pas fin | + | /*O tant que pas fin paramètres options & (5 options max) */ |
while (c != '\0' && i < 13) | while (c != '\0' && i < 13) | ||
{ /*S*/ | { /*S*/ | ||
Ligne 490 : | Ligne 411 : | ||
if((L=A+B+C+F+P+S)>1) | if((L=A+B+C+F+P+S)>1) | ||
{ | { | ||
- | printf("Syntax error: Too many 'Language' options:\n"); | + | printf(gettext("Syntax error: Too many 'Language' options:\n")); |
- | printf(" A or B or C or...please.\n.Exit 2\n"); | + | printf(gettext(" A or B or C or...please.\n.Exit 2\n")); |
exit(2); | exit(2); | ||
} | } | ||
Ligne 505 : | Ligne 426 : | ||
if (a==1 && w==1) | if (a==1 && w==1) | ||
{ | { | ||
- | if (v) printf("Options a or w please... "); | + | if (v) printf(gettext("Options a or w please... ")); |
a=w=0; | a=w=0; | ||
} | } | ||
} /*S*/ | } /*S*/ | ||
- | /*wwwO sinon | + | /*wwwO sinon écrire Option syntax error (OPTION DE COMPILATION) */ |
/*www else {printf("Option '-' syntax error\n");exit(2);} */ | /*www else {printf("Option '-' syntax error\n");exit(2);} */ | ||
} /*S argc>3 */ | } /*S argc>3 */ | ||
Ligne 516 : | Ligne 437 : | ||
if(L && v) | if(L && v) | ||
{ /*SL*/ | { /*SL*/ | ||
- | /*O donner les options a l' | + | /*O donner les options a l'écran */ |
- | printf ("Force language comment, style "); | + | printf (gettext("Force language comment, style ")); |
- | if(A)printf("ASSEMBLER\n"); | + | if(A)printf(gettext("ASSEMBLER\n")); |
- | else if(B)printf("BASIC\n"); | + | else if(B)printf(gettext("BASIC\n")); |
- | else if(C)printf("C\n"); | + | else if(C)printf(gettext("C\n")); |
- | else if(F)printf("FORTRAN\n"); | + | else if(F)printf(gettext("FORTRAN\n")); |
- | else if(P)printf("PASCAL\n"); | + | else if(P)printf(gettext("PASCAL\n")); |
- | else if(S)printf("SHELL\n"); | + | else if(S)printf(gettext("SHELL\n")); |
} /*SL*/ | } /*SL*/ | ||
- | if (v) printf ("Options a=%d f=%d j=%d l=%d n=%d p=%d s=%d t=%d w=%d\n",a,f,j,l,n,p,s,t,w); | + | if (v) printf (gettext("Options a=%d f=%d j=%d l=%d n=%d p=%d s=%d t=%d w=%d\n"),a,f,j,l,n,p,s,t,w); |
/*###########################################################################*/ | /*###########################################################################*/ | ||
- | /*O si ( argc > 3 et Opt ) examiner les cas | + | /*O si ( argc > 3 et Opt ) examiner les cas *. *.* pour path_target="" */ |
/*###########################################################################*/ | /*###########################################################################*/ | ||
if (argc > 3+O && ((c=argv[O+3][0])=='.'||c=='*') ) | if (argc > 3+O && ((c=argv[O+3][0])=='.'||c=='*') ) | ||
- | { /*S cas | + | { /*S cas ramenés */ |
if(c=='*') | if(c=='*') | ||
{ /*S *. *.* */ | { /*S *. *.* */ | ||
Ligne 538 : | Ligne 459 : | ||
} /*S * */ | } /*S * */ | ||
else | else | ||
- | { /*S . */ /*P | + | { /*S . */ /*P même répertoire */ |
if(argv[O+3][1]=='\0')argc=O+3; | if(argv[O+3][1]=='\0')argc=O+3; | ||
/* Les cas '\*'.... sont examines plus loin */ | /* Les cas '\*'.... sont examines plus loin */ | ||
} /*S . */ | } /*S . */ | ||
- | } /*S cas | + | } /*S cas ramenés */ |
/*##########################################################################*/ | /*##########################################################################*/ | ||
/*O si argc<4 ou (argc<5 avec Options) | /*O si argc<4 ou (argc<5 avec Options) | ||
- | - ligne de commande " | + | - ligne de commande "mkd -options char_codes path" |
- | - ou " | + | - ou "mkd char_codes path" |
- | - (source et dest auront | + | - (source et dest auront même path avec suffixe différent) */ |
/*###########################################################################*/ | /*###########################################################################*/ | ||
if (argc<4+O) | if (argc<4+O) | ||
- | { /*S | + | { /*S même path */ |
- | /*O alors si j=1 fprj= | + | /*O alors si j=1 fprj=4ème argument de la ligne de commande */ |
if (j==1) fprj=argv[3]; /* fichier projet si j */ | if (j==1) fprj=argv[3]; /* fichier projet si j */ | ||
- | /*O fsrc=O+ | + | /*O fsrc=O+2ème arg. de la ligne de commande a copier dans fsrc */ |
{ /*S source */ | { /*S source */ | ||
k=0;isource=0; | k=0;isource=0; | ||
Ligne 574 : | Ligne 495 : | ||
else if(c=='*') | else if(c=='*') | ||
{ /*S*/ | { /*S*/ | ||
- | printf("Syntax error '*' in path_source.\n.Exit 2\n"); | + | printf(gettext("Syntax error '*' in path_source.\n.Exit 2\n")); |
exit(2); | exit(2); | ||
} /*S*/ | } /*S*/ | ||
Ligne 583 : | Ligne 504 : | ||
if (isource==1&&argv[O+2][1]==':') | if (isource==1&&argv[O+2][1]==':') | ||
{ /*S*/ | { /*S*/ | ||
- | printf("Arg. syntax error '\\:'\n.Exit 2 \n"); | + | printf(gettext("Arg. syntax error '\\:'\n.Exit 2 \n")); |
exit(2); | exit(2); | ||
} /*S*/ | } /*S*/ | ||
Ligne 591 : | Ligne 512 : | ||
if(f&&!j) | if(f&&!j) | ||
{ /*S*/ | { /*S*/ | ||
+ | // puts("\nTEST: f positionné et pas j ... rechercher avec find"); //T | ||
#include"find.inc.c" | #include"find.inc.c" | ||
Ligne 612 : | Ligne 534 : | ||
&& ((c=(fdoc[i+3]))=='c'||c=='C')) | && ((c=(fdoc[i+3]))=='c'||c=='C')) | ||
{ /*S*/ | { /*S*/ | ||
- | printf("Syntax error: path_source, suffixe '.doc'\n.Exit 2\n"); | + | printf(gettext("Syntax error: path_source, suffixe '.doc'\n.Exit 2\n")); |
exit(2); | exit(2); | ||
} /*S*/ | } /*S*/ | ||
Ligne 629 : | Ligne 551 : | ||
/*###########################################################################*/ | /*###########################################################################*/ | ||
/*O sinon si ( argc > 3 et Opt ) | /*O sinon si ( argc > 3 et Opt ) | ||
- | -ligne de commande " | + | -ligne de commande "mkd char_codes path_src path_target |
- | - ou " | + | - ou " mkd -options char_codes path_src path_target |
- | -(path doc et path src seront | + | -(path doc et path src seront différents) */ |
/*##########################################################################*/ | /*##########################################################################*/ | ||
else if (argc > 3+O) | else if (argc > 3+O) | ||
- | { /*S path | + | { /*S path différents */ |
/*O copier les noms de fichier: */ | /*O copier les noms de fichier: */ | ||
- | /*O si j=1 fprj= | + | /*O si j=1 fprj=4ème argument de la ligne de commande */ |
if (j==1) fprj=argv[3]; /* 3 = O+2 */ | if (j==1) fprj=argv[3]; /* 3 = O+2 */ | ||
- | /* fsrc est O+ | + | /* fsrc est O+2ème arg. de la ligne de commande a copier dans fsrc */ |
- | /*O copier le path source dans fsrc pour | + | /*O copier le path source dans fsrc pour évaluation des paramètres */ |
{ /*S source */ | { /*S source */ | ||
isource=0;itarget=0; | isource=0;itarget=0; | ||
Ligne 659 : | Ligne 581 : | ||
else if(c=='*') | else if(c=='*') | ||
{ /*S*/ | { /*S*/ | ||
- | printf("Syntax error '*' in path_source.\n.Exit 2\n"); | + | printf(gettext("Syntax error '*' in path_source.\n.Exit 2\n")); |
exit(2); | exit(2); | ||
} /*S*/ | } /*S*/ | ||
Ligne 670 : | Ligne 592 : | ||
if (isource==1&&argv[O+2][1]==':') | if (isource==1&&argv[O+2][1]==':') | ||
{ /*S*/ | { /*S*/ | ||
- | printf("Arg. syntax error '\\:'\n.Exit 2\n"); | + | printf(gettext("Arg. syntax error '\\:'\n.Exit 2\n")); |
exit(2); | exit(2); | ||
} /*S*/ | } /*S*/ | ||
Ligne 697 : | Ligne 619 : | ||
if(c=='\0') | if(c=='\0') | ||
{ /* err */ | { /* err */ | ||
- | printf("Path_target: syntax error at or near '\\'\n.Exit 2\n"); | + | printf(gettext("Path_target: syntax error at or near '\\'\n.Exit 2\n")); |
exit(2); | exit(2); | ||
} /* err */ | } /* err */ | ||
Ligne 714 : | Ligne 636 : | ||
if(c=='\0') | if(c=='\0') | ||
{ /* err */ | { /* err */ | ||
- | printf("Path_target: syntax error at or near '/'\n.Exit 2\n"); | + | printf(gettext("Path_target: syntax error at or near '/'\n.Exit 2\n")); |
exit(2); | exit(2); | ||
} /* err */ | } /* err */ | ||
Ligne 727 : | Ligne 649 : | ||
/*O si * n'est pas en 1ere position copier le path target dans fdoc tq pas '*' */ | /*O si * n'est pas en 1ere position copier le path target dans fdoc tq pas '*' */ | ||
if(itarget){for(i=0;i<itarget;i++)fdoc[i]=argv[argc-1][i];} | if(itarget){for(i=0;i<itarget;i++)fdoc[i]=argv[argc-1][i];} | ||
- | /*O | + | /*O concaténer le nom du fichier source */ |
k=0; | k=0; | ||
for(i=0;(c=argv[argc-2][i+isource]) !=0 && i < (MAX-5); ++i) | for(i=0;(c=argv[argc-2][i+isource]) !=0 && i < (MAX-5); ++i) | ||
{ /*S*/ | { /*S*/ | ||
fdoc[i+itarget]=c; | fdoc[i+itarget]=c; | ||
- | /*O si il y a un point, noter la | + | /*O si il y a un point, noter la dernière place */ |
if(c=='.') k=i+itarget; /* position du dernier '.' dans la recopie */ | if(c=='.') k=i+itarget; /* position du dernier '.' dans la recopie */ | ||
} /*S*/ | } /*S*/ | ||
Ligne 739 : | Ligne 661 : | ||
if( argv[argc-1][ktar]== '.') | if( argv[argc-1][ktar]== '.') | ||
{ /*S*/ | { /*S*/ | ||
- | /*O si c'est .* ou s'il n'est pas suivi d'une | + | /*O si c'est .* ou s'il n'est pas suivi d'une chaîne */ |
if( (c=argv[argc-1][ktar+1]) =='\0'||c=='*') | if( (c=argv[argc-1][ktar+1]) =='\0'||c=='*') | ||
/*O alors donner le suffixe .doc au fichier documentaire */ | /*O alors donner le suffixe .doc au fichier documentaire */ | ||
Ligne 750 : | Ligne 672 : | ||
fdoc[i+4] = '\0' ; | fdoc[i+4] = '\0' ; | ||
} /*S*/ | } /*S*/ | ||
- | /*O sinon (le '.' existe) | + | /*O sinon (le '.' existe) concaténer le suffixe demande */ |
else | else | ||
{ /*S*/ | { /*S*/ | ||
Ligne 761 : | Ligne 683 : | ||
} /*S*/ | } /*S*/ | ||
} /*S*/ | } /*S*/ | ||
- | /*O sinon le nom du suffixe est | + | /*O sinon le nom du suffixe est indéterminé */ |
else | else | ||
{ /*S*/ | { /*S*/ | ||
- | printf("Path target: suffixe not determined.\n"); | + | printf(gettext("Path target: suffixe not determined.\n")); |
fdoc[k]='\0'; | fdoc[k]='\0'; | ||
} /*S*/ | } /*S*/ | ||
Ligne 794 : | Ligne 716 : | ||
fdoc[k+4] = '\0' ; | fdoc[k+4] = '\0' ; | ||
} /*S xxx.* */ | } /*S xxx.* */ | ||
- | /*O sinon (le '.' existe) | + | /*O sinon (le '.' existe) concaténer le suffixe demande */ |
else | else | ||
{ /*S xxx.abc */ | { /*S xxx.abc */ | ||
Ligne 805 : | Ligne 727 : | ||
} /*S '.' */ | } /*S '.' */ | ||
- | /*O sinon le nom du suffixe est | + | /*O sinon le nom du suffixe est indéterminé */ |
else /* abcde */ | else /* abcde */ | ||
{ /*S*/ | { /*S*/ | ||
for(i=0;(c=argv[argc-1][i]) != '\0' && i<MAX-1;fdoc[i]=c,++i); | for(i=0;(c=argv[argc-1][i]) != '\0' && i<MAX-1;fdoc[i]=c,++i); | ||
- | printf("Path target: suffixe not determined.\n"); | + | printf(gettext("Path target: suffixe not determined.\n")); |
fdoc[i]='\0'; | fdoc[i]='\0'; | ||
} /*S*/ | } /*S*/ | ||
Ligne 816 : | Ligne 738 : | ||
/*########### controle des arguments ########################################*/ | /*########### controle des arguments ########################################*/ | ||
- | /*O si le fichier source est | + | /*O si le fichier source est identique au fichier target : */ |
k=1; | k=1; | ||
for(i=0;k>0&&i<MAX;i++) | for(i=0;k>0&&i<MAX;i++) | ||
Ligne 836 : | Ligne 758 : | ||
{ /*S*/ | { /*S*/ | ||
/*O envoi du message d'erreur et quitter */ | /*O envoi du message d'erreur et quitter */ | ||
- | printf("Syntax error: (path_source : \'%s\') == (path_target = \'%s\')\n",fsrc,fdoc); | + | printf(gettext("Syntax error: (path_source : \'%s\') == (path_target = \'%s\')\n"),fsrc,fdoc); |
printf(".Exit 2 \n"); | printf(".Exit 2 \n"); | ||
exit(2); | exit(2); | ||
Ligne 848 : | Ligne 770 : | ||
/*T printf("code nx1 pour test: %c\n",codes[0]); T*/ | /*T printf("code nx1 pour test: %c\n",codes[0]); T*/ | ||
- | /*O si option v | + | /*O si option v écrire le nom du fichier documentaire sur la sortie standard */ |
- | if(v) printf("doc file : \'%s\' \n", fdoc); | + | if(v) printf(gettext("doc file : \'%s\' \n"), fdoc); |
- | /*O si pas d'option a ni w | + | /*O si pas d'option a ni w vérifier l'existence et ses protections */ |
if (w==0 && a==0) | if (w==0 && a==0) | ||
{ /*S si !a !w */ | { /*S si !a !w */ | ||
/*O si le fichier existe: */ | /*O si le fichier existe: */ | ||
if( (access(fdoc, 00 )) == 0 ) | if( (access(fdoc, 00 )) == 0 ) | ||
- | /*O alors si il n'est pas | + | /*O alors si il n'est pas protégé en écriture */ |
if( (access(fdoc, 02 )) == 0 ) | if( (access(fdoc, 02 )) == 0 ) | ||
{ /*S*/ | { /*S*/ | ||
/*O alors demander si overwrit ...si pas 'y'es quitter le programme */ | /*O alors demander si overwrit ...si pas 'y'es quitter le programme */ | ||
{ | { | ||
- | printf("\n OVERWRIT \'%s\' ... y?\n",fdoc); | + | printf(gettext("\n OVERWRIT \'%s\' ... y?\n"),fdoc); |
if ( (c=(getch()))=='y' || c=='Y'); | if ( (c=(getch()))=='y' || c=='Y'); | ||
else | else | ||
{ /*S*/ | { /*S*/ | ||
- | printf(".Exit 1\n"); | + | printf(gettext(".Exit 1\n")); |
exit(1); | exit(1); | ||
} /*S*/ | } /*S*/ | ||
} | } | ||
} /*S*/ | } /*S*/ | ||
- | /*O sinon | + | /*O sinon préciser qu'il existe et est protégé puis quitter avec retour = 2 */ |
else | else | ||
{ /*S*/ | { /*S*/ | ||
- | printf("%s is write protected.\n", fdoc); | + | printf(gettext("%s is write protected.\n"), fdoc); |
- | puts(".Exit 2\n"); | + | puts(gettext(".Exit 2\n")); |
exit(2); | exit(2); | ||
} /*S*/ | } /*S*/ | ||
Ligne 891 : | Ligne 813 : | ||
#endif | #endif | ||
{ | { | ||
- | printf("fopen file \'%s\' error for append\n.Exit 2\n",fdoc); | + | printf(gettext("fopen file \'%s\' error for append\n.Exit 2\n"),fdoc); |
exit(2); | exit(2); | ||
} | } | ||
} /*S option a */ | } /*S option a */ | ||
- | /*O sinon si option w ouvrir fdoc en | + | /*O sinon si option w ouvrir fdoc en écriture */ |
else if (w==1) | else if (w==1) | ||
{ /*S option w */ | { /*S option w */ | ||
- | /*O si erreur l' | + | /*O si erreur l'écrire et sortir */ |
#ifdef VC10 | #ifdef VC10 | ||
if (fopen_s(&pfdoc,fdoc,"wb") != 0) | if (fopen_s(&pfdoc,fdoc,"wb") != 0) | ||
Ligne 905 : | Ligne 827 : | ||
#endif | #endif | ||
{ /*S*/ | { /*S*/ | ||
- | printf("fopen file \'%s\' error for overwrit\n.Exit 2\n",fdoc); | + | printf(gettext("fopen file \'%s\' error for overwrit\n.Exit 2\n"),fdoc); |
exit(2); | exit(2); | ||
} /*S*/ | } /*S*/ | ||
Ligne 912 : | Ligne 834 : | ||
else /* ne doit jamais arriver.... */ | else /* ne doit jamais arriver.... */ | ||
{ /*Test*/ | { /*Test*/ | ||
- | printf("error option -a or -w not found\n"); | + | printf(gettext("error option -a or -w not found\n")); |
exit(255); | exit(255); | ||
} /*Test*/ | } /*Test*/ | ||
Ligne 919 : | Ligne 841 : | ||
if (j==1) | if (j==1) | ||
{ /*S si option j */ | { /*S si option j */ | ||
- | /*O | + | /*O écrire le nom du fichier projet a l'écran */ |
- | printf("project file : \'%s\' \n", fprj); | + | printf(gettext("project file : \'%s\' \n"), fprj); |
- | /*O si erreur d'ouverture | + | /*O si erreur d'ouverture écrire not found et quitter le programme */ |
#ifdef VC10 | #ifdef VC10 | ||
if ( fopen_s(&pfprj,fprj,"r") != 0 ) | if ( fopen_s(&pfprj,fprj,"r") != 0 ) | ||
Ligne 928 : | Ligne 850 : | ||
#endif | #endif | ||
{ /*S*/ | { /*S*/ | ||
- | printf ("project file \'%s\' not found\n.Exit 2\n",fprj); | + | printf (gettext("project file \'%s\' not found\n.Exit 2\n"),fprj); |
exit(2); | exit(2); | ||
} /*S*/ | } /*S*/ | ||
Ligne 945 : | Ligne 867 : | ||
if( fsrc[0]!='\0' || fsrc[0]!='#' ) | if( fsrc[0]!='\0' || fsrc[0]!='#' ) | ||
{ /*S namefile exist */ | { /*S namefile exist */ | ||
- | /*O si option v | + | /*O si option v écrire le nom du fichier a documenter */ |
- | if(v) printf("\n\nfile for doc: \'%s\'\n",fsrc); | + | if(v) printf(gettext("\n\nfile for doc: \'%s\'\n"),fsrc); |
- | /*O si option f | + | /*O si option f déterminer la place du point séparateur du langage */ |
if(f) | if(f) | ||
{ /*S source */ | { /*S source */ | ||
k=0; | k=0; | ||
c=1; | c=1; | ||
- | /*O | + | /*O déterminer l'emplacement du point s'il existe */ |
for (i=0; fsrc[i] != '\0' && i < MAX-5;++i) | for (i=0; fsrc[i] != '\0' && i < MAX-5;++i) | ||
{ /*S*/ | { /*S*/ | ||
Ligne 962 : | Ligne 884 : | ||
} /*S source */ | } /*S source */ | ||
- | /*O si le | + | /*O si le décryptage (langage) est détermine */ |
if(L==1||p||l) | if(L==1||p||l) | ||
/*O alors: */ | /*O alors: */ | ||
Ligne 968 : | Ligne 890 : | ||
/*O si l'ouverture du fichier source n'est pas correcte */ | /*O si l'ouverture du fichier source n'est pas correcte */ | ||
#ifdef VC10 | #ifdef VC10 | ||
- | + | if ( fopen_s(&pnfile,fsrc,"rb" ) != 0 ) | |
#else | #else | ||
- | + | if (( pnfile = fopen ( fsrc,"rb" )) == 0 ) | |
#endif | #endif | ||
- | /*O | + | /*O écrire file "nomfich" not found */ |
- | + | printf (gettext("file \'%s\' not found for read\n"),fsrc); | |
/*O sinon call tri ou langage */ | /*O sinon call tri ou langage */ | ||
else | else | ||
Ligne 980 : | Ligne 902 : | ||
if(n||s||v) /*www modifié le 10/03/2010 par JPL */ | if(n||s||v) /*www modifié le 10/03/2010 par JPL */ | ||
{ /*S si*/ | { /*S si*/ | ||
- | if(v)fprintf(pfdoc,"%s\n(file %s :)", NL, fsrc ); | + | if(v)fprintf(pfdoc,gettext("%s\n(file %s :)"), NL, fsrc ); |
- | if( v || s ) printf("\n\n(file %s :)\n",fsrc); | + | if( v || s ) printf(gettext("\n\n(file %s :)\n"),fsrc); |
- | if(v)fprintf (pfdoc,"Options a=%d f=%d j=%d l=%d n=%d p=%d s=%d t=%d w=%d",a,f,j,l,n,p,s,t,w); | + | if(v)fprintf (pfdoc,gettext("Options a=%d f=%d j=%d l=%d n=%d p=%d s=%d t=%d w=%d"),a,f,j,l,n,p,s,t,w); |
fprintf (pfdoc, "%s", NL ); | fprintf (pfdoc, "%s", NL ); | ||
} /*S fin si*/ | } /*S fin si*/ | ||
Ligne 992 : | Ligne 914 : | ||
else if(P)pascal_(pfdoc,pnfile); | else if(P)pascal_(pfdoc,pnfile); | ||
else if(S)shell_(pfdoc,pnfile); | else if(S)shell_(pfdoc,pnfile); | ||
- | else if(l==0&&p==0)printf("Error, language not determined !.\n"); | + | else if(l==0&&p==0)printf(gettext("Error, language not determined !.\n")); |
/*O fermer le fichier source */ | /*O fermer le fichier source */ | ||
if (fclose(pnfile)) | if (fclose(pnfile)) | ||
{ /*S si*/ | { /*S si*/ | ||
- | printf("Closure error: \'%s\'\n.Exit 2\n",fsrc); | + | printf(gettext("Closure error: \'%s\'\n.Exit 2\n"),fsrc); |
/*www exit(2); */ | /*www exit(2); */ | ||
} /*S fin si*/ | } /*S fin si*/ | ||
Ligne 1 006 : | Ligne 928 : | ||
if (fclose(pfprj)) | if (fclose(pfprj)) | ||
{ /*S*/ | { /*S*/ | ||
- | printf("Closure error: \'%s\'\n.Exit 2\n",fprj); | + | printf(gettext("Closure error: \'%s\'\n.Exit 2\n"),fprj); |
exit(2); | exit(2); | ||
} /*S*/ | } /*S*/ | ||
Ligne 1 014 : | Ligne 936 : | ||
else | else | ||
{ /*S !j */ | { /*S !j */ | ||
- | /*O si option v | + | /*O si option v écrire le nom du fichier a documenter */ |
- | if(v) printf("\n\nfile for doc: \'%s\' \n",fsrc); | + | if(v) printf(gettext("\n\nfile for doc: \'%s\' \n"),fsrc); |
/*O si l'ouverture du fichier n'est pas correcte */ | /*O si l'ouverture du fichier n'est pas correcte */ | ||
#ifdef VC10 | #ifdef VC10 | ||
Ligne 1 023 : | Ligne 945 : | ||
#endif | #endif | ||
{ /*S*/ | { /*S*/ | ||
- | /*O | + | /*O écrire file "nomfich" not found */ |
- | printf("file \'%s\' not found for read\n.Exit 2\n",fsrc); | + | printf(gettext("file \'%s\' not found for read\n.Exit 2\n"),fsrc); |
exit(2); | exit(2); | ||
} /*S*/ | } /*S*/ | ||
Ligne 1 033 : | Ligne 955 : | ||
if(n||v||s) /*www modifié le 10/03/2010 par JPL */ | if(n||v||s) /*www modifié le 10/03/2010 par JPL */ | ||
{ /*S*/ | { /*S*/ | ||
- | if(v)fprintf(pfdoc,"%s\n(file %s :)", NL, fsrc ); | + | if(v)fprintf(pfdoc,gettext("%s\n(file %s :)"), NL, fsrc ); |
- | if( v || s ) printf("\n\n(file %s :)\n",fsrc); | + | if( v || s ) printf(gettext("\n\n(file %s :)\n"),fsrc); |
- | if(v)fprintf (pfdoc,"Options a=%d f=%d j=%d l=%d n=%d p=%d s=%d t=%d w=%d",a,f,j,l,n,p,s,t,w); | + | if(v)fprintf (pfdoc,gettext("Options a=%d f=%d j=%d l=%d n=%d p=%d s=%d t=%d w=%d"),a,f,j,l,n,p,s,t,w); |
fprintf (pfdoc, "%s", NL ); | fprintf (pfdoc, "%s", NL ); | ||
} /*S*/ | } /*S*/ | ||
Ligne 1 047 : | Ligne 969 : | ||
else if(l==0&&p==0) | else if(l==0&&p==0) | ||
{ /*S*/ | { /*S*/ | ||
- | printf("Error, language not | + | printf(gettext("Error, programming language not found !.\n.Exit 2\n")); |
exit(2); | exit(2); | ||
} /*S*/ | } /*S*/ | ||
Ligne 1 053 : | Ligne 975 : | ||
if (fclose(pnfile)) | if (fclose(pnfile)) | ||
{ /*S*/ | { /*S*/ | ||
- | printf("Closure error: \'%s\'\n.Exit 2 \n",fdoc); | + | printf(gettext("Closure error: \'%s\'\n.Exit 2 \n"),fdoc); |
exit(2); | exit(2); | ||
} /*S*/ | } /*S*/ | ||
Ligne 1 061 : | Ligne 983 : | ||
if (fclose(pfdoc)) | if (fclose(pfdoc)) | ||
{ /*S*/ | { /*S*/ | ||
- | printf("Closure \'%s\' error\n.Exit 2\n",fdoc); | + | printf(gettext("Closure \'%s\' error\n.Exit 2\n"),fdoc); |
exit(2); | exit(2); | ||
} /*S*/ | } /*S*/ | ||
/*O ecrire DOC "file_src" END */ | /*O ecrire DOC "file_src" END */ | ||
- | if(v) printf("\n\nDOC %s END\n",fdoc); | + | if(v) printf(gettext("\n\nDOC %s END\n"),fdoc); |
} /*S corps */ | } /*S corps */ | ||
} /*S main */ | } /*S main */ | ||
</pre> | </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 à 14:48
Retour aux fichiers en développement →
version.h
version.h Updated 11 may 2013
/* * © mkd, version 2009.12 et ultérieures * * 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. */ /*P NOM DU FICHIER: version.h PROJET INITIAL: mkd console linux & MSDOS DOSSIER INITIAL : mkdoc3.12 Centre d'Electronique de Montpellier PROGRAMMEUR: JPL DATE: 18/12/2009 MODIFICATIONS: le: 09/01/2011 par JPL objet: Ajouté l'option de compilation pour MSDEV41 le: 10/01/2012 par JPL objet: Ajouté la définition std_C pour compilation UNIX STD le: 25/03/2012 par Clara objet: internationalisation le: 27/03/2012 par jpl objet: internationalisation en utf-8 le: 10/04/2013 par Cardabela: Modification mineure. Alignement des commentaires. le: 11/05/2013 par jpl mise à jour des définitions CD* pour tri.c */ // le: ../../.. par .............. objet de la modification .... /*E ?C?*/ /**# MKD.C ############################*/ /*H*/ /*U UTILISATEURS */ /*H*/ /*O ORGANIGRAMME */ /*H*/ /*S STRUCTURE */ /*H*/ /*T TESTS */ /*H*/ /*P PROGRAMMEUR */ /*H*/ /*www remarques particulieres */ /*H*/ /**####################################*/ /*H*/ // define VERSION line 173 #define UNIX /*O UNIX version */ /* Delete this line for PC version */ //#define GTKMM /*O Version fenêtrée avec gtkmm pour mkdcppw uniquement */ #ifndef UNIX /*H*/ #define PC /*O version de compilation PC */ /*H*/ /*#define PC_ONLY*/ /*H find_ ne reconnaît pas: .s .f .p .sh .csh */ #define NL "\r\n" /*H*/ //#define VC10 /*O Microsoft Visual C 10.- */ #define MSDEV41 #endif /*H*/ /*H*/ #ifdef UNIX /*H*/ // #define UNIX_ONLY /*H find_ ne reconnaît pas: .BAS .PAS .FOR ... */ #endif /*H*/ /*H*/ /*H #D *************************************************************************************/ /*H *** #Define OPTIONS DE COMPILATION: options par défaut, redéfinissables: ************** (#D pour l'extraction des options de compilation en ligne avec l'option CD3='#') */ /*H****************** #Define 'l' (ligne) commence par #define en 1ère colonne : ***********/ #define CD1 '%' /*H #Define Option CD1 en 1ère colonne prend fin avec NL */ #define CD2 '<' /*H #Define Option CD2 en 1ère colonne prend fin avec NL */ #define CD3 '!' /*H #Define Option CD3 dans la ligne prend fin avec NL */ /*H #Define Option '!' commentaire Fortran 90 et ultérieurs */ /*H #Define Option '%' commentaire postcript */ /*H #Define Option '#' commentaire shell ou pour Makefile voir option S ( le commentaire se termine avec new_line ) */ /*H #Define Option '\'' commentaires Basic */ /*H #Define Option ';' commentaires assembleur */ /*H ***************** #Define Option 'p' (dans la page) #define en 1ère colonne : **********/ #define CD4 '\"' /*H #Define Option CD4 = " debut de commentaire */ #define CD5 '\"' /*H #Define Option CD5 = " fin de commentaire */ /*H #Define **************************************************************/ #define FULL_LINE /*H #Define Option de compil. copier toute la ligne */ /*H #D *************************************************************************************/ /*H*/ #define VERSION "13.05 alpha1" /*H*/ /*H*/ #define MAX 85 /*H longueur des buffers des path source et doc */ #define STX 0x2 /*H Start Text */ #include <stdio.h> /*H*/ /*H*/ #ifdef PC /*H*/ #include <conio.h> /*H*/ #include <process.h> /*H*/ #include <io.h> /*H*/ #endif /*H*/ #ifdef VC10 /*H Microsoft Visual C 10.- */ #define putch _putch /*H ISO C++ */ #define getch _getch /*H ISO C++ */ #define access _access /*H ISO C++ */ #endif /*H*/ /*H*/ #ifdef MSDEV41 /*H*/ //#define STD_C /*H SVr4, 4.3BSD, C89, C99.*/ #include <string.h> /*H*/ #endif /*H*/ /*H*/ #ifdef UNIX /*H*/ #define NL "\n" /*H*/ #define exit return #define bool int //#define STD_C /*H SVr4, 4.3BSD, C89, C99.*/ //#define getch() getchar()*/ defined in mkd.c #define putch putchar /*H*/ #include <signal.h> /*H*/ #include <sys/file.h> /*H*/ #include <string.h> /*H*/ #endif /*H*/
mkd.h
// asm.cpp: extern int asm_(FILE *pfdoc, FILE *pnfile); // File: basic.c void basic_ (FILE * pfdoc, FILE * pnfile); // File: cpp.c extern int cpp_ (FILE * pfdoc, FILE * pnfile); // File: fortran.c void fortran_ (FILE * pfdoc, FILE * pnfile); // File: pascal.c (Comments for UTF-8 text editor) void pascal_ (FILE * pfdoc, FILE * pnfile); // File: shell.c (Comments for UTF-8 text editor) void shell_ (FILE * pfdoc, FILE * pnfile); // File: tri.c void tri_ (FILE * pfdoc, FILE * pnfile);
mkd.c
mkd.c ; Update 11 may 2013
/*D COPYRIGHT: © Contact: http://edeulo.free.fr/contacts/formmail.php © EELL, Éditeurs Européens de Logiciels Libres, 2007 Association à but non lucratif selon l'Article 11 de la convention européenne des droits de l'homme. AUTHORS: Designer: intial JP Louyot (JPL) Updates : JPL and Clara Jimenez Tranlations: Alizée, Clara, JPL, JPT, Luca */ /*P NOM DU FICHIER: mkd.c PROJET INITIAL: mkd console linux & Windows 7 DOSSIER INITIAL : mkdoc3.12 Centre d'Electronique de Montpellier PROGRAMMEUR: Jean-Paul LOUYOT DATE: 18/12/2009 MODIFICATIONS: le: 10/03/2010 par JPL : Mise à jour pour Visual C 10 le: 25/03/2012 par Clara : internationalisation le: 31/03/2012 par jpl : internationalisation. Conversion du fichier au format UTF-8 le: 18/04/2013 par jpl : mise à jour pour version 2013 alpha le: 11/05/2013 par jpl : pour compilation avec les fichiers mis à jour */ // le: ../../.. par
#include "version.h" #include "strings.h" #include "mkd.h" #include "internationalisation.h" unsigned char A,B,C,F,P,S,a,f,j,l,n,p,s,t,v,w; /*P ajout n et v version 3.1 */ /* static */ char codes[5] = {0,0,0,0,0}; /** ####################################### # SOUS PROGRAMMES # ####################################### */ // #include "asm.inc.c" //P old version see asm.c // #include "basic.inc.c" //P old version see basic.c // #include "c.inc.c" //P old version see cpp.c // #include "fortran.inc.c" //P old version see fortran.c // #include "pascal.inc.c" //P old version see pascal.c // #include "shell.inc.c" //P old version see shell.c // #include "tri.inc.c" //P old version see tri.c int tolower(int c) // char c; { if( c >='A' && c <='Z' ) c=(c-'A')+'a'; return(c); } int toupper(int c) // char c; { if( c >='a' && c <='z' ) c=(c-'a')+'A'; return(c); } #ifdef UNIX int getch() { int c; c=getc(stdin); if (c=='\r')c='\n'; return(c); } #define exit return //P c++ #endif /** ####################################### # MAIN() # ####################################### */ int main (int argc, char * argv[]) // int argc; // char *argv[]; { /*S main */ //O Internationalization Initialization // i18n: initializes the entire current locale of the program as per // environment variables set by the user setlocale( LC_ALL, "" ); // i18n: Indicate the path of the i18n catalog file bindtextdomain( "mkd", "/usr/share/locale" ); // i18n: sets the message domain textdomain( "mkd" ); char *fprj; // nom du fichier de projet s'il existe char fdoc[MAX]; // nom du fichier cible char fsrc[MAX]; // nom du fichier source extern char codes[]; // codes extern unsigned char A,B,C,F,P,S,a,f,j,l,n,p,s,t,v,w; // booléennes int i,k; // compteurs char isource; // position nom du fichier source dans path source char itarget; // position fin du path_target avec '*' ou ':'(PC) char ktar; // position du '.' dans p_target static char O; // booléen =1 si option validée static char L; // booléen =1 si option langage register int c; // char (variable) int c1; // char (variable) pour version PC int ret = 0; // essai FILE *pfprj; // fichier de projet */ FILE *pnfile; // fichier source FILE *pfdoc; // fichier cible /*##########################################################################*/ /*O si argc < 3 ou arc > 5: */ /*##########################################################################*/ /*O alors ecrire 'USAGE', donner la syntaxe puis quitter */ if ( argc < 3 || argc > 5 ) { //S argc <3 ou argc > 5 : syntaxe #ifdef PC ret = printf(gettext("mkd PC version, Release %s, USAGE:\n"),VERSION); printf(gettext("syntax: mkd [-ABCFPSafjlnpstvw] char_codes path_source [path_target]\n")); puts (gettext(" or: mkd ? .See also mkd.doc or manual.")); #endif #ifdef UNIX printf(gettext("mkd UNIX version, Release %s, USAGE:\n"),VERSION); printf(gettext("syntax: mkd [-ABCFPSafjlnpstvw] char_codes path_source [path_target]\n")); puts (gettext(" or: mkd \\? .See also nanual: \'man mkd\'")); #endif if( argc==2 && argv[1][0]=='?' ) { //S argc=2 et ? printf(gettext(" --> options:\n")); printf(gettext(" -A decode Assembler comment style only\n")); /* #ifndef UNIX_ONLY */ printf(gettext(" -B Basic style\n")); /* #endif */ printf(gettext(" -C C++ style\n")); printf(gettext(" -F Fortran 77 style\n")); printf(gettext(" -P Pascal style\n")); /* #ifndef PC_ONLY */ printf(gettext(" -S Shell style\n")); /* #endif */ printf(gettext(" -a append target file\n")); printf(gettext(" -f:\n")); #ifndef UNIX_ONLY printf(gettext(" find language ( .ASM .BAS .C .FOR .PAS .PRO )\n")); #endif #ifndef PC_ONLY printf(gettext(" find language ( .s .S .c .h .i .f .F .r .p .sh .csh )\n")); #endif printf(gettext(" -j use only with project sources file.\n")); printf(gettext(" -l and p; line: (compil.: %c or %c in first column or %c in line)\n"),CD1,CD2,CD3); printf(gettext(" page: (compil.: begin with %c and end with %c)\n"),CD4,CD5); printf(gettext(" -n insert line number\n")); printf(gettext(" -s copy and add to screen\n")); printf(gettext(" -t copy the comment only\n")); printf(gettext(" -v verbose\n")); printf(gettext(" -w overwrite (default option: switch off)\n")); printf(gettext(" --> char_codes: all ASCII ")); #ifdef PC printf(gettext("except space:' ' (5 char max)\n")); printf(gettext(" example codes = UM or *OPTw or *HOS or ** for all\n")); #endif #ifdef UNIX printf(gettext(" (5 char max)\n")); printf(gettext(" example codes = UM or \\*OPTw or '* HOS' or '**' for all\n")); #endif printf(gettext(" --> path_source: source file (option j: if it is a project file) \n")); printf(gettext(" --> path_target: target file\n")); #ifdef UNIX printf(gettext("Example: mkd -Csnv '*S' file.c \\*.verif_struct\n")); #endif #ifdef PC printf(gettext("Example: mkd -Cs *Snv file.c *.str\n")); #endif printf(gettext(".Exit 2\n")); exit(2); /* Pour un contrôle éventuel (make) */ } //S argc=2 et ? } //S argc <3 ou argc > 5 : syntaxe /*O sinon exécuter la suite de la commande: */ else { /*S corps */ /*O valider QUIT par CTRL \ */ #ifdef UNIX signal(SIGQUIT,SIG_DFL); #endif /*www n'est pas utile lorsque break est 'on' avant lancement de mkd éliminer cette procédure évite la recherche de command.com sur disque. #ifdef PC c=system("BREAK ON"); #endif www*/ /*O init fsrc & fdoc buffers */ for(i=0;i<MAX;fsrc[i]='\0',fdoc[i]='\0',++i); /*O init options par défaut */ {A=0;B=0;C=0;F=0;P=0;S=0;a=0;f=0;j=0;l=0;n=0,p=0;s=0;t=0;v=0;w=0;} /*O*/ O=0; /* Option=0 */ /*O si argc>3 */ if (argc>3) { /*S argc>3 */ /*O si en 2ème paramètre 1er char = '-' décoder les options */ if( argv[1][0]=='-') { /*S*/ /*O initialiser les paramètres du tant que */ O=1; /* Option=1 */ c=1; i=1; /*O tant que pas fin paramètres options & (5 options max) */ while (c != '\0' && i < 13) { /*S*/ /*O valider les options */ if ((c=argv[1][i]) == 'a') a=1; else if (c=='w') w=1; else if (c=='l') l=1; else if (c=='p') p=1; else if (c=='j') j=1; else if (c=='f') f=1; else if (c=='s') s=1; else if (c=='t') t=1; else if (c=='A') A=1; else if (c=='B') B=1; else if (c=='C') C=1; else if (c=='F') F=1; else if (c=='P') P=1; else if (c=='S') S=1; else if (c=='n') n=1; else if (c=='v') v=1; i++; } /*S*/ /*O si A+B+C+F+P+S > 1 il y a erreur le dire et quitter */ if((L=A+B+C+F+P+S)>1) { printf(gettext("Syntax error: Too many 'Language' options:\n")); printf(gettext(" A or B or C or...please.\n.Exit 2\n")); exit(2); } /*O sinon si option langage = 1 imposer (find) f = 0 */ else if(L==1) { f=0; } /*O sinon si pas d'option de langage et p=1 ou l=1 alors f=0 */ else if (L==0 && p==0 && l==0) f=1; /*O si a=1 et w=1 alors a=w=0 */ if (a==1 && w==1) { if (v) printf(gettext("Options a or w please... ")); a=w=0; } } /*S*/ /*wwwO sinon écrire Option syntax error (OPTION DE COMPILATION) */ /*www else {printf("Option '-' syntax error\n");exit(2);} */ } /*S argc>3 */ /*O si langage et mode verbose : */ if(L && v) { /*SL*/ /*O donner les options a l'écran */ printf (gettext("Force language comment, style ")); if(A)printf(gettext("ASSEMBLER\n")); else if(B)printf(gettext("BASIC\n")); else if(C)printf(gettext("C\n")); else if(F)printf(gettext("FORTRAN\n")); else if(P)printf(gettext("PASCAL\n")); else if(S)printf(gettext("SHELL\n")); } /*SL*/ if (v) printf (gettext("Options a=%d f=%d j=%d l=%d n=%d p=%d s=%d t=%d w=%d\n"),a,f,j,l,n,p,s,t,w); /*###########################################################################*/ /*O si ( argc > 3 et Opt ) examiner les cas *. *.* pour path_target="" */ /*###########################################################################*/ if (argc > 3+O && ((c=argv[O+3][0])=='.'||c=='*') ) { /*S cas ramenés */ if(c=='*') { /*S *. *.* */ if(argv[O+3][1]=='.'&&((c=argv[O+3][2])=='*'||c=='\0') )argc=O+3; } /*S * */ else { /*S . */ /*P même répertoire */ if(argv[O+3][1]=='\0')argc=O+3; /* Les cas '\*'.... sont examines plus loin */ } /*S . */ } /*S cas ramenés */ /*##########################################################################*/ /*O si argc<4 ou (argc<5 avec Options) - ligne de commande "mkd -options char_codes path" - ou "mkd char_codes path" - (source et dest auront même path avec suffixe différent) */ /*###########################################################################*/ if (argc<4+O) { /*S même path */ /*O alors si j=1 fprj=4ème argument de la ligne de commande */ if (j==1) fprj=argv[3]; /* fichier projet si j */ /*O fsrc=O+2ème arg. de la ligne de commande a copier dans fsrc */ { /*S source */ k=0;isource=0; c=1; #ifdef PC if(argv[O+2][1]==':')isource=2; #endif for (i=0; c != '\0' && i < MAX-5;++i) { /*S*/ if((c=argv[O+2][i])=='.')k=i; /* pour find */ #ifdef PC if(c=='\\')isource=i+1; #endif #ifdef UNIX if(c=='/')isource=i+1; #endif else if(c=='*') { /*S*/ printf(gettext("Syntax error '*' in path_source.\n.Exit 2\n")); exit(2); } /*S*/ fsrc[i]=c; } /*S*/ #ifdef PC /*O si '\:' adresser un message d'erreur et quitter */ if (isource==1&&argv[O+2][1]==':') { /*S*/ printf(gettext("Arg. syntax error '\\:'\n.Exit 2 \n")); exit(2); } /*S*/ #endif /*O si find est positionne et pas j: chercher le langage */ if(f&&!j) { /*S*/ // puts("\nTEST: f positionné et pas j ... rechercher avec find"); //T #include"find.inc.c" if (j==1) fprj=argv[O+2]; /* fichier projet si j trouve */ } /*S*/ } /*S source */ /*O recopier le nomfichier sans path dans fdoc et noter l'emplacement du point s'il existe */ k=0; for ( i = 0 ;(c=argv[O+2][i+isource]) != '\0' && i < MAX-5; ++i ) { /*S*/ fdoc[i]=c; if(c=='.')k=i; } /*S*/ /*O si le source a le suffixe .DOC l'ecrire et quitter le pgm */ if(k)i=k; if ( fdoc[i]=='.' && ((c=(fdoc[i+1]))=='d'||c=='D') && ((c=(fdoc[i+2]))=='o'||c=='O') && ((c=(fdoc[i+3]))=='c'||c=='C')) { /*S*/ printf(gettext("Syntax error: path_source, suffixe '.doc'\n.Exit 2\n")); exit(2); } /*S*/ /*O sinon donner le suffixe .doc au fichier documentaire */ else { /*S*/ fdoc[i] = '.' ; fdoc[i+1] = 'd' ; fdoc[i+2] = 'o' ; fdoc[i+3] = 'c' ; fdoc[i+4] = '\0' ; } /*S*/ } /*S meme path */ /*###########################################################################*/ /*O sinon si ( argc > 3 et Opt ) -ligne de commande "mkd char_codes path_src path_target - ou " mkd -options char_codes path_src path_target -(path doc et path src seront différents) */ /*##########################################################################*/ else if (argc > 3+O) { /*S path différents */ /*O copier les noms de fichier: */ /*O si j=1 fprj=4ème argument de la ligne de commande */ if (j==1) fprj=argv[3]; /* 3 = O+2 */ /* fsrc est O+2ème arg. de la ligne de commande a copier dans fsrc */ /*O copier le path source dans fsrc pour évaluation des paramètres */ { /*S source */ isource=0;itarget=0; #ifdef PC if(argv[O+2][1]==':')isource=2; #endif for (i=0; (c=argv[O+2][i]) != '\0' && i < MAX-1;++i) { /*S examen des positions de '/' et '.' */ if(c=='.')k=i; /* pour find */ #ifdef PC else if(c=='\\')isource=i+1; /* '\:' n'est pas evalue */ #endif #ifdef UNIX else if(c=='/')isource=i+1; #endif else if(c=='*') { /*S*/ printf(gettext("Syntax error '*' in path_source.\n.Exit 2\n")); exit(2); } /*S*/ fsrc[i]=c; } /*S examen des positions de '/' et '.' */ fsrc[i]='\0'; #ifdef PC /*O si '\:' adresser un message d'erreur et quitter */ if (isource==1&&argv[O+2][1]==':') { /*S*/ printf(gettext("Arg. syntax error '\\:'\n.Exit 2\n")); exit(2); } /*S*/ #endif /*O si find est positionne et pas j: chercher le langage */ if(f&&!j) { /*S*/ #include "find.inc.c" /*O si le fichier est un fichier projet affecter le nom a fprj */ if (j==1) fprj=argv[O+2]; /* fichier projet si j trouve */ } /*S*/ } /*S source */ /*O traitement du dernier argument de la ligne de commande */ /*O reperer '/ *' ou ':' et '.' dans fdoc */ ktar=0;itarget=0;c=1; #ifdef PC if(argv[O+3][1]==':')itarget=2; for (i=0; c!='\0' && i<MAX-1 ; ++i) { /*S*/ if((c=argv[O+3][i])=='\\') { /*S*/ if((c=argv[O+3][i+1])=='*')itarget=i+1; /*O si '\\0' erreur de syntaxe quitter */ if(c=='\0') { /* err */ printf(gettext("Path_target: syntax error at or near '\\'\n.Exit 2\n")); exit(2); } /* err */ } /*S*/ else if(c=='.')ktar=i; } /*S*/ #endif #ifdef UNIX c=1; for (i=0; c!='\0' && i<MAX-1 ; ++i) { /*S*/ if((c=argv[O+3][i])=='/') { /*S*/ if((c=argv[O+3][i+1])=='*')itarget=i+1; /*O si '/ \0' erreur de syntaxe quitter */ if(c=='\0') { /* err */ printf(gettext("Path_target: syntax error at or near '/'\n.Exit 2\n")); exit(2); } /* err */ } /*S*/ else if(c=='.')ktar=i; } /*S*/ #endif /*O si nomfichier commence par '*': '/ *' ou ':' ou target commence par '*': */ if(itarget||argv[O+3][0]=='*') /*O alors: */ { /*S*/ /*O si * n'est pas en 1ere position copier le path target dans fdoc tq pas '*' */ if(itarget){for(i=0;i<itarget;i++)fdoc[i]=argv[argc-1][i];} /*O concaténer le nom du fichier source */ k=0; for(i=0;(c=argv[argc-2][i+isource]) !=0 && i < (MAX-5); ++i) { /*S*/ fdoc[i+itarget]=c; /*O si il y a un point, noter la dernière place */ if(c=='.') k=i+itarget; /* position du dernier '.' dans la recopie */ } /*S*/ /*O ajouter le suffixe: */ /*O si le '.' existe dans le path_target */ if( argv[argc-1][ktar]== '.') { /*S*/ /*O si c'est .* ou s'il n'est pas suivi d'une chaîne */ if( (c=argv[argc-1][ktar+1]) =='\0'||c=='*') /*O alors donner le suffixe .doc au fichier documentaire */ { /*S*/ if(k)i=k; fdoc[i] = '.' ; fdoc[i+1] = 'd' ; fdoc[i+2] = 'o' ; fdoc[i+3] = 'c' ; fdoc[i+4] = '\0' ; } /*S*/ /*O sinon (le '.' existe) concaténer le suffixe demande */ else { /*S*/ for(i=ktar;(c=argv[argc-1][i])!='\0'&&k<(MAX-1);++i) { /*S*/ fdoc[k]=c; k++; } /*S*/ fdoc[k]='\0'; } /*S*/ } /*S*/ /*O sinon le nom du suffixe est indéterminé */ else { /*S*/ printf(gettext("Path target: suffixe not determined.\n")); fdoc[k]='\0'; } /*S*/ } /*S*/ /*O sinon: xxx xxx. xxx.* .xxx .* */ else { /*S else */ /*O si le point existe: (abc. abc.def abc.* .abc .*) */ if( argv[argc-1][ktar]== '.') { /*S '. */ /*O copier le nom du fichier target */ k=0;c=1; for(i=0;(c=argv[argc-1][i]) !=0 && i < (MAX-5); ++i) { /*S*/ fdoc[i]=c; /*O noter la position du point dans la recopie */ if(c=='.') k=i; } /*S*/ /*O ajouter le suffixe: */ /*O si le point est suivi de '*' ou rien: */ if( (c=argv[argc-1][k+1])=='\0'||c=='*') /*O alors donner le suffixe .doc au fichier documentaire */ { /*S xxx.* */ fdoc[k] = '.' ; fdoc[k+1] = 'd' ; fdoc[k+2] = 'o' ; fdoc[k+3] = 'c' ; fdoc[k+4] = '\0' ; } /*S xxx.* */ /*O sinon (le '.' existe) concaténer le suffixe demande */ else { /*S xxx.abc */ for(i=0;(c=argv[argc-1][i+ktar])!='\0'&&k<(MAX-1);++i) { /*S*/ fdoc[i+k]=c; } /*S*/ fdoc[i+k]='\0'; } /*S xxx.abc*/ } /*S '.' */ /*O sinon le nom du suffixe est indéterminé */ else /* abcde */ { /*S*/ for(i=0;(c=argv[argc-1][i]) != '\0' && i<MAX-1;fdoc[i]=c,++i); printf(gettext("Path target: suffixe not determined.\n")); fdoc[i]='\0'; } /*S*/ } /*S else */ } /*S path differents */ /*########### controle des arguments ########################################*/ /*O si le fichier source est identique au fichier target : */ k=1; for(i=0;k>0&&i<MAX;i++) { /*S*/ #ifdef PC c=toupper(fdoc[i]); c1=toupper(fsrc[i]); if(c>0 && c!=c1)k=0; /* exit */ else if(c=='\0'|| fsrc[i]=='\0')k=0; /* exit */ #endif #ifdef UNIX if((c=fdoc[i])>0&&c!=fsrc[i])k=0; /* exit */ else if(c=='\0'|| fsrc[i]=='\0')k=0; /* exit */ #endif /*Test printf("%c%c",c,fsrc[i]); */ } /*S*/ if(c=='\0'&& fsrc[i]=='\0') /*O alors : */ { /*S*/ /*O envoi du message d'erreur et quitter */ printf(gettext("Syntax error: (path_source : \'%s\') == (path_target = \'%s\')\n"),fsrc,fdoc); printf(".Exit 2 \n"); exit(2); } /*S*/ /*## FIN DE L'EXAMEN DES ARGUMENTS ##########################################*/ /*O copier les codes dans le buffer codes */ for ( i = 0 ; *(argv[1+O]+i) != '\0' && i < 5 ; ++i) codes[i] = *(argv[1+O]+i); if(codes[0]=='*'&&codes[1]=='*')codes[0]=0; /*T printf("code nx1 pour test: %c\n",codes[0]); T*/ /*O si option v écrire le nom du fichier documentaire sur la sortie standard */ if(v) printf(gettext("doc file : \'%s\' \n"), fdoc); /*O si pas d'option a ni w vérifier l'existence et ses protections */ if (w==0 && a==0) { /*S si !a !w */ /*O si le fichier existe: */ if( (access(fdoc, 00 )) == 0 ) /*O alors si il n'est pas protégé en écriture */ if( (access(fdoc, 02 )) == 0 ) { /*S*/ /*O alors demander si overwrit ...si pas 'y'es quitter le programme */ { printf(gettext("\n OVERWRIT \'%s\' ... y?\n"),fdoc); if ( (c=(getch()))=='y' || c=='Y'); else { /*S*/ printf(gettext(".Exit 1\n")); exit(1); } /*S*/ } } /*S*/ /*O sinon préciser qu'il existe et est protégé puis quitter avec retour = 2 */ else { /*S*/ printf(gettext("%s is write protected.\n"), fdoc); puts(gettext(".Exit 2\n")); exit(2); } /*S*/ /*O faire option w=1 (puisque overwrit) */ w=1; } /*S si !a !w */ /*O si option a ouvrir fdoc en ajout */ if (a==1) { /*S option a */ /*O si erreur l'ecrire et sortir */ #ifdef VC10 if ( fopen_s( &pfdoc,fdoc,"ab") != 0 ) #else if((pfdoc = fopen(fdoc,"ab")) == NULL) #endif { printf(gettext("fopen file \'%s\' error for append\n.Exit 2\n"),fdoc); exit(2); } } /*S option a */ /*O sinon si option w ouvrir fdoc en écriture */ else if (w==1) { /*S option w */ /*O si erreur l'écrire et sortir */ #ifdef VC10 if (fopen_s(&pfdoc,fdoc,"wb") != 0) #else if((pfdoc = fopen(fdoc,"wb")) == NULL) #endif { /*S*/ printf(gettext("fopen file \'%s\' error for overwrit\n.Exit 2\n"),fdoc); exit(2); } /*S*/ } /*S option w */ /*T sinon ecrire message d'erreur -a -w pas trouve */ else /* ne doit jamais arriver.... */ { /*Test*/ printf(gettext("error option -a or -w not found\n")); exit(255); } /*Test*/ /*O si option j */ if (j==1) { /*S si option j */ /*O écrire le nom du fichier projet a l'écran */ printf(gettext("project file : \'%s\' \n"), fprj); /*O si erreur d'ouverture écrire not found et quitter le programme */ #ifdef VC10 if ( fopen_s(&pfprj,fprj,"r") != 0 ) #else if (( pfprj = fopen ( fprj,"r" )) == 0 ) #endif { /*S*/ printf (gettext("project file \'%s\' not found\n.Exit 2\n"),fprj); exit(2); } /*S*/ /*O sinon : */ else { /*S copy src & tri */ /*O tant que pas fin de fichier projet */ while ( (c = getc(pfprj)) != EOF ) { /*S tq !EOF */ /*O lire le nom du fichier a documenter */ ungetc(c,pfprj); for (i=0 ; (c = getc(pfprj)) != '\n' && c != EOF ; ++i) fsrc[i] = (char)c ; fsrc[i] = '\0'; /*O si le nomfichier existe et ne commence pas par '#' */ if( fsrc[0]!='\0' || fsrc[0]!='#' ) { /*S namefile exist */ /*O si option v écrire le nom du fichier a documenter */ if(v) printf(gettext("\n\nfile for doc: \'%s\'\n"),fsrc); /*O si option f déterminer la place du point séparateur du langage */ if(f) { /*S source */ k=0; c=1; /*O déterminer l'emplacement du point s'il existe */ for (i=0; fsrc[i] != '\0' && i < MAX-5;++i) { /*S*/ if(fsrc[i]=='.')k=i; } /*S*/ if(k) #include "find.inc.h" #include "find.inc.c" } /*S source */ /*O si le décryptage (langage) est détermine */ if(L==1||p||l) /*O alors: */ { /*S alors*/ /*O si l'ouverture du fichier source n'est pas correcte */ #ifdef VC10 if ( fopen_s(&pnfile,fsrc,"rb" ) != 0 ) #else if (( pnfile = fopen ( fsrc,"rb" )) == 0 ) #endif /*O écrire file "nomfich" not found */ printf (gettext("file \'%s\' not found for read\n"),fsrc); /*O sinon call tri ou langage */ else { /*S else*/ /*O si: on a option n ou s et mode bavard (option v) écrire le nom du fichier lu et les options */ if(n||s||v) /*www modifié le 10/03/2010 par JPL */ { /*S si*/ if(v)fprintf(pfdoc,gettext("%s\n(file %s :)"), NL, fsrc ); if( v || s ) printf(gettext("\n\n(file %s :)\n"),fsrc); if(v)fprintf (pfdoc,gettext("Options a=%d f=%d j=%d l=%d n=%d p=%d s=%d t=%d w=%d"),a,f,j,l,n,p,s,t,w); fprintf (pfdoc, "%s", NL ); } /*S fin si*/ if(l||p)tri_(pfdoc,pnfile); if(A)asm_(pfdoc,pnfile); else if(B)basic_(pfdoc,pnfile); else if(C)cpp_(pfdoc,pnfile); /*www modifié le 10 mars 2010 */ else if(F)fortran_(pfdoc,pnfile); else if(P)pascal_(pfdoc,pnfile); else if(S)shell_(pfdoc,pnfile); else if(l==0&&p==0)printf(gettext("Error, language not determined !.\n")); /*O fermer le fichier source */ if (fclose(pnfile)) { /*S si*/ printf(gettext("Closure error: \'%s\'\n.Exit 2\n"),fsrc); /*www exit(2); */ } /*S fin si*/ } /*S fin else*/ } /*S fin alors*/ } /*S namefile exist */ } /*S tq !EOF */ /*O fermer le fichier projet */ if (fclose(pfprj)) { /*S*/ printf(gettext("Closure error: \'%s\'\n.Exit 2\n"),fprj); exit(2); } /*S*/ } /*S copy src & tri */ } /*S si option j */ /*O sinon: (pas option j) */ else { /*S !j */ /*O si option v écrire le nom du fichier a documenter */ if(v) printf(gettext("\n\nfile for doc: \'%s\' \n"),fsrc); /*O si l'ouverture du fichier n'est pas correcte */ #ifdef VC10 if ( fopen_s(&pnfile,fsrc,"rb") != 0 ) #else if (( pnfile = fopen ( fsrc,"rb" )) == 0 ) #endif { /*S*/ /*O écrire file "nomfich" not found */ printf(gettext("file \'%s\' not found for read\n.Exit 2\n"),fsrc); exit(2); } /*S*/ /*O sinon call langage... */ else { /*S*/ /*O si: on a option n (on n'a pas l'option j) et mode bavard (option v) écrire le nom du fichier lu et les option */ if(n||v||s) /*www modifié le 10/03/2010 par JPL */ { /*S*/ if(v)fprintf(pfdoc,gettext("%s\n(file %s :)"), NL, fsrc ); if( v || s ) printf(gettext("\n\n(file %s :)\n"),fsrc); if(v)fprintf (pfdoc,gettext("Options a=%d f=%d j=%d l=%d n=%d p=%d s=%d t=%d w=%d"),a,f,j,l,n,p,s,t,w); fprintf (pfdoc, "%s", NL ); } /*S*/ if(l||p) tri_(pfdoc,pnfile); if(A)asm_(pfdoc,pnfile); else if(B)basic_(pfdoc,pnfile); else if(C) cpp_(pfdoc,pnfile); /*www modifié le 10/03/2010 par JPL */ else if(F)fortran_(pfdoc,pnfile); else if(P)pascal_(pfdoc,pnfile); else if(S) shell_(pfdoc,pnfile); else if(l==0&&p==0) { /*S*/ printf(gettext("Error, programming language not found !.\n.Exit 2\n")); exit(2); } /*S*/ /*O fermer le fichier depouille */ if (fclose(pnfile)) { /*S*/ printf(gettext("Closure error: \'%s\'\n.Exit 2 \n"),fdoc); exit(2); } /*S*/ } /*S*/ } /*S !j */ /*O fermer le fichier documentaire */ if (fclose(pfdoc)) { /*S*/ printf(gettext("Closure \'%s\' error\n.Exit 2\n"),fdoc); exit(2); } /*S*/ /*O ecrire DOC "file_src" END */ if(v) printf(gettext("\n\nDOC %s END\n"),fdoc); } /*S corps */ } /*S main */