00001 #include "machine.h"
00002 #include "tpconv.h"
00003 typedef signed char integer1;
00004 typedef short integer2;
00005
00006
00007 #define TCONV(Xtype,Ytype) {\
00008 Xtype *DX;\
00009 Ytype *DY;\
00010 DY=(Ytype *)dy;\
00011 --DY;\
00012 DX=(Xtype *)dx;\
00013 --DX;\
00014 if (*incx == 1 && *incy == 1) {\
00015 for (i = 1; i <= i1; ++i) DY[i] = (Ytype) DX[i];\
00016 }\
00017 else {\
00018 ix = 1;iy = 1;\
00019 if (*incx < 0) {ix = (-i1 + 1) * (*incx) + 1;}\
00020 if (*incy < 0) {iy = (-i1 + 1) * (*incy) + 1;}\
00021 for (i = 1; i <= i1; ++i) {\
00022 DY[iy] = (Ytype) DX[ix];\
00023 ix += *incx;iy += *incy;\
00024 }\
00025 }\
00026 }
00027
00028 int C2F(tpconv)(integer *xtyp, integer *ytyp, integer *n, void *dx, integer *incx, void *dy, integer *incy)
00029 {
00030 integer i1;
00031 static integer i, ix, iy;
00032
00033 i1 = *n;
00034 if (i1 <= 0) return 0;
00035
00036 switch (*xtyp) {
00037 case 0:
00038 switch (*ytyp) {
00039 case 0:
00040 TCONV(double,double);
00041 break;
00042 case 1:
00043 TCONV(double,integer1);
00044 break;
00045 case 2:
00046 TCONV(double,integer2);
00047 break;
00048 case 4:
00049 TCONV(double,integer);
00050 break;
00051 case 11:
00052 TCONV(double,unsigned char);
00053 break;
00054 case 12:
00055 TCONV(double,unsigned short);
00056 break;
00057 case 14:
00058 TCONV(double,unsigned int);
00059 break;
00060 }
00061 break;
00062 case 1:
00063 switch (*ytyp) {
00064 case 0:
00065 TCONV(integer1,double);
00066 break;
00067 case 1:
00068 TCONV(integer1,integer1);
00069 break;
00070 case 2:
00071 TCONV(integer1,integer2);
00072 break;
00073 case 4:
00074 TCONV(integer1,integer);
00075 break;
00076 case 11:
00077 TCONV(integer1,unsigned char);
00078 break;
00079 case 12:
00080 TCONV(integer1,unsigned short);
00081 break;
00082 case 14:
00083 TCONV(integer1,unsigned int);
00084 break;
00085 }
00086 break;
00087 case 2:
00088 switch (*ytyp) {
00089 case 0:
00090 TCONV(integer2,double);
00091 break;
00092 case 1:
00093 TCONV(integer2,integer1);
00094 break;
00095 case 2:
00096 TCONV(integer2,integer2);
00097 break;
00098 case 4:
00099 TCONV(integer2,integer);
00100 break;
00101 case 11:
00102 TCONV(integer2,unsigned char);
00103 break;
00104 case 12:
00105 TCONV(integer2,unsigned short);
00106 break;
00107 case 14:
00108 TCONV(integer2,unsigned int);
00109 break;
00110 }
00111 break;
00112 case 4:
00113 switch (*ytyp) {
00114 case 0:
00115 TCONV(integer,double);
00116 break;
00117 case 1:
00118 TCONV(integer,integer1);
00119 break;
00120 case 2:
00121 TCONV(integer,integer2);
00122 break;
00123 case 4:
00124 TCONV(integer,integer);
00125 break;
00126 case 11:
00127 TCONV(integer,unsigned char);
00128 break;
00129 case 12:
00130 TCONV(integer,unsigned short);
00131 break;
00132 case 14:
00133 TCONV(integer,unsigned int);
00134 break;
00135 }
00136 break;
00137 case 11:
00138 switch (*ytyp) {
00139 case 0:
00140 TCONV(unsigned char,double);
00141 break;
00142 case 1:
00143 TCONV(unsigned char,integer1);
00144 break;
00145 case 2:
00146 TCONV(unsigned char,integer2);
00147 break;
00148 case 4:
00149 TCONV(unsigned char,integer);
00150 break;
00151 case 11:
00152 TCONV(unsigned char,unsigned char);
00153 break;
00154 case 12:
00155 TCONV(unsigned char,unsigned short);
00156 break;
00157 case 14:
00158 TCONV(unsigned char,unsigned int);
00159 break;
00160 }
00161 break;
00162 case 12:
00163 switch (*ytyp) {
00164 case 0:
00165 TCONV(unsigned short,double);
00166 break;
00167 case 1:
00168 TCONV(unsigned short,integer1);
00169 break;
00170 case 2:
00171 TCONV(unsigned short,integer2);
00172 break;
00173 case 4:
00174 TCONV(unsigned short,integer);
00175 break;
00176 case 11:
00177 TCONV(unsigned short,unsigned char);
00178 break;
00179 case 12:
00180 TCONV(unsigned short,unsigned short);
00181 break;
00182 case 14:
00183 TCONV(unsigned short,unsigned int);
00184 break;
00185 }
00186 break;
00187 case 14:
00188 switch (*ytyp) {
00189 case 0:
00190 TCONV(unsigned int,double);
00191 break;
00192 case 1:
00193 TCONV(unsigned int,integer1);
00194 break;
00195 case 2:
00196 TCONV(unsigned int,integer2);
00197 break;
00198 case 4:
00199 TCONV(unsigned int,integer);
00200 break;
00201 case 11:
00202 TCONV(unsigned int,unsigned char);
00203 break;
00204 case 12:
00205 TCONV(unsigned int,unsigned short);
00206 break;
00207 case 14:
00208 TCONV(unsigned int,unsigned int);
00209 break;
00210 }
00211 break;
00212 }
00213 return 0;
00214 }
00215