Clang format: Fix tabs/spaces in generator script/template

This commit is contained in:
Shahram Najm 2020-01-23 11:09:20 +00:00
parent 5ee60066e4
commit 51d6d7822c
2 changed files with 42 additions and 41 deletions

View File

@ -1,42 +1,43 @@
static grib_section* sub_section(grib_accessor* a);
static int get_native_type(grib_accessor*);
static int get_native_type(grib_accessor*);
static int pack_missing(grib_accessor*);
static int is_missing(grib_accessor*);
static int pack_bytes(grib_accessor*,const unsigned char*, size_t *len);
static int pack_double(grib_accessor*, const double* val,size_t *len);
static int pack_long(grib_accessor*, const long* val,size_t *len);
static int pack_string(grib_accessor*, const char*, size_t *len);
static int pack_string_array(grib_accessor*, const char**, size_t *len);
static int pack_bytes(grib_accessor*, const unsigned char*, size_t* len);
static int pack_double(grib_accessor*, const double* val, size_t* len);
static int pack_long(grib_accessor*, const long* val, size_t* len);
static int pack_string(grib_accessor*, const char*, size_t* len);
static int pack_string_array(grib_accessor*, const char**, size_t* len);
static int pack_expression(grib_accessor*, grib_expression*);
static int unpack_bytes (grib_accessor*,unsigned char*, size_t *len);
static int unpack_double(grib_accessor*, double* val,size_t *len);
static int unpack_long(grib_accessor*, long* val,size_t *len);
static int unpack_string (grib_accessor*, char*, size_t *len);
static int unpack_string_array (grib_accessor*, char**, size_t *len);
static int unpack_bytes(grib_accessor*, unsigned char*, size_t* len);
static int unpack_double(grib_accessor*, double* val, size_t* len);
static int unpack_long(grib_accessor*, long* val, size_t* len);
static int unpack_string(grib_accessor*, char*, size_t* len);
static int unpack_string_array(grib_accessor*, char**, size_t* len);
static size_t string_length(grib_accessor*);
static long byte_count(grib_accessor*);
static long byte_offset(grib_accessor*);
static long next_offset(grib_accessor*);
static int value_count(grib_accessor*,long*);
static void destroy(grib_context*,grib_accessor*);
static int value_count(grib_accessor*, long*);
static void destroy(grib_context*, grib_accessor*);
static void dump(grib_accessor*, grib_dumper*);
static void init(grib_accessor*,const long, grib_arguments* );
static void init(grib_accessor*, const long, grib_arguments*);
static void post_init(grib_accessor*);
static void init_class(grib_accessor_class*);
static int notify_change(grib_accessor*,grib_accessor*);
static void update_size(grib_accessor*,size_t);
static size_t preferred_size(grib_accessor*,int);
static int notify_change(grib_accessor*, grib_accessor*);
static void update_size(grib_accessor*, size_t);
static size_t preferred_size(grib_accessor*, int);
static void resize(grib_accessor*,size_t);
static int nearest_smaller_value (grib_accessor*, double,double*);
static int nearest_smaller_value (grib_accessor*, double, double*);
static grib_accessor* next(grib_accessor*, int);
static int compare(grib_accessor*, grib_accessor*);
static int unpack_double_element(grib_accessor*,size_t i, double* val);
static int unpack_double_subarray(grib_accessor*, double* val,size_t start,size_t len);
static int unpack_double_element(grib_accessor*, size_t i, double* val);
static int unpack_double_subarray(grib_accessor*, double* val, size_t start, size_t len);
static int clear(grib_accessor*);
static grib_accessor* make_clone(grib_accessor*,grib_section*,int*);
static grib_accessor* make_clone(grib_accessor*, grib_section*, int*);
typedef struct grib_accessor_NAME {
grib_accessor att;
typedef struct grib_accessor_NAME
{
grib_accessor att;
MEMBERS
} grib_accessor_NAME;
@ -74,15 +75,15 @@ static grib_accessor_class _grib_accessor_class_NAME = {
&pack_expression, /* pack_expression */
&notify_change, /* notify_change */
&update_size, /* update_size */
&preferred_size, /* preferred_size */
&resize, /* resize */
&preferred_size, /* preferred_size */
&resize, /* resize */
&nearest_smaller_value, /* nearest_smaller_value */
&next, /* next accessor */
&compare, /* compare vs. another accessor */
&unpack_double_element, /* unpack only ith value */
&unpack_double_element, /* unpack only ith value */
&unpack_double_subarray, /* unpack a subarray */
&clear, /* clear */
&make_clone, /* clone accessor */
&clear, /* clear */
&make_clone, /* clone accessor */
};

View File

@ -100,7 +100,7 @@ sub super_members {
my $class = cleanup($s->{NAME});
my @members = map { cleanup($_);} split(";",$s->{MEMBERS});
unshift @members, "/* Members defined in $class */";
unshift @members, " /* Members defined in $class */";
unshift @{$list}, @members;
@ -117,7 +117,7 @@ sub output {
my $name = cleanup($args->{NAME});
my @members = map { cleanup($_);} split(";",$args->{MEMBERS});
unshift @members, "/* Members defined in $name */";
unshift @members, " /* Members defined in $name */";
my @implements = map { cleanup($_);} split(";",$args->{IMPLEMENTS});
@ -190,7 +190,7 @@ EOF
}
else
{
print OUT "\t$m;\n";
print OUT " $m;\n";
}
}
next;
@ -241,7 +241,7 @@ EOF
foreach my $c ( grep { !$implements{$_} } grep { ! /\binit\b|\bdestroy\b|\bpost_init\b/ } @procs )
{
print OUT "\tc->$c\t=\t(*(c->super))->$c;\n";
print OUT " c->$c = (*(c->super))->$c;\n";
}
next;
}
@ -255,10 +255,10 @@ EOF
foreach my $proc ( grep { /clone/ } @procs ) {
my $done=0;
print OUT "static grib_$class* clone(grib_$class* s) {\n";
print OUT "\tgrib_${class}_$name* c=grib_context_alloc_clear(a->parent->h,sizeof(grib_${class}_$name));\n";
print OUT " grib_${class}_$name* c=grib_context_alloc_clear(a->parent->h,sizeof(grib_${class}_$name));\n";
foreach my $m ( @members ) {
if ( $m =~ /\/\*/ ) {next;}
print OUT "\n\tgrib_${class}_$name* self=(grib_${class}_$name*)s;\n\n" unless ($done);
print OUT "\n grib_${class}_$name* self=(grib_${class}_$name*)s;\n\n" unless ($done);
$done=1;
my $is_pointer=0;
my @ma=split(/ /,$m);
@ -269,18 +269,18 @@ EOF
if ($is_pointer) {
if ($mtype =~ "\bchar\b") {
print OUT "\tif (self->$mname) \n\t\tc->$mname=grib_context_strdup(a->parent->h,self->$mname);\n\n";
print OUT " if (self->$mname) \n c->$mname=grib_context_strdup(a->parent->h,self->$mname);\n\n";
}
if ($mtype =~ "\b(double|long|int|float)\b") {
print OUT "\tif (self->".$mname."_size) {\n";
print OUT "\tint i=0;\n";
print OUT "\tc->$mname=grib_context_alloc_clear(a->parent->h,self->".$mname."_size*sizeof($mtype));";
print OUT "\tfor (i=0;i<self->${mname}_size;i++) c->".$mname."[i]=self->".$mname."[i];";
print OUT " if (self->".$mname."_size) {\n";
print OUT " int i=0;\n";
print OUT " c->$mname=grib_context_alloc_clear(a->parent->h,self->".$mname."_size*sizeof($mtype));";
print OUT " for (i=0;i<self->${mname}_size;i++) c->".$mname."[i]=self->".$mname."[i];";
print OUT "}\n";
}
} else { print OUT "\tc->$mname=self->$mname;\n\n"; }
} else { print OUT " c->$mname=self->$mname;\n\n"; }
}
print OUT "\treturn (grib_$class*)c;\n}\n\n"
print OUT " return (grib_$class*)c;\n}\n\n"
}
}