Skip to content

Commit fc0275e

Browse files
author
JanThorbecke
committed
fixing warnings and robustness
1 parent 78d6cb4 commit fc0275e

File tree

6 files changed

+57
-13
lines changed

6 files changed

+57
-13
lines changed

Make_include_OSX

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ ifneq ($(strip $(MKLROOT)),)
9494
endif
9595
else
9696
BLAS = -llapack -lblas
97-
BLAS = /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//usr/lib/liblapack.tbd /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//usr/lib/libblas.tbd
97+
BLAS = /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/liblapack.tbd /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libblas.tbd
9898
endif
9999

100100
#LIBARIES

extrap/lib/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ CSRC = \
1313
getModelInfo.c \
1414
readData.c \
1515
writeData.c \
16+
name_ext.c \
1617
forwExtr.c \
1718
getrecextr.c \
1819
getrecvsp.c \

extrap/lib/name_ext.c

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#include<stdlib.h>
2+
#include<string.h>
3+
#include<stdio.h>
4+
5+
/**
6+
* inserts a character string after the filename, before the extension
7+
*
8+
* AUTHOR:
9+
* Jan Thorbecke ([email protected])
10+
* The Netherlands
11+
**/
12+
13+
14+
void name_ext(char *filename, char *extension)
15+
{
16+
char ext[100];
17+
18+
if (strstr(filename, ".su") != NULL) {
19+
sprintf(ext,"%s.su", extension);
20+
strcpy(strstr(filename, ".su"), ext);
21+
}
22+
else if (strstr(filename, ".segy") != NULL) {
23+
sprintf(ext,"%s.segy", extension);
24+
strcpy(strstr(filename, ".segy"), ext);
25+
}
26+
else if (strstr(filename, ".mat") != NULL) {
27+
sprintf(ext,"%s.mat", extension);
28+
strcpy(strstr(filename, ".mat"), ext);
29+
}
30+
else if (strstr(filename, ".hdf") != NULL) {
31+
sprintf(ext,"%s.hdf", extension);
32+
strcpy(strstr(filename, ".hdf"), ext);
33+
}
34+
else if (strrchr(filename, '.') != NULL) {
35+
sprintf(ext,"%s.su", extension);
36+
strcpy(strrchr(filename, '.'), ext);
37+
}
38+
else {
39+
sprintf(ext,"%s.su", extension);
40+
strcat(filename, ext);
41+
}
42+
43+
return;
44+
}

extrap/lib/verbosepkg.c

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#ifdef _CRAYMPP
66
#include <intrinsics.h>
77
#endif
8+
#ifdef _OPENMP
9+
#include <omp.h>
10+
#endif
811

912
void verr(char *fmt, ...)
1013
{

extrap/main/opercalc.c

+5-12
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ void shortoper(complex *kxwop, int nkx, complex *xwop, int opl, float dx,
1717
float kw, float alfa1_w, float alfa2_w, float scale, int filter);
1818

1919
int writeData(char *filename, float *data, segy *hdrs, int n2);
20+
void name_ext(char *filename, char *extension);
2021

2122
/*********************** self documentation **********************/
2223
char *sdoc[] = {
@@ -296,12 +297,8 @@ int main(int argc, char **argv)
296297
writeData(NULL, data_out, hdrs, n2);
297298
}
298299
else {
299-
s = file_out;
300-
q = &filename[0];
301-
while (*s != '.') *q++ = *s++;
302-
*q++ = '_'; *q++ = 'k'; *q++ = 'x';
303-
while (*s != '\0') *q++ = *s++;
304-
*q = '\0';
300+
strcpy(filename, file_out);
301+
name_ext(filename, "_kx");
305302

306303
if(verbose) vmess("Writing Kx-results to file %s", filename);
307304
writeData(filename, data_out, hdrs, n2);
@@ -343,12 +340,8 @@ int main(int argc, char **argv)
343340
writeData(NULL, data_out, hdrs, n2);
344341
}
345342
else {
346-
s = file_out;
347-
q = &filename[0];
348-
while (*s != '.') *q++ = *s++;
349-
*q++ = '_'; *q++ = 'x';
350-
while (*s != '\0') *q++ = *s++;
351-
*q = '\0';
343+
strcpy(filename, file_out);
344+
name_ext(filename, "_x");
352345

353346
if(verbose) vmess("Writing X-results to file %s", filename);
354347
writeData(filename, data_out, hdrs, n2);

vmar/Marchenko_Iterations.c

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
#ifdef MKL
77
#include<mkl_cblas.h>
88
#endif
9+
#ifdef _OPENMP
10+
#include <omp.h>
11+
#endif
912

1013
typedef struct { /* complex number */
1114
float r,i;

0 commit comments

Comments
 (0)