Task #12780

Check that squint preprocessor output matches A2 preprocessor output

Added by sbsmac over 4 years ago. Updated over 4 years ago.

Status:Closed Start date:08/08/2010
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:-
Affected Version:

Description

In particular, check where # and ## get processed and how A2 deals with constructions such as

#define X(A) #A
#define Z(A,B) X(A)##X(B)##X(a param with spaces)

History

Updated by sbsmac over 4 years ago

Some random findings...

#define HASHSPACE #abc def
#define HASHPASTE(A,B) #A##B
#define MIDHASH abcd#efgh
#define HASH  #INNERVAR
#define HASHIFY(VAR)  #VAR
#define PASTIFY(V1,V2) V1##V2
#define INNERQUOTE(INNERVAR) #OUTERVAR #INNERVAR  
#define OUTERQUOTE(OUTERVAR) INNERQUOTE(OUTERVAR)  
#define INNERPASTE(INNERVAR,V1,V2)  OUTERVAR INNERVAR V1##V2
#define OUTERPASTE(OUTERVAR)  OUTERVAR INNERPASTE(OUTERVAR,OUT,ERVAR)
#define INNER(INNERVAR)  OUTERVAR INNERVAR
#define OUTER(OUTERVAR) INNER(OUTERVAR)
#define OUTERHASH(OUTERVAR) INNER(#OUTERVAR)
#define OUTERHASH2(OUTERVAR) INNER(HASHIFY(OUTERVAR))
#define QUOTE(A) 'A'

#define DOUBLE(PA) PA##PA
#define QUOTEDOUBLE(PB) #DOUBLE(PB)

r={
     diag_log [format ["%1=%2",(_this select 0),_this select 1],_this select 1];
      player sidechat format ["%1=%2",_this select 0,_this select 1] ; 
};

[] spawn
{
     sleep 1 ;
     diag_log "=====================START==========================";
     ["quote",QUOTE(some text) ] call r;
     ["outer",QUOTE(OUTER(out)) ] call r;
     ["outerq",QUOTE(OUTERQUOTE(out)) ] call r;
     ["hash",QUOTE(HASH) ] call r;
     ["innerhash",QUOTE(INNER(HASH)) ] call r;
     ["outerhash",QUOTE(OUTER(HASH)) ] call r;
     ["midhash",QUOTE(MIDHASH) ] call r;
     ["hashpaste",QUOTE(HASHPASTE(abc,def)) ] call r;
     ["hashspace",QUOTE(HASHSPACE) ] call r;
     ["outerhash",QUOTE(OUTERHASH(out)) ] call r;
     ["outerhash2",QUOTE(OUTERHASH2(out)) ] call r;
     ["hash,paste",QUOTE(HASHIFY(PASTIFY(abc,def))) ] call r;
     ["hash,paste w/space",QUOTE(HASHIFY(PASTIFY(abc,def ghj))) ] call r;
     ["outerpaste",QUOTE(OUTERPASTE(out))] call r;
     ["quotedouble",QUOTE(QUOTEDOUBLE(abc def))] call r;
};

"=====================START==========================" 
["quote=some text","some text"]
["outer=out out","out out"]
["outerq="out" "out"    ",""out" "out"    "]
["hash="INNERVAR"",""INNERVAR""]
["innerhash=OUTERVAR "INNERVAR"","OUTERVAR "INNERVAR""]
["outerhash="INNERVAR" "INNERVAR"",""INNERVAR" "INNERVAR""]
["midhash=abcd"efgh"","abcd"efgh""]
["hashpaste="abc"def",""abc"def"]
["hashspace="abc" def",""abc" def"]
["outerhash=out #out","out #out"]
["outerhash2=out "out"","out "out""]
["hash,paste="abcdef"",""abcdef""]
["hash,paste w/space="abcdef ghj"",""abcdef ghj""]
["outerpaste=out out out OUTERVAR","out out out OUTERVAR"]
["quotedouble="abc defabc def"",""abc defabc def""]

Updated by sbsmac over 4 years ago

  • Status changed from New to Closed

pretty confident this is now working

Also available in: Atom PDF