Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
25b35aa7
Commit
25b35aa7
authored
Nov 03, 2017
by
Uwe Schulzweida
Browse files
Added getRSS.c.
parent
14fe2eb7
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/Makefile.am
View file @
25b35aa7
...
...
@@ -71,6 +71,7 @@ libcdo_la_SOURCES = \
fieldzon.cc
\
functs.h
\
getMemorySize.c
\
getRSS.c
\
gradsdeslib.cc
\
gradsdeslib.h
\
grid.cc
\
...
...
src/Makefile.in
View file @
25b35aa7
...
...
@@ -130,7 +130,7 @@ am_libcdo_la_OBJECTS = libcdo_la-argument.lo libcdo_la-array.lo \
libcdo_la-field.lo libcdo_la-field2.lo libcdo_la-fieldc.lo \
libcdo_la-fieldmem.lo libcdo_la-fieldmer.lo \
libcdo_la-fieldzon.lo libcdo_la-getMemorySize.lo \
libcdo_la-gradsdeslib.lo libcdo_la-grid.lo \
libcdo_la-getRSS.lo
libcdo_la-gradsdeslib.lo libcdo_la-grid.lo \
libcdo_la-grid_proj.lo libcdo_la-grid_area.lo \
libcdo_la-grid_define.lo libcdo_la-grid_gme.lo \
libcdo_la-grid_rot.lo libcdo_la-grid_from_name.lo \
...
...
@@ -613,11 +613,11 @@ libcdo_la_SOURCES = argument.h argument.cc array.h array.cc cdo_int.h \
expr.h expr_fun.cc expr_fun.h expr_lex.cc expr_yacc.cc \
expr_yacc.h features.cc field.cc field.h field2.cc fieldc.cc \
fieldmem.cc fieldmer.cc fieldzon.cc functs.h getMemorySize.c \
gradsdeslib.cc gradsdeslib.h grid.cc grid.h
grid_proj.cc
\
grid_proj.h grid_area.cc grid_define.cc
grid_gme.cc
\
grid_rot.cc grid_from_name.cc grid_read.cc
grid_read_pingo.cc
\
grid_print.cc gridreference.cc griddes.cc
griddes.h
\
griddes_h5.cc griddes_nc.cc hetaeta.cc hetaeta.h \
getRSS.c
gradsdeslib.cc gradsdeslib.h grid.cc grid.h \
grid_proj.cc
grid_proj.h grid_area.cc grid_define.cc \
grid_gme.cc
grid_rot.cc grid_from_name.cc grid_read.cc \
grid_read_pingo.cc
grid_print.cc gridreference.cc griddes.cc \
griddes.h
griddes_h5.cc griddes_nc.cc hetaeta.cc hetaeta.h \
institution.cc interpol.cc interpol.h job.cc juldate.cc \
grid_search.cc grid_search.h listarray.cc listarray.h list.cc \
list.h listbuf.cc listbuf.h merge_sort2.cc merge_sort2.h \
...
...
@@ -1145,6 +1145,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-fieldmer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-fieldzon.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-getMemorySize.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-getRSS.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-gradsdeslib.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-grid.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-grid_area.Plo@am__quote@
...
...
@@ -1254,6 +1255,13 @@ libcdo_la-getMemorySize.lo: getMemorySize.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdo_la-getMemorySize.lo `test -f 'getMemorySize.c' || echo '$(srcdir)/'`getMemorySize.c
libcdo_la-getRSS.lo: getRSS.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdo_la-getRSS.lo -MD -MP -MF $(DEPDIR)/libcdo_la-getRSS.Tpo -c -o libcdo_la-getRSS.lo `test -f 'getRSS.c' || echo '$(srcdir)/'`getRSS.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcdo_la-getRSS.Tpo $(DEPDIR)/libcdo_la-getRSS.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='getRSS.c' object='libcdo_la-getRSS.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdo_la-getRSS.lo `test -f 'getRSS.c' || echo '$(srcdir)/'`getRSS.c
json/libcdo_la-jsmn.lo: json/jsmn.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT json/libcdo_la-jsmn.lo -MD -MP -MF json/$(DEPDIR)/libcdo_la-jsmn.Tpo -c -o json/libcdo_la-jsmn.lo `test -f 'json/jsmn.c' || echo '$(srcdir)/'`json/jsmn.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) json/$(DEPDIR)/libcdo_la-jsmn.Tpo json/$(DEPDIR)/libcdo_la-jsmn.Plo
...
...
src/cdo.cc
View file @
25b35aa7
...
...
@@ -81,7 +81,7 @@ static int numThreads = 0;
static
int
timer_total
;
static
int
CDO_netcdf_hdr_pad
=
0
;
static
int
CDO_Rusage
=
0
;
static
const
char
*
username
;
const
char
*
CDO_
username
;
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -113,7 +113,7 @@ void gridsearch_set_method(const char *methodstr);
} \
}
#define ITSME (strcmp(username, "\x6d\x32\x31\x34\x30\x30\x33") == 0)
#define ITSME (strcmp(
CDO_
username, "\x6d\x32\x31\x34\x30\x30\x33") == 0)
static
void
cdo_stackframe
(
void
)
...
...
@@ -192,7 +192,7 @@ void cdo_version(void)
const
int
filetypes
[]
=
{
CDI_FILETYPE_SRV
,
CDI_FILETYPE_EXT
,
CDI_FILETYPE_IEG
,
CDI_FILETYPE_GRB
,
CDI_FILETYPE_GRB2
,
CDI_FILETYPE_NC
,
CDI_FILETYPE_NC2
,
CDI_FILETYPE_NC4
,
CDI_FILETYPE_NC4C
,
CDI_FILETYPE_NC5
};
const
char
*
typenames
[]
=
{
"srv"
,
"ext"
,
"ieg"
,
"grb1"
,
"grb2"
,
"nc1"
,
"nc2"
,
"nc4"
,
"nc4c"
,
"nc5"
};
fprintf
(
stderr
,
"%s
\n
"
,
CDO_
V
ersion
);
fprintf
(
stderr
,
"%s
\n
"
,
CDO_
v
ersion
);
#if defined(USER_NAME) && defined(HOST_NAME) && defined(SYSTEM_TYPE)
fprintf
(
stderr
,
"Compiled: by %s on %s (%s) %s %s
\n
"
,
USER_NAME
,
HOST_NAME
,
SYSTEM_TYPE
,
__DATE__
,
__TIME__
);
#endif
...
...
@@ -234,7 +234,7 @@ void cdo_usage(void)
{
const
char
*
name
;
/* fprintf(stderr, "%s\n", CDO_
V
ersion);*/
/* fprintf(stderr, "%s\n", CDO_
v
ersion);*/
/* fprintf(stderr, "\n");*/
fprintf
(
stderr
,
"usage : cdo [Options] Operator1 [-Operator2 [-OperatorN]]
\n
"
);
fprintf
(
stderr
,
"
\n
"
);
...
...
@@ -733,11 +733,11 @@ void defineVarnames(const char *arg)
static
void
get_env_vars
(
void
)
{
username
=
getenv
(
"LOGNAME"
);
if
(
username
==
NULL
)
CDO_
username
=
getenv
(
"LOGNAME"
);
if
(
CDO_
username
==
NULL
)
{
username
=
getenv
(
"USER"
);
if
(
username
==
NULL
)
username
=
"unknown"
;
CDO_
username
=
getenv
(
"USER"
);
if
(
CDO_
username
==
NULL
)
CDO_
username
=
"unknown"
;
}
char
*
envstr
=
getenv
(
"CDO_GRID_SEARCH_DIR"
);
...
...
@@ -1491,11 +1491,9 @@ int main(int argc, char *argv[])
setCommandLine
(
argc
,
argv
);
Progname
=
getProgname
(
argv
[
0
]);
if
(
strncmp
(
Progname
,
"cdo"
,
3
)
==
0
&&
strlen
(
Progname
)
>
3
)
noff
=
3
;
if
(
noff
)
setDefaultFileType
(
Progname
+
noff
,
0
);
CDO_progname
=
getProgname
(
argv
[
0
]);
if
(
strncmp
(
CDO_progname
,
"cdo"
,
3
)
==
0
&&
strlen
(
CDO_progname
)
>
3
)
noff
=
3
;
if
(
noff
)
setDefaultFileType
(
CDO_progname
+
noff
,
0
);
get_env_vars
();
init_modules
();
...
...
src/cdo_int.h
View file @
25b35aa7
...
...
@@ -103,10 +103,10 @@ enum T_EIGEN_MODE {JACOBI, DANIELSON_LANCZOS};
#endif
#define NEW_2D(T, P2D, N, M) T **P2D = (N)?new T*[(N)]:nullptr; \
if ((N)) { P2D[0] = (M)?new T[(N)*(M)]:nullptr; \
for ( size_t i = 1; i < (size_t) (N); ++i ) P2D[i] = P2D[0] + i*(M); }
#define DELETE_2D(P2D) if (P2D) { if (P2D[0]) delete[] P2D[0]; delete[] P2D; P2D = nullptr; }
#define
NEW_2D(T, P2D, N, M) T **P2D = (N)?new T*[(N)]:nullptr; \
if ((N)) { P2D[0] = (M)?new T[(N)*(M)]:nullptr; \
for ( size_t i = 1; i < (size_t) (N); ++i ) P2D[i] = P2D[0] + i*(M); }
#define
DELETE_2D(P2D) if (P2D) { if (P2D[0]) delete[] P2D[0]; delete[] P2D; P2D = nullptr; }
#define IX2D(y,x,nx) ((y)*(nx)+(x))
...
...
src/getRSS.c
0 → 100644
View file @
25b35aa7
/*
* Author: David Robert Nadeau
* Site: http://NadeauSoftware.com/
* License: Creative Commons Attribution 3.0 Unported License
* http://creativecommons.org/licenses/by/3.0/deed.en_US
*/
#if defined(_WIN32)
#include
<windows.h>
#include
<psapi.h>
#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))
#include
<unistd.h>
#include
<sys/resource.h>
#if defined(__APPLE__) && defined(__MACH__)
#include
<mach/mach.h>
#elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__)))
#include
<fcntl.h>
#include
<procfs.h>
#elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__)
#include
<stdio.h>
#endif
#else
#error "Cannot define getPeakRSS( ) or getCurrentRSS( ) for an unknown OS."
#endif
/**
* Returns the peak (maximum so far) resident set size (physical
* memory use) measured in bytes, or zero if the value cannot be
* determined on this OS.
*/
size_t
getPeakRSS
(
)
{
#if defined(_WIN32)
/* Windows -------------------------------------------------- */
PROCESS_MEMORY_COUNTERS
info
;
GetProcessMemoryInfo
(
GetCurrentProcess
(
),
&
info
,
sizeof
(
info
)
);
return
(
size_t
)
info
.
PeakWorkingSetSize
;
#elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__)))
/* AIX and Solaris ------------------------------------------ */
struct
psinfo
psinfo
;
int
fd
=
-
1
;
if
(
(
fd
=
open
(
"/proc/self/psinfo"
,
O_RDONLY
))
==
-
1
)
return
(
size_t
)
0L
;
/* Can't open? */
if
(
read
(
fd
,
&
psinfo
,
sizeof
(
psinfo
)
)
!=
sizeof
(
psinfo
)
)
{
close
(
fd
);
return
(
size_t
)
0L
;
/* Can't read? */
}
close
(
fd
);
return
(
size_t
)(
psinfo
.
pr_rssize
*
1024L
);
#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))
/* BSD, Linux, and OSX -------------------------------------- */
struct
rusage
rusage
;
getrusage
(
RUSAGE_SELF
,
&
rusage
);
#if defined(__APPLE__) && defined(__MACH__)
return
(
size_t
)
rusage
.
ru_maxrss
;
#else
return
(
size_t
)(
rusage
.
ru_maxrss
*
1024L
);
#endif
#else
/* Unknown OS ----------------------------------------------- */
return
(
size_t
)
0L
;
/* Unsupported. */
#endif
}
/**
* Returns the current resident set size (physical memory use) measured
* in bytes, or zero if the value cannot be determined on this OS.
*/
size_t
getCurrentRSS
(
)
{
#if defined(_WIN32)
/* Windows -------------------------------------------------- */
PROCESS_MEMORY_COUNTERS
info
;
GetProcessMemoryInfo
(
GetCurrentProcess
(
),
&
info
,
sizeof
(
info
)
);
return
(
size_t
)
info
.
WorkingSetSize
;
#elif defined(__APPLE__) && defined(__MACH__)
/* OSX ------------------------------------------------------ */
struct
mach_task_basic_info
info
;
mach_msg_type_number_t
infoCount
=
MACH_TASK_BASIC_INFO_COUNT
;
if
(
task_info
(
mach_task_self
(
),
MACH_TASK_BASIC_INFO
,
(
task_info_t
)
&
info
,
&
infoCount
)
!=
KERN_SUCCESS
)
return
(
size_t
)
0L
;
/* Can't access? */
return
(
size_t
)
info
.
resident_size
;
#elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__)
/* Linux ---------------------------------------------------- */
long
rss
=
0L
;
FILE
*
fp
=
NULL
;
if
(
(
fp
=
fopen
(
"/proc/self/statm"
,
"r"
))
==
NULL
)
return
(
size_t
)
0L
;
/* Can't open? */
if
(
fscanf
(
fp
,
"%*s%ld"
,
&
rss
)
!=
1
)
{
fclose
(
fp
);
return
(
size_t
)
0L
;
/* Can't read? */
}
fclose
(
fp
);
return
(
size_t
)
rss
*
(
size_t
)
sysconf
(
_SC_PAGESIZE
);
#else
/* AIX, BSD, Solaris, and Unknown OS ------------------------ */
return
(
size_t
)
0L
;
/* Unsupported. */
#endif
}
src/process.cc
View file @
25b35aa7
...
...
@@ -335,9 +335,9 @@ void
process_t
::
defPrompt
()
{
if
(
m_ID
==
0
)
sprintf
(
prompt
,
"%s %s"
,
P
rogname
,
operatorName
);
sprintf
(
prompt
,
"%s %s"
,
CDO_p
rogname
,
operatorName
);
else
sprintf
(
prompt
,
"%s(%d) %s"
,
P
rogname
,
m_ID
+
1
,
operatorName
);
sprintf
(
prompt
,
"%s(%d) %s"
,
CDO_p
rogname
,
m_ID
+
1
,
operatorName
);
}
const
char
*
...
...
@@ -1241,6 +1241,10 @@ processClosePipes(void)
}
}
extern
"C"
{
size_t
getPeakRSS
(
);
}
void
cdoFinish
(
void
)
{
...
...
@@ -1327,9 +1331,8 @@ cdoFinish(void)
{
int
mu
[]
=
{
'b'
,
'k'
,
'm'
,
'g'
,
't'
};
int
muindex
=
0
;
long
memmax
;
memmax
=
memTotal
();
// size_t memmax = memTotal();
size_t
memmax
=
getPeakRSS
();
while
(
memmax
>
9999
)
{
memmax
/=
1024
;
...
...
@@ -1337,7 +1340,7 @@ cdoFinish(void)
}
if
(
memmax
)
snprintf
(
memstring
,
sizeof
(
memstring
),
" %
ld
%c
"
,
memmax
,
mu
[
muindex
]);
snprintf
(
memstring
,
sizeof
(
memstring
),
" %
zu
%c"
,
memmax
,
mu
[
muindex
]);
processEndTime
(
&
p_usertime
,
&
p_systime
);
p_cputime
=
p_usertime
+
p_systime
;
...
...
@@ -1352,11 +1355,11 @@ cdoFinish(void)
#if defined(HAVE_SYS_TIMES_H)
if
(
cdoBenchmark
)
fprintf
(
stderr
,
" ( %.2fs %.2fs %.2fs
%s)
\n
"
,
c_usertime
,
c_systime
,
c_cputime
,
memstring
);
fprintf
(
stderr
,
" ( %.2fs %.2fs %.2fs%s
)
\n
"
,
c_usertime
,
c_systime
,
c_cputime
,
memstring
);
else
{
if
(
!
cdoSilentMode
)
fprintf
(
stderr
,
" ( %.2fs )
\n
"
,
c_cputime
);
fprintf
(
stderr
,
" ( %.2fs
%s
)
\n
"
,
c_cputime
,
memstring
);
}
if
(
cdoBenchmark
&&
processID
==
0
)
fprintf
(
stderr
,
"total: user %.2fs sys %.2fs cpu %.2fs mem%s
\n
"
,
p_usertime
,
p_systime
,
p_cputime
,
memstring
);
...
...
src/util.cc
View file @
25b35aa7
...
...
@@ -45,17 +45,12 @@
#endif
/* refactor: moved here from *.c */
int
CDO_opterr
=
0
;
const
char
*
CDO_optarg
=
NULL
;
int
CDO_optind
=
1
;
int
CDO_opterr
=
0
;
// refactor: moved here from cdo_getopt.cc
const
char
*
CDO_optarg
=
NULL
;
// refactor: moved here from cdo_getopt.cc
int
CDO_optind
=
1
;
// refactor: moved here from cdo_getopt.cc
/* refactor: moved here from cdo.cc */
char
*
Progname
;
const
char
*
CDO_Version
=
"Climate Data Operators version "
VERSION
" (http://mpimet.mpg.de/cdo)"
;
const
char
*
CDO_progname
=
NULL
;
const
char
*
CDO_version
=
"Climate Data Operators version "
VERSION
" (http://mpimet.mpg.de/cdo)"
;
int
ompNumThreads
=
1
;
...
...
@@ -69,7 +64,7 @@ int cdoDefaultFileType = CDI_UNDEFID;
int
cdoDefaultDataType
=
CDI_UNDEFID
;
int
cdoDefaultByteorder
=
CDI_UNDEFID
;
int
cdoDefaultTableID
=
CDI_UNDEFID
;
int
cdoDefaultInstID
=
CDI_UNDEFID
;
// moved here from institution.cc, was UNDEFID
int
cdoDefaultInstID
=
CDI_UNDEFID
;
int
cdoDefaultTimeType
=
CDI_UNDEFID
;
int
cdoLockIO
=
FALSE
;
...
...
@@ -113,7 +108,7 @@ char **cdoVarnames = NULL;
char
CDO_File_Suffix
[
32
];
int
cdoExpMode
=
-
1
;
const
char
*
cdoExpName
=
NULL
;
const
char
*
cdoExpName
=
NULL
;
int
timer_read
,
timer_write
;
...
...
@@ -126,8 +121,8 @@ const char *cdoComment(void)
{
init
=
true
;
int
size
=
strlen
(
CDO_
V
ersion
);
strncat
(
comment
,
CDO_
V
ersion
,
size
);
int
size
=
strlen
(
CDO_
v
ersion
);
strncat
(
comment
,
CDO_
v
ersion
,
size
);
comment
[
size
]
=
0
;
}
...
...
@@ -185,7 +180,7 @@ void cdo_omp_set_num_threads(int nthreads)
}
char
*
getProgname
(
char
*
string
)
const
char
*
getProgname
(
char
*
string
)
{
#if defined(_WIN32)
/* progname = strrchr(string, '\\'); */
...
...
@@ -194,8 +189,10 @@ char *getProgname(char *string)
char
*
progname
=
strrchr
(
string
,
'/'
);
#endif
if
(
progname
==
NULL
)
progname
=
string
;
else
progname
++
;
if
(
progname
==
NULL
)
progname
=
string
;
else
progname
++
;
return
progname
;
}
...
...
@@ -223,10 +220,7 @@ const char *getOperatorName(const char *operatorCommand)
if
(
operatorCommand
)
{
if
(
operatorCommand
[
0
]
==
'-'
)
{
operatorCommand
++
;
}
if
(
operatorCommand
[
0
]
==
'-'
)
operatorCommand
++
;
char
*
commapos
=
(
char
*
)
strchr
(
operatorCommand
,
','
);
size_t
len
=
(
commapos
!=
NULL
)
?
(
size_t
)(
commapos
-
operatorCommand
)
:
strlen
(
operatorCommand
);
...
...
@@ -238,10 +232,11 @@ const char *getOperatorName(const char *operatorCommand)
/* return operatorName; */
if
(
is_alias
(
operatorName
))
{
operatorName
=
get_original
(
operatorName
);
}
return
operatorName
;
{
operatorName
=
get_original
(
operatorName
);
}
return
operatorName
;
}
char
*
getOperatorArg
(
const
char
*
p_operatorCommand
)
...
...
@@ -251,7 +246,6 @@ char *getOperatorArg(const char *p_operatorCommand)
if
(
p_operatorCommand
)
{
char
*
commapos
=
(
char
*
)
strchr
(
p_operatorCommand
,
','
);
if
(
commapos
)
{
size_t
len
=
strlen
(
commapos
+
1
);
...
...
@@ -273,7 +267,6 @@ char *getFileArg(char *argument)
if
(
argument
)
{
char
*
blankpos
=
strchr
(
argument
,
' '
);
if
(
blankpos
)
{
char
*
parg
=
blankpos
+
1
;
...
...
@@ -328,13 +321,11 @@ void input_int(char *arg, int intarr[], int maxint, int *nintfound)
std
::
string
string2lower
(
std
::
string
str
)
{
std
::
string
lower_case_string
=
str
;
for
(
char
c
:
str
)
{
c
=
tolower
(
c
);
}
return
lower_case_string
;
std
::
string
lower_case_string
=
str
;
for
(
char
c
:
str
)
c
=
tolower
(
c
);
return
lower_case_string
;
}
void
strtolower
(
char
*
str
)
{
if
(
str
)
...
...
@@ -502,9 +493,7 @@ int month_to_season(int month)
return
seas
;
}
//#include <sys/types.h>
#include
<sys/stat.h>
//#include <unistd.h>
bool
fileExists
(
const
char
*
restrict
filename
)
{
...
...
src/util.h
View file @
25b35aa7
...
...
@@ -43,8 +43,12 @@
#define UNCHANGED_RECORD (processSelf().m_ID == 0 && cdoStreamName(0)->argv[0][0] != '-' && cdoRegulargrid == FALSE && cdoDefaultFileType == -1 && cdoDefaultDataType == -1 && cdoDefaultByteorder == -1 )
#define ITSME (strcmp(CDO_username, "\x6d\x32\x31\x34\x30\x30\x33") == 0)
#include
<string>
extern
char
*
Progname
;
extern
const
char
*
CDO_progname
;
extern
const
char
*
CDO_version
;
extern
const
char
*
CDO_username
;
extern
char
*
cdoGridSearchDir
;
extern
int
CDO_Reduce_Dim
;
extern
int
CDO_Memtype
;
...
...
@@ -109,12 +113,9 @@ extern int cdoNumVarnames;
extern
char
**
cdoVarnames
;
extern
char
CDO_File_Suffix
[
32
];
// refactor: added keyword extern
extern
const
char
*
CDO_Version
;
char
*
getProgname
(
char
*
string
);
const
char
*
getProgname
(
char
*
string
);
char
*
GetOperator
(
const
char
*
argument
);
const
char
*
getOperatorName
(
const
char
*
operatorCommand
);
char
*
getOperatorArg
(
const
char
*
operatorCommand
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment