~laney/ubuntu/quantal/swig2.0/guile-2.0

« back to all changes in this revision

Viewing changes to Source/Swig/error.c

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Landschoff
  • Date: 2010-12-19 18:25:59 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101219182559-8lh77o66bo890jwo
Tags: 2.0.1-1
* Merge new upstream release 2.0.1.
* Remove dependency on quilt and usage in debian/rules, the new source
  format will take care of that.
* Remove patch fix-cleaning.diff (applied upstream).
* Remove patch keep_docs.diff (applied upstream).

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 * error messages.
13
13
 * ----------------------------------------------------------------------------- */
14
14
 
15
 
char cvsroot_error_c[] = "$Id: error.c 11876 2010-02-27 23:53:33Z wsfulton $";
 
15
char cvsroot_error_c[] = "$Id: error.c 12221 2010-09-15 20:17:11Z wsfulton $";
16
16
 
17
17
#include "swig.h"
18
18
#include <stdarg.h>
285
285
}
286
286
 
287
287
/* -----------------------------------------------------------------------------
 
288
 * Swig_stringify_with_location()
 
289
 *
 
290
 * Return a string representation of any DOH object with line and file location
 
291
 * information in the appropriate error message format. The string representation
 
292
 * is enclosed within [] brackets after the line and file information.
 
293
 * ----------------------------------------------------------------------------- */
 
294
 
 
295
String *Swig_stringify_with_location(DOH *object) {
 
296
  String *str = NewStringEmpty();
 
297
 
 
298
  if (!init_fmt)
 
299
    Swig_error_msg_format(DEFAULT_ERROR_MSG_FORMAT);
 
300
 
 
301
  if (object) {
 
302
    int line = Getline(object);
 
303
    String *formatted_filename = format_filename(Getfile(object));
 
304
    if (line > 0) {
 
305
      Printf(str, diag_line_fmt, formatted_filename, line);
 
306
    } else {
 
307
      Printf(str, diag_eof_fmt, formatted_filename);
 
308
    }
 
309
    if (Len(object) == 0) {
 
310
      Printf(str, "[EMPTY]");
 
311
    } else {
 
312
      Printf(str, "[%s]", object);
 
313
    }
 
314
    Delete(formatted_filename);
 
315
  } else {
 
316
    Printf(str, "[NULL]");
 
317
  }
 
318
 
 
319
  return str;
 
320
}
 
321
 
 
322
/* -----------------------------------------------------------------------------
288
323
 * Swig_diagnostic()
289
324
 *
290
325
 * Issue a diagnostic message on stdout.