Author Topic: Code-Formatter PB 10  (Read 158593 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 #240 on: March 11, 2012, 09:50:17 AM »
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!
« Last Edit: March 11, 2012, 09:59:47 AM by Peter Weis »

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #241 on: March 13, 2012, 01:51:43 AM »
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?

« Last Edit: March 13, 2012, 02:07:02 AM by Paul Elliott »

Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #242 on: March 13, 2012, 07:26:10 AM »
Hi Paul,
 to write to file Codeformatter.rc!
 line:
Code: [Select]
//IDI_ICON_1                  ICON DISCARDABLE  "F:\\PBWin10\\bin\\Icon_1.ico"
//IDI_TEST2                   ICON DISCARDABLE  "F:\\PBCC60\\bin\\test2.ico"   

replace with:

Code: [Select]
//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)
« Last Edit: March 13, 2012, 08:00:04 AM by Peter Weis »

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #243 on: March 13, 2012, 03:01:27 PM »
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.


Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #244 on: March 14, 2012, 01:36:45 AM »
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.


Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #245 on: March 14, 2012, 07:04:21 AM »
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
Code: [Select]
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

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #246 on: March 14, 2012, 01:24:22 PM »
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.


Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 1037
  • User-Rate: +30/-4
    • it-berater
Re: Code-Formatter PB 10
« Reply #247 on: March 14, 2012, 01:35:56 PM »
Peter erklär mir das und ich poste es dann. Dein aktuelles DEnglisch ist nicht gut verständlich.

Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #248 on: March 14, 2012, 03:21:37 PM »
(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.


« Last Edit: March 14, 2012, 04:04:30 PM by Theo Gottwald »

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #249 on: March 14, 2012, 05:51:13 PM »
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 ).



Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #250 on: March 18, 2012, 11:48:24 PM »
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)
« Last Edit: March 19, 2012, 05:20:58 PM by Theo Gottwald »

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 1037
  • User-Rate: +30/-4
    • it-berater
Re: Code-Formatter PB 10
« Reply #251 on: March 19, 2012, 05:20:05 PM »
@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.
« Last Edit: March 19, 2012, 05:23:20 PM by Theo Gottwald »

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #252 on: March 19, 2012, 06:53:40 PM »
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.


Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 1037
  • User-Rate: +30/-4
    • it-berater
Re: Code-Formatter PB 10
« Reply #253 on: March 19, 2012, 07:02:58 PM »
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.
« Last Edit: March 19, 2012, 07:08:44 PM by Theo Gottwald »

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #254 on: March 19, 2012, 08:52:31 PM »
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

« Last Edit: March 24, 2012, 03:08:26 PM by Paul Elliott »