CONTRIBUTING
changeset 0 2b3e5ec03512
equal deleted inserted replaced
-1:000000000000 0:2b3e5ec03512
       
     1 
       
     2 This document briefly describes how to get involved with DTN
       
     3 development. Note that the DTN research project is still very much in
       
     4 its formative stages, and this code base in particular is likely to
       
     5 still be largely in flux. 
       
     6 
       
     7 Contribution Process
       
     8 --------------------
       
     9 
       
    10 Anonymous source code repository access is available for the general
       
    11 public. To gain access for checkins via ssh access requires
       
    12 permission. Send email to Michael Demmer <demmer@cs.berkeley.edu> if
       
    13 you're interested in contributing.
       
    14 
       
    15 Coding Conventions
       
    16 ------------------
       
    17 
       
    18 In the interest of overall clarity and consistency, we have adopted
       
    19 the following conventions for the implementation. Please follow them
       
    20 in your extensions:
       
    21 
       
    22 - The basic indentation level is 4 spaces (no tab characters please).
       
    23   Please take care to make sure that indentation matches the code
       
    24   around it.
       
    25 
       
    26 - Class names should begin with capital letters and use mixed case for
       
    27   word separation. e.g. BundleRouter
       
    28 
       
    29 - Method / function names should have all lowercase letters with words
       
    30   separated by underscores: e.g. send_bundle()
       
    31 
       
    32 - Class member variables should be distinguished from local variables
       
    33   with a trailing underscore, e.g. bundle_.
       
    34 
       
    35 - Macros and constants should be all capital letters with underscores
       
    36   to separate words. e.g. #define MAX_TUPLE_LENGTH 256
       
    37 
       
    38 - The file names for individual .h/.cc files should correspond to the
       
    39   (primary) class in the file. e.g BundleRouter.cc
       
    40 
       
    41 - Inline comments can use either C or C++ style syntax. For block
       
    42   comments on methods and classes, please use the mark-up syntax of
       
    43   doxygen since we use that to generate html code documentation.
       
    44 
       
    45 - Above all, please be consistent. When modifying code, follow the
       
    46   conventions of the code around you.
       
    47 
       
    48 - Try to keep code lines under 80 columns in width.
       
    49 
       
    50 - For emacs users, adding the following lisp code to your .emacs will
       
    51   follow these conventions:
       
    52 
       
    53 (require 'cc-mode)
       
    54 (require 'cc-vars)
       
    55 
       
    56 (defconst dtn-c-style
       
    57   '((c-basic-offset		. 4)		; 4 spaces for indentation
       
    58     (c-offsets-alist
       
    59      . ((substatement-open	. 0)		; don't indent braces!
       
    60 	(inline-open		. 0)		; don't indent braces, please.
       
    61 	(label 			. -1000)	; flush labels left
       
    62 	(statement-cont		. c-lineup-math); line up with = signs
       
    63 	(innamespace		. 0)		; no indent for namespaces
       
    64 	(inextern-lang		. 0)		; or extern language
       
    65 	))))
       
    66 
       
    67 (defun dtn-c-setup()
       
    68   (interactive)
       
    69   (c-add-style "dtn-c-style" dtn-c-style t)	; dtn style above
       
    70   (setq indent-tabs-mode nil)	           	; use spaces for tabs
       
    71 )
       
    72 
       
    73 (add-hook 'c-mode-hook 'dtn-c-setup)
       
    74 (add-hook 'c++-mode-hook 'dtn-c-setup)
       
    75   
       
    76 - For vim users, use the following settings for tabs:
       
    77 
       
    78 set tabstop=8        " \t are 8 spaces
       
    79 set shiftwidth=4     " but tab key inserts 4
       
    80 set softtabstop=4    " and indentation advances in increments of 4
       
    81 set noexpandtab      " don't turn tabs into spaces
       
    82 
       
    83 Testing
       
    84 -------
       
    85 
       
    86 There is an extensive set of unit tests and system tests in the test/
       
    87 directories of both DTN2 and oasys, as well as a suite of test
       
    88 utilities in the test-utils directories of both. 
       
    89