Marc
Nombre de messages : 2466 Age : 63 Localisation : TOURS (37) Date d'inscription : 17/03/2014
| Sujet: Analyse d'un source - Version 2.1 Dim 24 Déc 2017 - 12:49 | |
| Bonjour à tous ! Voici la version 2.1 de mon programme d’analyse d’un source. Bien plus performant, non pas en rapidité, mais en discrimination des mots clés. J’y ai intégré la fonction de recherche et une fonction de sauvegarde. L’analyse peut être sauvegardée sous un nom de fichier qui prendra automatiquement l’extension .SAV Lors de la sauvegarde, le programme crée également un sous répertoire du même nom que la sauvegarde, incluant les fichiers .TXT de l’analyse. On peut donc les imprimer individuellement pour travailler dessus. On peut recharger une sauvegarde (fichier .sav), ce qui permet de retrouver tous les écrans d’analyse instantanément sans attendre une nouvelle analyse. Le bouton Integral affiche la totalité du code source à analyser. Le bouton LABEL affiche les structures LABEL - GOSUB - RETURN Le bouton + LABEL classe les LABELs par ordre alphabétique avec leurs numéros de ligne. Le bouton SUB affiche les structures SUB - EXIT_SUB - END_SUB - FNC - RESULT - END_FNC Le bouton + SUB classe les SUB et les FNC ordre alphabétique avec leurs numéros de ligne. Le bouton DIM affiche les structures DIM - DIM_LOCAL - FREE Le bouton + DIM classe les DIMs par ordre alphabétique avec leurs numéros de ligne. Le bouton IF affiche les structures IF - THEN - ELSE - END_IF Le bouton FOR affiche les structures FOR - TO - STEP - EXIT_FOR - NEXT Le bouton WHILE affiche les structures WHILE - EXIT_WHILE - END_WHILE - REPEAT - EXIT_REPEAT - UNTIL Le bouton SELECT affiche les structures SELECT - CASE - END_SELECT - Code:
-
' ------------------------------------------------------------------------------ ' PANORAMIC FILE ANALYSER Version 2.1 ' MARC37 - February 2018 - Panoramic v0.9.28.i13 ' http://panoramic-language.pagesperso-orange.fr/French/index.html ' http://panoramic.forumotion.com ' ------------------------------------------------------------------------------ DIM a$ DIM b$ : ' Reading a line of BasicFileToAnalyse$ DIM c$ : ' uppercase of b$ DIM d$ : ' formatted line number as ###### DIM BasicFileToAnalyse$ DIM AlreadyExistingLine% DIM i%, j% : ' variable loop FOR/NEXT DIM k%, l%, f% DIM LineLength% DIM LineNumber%, FontSize%, MemoInUse% DIM StartingLinePosition% DIM Character$ DIM Word$, UpperWord$, LastWordDisplay$ DIM Line$ DIM z$ LABEL Resize, OpenFile, Bigger, Smaller, About, Save, Quit LABEL Integral, AllLabel, AllSub, AllIf, AllDim, AllForNext, AllWhile, AllSelect, FindText, DataEntry, StringSearch LABEL AllLabelMore, AllSubMore, AllDimMore FontSize% = 10 DLIST 50 : ' hiden object => code source to analyze DLIST 51 : ' hidden object => list of LABEL DLIST 52 : ' hidden object => Source code Upper No Quotes Mask() ON_CLOSE 0, Quit ON_RESIZE 0, Resize ON_CLICK 1, OpenFile ON_CLICK 2, Quit ON_CLICK 3, About ON_CLICK 4, Save ON_CLICK 5, Integral ON_CLICK 6, AllLabel ON_CLICK 7, AllLabelMore ON_CLICK 8, AllSub ON_CLICK 9, AllSubMore ON_CLICK 10, AllDim ON_CLICK 11, AllDimMore ON_CLICK 12, AllIf ON_CLICK 13, AllForNext ON_CLICK 14, ALLWhile ON_CLICK 15, AllSelect ON_CLICK 16, Smaller ON_CLICK 17, Bigger ON_CLiCK 18, FindText END ' ------------------------------------------------------------------------------ FindText: OFF_CLICK 18 FOR i%=20 TO 32 HIDE i% NEXT i% SHOW 31 MemoInUse% = 31 IF TEXT$(18)=" >> Search >>" THEN TEXT 18,"" Word$=TEXT$(18) DISPLAY GOSUB StringSearch RETURN ' ------------------------------------------------------------------------------ DataEntry: Word$=TEXT$(18) GOSUB StringSearch RETURN ' ------------------------------------------------------------------------------ StringSearch: UpperWord$ = UPPER$(Word$) CLEAR 31 WaitingMessage() DISPLAY FOR LineNumber% = 1 to COUNT(50) IF Word$="" b$=ITEM_READ$(20,LineNumber%) ITEM_ADD 31,b$ ELSE b$=UPPER$(ITEM_READ$(50,LineNumber%)) IF INSTR(b$,UpperWord$)>0 b$=ITEM_READ$(20,LineNumber%) ITEM_ADD 31,b$ END_IF END_IF ON_CHANGE 18, DataEntry NEXT LineNumber% HIDE 100 RETURN ' ------------------------------------------------------------------------------ OpenFile: IF OBJECT_EXISTS(40)=0 THEN OPEN_DIALOG 40 FILTER 40,"*.bas, *.sav|*.bas;*.sav" BasicFileToAnalyse$=FILE_NAME$(40) IF BasicFileToAnalyse$="_" THEN RETURN CAPTION 0, BasicFileToAnalyse$ CLEAR 50 CLEAR 51 CLEAR 52 FOR i% = 20 TO 31 CLEAR i% NEXT i% IF RIGHT$(BasicFileToAnalyse$,4)= ".sav" BasicFileToAnalyse$ = LEFT$(BasicFileToAnalyse$,LEN(BasicFileToAnalyse$)-4) IF DIR_EXISTS(BasicFileToAnalyse$+"_txt")= 0 THEN DIR_MAKE BasicFileToAnalyse$+"_txt" ARCHIVER_ON ARCHIVER_EXTRACT BasicFileToAnalyse$+".sav",BasicFileToAnalyse$+"_txt" ARCHIVER_OFF FILE_LOAD 50,BasicFileToAnalyse$+"_txt\Source.txt" FOR i%=20 TO 31 SELECT i% CASE 20 : FILE_LOAD i%,BasicFileToAnalyse$+"_txt\Integral.txt" CASE 21 : FILE_LOAD i%,BasicFileToAnalyse$+"_txt\Label.txt" CASE 22 : FILE_LOAD i%,BasicFileToAnalyse$+"_txt\Sub.txt" CASE 23 : FILE_LOAD i%,BasicFileToAnalyse$+"_txt\Dim.txt" CASE 24 : FILE_LOAD i%,BasicFileToAnalyse$+"_txt\If.txt" CASE 25 : FILE_LOAD i%,BasicFileToAnalyse$+"_txt\For.txt" CASE 26 : FILE_LOAD i%,BasicFileToAnalyse$+"_txt\While.txt" CASE 27 : FILE_LOAD i%,BasicFileToAnalyse$+"_txt\Select.txt" CASE 28 : FILE_LOAD i%,BasicFileToAnalyse$+"_txt\LabelMore.txt" CASE 29 : FILE_LOAD i%,BasicFileToAnalyse$+"_txt\SubMore.txt" CASE 30 : FILE_LOAD i%,BasicFileToAnalyse$+"_txt\DimMore.txt" CASE 31 : FILE_LOAD i%,BasicFileToAnalyse$+"_txt\Search.txt" END_SELECT NEXT i% TEXT 18, " >> Search >>" FOR i% = 4 TO 18 SHOW i% NEXT i% RETURN END_IF FOR i% = 4 TO 18 HIDE i% NEXT i% OFF_RESIZE 0 OFF_CLICK 1 OFF_CHANGE 18 ON_CLiCK 18, FindText LineNumber% = 1 FOR i% = 21 to 32 HIDE i% NEXT i% SHOW 20 TEXT 18, " >> Search >>" WaitingMessage() FILE_OPEN_READ 40,BasicFileToAnalyse$ WHILE FILE_EOF(40)<>1 b$=FILE_READLN$(40) d$=STR$(LineNumber%) WHILE LEN(d$)<6 d$=" "+d$ END_WHILE c$=UPPER$(b$) QuoteFilter() ITEM_ADD 50, b$ ITEM_ADD 20, d$+" "+b$ LineNumber% = LineNumber% + 1 END_WHILE FILE_CLOSE 40 Analyse() HIDE 100 ON_RESIZE 0, Resize ON_CLICK 1, OpenFile RETURN ' ------------------------------------------------------------------------------ SUB QuoteFilter() DIM_LOCAL DoubleQuote% LineLength% = LEN(c$) IF LineLength% = 0 ITEM_ADD 52,"" EXIT_SUB END_IF IF INSTR(c$,"REM ")>0 IF INSTR(c$,"REM ")=1 OR INSTR(c$," REM ")>0 OR INSTR(c$,":REM ")>0 c$= LEFT$(b$,INSTR(c$,"REM")) ITEM_ADD 52, c$ EXIT_SUB END_IF END_IF IF LineLength% > 0 DoubleQuote% = 0 Line$="" FOR i% = 1 to LineLength% Character$=MID$(c$,i%,1) IF Character$ = CHR$(39) AND DoubleQuote% = 0 ITEM_ADD 52, Line$ EXIT_SUB END_IF IF Character$ = CHR$(34) THEN DoubleQuote% = DoubleQuote% + 1 IF DoubleQuote% = 1 THEN Character$ = "x" IF DoubleQuote% = 2 THEN DoubleQuote% = 0 Line$ = Line$ + Character$ NEXT i% ITEM_ADD 52, Line$ END_IF END_SUB ' ------------------------------------------------------------------------------ SUB Analyse() IF COUNT(50) = 0 HIDE 100 IF MESSAGE_WARNING_OK("This file is empty !")=1 THEN EXIT_SUB END_IF ExtractingLabelNames() FOR LineNumber% = 1 to COUNT(50) AlreadyExistingLine% = 0 b$=ITEM_READ$(50,LineNumber%) c$=ITEM_READ$(52,LineNumber%) LineLength% = LEN(c$) d$=STR$(LineNumber%) WHILE LEN(d$)<6 d$=" "+d$ END_WHILE DisplayLabel() DisplaySub() DisplayIf() DisplayDim() DisplayFor() DisplayWhile() DisplaySelect() NEXT LineNumber% ITEM_ADD 28, " Number of LABEL(s) : .................. "+STR$(COUNT(28)) ITEM_ADD 29, " Number of SUB / FNC : .................. "+STR$(COUNT(29)) ITEM_ADD 30, " Number of DIM(s) : ................ "+STR$(COUNT(30)) FOR i% = 4 TO 18 SHOW i% NEXT i% END_SUB ' ------------------------------------------------------------------------------ SUB ExtractingLabelNames() FOR LineNumber% = 1 to COUNT(50) b$=ITEM_READ$(50,LineNumber%) c$=ITEM_READ$(52,LineNumber%) IF INSTR(c$,"LABEL ")>0 IF INSTR(c$,"LABEL ")=1 OR INSTR(c$," LABEL ")>0 OR INSTR(c$,":LABEL ")>0 StartingLinePosition% = INSTR(c$,"LABEL ")+6 LineLength%=LEN(b$) Word$ = "" FOR j% = StartingLinePosition% TO LineLength% Character$=MID$(b$,j%,1) IF ASC(Character$) = 58 Word$=Word$+":" ITEM_ADD 51, Word$ Word$ = "" EXIT_FOR END_IF IF ASC(Character$)>47 Word$ = Word$ + Character$ END_IF IF j% = LineLength% OR ASC(Character$) = 32 OR ASC(Character$) = 44 IF ASC(Word$) > 47 Word$=Word$+":" ITEM_ADD 51, Word$ Word$ = "" END_IF END_IF NEXT j% END_IF END_IF NEXT LineNumber% END_SUB ' ------------------------------------------------------------------------------ SUB DisplayLabel() IF INSTR(c$,"LABEL ")>0 IF INSTR(c$,"LABEL ")=1 OR INSTR(c$," LABEL ")>0 OR INSTR(c$,":LABEL ")>0 ITEM_ADD 21, d$+" "+b$ AlreadyExistingLine%=1 END_IF END_IF IF AlreadyExistingLine%=0 AND INSTR(c$,"GOSUB ")>0 IF INSTR(c$,"GOSUB ")=1 OR INSTR(c$," GOSUB ")>0 OR INSTR(c$,":GOSUB ")>0 ITEM_ADD 21, d$+" "+b$ AlreadyExistingLine%=1 END_IF END_IF IF AlreadyExistingLine% = 0 and COUNT(51) > 0 FOR i% = 1 to COUNT(51) Word$ = ITEM_READ$(51,i%) UpperWord$=UPPER$(Word$) IF INSTR(c$,UpperWord$)>0 j% = INSTR(c$,UpperWord$) IF INSTR(c$,UpperWord$)=1 ITEM_ADD 21,"" ITEM_ADD 21, d$+" "+b$ ITEM_ADD 28, " " + Word$ + " "+ STRING$(70-len(Word$),".")+ d$ AlreadyExistingLine% = 1 END_IF IF J%>1 IF MID$(b$,j%-1,1)= CHR$(32) OR MID$(b$,j%-1,1)= CHR$(58) ITEM_ADD 21,"" ITEM_ADD 21, d$+" "+b$ ITEM_ADD 28, " " + Word$ + " "+ STRING$(70-len(Word$),".")+ d$ AlreadyExistingLine% = 1 END_IF END_IF END_IF NEXT i% END_IF IF AlreadyExistingLine%=0 AND INSTR(c$,"RETURN")>0 IF INSTR(c$,"RETURN ")=1 OR INSTR(c$,"RETURN:")=1 OR INSTR(c$," RETURN ")>0 OR INSTR(c$,":RETURN ")>0 OR INSTR(c$,":RETURN:")> 0 OR INSTR(c$," RETURN:")> 0 OR INSTR(c$," RETURN") = (LineLength%-6) OR INSTR(c$,":RETURN") = (LineLength%-6) ITEM_ADD 21, d$+" "+b$ AlreadyExistingLine%=1 END_IF END_IF END_SUB ' ------------------------------------------------------------------------------ SUB DisplaySub() IF INSTR(c$,"SUB ")>0 IF INSTR(c$,"SUB ")=1 OR INSTR(c$," SUB ")>0 OR INSTR(c$,":SUB ")>0 ITEM_ADD 22, d$+" "+b$ ITEM_ADD 29, " " + b$ + " "+ STRING$(70-len(b$),".")+ d$ AlreadyExistingLine%=1 END_IF END_IF IF AlreadyExistingLine%=0 AND INSTR(c$,"EXIT_SUB")>0 IF INSTR(c$,"EXIT_SUB ")=1 OR INSTR(c$,"EXIT_SUB:")=1 OR INSTR(c$," EXIT_SUB ")>0 OR INSTR(c$,":EXIT_SUB ")>0 OR INSTR(c$,":EXIT_SUB:")> 0 OR INSTR(c$," EXIT_SUB:")> 0 OR INSTR(c$," EXIT_SUB") = (LineLength%-8) OR INSTR(c$,":EXIT_SUB") = (LineLength%-8) ITEM_ADD 22, d$+" "+b$ AlreadyExistingLine%=1 END_IF END_IF IF AlreadyExistingLine%=0 AND INSTR(c$,"END_SUB")>0 IF INSTR(c$,"END_SUB ")=1 OR INSTR(c$,"END_SUB:")=1 OR INSTR(c$," END_SUB ")>0 OR INSTR(c$,":END_SUB ")>0 OR INSTR(c$,":END_SUB:")> 0 OR INSTR(c$," END_SUB:")> 0 OR INSTR(c$," END_SUB") = (LineLength%-7) OR INSTR(c$,":END_SUB") = (LineLength%-7) ITEM_ADD 22, d$+" "+b$ ITEM_ADD 22, "" AlreadyExistingLine%=1 END_IF END_IF IF INSTR(c$,"FNC ")>0 IF INSTR(c$,"FNC ")=1 OR INSTR(c$," FNC ")>0 OR INSTR(c$,":FNC ")>0 ITEM_ADD 22, d$+" "+b$ ITEM_ADD 29, " " + b$ + " "+ STRING$(70-len(b$),".")+ d$ AlreadyExistingLine%=1 END_IF END_IF IF AlreadyExistingLine%=0 AND INSTR(c$,"RESULT")>0 IF INSTR(c$,"RESULT ")=1 OR INSTR(c$," RESULT ")>0 OR INSTR(c$,":RESULT ")>0 ITEM_ADD 22, d$+" "+b$ AlreadyExistingLine%=1 END_IF END_IF IF AlreadyExistingLine%=0 AND INSTR(c$,"END_FNC")>0 IF INSTR(c$,"END_FNC ")=1 OR INSTR(c$,"END_FNC:")=1 OR INSTR(c$," END_FNC ")>0 OR INSTR(c$,":END_FNC ")>0 OR INSTR(c$,":END_FNC:")> 0 OR INSTR(c$," END_FNC:")> 0 OR INSTR(c$," END_FNC") = (LineLength%-7) OR INSTR(c$,":END_FNC") = (LineLength%-7) ITEM_ADD 22, d$+" "+b$ ITEM_ADD 22, "" AlreadyExistingLine%=1 END_IF END_IF END_SUB ' ------------------------------------------------------------------------------ SUB DisplayIf() z$=" THEN " IF INSTR(c$,"IF ")>0 IF INSTR(c$,"IF ")=1 OR INSTR(c$," IF ")>0 OR INSTR(c$,":IF ")>0 ITEM_ADD 24, d$+" "+b$ IF INSTR(c$,z$)>0 THEN ITEM_ADD 24,"" AlreadyExistingLine%=1 LastWordDisplay$="IF" END_IF END_IF IF AlreadyExistingLine%=0 IF INSTR(c$,z$)>0 ITEM_ADD 24, d$+" "+b$ ITEM_ADD 24,"" : beep AlreadyExistingLine%=1 LastWordDisplay$=z$ END_IF END_IF IF AlreadyExistingLine%=0 AND INSTR(c$,"ELSE")>0 IF INSTR(c$,"ELSE ")=1 OR INSTR(c$,"ELSE:")=1 OR INSTR(c$," ELSE ")>0 OR INSTR(c$,":ELSE ")>0 OR INSTR(c$,":ELSE:")> 0 OR INSTR(c$," ELSE:")> 0 OR INSTR(c$," ELSE") = (LineLength%-4) OR INSTR(c$,":ELSE") = (LineLength%-4) ITEM_ADD 24, d$+" "+b$ AlreadyExistingLine%=1 LastWordDisplay$="ELSE" END_IF END_IF IF AlreadyExistingLine%=0 AND INSTR(c$,"END_IF")>0 IF INSTR(c$,"END_IF ")=1 OR INSTR(c$,"END_IF:")=1 OR INSTR(c$," END_IF ")>0 OR INSTR(c$,":END_IF ")>0 OR INSTR(c$,":END_IF:")> 0 OR INSTR(c$," END_IF:")> 0 OR INSTR(c$," END_IF") = (LineLength%-6) OR INSTR(c$,":END_IF") = (LineLength%-6) ITEM_ADD 24, d$+" "+b$ LastWordDisplay$="END_IF" AlreadyExistingLine%=1 END_IF END_IF END_SUB ' ------------------------------------------------------------------------------ SUB DisplayDim() IF INSTR(c$,"DIM ")>0 IF INSTR(c$,"DIM ")=1 OR INSTR(c$," DIM ")>0 OR INSTR(c$,":DIM ")>0 k% = 4 ITEM_ADD 23, d$+" "+b$ DisplayDimMore() AlreadyExistingLine%=1 END_IF END_IF IF INSTR(c$,"DIM_LOCAL ")>0 IF INSTR(c$,"DIM_LOCAL ")=1 OR INSTR(c$," DIM_LOCAL ")>0 OR INSTR(c$,":DIM_LOCAL ")>0 k% = 10 ITEM_ADD 23, d$+" "+b$ DisplayDimMore() AlreadyExistingLine%=1 END_IF END_IF IF INSTR(c$,"FREE ")>0 IF INSTR(c$,"FREE ")=1 OR INSTR(c$," FREE ")>0 OR INSTR(c$,":FREE ")>0 ITEM_ADD 23, d$+" "+b$ AlreadyExistingLine%=1 END_IF END_IF END_SUB ' ------------------------------------------------------------------------------ SUB DisplayDimMore() IF k% = 4 THEN StartingLinePosition% = INSTR(c$,"DIM ")+4 IF k% = 10 THEN StartingLinePosition% = INSTR(c$,"DIM_LOCAL ")+10 LineLength%=LEN(b$) Word$ = "" f% = 0 FOR j% = StartingLinePosition% TO LineLength% Character$=MID$(b$,j%,1) IF ASC(Character$)=40 THEN f%=1 IF ASC(Character$)=41 THEN f%=0 IF ASC(Character$)=44 AND f%=0 AND Word$<>"" IF k% = 4 THEN ITEM_ADD 30, " " + Word$ + " " + STRING$(70-len(Word$),".")+d$+" DIM" IF k% = 10 THEN ITEM_ADD 30, " " + Word$ + " " + STRING$(70-len(Word$),".")+d$+" DIM_LOCAL" Word$ = "" END_IF IF ASC(Character$)<>44 AND ASC(Character$)<>58 AND ASC(Character$)>35 THEN Word$ = Word$ + Character$ IF ASC(Character$)=44 AND f%=1 THEN Word$ = Word$ + Character$ IF ASC(Character$)=58 OR j% = LineLength% IF Word$<>"" IF k% = 4 THEN ITEM_ADD 30, " " + Word$ + " " + STRING$(70-len(Word$),".")+d$+" DIM" IF k% = 10 THEN ITEM_ADD 30, " " + Word$ + " " + STRING$(70-len(Word$),".")+d$+" DIM_LOCAL" END_IF Word$ = "" EXIT_FOR END_IF NEXT j% END_SUB ' ------------------------------------------------------------------------------ SUB DisplayFor() IF INSTR(c$,"FOR ")>0 IF INSTR(c$,"FOR ")=1 OR INSTR(c$," FOR ")>0 OR INSTR(c$,":FOR ")>0 ITEM_ADD 25, d$+" "+b$ AlreadyExistingLine%=1 END_IF END_IF IF AlreadyExistingLine%=0 AND INSTR(c$," TO ")>0 THEN ITEM_ADD 25, d$+" "+b$ : AlreadyExistingLine%=1 IF AlreadyExistingLine%=0 AND INSTR(c$," STEP ")>0 THEN ITEM_ADD 25, d$+" "+b$ : AlreadyExistingLine%=1 IF AlreadyExistingLine%=0 AND INSTR(c$,"EXIT_FOR")>0 IF INSTR(c$,"EXIT_FOR ")=1 OR INSTR(c$,"EXIT_FOR:")=1 OR INSTR(c$," EXIT_FOR ")>0 OR INSTR(c$,":EXIT_FOR ")>0 OR INSTR(c$,":EXIT_FOR:")> 0 OR INSTR(c$," EXIT_FOR:")> 0 OR INSTR(c$," EXIT_FOR") = (LineLength%-8) OR INSTR(c$,":EXIT_FOR") = (LineLength%-8) ITEM_ADD 25, d$+" "+b$ AlreadyExistingLine%=1 END_IF END_IF IF AlreadyExistingLine%=0 AND INSTR(c$,"NEXT ")>0 IF INSTR(c$,"NEXT ")=1 OR INSTR(c$," NEXT ")>0 OR INSTR(c$,":NEXT ")>0 ITEM_ADD 25, d$+" "+b$ ITEM_ADD 25,"" AlreadyExistingLine%=1 END_IF END_IF END_SUB ' ------------------------------------------------------------------------------ SUB DisplayWhile() IF INSTR(c$,"WHILE ")>0 IF INSTR(c$,"WHILE ")=1 OR INSTR(c$," WHILE ")>0 OR INSTR(c$,":WHILE ")>0 ITEM_ADD 26, d$+" "+b$ AlreadyExistingLine%=1 END_IF END_IF IF INSTR(c$,"REPEAT")>0 IF INSTR(c$,"REPEAT ")=1 OR INSTR(c$,"REPEAT:")=1 OR INSTR(c$," REPEAT ")>0 OR INSTR(c$,":REPEAT ")>0 OR INSTR(c$,":REPEAT:")> 0 OR INSTR(c$," REPEAT:")> 0 OR INSTR(c$," REPEAT") = (LineLength%-6) OR INSTR(c$,":REPEAT") = (LineLength%-6) ITEM_ADD 26, d$+" "+b$ AlreadyExistingLine%=1 END_IF END_IF IF AlreadyExistingLine%=0 AND INSTR(c$,"EXIT_WHILE")>0 IF INSTR(c$,"EXIT_WHILE ")=1 OR INSTR(c$,"EXIT_WHILE:")=1 OR INSTR(c$," EXIT_WHILE ")>0 OR INSTR(c$,":EXIT_WHILE ")>0 OR INSTR(c$,":EXIT_WHILE:")> 0 OR INSTR(c$," EXIT_WHILE:")> 0 OR INSTR(c$," EXIT_WHILE") = (LineLength%-10) OR INSTR(c$,":EXIT_WHILE") = (LineLength%-10) ITEM_ADD 26, d$+" "+b$ AlreadyExistingLine%=1 END_IF END_IF IF AlreadyExistingLine%=0 AND INSTR(c$,"EXIT_REPEAT")>0 IF INSTR(c$,"EXIT_REPEAT ")=1 OR INSTR(c$,"EXIT_REPEAT:")=1 OR INSTR(c$," EXIT_REPEAT ")>0 OR INSTR(c$,":EXIT_REPEAT ")>0 OR INSTR(c$,":EXIT_REPEAT:")> 0 OR INSTR(c$," EXIT_REPEAT:")> 0 OR INSTR(c$," EXIT_REPEAT") = (LineLength%-11) OR INSTR(c$,":EXIT_REPEAT") = (LineLength%-11) ITEM_ADD 26, d$+" "+b$ AlreadyExistingLine%=1 END_IF END_IF IF AlreadyExistingLine%=0 AND INSTR(c$,"END_WHILE")>0 IF INSTR(c$,"END_WHILE ")=1 OR INSTR(c$,"END_WHILE:")=1 OR INSTR(c$," END_WHILE ")>0 OR INSTR(c$,":END_WHILE ")>0 OR INSTR(c$,":END_WHILE:")> 0 OR INSTR(c$," END_WHILE:")> 0 OR INSTR(c$," END_WHILE") = (LineLength%-9) OR INSTR(c$,":END_WHILE") = (LineLength%-9) ITEM_ADD 26, d$+" "+b$ AlreadyExistingLine%=1 END_IF END_IF IF AlreadyExistingLine%=0 AND INSTR(c$,"UNTIL")>0 IF INSTR(c$,"UNTIL ")=1 OR INSTR(c$," UNTIL ")>0 OR INSTR(c$,":UNTIL ")>0 ITEM_ADD 26, d$+" "+b$ ITEM_ADD 26, "" AlreadyExistingLine%=1 END_IF END_IF END_SUB ' ------------------------------------------------------------------------------ SUB DisplaySelect() IF INSTR(c$,"SELECT ")>0 IF INSTR(c$,"SELECT ")=1 OR INSTR(c$," SELECT ")>0 OR INSTR(c$,":SELECT ")>0 ITEM_ADD 27, d$+" "+b$ AlreadyExistingLine%=1 END_IF END_IF IF INSTR(c$,"CASE ")>0 IF INSTR(c$,"CASE ")=1 OR INSTR(c$," CASE ")>0 OR INSTR(c$,":CASE ")>0 ITEM_ADD 27, d$+" "+b$ AlreadyExistingLine%=1 END_IF END_IF IF AlreadyExistingLine%=0 AND INSTR(c$,"END_SELECT")>0 IF INSTR(c$,"END_SELECT ")=1 OR INSTR(c$,"END_SELECT:")=1 OR INSTR(c$," END_SELECT ")>0 OR INSTR(c$,":END_SELECT ")>0 OR INSTR(c$,":END_SELECT:")> 0 OR INSTR(c$," END_SELECT:")> 0 OR INSTR(c$," END_SELECT") = (LineLength%-10) OR INSTR(c$,":END_SELECT") = (LineLength%-10) ITEM_ADD 27, d$+" "+b$ ITEM_ADD 27, "" AlreadyExistingLine%=1 END_IF END_IF END_SUB ' ------------------------------------------------------------------------------ Integral: FOR i%=20 TO 32 HIDE i% NEXT i% SHOW 20 MemoInUse% = 20 IF TEXT$(18) = "" THEN TEXT 18, " >> Search >>" ON_CLiCK 18, FindText RETURN ' ------------------------------------------------------------------------------ AllLabel: FOR i%=20 TO 32 HIDE i% NEXT i% SHOW 21 MemoInUse% = 21 IF TEXT$(18) = "" THEN TEXT 18, " >> Search >>" ON_CLiCK 18, FindText RETURN ' ------------------------------------------------------------------------------ AllSub: FOR i%=20 TO 32 HIDE i% NEXT i% SHOW 22 MemoInUse% = 22 IF TEXT$(18) = "" THEN TEXT 18, " >> Search >>" ON_CLiCK 18, FindText RETURN ' ------------------------------------------------------------------------------ AllIf: FOR i%=20 TO 32 HIDE i% NEXT i% SHOW 24 MemoInUse% = 24 IF TEXT$(18) = "" THEN TEXT 18, " >> Search >>" ON_CLiCK 18, FindText RETURN ' ------------------------------------------------------------------------------ AllDim: FOR i%=20 TO 32 HIDE i% NEXT i% SHOW 23 MemoInUse% = 23 IF TEXT$(18) = "" THEN TEXT 18, " >> Search >>" ON_CLiCK 18, FindText RETURN ' ------------------------------------------------------------------------------ AllForNext: FOR i%=20 TO 32 HIDE i% NEXT i% SHOW 25 MemoInUse% = 25 IF TEXT$(18) = "" THEN TEXT 18, " >> Search >>" ON_CLiCK 18, FindText RETURN ' ------------------------------------------------------------------------------ AllWhile: FOR i%=20 TO 32 HIDE i% NEXT i% SHOW 26 MemoInUse% = 26 IF TEXT$(18) = "" THEN TEXT 18, " >> Search >>" ON_CLiCK 18, FindText RETURN ' ------------------------------------------------------------------------------ AllSelect: FOR i%=20 TO 32 HIDE i% NEXT i% SHOW 27 MemoInUse% = 27 IF TEXT$(18) = "" THEN TEXT 18, " >> Search >>" ON_CLiCK 18, FindText RETURN ' ------------------------------------------------------------------------------ AllLabelMore: FOR i%=20 TO 32 HIDE i% NEXT i% SHOW 28 MemoInUse% = 28 IF TEXT$(18) = "" THEN TEXT 18, " >> Search >>" ON_CLiCK 18, FindText RETURN ' ------------------------------------------------------------------------------ AllSubMore: FOR i%=20 TO 32 HIDE i% NEXT i% SHOW 29 MemoInUse% = 29 IF TEXT$(18) = "" THEN TEXT 18, " >> Search >>" ON_CLiCK 18, FindText RETURN ' ------------------------------------------------------------------------------ AllDimMore: FOR i%=20 TO 32 HIDE i% NEXT i% SHOW 30 MemoInUse% = 30 IF TEXT$(18) = "" THEN TEXT 18, " >> Search >>" ON_CLiCK 18, FindText RETURN ' ------------------------------------------------------------------------------ About: FOR i%=20 TO 32 HIDE i% NEXT i% SHOW 32 MemoInUse% = 32 IF TEXT$(18) = "" THEN TEXT 18, " >> Search >>" ON_CLiCK 18, FindText RETURN ' ------------------------------------------------------------------------------ Resize: FOR i% = 20 TO 32 WIDTH i%, (WIDTH(0)-100) HEIGHT i%, (HEIGHT(0)-60) NEXT i% RETURN ' ------------------------------------------------------------------------------ Bigger: FontSize%=FontSize% + 1 IF FontSize% > 16 THEN FontSize% = 16 : RETURN FOR i% = 20 TO 32 FONT_SIZE i%, FontSize% NEXT i% HIDE MemoInUse% : SHOW MemoInUse% RETURN ' ------------------------------------------------------------------------------ Smaller: FontSize%=FontSize% - 1 IF FontSize% < 8 THEN FontSize% = 8 : RETURN FOR i% = 20 TO 32 FONT_SIZE i%, FontSize% NEXT i% HIDE MemoInUse% : SHOW MemoInUse% RETURN ' ------------------------------------------------------------------------------ SUB Mask() WIDTH 0, 1025 HEIGHT 0, 727 LEFT 0,(SCREEN_X-WIDTH(0))/2 TOP 0,(SCREEN_Y-HEIGHT(0))/2 COLOR 0, 120,120,130 BUTTON 1 WIDTH 1, 100 HEIGHT 1, 25 LEFT 1,13 TOP 1,10 CAPTION 1, "&Open" BUTTON 2 WIDTH 2, 100 HEIGHT 2, 25 LEFT 2,13 TOP 2, 650 CAPTION 2, "&Quit" BUTTON 3 WIDTH 3, 100 HEIGHT 3, 25 LEFT 3,13 TOP 3, 610 CAPTION 3, "&About" CREATE_HIDE BUTTON 4 WIDTH 4, 100 HEIGHT 4, 25 LEFT 4,13 TOP 4,50 CAPTION 4, "Sa&ve" BUTTON 5 WIDTH 5, 100 HEIGHT 5, 25 LEFT 5,13 TOP 5,125 CAPTION 5, "&Integral" BUTTON 6 WIDTH 6, 75 HEIGHT 6, 25 LEFT 6,13 TOP 6,165 HINT 6, "Label, Gosub, Return" CAPTION 6, "&Label" BUTTON 7 WIDTH 7, 25 HEIGHT 7, 25 LEFT 7,88 TOP 7,165 CAPTION 7, "+" BUTTON 8 WIDTH 8, 75 HEIGHT 8, 25 LEFT 8,13 TOP 8,205 HINT 8, "Sub, Exit_Sub, End_sub, Fnc, Result, End_Fnc" CAPTION 8, "S&UB / FNC" BUTTON 9 WIDTH 9, 25 HEIGHT 9, 25 LEFT 9,88 TOP 9,205 CAPTION 9, "+" BUTTON 10 WIDTH 10, 75 HEIGHT 10, 25 LEFT 10,13 TOP 10,245 HINT 10, "Dim, Local_Dim, Free" CAPTION 10, "&DIM" BUTTON 11 WIDTH 11, 25 HEIGHT 11, 25 LEFT 11,88 TOP 11,245 CAPTION 11, "+" BUTTON 12 WIDTH 12, 100 HEIGHT 12, 25 LEFT 12,13 TOP 12,285 HINT 12, "If, Then, Else, End_if" CAPTION 12, "&IF" BUTTON 13 WIDTH 13, 100 HEIGHT 13, 25 LEFT 13,13 TOP 13,325 HINT 13, "For, To, Step, Exit_For, Next" CAPTION 13, "&FOR" BUTTON 14 WIDTH 14, 100 HEIGHT 14, 25 LEFT 14,13 TOP 14,365 HINT 14, "While, Exit_While, End_While, Repeat, Exit_Repeat, Until" CAPTION 14, "&WHILE" BUTTON 15 WIDTH 15, 100 HEIGHT 15, 25 LEFT 15,13 TOP 15,405 HINT 15, "Select, Case, End_Select" CAPTION 15, "SE&LECT" BUTTON 16 WIDTH 16, 100 HEIGHT 16, 25 LEFT 16,13 TOP 16,530 CAPTION 16, "S&maller" BUTTON 17 WIDTH 17, 100 HEIGHT 17, 25 LEFT 17,13 TOP 17,570 CAPTION 17, "B&igger" EDIT 18 WIDTH 18, 100 HEIGHT 18, 25 LEFT 18,13 TOP 18,470 TEXT 18, " >> Search >>" for i% = 1 to 18 : font_bold i% : next i% FOR i%= 20 TO 33 LIST i% LEFT i%, 125 TOP i%,10 WIDTH i%, 870 HEIGHT i%, 666 FONT_NAME i%,"Courier New" FONT_SIZE i%,10 NEXT i% SORT 28 SORT_ON 28 SORT 29 SORT_ON 29 SORT 30 SORT_ON 30 SHOW 20 TextAbout() MessageBox() END_SUB ' ------------------------------------------------------------------------------ SUB MessageBox() PANEL 100 WIDTH 100,300 HEIGHT 100,200 FONT_NAME 100,"Arial" FONT_SIZE 100,14 COMMAND_TARGET_IS 100 ALPHA 101 TOP 101, 60 LEFT 101, 100 CAPTION 101, "Please wait" ALPHA 102 TOP 102, 110 LEFT 102, 60 CAPTION 102, "Analyse in progress..." COMMAND_TARGET_IS 0 SHOW 101 SHOW 102 END_SUB ' ------------------------------------------------------------------------------ SUB WaitingMessage() TOP 100, (HEIGHT_CLIENT(0)-200)/2 LEFT 100, (WIDTH_CLIENT(0)-300)/2 SHOW 100 END_SUB ' ------------------------------------------------------------------------------ SUB TextAbout() ITEM_ADD 32,"" b$=" PANORAMIC FILE ANALYSER" ITEM_ADD 32, b$ b$=" MARC - December 2017 - Panoramic v0.9.28.i12" ITEM_ADD 32, b$ b$=" http://panoramic-language.pagesperso-orange.fr/French/index.html" ITEM_ADD 32, b$ b$=" http://panoramic.forumotion.com" ITEM_ADD 32, b$ END_SUB ' ------------------------------------------------------------------------------ Save: IF OBJECT_EXISTS(41)=0 THEN SAVE_DIALOG 41 FILTER 41,"*.sav|*.sav" a$=FILE_NAME$(41) IF a$="_" THEN RETURN IF RIGHT$(a$,4)= ".sav" THEN a$ = LEFT$(a$,LEN(a$)-4) IF DIR_EXISTS(a$+"_txt")= 0 THEN DIR_MAKE a$+"_txt" FILE_SAVE 50,a$+"_txt\Source.txt" FOR i%=20 TO 31 SELECT i% CASE 20 : FILE_SAVE i%,a$+"_txt\Integral.txt" CASE 21 : FILE_SAVE i%,a$+"_txt\Label.txt" CASE 22 : FILE_SAVE i%,a$+"_txt\Sub.txt" CASE 23 : FILE_SAVE i%,a$+"_txt\Dim.txt" CASE 24 : FILE_SAVE i%,a$+"_txt\If.txt" CASE 25 : FILE_SAVE i%,a$+"_txt\For.txt" CASE 26 : FILE_SAVE i%,a$+"_txt\While.txt" CASE 27 : FILE_SAVE i%,a$+"_txt\Select.txt" CASE 28 : FILE_SAVE i%,a$+"_txt\LabelMore.txt" CASE 29 : FILE_SAVE i%,a$+"_txt\SubMore.txt" CASE 30 : FILE_SAVE i%,a$+"_txt\DimMore.txt" CASE 31 : FILE_SAVE i%,a$+"_txt\Search.txt" END_SELECT NEXT i% ARCHIVER_ON ARCHIVER_ADD a$+"_txt",a$+".sav" ARCHIVER_OFF RETURN ' ------------------------------------------------------------------------------ Quit: TERMINATE RETURN
- Aperçu:
==> EDIT du 26 décembre 2017 à 11h00 : mise à jour du source (amélioration de la reconnaissance des LABELs + correction d'un bug). ==> EDIT du 03 février 2018 à 16h30 : mise à jour du source : ajout de la reconnaissance des fonctions : FNC, RESULT, END_FNC. ==> EDIT du 06 octobre 2018 à 02h38 : mise à jour du source : Mise en conformité avec la compilateur.
Dernière édition par Marc le Sam 6 Oct 2018 - 2:39, édité 10 fois | |
|