gensubst.c

Go to the documentation of this file.
00001 #include "machine.h"
00002 typedef signed char integer1;
00003 typedef short integer2;
00004 /*     Copyright INRIA */
00005 
00006 #define SUBST(Type) {\
00007 Type *DX;\
00008 Type *DY;\
00009     DX=(Type *)dx;\
00010     --DX;\
00011     DY=(Type *)dy;\
00012     --DY;\
00013     if (*incx == 1 && *incy == 1){\
00014        for (i = 1; i <= i1; ++i)  DX[i] = DX[i] - DY[i];\
00015     }\
00016     else {\
00017       ix = 1; iy = 1;\
00018       if (*incx < 0) ix = (-(*n) + 1) * *incx + 1;\
00019       if (*incy < 0) iy = (-(*n) + 1) * *incy + 1;\
00020       for (i = 1; i <= i1; ++i) {\
00021         DX[ix] = DX[ix] - DY[iy];\
00022         ix += *incx; iy += *incy;\
00023       }\
00024  }\
00025 }
00026 
00027 
00028 
00029 int C2F(gensubst)(typ, n, dx, incx, dy, incy)
00030 integer *n;
00031 integer *incx;
00032 integer *incy;
00033 integer *typ;
00034 int *dx;
00035 int *dy;
00036 {
00037   static integer i, ix, iy, i1;
00038 
00039   i1 = *n;
00040   if (i1 <= 0) return 0;
00041 
00042   switch (*typ) {
00043   case 1:
00044     SUBST(integer1);
00045     break;
00046   case 2:
00047     SUBST(integer2);
00048     break;
00049   case 4:
00050     SUBST(integer);
00051     break;
00052   case 11:
00053     SUBST(unsigned char);
00054     break;
00055   case 12:
00056     SUBST(unsigned short);
00057     break;
00058   case 14:
00059     SUBST(unsigned int);
00060     break;
00061   }
00062   return 0;
00063 }
00064 

Generated on Sun Mar 4 15:03:57 2007 for Scilab [trunk] by  doxygen 1.5.1