Yannick
Nombre de messages : 8611 Age : 53 Localisation : Bretagne Date d'inscription : 15/02/2010
| Sujet: SRC INFOS Mer 7 Aoû 2019 - 5:01 | |
| Bon, j' avais besoin de lister les variables d' un vieux source pour y ajouter une bricole (Avec le temps, on oublie vite ce que l' on a fait). Je suis donc parti d' une dizaines de ligne et de fil en aiguille... ...j' ai fini par en arriver là : - Code:
-
' Src Infos ' Vs 1.0 ' Y.GERONIMI ' 06/08/2019 ' ============================================================================== ' VARIABLES ' ============================================================================== ' Gestion des objets dim no% ' Gestion du fichieer analysé dim cnt% ' ============================================================================== ' CONSTANTES ' ============================================================================== ' fichiers image dim ImgSearch$ dim ImgAnalyse$ dim ImgIllustr$ ' Objets dim Odial% dim Sdial% dim Frame%(5) dim Alph%(12) dim EditFile% dim BtnSearchFile% dim ListVar% dim ListSsProg% dim ListSub% dim ListFnc% dim BtnAnalyse% dim Memory% dim FenWait% dim illustr% dim Statement% ' ============================================================================== ' LABELS ' ============================================================================== Label CLIC Label FIN ' ============================================================================== ' DATAS ' ============================================================================== rem NO DATAS ' ============================================================================== ' PROGRAMME ' ============================================================================== InitImageFiles$() InitConstantesObjets() Gui() End ' ============================================================================== ' SOUS PROGRAMMES ' ============================================================================== CLIC: if number_click = BtnSearchFile% text EditFile%,OpenSrcFiles$(Odial%) if trim$(text$(EditFile%))<>"" clear Memory% file_load Memory%,text$(EditFile%) cnt%=count(Memory%) CleanAllList() end_if end_if if number_click = BtnAnalyse% if trim$(text$(EditFile%))<>"" CleanAllList() inactive BtnAnalyse% DeplaceForm(1) FenAttente(cnt%) caption alph%(7),"Recherche des variables..." AnalyseVariables(Memory%,Statement%,ListVar%) position Statement%,0 wait 1000 caption alph%(7),"Recherche des sous programmes..." AnalyseSsProg(Memory%,Statement%,ListSsProg%) position Statement%,0 wait 1000 caption alph%(7),"Recherche des procédures..." AnalyseSub(Memory%,Statement%,ListSub%) position Statement%,0 wait 1000
caption alph%(7),"Recherche des fonctions..." AnalyseFnc(Memory%,Statement%,ListFnc%) position Statement%,0 wait 1000 hide FenWait% DeplaceForm(2) active BtnAnalyse% end_if end_if return ' ------------------------------------------------------------------------------ FIN: Terminate return ' ============================================================================== ' PROCEDURES ' ============================================================================== Sub Gui() dim_local i%
border_small 0 height 0,450 : width 0,680 top 0,(screen_y-height(0))/2 : left 0,(screen_x-width(0))/2 color 0,230,230,230 font_name 0,"Arial" : font_size 0,10 : font_bold 0 : font_color 0,0,0,150 caption 0,"SRC INFOS" on_close 0,FIN
panel Frame%(1) height Frame%(1),height_client(0)-20 : width Frame%(1),width_client(0)-20 top Frame%(1),10 : left Frame%(1),10 color Frame%(1),140,185,255 alpha Alph%(1) parent Alph%(1),Frame%(1) caption Alph%(1),"Fichier source :" top Alph%(1),10 : left Alph%(1),10 edit EditFile% parent EditFile%,Frame%(1) width EditFile%,width_client(Frame%(1))-54 top EditFile%,top(Alph%(1))+height(Alph%(1))+5 : left EditFile%,10 color EditFile%,175,215,255 font_name EditFile%,"Times new roman" : font_size EditFile%,10 : font_color EditFile%,0,0,0 button_picture BtnSearchFile% parent BtnSearchFile%,Frame%(1) button_picture_target_is_object height BtnSearchFile%,24 : width BtnSearchFile%,24 top BtnSearchFile%,top(EditFile%) : left BtnSearchFile%,left(EditFile%)+width(EditFile%)+10 button_picture_target_is_picture height BtnSearchFile%,20 : width BtnSearchFile%,20 file_load BtnSearchFile%,ImgSearch$ cursor_point BtnSearchFile% on_click BtnSearchFile%,CLIC alpha Alph%(2) parent Alph%(2),Frame%(1) caption Alph%(2),"Variables :" top Alph%(2),top(EditFile%)+height(EditFile%)+5 : left Alph%(2),10 alpha Alph%(8) parent Alph%(8),Frame%(1) caption Alph%(8),"" font_color Alph%(8),0,0,250 top Alph%(8),top(EditFile%)+height(EditFile%)+5 : left Alph%(8),left(Alph%(2))+width(Alph%(2))+5 list ListVar% parent ListVar%,Frame%(1) height ListVar%,height_client(Frame%(1))-height(EditFile%)-height(Alph%(1))-50 : width ListVar%,230 top ListVar%,top(Alph%(2))+height(Alph%(2))+5 : left ListVar%,10 color ListVar%,175,215,255 font_name ListVar%,"Times new roman" : font_size ListVar%,10 : font_color ListVar%,0,0,0
alpha Alph%(3) parent Alph%(3),Frame%(1) caption Alph%(3),"Sous Programmes :" top Alph%(3),top(EditFile%)+height(EditFile%)+5 : left Alph%(3),left(ListVar%)+width(ListVar%)+10
alpha Alph%(9) parent Alph%(9),Frame%(1) caption Alph%(9),"" font_color Alph%(9),0,0,250 top Alph%(9),top(EditFile%)+height(EditFile%)+5 : left Alph%(9),left(Alph%(3))+width(Alph%(3))+5
list ListSsProg% parent ListSsProg%,Frame%(1) height ListSsProg%,70 : width ListSsProg%,width_client(Frame%(1))-width(ListVar%)-30 top ListSsProg%,top(Alph%(2))+height(Alph%(2))+5 : left ListSsProg%,left(ListVar%)+width(ListVar%)+10 color ListSsProg%,175,215,255 font_name ListSsProg%,"Times new roman" : font_size ListSsProg%,10 : font_color ListSsProg%,0,0,0
alpha Alph%(4) parent Alph%(4),Frame%(1) caption Alph%(4),"Procédures :" top Alph%(4),top(ListSsProg%)+height(ListSsProg%)+5 : left Alph%(4),left(ListVar%)+width(ListVar%)+10
alpha Alph%(10) parent Alph%(10),Frame%(1) caption Alph%(10),"" font_color Alph%(10),0,0,250 top Alph%(10),top(ListSsProg%)+height(ListSsProg%)+5 : left Alph%(10),left(Alph%(4))+width(Alph%(4))+5
list ListSub% parent ListSub%,Frame%(1) height ListSub%,70 : width ListSub%,width_client(Frame%(1))-width(ListVar%)-30 top ListSub%,top(Alph%(4))+height(Alph%(4))+5 : left ListSub%,left(ListVar%)+width(ListVar%)+10 color ListSub%,175,215,255 font_name ListSub%,"Times new roman" : font_size ListSub%,10 : font_color ListSub%,0,0,0
alpha Alph%(5) parent Alph%(5),Frame%(1) caption Alph%(5),"Fonctions :" top Alph%(5),top(ListSub%)+height(ListSub%)+5 : left Alph%(5),left(ListVar%)+width(ListVar%)+10
alpha Alph%(11) parent Alph%(11),Frame%(1) caption Alph%(11),"" font_color Alph%(11),0,0,250 top Alph%(11),top(ListSub%)+height(ListSub%)+5 : left Alph%(11),left(Alph%(5))+width(Alph%(5))+5
list ListFnc% parent ListFnc%,Frame%(1) height ListFnc%,70 : width ListFnc%,width_client(Frame%(1))-width(ListVar%)-30 top ListFnc%,top(Alph%(5))+height(Alph%(5))+5 : left ListFnc%,left(ListVar%)+width(ListVar%)+10 color ListFnc%,175,215,255 font_name ListFnc%,"Times new roman" : font_size ListFnc%,10 : font_color ListFnc%,0,0,0 button_picture BtnAnalyse% parent BtnAnalyse%,Frame%(1) caption BtnAnalyse%,"Analyser le fichier" button_picture_target_is_object height BtnAnalyse%,28 : width BtnAnalyse%,width(ListFnc%) top BtnAnalyse%,height_client(Frame%(1))-height(BtnAnalyse%)-10 : left BtnAnalyse%,left(ListFnc%) button_picture_target_is_picture picture_left BtnAnalyse% height BtnAnalyse%,24 : width BtnAnalyse%,24 file_load BtnAnalyse%,ImgAnalyse$ cursor_point BtnAnalyse% on_click BtnAnalyse%,CLIC dlist Memory% End_sub ' ------------------------------------------------------------------------------ Sub FenAttente(c%) if object_exists(FenWait%)=0 form FenWait% border_hide FenWait% height FenWait%,100 : width FenWait%,width(0)-15 top FenWait%,top(0)+height(0)+1 : left FenWait%,left(0)+7 color FenWait%,230,230,230 font_name FenWait%,"Arial" : font_size FenWait%,10 : font_bold FenWait% : font_color FenWait%,0,0,150 panel Frame%(2) parent Frame%(2),FenWait% height Frame%(2),height_client(FenWait%)-20 : width Frame%(2),width_client(FenWait%)-20 top Frame%(2),10 : left Frame%(2),10 color Frame%(2),140,185,255 picture illustr% parent illustr%,Frame%(2) height illustr%,79 : width illustr%,80 top illustr%,1 : left illustr%,width_client(Frame%(2))-height(illustr%)-20 file_load illustr%,ImgIllustr$ alpha Alph%(6) parent Alph%(6),Frame%(2) caption Alph%(6),"Analyse du fichier..." top Alph%(6),10 : left Alph%(6),10 progress_bar Statement% parent Statement%,Frame%(2) width Statement%,300 top Statement%,top(Alph%(6))+height(Alph%(6))+5 : left Statement%,10 alpha Alph%(7) parent Alph%(7),Frame%(2) caption Alph%(7),"." font_bold_off Alph%(7) : font_italic Alph%(7) top Alph%(7),top(Statement%) : left Alph%(7),left(Statement%)+width(Statement%)+5 else show FenWait% end_if min Statement%,0 : max Statement%,c% : position Statement%,0 End_sub ' ------------------------------------------------------------------------------ Sub InitImageFiles$() ImgSearch$ = dir_current$+"\Search.bmp" ImgAnalyse$ = dir_current$+"\Analyse.bmp" ImgIllustr$ = dir_current$+"\Search2.bmp" End_sub ' ------------------------------------------------------------------------------ Sub InitConstantesObjets() dim_local i% no%=no%+1 : Odial%=no% no%=no%+1 : Sdial%=no% for i%=1 to 5 : no%=no%+1 : Frame%(i%)=no% : next i% for i%=1 to 12: no%=no%+1 : Alph%(i%)=no% : next i% no%=no%+1 : EditFile%=no% no%=no%+1 : BtnSearchFile%=no% no%=no%+1 : ListVar%=no% no%=no%+1 : ListSsProg%=no% no%=no%+1 : ListSub%=no% no%=no%+1 : ListFnc%=no% no%=no%+1 : BtnAnalyse%=no% no%=no%+1 : Memory%=no% no%=no%+1 : FenWait%=no% no%=no%+1 : illustr%=no% no%=no%+1 : Statement%=no% End_sub ' ------------------------------------------------------------------------------ Sub DeplaceForm(sens%) dim_local i% if sens%=1 for i%=1 to 101 top 0,top(0)-1 next i% else for i%=1 to 101 top 0,top(0)+1 next i% end_if End_sub ' ------------------------------------------------------------------------------ Sub CleanAllList() dim_local i% for i%=8 to 11 caption Alph%(i%),"" next i% clear ListVar% clear ListSsProg% clear ListSub% clear ListFnc% End_sub ' ------------------------------------------------------------------------------ Sub AnalyseVariables(obj1%,obj2%,obj3%) dim_local i%,x%,l$,lg$,mot$,n%,z% z%=len(str$(count(obj1%)))+1 for i%=1 to count(obj1%) l$=trim$(item_read$(obj1%,i%)) if instr(l$,chr$(58))>0 l$=left$(l$,instr(l$,chr$(58))-1) end_if if upper$(left$(l$,4))="DIM"+chr$(32) lg$=right$(string$(z%-len(str$(i%)),"0")+str$(i%),z%-1) l$=right$(l$,len(l$)-3) : l$=trim$(l$) if instr(l$,chr$(44))=0 item_add obj3%,lg$+chr$(32)+chr$(124)+l$ n%=n%+1 caption Alph%(8),"["+str$(n%)+"]" display else while instr(l$,chr$(44))>0 mot$=left$(l$,instr(l$,chr$(44))-1) mot$=trim$(mot$) l$ = right$(l$,len(l$)-instr(l$,chr$(44))) item_add obj3%,lg$+chr$(32)+chr$(124)+mot$ if len(l$)-instr(l$,chr$(44))=0 mot$=trim$(l$) item_add obj3%,lg$+chr$(32)+chr$(124)+mot$ n%=n%+1 caption Alph%(8),"["+str$(n%)+"]" display end_if end_while end_if end_if position obj2%,position(obj2%)+1 display next i% End_sub ' ------------------------------------------------------------------------------ Sub AnalyseSsProg(obj1%,obj2%,obj3%) dim_local i%,x%,l$,lg$,mot$,n%,z% z%=len(str$(count(obj1%)))+1 for i%=1 to count(obj1%) l$=trim$(item_read$(obj1%,i%)) if upper$(left$(l$,6))="LABEL"+chr$(32) lg$=right$(string$(z%-len(str$(i%)),"0")+str$(i%),z%-1) l$=right$(l$,len(l$)-5) : l$=trim$(l$) if instr(l$,chr$(44))=0 item_add obj3%,lg$+chr$(32)+chr$(124)+l$ n%=n%+1 caption Alph%(9),"["+str$(n%)+"]" display else while instr(l$,chr$(44))>0 mot$=left$(l$,instr(l$,chr$(44))-1) mot$=trim$(mot$) l$ = right$(l$,len(l$)-instr(l$,chr$(44))) item_add obj3%,lg$+chr$(32)+chr$(124)+mot$ if len(l$)-instr(l$,chr$(44))=0 mot$=trim$(l$) item_add obj3%,lg$+chr$(32)+chr$(124)+mot$ n%=n%+1 caption Alph%(9),"["+str$(n%)+"]" display end_if end_while end_if end_if position obj2%,position(obj2%)+1 display next i% End_sub ' ------------------------------------------------------------------------------ Sub AnalyseSub(obj1%,obj2%,obj3%) dim_local i%,l$,lg$,lwl$,mot$,n%,z% z%=len(str$(count(obj1%)))+1 for i%=1 to count(obj1%) l$=trim$(item_read$(obj1%,i%)) lwl$=left$(l$,4) if upper$(lwl$)="SUB"+chr$(32) lg$=right$(string$(z%-len(str$(i%)),"0")+str$(i%),z%-1) mot$=trim$(right$(l$,len(l$)-3)) item_add obj3%,lg$+chr$(32)+chr$(124)+mot$ n%=n%+1 caption Alph%(10),"["+str$(n%)+"]" display end_if position obj2%,position(obj2%)+1 display next i% End_sub ' ------------------------------------------------------------------------------ Sub AnalyseFnc(obj1%,obj2%,obj3%) dim_local i%,l$,lg$,lwl$,mot$,n%,z% z%=len(str$(count(obj1%)))+1 for i%=1 to count(obj1%) l$=trim$(item_read$(obj1%,i%)) lwl$=left$(l$,4) if upper$(lwl$)="FNC"+chr$(32) lg$=right$(string$(z%-len(str$(i%)),"0")+str$(i%),z%-1) mot$=trim$(right$(l$,len(l$)-3)) item_add obj3%,lg$+chr$(32)+chr$(124)+mot$ n%=n%+1 caption Alph%(11),"["+str$(n%)+"]" display end_if position obj2%,position(obj2%)+1 display next i% End_sub ' ============================================================================== ' FONCTIONS ' ============================================================================== Fnc OpenSrcFiles$(obj%) dim_local F$ open_dialog obj% dir_dialog obj%,"" filter obj%,"Panoramic|*.bas" F$ = file_name$(obj%) if F$<>"_" result F$ else result "" end_if delete obj% End_fnc
les images à remettre au format *.bmp :Search.bmp Analyse.bmp Search2.bmp
Dernière édition par Yannick le Mer 7 Aoû 2019 - 14:04, édité 2 fois | |
|