English
Source / code snippets

automatically Remove functions superfluous

 
- Page 1 -



Jörg
Sellmeyer
Hi,
I have time a couple Regexpressions zusammengefummelt, with them functions How Sub, Mul u.s.w automatically from the View source removes go can.
herewith can no nested Funktonen supplant and be too OR and AND stay unbehandelt.
nevertheless can it one a crowd work take off.
CompileMarkSeparation
Declare Term$[10,2],Wert$[5]
Declare Edit&,Text&,hFont&,btnLaden&,btnStarten&,btnSpeichern&,Liste&,ListeFertig&
Term$[0,0] = ([Ss][Uu][Bb])+ ?~(
Term$[1,0] = (([Aa][Dd][Dd])+ ?~()
Term$[2,0] = (([Aa][Dd][Dd]~$)+ ?~()
Term$[3,0] = (([Mm][Uu][Ll])+ ?~()
Term$[4,0] = ([Dd][Ii][Vv]+ ?~()
Term$[5,0] = ([Dd][Ii][Vv]&+ ?~()
Term$[6,0] = ([Aa][Nn][Nn]+ ?~()Wem was dazu einfällt...
Term$[7,0] = ([Oo][Rr]+ ?~()
Term$[8,0] = ([Mm][Oo][Vv][Ee][Ll][Ii][Ss][Tt][Tt][Oo]+([Ll][Ii][Ss][Tt]|[Cc][Hh][Oo][Ii][Cc][Ee]|[Ee][Dd][Ii][Tt]) ?~()
Term$[9,0] = (([Ss][Ee][Tt])([Aa][Uu][Tt][Oo][Pp][Aa][Ii][Nn][Tt]|
[Dd][Ee][Cc][Ii][Mm][Aa][Ll][Ss]|
[Nn][Uu][Mm][Ww][Ii][Dd][Tt][Hh]|
[Cc][Hh][Aa][Rr][Ss][Ee][Tt]|
[Ee][Rr][Rr][Oo][Rr][Ll][Ee][Vv][Ee][Ll]|
[Ff][Ii][Ll][Ee][Mm][Oo][Dd][Ee]|
[Tt][Rr][Uu][Ee][Cc][Oo][Ll][Oo][Rr]|
[Ss][Tt][Rr][Ww][Ii][Dd][Tt][Hh])) [0-9]+
Term$[0,1] = -
Term$[1,1] = +
Term$[2,1] = +
Term$[3,1] = *
Term$[4,1] = /
Term$[5,1] = \
Term$[6,1] = &
Term$[7,1] = |
Term$[8,1] = MoveListToHandle(
Wert$[0] = ( ?[0-9]+(~.[0-9]+)? ?)Zahl
Wert$[1] =  ( ?[!%&]?[A-Za-z0-9]+[!%&]? ?)numerische Variable; Hex-, Binär- oder Octalzahl; Konstante oder Systemvariable
Wert$[2] = ( ?q{1}.*q{1} ?)String
Wert$[3] = ( ?([A-Za-z0-9ÄÖÜäöü~-_])+~$+ ?)Stringvariable oder Konstante
Wert$[4] = ( ?~$+[A-Za-z0-9ÄÖÜäöü~-_]+ ?)Stringkonstante

Proc Bearbeiten

    Parameters Zeile$,hEdit&,hText&
    Declare Funktion$,RegExpVar$,FunktionTransformiert$
    Case Zeile$ > :SetText hEdit&,Zeile$

    { Sub:

        RegExpVar$ = Term$[0,0] + ( + Wert$[0] + | + Wert$[1] + )  + , + ( + Wert$[0] + | + Wert$[1] + ) + ~)

        While Match$(RegExpVar$,Zeile$) >

            Funktion$ = Match$(RegExpVar$,Zeile$)
            Set(RegEx,1)
            FunktionTransformiert$ = Translate$(Funktion$,Term$[0,0],()
            FunktionTransformiert$ = Translate$(FunktionTransformiert$,,,Term$[0,1])
            Set(RegEx,0)
            Zeile$ = Translate$(Zeile$,Funktion$,FunktionTransformiert$)
            Case Zeile$ > :SetText hText&,Zeile$

        Wend

    }

    { Add:

        RegExpVar$ = Term$[1,0] + ( + Wert$[0] + | + Wert$[1] + )  + , + ( + Wert$[0] + | + Wert$[1] + ) + ~)

        While Match$(RegExpVar$,Zeile$) >

            Funktion$ = Match$(RegExpVar$,Zeile$)
            Set(RegEx,1)
            FunktionTransformiert$ = Translate$(Funktion$,Term$[1,0],()
            FunktionTransformiert$ = Translate$(FunktionTransformiert$,,,Term$[1,1])
            Set(RegEx,0)
            Zeile$ = Translate$(Zeile$,Funktion$,FunktionTransformiert$)
            Case Zeile$ > :SetText hText&,Zeile$

        Wend

    }

    {Add$:

        RegExpVar$ = Term$[2,0] + ( + Wert$[2] + | + Wert$[3] + | + Wert$[4] + ),( + Wert$[2] + | + Wert$[3] + | + Wert$[4] + ) + ~)

        While Match$(RegExpVar$,Zeile$) >

            Funktion$ = Match$(RegExpVar$,Zeile$)
            Set(RegEx,1)
            FunktionTransformiert$ = Translate$(Funktion$,Term$[2,0],()
            FunktionTransformiert$ = Translate$(FunktionTransformiert$,,,Term$[2,1])
            Set(RegEx,0)
            Zeile$ = Translate$(Zeile$,Funktion$,FunktionTransformiert$)
            Case Zeile$ > :SetText hText&,Zeile$

        Wend

    }

    {Mul:

        RegExpVar$ = Term$[3,0] + ( + Wert$[0] + | + Wert$[1] + )  + , + ( + Wert$[0] + | + Wert$[1] + ) + ~)

        While Match$(RegExpVar$,Zeile$) >

            Funktion$ = Match$(RegExpVar$,Zeile$)
            Set(RegEx,1)
            FunktionTransformiert$ = Translate$(Funktion$,Term$[3,0],()
            FunktionTransformiert$ = Translate$(FunktionTransformiert$,,,Term$[3,1])
            Set(RegEx,0)
            Zeile$ = Translate$(Zeile$,Funktion$,FunktionTransformiert$)
            Case Zeile$ > :SetText hText&,Zeile$

        Wend

    }

    {Div

        RegExpVar$ = Term$[4,0] + ( + Wert$[0] + | + Wert$[1] + )  + , + ( + Wert$[0] + | + Wert$[1] + ) + ~)

        While Match$(RegExpVar$,Zeile$) >

            Funktion$ = Match$(RegExpVar$,Zeile$)
            Set(RegEx,1)
            FunktionTransformiert$ = Translate$(Funktion$,Term$[4,0],()
            FunktionTransformiert$ = Translate$(FunktionTransformiert$,,,Term$[4,1])
            Set(RegEx,0)
            Zeile$ = Translate$(Zeile$,Funktion$,FunktionTransformiert$)
            Case Zeile$ > :SetText hText&,Zeile$

        Wend

    }

    {Div&

        RegExpVar$ = Term$[5,0] + ( + Wert$[0] + | + Wert$[1] + )  + , + ( + Wert$[0] + | + Wert$[1] + ) + ~)

        While Match$(RegExpVar$,Zeile$) >

            Funktion$ = Match$(RegExpVar$,Zeile$)
            Set(RegEx,1)
            FunktionTransformiert$ = Translate$(Funktion$,Term$[5,0],()
            FunktionTransformiert$ = Translate$(FunktionTransformiert$,,,Term$[5,1])
            Set(RegEx,0)
            Zeile$ = Translate$(Zeile$,Funktion$,FunktionTransformiert$)
            Case Zeile$ > :SetText hText&,Zeile$

        Wend

    }

    {MoveListTo

        RegExpVar$ = Term$[8,0]

        While Match$(RegExpVar$,Zeile$) >

            Funktion$ = Match$(RegExpVar$,Zeile$)
            FunktionTransformiert$ = Translate$(Funktion$,Funktion$,Term$[8,1])
            Set(RegEx,0)
            Zeile$ = Translate$(Zeile$,Funktion$,FunktionTransformiert$)
            Case Zeile$ > :SetText hText&,Zeile$

        Wend

    }

    {Set...

        RegExpVar$ = Term$[9,0]
        Declare Zahl$

        While Match$(RegExpVar$,Zeile$) >

            Funktion$ = Match$(RegExpVar$,Zeile$)
            Zahl$ = SubStr$(Funktion$,2, )
            FunktionTransformiert$ = Translate$(Funktion$,Zahl$,q, + Zahl$ + ))
            FunktionTransformiert$ = Translate$(FunktionTransformiert$,Left$(FunktionTransformiert$,3),Left$(FunktionTransformiert$,3) + (q)
            Zeile$ = Translate$(Zeile$,Funktion$,FunktionTransformiert$)
            Case Zeile$ > :SetText hText&,Zeile$

        Wend

    }

    Return Zeile$

EndProc

Proc DateiLaden

    Declare Datei$,Zeile$
    Datei$=LoadFile$(Profan-Code laden,Profan-Code (*.prf)|*.prf|
    + Include-Datei (*.inc)|*.inc)

    If Datei$ >

        ClearList Liste&
        Assign #1,Datei$
        Reset #1

        WhileNot @Eof(#1)

            Input #1,Zeile$
            AddString(Liste&, Zeile$)

        Wend

        Close #1
        WindowTitle Datei$ +  geladen

    EndIf

EndProc

Proc DateiBearbeiten

    If GetCount(Liste&) > 0

        Declare Zeile$,ZeileNeu$
        ClearList ListeFertig&

        WhileLoop 0,GetCount(Liste&)

            locate 12,0
            Zeile$ = GetString$(Liste&,&Loop)
            ZeileNeu$ = Bearbeiten(Zeile$,Edit&,Text&)
            AddString(ListeFertig&,ZeileNeu$)

            If ZeileNeu$ <> Zeile$

                AddString Str$(&Loop) +   + Trim$(Zeile$)
                AddString Str$(&Loop) +   + Trim$(ZeileNeu$)

            EndIf

        Wend

        ListBox$(Änderungen,2)
        WindowTitle Translate$(GetText$(%hwnd),geladen,bearbeitet)

    EndIf

EndProc

Proc DateiSpeichern

    If GetCount(ListeFertig&) > 0

        Declare Datei$
        Datei$ = SaveFile$(Datei speichern,Profan-Code (*.prf)|*.prf|
        + Include-Datei (*.inc)|*.inc|
        + Andere (*.*)|*.*))

        If Datei$ >

            Assign #1,Datei$
            ReWrite #1

            WhileLoop 0,GetCount(ListeFertig&)

                Print #1,GetString$(ListeFertig&,&Loop)

            Wend

            Close #1
            WindowTitle Translate$(GetText$(%hwnd),bearbeitet,gespeichert)

        EndIf

    EndIf

EndProc

Window 1,1 - 1100,400
hFont& = Create(Font,MS Sans Serif,14,0,0,0,0)
SetDialogFont hFont&
Edit& = Create(Edit,%hwnd,,0,0,Width(%hwnd),24)
Text& = Create(Text,%hwnd,,0,50,Width(%hwnd),24)
btnLaden& = Create(Button,%hwnd,laden,10,100,60,24)
btnStarten& = Create(Button,%hwnd,starten,80,100,60,24)
btnSpeichern& = Create(Button,%hwnd,speichern,150,100,60,24)
Liste&=Create(List,0)
ListeFertig&=Create(List,0)

While 1

    Waitinput

    If Clicked(btnLaden&)

        ChDir C:/ProfanTools
        DateiLaden

    ElseIf Clicked(btnStarten&)

        DateiBearbeiten

    ElseIf Clicked(btnSpeichern&)

        DateiSpeichern

    EndIf

Wend

DeleteObject hFont&
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
10/10/06  
 



 
- Page 4 -



Dietmar
Horn
Yes, these Version launch at least, even if the Program-Window for 1024 x 768 in the Höhe circa about 20 - 30 Pixel small his could, so it entire on the Bildschjirm fits.

whom remainder I will later testing.

I see: ältere versions wished I ditto testing, still because there by me utterly quite nothing passierte (not yet time a Error Message), I had me first times not big moreover so befaßt.

Greeting
Dietmar
 
Multimedia für Jugendliche und junge Erwachsene - MMJ Hoyerswerda e.V.  [...] 

Windows 95 bis Windows 7
Profan² 6.6 bis XProfan X2 mit XPSE

Das große XProfan-Lehrbuch:  [...] 
10/14/06  
 




Dietmar
Horn
On The speedy rausgefischt:

from -> FileMode 2 becomes -> Set(Filemode ,2) made (means bow, because one space too much).

Greeting
Dietmar
 
Multimedia für Jugendliche und junge Erwachsene - MMJ Hoyerswerda e.V.  [...] 

Windows 95 bis Windows 7
Profan² 6.6 bis XProfan X2 mit XPSE

Das große XProfan-Lehrbuch:  [...] 
10/14/06  
 




Jörg
Sellmeyer
The Size have I now again on small displays angepaßt. I vergeß always, that I a 19it have and the nichtgerade standard is.
The Set...-command should now functions.


(not yet time a Error Message), I had me first times not big moreover so befaßt.


Schade, hätteste at least the time short mitgeteilt, then had I former on The Fehlersuche make can.

Greeting
Jörg
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
10/14/06  
 




Dietmar
Horn
Hello Jörg,

with smaller Bildschirmauflösungen knallt it yet nevertheless yet!

hint: simply %MaxX and %MaxY inquire and accordingly (under Berücksichtigung the Client-Bereiches the Mainwindow) The Objects on the Mainwindow basteln.

of my opinion to ought to one solches Tool too nowadys yet abwärtskompatibel up to 640 x 480 his (only moreover could I you one kilometerlanges Posting as Begründung send - Why, wieso, and so etc. a such Vorgehensweise yet always better would ...).

The oberen both CreateText-Lines would I integrally omit. On faster Rechnern recognize one there anyhow nothing (except that there Irgendwas relatively futile to itself rumzappelt) - and on slower PCs becomes by the zweimalige SetText with eachone Codezeile the program only unnecessary ausgebremst. with longer Quelltexten interested such Info eh none - except that the Program with seinem Getue possible quick ready go möge.

too would I the two Listviews or. Gridboxen ditto not zeitnah constantly with whoso straight bearbeiteten Codezeilen fill, because the bremst only unnecessary and interested none. simply of Program The work so quick How possible make let - and well is it.

to that Schluß becomes crept and simply in anybody reasonable shape the Result präsentiert, evtl. yet with Editiermöglichkeit, o.ä. whom remainder will eachone Programmer anyhow yourself with seinem bevorzugten editor look at and testing - means, whether everything correctly transformed been is, etc. ...

The whole graphic-Schnick-Schnack, etc. is of my opinion to with one such Tool pill-Palle and means completely uninteressant.

if need be would with longer Sources as Fortschrittsanzeige (so the User not believes, that itself the program evtl. aufgehängt had) a couple kreiselnde or zappelnde simple ASCII- or Ansi-characters suffice.

I faith, something like becomes altogether too as software-Ergonomie marks (or so similar ...).

Greeting
Dietmar
 
Multimedia für Jugendliche und junge Erwachsene - MMJ Hoyerswerda e.V.  [...] 

Windows 95 bis Windows 7
Profan² 6.6 bis XProfan X2 mit XPSE

Das große XProfan-Lehrbuch:  [...] 
10/14/06  
 




Jörg
Sellmeyer

with smaller Bildschirmauflösungen knallt it yet nevertheless yet!


this is Yes angry! you have naturally right - the must angepaßt go. nevertheless must of my opinion to no simpler crash occur. I suspect time, the Profan there another Macke has.
your suggestions I had any already on the ToDo-list. it go another couple Optionseinstellungen come along, The The grafischen things Abschaltbar make. (simply time with right Mouse button the Window clicking)
are because your Codes correctly Translated been? If there yet Error are, is it me in the momentum importent, The To correct.

thanks for testing!
Greeting
Jörg
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
10/14/06  
 



 
- Page 5 -



Frank
Abbing
already one nützliches Program, straight for ältere Source code. only EQU and EQU$ go well not yet Translated, The Source code Yes maximum unübersichtlich make.
 
10/14/06  
 




Jörg
Sellmeyer
The have I still saponaceous forget! thanks Frank!

Greeting
Jörg
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
10/14/06  
 




Jörg
Sellmeyer
i think I closer me of/ one final Version

the Program ought to now under all Auflösungen To mind. 800 x 600 walk.
Equ and Equ$ are installed.
The bearbeiteten Lines go not displayed
too The lists only end the Vorgangs filled
in the Optionsmenü can the umgeändert go (rights Mouse button calls the Menu on)
Wend can on wish except go
The Funktionsumwandlung can on wish shorted go (z. B. if only old DBase-Commands in one otherwise actually code are)
The DBase-command can except go (small Geschwindigkeitsvorteil - meaningfully if one these Funktionalitäten anyhow not Program has.)

a in the Editfeld under the rechten Listbox bearbeitete row ersetz with Enter directly The suitable Line in the left Listbox.

by me need the program for ca. 5000 Lines 53 sec. means too large programs can in akzeptabler Time transfiguring.
i'll another function install with the to the conversion further (not bearbeitete ) Vorkommen the überflüssigen terms find let. The can then To foot nachbearbeitet go.

Please testing and rückmelden. thanks again all Tester!
@Roland: If it because for good is done, can the program gladly with on The CD.

Greeting
Jörg

 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
10/14/06  
 




Peter
Max
Müller
Hello,
on Jörch,
(i know I nerve )

on the end the Umwandelns comes a Error Message with
row 527 Variable not declariert I%

and these row kannste test times.



Create(Text,D%,°C,509, 127,15,15)


moreover are missing apparently : Neq,Neq$,GT,LT and SetErrorLevel

Hello
 
XProfan X3, X4ß, Win 10.1
10/14/06  
 




Rolf
Koch
Yes, have strain 30000 Lines durchgezogen. will be it on lauffähigkeit then test times. Time was too yet acceptable.
sees already time super from. however wisely one never, because I printe indeed Profanbefehle in Files and the must I with something free time time hither look at. but first once: respect

Achja, with the I% not declared comes by me too.
 
10/14/06  
 




Jörg
Sellmeyer
Hi,
thanks, for feedback.
@Max: this is definitiv not irritating! in the contrary, without würds Yes not vorangehen.


and SetErrorLevel


the can really not .If the with you not Translated becomes, poste still times the suitable row (so tappt im dunkeln because differently looks as
CompileMarkSeparation
have You evtl. a variable:SetErrorLevel n%?
there have I yet none dran virtual....
will be I but later yet respect.

@Rolf: With the whom Profanbefehlen into Files write would naturally particularly interestingly.
Perhaps can You me Yes time one typisches Codebeispiel post/send. then could I evtl. adjustments Specifically for ROC distinguished.

The Variable l% is now aale (there lane )
in the Statuszeile is the Number of modified Codezeilen To see
GT,LTNeq and Neq$ are too drin.

Since I straight thereby was, have I The Controls yet skalierbar made. now can ma means The Size the Fensters change and nevertheless weiterarbeiten.

Greeting
Jörg

 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
10/14/06  
 




Torsten
Rümker
Jörg Sellmeyer
in the Optionsmenü can the umgeändert go (rights Mouse button calls the Menu on)


I have by me in the Optionsmenü a Anzeigefehler, if I The DB command rausnehme (switch on No) becomes too the Menupunkt under on No umgestellt (means: functions => Operators).
The attitude the Menüpunktes changes itself therefore but not, shining means only wrong vergebener Text To his.

MfG
Torsten
 
Ich lerne, ob ich will oder nicht!
Betriebssystem:
- Ubuntu 15.x
- Windows (diverse)
XProfan Version: X2
10/15/06  
 




Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

44.314 Views

Untitledvor 0 min.
Walter02/16/19
AndreasS11/27/18
Jörg Sellmeyer05/14/18
PETER195609/05/15
More...

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie