Standard Header

Here you'll find standard header templates used for software developed in our lab carrying copyright, licensing and attribution information as well as the usual file description and usage notes.

BSD template

The following header has been adapted from the OSI BSD template and carries the 3-clause modified-BSD licensing information:

/*
 * Copyright (c) <YEAR(S)>, Regents of the University of California
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright notice,
 *   this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright notice,
 *   this list of conditions and the following disclaimer in the documentation
 *   and/or other materials provided with the distribution.
 * - Neither the name of the University of California, Berkeley nor the names
 *   of its contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 *
 * <DESCRIPTION>
 *
 * by <ORIGINAL/MAIN AUTHOR(S)>
 *
 * v.<VERSION NUMBER AND/OR STATE>
 *
 * Revisions:
 *  <\nAUTHOR     DATE    COMMENT>
 *
 * Notes:
 *  <NOTES>
 *
 * Usage:
 *  <SAMPLE USAGE>
 */

Here is an example of the variable contents of the above header:

<YEAR(S)>
    2008-2010

<DESCRIPTION>
    ATMEL DataFlash Memory (dfmem) Interface

<ORIGINAL/MAIN AUTHOR(S)>
    Fernando L. Garcia Bermudez

<VERSION NUMBER AND/OR STATE>
    {0.1 alpha} OR {alpha}

<\nAUTHOR     DATE    COMMENT>
    Fernando Garcia Bermudez   2008-7-23   Initial release
    Stanley S. Baek            2010-7-20   Added handling of several chips

<NOTES>
    - Uses SPIx to communicate with dfmem.
    - Beware of having more than 255 chips connected, black hole expected.

<SAMPLE USAGE>
    // Initialize memory interface
    dfmemSetup();

    // Send random bits
    dfmemWrite(lotsadata);

    // Block execution until writing is finished so as to bother Aaron
    while(!dfmemIsReady());

Note that the above header is prepared for C/C++ (if you prefer a different type of comment enclosure, feel free to modify it):

/*
 * <HEADER>
 */

For Python, we could use:

#
# <HEADER>
#

For Matlab, we could use:

%
% <HEADER>
%

And for PIC Assembly code:

;
; <HEADER>
;

Note: Try to make sure that the header (and potentially the rest of your code) has a maximum line-width of 80 characters. This guarantees proper printing and display of the code for almost all cases.