gencheck.c

Go to the documentation of this file.
00001 #include "machine.h"
00002 #include "gencheck.h"
00003 typedef signed char integer1;
00004 typedef short integer2;
00005 /*     Copyright INRIA */
00006 
00007 #define CHECK(Type) {\
00008 Type *A;\
00009 Type *B;\
00010     A=(Type *)a;\
00011     --A;\
00012     B=(Type *)b;\
00013     --B;\
00014     if (*op == equal) {\
00015         for (i = 1; i <= ii1; ++i) {\
00016             if (A[i1] == B[i2]) {\
00017                 r[i] = 1;\
00018             } else {\
00019                 r[i] = 0;\
00020             }\
00021             i1 += *ia;i2 += *ib;\
00022         }\
00023       }\
00024       else if (*op == less + great) {\
00025         for (i = 1; i <= ii1; ++i) {\
00026             if (A[i1] != B[i2]) {\
00027                 r[i] = 1;\
00028             } else {\
00029                 r[i] = 0;\
00030             }\
00031             i1 += *ia; i2 += *ib;\
00032         }\
00033       }\
00034       else if (*op == less) {\
00035         for (i = 1; i <= ii1; ++i) {\
00036             if (A[i1] < B[i2]) {\
00037                 r[i] = 1;\
00038             } else {\
00039                 r[i] = 0;\
00040             }\
00041             i1 += *ia;i2 += *ib;\
00042         }\
00043       }\
00044       else if (*op == great) {\
00045         for (i = 1; i <= ii1; ++i) {\
00046             if (A[i1] > B[i2]) {\
00047                 r[i] = 1;\
00048             } else {\
00049                 r[i] = 0;\
00050             }\
00051             i1 += *ia;i2 += *ib;\
00052         }\
00053       }\
00054       else if (*op == less + equal) {\
00055         for (i = 1; i <= ii1; ++i) {\
00056             if (A[i1] <= B[i2]) {\
00057                 r[i] = 1;\
00058             } else {\
00059                 r[i] = 0;\
00060             }\
00061             i1 += *ia;i2 += *ib;\
00062         }\
00063       }\
00064       else if (*op == great + equal) {\
00065         for (i = 1; i <= ii1; ++i) {\
00066             if (A[i1] >= B[i2]) {\
00067                 r[i] = 1;\
00068             } else {\
00069                 r[i] = 0;\
00070             }\
00071             i1 += *ia;i2 += *ib;\
00072         }\
00073     }\
00074 }
00075 
00076 
00077 
00078 
00079 int C2F(gencheck)(integer *typ, integer *op, integer *n, int *a, integer *ia, int *b, integer *ib, int *r)
00080 {
00081   static integer i, i1, i2, ii1;
00082   static integer less = 59;
00083   static integer great = 60;
00084   static integer equal = 50;
00085 
00086   --r;
00087   i1 = 1;i2 = 1;
00088   ii1 = *n; 
00089   switch (*typ) {
00090   case 0:
00091     CHECK(double);
00092     break;
00093   case 1:
00094     CHECK(integer1);
00095     break;
00096   case 2:
00097     CHECK(integer2);
00098     break;
00099   case 4:
00100     CHECK(integer);
00101     break;
00102   case 11:
00103     CHECK(unsigned char);
00104     break;
00105   case 12:
00106     CHECK(unsigned short);
00107     break;
00108   case 14:
00109     CHECK(unsigned int);
00110     break;
00111   }
00112   return 0;
00113 }

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