Improve debug and error messages

This commit is contained in:
Shahram Najm 2013-06-19 13:13:45 +01:00
parent 13ff8f62ec
commit b43966afa5
3 changed files with 318 additions and 305 deletions

View File

@ -44,7 +44,7 @@ static GRIB_INLINE int grib_inline_strcmp(const char* a,const char* b) {
static struct table_entry table[] =
{
/* This file is generated my ./make_class.pl */
/* This file is generated my ./make_class.pl */
#include "grib_accessor_factory.h"
};
@ -60,7 +60,7 @@ grib_section* grib_create_root_section(const grib_context *context, grib_handle
if(h->context->grib_reader == NULL) {
if ((fpath=grib_context_full_defs_path(h->context,"boot.def"))==NULL) {
grib_context_log(h->context,GRIB_LOG_FATAL,
"Unable to find boot.def ");
"Unable to find boot.def. Context path=%s", context->grib_definition_files_path);
}
grib_parse_file(h->context,fpath);
}
@ -123,11 +123,11 @@ grib_accessor* grib_accessor_factory(grib_section* p, grib_action* creator,
if(p->block->last) {
a->offset = grib_get_next_position_offset(p->block->last);
#if 0
#if 0
printf("offset: p->block->last %s %s %ld %ld\n",
p->block->last->cclass->name,
p->block->last->name,(long)p->block->last->offset,(long)p->block->last->length);
#endif
#endif
} else {
if(p->owner) {
a->offset = p->owner->offset;
@ -162,7 +162,6 @@ grib_accessor* grib_accessor_factory(grib_section* p, grib_action* creator,
}
}
if(p->owner)
grib_context_log(p->h->context, GRIB_LOG_DEBUG,
"Creating (%s)%s of %s at offset %d [len=%d]",
@ -201,7 +200,6 @@ void grib_push_accessor(grib_accessor* a, grib_block_of_accessors* l)
}
}
}
}
void grib_section_post_init(grib_section* s)
@ -334,7 +332,6 @@ int grib_get_block_length(grib_section* s, size_t *l)
#endif
}
grib_accessor* find_paddings(grib_section* s)
{
grib_accessor* a = s ? s->block->first : NULL;

View File

@ -281,7 +281,8 @@ static grib_context default_grib_context = {
};
grib_context* grib_context_get_default(){
grib_context* grib_context_get_default()
{
GRIB_PTHREAD_ONCE(&once,&init);
if(!default_grib_context.inited)
@ -346,11 +347,18 @@ grib_context* grib_context_get_default(){
if(!default_grib_context.grib_samples_path)
default_grib_context.grib_samples_path = GRIB_TEMPLATES_PATH ;
#endif
default_grib_context.grib_definition_files_path = getenv("GRIB_DEFINITION_PATH");
#ifdef GRIB_DEFINITION_PATH
if(!default_grib_context.grib_definition_files_path)
default_grib_context.grib_definition_files_path = GRIB_DEFINITION_PATH ;
#endif
grib_context_log(&default_grib_context, GRIB_LOG_DEBUG, "Definitions path: %s",
default_grib_context.grib_definition_files_path);
grib_context_log(&default_grib_context, GRIB_LOG_DEBUG, "Samples path: %s",
default_grib_context.grib_samples_path);
default_grib_context.keys_count=0;
default_grib_context.keys=grib_hash_keys_new(&(default_grib_context),
&(default_grib_context.keys_count));
@ -363,7 +371,6 @@ grib_context* grib_context_get_default(){
GRIB_MUTEX_UNLOCK(&mutex_c);
}
return &default_grib_context;
}
@ -534,7 +541,6 @@ char *grib_context_full_defs_path(grib_context* c,const char* basename)
}
dir=dir->next;
}
}
GRIB_MUTEX_LOCK(&mutex_c);

View File

@ -1,5 +1,15 @@
/* This file is automatically generated by ./errors.pl, do not edit */
/*
* Copyright 2005-2013 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
*
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
#include "grib_api_internal.h"
static const char *errors[] = {