2011-04-18 02:56:10 +08:00
|
|
|
/*********************************************************************
|
2018-12-07 05:21:03 +08:00
|
|
|
* Copyright 2018, UCAR/Unidata
|
2011-04-18 02:56:10 +08:00
|
|
|
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
|
|
|
*********************************************************************/
|
|
|
|
#include "config.h"
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2017-03-09 08:01:10 +08:00
|
|
|
#include "dapincludes.h"
|
2011-04-18 02:56:10 +08:00
|
|
|
#include "nclog.h"
|
|
|
|
|
|
|
|
#ifdef CATCHERROR
|
|
|
|
/* Place breakpoint here to catch errors close to where they occur*/
|
|
|
|
int
|
2017-06-29 03:51:01 +08:00
|
|
|
dapbreakpoint(int err)
|
|
|
|
{
|
|
|
|
return err;
|
|
|
|
}
|
2011-04-18 02:56:10 +08:00
|
|
|
|
|
|
|
int
|
2017-07-14 00:40:07 +08:00
|
|
|
dapthrow(int err, int lineno, const char* filename)
|
2011-04-18 02:56:10 +08:00
|
|
|
{
|
|
|
|
if(err == 0) return err;
|
2017-07-14 00:40:07 +08:00
|
|
|
fprintf(stderr,"$dapthrow: err=%d line=%d file=%s\n",err,lineno,filename); fflush(stderr);
|
2011-04-18 02:56:10 +08:00
|
|
|
return dapbreakpoint(err);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int
|
|
|
|
dappanic(const char* fmt, ...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
if(fmt != NULL) {
|
|
|
|
va_start(args, fmt);
|
|
|
|
vfprintf(stderr, fmt, args);
|
|
|
|
fprintf(stderr, "\n" );
|
|
|
|
va_end( args );
|
|
|
|
} else {
|
|
|
|
fprintf(stderr, "panic" );
|
|
|
|
}
|
|
|
|
fprintf(stderr, "\n" );
|
|
|
|
fflush(stderr);
|
|
|
|
return 0;
|
|
|
|
}
|
2013-02-26 12:31:06 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
Provide a way to print the oc full name for
|
|
|
|
an ocnode
|
|
|
|
*/
|
|
|
|
|
|
|
|
char*
|
|
|
|
ocfqn(OCddsnode node)
|
|
|
|
{
|
|
|
|
OClink conn;
|
|
|
|
oc_get_connection(node,&conn);
|
2014-03-25 04:02:52 +08:00
|
|
|
return makeocpathstring(conn,node,".");
|
2013-02-26 12:31:06 +08:00
|
|
|
}
|