Skip to content

Commit 091422b

Browse files
1994-09
1 parent c4d6a48 commit 091422b

File tree

7 files changed

+567
-0
lines changed

7 files changed

+567
-0
lines changed

A-FLOAT.C

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/*
2+
* a-float.c - functions to allocate arrays of float
3+
*
4+
* copyright (c) 1991, George K. Thiruvathukal
5+
* This file is distributed with the Apt Compiler Toolkit
6+
*/
7+
8+
#include "a-float.h"
9+
10+
#include <stdio.h>
11+
#include <stdlib.h>
12+
13+
#ifdef __STDC__
14+
float *New1DOffloat (int l1, int h1)
15+
#else
16+
float *New1DOffloat (l1, h1)
17+
int l1, h1;
18+
#endif
19+
{
20+
float *x = (float *)calloc( (h1 - l1 + 1), sizeof(float));
21+
if (x == NULL) {
22+
fprintf(stderr,"New1DOffloat: allocation failure.\n");
23+
return NULL;
24+
}
25+
return x - l1;
26+
}
27+
28+
#ifdef __STDC__
29+
float **New2DOffloat (int l1, int h1, int l2, int h2)
30+
#else
31+
float **New2DOffloat (l1, h1, l2, h2)
32+
int l1, h1, l2, h2;
33+
#endif
34+
{
35+
float **x = (float **)calloc( (h1 - l1 + 1), sizeof(float *));
36+
int i;
37+
38+
39+
if (x == NULL) {
40+
fprintf(stderr,"New2DOffloat: allocation failure; dimension 1\n");
41+
return NULL;
42+
}
43+
x -= l1;
44+
for (i=l1; i <= h1; i++) {
45+
x[i] = New1DOffloat (l2, h2);
46+
if (x[i] == NULL) {
47+
fprintf(stderr,"New2DOffloat: allocation failure; dimension 2\n");
48+
return NULL;
49+
}
50+
}
51+
return x;
52+
}
53+
54+
#ifdef __STDC__
55+
float ***New3DOffloat (int l1, int h1, int l2, int h2, int l3, int h3)
56+
#else
57+
float ***New3DOffloat (l1, h1, l2, h2, l3, h3)
58+
int l1, h1, l2, h2, l3, h3;
59+
#endif
60+
{
61+
float ***x = (float ***)calloc( (h1 - l1 + 1), sizeof(float **));
62+
int i;
63+
64+
if (x == NULL) {
65+
fprintf(stderr,"New3DOffloat: allocation failure; dimension 1\n");
66+
return NULL;
67+
}
68+
x -= l1;
69+
for (i=l1; i <= h1; i++) {
70+
x[i] = New2DOffloat (l2, h2, l3, h3);
71+
if (x[i] == NULL) {
72+
fprintf(stderr,"New3DOffloat: allocation failure; dimension 2\n");
73+
return NULL;
74+
}
75+
}
76+
return x;
77+
}
78+
79+
#ifdef __STDC__
80+
void Dispose1DOffloat (float *a)
81+
#else
82+
void Dispose1DOffloat (a)
83+
float *a;
84+
#endif
85+
{
86+
free(a);
87+
}
88+
89+
#ifdef __STDC__
90+
void Dispose2DOffloat (float **a, int l1, int h1)
91+
#else
92+
void Dispose2DOffloat (a, l1, h1)
93+
float **a;
94+
int l1, h1;
95+
#endif
96+
{
97+
int i;
98+
99+
for (i=l1; i <= h1; i++)
100+
Dispose1DOffloat (a[i]);
101+
}
102+
103+
#ifdef __STDC__
104+
void Dispose3DOffloat (float ***a, int l1, int h1, int l2, int h2)
105+
#else
106+
void Dispose3DOffloat (a, l1, h1, l2, h2)
107+
float ***a;
108+
int l1, h1, l2, h2;
109+
#endif
110+
{
111+
int i;
112+
113+
for (i=l1; i <= h1; i++)
114+
Dispose2DOffloat (a[i],l2,h2);
115+
}

A-FLOAT.H

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* array.h - header file for the parameterized array package
3+
* author: George K. Thiruvathukal
4+
* note: these routines are supplied with the Apt Compiler Toolkit
5+
* copyright (c); 1991, George K. Thiruvathukal
6+
*/
7+
8+
#ifdef __ANSI_C__
9+
float *New1DOffloat (int l1, int h1);
10+
#else
11+
float *New1DOffloat ();
12+
#endif
13+
14+
#ifdef __ANSI_C__
15+
float **New2DOffloat (int l1, int h1, int l2, int h2);
16+
#else
17+
float **New2DOffloat ();
18+
#endif
19+
20+
#ifdef __ANSI_C__
21+
float ***New3DOffloat (int l1, int h1, int l2, int h2, int l3, int h3);
22+
#else
23+
float ***New3DOffloat ();
24+
#endif
25+
26+
#ifdef __ANSI_C__
27+
void Dispose1DOffloat (float *a);
28+
#else
29+
void Dispose1DOffloat ();
30+
#endif
31+
32+
#ifdef __ANSI_C__
33+
void Dispose2DOffloat (float **a, int l1, int h1);
34+
#else
35+
void Dispose2DOffloat ();
36+
#endif
37+
38+
#ifdef __ANSI_C__
39+
void Dispose3DOffloat (float ***a, int l1, int h1, int l2, int h2);
40+
#else
41+
void Dispose3DOffloat ();
42+
#endif

BUILD.CMD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@echo off
2+
gcc -o fastgpi -O fastgpi.c a-float.c fastgpi.def

0 commit comments

Comments
 (0)