Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
296aa8d
fixed Math.sac for sac_int
sbscholz Jan 21, 2026
07c9faf
missing C implementations
sbscholz Jan 21, 2026
4fec4a8
Update environment
Jan 21, 2026
d5b1a20
Modify file system
Jan 21, 2026
ee37181
ComplexIO
Jan 21, 2026
57871f2
no sac_int needed, use long to avoid cast altogether
JordyAaldering Jan 21, 2026
ee75643
sac_int in cmdline
JordyAaldering Jan 21, 2026
608cd45
SAC_MALLOC expects a size_t
JordyAaldering Jan 21, 2026
ba68fe9
SAC_MALLOC expects a size_t
JordyAaldering Jan 21, 2026
8e0287c
inserted missing ampersands
sbscholz Jan 21, 2026
47026ea
get rid of SACs malloc and FREE
sbscholz Jan 21, 2026
3e72d50
just a cast needed for runtimerror
JordyAaldering Jan 21, 2026
e0ea906
the errors are just #define constants, so no cast needed
JordyAaldering Jan 21, 2026
9775283
sac_int in failsucc
JordyAaldering Jan 21, 2026
2e27b3d
add sac_int to strerror
JordyAaldering Jan 21, 2026
665ed28
add sac_int to dir
JordyAaldering Jan 21, 2026
0765304
add sac_int to getopt
JordyAaldering Jan 21, 2026
93a72c6
convert clock to sac_int
JordyAaldering Jan 21, 2026
56cefd7
oops, I did a booboo
JordyAaldering Jan 21, 2026
5284a37
use index types branch
JordyAaldering Jan 21, 2026
0cef93e
macos13 was retired
JordyAaldering Jan 21, 2026
1f95208
macos13 was retired
JordyAaldering Jan 21, 2026
7d13322
Char.sac
Jan 21, 2026
3951337
Constants
Jan 21, 2026
f902e0d
Precedence fix
Jan 21, 2026
24963c7
Fix
Jan 21, 2026
8ffb153
Benchmarking
Jan 21, 2026
471b3f0
System
Jan 21, 2026
4dbf370
use default sac2c branch (will fail the first time)
JordyAaldering Jan 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 4 additions & 53 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
sudo apt install xsltproc -y
- name: Install sac2c
run: |
git clone --recursive --single-branch https://gitlab.sac-home.org/sac-group/sac2c.git
git clone --single-branch --recursive https://gitlab.sac-home.org/sac-group/sac2c.git
cd sac2c
make release -j2
cp build_p/sac2c_p /usr/local/bin/sac2c
Expand Down Expand Up @@ -52,57 +52,8 @@ jobs:
make all
./test.sh

build-macos-x86:
runs-on: macos-13
steps:
- name: Get HEAD and submodules
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'
- name: Install dependencies
run: |
brew update
brew install libxslt
- name: Set XCode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '14.2'
- name: Install sac2c
run: |
git clone --recursive --single-branch https://gitlab.sac-home.org/sac-group/sac2c.git
cd sac2c
make release -j2
cp build_p/sac2c_p /usr/local/bin/sac2c
sac2c -V
- name: Create build dir
run: |
cmake -E make_directory ${{runner.workspace}}/build
- name: Configure build-system
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake ${GITHUB_WORKSPACE}
- name: Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
cmake --build . -j4 >&1 | tee build.log
if [ ${PIPESTATUS[0]} -ne 0 ]; then
echo "!!! ERROR detected in build !!!";
exit 1;
fi
${GITHUB_WORKSPACE}/ci/fail-on-warning.sh build.log
- name: Test
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
git clone --single-branch https://github.com/SacBase/IntegrationTests.git
cd IntegrationTests
make all
./test.sh

build-macos-arm:
runs-on: macos-15
runs-on: macos-latest
steps:
- name: Get HEAD and submodules
uses: actions/checkout@v2
Expand All @@ -116,10 +67,10 @@ jobs:
- name: Set XCode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '16.2'
xcode-version: latest-stable
- name: Install sac2c
run: |
git clone --recursive --single-branch https://gitlab.sac-home.org/sac-group/sac2c.git
git clone --single-branch --recursive https://gitlab.sac-home.org/sac-group/sac2c.git
cd sac2c
make release -j2
cp build_p/sac2c_p /usr/local/bin/sac2c
Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ SET (C_DEPS_SRC
numerical/src/Math/int_log.c
numerical/src/Math/sign.c
numerical/src/Math/isnan.c
numerical/src/Math/frexp.c
numerical/src/Math/ldexp.c
numerical/src/Math/isinf.c
numerical/src/Math/isfinite.c
random/src/Xoshiro.c
Expand Down
18 changes: 9 additions & 9 deletions src/auxiliary/src/C99Benchmarking/bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
static const char * unitName[] = {"s", "ms", "us", "ns"};

struct bench {
int num;
sac_int num;
char * name;
int timeUnit;
sac_int timeUnit;
double startTime;
double stopTime;
};
Expand Down Expand Up @@ -51,7 +51,7 @@ char* benchName( struct bench* interval)
return( newName);
}

int benchNum( struct bench* interval)
sac_int benchNum( struct bench* interval)
{
return( interval->num);
}
Expand All @@ -64,7 +64,7 @@ char* benchUnitName( struct bench* interval)
return( unit_name);
}

int benchUnit( struct bench* interval)
sac_int benchUnit( struct bench* interval)
{
return( interval->timeUnit);
}
Expand All @@ -74,7 +74,7 @@ void benchCreate( struct bench** interval)
/* benchGetInterval actually creates the data structure */
}

struct bench* benchGetInterval_si(char * name, int num)
struct bench* benchGetInterval_si(char * name, sac_int num)
{
struct bench *interval;
char* newName;
Expand All @@ -87,7 +87,7 @@ struct bench* benchGetInterval_si(char * name, int num)
return( interval);
}

struct bench* benchGetInterval_i( int num)
struct bench* benchGetInterval_i( sac_int num)
{
struct bench *interval;
interval = benchGetInterval_si("\0", num);
Expand All @@ -101,7 +101,7 @@ struct bench* benchGetInterval_s( char *name)
return( interval);
}

struct bench* benchGetInterval_siu(char * name, int num, int timeunit)
struct bench* benchGetInterval_siu(char * name, sac_int num, sac_int timeunit)
{
struct bench *interval;
char* newName;
Expand All @@ -114,14 +114,14 @@ struct bench* benchGetInterval_siu(char * name, int num, int timeunit)
return( interval);
}

struct bench* benchGetInterval_iu( int num, int timeunit)
struct bench* benchGetInterval_iu( sac_int num, sac_int timeunit)
{
struct bench *interval;
interval = benchGetInterval_siu("\0", num, timeunit);
return( interval);
}

struct bench* benchGetInterval_su( char *name, int timeunit)
struct bench* benchGetInterval_su( char *name, sac_int timeunit)
{
struct bench *interval;
interval = benchGetInterval_siu(name, -1, timeunit);
Expand Down
18 changes: 9 additions & 9 deletions src/auxiliary/src/CudaBenchmarking/bench.cu
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ extern "C" {
static const char * unitName[] = {"s", "ms", "us", "ns"};

struct cudabench {
int num;
sac_int num;
char * name;
int timeUnit;
sac_int timeUnit;
cudaEvent_t start;
cudaEvent_t stop;
};
Expand Down Expand Up @@ -57,7 +57,7 @@ char* benchName( struct cudabench* interval)
return( newName);
}

int benchNum( struct cudabench* interval)
sac_int benchNum( struct cudabench* interval)
{
return( interval->num);
}
Expand All @@ -70,7 +70,7 @@ char* benchUnitName( struct cudabench* interval)
return( unit_name);
}

int benchUnit( struct cudabench* interval)
sac_int benchUnit( struct cudabench* interval)
{
return( interval->timeUnit);
}
Expand All @@ -80,7 +80,7 @@ void benchCreate( struct cudabench** interval)
/* benchGetInterval actually creates the data structure */
}

struct cudabench* benchGetInterval_si(char * name, int num)
struct cudabench* benchGetInterval_si(char * name, sac_int num)
{
struct cudabench *interval;
char* newName;
Expand All @@ -93,7 +93,7 @@ struct cudabench* benchGetInterval_si(char * name, int num)
return( interval);
}

struct cudabench* benchGetInterval_i( int num)
struct cudabench* benchGetInterval_i( sac_int num)
{
struct cudabench *interval;
interval = benchGetInterval_si("\0", num);
Expand All @@ -107,7 +107,7 @@ struct cudabench* benchGetInterval_s( char *name)
return( interval);
}

struct cudabench* benchGetInterval_siu(char * name, int num, int timeunit)
struct cudabench* benchGetInterval_siu(char * name, sac_int num, sac_int timeunit)
{
struct cudabench *interval;
char* newName;
Expand All @@ -120,14 +120,14 @@ struct cudabench* benchGetInterval_siu(char * name, int num, int timeunit)
return( interval);
}

struct cudabench* benchGetInterval_iu( int num, int timeunit)
struct cudabench* benchGetInterval_iu( sac_int num, sac_int timeunit)
{
struct cudabench *interval;
interval = benchGetInterval_siu("\0", num, timeunit);
return( interval);
}

struct cudabench* benchGetInterval_su( char *name, int timeunit)
struct cudabench* benchGetInterval_su( char *name, sac_int timeunit)
{
struct cudabench *interval;
interval = benchGetInterval_siu(name, -1, timeunit);
Expand Down
10 changes: 8 additions & 2 deletions src/numerical/Math.sac
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,26 @@ external float exp(float X);

external double, int frexp(double X);
#pragma linksign [0,2,1]
#pragma linkname "SAC_MATH_frexp"
#pragma linkobj "src/Math/frexp.o"
#pragma header "<math.h>"

external float, int frexp(float X);
#pragma linksign [0,2,1]
#pragma linkname "frexpf"
#pragma linkname "SAC_MATH_frexpf"
#pragma linkobj "src/Math/frexp.o"
#pragma header "<math.h>"

external double ldexp(double X, int EXP);
#pragma linksign [0,1,2]
#pragma linkname "SAC_MATH_ldexp"
#pragma linkobj "src/Math/ldexp.o"
#pragma header "<math.h>"

external float ldexp(float X, int EXP);
#pragma linksign [0,1,2]
#pragma linkname "ldexpf"
#pragma linkname "SAC_MATH_ldexpf"
#pragma linkobj "src/Math/ldexp.o"
#pragma header "<math.h>"

external double log(double X);
Expand Down
29 changes: 29 additions & 0 deletions src/numerical/src/Math/frexp.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Dealing with sac_int arguments.
*/
#include <math.h>
#include "sacinterface.h"

double SAC_MATH_frexp( double val, sac_int *exp)
{
int ex;
double res;

res = frexp (val, &ex);

*exp = (sac_int)ex;

return res;
}

float SAC_MATH_frexpf( float val, sac_int *exp)
{
int ex;
float res;

res = frexpf (val, &ex);

*exp = (sac_int)ex;

return res;
}
15 changes: 15 additions & 0 deletions src/numerical/src/Math/ldexp.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Dealing with sac_int arguments.
*/
#include <math.h>
#include "sacinterface.h"

double SAC_MATH_ldexp( double val, sac_int exp)
{
return ldexp (val, (int)exp);
}

float SAC_MATH_ldexpf( float val, sac_int exp)
{
return ldexpf (val, (int)exp);
}
28 changes: 14 additions & 14 deletions src/stdio/src/ComplexIO/PrintComplexArray.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
#include <stdio.h>
#include <stdarg.h>

#include "sac.h"
#include "sacinterface.h"

#define COMPLEX 1

typedef char* string;
typedef double complex[2];

static
int Index2Offset( int dim, int *shp, int *index)
sac_int Index2Offset( sac_int dim, sac_int *shp, sac_int *index)
{
int i,n;
int offset=0;
int fact;
sac_int i,n;
sac_int offset=0;
sac_int fact;

for (i=0; i<dim; i++) {
fact=1;
Expand All @@ -31,17 +31,17 @@ int Index2Offset( int dim, int *shp, int *index)
return(offset);
}

static void PrintArr(FILE *stream, int typeflag, string format, int dim, int * shp, void *a)
static void PrintArr(FILE *stream, int typeflag, string format, sac_int dim, sac_int * shp, void *a)
{
int i,n, element_count;
sac_int i,n, element_count;
char *space=" ";
int *index;
sac_int *index;

fprintf(stream, "Dimension: %2i\n", dim);
fprintf(stream, "Dimension: %" PRIisac "\n", dim);
fprintf(stream, "Shape : <");
element_count = 1;
for (i=0;i<dim;) {
fprintf(stream, " %2i", shp[i]);
fprintf(stream, " %" PRIisac, shp[i]);
element_count = element_count * shp[i];
i++;
if (i<dim) {
Expand Down Expand Up @@ -70,7 +70,7 @@ static void PrintArr(FILE *stream, int typeflag, string format, int dim, int * s
fprintf(stream, "<>\n");
} else {

index = SAC_MALLOC(dim * sizeof(int));
index = (sac_int *)malloc(dim * sizeof(sac_int));
for (i=0; i<dim; i++) {
index[i]=0;
}
Expand Down Expand Up @@ -130,20 +130,20 @@ static void PrintArr(FILE *stream, int typeflag, string format, int dim, int * s

fprintf(stream, "\n");

SAC_FREE(index);
free(index);
} /* if (element_count == 0) */
} else {
SAC_RuntimeError ("Dimension is less than 0, aborting!");
}

}

void COMPLEXIO__PrintComplexArray( FILE *stream, int dim, int * shp, complex * a)
void COMPLEXIO__PrintComplexArray( FILE *stream, sac_int dim, sac_int * shp, complex * a)
{
PrintArr(stream, COMPLEX, "(%.g, %.g) ", dim, shp, a);
}

void COMPLEXIO__PrintComplexArrayFormat( FILE *stream, string format, int dim, int * shp, complex * a)
void COMPLEXIO__PrintComplexArrayFormat( FILE *stream, string format, sac_int dim, sac_int * shp, complex * a)
{
PrintArr(stream, COMPLEX, format, dim, shp, a);
}
Loading
Loading