Add string literal concatenation using ellipses "..." (bug 4261)
Backported the changes CompuPhase did to the compiler to support string literal concatenation including all fixes in later commits from r30 on. http://code.google.com/p/pawnscript/source/detail?r=30 Pawn uses ellipses "..." to concatenate so it looks like this: #define PROJECT_AUTHOR "Greyscale" #define PROJECT_COPYRIGHT "Copyright (C) 2010 " ... PROJECT_AUTHOR This would result in PROJECT_COPYRIGHT being defined as "Copyright (C) 2010 Greyscale" While i've been at it, that stringizing a macro parameter feature was ported too. From the changelog for version 3.3.4026 (http://www.compuphase.com/pawn/pawnhistory.htm): The macro substition processor now recognizes the "#" character for "stringizing" a parameter. For example, if you have the definition #define log(%1) #%1 Then the expression log(test) will result in "test". Note that concatenation of literal strings requires an ellipsis in pawn (which is different than C/C++). So to combine the parameter with literal strings, use a syntax like: #define log(%1) "logging: " ... #%1 ... "\n" The stringize operator is only available in the replacement text of a macro. Doing PrintToServer(log(hello)); would print logging: hello\n
This commit is contained in:
@@ -484,10 +484,10 @@ int pc_error(int number,char *message,char *filename,int firstline,int lastline,
|
||||
void *pc_opensrc(char *filename); /* reading only */
|
||||
void *pc_createsrc(char *filename);
|
||||
void pc_closesrc(void *handle); /* never delete */
|
||||
void pc_resetsrc(void *handle,void *position); /* reset to a position marked earlier */
|
||||
char *pc_readsrc(void *handle,unsigned char *target,int maxchars);
|
||||
int pc_writesrc(void *handle,unsigned char *source);
|
||||
void *pc_getpossrc(void *handle); /* mark the current position */
|
||||
void *pc_getpossrc(void *handle,void *position); /* mark the current position */
|
||||
void pc_resetsrc(void *handle,void *position); /* reset to a position marked earlier */
|
||||
int pc_eofsrc(void *handle);
|
||||
|
||||
/* output to intermediate (.ASM) file */
|
||||
|
||||
Reference in New Issue
Block a user