Source wurde am 15.07.2007 aus der MMJ-Quellcodesammlung (Dietmar Horn) in die Babyklappe auf XProfan.Com abgelegt:
Code-Formatierer
##########################################################################
PRF-Struktur, a Profan OpenSource Project(theFirst?),started april 2004
Copyright (C) 2004 by DS/iF (!ReGeXiT) on (iF@mxii.com)
__________________________________________________________________________
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 1.1
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-
1307, USA.
__________________________________________________________________________
Source changed by: [20040707] [IF] [if@mxii.com] <- added xpse syntax
Source changed by: [DATE] [NICK/NAME] [EML]
Source changed by: [DATE] [NICK/NAME] [EML]
Source changed by: [DATE] [NICK/NAME] [EML]
Source changed by: [DATE] [NICK/NAME] [EML]
##########################################################################
Decimals 0
Def Inv(1) If(@%(1),0,1)
Declare S$,Cx%,Ch$,Kl%,Ln%,Insa%,Pre$,Infle$,Maxinsa%,Maxln%,Frl%,Lnp%
Proc _end
End
Endproc
Proc Printfree
Ifnot Frl%
Print #2,
Frl%=1
Add Lnp%,1
Endif
Endproc
Proc Printit
Parameters S$
Print #2,S$
Add Lnp%,1
Frl%=0
Endproc
Proc Printm
Parameters S$,N%
Print S$,N%
Sleep 1000
Close #1
Close #2
Shell notepad _out_.txt
Waitkey
End
Endproc
Windowtitle Struktur V1.0 - Profan
Windowstyle 24
Window 100,100 - 640,480
Frl%=0
Lnp%=0
Infle$=Loadfile$(Profan-Programm:,Profan-Quellcode (*.prf)|*.prf|Alle Dateien (*.*)|*.*)
If Len(Infle$)
Assign #1,Infle$
Reset #1
Assign #2,_out_.txt
Rewrite #2
Locate 1,1
Print Datei:,Infle$
Kl%=0
Ln%=0
Insa%=0
Maxinsa%=0
Maxln%=0
Whilenot Eof(#1)
Input #1,S$
S$=Translate$(S$,Chr$(7),)
S$=Translate$(S$,Chr$(9),)
Add Ln%,1
While Or(Equ$(Chr$(9),Mid$(S$,1,1)),Equ$(Chr$(32),Mid$(S$,1,1)))
S$=Del$(S$,1,1)
Wend
Casenot Len(Trim$(S$)) : Continue
Ifnot Mod(Lnp%,25)
Locate 2,1
Print Zeilen:,Lnp%
Print maximale Tiefe:,Maxinsa%+1
Endif
Case Kl% : Printm string parse error in line:,Lnp%
Ifnot Equ$(Mid$(S$,1,3),P +Chr$(34))
Cx%=0
While Lt(Cx%,Len(S$)+1)
Add Cx%,1
Ch$=Mid$(S$,Cx%,1)
If Equ$(,Ch$)
Ifnot Kl%
S$=Mid$(S$,1,Cx%-1)
Endif
Endif
Case Equ$(Ch$,Chr$(34)) : Kl%=Inv(Kl%)
Ifnot Kl%
Endif
Wend
Case Equ$(WHILE ,Upper$(Mid$(S$,1,6))) : Printfree
Case Equ$(REPEAT,Upper$(Mid$(S$,1,6))) : Printfree
Case Equ$(WEND,Upper$(S$)) : Printfree
Case Equ$(UNTIL,Mid$(Upper$(S$),1,5)) : Printfree
Case Equ$(ENDWHILE,Upper$(S$)) : Printfree
Case Equ$(WHILENOT ,Upper$(Mid$(S$,1,9))) : Printfree
Case Equ$(WHILELOOP ,Upper$(Mid$(S$,1,10))) : Printfree
Case Equ$(IF ,Upper$(Mid$(S$,1,3))) : Printfree
Case Equ$(IFNOT ,Upper$(Mid$(S$,1,6))) : Printfree
Case Equ$(PROC ,Upper$(Mid$(S$,1,5))) : Printfree
Case Equ$(FUNCTION ,Upper$(Mid$(S$,1,9))) : Printfree
Case Equ$(PROCEDURE ,Upper$(Mid$(S$,1,10))) : Printfree
Case Equ$(ENDPROC,Upper$(S$)) : Sub Insa%,1
Case Equ$(ENDIF,Upper$(S$)) : Sub Insa%,1
Case Equ$(ENDIF,Upper$(S$)) : Printfree
If Equ$(ELSEIF ,Upper$(Mid$(S$,1,7)))
Sub Insa%,1
Printfree
Elseif Equ$(ELSE,Upper$(Mid$(S$,1,4)))
Printfree
Sub Insa%,1
Endif
Case Equ$(UNTIL,Upper$(Mid$(S$,1,5))) : Sub Insa%,1
Case Equ$(WEND,Upper$(Mid$(S$,1,4))) : Sub Insa%,1
Case Equ$(ENDWHILE,Upper$(Mid$(S$,1,8))) : Sub Insa%,1
Case Lt(Insa%,0) : Printm Insafailure in line:,Lnp%
If Gt(Insa%,Maxinsa%)
Maxinsa%=Insa%
Maxln%=Lnp%
Endif
Pre$=Mkstr$(Chr$(9),Insa%)
If Len(Trim$(S$))
Printit Add$(Pre$,S$)
Endif
Case Equ$(REPEAT,Upper$(Mid$(S$,1,6))) : Add Insa%,1
Case Equ$(WHILE ,Upper$(Mid$(S$,1,6))) : Add Insa%,1
Case Equ$(WHILENOT ,Upper$(Mid$(S$,1,9))) : Add Insa%,1
Case Equ$(WHILELOOP ,Upper$(Mid$(S$,1,10))) : Add Insa%,1
If Equ$(ELSEIF ,Upper$(Mid$(S$,1,7)))
Add Insa%,1
Printfree
Elseif Equ$(ELSE,Upper$(Mid$(S$,1,4)))
Printfree
Add Insa%,1
Endif
Case Equ$(PROC ,Upper$(Mid$(S$,1,5))) : Add Insa%,1
Case Equ$(PROCEDURE ,Upper$(Mid$(S$,1,10))) : Add Insa%,1
Case Equ$(FUNCTION ,Upper$(Mid$(S$,1,09))) : Add Insa%,1
Case Equ$(IF ,Upper$(Mid$(S$,1,3))) : Add Insa%,1
Case Equ$(IF ,Upper$(Mid$(S$,1,3))) : Printfree
Case Equ$(IFNOT ,Upper$(Mid$(S$,1,6))) : Add Insa%,1
Case Equ$(IFNOT ,Upper$(Mid$(S$,1,6))) : Printfree
Case Equ$(WHILENOT ,Upper$(Mid$(S$,1,9))) : Printfree
Case Equ$(WHILELOOP ,Upper$(Mid$(S$,1,10))) : Printfree
Case Equ$(REPEAT,Upper$(Mid$(S$,1,6))) : Printfree
Case Equ$(WHILE ,Upper$(Mid$(S$,1,6))) : Printfree
Case Equ$(ENDIF,Upper$(S$)) : Printfree
Case Equ$(ENDPROC,Upper$(S$)) : Printfree
Case Equ$(WEND,Upper$(S$)) : Printfree
Case Equ$(UNTIL,Upper$(Mid$(S$,1,5))) : Printfree
Case Equ$(ENDWHILE,Upper$(S$)) : Printfree
Case Lt(Insa%,0) : Printm Insafailure in line:,Lnp%
Endif
Wend
Close #1
Close #2
Locate 2,1
Print Zeilen:,Lnp%
Print maximale Tiefe:,Maxinsa%+1,in Zeile,Maxln%
Sleep 2000
Shell notepad _out_.txt
Endif
Fin