Silverfrost Forums

Welcome to our forums

Debugger improvements

1 Sep 2017 1:28 #20080

SDBG has nice feature showing variable value in tiny popup screen when you point on variable with the mouse. Would be great to add the same feature when you point on ENDIFs and ENDDOs. Something like here (on this static image shown all popups at the same time but of course only one will be seen in reality)

https://s26.postimg.org/cq640mmhl/End_Ifs_And_Enddos.jpg

That will help us not to be lost in the spaghetti codes

1 Sep 2017 6:55 #20081

I would often write this as !comment in the code. Also, don't forget that constructs can be named in Fortran 90.

1 Sep 2017 8:40 #20084

I also do comment enddos and endifs. But I started doing this just recently after hundreds of thousands of lines of codes when the mess became unbearable 😦. Because nobody teaches good coding practices so my $10 bet is that most people don't do that. And naming is way too rarely used, and is known and much less used only by very advanced coders.

1 Sep 2017 2:35 #20085

Dan,

When I was programming in Algol-60, back in the 1960s, the use of indenting was essential, and I spent many hours drawing links between the start of a loop and its end using different coloured pens. Can I help by sending you a set, along with a long ruler, down to the South Pole? Can you still get your source codes printed on music-ruled fan-fold paper on a line printer?

At least with traditional Fortran DO loops one automatically gets a connection between the DO statement and the final CONTINUE statement through the statement number of the latter, which in fixed-format source codes is an 'outdent'. It slowly dawned on me that what I had seen as a primitive defect was actually a helpful construct.

But sadly, the past is a foreign country where they do things differently (or so said H. E. Bates in 'The Go Between'). Don't believe people who say the past (or indeed, the primitive) was always worse!

Eddie

1 Sep 2017 10:29 (Edited: 2 Sep 2017 8:40) #20089

Eddie, oh yeah, the indentation is simply a must, I completely forgotten mentioning it, because it is so natural that you don't even notice it. You are dead without it in large codes. As to coloring - here is where I don't have opinion. I tried to convince my editor developer 20 years ago to implement coloring because almost all do that but he refused... I think Plato also has it but I use batch files to compile instead. As a result I have no clue if it actually helps or distracts. What is your opinion?

1 Sep 2017 11:49 #20090

Hi Dan,

Plato does have colouring, although the colours don't contrast a lot. I'm sure I could change the colour palette.

To keep track of nested or long DO loops I have always suggested using the DO variable as an alternate DO label, but few have given that support. The alternative I often use is END DO ! DO_variable, eg

!
      do j = 1,ncb
        c(:,j) = 0
        do k = 1,nca
          c(1:nra,j) = c(1:nra,j) + a(1:nra,k) * b(k,j)
        end do ! k
      end do ! j
!

It is good to see that we are thinking similarly. It is just a shame more on the Fortran committee don't have the same experience.

2 Sep 2017 12:56 #20091

John,

It is intriguing that the content of your do loop is one step further indented than the start and finish. Wouldn't:

! 
      do j = 1,ncb 
      c(:,j) = 0 
        do k = 1,nca 
        c(1:nra,j) = c(1:nra,j) + a(1:nra,k) * b(k,j) 
        end do ! k 
      end do ! j 
!

be more logical?

Eddie

2 Sep 2017 5:05 #20092

Quoted from LitusSaxonicum

It is intriguing that the content of your do loop is one step further indented than the start and finish.

The Fortran style guide at http://www.fortran90.org/src/best-practices.html#indentation would support John's style. That guide uses four spaces for indentation. Others may use fewer or more spaces, or tabs. Having the DO and the matching END DO indented less than the statements in the body of the DO construct (and likewise for IF...ENDIF, etc.) makes it clear where the loop starts and where it ends, and whether a statement is in the loop or not.

I usually don't bother too much about style when editing source code. After I am done, I can use a utility to reformat ('pretty print') the whole code in a standard way.

2 Sep 2017 10:19 #20094

Mecej4,

It doesn't work for me. I prefer no indent at all, blank lines, CONTINUE and statement numbers. It's the 'the way nature intended' as I see it (quote misused from the Silverfrost top page) 😉.

If I had to use indents, then I'm sure that I would find having the content indented differently obfuscated the connection between the beginning, content, and end.

But then I don't indent loops, not since ALGOL days, and they ended, abruptly, in 1970 ! My recollection was that they were indented rather like John's layout, but the interior code began with 'BEGIN' and ended with 'END' which made it a sort of logical block.

Eddie

13 Sep 2017 2:16 #20232

I wouldn't indent, but then I'd have statement numbers. They are an 'outdent', akin to a tab on the left. Then it's obvious where the loop ends.

The need for wider layouts is due to longer names and indents. Neither are essential.

Just saying.

Eddie

13 Sep 2017 5:43 (Edited: 13 Sep 2017 6:21) #20235
! JohnC's 'starter for 10' version (10) 

      some code here 
      some more code here 
      do j = 1,ncb 
        c(:,j) = 0 
        do k = 1,nca 
          c(1:nra,j) = c(1:nra,j) + a(1:nra,k) * b(k,j) 
        end do ! k 
      end do ! j 
      almost last code here 
      last code here 

2 spaces is also my style. I can not afford 4 with free style and 132 places. The editor has to keep open two panes with two files simultaneously. Occupies almost all 3840 pixels of screen width

For better visible separation of subroutines in the files each containing ~20000 lines i use huge banners made using this site below. Here is one for Main program

!http://patorjk.com/software/taag/#p=display&h=2&v=0&f=Doh&t=Main%20GUI
!MMMMMMMM               MMMMMMMM                    iiii
!M:::::::M             M:::::::M                   i::::i
!M::::::::M           M::::::::M                    iiii
!M:::::::::M         M:::::::::M
!M::::::::::M       M::::::::::M  aaaaaaaaaaaaa   iiiiiii nnnn  nnnnnnnn
!M:::::::::::M     M:::::::::::M  a::::::::::::a  i:::::i n:::nn::::::::nn
!M:::::::M::::M   M::::M:::::::M  aaaaaaaaa:::::a  i::::i n::::::::::::::nn
!M::::::M M::::M M::::M M::::::M           a::::a  i::::i nn:::::::::::::::n
!M::::::M  M::::M::::M  M::::::M    aaaaaaa:::::a  i::::i   n:::::nnnn:::::n
!M::::::M   M:::::::M   M::::::M  aa::::::::::::a  i::::i   n::::n    n::::n
!M::::::M    M:::::M    M::::::M a::::aaaa::::::a  i::::i   n::::n    n::::n
!M::::::M     MMMMM     M::::::Ma::::a    a:::::a  i::::i   n::::n    n::::n
!M::::::M               M::::::Ma::::a    a:::::a i::::::i  n::::n    n::::n
!M::::::M               M::::::Ma:::::aaaa::::::a i::::::i  n::::n    n::::n
!M::::::M               M::::::M a::::::::::aa:::ai::::::i  n::::n    n::::n
!MMMMMMMM               MMMMMMMM  aaaaaaaaaa  aaaaiiiiiiii  nnnnnn nnnnnn  
13 Sep 2017 6:06 #20236

Since all codes on Earth are full of devilry, this separator is also recommended for Main GUI

                 |             .      .       _   _                                                 
     )))         |.===.      .  .:::.        '\\-//`          -*~*-         \-^-/          |||      
    (o o)        {}o o{}       :(o o):  .     (o o)           (o o)         (o o)         (o o)     
ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo---ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-

or this

 \\\    ///      wW  Ww\\\  ///        \/    wWw  wWw wW  Ww 
 ((O)  (O))   /) (O)(O)((O)(O))       (OO)   (O)  (O) (O)(O) 
  | \  / |  (o)(O)(..)  | \ ||      ,'.--.)  / )  ( \  (..)  
  ||\\//||   //\\  ||   ||\\||     / /|_|_\ / /    \ \  ||   
  || \/ ||  |(__)|_||_  || \ |     | \_.--. | \____/ | _||_  
  ||    ||  /,-. (_/\_) ||  ||     '.   \) '. `--' .`(_/\_) 
 (_/    \_)-'   ''     (_/  \_)      `-.(_.'  `-..-'         

and this called 'Ghost' 😃

 _   .-')      ('-.                 .-') _                                       
( '.( OO )_   ( OO ).-.            ( OO ) )                                      
 ,--.   ,--.) / . --. / ,-.-') ,--./ ,--,'         ,----.   ,--. ,--.    ,-.-')  
 |   `.'   |  | \-.  \  |  |OO)|   \ |  |\        '  .-./-')|  | |  |    |  |OO) 
 |         |.-'-'  |  | |  |  \|    \|  | )       |  |_( O- )  | | .-')  |  |  \ 
 |  |'.'|  | \| |_.'  | |  |(_/|  .     |/        |  | .--, \  |_|( OO ) |  |(_/ 
 |  |   |  |  |  .-.  |,|  |_.'|  |\    |        (|  | '. (_/  | | `-' /,|  |_.' 
 |  |   |  |  |  | |  (_|  |   |  | \   |         |  '--'  ('  '-'(_.-'(_|  |    
 `--'   `--'  `--' `--' `--'   `--'  `--'          `------'  `-----'     `--'    
13 Sep 2017 6:33 #20237

Other examples

!               ___  ___         _______        __       ___  ___                 
!              |'  \/'  |       /'      \      /''\     |'  \/'  |                
!               \   \  /       |:        |    /    \     \   \  /                 
!                \\  \/    --  |_____/   )   /' /\  \     \\  \/                  
!                /\.  \    --   //      /   //  __'  \    /   /                   
!               /  \   \       |:  __   \  /   /  \\  \  /   /                    
!              |___/\___|      |__|  \___)(___/    \___)|___/                     
!                                                                               
!    ________  _______    _______   ______  ___________  _______        __      
!   /'       )|   __ '\  /'     '| /' _  '\('     _   ')/'      \      /''\     
!  (:   \___/ (. |__) :)(: ______)(: ( \___))__/  \\__/|:        |    /    \    
!   \___  \   |:  ____/  \/    |   \/ \        \\_ /   |_____/   )   /' /\  \   
!    __/  \\  (|  /      // ___)_  //  \ _     |.  |    //      /   //  __'  \  
!   /' \   :)/|__/ \    (:      '|(:   _) \    \:  |   |:  __   \  /   /  \\  \ 
!  (_______/(_______)    \_______) \_______)    \__|   |__|  \___)(___/    \___)
!

!
!   8888888b.                   888         8888888b. 8888888 .d8888b.  
!   888   Y88b                  888         888   Y88b  888  d88P  Y88b 
!   888    888                  888         888    888  888  888    888 
!   888   d88P .d88b.  .d8888b  888888      888   d88P  888  888        
!   8888888P' d88''88b 88K      888         8888888P'   888  888        
!   888       888  888 'Y8888b. 888  888888 888         888  888    888 
!   888       Y88..88P      X88 Y88b.       888         888  Y88b  d88P 
!   888        'Y88P'   88888P'  'Y888      888       8888888 'Y8888P'  
!
14 Sep 2017 3:12 #20239

ASCII sources are boring. With such beautifications you will start a bit loving them.

When compilers will accept normal human oriented editors, like WORD and PowerPoint for Windows with their DOC, DOCX etc files? There we can add graphics and tables for documenting, clarification and just for beautifications. Silverfrost/Salford, how about you, remember your glorious days of being first to offer something new!

But let's return to our poor sheeps, I still like to see very very much that SDBG to show the matching if/else/endif and do/enddo. Just right now I again was stopped with some my own bugs and again losing hell of time, swearing, hell angry at myself, trying to add indentations and separators, to finally find the ends of numerous if/endifs in my own code written 30 years ago as a spaghetti code.

15 Sep 2017 12:38 #20246

Dan,

You have to eliminate the bugs !!

Bugs are 'coding errors' not 'devilry'

Throw out the Ouija board and give /IM a go.

You then have to develop a table of all variables being used. It provides a way of looking at the code in a slightly different way and could help identify where some coding errors may be.

John

15 Sep 2017 2:33 #20248

John,

Both user errors and compiler. Have you tried to use FTN77 circa 1993 under DOS or the new Fortran90 features of FTN90 and FTN95 circa year 1997-2000? Then you should know what devilry means. Since then the Fortran part of FTN95 compiler itself was cleaned well already but GUI is not that heavily used and there I speculate still hide some last real devilry when the code crashes on one computer but does not on another. Or works when GUI small but crashes starting at some its size. Or crazy Simpleplot maked you nuts (good that Paul have introduced native %pl)? Or, in worst case, stuff works under SDBG and crashes without it not allowing to catch the error.

Probably you do not use Clearwin much. Count how many Clearwin+ %XX controls is in your program.

Actually only one hopefully last devilry actually worries me. Wanna try to find the reason of crashes of my property sheet? I'll pay $100 to anyone who will fix it. Could be my own error. But I doubt since it works under SDBG ok. Or find why 32bit debugger sometimes crashed right after Simpleplot call? Or when numbers in Simpleplot are >1e22? Though the Simpleplot is not interesting anymore.

Besides that there are a lot of other devilry goes in the place where I live, with the neighbors (their Jacuzzi for example roars like a 100kW transformer whole day and night resonating through the water pipes the whole area and no one cares and even hearing that. Is this possible people are THAT dense?), with the problems I am trying to solve being late on all of them by months and sometimes years. Even my town is called Grand Devil on the foreign language ! So yes, I am screwed like no one else! 😃 And I also see how many in the world are unbelievably screwed and even do not realize it but let's not talk about politics. There is a lot of totally amazing devilry in the world

Please login to reply.