mirror of https://github.com/ecmwf/eccodes.git
GRIB-92: MSVC++ project for GRIB API
This commit is contained in:
parent
b581dd7ec8
commit
a00a68304c
|
@ -366,7 +366,9 @@ EXTRA_DIST = README AUTHORS NOTICE LICENSE ChangeLog version.sh html \
|
||||||
data/simple_bitmap.grib \
|
data/simple_bitmap.grib \
|
||||||
data/second_ord_rbr.grib1 \
|
data/second_ord_rbr.grib1 \
|
||||||
perf/jmeter.awk \
|
perf/jmeter.awk \
|
||||||
perf/time.sh
|
perf/time.sh \
|
||||||
|
windows/msvc/grib_api.sln \
|
||||||
|
windows/msvc/grib_api_lib/grib_api_lib.vcproj
|
||||||
|
|
||||||
|
|
||||||
perf_dir = @abs_builddir@/perf
|
perf_dir = @abs_builddir@/perf
|
||||||
|
|
|
@ -297,6 +297,7 @@ list( APPEND grib_api_srcs
|
||||||
jgribapi_GribIterator.h
|
jgribapi_GribIterator.h
|
||||||
md5.h
|
md5.h
|
||||||
md5.c
|
md5.c
|
||||||
|
grib_windef.h
|
||||||
)
|
)
|
||||||
|
|
||||||
# list( APPEND grib_api_extra_srcs
|
# list( APPEND grib_api_extra_srcs
|
||||||
|
|
|
@ -302,6 +302,7 @@ CLEANFILES = libgrib_api.la
|
||||||
|
|
||||||
noinst_HEADERS = grib_api_internal.h \
|
noinst_HEADERS = grib_api_internal.h \
|
||||||
md5.h \
|
md5.h \
|
||||||
|
grib_windef.h \
|
||||||
grib_emoslib.h \
|
grib_emoslib.h \
|
||||||
grib_api_prototypes.h \
|
grib_api_prototypes.h \
|
||||||
grib_dumper_class.h \
|
grib_dumper_class.h \
|
||||||
|
|
|
@ -540,7 +540,7 @@ static int pack_string(grib_accessor* a, const char* buffer, size_t *len)
|
||||||
size_t size = 1;
|
size_t size = 1;
|
||||||
|
|
||||||
typedef int (*cmpproc)(const char*, const char*);
|
typedef int (*cmpproc)(const char*, const char*);
|
||||||
#ifndef _WIN32
|
#ifndef GRIB_ON_WINDOWS
|
||||||
cmpproc cmp = a->flags | GRIB_ACCESSOR_FLAG_LOWERCASE ? strcasecmp : strcmp;
|
cmpproc cmp = a->flags | GRIB_ACCESSOR_FLAG_LOWERCASE ? strcasecmp : strcmp;
|
||||||
#else
|
#else
|
||||||
/* Microsoft Windows Visual Studio support */
|
/* Microsoft Windows Visual Studio support */
|
||||||
|
|
|
@ -26,7 +26,7 @@ extern "C" {
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifndef _WIN32
|
#ifndef GRIB_ON_WINDOWS
|
||||||
#include <sys/times.h>
|
#include <sys/times.h>
|
||||||
#endif
|
#endif
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
|
@ -60,12 +60,14 @@ extern "C" {
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
/* Microsoft Windows Visual Studio support */
|
||||||
|
#include "grib_windef.h"
|
||||||
|
|
||||||
|
#ifndef GRIB_ON_WINDOWS
|
||||||
# include <dirent.h>
|
# include <dirent.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <inttypes.h>
|
# include <inttypes.h>
|
||||||
#else
|
#else
|
||||||
/* Microsoft Windows Visual Studio support */
|
|
||||||
# include <direct.h>
|
# include <direct.h>
|
||||||
# include <io.h>
|
# include <io.h>
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "grib_api_internal.h"
|
#include "grib_api_internal.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifndef _WIN32
|
#ifndef GRIB_ON_WINDOWS
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#else
|
#else
|
||||||
#include <fcntl.h> /* Windows: for _O_BINARY */
|
#include <fcntl.h> /* Windows: for _O_BINARY */
|
||||||
|
@ -315,7 +315,7 @@ grib_context* grib_context_get_default(){
|
||||||
/* On UNIX, when we read from a file we get exactly what is in the file on disk.
|
/* On UNIX, when we read from a file we get exactly what is in the file on disk.
|
||||||
* But on Windows a file can be opened in binary or text mode. In binary mode the system behaves exactly as in UNIX.
|
* But on Windows a file can be opened in binary or text mode. In binary mode the system behaves exactly as in UNIX.
|
||||||
*/
|
*/
|
||||||
#ifdef _MSC_VER
|
#ifdef GRIB_ON_WINDOWS
|
||||||
_set_fmode(_O_BINARY);
|
_set_fmode(_O_BINARY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ grib_context* grib_context_new(grib_context* parent)
|
||||||
static char* resolve_path(grib_context* c, char* path)
|
static char* resolve_path(grib_context* c, char* path)
|
||||||
{
|
{
|
||||||
char* result = NULL;
|
char* result = NULL;
|
||||||
#ifdef _WIN32
|
#ifdef GRIB_ON_WINDOWS
|
||||||
result = grib_context_strdup(c, path);
|
result = grib_context_strdup(c, path);
|
||||||
#else
|
#else
|
||||||
char resolved[DEF_PATH_MAXLEN+1];
|
char resolved[DEF_PATH_MAXLEN+1];
|
||||||
|
@ -435,7 +435,7 @@ static char* resolve_path(grib_context* c, char* path)
|
||||||
|
|
||||||
/* Windows always has a colon in pathnames e.g. C:\temp\file. So instead we use semi-colons as delimiter */
|
/* Windows always has a colon in pathnames e.g. C:\temp\file. So instead we use semi-colons as delimiter */
|
||||||
/* in order to have multiple definitions directories */
|
/* in order to have multiple definitions directories */
|
||||||
#ifdef _WIN32
|
#ifdef GRIB_ON_WINDOWS
|
||||||
# define DEFS_PATH_DELIMITER_CHAR ';'
|
# define DEFS_PATH_DELIMITER_CHAR ';'
|
||||||
# define DEFS_PATH_DELIMITER_STR ";"
|
# define DEFS_PATH_DELIMITER_STR ";"
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -153,7 +153,7 @@ int grib_jasper_encode(grib_context *c, j2k_encode_helper *helper) {
|
||||||
if( helper->compression != 0)
|
if( helper->compression != 0)
|
||||||
{
|
{
|
||||||
/* Lossy */
|
/* Lossy */
|
||||||
#ifndef _WIN32
|
#ifndef GRIB_ON_WINDOWS
|
||||||
snprintf (opts, MAXOPTSSIZE, "mode=real\nrate=%f", 1.0/helper->compression);
|
snprintf (opts, MAXOPTSSIZE, "mode=real\nrate=%f", 1.0/helper->compression);
|
||||||
#else
|
#else
|
||||||
/* Microsoft Windows Visual Studio support */
|
/* Microsoft Windows Visual Studio support */
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "grib_api_internal.h"
|
#include "grib_api_internal.h"
|
||||||
#ifndef _WIN32
|
#ifndef GRIB_ON_WINDOWS
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
# include <time.h>
|
# include <time.h>
|
||||||
# include <sys/resource.h>
|
# include <sys/resource.h>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "grib_api_internal.h"
|
#include "grib_api_internal.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef GRIB_ON_WINDOWS
|
||||||
/* Microsoft Windows Visual Studio support. Implementation of Unix rint() */
|
/* Microsoft Windows Visual Studio support. Implementation of Unix rint() */
|
||||||
double rint(double x)
|
double rint(double x)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2005-2012 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef grib_windef_H
|
||||||
|
#define grib_windef_H
|
||||||
|
|
||||||
|
/* Microsoft Windows Visual Studio support */
|
||||||
|
#if defined(_WIN32) && defined(_MSC_VER)
|
||||||
|
# define GRIB_ON_WINDOWS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -12,13 +12,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifndef _WIN32
|
#include "grib_windef.h"
|
||||||
#include <stdint.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef GRIB_ON_WINDOWS
|
||||||
typedef unsigned __int64 UnsignedInt64;
|
typedef unsigned __int64 UnsignedInt64;
|
||||||
#else
|
#else
|
||||||
|
# include <stdint.h>
|
||||||
typedef uint64_t UnsignedInt64;
|
typedef uint64_t UnsignedInt64;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ int main(int argc, char *argv[]) { return grib_tool(argc,argv);}
|
||||||
|
|
||||||
/* Windows always has a colon in pathnames e.g. C:\temp\file. So instead we use semi-colons as delimiter */
|
/* Windows always has a colon in pathnames e.g. C:\temp\file. So instead we use semi-colons as delimiter */
|
||||||
/* in order to have multiple samples directories */
|
/* in order to have multiple samples directories */
|
||||||
#ifdef _WIN32
|
#ifdef GRIB_ON_WINDOWS
|
||||||
# define SAMPLES_PATH_DELIMITER_CHAR ';'
|
# define SAMPLES_PATH_DELIMITER_CHAR ';'
|
||||||
# define SAMPLES_PATH_DELIMITER_STR ";"
|
# define SAMPLES_PATH_DELIMITER_STR ";"
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
*/
|
*/
|
||||||
#include "grib_tools.h"
|
#include "grib_tools.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef GRIB_ON_WINDOWS
|
||||||
/* Microsoft Windows Visual Studio support */
|
/* Microsoft Windows Visual Studio support */
|
||||||
#include "wingetopt.h"
|
#include "wingetopt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -482,7 +482,7 @@ static int grib_tool_index(grib_runtime_options* options) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef GRIB_ON_WINDOWS
|
||||||
static int scan(grib_context* c,grib_runtime_options* options,const char* dir) {
|
static int scan(grib_context* c,grib_runtime_options* options,const char* dir) {
|
||||||
struct dirent *s;
|
struct dirent *s;
|
||||||
DIR *d;
|
DIR *d;
|
||||||
|
@ -543,7 +543,7 @@ static int process(grib_context* c,grib_runtime_options* options,const char* pat
|
||||||
int stat_val=0;
|
int stat_val=0;
|
||||||
int ioerr=0;
|
int ioerr=0;
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef GRIB_ON_WINDOWS
|
||||||
stat_val = lstat(path,&s);
|
stat_val = lstat(path,&s);
|
||||||
#else
|
#else
|
||||||
stat_val = stat(path,&s);
|
stat_val = stat(path,&s);
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include "grib_api_internal.h"
|
#include "grib_api_internal.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#ifndef _WIN32
|
#ifndef GRIB_ON_WINDOWS
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef _WIN32
|
#include "wingetopt.h"
|
||||||
/* Microsoft Windows Visual Studio support */
|
|
||||||
|
#ifdef GRIB_ON_WINDOWS
|
||||||
|
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "wingetopt.h"
|
|
||||||
|
|
||||||
char *optarg; /* global argument pointer */
|
char *optarg; /* global argument pointer */
|
||||||
int optind = 0; /* global argv index */
|
int optind = 0; /* global argv index */
|
||||||
|
|
|
@ -11,7 +11,10 @@
|
||||||
#ifndef WINGETOPT_H
|
#ifndef WINGETOPT_H
|
||||||
#define WINGETOPT_H
|
#define WINGETOPT_H
|
||||||
|
|
||||||
#ifdef _WIN32
|
/* Microsoft Windows Visual Studio support */
|
||||||
|
#include "grib_windef.h"
|
||||||
|
|
||||||
|
#ifdef GRIB_ON_WINDOWS
|
||||||
/* Microsoft Windows Visual Studio support */
|
/* Microsoft Windows Visual Studio support */
|
||||||
extern int optind, opterr;
|
extern int optind, opterr;
|
||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||||
|
# Visual Studio 2008
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grib_api_lib", "grib_api_lib\grib_api_lib.vcproj", "{3DE8B13F-7DFE-48ED-9158-B34D774500EC}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{3DE8B13F-7DFE-48ED-9158-B34D774500EC}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{3DE8B13F-7DFE-48ED-9158-B34D774500EC}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{3DE8B13F-7DFE-48ED-9158-B34D774500EC}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{3DE8B13F-7DFE-48ED-9158-B34D774500EC}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{3DE8B13F-7DFE-48ED-9158-B34D774500EC}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{3DE8B13F-7DFE-48ED-9158-B34D774500EC}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{3DE8B13F-7DFE-48ED-9158-B34D774500EC}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{3DE8B13F-7DFE-48ED-9158-B34D774500EC}.Release|x64.Build.0 = Release|x64
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue