Advertisement
Guest User

MikelSV / Xcc Preprocessor

a guest
Nov 9th, 2015
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.47 KB | None | 0 0
  1. #define PROJECTNAME "MsvXcc"
  2. #define PROJECTVER PROJECTNAME ## _versions
  3. #define USEMSV_GENERALCPP
  4.  
  5. #define USEMSV_ITOS
  6. #define USEMSV_XDATACONT
  7. #define USEMSV_DATIXCONT
  8. #define USEMSV_MLIST
  9. #define USEMSV_ILIST
  10. #define USEMSV_OLIST
  11. #define USEMSV_ULIST
  12. #define USEMSV_CPPXCC
  13.  
  14. //#define USEMSV_INJECTDLL
  15. //#define USEMSV_INTERCEPT
  16. //#define USEMSV_INTERCEPT_MALLOC
  17.  
  18. #ifdef MSVXCCTEMPLATE
  19.  
  20. #define AA(a) int a;
  21. #define B(b) AA(b)
  22.  
  23. #define A 1, 2, 3
  24. #define B(a, b, ...) printf(a, __VA_ARGS__ );
  25.     B("%d %d %d\r\n", 1, 2, 3);
  26.     B("%d %d %d\r\n", ::A);
  27.  
  28.     #define B fail
  29.     #define BB(a, b, c) a c
  30.     #define AB(B) BB(B)
  31.     AB(A);
  32.  
  33.     #define BC(a, b, c) a c
  34.     #define AC(B) BC(::B)
  35.  
  36.     AC(A);
  37. #else
  38. // MSV CppXcc v.0.0.0.1 (07.11.2015 05:59) Do Not Write To This Block, All Data Well Be Rewrite On Update!
  39. // ##MD5: 9d66c96a17af0ee066ac38a104b70159 : 09.11.15 13:18:42
  40.  
  41.  
  42.  
  43.  
  44.  
  45.   printf ( "%d %d %d\r\n" , 2 , 3 ) ;
  46.   printf (  "%d %d %d\r\n" , 2 , 3 ) ;
  47.  
  48.  
  49.  
  50.     1 , 2 , 3
  51.  
  52.  
  53.    1 3
  54.  
  55.  
  56.  
  57. #endif
  58.  
  59. #include "../../opensource/msvcore/msvcore.cpp"
  60.  
  61. Versions PROJECTVER[]={
  62.     "0.0.0.1", "04.11.2015 21:40",
  63. };
  64.  
  65. int main(int args, char* arg[]){
  66.     ILink link; mainp(args, arg, link);
  67.  
  68.     print(PROJECTNAME, " v.", PROJECTVER[0].ver," (", PROJECTVER[0].date, ").\r\n");
  69.  
  70.     // operations
  71.     VString comm = link.file, t, l = PartLine(link.GetArg(), t);   
  72.     int ishelp = 0, isreplace = 0, isprint = 0;
  73.  
  74.     VString files[S1K];
  75.     int filesz = 0;
  76.  
  77.     while(l){
  78.         if(l == "--help" || l == "-h" || l == "/?"){ ishelp = 1; }
  79.         else if(l == "--replace" || l == "-r"){ isreplace = 1; }
  80.         else if(l == "--print" || l == "-p"){ isprint = 1; }
  81.         else{
  82.             if(l[0] == '-'){
  83.                 print("Error: unknown options: '",  l, "'\r\n");
  84.                 ishelp = 1;
  85.                 break;
  86.             }
  87.  
  88.             if(filesz >= S1K){
  89.                 print("Error: max files 1024!\r\n");
  90.                 ishelp = 1;
  91.                 break;
  92.             }
  93.             files[filesz++] = l;
  94.         }
  95.  
  96.         l = PartLine(link.GetArg(), t);
  97.     }
  98.  
  99.     if(!filesz || ishelp){
  100.         print("Usage: msvxcc [options] file1 [file2] [file3...]" "\r\n"
  101.             "--help, -h       print this help" "\r\n"
  102.             "--replace, -r    replace MSVXCCTEMPLATE and save to file.new" "\r\n"
  103.             "--print, -p      print logs" "\r\n"
  104.             );
  105.         return 0;
  106.     }
  107.  
  108.     CppXcc xcc;
  109.     xcc.SetPrint(isprint ? MSVXCC_PRINT_ALL : 0);
  110.     xcc.SetEnableReplace(isreplace);
  111.  
  112.     for(int i = 0; i < filesz; i++){
  113.         xcc.AnalysFile(files[i], 0);
  114.     }
  115.  
  116.     xcc.CheckFiles();
  117.  
  118.     VString err = xcc.GetError();
  119.     if(err)
  120.         print("Xcc errors: \r\n", err, "\r\n");
  121.  
  122.     return 0;
  123. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement