1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
/*****************
$Header: /home/amb/CVS/cxref/doc/README.c,v 1.4 1997-05-26 11:23:40 amb Exp $
A comment for the file, RCS header comments are treated specially when first.
*****************/
/*+ A #include comment +*/
#include <stdio.h>
#include <math.h> /*+ An alternative #include comment. +*/
/*+ A #define comment. +*/
#define def1 1
#define def2 2 /*+ An alternative #define comment. +*/
/*+++++++++++
A #define with args
arg1 The first arg
arg2 The second arg
+++++++++++*/
#define def3(arg1,arg2) (arg1+arg2)
/*+ An alternative #define with args. +*/
#define def4(arg1 /*+ The first arg +*/, \
arg2 /*+ The second arg +*/) \
(arg1+arg2)
/*+ An example typedef comment +*/
typedef enum
{
one, /*+ one value +*/
two /*+ another value +*/
}
type1;
/*+ Another example typedef comment, +*/
typedef struct
{
int a; /*+ A variable in a struct. +*/
union bar
{
char a; /*+ Each element +*/
int b, /*+ of a struct +*/
c; /*+ or a union +*/
long d; /*+ can have a comment +*/
}
e; /*+ Nested structs and unions also work. +*/
}
type2, /*+ a type that is a struct. +*/
*ptype2; /*+ a pointer to a struct type. +*/
/*+ A leading comment only. +*/
int var1,var2;
static int var3; /*+ A trailing comment only. +*/
/*+ A variable for +*/
int var4, /*+ one thing. +*/
var5, /*+ a second thing. +*/
var6; /*+ a third thing. +*/
/* Note: The leading comment is combined with each of the trailing comments. */
/* Note: the push through of the comment above on the ',' and ';', see README. */
/*+++++++++++
A function comment (the comments for the args need to be separated by a blank line).
int function1 The return value.
int arg1 The first argument.
int arg2 The second argument.
Some more comments
+none+ Note: this line and the two below are processed specially.
+html+ This comment is only visible in the HTML output, and can contain HTML markup.
+latex+ This comment is only visible in the \LaTeX output, and can contain \LaTeX markup.
+++++++++++*/
int function1(int arg1,int arg2)
{
/*+ An internal comment in a function that appears as a
new paragraph at the end of the comment. +*/
var1=0;
function2(var3,var4);
}
/*+ An alternative function comment +*/
int function2(int arg1, /*+ The first argument. +*/
int arg2) /*+ The second argument. +*/
/*+ Returns a value +*/
{
int (*funcp)()=&function1;
}
/* Note: the push through of the comment above on the ',' and ')', see README. */
|