1diff -r -c -N ../mcpp-2.7.2-old/noconfig/vc2010.dif ./noconfig/vc2010.dif 2*** ../mcpp-2.7.2-old/noconfig/vc2010.dif Wed Dec 31 20:30:00 1969 3--- ./noconfig/vc2010.dif Fri May 14 12:47:22 2010 4*************** 5*** 0 **** 6--- 1,67 ---- 7+ *** noconfig.H Thu Sep 25 15:34:56 2008 8+ --- noconfig.H.vc2005 Thu Sep 25 17:23:49 2008 9+ *************** 10+ *** 15,21 **** 11+ */ 12+ 13+ /* Define target operating-system. */ 14+ ! #define SYSTEM SYS_FREEBSD 15+ 16+ /* Define target compiler. */ 17+ #ifndef COMPILER 18+ --- 15,21 ---- 19+ */ 20+ 21+ /* Define target operating-system. */ 22+ ! #define SYSTEM SYS_WIN32 23+ 24+ /* Define target compiler. */ 25+ #ifndef COMPILER 26+ *************** 27+ *** 26,36 **** 28+ #define HOST_SYSTEM SYSTEM 29+ 30+ /* Define host compiler. */ 31+ ! #define HOST_COMPILER GNUC 32+ 33+ /* Version message. */ 34+ /* "MCPP V.2.* (200y/mm) compiled by " precedes VERSION_MSG */ 35+ ! #define VERSION_MSG "GCC 3.4" 36+ #if 0 37+ "LCC-Win32 2006-03" 38+ "Visual C 2005" 39+ --- 26,36 ---- 40+ #define HOST_SYSTEM SYSTEM 41+ 42+ /* Define host compiler. */ 43+ ! #define HOST_COMPILER MSC 44+ 45+ /* Version message. */ 46+ /* "MCPP V.2.* (200y/mm) compiled by " precedes VERSION_MSG */ 47+ ! #define VERSION_MSG "Visual C 2010" 48+ #if 0 49+ "LCC-Win32 2006-03" 50+ "Visual C 2005" 51+ *************** 52+ *** 212,221 **** 53+ #define ONE_PASS TRUE 54+ #endif 55+ #define COMPILER_EXT "_MSC_VER" 56+ ! #define COMPILER_EXT_VAL "1500" /* VC 6.0: "1200" */ 57+ /* VC 2002: "1300", VC 2003: "1310", VC 2005: "1400", VC 2008: "1500" */ 58+ #define COMPILER_EXT2 "_MSC_FULL_VER" 59+ ! #define COMPILER_EXT2_VAL "150021022" /* VC 6.0: "12008804" */ 60+ /* VC 2002: "13009466", VC 2003: "13103077", VC 2005: "140050320" */ 61+ /* VC 2008: "150021022" */ 62+ #define COMPILER_SP1 "_MSC_EXTENSIONS" 63+ --- 212,221 ---- 64+ #define ONE_PASS TRUE 65+ #endif 66+ #define COMPILER_EXT "_MSC_VER" 67+ ! #define COMPILER_EXT_VAL "1600" /* VC 6.0: "1200" */ 68+ /* VC 2002: "1300", VC 2003: "1310", VC 2005: "1400", VC 2008: "1500" */ 69+ #define COMPILER_EXT2 "_MSC_FULL_VER" 70+ ! #define COMPILER_EXT2_VAL "160030319" /* VC 6.0: "12008804" */ 71+ /* VC 2002: "13009466", VC 2003: "13103077", VC 2005: "140050320" */ 72+ /* VC 2008: "150021022" */ 73+ #define COMPILER_SP1 "_MSC_EXTENSIONS" 74diff -r -c -N ../mcpp-2.7.2-old/src/internal.H ./src/internal.H 75*** ../mcpp-2.7.2-old/src/internal.H Wed Aug 27 10:31:16 2008 76--- ./src/internal.H Fri May 14 12:40:56 2010 77*************** 78*** 390,395 **** 79--- 390,397 ---- 80 extern char identifier[]; /* Lastly scanned name */ 81 extern IFINFO ifstack[]; /* Information of #if nesting */ 82 extern char work_buf[]; 83+ extern FILEINFO * sh_file; 84+ extern int sh_line; 85 /* Temporary buffer for directive line and macro expansion */ 86 87 /* main.c */ 88*************** 89*** 557,562 **** 90 #endif 91 #endif 92 93! #if HOST_HAVE_STPCPY 94 extern char * stpcpy( char * dest, const char * src); 95 #endif 96--- 559,564 ---- 97 #endif 98 #endif 99 100! #if HOST_HAVE_STPCPY && !defined(stpcpy) 101 extern char * stpcpy( char * dest, const char * src); 102 #endif 103diff -r -c -N ../mcpp-2.7.2-old/src/main.c ./src/main.c 104*** ../mcpp-2.7.2-old/src/main.c Wed Nov 5 05:04:46 2008 105--- ./src/main.c Fri May 14 12:40:56 2010 106*************** 107*** 326,331 **** 108--- 326,333 ---- 109 = FALSE; 110 option_flags.trig = TRIGRAPHS_INIT; 111 option_flags.dig = DIGRAPHS_INIT; 112+ sh_file = NULL; 113+ sh_line = 0; 114 } 115 116 int mcpp_lib_main 117diff -r -c -N ../mcpp-2.7.2-old/src/support.c ./src/support.c 118*** ../mcpp-2.7.2-old/src/support.c Tue Jun 10 06:02:33 2008 119--- ./src/support.c Fri May 14 12:40:56 2010 120*************** 121*** 188,194 **** 122 size_t length 123 ) 124 { 125! if (mem_buf_p->bytes_avail < length) { /* Need to allocate more memory */ 126 size_t size = MAX( BUF_INCR_SIZE, length); 127 128 if (mem_buf_p->buffer == NULL) { /* 1st append */ 129--- 188,194 ---- 130 size_t length 131 ) 132 { 133! if (mem_buf_p->bytes_avail < length + 1) { /* Need to allocate more memory */ 134 size_t size = MAX( BUF_INCR_SIZE, length); 135 136 if (mem_buf_p->buffer == NULL) { /* 1st append */ 137*************** 138*** 1722,1727 **** 139--- 1722,1729 ---- 140 sp -= 2; 141 while (*sp != '\n') /* Until end of line */ 142 mcpp_fputc( *sp++, OUT); 143+ mcpp_fputc( '\n', OUT); 144+ wrong_line = TRUE; 145 } 146 goto end_line; 147 default: /* Not a comment */ 148diff -r -c -N ../mcpp-2.7.2-old/src/system.c ./src/system.c 149*** ../mcpp-2.7.2-old/src/system.c 2008-11-26 10:53:51.000000000 +0100 150--- ./src/system.c 2011-02-21 16:18:05.678058106 +0100 151*************** 152*** 3534,3539 **** 153--- 3534,3565 ---- 154 FILEINFO * file; 155 const char * too_many_include_nest = 156 "More than %.0s%ld nesting of #include"; /* _F_ _W4_ */ 157+ 158+ // 159+ // When encoding is UTF-8, skip BOM if present. 160+ // 161+ if(mbchar == UTF8 && fp != NULL && ftell(fp) == 0) 162+ { 163+ const unsigned char UTF8_BOM[3] = {0xEF, 0xBB, 0xBF}; 164+ unsigned char FILE_HEAD[3] = {0, 0, 0}; 165+ int i; 166+ for(i = 0; i < 3; ++i) 167+ { 168+ FILE_HEAD[i] = getc(fp); 169+ if(FILE_HEAD[i] != UTF8_BOM[i]) 170+ { 171+ if(FILE_HEAD[i] == (unsigned char)EOF) 172+ { 173+ i--; 174+ } 175+ for(; i >= 0; --i) 176+ { 177+ ungetc(FILE_HEAD[i], fp); 178+ } 179+ break; 180+ } 181+ } 182+ } 183 184 filename = set_fname( filename); /* Search or append to fnamelist[] */ 185 fullname = set_fname( fullname); /* Search or append to fnamelist[] */ 186*************** 187*** 3858,3863 **** 188--- 3884,3892 ---- 189 } 190 #endif 191 192+ FILEINFO* sh_file; 193+ int sh_line; 194+ 195 void sharp( 196 FILEINFO * sharp_file, 197 int flag /* Flag to append to the line for GCC */ 198*************** 199*** 3868,3875 **** 200 * else (i.e. 'sharp_file' is NULL) 'infile'. 201 */ 202 { 203- static FILEINFO * sh_file; 204- static int sh_line; 205 FILEINFO * file; 206 int line; 207 208--- 3897,3902 ---- 209