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 2 -



Peter
Max
Müller
nabend,
How you mean.
thought only because of the XProfan Help
WRITEINI SPIEL.INI,MeinProgramm, HIGHSCORE=@Str$(HighScore&)

means without clinging.

Greeting

@IF : my Avatar Image was spare of rechten dritter and has neither against The good
Sitten verstoßen and nevertheless is it again deleted been.in the meantime already the 4th.
Why?
 
XProfan X3, X4ß, Win 10.1
10/12/06  
 




Jörg
Sellmeyer
Peter Max Müller
Howdy,
because I me sure be that you your code so hinkriegst the it everything ordnungsgemäß umwandelt have I me virtual that I with the whom dbase things time erwähne.


thanks!

Peter Max Müller
Nochwas:
CompileMarkSeparation
WriteIni (add$(PrgDir$,Inis$)),VERG,Anzahl = verganzahl$
>

becomes transformed To:
CompileMarkSeparation
WriteIni ((PrgDir$ + Inis$)),VERG,Anzahl = verganzahl$
>

rather would faith I:
CompileMarkSeparation
WriteIni PrgDir$ + Inis$,VERG,Anzahl = verganzahl$
>

means without clinging.or.

Tschüßikowski


the would definitiv not rather, there You Yes the first Klammerpaar already self in the code stand have what about me whom actual code naturally possible unangetastet let!
The transformed functions let I in clinging, there otherwise Problems with verschachtelten functions appear can/go.
with Strings could to the evtl. omit but the risk, that then what schiefgeht is larger as the from it arisen benefit.
How iF already says: rather a couple clinging too much, as zuwenig.
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
10/12/06  
 




Peter
Max
Müller
now but

you have right. Einleitende clinging come of me and should therefore not angetastet go.have I not on it geachtet.
but The clinging to the transfiguring are definitiv To plenty.
i know , I know: rather To plenty as To little. says the Tax too always.
CompileMarkSeparation
WriteIni (add$(PrgDir$,Inis$)),DRUCK,Anzahl = Str$(Seizal%)
>

to
CompileMarkSeparation
WriteIni ((PrgDir$ + Inis$)),DRUCK,Anzahl = Str$(Seizal%)
>
 
XProfan X3, X4ß, Win 10.1
10/12/06  
 





@IF : my Avatar Image was spare of rechten dritter and has neither against The good
Sitten verstoßen and nevertheless is it again deleted been.in the meantime already the 4th.
Why?


I should in that LogFile look who your Ava deaktiviert has - must but confess that I neither 100%ig sure was whether it itself hierbei circa something Own deals. it was one photo ne? anyway anscheinlich keins from you ?! - and ausgesehen has it neither as though it one eigener Schnappschuss was. Perhaps watts it just therefore as a precaution deaktiviert because ebend not eindeutig was whether it objectively rechtefrei is.

I must too admit that I it well heisse if rather one Avatar More deaktiviert becomes, instead of Perhaps one To little. can at least nobody crude injury the duty of care nachsagen.
 
10/12/06  
 




Jac
de
Lad
Please not cut, but I having already times the idea. I habs time completed. there's yet Problems with variables, The same or similar names as functions having (ought to only wend concern) and self-defined functions, The similar names having (to that example Gosub()). and with several command, The through : separated, go, have I yet nothing installed. but as Trial sits Perhaps interestingly...

6 kB
Hochgeladen:10/12/06
Downloadcounter83
Download
 
Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE)
Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP
10/12/06  
 




Jörg
Sellmeyer
so, now functions The row too. Also are most DB-functions/-command drin.
If yet what missing: message say. I have simply from Help for Profan 9 copies.

New is moreover one Input, into single Lines to that transfiguring eingefügt/-written go can.

These dBase-terms go now supplant. I yourself none nennenswerten code of these functions have, could I do not too much testing. I would therefore glad over Rückmeldungen moreover.

db(Appendblank|Browse|Close|Delete|Edit|Find|Get$|GetField$|GetMemo|Go|Index|Open|Pack|Put|PutField|
PutMemo|PutRec|Seek|Undelete|Use)

db(Create|CreateIndex)

Wend

CloseRW


Greeting
Jörg

Nachtrag:
straight yet a Error expanded: dbCreate watts not Translated. now GEHTS.

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




Michael
Wodrich
dbgetfield$ missing yet


Überflüssige functions automatically Remove


superfluously are you Yes not, you've itself only a little bit changed.

Best wishes
Michael Wodrich

P.s.: it missing yet More.
look still simply with the Altlasten.inc / kombatibility.inc ex. there find You indeed The Umsetzung. The code is spare - the a should speedy remedy with whom (sometime) missing functions his - the others should whom Fortbestand and the light care the Codes secure.
Both becomes used.
P.P.s.: ...really quick...
 
Programmieren, das spannendste Detektivspiel der Welt.
10/13/06  
 




Michael
Wodrich
get your Proggi not running. Exception Error and start...
 
Programmieren, das spannendste Detektivspiel der Welt.
10/13/06  
 




Jörg
Sellmeyer
Michael Wodrich
get your Proggi not running. Exception Error and start...


Oh... there can I quite nothing To say I habgerade time yourself The latest Version Downloaded and runs free from problems.
Schmiert the program because already at Start ex or if you attempt, a File To loading or To Edit?
Teste still again. I had yet a Errors in the RegExp discover. who can because presage, that circa these Time here yet someone as active is.

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




Michael
Wodrich
again nothing.
5 Buttons - left leeres Window - right listview
and to this display then same the start.

I try time one Image anzuhängen, but have always bad luck so in a day where The quersumme ...

small interval, to the breakfast GEHTS moreover.

Best wishes
Michael Wodrich

26 kB
Hochgeladen:10/13/06
Downloadcounter107
Download
 
Programmieren, das spannendste Detektivspiel der Welt.
10/13/06  
 




Jörg
Sellmeyer
I could mirdenken, Why it's located:
into global Deklarationen standing Term$[16,2]
Ändere the in Term$[20,2]. I have namely already 0-16 => 17 in use. Erstaunlicherweise gives the by me no Problems.
in the new Version istdas korrigiert.

Greeting
Jörg

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



Hm Perhaps crashes therefore the actually Release (not the published) of my Okrea too ex - Perhaps liegts on whom Arrays hmmm.
 
10/13/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.332 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