IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 12, 2004, 12:06:19 PM (22 years ago)
Author:
jhoblitt
Message:

fix latex syntax

File:
1 edited

Legend:

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

    r2351 r2352  
    1 %%% $Id: perlCodeConventions.tex,v 1.8 2004-11-12 21:58:22 jhoblitt Exp $
     1%%% $Id: perlCodeConventions.tex,v 1.9 2004-11-12 22:06:19 jhoblitt Exp $
    22\documentclass[panstarrs]{panstarrs}
    33
     
    165165# Copyright (C) 2004  Joshua Hoblitt
    166166#
    167 # $Id: perlCodeConventions.tex,v 1.8 2004-11-12 21:58:22 jhoblitt Exp $
     167# $Id: perlCodeConventions.tex,v 1.9 2004-11-12 22:06:19 jhoblitt Exp $
    168168
    169169use 5.008005;   # optional
     
    222222# Copyright (C) 2004  Joshua Hoblitt
    223223#
    224 # $Id: perlCodeConventions.tex,v 1.8 2004-11-12 21:58:22 jhoblitt Exp $
     224# $Id: perlCodeConventions.tex,v 1.9 2004-11-12 22:06:19 jhoblitt Exp $
    225225
    226226package Foo;
     
    842842\begin{verbatim}
    843843my @things = qw( foo bar baz );
     844\end{verbatim}
    844845\end{itemize}
    845846
     
    10761077\label{SourceExample}
    10771078
    1078 \tbd{Need to include more of the rules, and shorten the example}
    1079 Here's \file{psBuffer.h}:
    1080 \begin{verbatim}
    1081 #if !defined(PS_BUFFER_H)               /* here's the insides of psBuffer.h */
    1082 #define PS_BUFFER_H
    1083 #define PS_BUFSIZE 128                  // Size for I/O buffers
    1084 
    1085 typedef struct {
    1086     char buf[PS_BUFSIZE];               // buffer
    1087     int n;                              // number of bytes in buffer
    1088 } psBuffer;
    1089 
    1090 psBuffer *psBufferAlloc(void);
    1091 void psBufferFree(psBuffer *buf,         // buffer to delete
    1092                  int deep);             // NOTUSED. Do a deep delete
    1093 
    1094 void psBufferAppend(psBuffer *restrict buf, // psBuffer to append to
    1095                     const char *restrict str); // string to add
    1096 
    1097 #endif
    1098 \end{verbatim}
    1099 
    11001079And here's the C source; \file{psUtils.h} provides \code{psAlloc/psFree}.
    11011080
     
    12181197%------------------------------------------------------------------------------
    12191198
    1220 \section{Departures from Sun Java Coding Standards}
    1221 
    1222 Apart from changes required by our use of C99 rather than Java,
    1223 this document differs from the original Sun-Java standard in
    1224 two sorts of ways; additions and changes.
    1225 
    1226 \subsection{ Additions to the Sun-Java standards}
    1227 
    1228 \begin{itemize}
    1229 \item
    1230     Naming convention for include files
    1231 
    1232 \item
    1233   Added naming conventions for constructors, destructors, and conversion
    1234   subroutines.
    1235 
    1236 \item
    1237   Specified that the `output' argument should come \emph{first}.
    1238 
    1239 \item
    1240   Added conventional comments for unused arguments and unreachable
    1241   statements (conforming to Doxygen's conventions).
    1242 
    1243 \item
    1244   Specified that subroutines taking no arguments should be explicitly
    1245   specified as \code{(void)} (avoiding complaints on some compilers,
    1246   e.g. on SGIs).
    1247 
    1248 \item
    1249   Added rules on typedefing structs, and on struct tags.
    1250 
    1251 \end{itemize}
    1252 
    1253 \subsection{Departures from the Sun-Java standards}
    1254 
    1255 \begin{itemize}
    1256 
    1257 \item
    1258   We break lines \emph{after} (not before) an operator.
    1259 
    1260 \item
    1261   We don't specify any special indentation for continued logical
    1262   expressions within an \code{if} clause.
    1263 
    1264 \item
    1265   Specify that \code{case/break} statements should be indented
    1266   by half an indent (2 spaces)
    1267 
    1268 \item
    1269   Comments need not be preceeded by a blank line
    1270 
    1271 \item
    1272   The restriction on only declaring variables at the top of blocks (including
    1273   \code{for} loops has been somewhat relaxed.
    1274 
    1275 \item
    1276   Relaxed the `only one statement per line' rule a little.
    1277 
    1278 \item
    1279   High-precedence binary operators (\code{*}, \code{/}, \code{%} and above)
    1280     should \emph{not} be surrounded by whitespace.
    1281 
    1282 \item
    1283   The line-length limit has been changed from 80 to 110 characters.
    1284 
    1285 \item
    1286   Relaxed wording to allow parentheses to be omitted when the precedence
    1287   is well known and unambiguous.
    1288 
    1289 \end{itemize}
    1290 
    1291 %------------------------------------------------------------------------------
    1292 
    1293 \section{How to Achieve This Style in Emacs}
    1294   \label{dot_emacs}
    1295 
    1296 \textit{This section is provided for your convenience; it is, of course,
    1297 not part of the coding standards.}
    1298 
    1299 The easiest way to use these conventions while writing code using
    1300 emacs is to get \file{panstarrs.el} from \code{cvs} with the command
    1301 \begin{verbatim}
    1302   cvs -d poiserver0.ifa.hawaii.edu:/usr/local/cvs/repositories/pan-starrs co Templates
    1303 \end{verbatim}
    1304 and then grab \file{Templates/panstarrs.el}.  Then add:
    1305 
    1306 \begin{verbatim}
    1307 (load-file "/home/you/Templates/panstarrs.el")
    1308 (add-to-list 'auto-mode-alist (cons "\\.[ch]$" 'panstarrs-c-mode))
    1309 \end{verbatim}                          % $ % match that $ for emacs
    1310 to your \file{.emacs} file; this will use \code{panstarrs-c-mode}
    1311 for all \file{.c} and \file{.h} files.
    1312 
    1313 If you want to
    1314 \begin{itemize}
    1315   \item use C99-style comments (i.e. \code{//} to end of line)
    1316   \item have your emacs window set to 110 characters wide
    1317   \item somewhat improve (or spoil?) the handling of re-indenting comments
    1318 \end{itemize}
    1319 add one or more of these \code{add-hook} commands to your \file{.emacs} file too:
    1320 \begin{verbatim}
    1321 (add-hook 'panstarrs-c-mode-hook 'panstarrs-c99-comments)
    1322 (add-hook 'panstarrs-c-mode-hook 'panstarrs-set-width)
    1323 (add-hook 'panstarrs-c-mode-hook
    1324           '(lambda ()
    1325              (set (make-variable-buffer-local 'comment-indent-subroutine)
    1326                   'panstarrs-comment-indent)))
    1327 \end{verbatim}
    1328          
    13291199\section{How to Achieve This Style with Astyle}
    13301200\label{astyle}
Note: See TracChangeset for help on using the changeset viewer.