#include #include #include #include "clsinfo.h" /* Affiche récursivement l'arbre de dérivation. */ PRIVATE int CLSFORM::printr ( const char *base, FILE *fout, int indent, OUTPUT_STYLE style) { int nxtindent = indent + 4; bool one = false; int nbder = ders.getnb(); for (int i=0; ibase->nom,base)==0){ if (!one){ if (style == OUTPUT_SGML){ fprintf (fout,"%*s\n",indent,""); }else{ fprintf (fout,"%*s
    \n",indent,""); } } one = true; CLS_INFO *info = ptder->info; if (style == OUTPUT_SGML){ fprintf (fout,"%*s%s %s",indent,"",info->nom,ptder->opt); }else if (style == OUTPUT_HTML){ fprintf (fout,"%*s
  • %s %s",indent,"",info->nom,ptder->opt); }else{ fprintf (fout,"%*s%s %s",indent,"",info->nom,ptder->opt); } info->nbprint++; if (info->nbbase > 1){ fprintf (fout," %d/%d",info->nbprint,info->nbbase); } fprintf (fout,"\n"); if (info->nbprint == 1){ printr (info->nom,fout,nxtindent,style); } } } if (one){ if (style == OUTPUT_SGML){ fprintf (fout,"%*s\n",indent,""); }else if (style == OUTPUT_HTML){ fprintf (fout,"%*s
\n",indent,""); } } return 0; } static int cmp (const ARRAY_OBJ *p1, const ARRAY_OBJ *p2) { CLS_DERIVE *d1 = (CLS_DERIVE *)p1; CLS_DERIVE *d2 = (CLS_DERIVE *)p2; return strcmp(d1->info->nom,d2->info->nom); } /* Affiche les classes sous forme d'arbre. Les classes de base apparaissent à gauche. */ PUBLIC int CLSFORM::print (FILE *fout, OUTPUT_STYLE style) { int nbinfo = infos.getnb(); for (int i=0; inbprint = 0; } ders.sort (cmp); printr("-",fout,0,style); return 0; }