~ubuntu-branches/ubuntu/oneiric/mpqc/oneiric

« back to all changes in this revision

Viewing changes to src/lib/util/psi3/libpsio/error.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2005-11-27 11:41:49 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051127114149-zgz9r3gk50w8ww2q
Tags: 2.3.0-1
* New upstream release.
* debian/rules (SONAME): Activate awk snippet for automatic so-name
  detection again, resulting in a bump to `7' and making a `c2a' for
  the C++ allocator change unnecessary; closes: #339232.
* debian/patches/00list (08_gcc-4.0_fixes): Removed, no longer needed.
* debian/rules (test): Remove workarounds, do not abort build if tests
  fail.
* debian/ref: Removed.
* debian/control.in (libsc): Added Conflict against libsc6c2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*!
 
2
** \file error.cc
 
3
** \ingroup (PSIO)
 
4
*/
 
5
 
 
6
#include <stdio.h>
 
7
#include <stdlib.h>
 
8
#include <util/psi3/libpsio/psio.h>
 
9
#include <util/psi3/libpsio/psifiles.h>
 
10
 
 
11
namespace psi3 {
 
12
namespace libpsio {
 
13
 
 
14
/*!
 
15
** \ingroup (PSIO)
 
16
**
 
17
** PSIO_ERROR(): Print out an error message for libpsio.
 
18
**
 
19
** \param unit   = file number
 
20
** \param errval = error code (defined symbolically, PSIO_ERROR_XXX)
 
21
**
 
22
*/
 
23
void psio_error(unsigned int unit, unsigned int errval)
 
24
{
 
25
  int i;
 
26
 
 
27
  fprintf(stderr, "PSIO_ERROR: unit = %d\n", unit);
 
28
  /* Try to save the TOCs for all open units */
 
29
  /* psio_tocwrite() does not call psio_error() so this is OK */
 
30
  for(i=0; i < PSIO_MAXUNIT; i++) psio_tocwrite(i);
 
31
 
 
32
  switch(errval) {
 
33
  case PSIO_ERROR_INIT:
 
34
      fprintf(stderr, "PSIO_ERROR: %d (I/O inititalization failed)\n",
 
35
              PSIO_ERROR_INIT);
 
36
      break;
 
37
  case PSIO_ERROR_DONE:
 
38
      fprintf(stderr, "PSIO_ERROR: %d (I/O cleanup failed)\n",
 
39
              PSIO_ERROR_DONE);
 
40
      break;
 
41
  case PSIO_ERROR_MAXVOL:
 
42
      fprintf(stderr, "PSIO_ERROR: %d (maximum number of volumes exceeded)\n",
 
43
              PSIO_ERROR_MAXVOL);
 
44
      break;
 
45
  case PSIO_ERROR_NOVOLPATH:
 
46
      fprintf(stderr, "PSIO_ERROR: %d (no volume path given)\n",
 
47
              PSIO_ERROR_NOVOLPATH);
 
48
      break;
 
49
  case PSIO_ERROR_IDENTVOLPATH:
 
50
      fprintf(stderr, "PSIO_ERROR: %d (two identical volume paths)\n",
 
51
              PSIO_ERROR_IDENTVOLPATH);
 
52
      break;
 
53
  case PSIO_ERROR_OPEN:
 
54
      fprintf(stderr, "PSIO_ERROR: %d (file not open or open call failed)\n",
 
55
              PSIO_ERROR_OPEN);
 
56
      break;
 
57
  case PSIO_ERROR_REOPEN:
 
58
      fprintf(stderr, "PSIO_ERROR: %d (file is already open)\n",
 
59
              PSIO_ERROR_REOPEN);
 
60
      break;
 
61
  case PSIO_ERROR_CLOSE:
 
62
      fprintf(stderr, "PSIO_ERROR: %d (file close failed)\n",
 
63
              PSIO_ERROR_CLOSE);
 
64
      break;
 
65
  case PSIO_ERROR_RECLOSE:
 
66
      fprintf(stderr, "PSIO_ERROR: %d (file is already closed)\n",
 
67
              PSIO_ERROR_RECLOSE);
 
68
      break;
 
69
  case PSIO_ERROR_OSTAT:
 
70
      fprintf(stderr, "PSIO_ERROR: %d (invalid status flag for file open)\n",
 
71
              PSIO_ERROR_OSTAT);
 
72
      break;
 
73
  case PSIO_ERROR_LSEEK:
 
74
      fprintf(stderr, "PSIO_ERROR: %d (lseek failed)\n",
 
75
              PSIO_ERROR_LSEEK);
 
76
      break;
 
77
  case PSIO_ERROR_NOTOCENT:
 
78
      fprintf(stderr, "PSIO_ERROR: %d (no such TOC entry)\n",
 
79
              PSIO_ERROR_NOTOCENT);
 
80
      break;
 
81
  case PSIO_ERROR_TOCENTSZ:
 
82
      fprintf(stderr, "PSIO_ERROR: %d (TOC entry size mismatch)\n",
 
83
              PSIO_ERROR_TOCENTSZ);
 
84
      break;
 
85
  case PSIO_ERROR_KEYLEN:
 
86
      fprintf(stderr, "PSIO_ERROR: %d (TOC key too long)\n",
 
87
              PSIO_ERROR_KEYLEN);
 
88
      break;
 
89
  case PSIO_ERROR_BLKSIZ:
 
90
      fprintf(stderr, "PSIO_ERROR: %d (Requested blocksize invalid)\n",
 
91
              PSIO_ERROR_BLKSIZ);
 
92
      break;
 
93
  case PSIO_ERROR_BLKSTART:
 
94
      fprintf(stderr, "PSIO_ERROR: %d (Incorrect block start address)\n",
 
95
              PSIO_ERROR_BLKSTART);
 
96
      break;
 
97
  case PSIO_ERROR_BLKEND:
 
98
      fprintf(stderr, "PSIO_ERROR: %d (Incorrect block end address)\n",
 
99
              PSIO_ERROR_BLKEND);
 
100
      break;
 
101
    }
 
102
  exit(PSI_RETURN_FAILURE);
 
103
}
 
104
 
 
105
}
 
106
}
 
 
b'\\ No newline at end of file'