Changes between Version 2 and Version 3 of doc/tec/developerrules/palmstandard


Ignore:
Timestamp:
Nov 2, 2018 6:01:39 PM (6 years ago)
Author:
kanani
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • doc/tec/developerrules/palmstandard

    v2 v3  
    11= PALM coding rules =
    2 This is.....\\
     2Why to follow some standards? - Because everyone has her/his own programming style, sort of a dialect. And as it is, no one can understand all the possible dialects. So what do we do? We learn and apply the coding standard to make PALM more easily readable for all current and future developers. Let's all work on that - together.
    33
    4 '''Why to follow some standards?''' - Because everyone has her/his own programming style, sort of a dialect. And as it is, no one can understand all the possible dialects. So what do we do? We learn and apply the coding standard to make PALM more easily readable for all current and future developers. Let's all work on that - together.
     4== General ==
     5* Only ASCII characters allowed ('''no:''' °, ^2^, µ, etc.)
     6* Line length limit: 80 (soft) | 120 (hard)
     7*
    58
    6 == Indenting ==
    7 '''General module structure'''
    8 * 1 blank before MODULE, CONTAINS, SUBROUTINE (= first indention level)
    9 * +3 blanks for all following indention levels \\('''only exception:''' ONLY list in USE statements +4 blanks)
    10 * 1 blank between individual strings
    11 * 1 blank after ","
    12 * 1 blank before "::"
    13 * 2 blanks after ":"
     9== Indenting & spaces ==
     10=== General module structure ===
    1411{{{
    15  MODULE new_module_mod
    16 
    17     USE arrays_3d,                                                        &
    18         ONLY:  tend, u, v, w, zu, zw
    19 
    20     IMPLICIT NONE
    21 
    22     CHARACTER ::  global_string_a
    23 
    24     SAVE
    25 
    26     PRIVATE
    27 
    28     PUBLIC global_string_a
    29 
    30     INTERFACE newmod_3d_data_averaging
    31        MODULE PROCEDURE newmod_3d_data_averaging
    32     END INTERFACE newmod_3d_data_averaging
    33 
    34  CONTAINS
    35 
    36  SUBROUTINE newmod_3d_data_averaging( mode, variable )
    37 
    38     USE control_parameters
    39 
    40  END SUBROUTINE newmod_3d_data_averaging
    41 
    42  END MODULE new_module_mod
     12#!div style="align:'left'; width: 500px; border: 0px solid; float:right"
     13[[Image(rules_indent_general.png, 500px, right, margin-right=2, margin-top=0, border=0)]]\\
     14Indention example with highlighted whitespaces. Click to enlarge.
    4315}}}
    4416
    45 == Sorting ==
     17* '''1 whitespace''' before MODULE, CONTAINS, SUBROUTINE (= first indention level)
     18* '''+3 whitespaces''' for all following indention levels \\(only exception: ONLY list in USE statements '''+4 whitespaces''')\\
     19
     20
     21* '''1 whitespace''' between individual strings
     22* '''1 whitespace''' after ''','''
     23* '''1 whitespace''' before '''::'''
     24* '''2 whitespace''' after ''':'''
     25
     26
     27=== Whitespaces between brackets ===
     28* '''0 whitespace''' between string and '''('''
     29* '''1 whitespace''' after '''(''' and before ''')'''
     30
     31\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
     32== Alphabetical sorting ==
    4633except for CALLs to modules/subroutines
     34
     35== Lower/upper case ==
    4736
    4837== Commenting ==