DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Programming with Remote Procedure Calls (RPC)

Using preprocessing directives

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.


NOTE: The % feature is not always useful, owing to a limitation: The rpcgen compiler may not place the lines where the programmer intended.

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


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004