English
Source / code snippets

Befehlszeilentrennung

 

RudiB.
Hello together,

I stand well at a for me sheer unlösbaren task.
i want one Program-Listing with Befehlszeilentrennung through Doppelpunkte, aufsplitten in self-contained Program lines.
as Sonderfall should however a row with "Case" or "CaseNot" to maintain go.

here time one utterly Sinnfreies Listing and thereafter the Listing bereinigt.
CLS
Declare a$,b$:Declare c$,d$
Declare e$:Print "Hallo \
together !":Declare INT GROBI: GROBI=500
a$=" the dog goes to that \
bright brennenden fires circa itself \
To wärmen: ABER!!\
The cat standing it in the lane"
b$="nicht LEER"
c$="Test"
d$="fertig"
Print:Print:Case b$="":Print" B is LEER":Print GROBI
Print c$,d$,GROBI
waitinput

...and so reserves then looks.....I utterly not hinkriege !!!!
CLS
Declare a$,b$
Declare c$,d$
Declare e$
Print "Hallo \
together !"
Declare INT GROBI
GROBI=500
a$=" the dog goes to that \
bright brennenden fires circa itself \
To wärmen: ABER!!\
The cat standing it in the lane"
b$="nicht LEER"
c$="Test"
d$="fertig"
Print
Print
Case b$="":Print" B is LEER"
Print GROBI
Print c$,d$,GROBI
waitinput

....z.B: on my own already the String VAR a$ with a colon therein position a challenge dar...because here too yet The eigentliche Befehlszeile with a Backslash aufgesplittet becomes...

here in the Forum becomes the first Listing with the Strings farblich not correctly displayed....

stand straight fully on the Hose...
can me here someone on The Sprünge help ???
 
XProfan X4
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
10/15/22  
 




RudiB.
alas......, the most important forget....The Aufsplittung the Befehlszeilen with Backslash should naturally, How in the downstairs Listing, to maintain go.
 
XProfan X4
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
10/15/22  
 




RudiB.
this is my attempt (LISTING) the trouble To solve...
cls
Declare row$,x%,pos%,pos2%,new_zeile$,next_zeile$,org_zeile$,End_kommentar$,kom%,aray$[]
Declare Zeit&,File$
Datei$=Loadfile$("ÖFFNE:","*.prf")
Zeit&=&gettickcount
Assign #1,File$
reset #1
Print "Working.....Please Wait"

WhileNot EOF(#1)

    input #1,row$
    Org_Zeile$=row$
    '-----------------------------------------------------------------------------------------------------------------------
    '          Ganzzeilige comments and Blockkommentare in Leerzeilen wandeln
    '-----------------------------------------------------------------------------------------------------------------------

    If (Left$(Trim $(Line $),1)="'") Or (Left$(Trim $(Line $),2)="//")

        row$=""
        Print Org_zeile$
        continue

    EndIf

    If Left$(row$,2)="/*"

        Print Org_zeile$
        kom%=1
        continue

    EndIf

    If Left$(row$,2)="*/"

        Print Org_zeile$
        kom%=0
        continue

    EndIf

    If kom%=1

        row$=""
        Print Org_zeile$
        continue

    EndIf

    '-----------------------------------------------------------------------------------------------------------------------
    '-----------------------------------------------------------------------------------------------------------------------
    '          Doppelpunkte in Strings transfiguring
    '-----------------------------------------------------------------------------------------------------------------------

    Ifnot right$(trim$(Line $),1)=chr $(92)

        If instr(chr $(58),row$)

            pos%=0

            Whileloop Len(Line $)

                If mid$(row$,&loop,1)=chr $(34)

                    pos%=hardship(pos%)

                EndIf

                If (pos%=1) And (mid$(row$,&loop,1)=Chr$(58))

                    New_Zeile$=New_Zeile$+chr $(247)

                Else

                    new_Zeile$=new_Zeile$+mid$(row$,&loop,1)

                EndIf

            EndWhile

            If pos%=1

                row$=Translate$(row$,chr $(58),chr $(247))

            Else

                row$=New_Zeile$
                new_zeile$=""

            Endif

        EndIf

    Endif

    '-----------------------------------------------------------------------------------------------------------------------
    '          Endkommentare cut off
    '-----------------------------------------------------------------------------------------------------------------------

    If (Instr("'",Trim $(Line $),2)) Or (Instr("//",Trim $(Line $),2))

        pos%=0
        End_kommentar$=""

        Whileloop Len(Line $)

            If mid$(row$,&loop,1)=chr $(34)

                pos%=hardship(pos%)

            EndIf

            If (mid$(row$,&loop,1)="'") And (pos%=0)

                End_kommentar$=Right$(row$,Len(Line $)-&loop+1)
                row$=Left$(row$,&loop-1)
                Break

            EndIf

            If (mid$(row$,&loop,2)="//") And (pos%=0)

                End_kommentar$=Right$(row$,Len(Line $)-&loop+1)
                row$=Left$(row$,&loop-1)
                Break

            EndIf

        EndWhile

    EndIf

    '-----------------------------------------------------------------------------------------------------------------------
    '          colon Befehlszeilen-Trennung
    '-----------------------------------------------------------------------------------------------------------------------

    Ifnot right$(trim$(Line $),1)=chr $(92)

        If Instr(":",row$)

            pos%=0
            pos2%=1
            new_zeile$=""

            While 1

                Pos%=Instr(":",row$,pos2%)

                If pos%=0

                    Break

                EndIf

                If right$(row$,1)=":"'Sprungmarker

                    break

                EndIf

                If (Left$(Trim $(lower$(Line $)),5)="case ") or (Left$(Trim $(lower$(Line $)),8)="casenot ")

                    Pos2%=Instr(":",row$,pos%+1)

                    If pos2%=0

                        Break

                    EndIf

                EndIf

                new_Zeile$=Left$(row$,pos%-1)
                new_Zeile$=Translate$(new_Zeile$,chr $(247),chr $(58))
                Print new_zeile$
                new_Zeile$=""
                row$=right$(row$,Len(Line $)-pos%)

            EndWhile

        EndIf

    Endif

    row$=Translate$(row$,chr $(247),chr $(58))
    Print row$+" "+End_kommentar$
    End_kommentar$=""
    new_zeile$=" "

EndWhile

Close #1
Print &gettickcount-Zeit&
Print "FERTIG"
Waitinput
 
XProfan X4
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
10/15/22  
 




Walter
here one first Ansatz, the simply feststellt, whether one itself with one colon within one Strings befindet or not.
Bzgl. Case must first yet clarified go, whether only the first colon thereafter stay should or. How one with further verfährt.
'## Kommentarzeilen are not berücksichtigt
'## case is here not yet berücksichtigt
cls
Declare File$
declare StringAn%,i%,in$,out$,a$[]
StringAn%=0' 0=Außerhalb one Strings, 1=Innerhalb one Strings
Datei$=Loadfile$("ÖFFNE:","*.prf")
Assign #1,File$
reset #1
Print "Working.....Please Wait"

WhileNot EOF(#1)

    input #1,in$
    a$[]=explode(in $)' characters the Line in one aray write
    'any characters the row go through
    for i%,len(in $)
    ' check, whether one itself within one Strings befindet
    case a$[i%-1]=Chr$(34) and StringAn%=0:StringAn%=1
    case a$[i%-1]=Chr$(34) and StringAn%=1:StringAn%=0

    if a$[i%-1]=":"

        If StringAn%=0'  :  isn't within one Strings - row share

            print out$
            out$=""

        else

            out$=out $+a$[i%-1]'  :  is within one Strings - row continue

        endif

    else

        out$=out $+a$[i%-1]

    endif

    endfor
    print out$
    out$=""

EndWhile

Close #1
Print "FERTIG"
waitinput
 
10/19/22  
 




RudiB.
Hello Walter,

...beautiful the still someone this Topic answer.

your Ansatz is Yes correctly., still the devil's stick Yes in the detail...
If I z.B.: an Programmzeile The a String contain, but then with a Backslash on several Lines zoned becomes.
see here....
a$=" the dog goes to that \
bright brennenden fires circa itself \
To wärmen: ABER!!\
The cat standing it in the lane"

here haperst then vast...

i know already a Solution for my trouble in general, however would I gladly too a Solution for find, if I a File Zeilenweise einlese ....
there's too this a Solution .... here should then but each row through several inquire walk, what naturally very plenty Time cost.....

I Have even hoped, someone has a zündende idea, on The I do not come...

Greeting from munich
Rudi
 
XProfan X4
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
10/19/22  
 




Walter
my Programmstück comes with your code
a$=" the dog goes to that \
bright brennenden fires circa itself \
To wärmen: ABER!!\
The cat standing it in the lane"

but fine zurecht...
 
10/19/22  
 




Walter
Sorry - already seen.
look I me moreover on...
 
10/19/22  
 




RudiB.
THANK YOU...
 
XProfan X4
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
10/19/22  
 




Walter
Bähhh - was only one small Error drin...
now does it!
'## Kommentarzeilen not berücksichtigt
'## case not berücksichtigt
cls
Declare File$
declare StringAn%,i%,in$,out$,a$[]
StringAn%=0
Datei$=Loadfile$("ÖFFNE:","*.prf")
Assign #1,File$
reset #1
Print "Working.....Please Wait"

WhileNot EOF(#1)

    input #1,in$
    a$[]=explode(in $)' characters the Line in aray write
    'any characters the row go through
    for i%,len(in $)
    ' check, whether one itself within one Strings befindet

    if (a$[i%-1]=Chr$(34)) and (StringAn%=0)

        StringAn%=1

    elseif (a$[i%-1]=Chr$(34)) and (StringAn%=1)

        StringAn%=0

    endif

    if a$[i%-1]=":"

        If StringAn%=0' : isn't within one Strings - row share

            print out$
            out$=""

        else

            out$=out $+a$[i%-1]' : is within one Strings - row continue

        endif

    else

        out$=out $+a$[i%-1]

    endif

    endfor
    print out$
    out$=""

EndWhile

Close #1
Print "FERTIG"
waitinput
 
10/19/22  
 




RudiB.
I work indeed dran.... but apparently seh I the woods not sheer trees.... often is it so simply...Have I already so often here in the Forum erlebt...
 
XProfan X4
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
10/19/22  
 




RudiB.
wow....short probiert with the Test-Listing, How have You now the made????
..must your Sourcecode time look at...
 
XProfan X4
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
10/19/22  
 




Walter
here now velvet case / caseNot:
thereby Have I on it held, that usually any  auf case subesquent Commands in same row with true worn out go, during with false immediate into next row sprang becomes.
(from Help: Case n : BEF
has the expression n a worth <> 0, becomes BEF carryed out, otherwise goes The Programmausführung into next row...)
' the Codestück divides Befehlszeilen with ":" in new Lines on,
' except
' a) the ":" is within one Stringliterals; or
' b) with case/caseNot. here stay any ":" in same row _nach_ one
' case/caseNot receive (though yet yet without Berücksichtigung of
' Umbrüchen langer Codezeilen)
' Kommentarzeilen are not berücksichtigt;
' The must ggf before ausgeschieden go
cls
Declare File$
declare StringAn%,i%,in$,out$,a$[]
declare caseAn%,pos%
StringAn%=0
CaseAn%=0
Datei$=Loadfile$("ÖFFNE:","*.prf")
Assign #1,File$
reset #1
Print "Working.....Please Wait"

WhileNot EOF(#1)

    input #1,in$
    a$[]=explode(in $)' characters the Line in aray write
    ' if case or caseNot drin: position check
    pos%=instr("case ",lower$(in $))
    case pos%=0:pos%=instr("casenot ",lower$(in $))

    if pos%=0' KEIN case drin

        'any characters the row go through
        for i%,len(in $)
        ' check, whether one itself within one Strings befindet

        if (a$[i%-1]=Chr$(34)) and (StringAn%=0)#

            StringAn%=1

        elseif (a$[i%-1]=Chr$(34)) and (StringAn%=1)

            StringAn%=0

        endif

        if a$[i%-1]=":"

            If StringAn%=0' : isn't within one Strings - row share

                print out$
                out$=""

            else

                out$=out $+a$[i%-1]' : is within one Strings - row continue

            endif

        else

            out$=out $+a$[i%-1]' other characters as :

        endif

        endfor

    else' case or caseNot drin

        'any characters the row up to case go through
        for i%,pos%-1
        ' check, whether one itself within one Strings befindet

        if (a$[i%-1]=Chr$(34)) and (StringAn%=0)

            StringAn%=1

        elseif (a$[i%-1]=Chr$(34)) and (StringAn%=1)

            StringAn%=0

        endif

        if a$[i%-1]=":"

            If StringAn%=0' : isn't within one Strings - row share

                print out$
                out$=""

            else

                out$=out $+a$[i%-1]' : is within one Strings - row continue

            endif

        else

            out$=out $+a$[i%-1]' one other characters as :

        endif

        endfor

    endif

    if pos%>0

        ' remainder the case-Line in a new row write
        print mid$(in$,pos%,len(in $)-pos%+1)

    else

        print out$
        out$=""

    endif

EndWhile

Close #1
Print "FERTIG"
waitinput

gladly inquiries, sofern The comments not suffice.
Error are naturally possible...
 
10/19/22  
 




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

7.881 Views

Untitledvor 0 min.
Member 862464105/12/24
Cyberangle02/03/23
RudiB.02/02/23
Normann Strübli01/31/23
More...

Themeninformationen

this Topic has 3 subscriber:

RudiB. (13x)
Walter (8x)
Georg Teles (3x)


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