6.3. 关键字例子

下面的例子显示了模版文件中的关键字是如何在输出文件中被替换的。

// Test file for SubWCRev

char *Revision = "$WCREV$";
char *Modified = "$WCMODS?Modified:Not modified$";
char *Date     = "$WCDATE$";
char *RevRange = "$WCRANGE$";
char *Mixed    = "$WCMIXED?Mixed revision WC:Not mixed$";
char *URL      = "$WCURL$";

#if $WCMODS?1:0$
#error Source is modified
#endif

// EndOfFile

SubWCRev.exe运行完之后,输出文件类似:

// Test file for SubWCRev

char *Revision = "3701";
char *Modified = "Modified";
char *Date     = "2005/06/15 11:15:12";
char *RevRange = "3699:3701";
char *Mixed    = "Mixed revision WC";
char *URL      = "http://tortoisesvn.tigris.org/svn/tortoisesvn/trunk/src/SubWCRev";

#if 1
#error Source is modified
#endif

// EndOfFile