Remove unused function etc (old template from memory)

This commit is contained in:
Shahram Najm 2019-08-19 12:53:10 +01:00
parent f28bbb9573
commit f7281385ad
4 changed files with 24 additions and 17 deletions

View File

@ -18,9 +18,12 @@ print OUT "/* This file is automatically generated by $0, do not edit */\n\n";
foreach $name ( @ARGV )
{
$name =~ /(\w+)\.grib/;
my $proc = $1;
# The old assumption that the file had a .grib extension
# $name =~ /(\w+)\.grib/;
#my $proc = $1;
my $proc = $name;
$proc =~ s/[^a-z0-9]/_/g;
print "$name\n";
@ -75,3 +78,5 @@ foreach my $k ( sort keys %entries )
print OUT "};\n\n";
close(OUT) or "die grib_templates.h: $!";
print "Created grib_templates.h\n";

View File

@ -1230,7 +1230,7 @@ long grib_get_bits_per_value(double max, double min, long binary_scale_factor);
long grib_get_decimal_scale_fact(double max, double min, long bpval, long binary_scale);
/* grib_templates.c */
grib_handle *grib_internal_template(grib_context *c, const char *name);
/*grib_handle *grib_internal_sample(grib_context *c, const char *name);*/
grib_handle *grib_external_template(grib_context *c, const char *name);
grib_handle *bufr_external_template(grib_context *c, const char *name);
char *grib_external_template_path(grib_context *c, const char *name);

View File

@ -257,8 +257,8 @@ grib_handle* grib_handle_new_from_samples( grib_context* c, const char* name )
grib_context_set_handle_total_count(c,0);
/*
g = grib_internal_template(c,name);
if(g) return g;
* g = grib_internal_sample(c,name);
* if(g) return g;
*/
if (c->debug) {
fprintf(stderr, "ECCODES DEBUG: grib_handle_new_from_samples '%s'\n", name);
@ -280,8 +280,8 @@ grib_handle* codes_bufr_handle_new_from_samples ( grib_context* c, const char* n
grib_context_set_handle_total_count(c,0);
/*
g = grib_internal_template(c,name);
if(g) return g;
* g = grib_internal_sample(c,name);
* if(g) return g;
*/
if (c->debug) {
fprintf(stderr, "ECCODES DEBUG: grib_handle_new_from_samples '%s'\n", name);

View File

@ -14,30 +14,32 @@
# include <unistd.h>
#endif
#if 0
/* This is a mechanism where we generate C code in grib_templates.h
* from our GRIB sample files and then include the header so one
* can instantiate samples without any disk access.
* This is now superseded by MEMFS
*/
typedef struct grib_templates {
const char* name;
const unsigned char* data;
size_t size;
} grib_templates;
#if 1
#include "grib_templates.h"
#define NUMBER(x) (sizeof(x)/sizeof(x[0]))
grib_handle* grib_internal_template(grib_context* c,const char* name)
grib_handle* grib_internal_sample(grib_context* c,const char* name)
{
int i;
for(i = 0; i < NUMBER(templates); i++)
size_t i;
const size_t num_samples = NUMBER(templates);
Assert(0);
for(i = 0; i < num_samples; i++)
if(strcmp(name,templates[i].name) == 0)
return grib_handle_new_from_message_copy(c,templates[i].data,templates[i].size);
return NULL;
}
#else
grib_handle* grib_internal_template(grib_context* c,const char* name)
{
return NULL;
}
#endif
static grib_handle* try_template(grib_context* c,const char* dir,const char* name)