#include #include #include #include "permut.h" #include "clsinfo.h" #include "nadoc.m" PRIVATE int CLSFORM::flatfunc ( const char *clsname, NAP_LIST &lst, bool vue_interne, // Fonction utilisable dans les fonctions // membres de la classe // ou fonction utilisable par tous NAP_FCT **tbfct, int nbfct) { { NAP_FCT *fct = NULL; while (1){ fct = lst.locatemember (clsname,fct); if (fct == NULL) break; const char *desc = fct->desc; bool collect = false; if (vue_interne){ if (strncmp(desc,"PUBLIC ",7)==0 || strncmp(desc,"PROTECTED ",10)==0 || strstr(desc,"\nPROTECTED ")!=NULL || strstr(desc,"\nPUBLIC ")!=NULL){ collect = true; } }else if (strncmp(desc,"PUBLIC ",7)==0 || strstr(desc,"\nPUBLIC ")!=NULL){ collect = true; } if (collect){ // Make sure the function is not already collected const char *nom = strstr(fct->nom,"::"); nom += 2; bool skip = false; for (int i=0; inom,"::"); if (strcmp(nom,other+2)==0){ skip = true; break; } } if (!skip) tbfct[nbfct++] = fct; } } } int nbder = ders.getnb(); for (int i=0; iinfo->nom,clsname)==0){ bool col = false; const char *opt = ptder->opt; if (vue_interne){ if (strstr(opt,"protected")!=NULL || strstr(opt,"public")!=NULL){ col = true; } }else if (strstr(opt,"public")!=NULL){ col = true; } if (col){ const char *nombase = ptder->base->nom; nbfct = flatfunc (nombase,lst,vue_interne,tbfct,nbfct); } } } return nbfct; } /* Retrouve toute les functions disponibles publiquement pour un classe */ PUBLIC void CLSFORM::flatfunc ( const char *clsname, NAP_LIST &lst, bool vue_interne, // Fonction utilisable dans les fonctions // membres de la classe // ou fonction utilisable par tous OUTPUT_STYLE style, FILE *fout) { int nbfct = lst.getnb(); NAP_FCT **tbfct = (NAP_FCT**)malloc_err (nbfct*sizeof(NAP_FCT*),1); int nbcol = flatfunc (clsname,lst,vue_interne,tbfct,0); nap_sortmem (tbfct,nbcol); fprintf (fout,MSG_B(I_CLASSVIEW ,"Classe %s, %s\n","Class %s, %s\n") ,clsname ,vue_interne ? MSG_B(I_INTERNAL,"vue interne","internal view") : MSG_B(I_PUBLIC,"vue publique","public view")); if (style == OUTPUT_SGML){ printf ("\n"); }else if (style == OUTPUT_HTML){ printf ("
    \n"); } for (int i=0; i"); }else if (style == OUTPUT_HTML){ printf ("
  • "); } fprintf (fout,"\t%s\n",tbfct[i]->nom); } if (style == OUTPUT_SGML){ printf ("\n"); }else if (style == OUTPUT_HTML){ printf ("
\n"); } fputs ("\n",fout); free (tbfct); } /* Retrouve toute les functions disponibles publiquement pour toutes les classes. */ PUBLIC void CLSFORM::flatfunc ( NAP_LIST &lst, bool vue_interne, // Fonction utilisable dans les fonctions // membres de la classe // ou fonction utilisable par tous OUTPUT_STYLE style, FILE *fout) { int nbinfo = infos.getnb(); char **tbnom = (char**)malloc_err (nbinfo*sizeof(char*),1); for (int i=1; inom; } tbstr_sort (tbnom+1,nbinfo-1); for (int i=1; i