-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c4d6a48
commit 091422b
Showing
7 changed files
with
567 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/* | ||
* a-float.c - functions to allocate arrays of float | ||
* | ||
* copyright (c) 1991, George K. Thiruvathukal | ||
* This file is distributed with the Apt Compiler Toolkit | ||
*/ | ||
|
||
#include "a-float.h" | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#ifdef __STDC__ | ||
float *New1DOffloat (int l1, int h1) | ||
#else | ||
float *New1DOffloat (l1, h1) | ||
int l1, h1; | ||
#endif | ||
{ | ||
float *x = (float *)calloc( (h1 - l1 + 1), sizeof(float)); | ||
if (x == NULL) { | ||
fprintf(stderr,"New1DOffloat: allocation failure.\n"); | ||
return NULL; | ||
} | ||
return x - l1; | ||
} | ||
|
||
#ifdef __STDC__ | ||
float **New2DOffloat (int l1, int h1, int l2, int h2) | ||
#else | ||
float **New2DOffloat (l1, h1, l2, h2) | ||
int l1, h1, l2, h2; | ||
#endif | ||
{ | ||
float **x = (float **)calloc( (h1 - l1 + 1), sizeof(float *)); | ||
int i; | ||
|
||
|
||
if (x == NULL) { | ||
fprintf(stderr,"New2DOffloat: allocation failure; dimension 1\n"); | ||
return NULL; | ||
} | ||
x -= l1; | ||
for (i=l1; i <= h1; i++) { | ||
x[i] = New1DOffloat (l2, h2); | ||
if (x[i] == NULL) { | ||
fprintf(stderr,"New2DOffloat: allocation failure; dimension 2\n"); | ||
return NULL; | ||
} | ||
} | ||
return x; | ||
} | ||
|
||
#ifdef __STDC__ | ||
float ***New3DOffloat (int l1, int h1, int l2, int h2, int l3, int h3) | ||
#else | ||
float ***New3DOffloat (l1, h1, l2, h2, l3, h3) | ||
int l1, h1, l2, h2, l3, h3; | ||
#endif | ||
{ | ||
float ***x = (float ***)calloc( (h1 - l1 + 1), sizeof(float **)); | ||
int i; | ||
|
||
if (x == NULL) { | ||
fprintf(stderr,"New3DOffloat: allocation failure; dimension 1\n"); | ||
return NULL; | ||
} | ||
x -= l1; | ||
for (i=l1; i <= h1; i++) { | ||
x[i] = New2DOffloat (l2, h2, l3, h3); | ||
if (x[i] == NULL) { | ||
fprintf(stderr,"New3DOffloat: allocation failure; dimension 2\n"); | ||
return NULL; | ||
} | ||
} | ||
return x; | ||
} | ||
|
||
#ifdef __STDC__ | ||
void Dispose1DOffloat (float *a) | ||
#else | ||
void Dispose1DOffloat (a) | ||
float *a; | ||
#endif | ||
{ | ||
free(a); | ||
} | ||
|
||
#ifdef __STDC__ | ||
void Dispose2DOffloat (float **a, int l1, int h1) | ||
#else | ||
void Dispose2DOffloat (a, l1, h1) | ||
float **a; | ||
int l1, h1; | ||
#endif | ||
{ | ||
int i; | ||
|
||
for (i=l1; i <= h1; i++) | ||
Dispose1DOffloat (a[i]); | ||
} | ||
|
||
#ifdef __STDC__ | ||
void Dispose3DOffloat (float ***a, int l1, int h1, int l2, int h2) | ||
#else | ||
void Dispose3DOffloat (a, l1, h1, l2, h2) | ||
float ***a; | ||
int l1, h1, l2, h2; | ||
#endif | ||
{ | ||
int i; | ||
|
||
for (i=l1; i <= h1; i++) | ||
Dispose2DOffloat (a[i],l2,h2); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* array.h - header file for the parameterized array package | ||
* author: George K. Thiruvathukal | ||
* note: these routines are supplied with the Apt Compiler Toolkit | ||
* copyright (c); 1991, George K. Thiruvathukal | ||
*/ | ||
|
||
#ifdef __ANSI_C__ | ||
float *New1DOffloat (int l1, int h1); | ||
#else | ||
float *New1DOffloat (); | ||
#endif | ||
|
||
#ifdef __ANSI_C__ | ||
float **New2DOffloat (int l1, int h1, int l2, int h2); | ||
#else | ||
float **New2DOffloat (); | ||
#endif | ||
|
||
#ifdef __ANSI_C__ | ||
float ***New3DOffloat (int l1, int h1, int l2, int h2, int l3, int h3); | ||
#else | ||
float ***New3DOffloat (); | ||
#endif | ||
|
||
#ifdef __ANSI_C__ | ||
void Dispose1DOffloat (float *a); | ||
#else | ||
void Dispose1DOffloat (); | ||
#endif | ||
|
||
#ifdef __ANSI_C__ | ||
void Dispose2DOffloat (float **a, int l1, int h1); | ||
#else | ||
void Dispose2DOffloat (); | ||
#endif | ||
|
||
#ifdef __ANSI_C__ | ||
void Dispose3DOffloat (float ***a, int l1, int h1, int l2, int h2); | ||
#else | ||
void Dispose3DOffloat (); | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@echo off | ||
gcc -o fastgpi -O fastgpi.c a-float.c fastgpi.def |
Oops, something went wrong.