//Ecrit le caractère de la chaine cible avec la liaison éventuelle void Transcription::ecritPhon(char c) { if (liaison>0) { if ((liaison<10 && c>9) || (liaison>9 && c<10)) { //liaison possible ecrit(liaison+65); //évite 0 et rend visibles les caractères } } ecrit(c+65); //évite 0 et rend visibles les caractères liaison=0; }
static int ecrit(C_OBJ *obj, int x, int *y, int wc, int hc, int ystop) { char ligne[256]; int x1; int fin_ecran; x1=x; if (obj) /* Si l'oject existe */ { if (obj==sel_obj) /* Si c'est l'objet s‚lectionn‚ */ vst_color(VDIhandle, RED); /* Rouge pour ˆtre vu en moyenne res */ else vst_color(VDIhandle, BLACK); if (obj->type==t_donnee) ecrit_donnee(obj, ligne, x, *y, wc, hc, &x1); else if (obj->type==t_d_procedure || obj->type==t_procedure) ecrit_procedure(obj, ligne, x, *y, wc, hc, &x1); else if (obj->type==t_t_type) ecrit_type(obj, ligne, x, *y, wc, hc, &x1); else if (obj->type==t_bloc) ecrit_bloc(obj, ligne, x, *y, wc, hc, &x1); if (obj->commentaire) /* Afficher le commemtaire */ { vst_effects(VDIhandle, 4); /* texte italique */ if (x1>x+55*wc) /* Le commentaire est si il y a la place … la 50 iŠme colonne */ x1+=5*wc; else x1=(60*wc) +x; v_gtext (VDIhandle, x1, *y, obj->commentaire); /* Afficher la ligne */ } *y+=hc; if(*y<=ystop) /* Si on est pas … la fin de l'‚cran */ { if (obj->fils) fin_ecran=ecrit(obj->fils, x+tab*wc, y, wc, hc, ystop); /* g‚nial c'est r‚cursif */ if (obj->suivant) fin_ecran=ecrit(obj->suivant, x, y, wc, hc, ystop); /* g‚nial c'est r‚cursif */ } } }
//Phonème alpha -> phonème interne void Transcription::phonemePhoneme(char* texte, char* texPhon) { char c; texteLec=texte; texteEcr=texPhon; iLec=0; iEcr=0; while (true) { if (!carSuiv()) break; c=tab->tPhon(tab->tWin(carac)); if (c==NULP) continue; ecrit(c+65); //évite 0 et rend visibles les caractères } texPhon[iEcr]=0; }
void affiche(void) { int xw, yw, ww, hw, pxy[4], x, y; int wcell, hcell, attributs[10]; int dummy; C_OBJ *obj; vqt_attributes(VDIhandle, attributs); wcell=attributs[8]; hcell=attributs[9]; /* Coordonn‚es zone de travail fenˆtre : */ wind_get (buf[3], WF_WORKXYWH, &xw, &yw, &ww, &hw); vst_alignment (VDIhandle, 0, 5, &dummy, &dummy); /* Texte en haut … gauche */ x=xw-(prog.w_col-tab*generation(curr_aff))*wcell; y=yw; ecrit(curr_aff, x, &y, wcell, hcell, yw+hw); if(curr_aff->pere) /* ce bloc traite le cas o— les parents de curr_aff ne sont pas affiche */ { obj=curr_aff->pere; while (y<yw+hw && obj->suivant) { x-=tab*wcell; ecrit(obj->suivant, x, &y, wcell, hcell, yw+hw); if (obj->pere) obj=obj->pere; else y=yw+hw+1; /* cree un condition fausse pour sortir de la boucle */ } } }
//Lit le caractère suivant unsigned char Transcription::carSuiv() { while (true) { carac=(unsigned char)texteLec[iLec++]; if ((char)carac==MARQ_MARQ) { if (texteLec[iLec]==MARQ_INDEX) { ecrit(INDEX); iLec++; continue; } } break; } categ=tab->tCat(carac); return carac; }
//minuscules -> majuscules et traitement carac répété n fois void Transcription::minMajNFois(char* texteAlphaLec, char* texteAlphaEcr) { short nbFois; char chaine[5]; //pour nbFois short iLecCherche; texteLec=texteAlphaLec; texteEcr=texteAlphaEcr; iLec=0; iEcr=0; while (true) { carac=(unsigned char)texteLec[iLec++]; if ((char)carac==MARQ_MARQ) { if (texteLec[iLec]==MARQ_INDEX) { if (iEcr<NM_CAR_TEX_2) { texteEcr[iEcr++]=MARQ_MARQ; texteEcr[iEcr++]=MARQ_INDEX; } iLec++; continue; } } if (carac==0) break; if ((carac<48 && carac >32) || carac>57) { //pas les chiffres ni esp ni tab if (texteLec[iLec]==carac) { if (texteLec[iLec+1]==carac) { nbFois=3; //déjà trois fois for (iLecCherche=iLec+2; texteLec[iLecCherche]==carac; iLecCherche++) nbFois++; if (iEcr<NM_CAR_TEX_8) { sprintf(chaine, "%d", nbFois); texteEcr[iEcr]=0; //pour concaténer strcat(texteEcr, chaine); iEcr+=strlen(chaine); texteEcr[iEcr++]=tab->FOIS; texteEcr[iEcr++]=(char)tab->tWin(carac); texteEcr[iEcr++]=' '; iLec=iLecCherche; continue; } } } } carac=tab->tWin(carac); ecrit(carac); } texteEcr[iEcr]=0; }
void Fenetre::ecrit(int ax, int ay, int valeur) { char val[20]; sprintf(val,"%d",valeur); // transformer l'entier en chaîne ecrit(ax, ay, val); }