summaryrefslogtreecommitdiff
path: root/man/man1/pmcpp.1
blob: 26a23056a0c6060126aac9a3711c062d84e1afe6 (plain)
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
'\"macro stdmacro
.\"
.\" Copyright (c) 2011 Ken McDonell.  All Rights Reserved.
.\" 
.\" This program is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License as published by the
.\" Free Software Foundation; either version 2 of the License, or (at your
.\" option) any later version.
.\" 
.\" This program is distributed in the hope that it will be useful, but
.\" WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
.\" or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
.\" for more details.
.\" 
.\"
.TH PMCPP 1 "" "Performance Co-Pilot"
.SH NAME
\f3pmcpp\f1 \- simple preprocessor for the Performance Co-Pilot
.\" literals use .B or \f3
.\" arguments use .I or \f2
.SH SYNOPSIS
.B pmcpp
[\f3\-D\f1 \f2name\f1[=\f2value\f1] ...]
[\f2infile\f1]
.SH DESCRIPTION
.B pmcpp
provides a very simple pre-processor for manipulating Performance
Metric Name Space (PMNS) files for the
Performance Co-Pilot (PCP).  It is most commonly used internally
to process the PMNS file(s) after
.BR pmLoadNameSpace (3)
or
.BR pmLoadASCIINameSpace (3)
is called.
.PP
Input lines are read from
.I infile
(or standard input if
.I infile
is not specified), processed and written to standard output.
.PP
All C-style comments of the form /* ... */ are stripped from the
input stream.
.PP
There are no predefined macros for
.B pmcpp
although macros may be defined on the command line using the
.B \-D
option, where
.I name
and
.I value
must follow the same rules as described below for the
.B #define
directive.
.PP
.B pmcpp
accepts the following directives in the input stream (like
.BR cpp (1)):
.IP * 3n
\fB#include "\fIfilename\fB"\fR
.br
or
.br
\fB#include <\fIfilename\fB>\fR
.br
In either case the directory search path for
.I filename
tries
.I filename
first, then the directory for the command line
.I infile
(if any),
followed by the
.B $PCP_VAR_DIR/pmns
directory.
.B #include
directives may be nested, up to a maximum depth of 5.
.IP * 3n
\fB#define \fIname value\fR
.br
Defines a value for the macro
.I name
which must be a valid C-style name, so leading alphabetic or ``_'' followed by
zero or more alphanumerics or ``_''.
.I value
is optional (and defaults to an empty value) but when present it may
.B not
contain white space and quoting or escaping is
.B not
supported.
.IP * 3n
\fB#undef \fIname\fR
.br
Removes the macro definition, if any, for
.IR name .
.IP * 3n
\fB#ifdef \fIname\fR
.br
\&...
.br
\fB#endif\fR
.br
or
.br
\fB#ifndef \fIname\fR
.br
\&...
.br
\fB#endif\fR
.br
The enclosing lines will be stripped or included, depending if the
macro
.I name
is defined or not.
.PP
Macro substitution is achieved by breaking the input stream into words
separated by white space or one of the characters ``.'' or ``:''
\- this matches the syntax of the PMNS, see
.BR pmns (5).
Each word is checked and if it matches a macro name, the word is
replaced by the macro value, otherwise the word is unchanged.
.PP
There is generally one output line for each input line, although the line
may be empty if the text has been stripped due to the handling of
comments or conditional directives.  When there is a change in the input
stream, an additional output line is generated of the form:
.PP
.ti +10n
# line "name"
.PP
to indicate the 
.I following
line of output corresponds to line number
.I line
of the input file
.IR name .
.PP
Important
.BR cpp (1)
features that are
.B not
supported by
.B pmcpp
include:
.IP * 3n
\fB#if \fIexpr\fR
.br
\&...
.br
\fB#endif\fR
.IP * 3n
Nested use of
.B #ifdef
or
.BR #ifndef .
.IP * 3n
.B #else
within an
.B #ifdef
or
.BR #ifndef .
.IP * 3n
Stripping C++ style comments, as in // comment
.IP * 3n
Error recovery - the first error encountered by
.B pmcpp
will be fatal.
.IP * 3n
.BR cpp (1)
command line options like
.B \-U ,
.B \-P
and
.BR \-I .
.SH "PCP ENVIRONMENT"
Environment variables with the prefix
.B PCP_
are used to parameterize the file and directory names
used by PCP.
On each installation, the file
.I /etc/pcp.conf
contains the local values for these variables.
The
.B $PCP_CONF
variable may be used to specify an alternative
configuration file,
as described in
.BR pcp.conf (5).
.SH SEE ALSO
.BR cpp (1),
.BR pmLoadASCIINameSpace (3),
.BR pmLoadNameSpace (3),
.BR pmns (5),
.BR pcp.conf (5)
and
.BR pcp.env (5).