Add string literal concatenation using ellipses "..." (bug 4261, PR #5)
commitcd0d31805cAuthor: Peace-Maker <[email protected]> Date: Wed May 28 03:07:25 2014 +0200 Ignore \ ctrlchar in lexing commitcf617a4d20Author: Peace-Maker <[email protected]> Date: Tue May 27 13:32:59 2014 +0200 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:
committed by
David Anderson
parent
6ac013376f
commit
7868767dde
@@ -396,11 +396,12 @@ SC_FUNC int scan_utf8(FILE *fp,const char *filename)
|
||||
#if defined NO_UTF8
|
||||
return 0;
|
||||
#else
|
||||
void *resetpos=pc_getpossrc(fp);
|
||||
static void *resetpos=NULL;
|
||||
int utf8=TRUE;
|
||||
int firstchar=TRUE,bom_found=FALSE;
|
||||
const unsigned char *ptr;
|
||||
|
||||
resetpos=pc_getpossrc(fp,resetpos);
|
||||
while (utf8 && pc_readsrc(fp,pline,sLINEMAX)!=NULL) {
|
||||
ptr=pline;
|
||||
if (firstchar) {
|
||||
|
||||
Reference in New Issue
Block a user