diff --git a/fortran/eccodes_constants.h b/fortran/eccodes_constants.h index 15a04e896..8a14e93de 100644 --- a/fortran/eccodes_constants.h +++ b/fortran/eccodes_constants.h @@ -1,68 +1,68 @@ - integer, parameter,public :: CODES_WRONG_BITMAP_SIZE = -66 - integer, parameter,public :: CODES_OUT_OF_RANGE = -65 - integer, parameter,public :: CODES_UNSUPPORTED_EDITION = -64 - integer, parameter,public :: CODES_ATTRIBUTE_NOT_FOUND = -63 - integer, parameter,public :: CODES_TOO_MANY_ATTRIBUTES = -62 - integer, parameter,public :: CODES_ATTRIBUTE_CLASH = -61 - integer, parameter,public :: CODES_NULL_POINTER = -60 - integer, parameter,public :: CODES_MISSING_BUFR_ENTRY = -59 - integer, parameter,public :: CODES_WRONG_CONVERSION = -58 - integer, parameter,public :: CODES_STRING_TOO_SMALL = -57 - integer, parameter,public :: CODES_INVALID_KEY_VALUE = -56 - integer, parameter,public :: CODES_VALUE_DIFFERENT = -55 - integer, parameter,public :: CODES_DIFFERENT_EDITION = -54 - integer, parameter,public :: CODES_INVALID_BPV = -53 - integer, parameter,public :: CODES_CORRUPTED_INDEX = -52 - integer, parameter,public :: CODES_MESSAGE_MALFORMED = -51 - integer, parameter,public :: CODES_UNDERFLOW = -50 - integer, parameter,public :: CODES_SWITCH_NO_MATCH = -49 - integer, parameter,public :: CODES_CONSTANT_FIELD = -48 - integer, parameter,public :: CODES_MESSAGE_TOO_LARGE = -47 - integer, parameter,public :: CODES_INTERNAL_ARRAY_TOO_SMALL = -46 - integer, parameter,public :: CODES_PREMATURE_END_OF_FILE = -45 - integer, parameter,public :: CODES_NULL_INDEX = -44 - integer, parameter,public :: CODES_END_OF_INDEX = -43 - integer, parameter,public :: CODES_WRONG_GRID = -42 - integer, parameter,public :: CODES_NO_VALUES = -41 - integer, parameter,public :: CODES_END = -40 - integer, parameter,public :: CODES_WRONG_TYPE = -39 - integer, parameter,public :: CODES_NO_DEFINITIONS = -38 - integer, parameter,public :: CODES_HASH_ARRAY_NO_MATCH = -37 - integer, parameter,public :: CODES_CONCEPT_NO_MATCH = -36 - integer, parameter,public :: CODES_OUT_OF_AREA = -35 - integer, parameter,public :: CODES_MISSING_KEY = -34 - integer, parameter,public :: CODES_INVALID_ORDERBY = -33 - integer, parameter,public :: CODES_INVALID_NEAREST = -32 - integer, parameter,public :: CODES_INVALID_KEYS_ITERATOR = -31 - integer, parameter,public :: CODES_INVALID_ITERATOR = -30 - integer, parameter,public :: CODES_INVALID_INDEX = -29 - integer, parameter,public :: CODES_INVALID_GRIB = -28 - integer, parameter,public :: CODES_INVALID_FILE = -27 - integer, parameter,public :: CODES_WRONG_STEP_UNIT = -26 - integer, parameter,public :: CODES_WRONG_STEP = -25 - integer, parameter,public :: CODES_INVALID_TYPE = -24 - integer, parameter,public :: CODES_WRONG_LENGTH = -23 - integer, parameter,public :: CODES_VALUE_CANNOT_BE_MISSING = -22 - integer, parameter,public :: CODES_INVALID_SECTION_NUMBER = -21 - integer, parameter,public :: CODES_NULL_HANDLE = -20 - integer, parameter,public :: CODES_INVALID_ARGUMENT = -19 - integer, parameter,public :: CODES_READ_ONLY = -18 - integer, parameter,public :: CODES_OUT_OF_MEMORY = -17 - integer, parameter,public :: CODES_GEOCALCULUS_PROBLEM = -16 - integer, parameter,public :: CODES_NO_MORE_IN_SET = -15 - integer, parameter,public :: CODES_ENCODING_ERROR = -14 - integer, parameter,public :: CODES_DECODING_ERROR = -13 - integer, parameter,public :: CODES_INVALID_MESSAGE = -12 - integer, parameter,public :: CODES_IO_PROBLEM = -11 - integer, parameter,public :: CODES_NOT_FOUND = -10 - integer, parameter,public :: CODES_WRONG_ARRAY_SIZE = -9 - integer, parameter,public :: CODES_CODE_NOT_FOUND_IN_TABLE = -8 - integer, parameter,public :: CODES_FILE_NOT_FOUND = -7 - integer, parameter,public :: CODES_ARRAY_TOO_SMALL = -6 - integer, parameter,public :: CODES_7777_NOT_FOUND = -5 - integer, parameter,public :: CODES_NOT_IMPLEMENTED = -4 - integer, parameter,public :: CODES_BUFFER_TOO_SMALL = -3 - integer, parameter,public :: CODES_INTERNAL_ERROR = -2 - integer, parameter,public :: CODES_END_OF_FILE = -1 - integer, parameter,public :: CODES_SUCCESS = 0 - integer, parameter,public :: CODES_NULL = -1 + integer, parameter,public :: CODES_WRONG_BITMAP_SIZE = -66 + integer, parameter,public :: CODES_OUT_OF_RANGE = -65 + integer, parameter,public :: CODES_UNSUPPORTED_EDITION = -64 + integer, parameter,public :: CODES_ATTRIBUTE_NOT_FOUND = -63 + integer, parameter,public :: CODES_TOO_MANY_ATTRIBUTES = -62 + integer, parameter,public :: CODES_ATTRIBUTE_CLASH = -61 + integer, parameter,public :: CODES_NULL_POINTER = -60 + integer, parameter,public :: CODES_MISSING_BUFR_ENTRY = -59 + integer, parameter,public :: CODES_WRONG_CONVERSION = -58 + integer, parameter,public :: CODES_STRING_TOO_SMALL = -57 + integer, parameter,public :: CODES_INVALID_KEY_VALUE = -56 + integer, parameter,public :: CODES_VALUE_DIFFERENT = -55 + integer, parameter,public :: CODES_DIFFERENT_EDITION = -54 + integer, parameter,public :: CODES_INVALID_BPV = -53 + integer, parameter,public :: CODES_CORRUPTED_INDEX = -52 + integer, parameter,public :: CODES_MESSAGE_MALFORMED = -51 + integer, parameter,public :: CODES_UNDERFLOW = -50 + integer, parameter,public :: CODES_SWITCH_NO_MATCH = -49 + integer, parameter,public :: CODES_CONSTANT_FIELD = -48 + integer, parameter,public :: CODES_MESSAGE_TOO_LARGE = -47 + integer, parameter,public :: CODES_INTERNAL_ARRAY_TOO_SMALL = -46 + integer, parameter,public :: CODES_PREMATURE_END_OF_FILE = -45 + integer, parameter,public :: CODES_NULL_INDEX = -44 + integer, parameter,public :: CODES_END_OF_INDEX = -43 + integer, parameter,public :: CODES_WRONG_GRID = -42 + integer, parameter,public :: CODES_NO_VALUES = -41 + integer, parameter,public :: CODES_END = -40 + integer, parameter,public :: CODES_WRONG_TYPE = -39 + integer, parameter,public :: CODES_NO_DEFINITIONS = -38 + integer, parameter,public :: CODES_HASH_ARRAY_NO_MATCH = -37 + integer, parameter,public :: CODES_CONCEPT_NO_MATCH = -36 + integer, parameter,public :: CODES_OUT_OF_AREA = -35 + integer, parameter,public :: CODES_MISSING_KEY = -34 + integer, parameter,public :: CODES_INVALID_ORDERBY = -33 + integer, parameter,public :: CODES_INVALID_NEAREST = -32 + integer, parameter,public :: CODES_INVALID_KEYS_ITERATOR = -31 + integer, parameter,public :: CODES_INVALID_ITERATOR = -30 + integer, parameter,public :: CODES_INVALID_INDEX = -29 + integer, parameter,public :: CODES_INVALID_GRIB = -28 + integer, parameter,public :: CODES_INVALID_FILE = -27 + integer, parameter,public :: CODES_WRONG_STEP_UNIT = -26 + integer, parameter,public :: CODES_WRONG_STEP = -25 + integer, parameter,public :: CODES_INVALID_TYPE = -24 + integer, parameter,public :: CODES_WRONG_LENGTH = -23 + integer, parameter,public :: CODES_VALUE_CANNOT_BE_MISSING = -22 + integer, parameter,public :: CODES_INVALID_SECTION_NUMBER = -21 + integer, parameter,public :: CODES_NULL_HANDLE = -20 + integer, parameter,public :: CODES_INVALID_ARGUMENT = -19 + integer, parameter,public :: CODES_READ_ONLY = -18 + integer, parameter,public :: CODES_OUT_OF_MEMORY = -17 + integer, parameter,public :: CODES_GEOCALCULUS_PROBLEM = -16 + integer, parameter,public :: CODES_NO_MORE_IN_SET = -15 + integer, parameter,public :: CODES_ENCODING_ERROR = -14 + integer, parameter,public :: CODES_DECODING_ERROR = -13 + integer, parameter,public :: CODES_INVALID_MESSAGE = -12 + integer, parameter,public :: CODES_IO_PROBLEM = -11 + integer, parameter,public :: CODES_NOT_FOUND = -10 + integer, parameter,public :: CODES_WRONG_ARRAY_SIZE = -9 + integer, parameter,public :: CODES_CODE_NOT_FOUND_IN_TABLE = -8 + integer, parameter,public :: CODES_FILE_NOT_FOUND = -7 + integer, parameter,public :: CODES_ARRAY_TOO_SMALL = -6 + integer, parameter,public :: CODES_7777_NOT_FOUND = -5 + integer, parameter,public :: CODES_NOT_IMPLEMENTED = -4 + integer, parameter,public :: CODES_BUFFER_TOO_SMALL = -3 + integer, parameter,public :: CODES_INTERNAL_ERROR = -2 + integer, parameter,public :: CODES_END_OF_FILE = -1 + integer, parameter,public :: CODES_SUCCESS = 0 + integer, parameter,public :: CODES_NULL = -1 diff --git a/src/errors.pl b/src/errors.pl index 1cdde7d6b..69ca46182 100755 --- a/src/errors.pl +++ b/src/errors.pl @@ -45,15 +45,19 @@ sub write_python_errors { sub write_F90_errors { my $errdict = shift; - open(F,">grib_api_constants.h.new") or die "grib_api_constants.h.new: $!"; + open(F1,">grib_api_constants.h.new") or die "grib_api_constants.h.new: $!"; + open(F2,">eccodes_constants.h.new") or die "eccodes_constants.h.new: $!"; foreach (sort {$a<=>$b} keys %{$errdict}){ - printf F " integer, parameter,public :: %-50s = %d\n", - $errdict->{$_}{name},$_; + my $name = $errdict->{$_}{name}; + printf F1 " integer, parameter,public :: %-50s = %d\n", $name,$_; + (my $eccodes_name = $name) =~ s/GRIB_/CODES_/; + printf F2 " integer, parameter,public :: %-50s = %d\n", $eccodes_name,$_; } - printf F " integer, parameter,public :: %-50s = %d\n","GRIB_NULL",-1; - - close(F); + printf F1 " integer, parameter,public :: %-50s = %d\n","GRIB_NULL",-1; + printf F2 " integer, parameter,public :: %-50s = %d\n","CODES_NULL",-1; + close(F1); + close(F2); } sub write_C_errors { diff --git a/src/extrules.am b/src/extrules.am index 99b4d1447..f64e5ca4a 100644 --- a/src/extrules.am +++ b/src/extrules.am @@ -5,8 +5,9 @@ grib_errors.c : grib_errors.txt errors.pl ./errors.pl cmp grib_errors.c grib_errors.c.new || (cp grib_errors.c.new grib_errors.c) cmp grib_api.h grib_api.h.new || (cp grib_api.h.new grib_api.h) - cmp ../fortran/grib_api_constants.h grib_api_constants.h.new || (cp grib_api_constants.h.new ../fortran/grib_api_constants.h) - cmp ../python/grib_errors.h grib_errors.h.new || (cp grib_errors.h.new ../python/grib_errors.h) + cmp ../fortran/grib_api_constants.h grib_api_constants.h.new || (mv grib_api_constants.h.new ../fortran/grib_api_constants.h) + cmp ../fortran/eccodes_constants.h eccodes_constants.h.new || (mv eccodes_constants.h.new ../fortran/eccodes_constants.h) + cmp ../python/grib_errors.h grib_errors.h.new || (mv grib_errors.h.new ../python/grib_errors.h) proto:;-chmod +w grib_api_prototypes.h; mkptypes -A $(libeccodes_la_prototypes) $(libeccodes_extra_prototypes) > temp && mv temp grib_api_prototypes.h;rm -f temp