[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 19990323: pqing.c:518: `scan_afos' undeclared
- Subject: Re: 19990323: pqing.c:518: `scan_afos' undeclared
- Date: Tue, 23 Mar 1999 14:35:08 -0700 (MST)
Gilbert,
Try this afos_message.{c,h} file that are attached.
Robb...
On Tue, 23 Mar 1999, Unidata Support wrote:
>
> ------- Forwarded Message
>
> >To: General Support <address@hidden>
> >From: Gilbert Sebenste <address@hidden>
> >Subject: Re: 19990313: LDM modification for TTAA00 K... (fwd)
> >Organization: .
> >Keywords: 199903231627.JAA10105
>
> Hi Robb,
>
> David Magee and I are working on this together...he has a NOAA Wx Wire
> feed and I am about to get the AFOS feed directly from NWS Chicago.
> He tried compiling it with your 5.0.0 software, but he comes up with a
> fatal error.
>
> ---------- Forwarded message ----------
> Date: Tue, 23 Mar 1999 10:20:56 -0600 (CST)
> From: David Magee <address@hidden>
> To: Gilbert Sebenste <address@hidden>
> Subject: Re: 19990313: LDM modification for TTAA00 K... (fwd)
>
> On Mon, 22 Mar 1999, Gilbert Sebenste wrote:
>
> > Hi David,
> >
> > I hope this helps!!!
>
>
> I tried, but pqing still didn't like it during compilation. :(
>
> Maybe Robb could tell something from this. It appears scan_afos never got
> declared. It's been a long time since I've done any c.
>
> David
>
>
> Making `all' in /staff1/ldm/ldm-5.0.6/src/pqing
> cc -g -I../config -I/staff1/ldm/ldm-5.0.6/include -DHAVE_FTRUNCATE=1
> -DHAVE_CONFIG_H -c pqing.c
> pqing.c: In function `main':
> pqing.c:518: `scan_afos' undeclared (first use in this function)
> pqing.c:518: (Each undeclared identifier is reported only once
> pqing.c:518: for each function it appears in.)
> *** Error code 1
> make: Fatal error: Command failed for target `pqing.o'
> Current working directory /staff1/ldm/ldm-5.0.6/src/pqing
> *** Error code 1
> make: Fatal error: Command failed for target `_sub'
> Current working directory /staff1/ldm/ldm-5.0.6/src
> *** Error code 1
> make: Fatal error: Command failed for target `progs'
>
> >
> > I attached the afos files from the ldm 5.0.0 release. I don't know if
> > they will compile or work for you.
> >
> > Robb...
> >
> > > > ===============================================================================
> > > > Robb Kambic Unidata Program Center
> > > > Software Engineer III Univ. Corp for Atmospheric
> > > > Research
> > > > address@hidden WWW: http://www.unidata.ucar.edu/
> > > > ===============================================================================
> > >
> > > Robb, Et al,
> > >
> > > Do you know where we could get a hold of the LDM 5.0.0 source code?
> > >
> > > Gilbert
> > >
> > > *******************************************************************************
> > > Gilbert Sebenste
> > > ********
> > > Internet: address@hidden (My opinions only!) ******
> > > Staff Meteorologist, Northern Illinois University
> > > ****
> > > Work phone: 815-753-5492
> > > ***
> > > *******************************************************************************
> > >
> > >
> >
> > ===============================================================================
> > Robb Kambic Unidata Program Center
> > Software Engineer III Univ. Corp for Atmospheric
> > Research
> > address@hidden WWW: http://www.unidata.ucar.edu/
> > ===============================================================================
> >
>
>
>
> --
>
> David K. Magee
> address@hidden
>
>
>
>
> ------- End of Forwarded Message
>
===============================================================================
Robb Kambic Unidata Program Center
Software Engineer III Univ. Corp for Atmospheric Research
address@hidden WWW: http://www.unidata.ucar.edu/
===============================================================================
/*
* Copyright 1995, University Corporation for Atmospheric Research
* See ../COPYRIGHT file for copying and redistribution conditions.
*/
/* $Id: afos_message.c,v 1.33 1995/11/11 00:47:27 davis Exp $ */
/*
* Routines to handle AFOS messages.
* Thanks to NWS personell, who shared their ldm3 mods and
* other info.
* N.B. This module prepare without any supporting definitions
* or AFOS documentation.
*/
#include <ldmconfig.h>
#include <string.h>
#include <ctype.h>
#include "xbuf.h"
#include "tokens.h"
#include "afos_message.h"
#include "ulog.h"
static int seqno = 0;
static int zczc_missed = 0;
static int nnnn_missed = 0;
static int unrecognizable = 0;
void
afos_stats(void)
{
unotice(" AFOS Messages seen: %8d", seqno - unrecognizable);
unotice(" Errors: lone ZCZC: %8d", nnnn_missed);
unotice(" lone NNNN: %8d", zczc_missed);
unotice(" Unrecognizable: %8d", unrecognizable);
}
/*
* Set time stamp and hook up body of message
*/
static afos_message *
init_afos_message(
xbuf *buf, /* should be a clone ! */
afos_message *mess
)
{
mess->len = buf->cnt;
mess->msg = buf->get;
if( set_timestamp(&mess->arrival) != 0)
return NULL;
return mess;
}
/*
* skip up to the first Upper case char and get the rest of the line
*/
static int
nextUcaseLine(xbuf *buf, char *str, int maxlen)
{
int ch;
do{
ch = nextc(buf);
if(ch == EOB)
break;
}while(!isascii(ch) || !isupper(ch));
unnextc(buf,ch);
return( get_line(buf, str, maxlen) );
}
#define MIN_AFOS_MSG_LEN 14 /* wild ass guess */
static int
get_afos_message(xbuf *buf, afos_message *mess)
{
int zczc_missing = 0;
init_afos_message(buf, mess);
/* DEBUG */
if(mess->len < MIN_AFOS_MSG_LEN)
{
uerror("new_afos_message: length %d too short", mess->len);
goto err;
}
if(!hasSTR(buf, "ZCZC"))
{
/* not fatal, complain later */
zczc_missing = 1;
}
if(nextUcaseLine(buf, mess->ident, 12) == EOB) goto err;
{
/*
* Skip white space and (maybe) the next two bytes.
* What do they mean?
*/
int one;
int two;
do{
one = nextc(buf);
}while((isascii(one) && !isgraph(one)));
if(isascii(one))
unnextc(buf, one);
else
two = nextc(buf);
}
if(get_wmo_header(buf, mess->wmo_hdr) == NULL)
{
mess->wmo_hdr->TT[0] = 0;
mess->wmo_hdr->AA[0] = 0;
mess->wmo_hdr->ii = 0;
mess->wmo_hdr->CCCC[0] = 0;
mess->wmo_hdr->retransmit = ORIGINAL;
mess->wmo_hdr->retrans_seq = MESSAGE_TYPE_UNKNOWN;
}
else if(isascii(mess->wmo_hdr->TT[0]) &&
isupper(mess->wmo_hdr->TT[0]) && isupper(mess->wmo_hdr->TT[1]))
{
size_t len = strlen(mess->ident);
sprintf(&mess->ident[len],
" (%s)", s_wmo_header(mess->wmo_hdr));
}
if(zczc_missing)
{
uerror(" Missing ZCZC: %6s %03d %8d %s",
"AFOS",
seqno,
mess->len,
mess->ident);
}
if(memcmp(&mess->msg[mess->len -4], "NNNN", 4) != 0)
{
uerror(" Missing NNNN: %6s %03d %8d %s",
"AFOS",
seqno,
mess->len,
mess->ident);
/* Fatal, They will send it again */
return -1;
}
return 0;
err:
unrecognizable++;
uerror("Unrecognizable: %5s %03d %8d",
"AFOS",
seqno,
buf->cnt);
return -1;
}
extern void toClients(timestampt arrival,
unsigned seqno,
const char *ident,
unsigned len,
const char *buf);
static void
afos_send_buf(xbuf *buf, int backoff)
{
xbuf clone[1];
afos_message mess[1];
wmo_header_t wmo_hdr[1];
dtime time[1];
seqno++;
mess->wmo_hdr = wmo_hdr;
mess->wmo_hdr->time = time;
clone_xbuf(buf,clone, backoff);
if(get_afos_message(clone, mess) != 0)
return;
/* else, we got something */
toClients(mess->arrival,
seqno,
mess->ident,
mess->len, (char *)mess->msg);
}
int
scan_afos(xbuf *buf)
{
int sent = 0;
int ch;
static enum afos_l_state {
GND,
Z_,
Z_C_,
Z_C_Z_,
N_,
N_N_,
N_N_N_
} lstate = GND;
static enum afos_state {
START,
HEADER_SEEN,
TRAILER_SEEN
} state = START;
while ((ch = nextc(buf)) != EOB)
{
switch (ch) {
case 'Z':
if(lstate == Z_C_)
lstate = Z_C_Z_;
else
lstate = Z_;
break;
case 'C':
if(lstate == Z_)
lstate = Z_C_;
else if(lstate == Z_C_Z_ )
{
/* Z_C_Z_C */
if(state == HEADER_SEEN)
{
/* missing trailer */
nnnn_missed++;
udebug("Missing NNNN trailer");
afos_send_buf(buf, 4);
sent = 1;
}
justify_xbuf(buf, 4);
state = HEADER_SEEN;
lstate = GND;
}
break;
case 'N':
switch (lstate) {
case N_N_N_ :
/* N_N_N_N */
if(state == TRAILER_SEEN)
{
/* missing header */
zczc_missed++;
udebug("Missing ZCZC header");
}
afos_send_buf(buf, 0);
sent = 1;
justify_xbuf(buf, 0);
state = TRAILER_SEEN;
lstate = GND;
break;
case N_N_ :
lstate = N_N_N_;
break;
case N_ :
lstate = N_N_;
break;
default :
lstate = N_;
break;
} /* lstate switch */
break;
default :
lstate = GND;
break;
} /* ch switch */
} /* input character loop */
return sent;
}
/*
* Copyright 1995, University Corporation for Atmospheric Research
* See ../COPYRIGHT file for copying and redistribution conditions.
*/
/* $Id: afos_message.h,v 1.25 1995/09/18 18:54:00 davis Exp $ */
#ifndef _AFOS_MESSAGE_H_
#define _AFOS_MESSAGE_H_
#include "timestamp.h"
#include "xbuf.h"
#include "wmo_header.h"
/* size of the buffer for 9 character AFOS header */
#define MAX_AFOS_HLEN 16 /* actually, its 9 + 1 */
#define MAX_WMO_HLEN 24 /* actually, its 22 +1 */
/*
* AFOS Message
*/
typedef struct {
timestampt arrival; /* arrival time */
char ident[MAX_AFOS_HLEN +MAX_WMO_HLEN + 4]; /* AFOS header and more */
wmo_header_t *wmo_hdr; /* optional */
unsigned char *msg; /* the whole message */
int len;
} afos_message;
extern void afos_stats(void);
extern int scan_afos(xbuf *buf);
#endif /* _AFOS_MESSAGE_H_ */