Mapper
sherr.c
Go to the documentation of this file.
1 /*Translated by FOR_C, v3.4.2 (-), on 06/07/94 at 17:01:47 */
2 /*FOR_C Options SET: c=2 com=u do=r4 ftn=2ln6k op=iv s=dvn str=l sq=i */
3 
4 #define _POSIX_SOURCE
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <ctype.h>
8 #include <dirent.h>
9 #include <unistd.h>
10 #include <math.h>
11 #include <string.h>
12 #include <fcntl.h>
13 #include <sys/stat.h>
14 #include "shef_structs_external.h"
15 
16 /*---------------------------------------------------------------------
17 
18  NAME
19  SUBROUTINE SHERR(IER)
20 
21  PURPOSE
22  Decode .E Format
23  IREV = 1 FOR REVISED, = 0 FOR NEW DATA
24 
25  VERSION and UPDATES
26  1.0 APR 82 Geoffrey M. Bonnin
27  Original Version
28  1.1 AUG 84
29  Conut non fatal errors
30  2.0 MAY 94 David G. Brandon
31  Add the ability to print out specific error messages
32  to the error file.
33  Also Translated to 'C' using FOR_C
34  2.1 Add iscore to t_codes array.
35  2.2 Add PARTIAL_ERROR option which only prints our line
36  where error occurs.
37  2.3x SEP 10 97 DGB
38  Add the use of MAX_SHEF_INPUT so that the input line can
39  be longer than 80 characters.
40 
41  *--------------------------------------------------------------------- */
42 
43 
44 void sherr(ier)
45 short int *ier;
46 {
47  static short int _fst, i, i_, line[MAX_SHEF_INPUT]; /* dgb:09/10/97 */
48 
49  /* OFFSET Vectors w/subscript range: 1 to dimension */
50  short *const Ibuf = &buffer_.ibuf[0] - 1;
51  short *const Line = &line[0] - 1;
52 
53  if( (buffer_.ip <= 0) || (buffer_.ip >= MAX_SHEF_INPUT + 1) ) /* dgb:09/10/97 */
54  goto L_30;
55  for( i = 1, _fst=1; (i <= buffer_.ip) || _fst; i++, _fst=0 )
56  {
57  i_ = i - 1;
58  Line[i] = codes_.iblnk;
59  }
60 
61  if ( PARTIAL_ERROR ) /* DGB:05/30/96 */
62  fprintf( fp_.icher,"%s\n",tempfiles_.last_line_read); /* dgb:05/30/96 */
63 
64 
65  Line[buffer_.ip] = codes_.iarrow;
66  for( i = 1, _fst=1; (i <= buffer_.ip) || _fst; i++, _fst=0 )
67  {
68  fprintf( fp_.icher, "%c", Line[i]);
69  }
70  fprintf( fp_.icher,"\n");
71 
72 L_30:
73  if( (*ier != 23) && (*ier != 32) && (*ier != 38) )
74  {
75  error_.nerror = error_.nerror + 1;
76  fprintf( fp_.icher," SHEF ERROR NUMBER %d \n",
77  *ier);
78  }
79  else
80  {
81  error_.nwarn = error_.nwarn + 1;
82  fprintf( fp_.icher," SHEF WARNING NUMBER %d \n",
83  *ier);
84  }
85 
86  sherrp( ier );
87 
88  return;
89 }
90 
static int i
fprintf(fp,"%d %d %d %d 1\n", iminx, iminy, maxi, maxj)
#define MAX_SHEF_INPUT
Definition: shef.h:38
struct t_error_ error_
int PARTIAL_ERROR
Definition: shef_structs.h:248
struct t_pointers_ fp_
struct t_codes_ codes_
struct t_buffer_ buffer_
struct t_tempfiles_ tempfiles_
void sherr(short int *ier)
Definition: sherr.c:44
void sherrp(short int *ier)
Definition: sherrp.c:38
short int ip
Definition: shef_structs.h:109
short int ibuf[MAX_SHEF_INPUT]
Definition: shef_structs.h:109
short int iblnk
Definition: shef_structs.h:81
short int iarrow
Definition: shef_structs.h:82
short int nerror
Definition: shef_structs.h:103
short int nwarn
Definition: shef_structs.h:103
FILE * icher
Definition: shef_structs.h:72
char last_line_read[MAX_SHEF_INPUT+1]
Definition: shef_structs.h:222