version 1.1, 1999/10/08 02:12:01 |
version 1.6, 2001/04/12 06:48:25 |
|
|
|
/* $OpenXM: OpenXM/src/kan96xx/Kan/kanExport0.c,v 1.5 2000/12/28 00:07:14 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
#include "datatype.h" |
#include "datatype.h" |
#include "stackm.h" |
#include "stackm.h" |
|
|
struct object rob1,rob2; |
struct object rob1,rob2; |
char *s; |
char *s; |
int i; |
int i; |
|
double f; |
|
double f2; |
/* reports the data type */ |
/* reports the data type */ |
if (key[0] == 't' || key[0] =='e') { |
if (key[0] == 't' || key[0] =='e') { |
if (strcmp(key,"type?")==0) { |
if (strcmp(key,"type?")==0) { |
|
|
if (flag == -1) errorKan1("KdataConversion(): %s", |
if (flag == -1) errorKan1("KdataConversion(): %s", |
"It's not number.\n"); |
"It's not number.\n"); |
return(rob); |
return(rob); |
|
}else if (strcmp(key,"double") == 0) { |
|
/* Check the format. 2.3432 e2 is not allowed. It should be 2.3232e2.*/ |
|
flag = 0; |
|
for (i=0; (obj.lc.str)[i] != '\0'; i++) { |
|
if ((obj.lc.str)[i] > ' ' && flag == 0) flag=1; |
|
else if ((obj.lc.str)[i] <= ' ' && flag == 1) flag = 2; |
|
else if ((obj.lc.str)[i] > ' ' && flag == 2) flag=3; |
|
} |
|
if (flag == 3) errorKan1("KdataConversion(): %s","The data for the double contains blanck(s)"); |
|
/* Read the double. */ |
|
if (sscanf(obj.lc.str,"%lf",&f) <= 0) { |
|
errorKan1("KdataConversion(): %s","It cannot be translated to double."); |
|
} |
|
rob = KpoDouble(f); |
|
return(rob); |
}else if (strcmp(key,"null") == 0) { |
}else if (strcmp(key,"null") == 0) { |
rob = NullObject; |
rob = NullObject; |
return(rob); |
return(rob); |
|
|
break; |
break; |
case Spoly: |
case Spoly: |
if (strcmp(key,"poly")==0) { |
if (strcmp(key,"poly")==0) { |
|
rob = obj; |
return(rob); |
return(rob); |
}else if (strcmp(key,"integer")==0) { |
}else if (strcmp(key,"integer")==0) { |
if (obj.lc.poly == ZERO) return(KpoInteger(0)); |
if (obj.lc.poly == ZERO) return(KpoInteger(0)); |
Line 1358 int c,l,m,n,cc,ll,mm,nn; |
|
Line 1377 int c,l,m,n,cc,ll,mm,nn; |
|
if (!(cc<=ll && ll<=mm && mm<=nn && nn <= n)) return(1); |
if (!(cc<=ll && ll<=mm && mm<=nn && nn <= n)) return(1); |
if (!(cc<c || ll < l || mm < m || nn < n)) { |
if (!(cc<c || ll < l || mm < m || nn < n)) { |
if (WarningNoVectorVariable) { |
if (WarningNoVectorVariable) { |
warningKan("Ring definition: there is no variable to represent vectors.\n"); |
warningKanNoStrictMode("Ring definition: there is no variable to represent vectors.\n"); |
} |
} |
} |
} |
if (!(cc<=c && ll <= l && mm <= m && nn <= n)) return(1); |
if (!(cc<=c && ll <= l && mm <= m && nn <= n)) return(1); |
Line 1719 struct object rule; |
|
Line 1738 struct object rule; |
|
} |
} |
n = getoaSize(rule); |
n = getoaSize(rule); |
|
|
if (of.tag != Spoly) { |
if (of.tag == Spoly) { |
|
}else if (of.tag ==Sclass && ectag(of) == CLASSNAME_recursivePolynomial) { |
|
return(KreplaceRecursivePolynomial(of,rule)); |
|
}else{ |
errorKan1("%s\n"," KoReplace(): The first argument must be a polynomial."); |
errorKan1("%s\n"," KoReplace(): The first argument must be a polynomial."); |
} |
} |
f = KopPOLY(of); |
f = KopPOLY(of); |
Line 2242 struct object KgbExtension(struct object obj) |
|
Line 2264 struct object KgbExtension(struct object obj) |
|
obj1 = getoa(obj,1); |
obj1 = getoa(obj,1); |
if (obj1.tag != Sarray) errorKan1("%s\n","[(toes) array] gbext poly"); |
if (obj1.tag != Sarray) errorKan1("%s\n","[(toes) array] gbext poly"); |
return(KvectorToSchreyer_es(obj1)); |
return(KvectorToSchreyer_es(obj1)); |
|
}else if (strcmp(key,"toe_") == 0) { |
|
if (size != 2) errorKan1("%s\n","[(toe_) array] gbext poly"); |
|
obj1 = getoa(obj,1); |
|
if (obj1.tag == Spoly) return(obj1); |
|
if (obj1.tag != Sarray) errorKan1("%s\n","[(toe_) array] gbext poly"); |
|
return(KpoPOLY(arrayToPOLY(obj1))); |
}else if (strcmp(key,"isOrdered") == 0) { |
}else if (strcmp(key,"isOrdered") == 0) { |
if (size != 2) errorKan1("%s\n","[(isOrdered) poly] gbext poly"); |
if (size != 2) errorKan1("%s\n","[(isOrdered) poly] gbext poly"); |
obj1 = getoa(obj,1); |
obj1 = getoa(obj,1); |
|
|
} |
} |
/* if (Strict) errorKan1("%s\n"," "); */ |
/* if (Strict) errorKan1("%s\n"," "); */ |
if (Strict) errorKan1("%s\n",str); |
if (Strict) errorKan1("%s\n",str); |
|
return(0); |
|
} |
|
|
|
warningKanNoStrictMode(str) |
|
char *str; |
|
{ |
|
extern int Strict; |
|
int t; |
|
t = Strict; |
|
Strict = 0; |
|
warningKan(str); |
|
Strict = t; |
return(0); |
return(0); |
} |
} |
|
|