Changeset 138 for trunk/doc/misc/codeConventions.tex
- Timestamp:
- Mar 4, 2004, 4:56:40 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/doc/misc/codeConventions.tex (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/misc/codeConventions.tex
r137 r138 155 155 Header files should have names starting \code{ps} or 156 156 \code{p_ps} for private interface definitions. The latter 157 should appear in a subdirectory \code{ private} of whichever158 directory i tbeing searched for the public header files.157 should appear in a subdirectory \code{Private} of whichever 158 directory is being searched for the public header files. 159 159 160 160 Include files should have the following order: … … 238 238 \subsection{Line Length} 239 239 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. 240 Avoid lines longer than 110 characters, since they're not handled well by many terminals and tools. 241 242 When preparing documents, you should ensure that lines of this length 243 are not wrapped (If you are using the standard PSDC \LaTeX{} class 244 file \file{panstarrs.cls}, \CODE|\begin{verbatim} ... \end{verbatim}| 245 will do this for you). 243 246 244 247 \subsection{Wrapping Lines} … … 1395 1398 High-precedence binary operators (\code{*}, \code{/}, \code{%} and above) 1396 1399 should \emph{not} be surrounded by whitespace. 1400 1401 \item 1402 The line-length limit has been changed from 80 to 110 characters. 1403 1397 1404 \end{itemize} 1398 1405 … … 1406 1413 1407 1414 The 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} 1415 emacs 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} 1419 and then grab \file{Templates/panstarrs.el}. Then add: 1420 1421 \begin{verbatim} 1422 (load-file "/home/you/Templates/panstarrs.el") 1429 1423 (add-to-list 'auto-mode-alist (cons "\\.[ch]$" 'panstarrs-c-mode)) 1430 1424 \end{verbatim} % $ % match that $ for emacs … … 1432 1426 for all \file{.c} and \file{.h} files. 1433 1427 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} 1428 If 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} 1434 add 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) 1437 1438 (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))) 1441 1442 \end{verbatim} 1442 1443
Note:
See TracChangeset
for help on using the changeset viewer.
