GccStyleErrorMessages

From CSWiki
Revision as of 15:50, 27 April 2006 by Kruhft (talk | contribs)

Jump to: navigation, search

Causes chuck to generate gcc style/format error messages to make the edit/compile/listen cycle much easier using emacs compilation mode.

*** chuck_errmsg.cpp	2006/04/27 20:45:51	1.1
--- chuck_errmsg.cpp	2006/04/27 20:47:15
***************
*** 128,133 ****
--- 128,141 ----
          num--;
      }
  
+ #define GCC_STYLE_ERROR_MESSAGES
+ #ifdef GCC_STYLE_ERROR_MESSAGES
+   fprintf(stderr, "%s:%d: error: ", *fileName ? mini(fileName) : "chuck", num);
+   va_start(ap, message);
+   vfprintf(stderr, message, ap);
+   va_end(ap);
+   fprintf(stderr, "\n");
+ #else
      fprintf( stderr, "[%s]:", *fileName ? mini(fileName) : "chuck" );
      sprintf( g_lasterror, "[%s]:", *fileName ? mini(fileName) : "chuck" );
      if(lines)
***************
*** 144,149 ****
--- 152,158 ----
      va_end(ap);
      fprintf(stderr, "\n");
      strcat( g_lasterror, g_buffer );
+ #endif
  }
  
  
***************
*** 152,157 ****
--- 161,173 ----
  {
      va_list ap;
  
+ #ifdef GCC_STYLE_ERROR_MESSAGES
+   fprintf(stderr, "%s:%d: error: ", *fileName ? mini(fileName) : "chuck", line);
+   va_start(ap, message);
+   vfprintf(stderr, message, ap);
+   va_end(ap);
+   fprintf(stderr, "\n");
+ #else
      fprintf( stderr, "[%s]:", *fileName ? mini(fileName) : "chuck" );
      sprintf( g_lasterror, "[%s]:", *fileName ? mini(fileName) : "chuck" );
      if(line)
***************
*** 170,175 ****
--- 186,192 ----
  
      strcat( g_lasterror, g_buffer );
      fprintf( stderr, "\n" );
+ #endif    
  }
  
  
***************
*** 178,183 ****
--- 195,207 ----
  {
      va_list ap;
  
+ #ifdef GCC_STYLE_ERROR_MESSAGES
+   fprintf(stderr, "%s:%d: error: ", *fileName ? mini(fileName) : "chuck", line);
+   va_start(ap, message);
+   vfprintf(stderr, message, ap);
+   va_end(ap);
+   fprintf(stderr, "\n");
+ #else
      fprintf( stderr, "[%s]:", *fileName ? mini(fileName) : "chuck" );
      sprintf( g_lasterror, "[%s]:", *fileName ? mini(fileName) : "chuck" );
      if(line)
***************
*** 196,201 ****
--- 220,226 ----
  
      strcat( g_lasterror, g_buffer );
      fprintf( stdout, "\n" );
+ #endif
  }