Projet mkd/find.c
De Wiki EELL.
Version du 19 décembre 2010 à 14:44 par JPL (discuter | contributions)
| | Cette page n'est pas finie. Veuillez considérer le plan et le contenu comme incomplets et en préparation, temporaires et sujets à caution. Si vous souhaitez participer, il vous est recommandé de consulter sa page de discussion au préalable. |
Retour aux fichiers en développement →
- find.inc.c : Ce fichier est à revoir il n'est pas indépendant! ...--jpl 19 décembre 2010 à 14:44 (UTC)
/*P maj R3.11 04/01/91 par JPL */
{ /*S find */
L=0;
if(v) printf("Find Souce File Language, \'%s\': ",fsrc);
if(k)
{ /*S chercher */
#ifndef UNIX_ONLY
if((tolower(fsrc[k+1]))=='a'&&
(tolower(fsrc[k+2]))=='s'&&
(tolower(fsrc[k+3]))=='m') {L=1;A=1;printf("ASM\n");}
else if((tolower(fsrc[k+1]))=='b'&&
(tolower(fsrc[k+2]))=='a'&&
(tolower(fsrc[k+3]))=='s') {L=1;B=1;printf("BASIC\n");}
else if(
( ( (c=tolower(fsrc[k+1])) == 'c' ||
c=='h'||c=='i') &&
fsrc[k+2]=='\0')
||
(c=='p'&&
(tolower(fsrc[k+2]))=='r'&&
(tolower(fsrc[k+3]))=='o') ) {L=1;C=1;printf("C or PROLOG\n");}
else if((tolower(fsrc[k+1]))=='f'&&
(tolower(fsrc[k+2]))=='o'&&
(tolower(fsrc[k+3]))=='r') {L=1;F=1;printf("FORTRAN\n");}
else if((tolower(fsrc[k+1]))=='p'&&
(tolower(fsrc[k+2]))=='a'&&
(tolower(fsrc[k+3]))=='s') {L=1;P=1;printf("PASCAL\n");}
#endif
#ifndef PC_ONLY
if((c=tolower(fsrc[k+1]))=='s'&&
fsrc[k+2]=='\0') {L=1;A=1;printf("Assembler\n");}
else if(c=='f'&&fsrc[k+2]=='\0') {L=1;F=1;printf("Fortran\n");}
else if(c=='p'&&fsrc[k+2]=='\0') {L=1;P=1;printf("Pascal\n");}
else if( c=='c'&&
(tolower(fsrc[k+2]))=='s'&&
(tolower(fsrc[k+3]))=='h') {L=1;S=1;printf("Cshell\n");}
else if( c=='s'&&
(tolower(fsrc[k+2]))=='h'&&
(tolower(fsrc[k+3]))=='\0') {L=1;S=1;printf("Shell\n");}
else if(c=='r'&&fsrc[k+2]=='\0') {L=1;S=1;printf("Ratfor\n");}
#endif
#ifdef UNIX_ONLY
else if((c=='c'||
c=='i'|| c=='h')&&
fsrc[k+2]=='\0') {L=1;C=1;printf("C or C after cpp\n");}
#endif
#ifndef ARGS_EXAM
else if((tolower(fsrc[k+1]))=='p'&&
(tolower(fsrc[k+2]))=='r'&&
(tolower(fsrc[k+3]))=='j') {L=1;j=1;printf("Project file\n");}
#endif
} /*S chercher */
/*O si le langage n'est pas trouve: */
if(!L)
/*O alors: */
{ /*S*/
/*O mettre les drapeaux (options ABC... ) a 0 */
A=B=C=F=P=S=0;
/*O demander le type de langage du fichier et positionner le drapeau */
printf("\n*** Source file: language not found. (Enter A,B,C,F,P,S,l or p)\n");
#ifndef ARGS_EXAM
if(!j)printf("*** For project file: exit and use option -j.\n");
#endif
printf("Enter ESCAPE for exit ?:");
if(j)printf("\b\bor space_bar for Ignore ?: ");
if((c=getch())==0x1B){ /*S*/ printf("\n.Exit 1\n");exit(1);} /*S*/
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=='l')l=1;
else if(c=='p')p=1;
else { /*S*/printf("\n.Exit 2\n"); exit(2);} /*S*/
printf("\n");
L=A+B+C+F+P+S;
/*O si aucun drapeau langage n'est positionne envoyer BEL */
if(!(L==1||p||l))putch(0x7);
putch('\n');
} /*S*/
} /*S find */

