Skip to content

Commit

Permalink
1994-09
Browse files Browse the repository at this point in the history
  • Loading branch information
martiniturbide committed Oct 19, 2016
1 parent c4d6a48 commit 091422b
Show file tree
Hide file tree
Showing 7 changed files with 567 additions and 0 deletions.
115 changes: 115 additions & 0 deletions A-FLOAT.C
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);
}
42 changes: 42 additions & 0 deletions A-FLOAT.H
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
2 changes: 2 additions & 0 deletions BUILD.CMD
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
Loading

0 comments on commit 091422b

Please sign in to comment.