Author Topic: Code-Formatter PB 10  (Read 158594 times)

0 Members and 1 Guest are viewing this topic.

Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #120 on: December 05, 2011, 07:23:31 PM »
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
« Last Edit: December 05, 2011, 07:35:09 PM by Peter Weis »

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 1037
  • User-Rate: +30/-4
    • it-berater
Re: Code-Formatter PB 10
« Reply #121 on: December 06, 2011, 07:20:29 AM »
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.


Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #122 on: December 06, 2011, 07:29:10 AM »
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.
« Last Edit: December 26, 2011, 10:36:06 AM by Peter Weis »

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #123 on: December 06, 2011, 01:00:44 PM »
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.


Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #124 on: December 06, 2011, 01:24:47 PM »
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.


Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #125 on: December 06, 2011, 03:36:35 PM »
Proper indenting and comments wouldn't hurt. But would need English comments.




Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 1037
  • User-Rate: +30/-4
    • it-berater
Re: Code-Formatter PB 10
« Reply #126 on: December 06, 2011, 08:25:33 PM »
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.

Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #127 on: December 06, 2011, 10:52:57 PM »
Hello,

 which will now be properly resolved

input:

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


output:
Code: [Select]
    LOCAL    xxx                        AS DWORD            'testvar
    pbword = "ABC"
    LOCAL    xxc                        AS INTEGER
    LOCAL    yyc                        AS INTEGER
    LOCAL    zzc                        AS INTEGER   

 regards Peter
« Last Edit: December 26, 2011, 10:36:26 AM by Peter Weis »

Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #128 on: December 07, 2011, 12:37:23 AM »
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

Code: [Select]
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

« Last Edit: December 26, 2011, 10:46:00 AM by Peter Weis »

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #129 on: December 07, 2011, 12:54:45 AM »
What about Callback or Threaded Functions?

and where is EXIT SUB supposed to be?
Code: [Select]
            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.     :(


Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #130 on: December 07, 2011, 09:50:03 AM »
Hi Paul,

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

But they have not yet tested!

regards Peter

« Last Edit: December 26, 2011, 10:46:22 AM by Peter Weis »

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #131 on: December 07, 2011, 12:58:42 PM »
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.

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 1037
  • User-Rate: +30/-4
    • it-berater
Re: Code-Formatter PB 10
« Reply #132 on: December 07, 2011, 08:53:44 PM »
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.

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #133 on: December 07, 2011, 11:25:21 PM »
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.


Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 1037
  • User-Rate: +30/-4
    • it-berater
Re: Code-Formatter PB 10
« Reply #134 on: December 08, 2011, 07:13:59 AM »
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.