• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

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

#240
Hi Paul,

sending you here the code of all three versions in which the last time I =
was working!

code formater PB10e V2 is the latest version 2, or have already been?


code formater PB10e V3 with old format

There are only two buttons you can work with it

code formater PB10e V3 with new format does not go

I wanted to revise the format completely. I not gotten this version run run!

Paul Elliott

#241
Hi Peter,

How did you produce the RES & PBR? The PB v10 RC complains about 2 of the ICO files and
them aborts before finishing and the new PBR isn't complete.

Also where are icon_1.ico & test2.ico?

Did you use a newer version of RC.exe than PB supplies?


Peter Weis

#242
Hi Paul,
to write to file Codeformatter.rc!
line:

//IDI_ICON_1                  ICON DISCARDABLE  "F:\\PBWin10\\bin\\Icon_1.ico"
//IDI_TEST2                   ICON DISCARDABLE  "F:\\PBCC60\\bin\\test2.ico"   


replace with:


//IDI_ICON_1                  ICON DISCARDABLE  "ResDll\\Icon_1.ico"
//IDI_TEST2                   ICON DISCARDABLE   "ResDll\\test2.ico" 


Extract the icons that I'm sending to ResDll!

Get yourself a new resource compiler. Copy it into the bin directory of PowerBASIC

Resource Compiler-Update:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa381042(v=vs.85).aspx
   
regards Peter


(Minor changes/Theo)

Paul Elliott

Peter,

Thanks for that last file.

I pulled the 2 missing icons. But instead of manually changing the RC file ( which Phoenix keeps
changing back ), it was easier to name to two icons to their right names then fix the imagelist
and remove the extra code that replaced the old icons with the new ones at run time.

I'm using RC v6.1 but will have to remember to swap back to PB original RC when doing any
update.


Paul Elliott

Peter,

It only took an hour or so to put in the DoFormat.inc from 02/18/2012 ( that can produce SLL or
plain include ) with the changes you made to the file in v3 old. Most of the time was getting all
the files open in 1 place & the differences hi-lited.

Seems to work the same as before. I commented out some parts instead of deleting them. Mostly
to do with all the file handling being moved to the DoFormat.inc file.

So it is possible.

But the big question I have is Are you rewriting all the DoFormat routines for your new v3?
Or is it way to early to be asking?

Just curious.


Peter Weis

Hi Paul,
I kicked everything here because I wanted to make the totally new! But I have not gotten around! Have nothing new. Have you all been

FOR currentline = 1 TO totallines

            IF LEFT$(ztext(currentline), 9) = "#PBFORMS " THEN
                PRINT #fc.fhout, ztext(currentline)
            ELSE

                LineAnzahl = splitVarLine(Zeilen(), zeilenNummer, ztext(), remstr(), currentline)
                FOR lineStart = 0 TO lineAnzahl
                    ftab = is_space(Zeilen(lineStart)) * FoDoFormat.tabsize
                    p = 1

                        findPBWord(Zeilen(lineStart), p, statement, termstr)
                        SELECT CASE UCASE$(statement)
                        CASE "GLOBAL", "LOCAL", "REGISTER", "DIM", "REDIM", "STATIC", "INSTANCE"
                            IF FoDoFormat.splitvariables THEN
                                Build = BuildVars (statement, Zeilen(), remstr(), lineStart, LineAnzahl)
                                work = %TRUE
                            END IF
                        CASE ELSE
                        END SELECT

                        IF Work = %False THEN
                           IF FoDoFormat.insertblanks = 1 AND work = %False THEN
                              WordCount = Line2Words(Zeilen(lineStart) + remstr(lineStart), w())    ' , @fo)
                              build = RebuildLine(w(), WordCount)
                           ELSE
                              build = SPACE$(ftab) + LTRIM$(Zeilen(lineStart))
                           END IF
                           PRINT #fc.fhout, zeilenNummer + build


                        END IF

                NEXT lineb

            END IF
            IF (currentline MOD 10) = 0 THEN     'update the progress control
                SendMessage fc.hProgress, %PBM_SETPOS, 100 * (CurrentLine / TotalLines), 0
            END IF
    NEXT                   


  Best regards Peter

Paul Elliott

Peter,

I do not understand. Is that little bit of code supposed to replace everything you had in the
DoFormat routine?

Maybe it's best if I just wait until you decide to show your new v3.

Until then.


Theo Gottwald

Peter erklär mir das und ich poste es dann. Dein aktuelles DEnglisch ist nicht gut verständlich.

Peter Weis

#248
(Translated/ Theo)

I just wanted tell Paul that i have3 removed all stuff that i believe to be useless for the next version.
However i could not yet start with it. THe code above just shows a part of all.



Paul Elliott

Ok, that probably explains a few things.
Such as  :
some options not saved  or wiped out based on some unrelated option
input file loaded into output tab
duplicated output lines
indenting that gets really large if Format run multiple times without exiting

I think I'll check the v3 old to see if it needs fixed.

Just something to do ( instead of waxing the car ).



Paul Elliott

#250
In case anyone is interested, I've attached the version of Code Formatter that I've been working
on ( based on v2 ). It's written using Jose's CWindow for the GUI and with enhancements to the
original RebuildLine along with some extra routines to handle specific keywords.

NO source included ( I don't really want to compete in any way with what Peter's doing ) but did
this just to see what I could do.

If you don't feel comfortable using an EXE without the source then DO NOT download.
As far as I know there is nothing bad in the code.

There is a text file included in the zip that documents some of the changes I've made. I started
out creating a DDT version of the GUI and then created a CWindow version. They both use
exactly the save DoFormat routines ( either via an INC or SLL ).

There is also a "Code Formatter.cfg" included and you'll probably want to change the input &
output file names.

If you do use it and find something that doesn't work the way you think it should, Please let me
know. I'll try to change it or explain why not.

(Executable removed / Theo)

Theo Gottwald

#251
@Paul, this is a Source-Code Forum.
Please do not publish executables unless in the third party forum.
Here i want (also for safety reasons) only compilable Source code.

This is true for anybody, posting here.

The problem is that there are multiple viruses out there, some of them not even known by AV-Programs.
And we do not want them to have platform to spread here.
Sourcecode is safe, and is welcome from anybody.

If you have reasons not to share your sourcecode, please explain them.
Executables can be posted as Sollutions in the Third Party Forum.
In that case i will run them through Virustotal to have a maximum, safety for our Forum Members.

PS: I personally never use executables from public places unless i have tested them hardly.
Therefore i have removed the executable, and hope that you will provide the source-code that will be the newest version here.

Paul Elliott

Theo,

Ok, have it your way.

I stated the main reason that I won't publish my source ( did NOT want to interfere with what
Peter is doing ).

The last time I contributed a hunk of code for this project, Peter reworked it. The revision didn't
work. Personally I could barely recognise any of my code. Then you both stepped back and
said the "ball was in my court" to fix it. Maybe I didn't understand exactly what you two were
saying but the implication was there that I was responsible for it being wrong.

My code worked then and is still working. I am not going to post code just to have it hacked
to pieces until it fails to work. Having looked at Peter's code, I still can not understand what
it is doing. All I do know is that it doesn't always work.

My program works on everything I can find to run thru it. And hasn't shown any anti-viral
activity on 2 different ant-virus program.

As it is, I can see there is no use in my coming back here for several months.

So Long.


Theo Gottwald

#253
Paul, most people come here to get sollutions to their problems.
And we have the finest sollutions here, therefore its up to you to come here or not.

Besides i have not sted new rules but just told you my practise,
and thats for your and our safety.

I will not force you to post source code, but please do not poste executables.
If i see them I'll remove them. People can compile them if the source code is there.

The things you tell from the past are strories from the past.
I don't know why you warm these up, as i told you to post the source code.

Now do it and it will be the new version. Or leave it, then somebody else will make a new version.

We are all not employees whatever we do, that we do in our freetime.
And we do not get paid for it. Not me (even though i have expenses with the forum),
and not Jose (who works like an one man army here to provide us with highes quality code).

Please note that i, as the moderator of this Subforum, take the right to delete all postings that do not contribute to a subject at a later time.
This is a practice to clean up the forum and keep it a place of experts knowledge.

Generally said:
We do not need people explaining us their problems of psychological character,  and we do not need men whining like girls (because somebody did something to them).
But you are welcome to be a part of our experts network, if you can leave emotions behind and, start sharing your programming knowledge. And source-code.

Paul Elliott

#254
Theo,

Quit the name calling. You asked for my reason and I told you. The facts as I saw them.
Delete any or all of my posts that you want.

Meanwhile, here's the DDT source that matches the zip you deleted.
Using PB Win v10.03 & Jose's WinAPI v3.

Or just delete this one too.

03/24/2012 new zip file -- updated DoFormat.bas