|
|
The rpcgen compiler supports C and other preprocessing features.
C-preprocessing is performed on rpcgen input files before they are compiled. All C-preprocessing directives are valid within a .x file. Five symbols may be defined by rpcgen, depending on the type of output file being generated. The symbols are:
| Symbol | Usage |
|---|---|
| RPC_HDR | Header file output |
| RPC_XDR | XDR routine output |
| RPC_SVC | Server skeleton output |
| RPC_CLNT | Client stub output |
| RPC_TBL | Index table output |
The rpcgen compiler provides an additional preprocessing feature: any line that begins with a percent sign (%) is passed directly into the output file, without any interpretation of the line.
This is a simple example that illustrates rpcgen preprocessing features:
/*
* time.x: Remote time protocol
*/
program TIMEPROG {
version TIMEVERS {
unsigned int TIMEGET(void) = 1;
} = 1;
} = 0x20000044;
#ifdef RPC_SVC
%int *
%timeget_1()
%{
% static int thetime;
%
% thetime = time(0);
% return (&thetime);
%}
#endif