home *** CD-ROM | disk | FTP | other *** search
- /*
- * This file is part of the Livermore Loops transliteration into C.
- * Copyright (C) 1991 by Martin Fouts
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 1, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
- #include "types.h"
- #include "externs.h"
-
- static Float fuzz, buzz, fizz, biased, scaled;
-
- void newbuzz()
- {
- fuzz = 1.2345e-3;
- buzz = 1.0 + fuzz;
- fizz = 1.1 * fuzz;
- }
-
- Float buzzer()
- {
- /* To make C 'Very Much Like' Fortran */ /*GAG*/
-
- buzz = (Float) (( (Float) (1.0 - fuzz)) * buzz) + fuzz;
- fuzz = -fuzz;
- return (Float) ((Float) ( (Float)(buzz - fizz) - (Float) biased) * scaled);
- }
-
- Void lsignal0(skale,bias)
- Float skale, bias;
- {
-
- #ifndef BUZZ
- newbuzz();
- #endif
- scaled= skale;
- biased= bias;
- a11 = buzzer();
- a12 = buzzer();
- a13 = buzzer();
- a21 = buzzer();
- a22 = buzzer();
- a23 = buzzer();
- a31 = buzzer();
- a32 = buzzer();
- a33 = buzzer();
- ar = buzzer();
- br = buzzer();
- c0 = buzzer();
- cr = buzzer();
- di = buzzer();
- dk = buzzer();
- dm22 = buzzer();
- dm23 = buzzer();
- dm24 = buzzer();
- dm25 = buzzer();
- dm26 = buzzer();
- dm27 = buzzer();
- dm28 = buzzer();
- dn = buzzer();
- e3 = buzzer();
- e6 = buzzer();
- expmax = buzzer();
- flx = buzzer();
- q = buzzer();
- qa = buzzer();
- r = buzzer();
- ri = buzzer();
- s = buzzer();
- scale = buzzer();
- sig = buzzer();
- stb5 = buzzer();
- t = buzzer();
- xnc = buzzer();
- xnei = buzzer();
- xnm = buzzer();
- }
-
-
- Void lsignal1(v,scale,bias,n) /* name changed to lsignal to avoid . . . */
- Float v[], scale, bias; /* name conflict under unix. */
- int n;
- {
- Int k;
-
- scaled= scale;
- biased= bias;
- #ifndef BUZZ
- newbuzz();
- #endif
- for (k = 0; k < n; k ++) {
- buzz= (1.0 - fuzz)*buzz +fuzz;
- fuzz= -fuzz;
- v[k]=((buzz- fizz) -biased)*scaled;
- }
- return;
- }
-
- Void lsignal2(v,scale,bias,n1,n2)
- Float v[], scale, bias;
- int n1, n2;
- {
- Int k;
-
- scaled= scale;
- biased= bias;
- #ifndef BUZZ
- newbuzz();
- #endif
- for (k = 0; k < n1 * n2; k ++) {
- buzz= (1.0 - fuzz)*buzz +fuzz;
- fuzz= -fuzz;
- v[k]=((buzz- fizz) -biased)*scaled;
- }
- return;
- }
-
- Void lsignal3(v,scale,bias,n1,n2,n3)
- Float v[], scale, bias;
- int n1, n2, n3;
- {
- Int k;
-
- scaled= scale;
- biased= bias;
- #ifndef BUZZ
- newbuzz();
- #endif
- for (k = 0; k < n1 * n2 * n3; k ++) {
- buzz= (1.0 - fuzz)*buzz +fuzz;
- fuzz= -fuzz;
- v[k]=((buzz- fizz) -biased)*scaled;
- }
- return;
- }
-
-