IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 4, 2004, 4:56:40 PM (22 years ago)
Author:
rhl
Message:

1/ Private .h files should appear in Private subdir
2/ Changed line length to 110
3/ Removed most emacs lisp code, and referred to cvs Templates/panstarrs.el

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/misc/codeConventions.tex

    r137 r138  
    155155Header files should have names starting \code{ps} or
    156156\code{p_ps} for private interface definitions. The latter
    157 should appear in a subdirectory \code{private} of whichever
    158 directory it being searched for the public header files.
     157should appear in a subdirectory \code{Private} of whichever
     158directory is being searched for the public header files.
    159159
    160160Include files should have the following order:
     
    238238\subsection{Line Length}
    239239
    240 Avoid lines longer than 80 characters, since they're not handled well by many terminals and tools.
    241 
    242 Note: Examples for use in documentation should have a shorter line length-generally no more than 70 characters.
     240Avoid lines longer than 110 characters, since they're not handled well by many terminals and tools.
     241
     242When preparing documents, you should ensure that lines of this length
     243are not wrapped (If you are using the standard PSDC \LaTeX{} class
     244file \file{panstarrs.cls}, \CODE|\begin{verbatim} ... \end{verbatim}|
     245will do this for you).
    243246
    244247\subsection{Wrapping Lines}
     
    13951398  High-precedence binary operators (\code{*}, \code{/}, \code{%} and above)
    13961399    should \emph{not} be surrounded by whitespace.
     1400
     1401\item
     1402  The line-length limit has been changed from 80 to 110 characters.
     1403
    13971404\end{itemize}
    13981405
     
    14061413
    14071414The easiest way to use these conventions while writing code using
    1408 emacs is to add these lines to your \file{.emacs} file:
    1409 
    1410 \begin{verbatim}
    1411 (define-derived-mode panstarrs-c-mode
    1412   c-mode "Pan-STARRS C"
    1413   "Major mode for editing Pan-STARRS C source.
    1414           \\{panstarrs-c-mode-map}"
    1415  
    1416   (setq c-default-style '((other . "k&r")))
    1417   (setq c-basic-offset 4)
    1418   (setq comment-column 40)
    1419   (add-to-list 'c-offsets-alist (cons 'statement-case-intro 2))
    1420   (add-to-list 'c-offsets-alist (cons 'statement-case-open 2))
    1421   (add-to-list 'c-offsets-alist (cons 'case-label 2))
    1422   )
    1423 \end{verbatim}
    1424 
    1425 You then need to ensure that this mode is set when editing code;
    1426 you could always type \code{ESCx panstarrs-c-mode} when you
    1427 opened a file, but the simplest way is to add
    1428 \begin{verbatim}
     1415emacs is to get \file{panstarrs.el} from \code{cvs} with the command
     1416\begin{verbatim}
     1417  cvs -d poiserver0.ifa.hawaii.edu:/usr/local/cvs/repositories/pan-starrs co Templates
     1418\end{verbatim}
     1419and then grab \file{Templates/panstarrs.el}.  Then add:
     1420
     1421\begin{verbatim}
     1422(load-file "/home/you/Templates/panstarrs.el")
    14291423(add-to-list 'auto-mode-alist (cons "\\.[ch]$" 'panstarrs-c-mode))
    14301424\end{verbatim}                          % $ % match that $ for emacs
     
    14321426for all \file{.c} and \file{.h} files.
    14331427
    1434 If you want to use C99-style comments (i.e. \code{//} to end of line),
    1435 add this to your \file{.emacs} file too:
    1436 \begin{verbatim}
     1428If you want to
     1429\begin{itemize}
     1430  \item use C99-style comments (i.e. \code{//} to end of line)
     1431  \item have your emacs window set to 110 characters wide
     1432  \item somewhat improve (or spoil?) the handling of re-indenting comments
     1433\end{itemize}
     1434add one or more of these \code{add-hook} commands to your \file{.emacs} file too:
     1435\begin{verbatim}
     1436(add-hook 'panstarrs-c-mode-hook 'panstarrs-c99-comments)
     1437(add-hook 'panstarrs-c-mode-hook 'panstarrs-set-width)
    14371438(add-hook 'panstarrs-c-mode-hook
    1438           '(lambda ()
    1439              (setq comment-start "// ")
    1440              (setq comment-end "")))
     1439          '(lambda ()
     1440             (set (make-variable-buffer-local 'comment-indent-function)
     1441                  'panstarrs-comment-indent)))
    14411442\end{verbatim}
    14421443         
Note: See TracChangeset for help on using the changeset viewer.