• Welcome to Theos PowerBasic Museum 2017.

News:

Attachments are only available to registered users.
Please register using your full, real name.

Main Menu

Code-Formatter PB 10

Started by Theo Gottwald, January 18, 2011, 07:58:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Peter Weis

#120
Hello Paul kept bin still a few days, busy with the function DoFormat!  At the moment does not have very much time for Programmieren. In addition, the code is very complex. Please still some patience!

Greetings Peter

Theo Gottwald

Paul, to share executables is for me no option. Because for safety reasons i only download executables if it can not be avoided.
And i believe many others also hold it like that .I need code that i can compile myself.

Back to the topic. I have suggested Peter, to split the job into "Passes". Then any body (including me) could work on a part and later for example peter could put it all together.
For this to work, the whole sourcecode would have to be passed through the passes as string (BYREF).
Then we can make subprogramms that do parts of the task.


Peter Weis

#122
Hello,
  new version for testing
regards Peter

added (Theo):
Peter has included the source code.
Now you can take part, if you want. Paul.
Add your stuff to Peters code.
Change the format in a way that the thing works in passes,so many people canwork on it at the same time.

Paul Elliott

Hi,

Sorry to say this but  I can't help you.    :(

It's going to take me a couple weeks of study before I can figure out what it is doing now.
I can't recognize my code at all and have no idea how to correct the errors that I'm now seeing
in it.

I do wish you luck.

I'll go back and delete my archive with the executable. Just thought it would help to see another
output and didn't want to throw a lot of confusion around what Peter's doing.


Paul Elliott

Not real sure about this but the PB v10 help file says

The underscore character must be preceded by at least one white space character and is not supported in the ASM statement.


Is a "(" considered a "white space character" ?  I noticed this "(_" in several of the Phoenix Function
statements. Probably the compiler handles it but it involves extra work in the formatter when
variables end with a "_"  to not flag as a continuation line but to flag the "(_" as a continuation
line.


Paul Elliott

Proper indenting and comments wouldn't hurt. But would need English comments.




Theo Gottwald

I would prefer to restructure the project into passes so anybody can take a closed part without need to use the otehr persons code.
I know that it can be diffucult to use other peoples code.
In most cases i am just faster to make things from scratch.

Thats why i believe the project would need a cooperative concept.

Ok, actually it looks that the ball is with paul.

Take a look, even if its a challenge.
Thats one reason why we do it.

Peter Weis

#127
Hello,

which will now be properly resolved

input:


LOCAL    xxx AS DWORD: pbword = "ABC":LOCAL xxc, yyc AS INTEGER, zzc AS INTEGER 'testvar     



output:

    LOCAL    xxx                        AS DWORD            'testvar
    pbword = "ABC"
    LOCAL    xxc                        AS INTEGER
    LOCAL    yyc                        AS INTEGER
    LOCAL    zzc                        AS INTEGER   


regards Peter

Peter Weis

#128
I love to eliminate errors in programs

One more mistake away. The program now correctly detects whether it is in a function or sub

Variables that are outside a function are now formatted correctly

New function added


FUNCTION Is_Function_or_Sub(BYREF s AS STRING) AS INTEGER
    STATIC   X                          AS LONG
    LOCAL    s1                         AS STRING
    LOCAL    pbword                     AS STRING
    LOCAL    termstr                    AS STRING
    LOCAL    i                          AS INTEGER

    s1 = UCASE$(LTRIM$(s))
    IF LEFT$(s1, 9) = "FUNCTION " THEN
        IF x = 1 THEN EXIT IF
        FOR i = 9 TO LEN(s)
            termstr = MID$(s, i, 1)
            IF termstr = "=" THEN
                EXIT FOR
            ELSEIF termstr <> " " THEN
                x = 1
                EXIT FOR
            END IF
        NEXT i

        EXIT IF

    ELSEIF LEFT$(s1, 4) = "SUB " THEN
        IF x = 0 THEN x = 1
        EXIT IF

    ELSEIF LEFT$(s1, 4) = "END " THEN
        IF X = 1 THEN
            findPBWord s, 4, pbword, termstr
            pbword = UCASE$(pbword)
            IF pbword = "FUNCTION" OR pbword = "SUB" THEN x = 0

        END IF
    END IF
    FUNCTION = X

END FUNCTION
                             


regards Peter


Paul Elliott

What about Callback or Threaded Functions?

and where is EXIT SUB supposed to be?

            CASE "'"
                IF pstring = %FALSE THEN
                    pbword = MID$(s, p)
                    termstr = "'"
                    EXIT SUB
                    p = LEN(s) + 1
                ELSE
                    pbword = pbword + z
                END IF


Fine, I'll wait a month  AT LEAST before I even begin to look at anything.
No sense wasting my time on a program that isn't finished.

See you next year sometime.     :(


Peter Weis

#130
Hi Paul,

have expanded the function Is_Function_or_Sub () with FASTPROC, CALLBACK FUNCTION, THREAD FUNCTION

But they have not yet tested!

regards Peter


Paul Elliott

Peter and Theo,

I'm doing no more on this project until you post in the forums the documentation of the program,
the COMPLETE current/future plans of the program and all the off-line conversations about
the program.

I am a VERY good programmer who is capable of taking garbage spaghetti-code programs and
producing clean easily understood & maintainable programs. BUT I DO NOT enjoy working in
the dark when the specifications are hidden from me and constantly changing.   >:(

You have so far ignored my requests and just a couple posts ago claimed " the ball is with paul"
and then proceeded to spit out a couple untested updates with no documentation.

THE BALL ( with a very big hole in it ) is back to you.

Theo Gottwald

Hallo Paul,
there is no doubt about your qualities as programmer.
While you seem to be a strange psychologist.

The only offline communication i have with peter, is that he telle me in skype from time to time "good morning" and "good evening".
Thats mostly all.

You are also invited to join my SKYPE-contacts and then we can even try to get a conference on the program with peter.

As there is no communication and no documentation, this is the only sollution i can offer.

My skype nick is no secret, its "theogott", just add me.

Paul Elliott

Theo and Peter,

I'm just telling it like I see it based on forum posts and source code provided.

I'm withdrawing from doing any more programming for this project.
I will continue to point out things that need fixing from time-to-time ( the same as anybody is allowed )
but will not supply code for the fix.

Personally, I have nothing against you guys but our programming styles are very different.
I've been doing my style of coding for almost 40 years in many languages from mainframes to
PCs & Apple ][s. It is generally clean, easily understood and easily modified. The programs that
I wrote for the last company have been working without modifications or fixes for over 10 years.

Good luck. And don't forget to try the program on some large programs with lots of Class coding.


Theo Gottwald

Peter are you actually working on the project or is the final code available?

Peter, arbeitest du gerade an dem projekt oder ist der finale code verfügbar?

Wenn der verfügbar ist werde ich mir mal die struktur anschauen ob man es nicht in unabhängige Passes einteilen kann.