50 #define UNKNOWN 01600000000
57 #define Alloc(N,T) (T *) Pmalloc((N)*sizeof(T))
58 #define AllocZero(N,T) (T *) Pcalloc(N, sizeof(T))
59 #define Realloc(V,N,T) V = (T *) Prealloc(V, (N)*sizeof(T))
61 #define Max(a,b) ((a)>(b) ? (a) : (b))
62 #define Min(a,b) ((a)<(b) ? (a) : (b))
64 #define Bit(b) (1 << (b))
65 #define In(b,s) ((s[(b) >> 3]) & Bit((b) & 07))
66 #define SetBit(b,s) (s[(b) >> 3] |= Bit((b) & 07))
68 #define ForEach(v,f,l) for(v=f ; v<=l ; ++v)
70 #define StatBit(a,b) (SpecialStatus[a]&(b))
71 #define Exclude(a) StatBit(a,EXCLUDE)
72 #define Skip(a) StatBit(a,EXCLUDE|SKIP)
73 #define Discrete(a) (MaxAttVal[a] || StatBit(a,DISCRETE))
74 #define Continuous(a) (! MaxAttVal[a] && ! StatBit(a,DISCRETE))
75 #define Ordered(a) StatBit(a,ORDERED)
76 #define DateVal(a) StatBit(a,DATEVAL)
77 #define TimeVal(a) StatBit(a,STIMEVAL)
78 #define TStampVal(a) StatBit(a,TSTMPVAL)
80 #define Space(s) (s==' ' || s=='\n' || s=='\r' || s=='\t')
81 #define SkipComment while ( ( c = InChar(f) ) != '\n' && c != EOF )
83 #define FreeUnlessNil(p) if((p)!=Nil) free(p)
84 #define Free(x) free(x)
89 #define rint(x) ((x)<0 ? (double)((int)((x)-0.5)) :\
90 (double)((int)((x)+0.5)))
91 #define finite(x) _finite(x)
92 #define strdup(x) _strdup(x)
95 #define P1(x) (rint((x)*10) / 10)
97 #define Goodbye(x) exit(x)
98 #define CharWidth(s) ((int) strlen(s))
102 #define BADCLASSTHRESH 1
103 #define LEQCLASSTHRESH 2
106 #define SINGLEATTVAL 5
110 #define BADCOSTCLASS 9
113 #define TOOMANYVALS 12
114 #define BADDISCRETE 13
116 #define BADCTARGET 15
117 #define BADDTARGET 16
124 #define DUPATTNAME 23
125 #define UNKNOWNATT 24
181 #define DefOp(DE) DE._op_code
182 #define DefSVal(DE) DE._operand._s_val
183 #define DefNVal(DE) DE._operand._n_val
222 #define CVal(Case,Attribute) Case[Attribute]._cont_val
223 #define DVal(Case,Attribute) Case[Attribute]._discr_val
224 #define XDVal(Case,Att) (Case[Att]._discr_val & 077777777)
225 #define SVal(Case,Attribute) Case[Attribute]._discr_val
226 #define Class(Case) (*Case)._discr_val
227 #define Weight(Case) (*(Case-1))._cont_val
229 #define Unknown(Case,Att) (DVal(Case,Att)==UNKNOWN)
230 #define UnknownVal(AV) (AV._discr_val==UNKNOWN)
231 #define NotApplic(Case,Att) (DVal(Case,Att)==NA)
232 #define NotApplicVal(AV) (AV._discr_val==NA)
356 void DumpOp(
char OpCode,
int Fi);
383 double *Prob,
Boolean *AttUsed);
384 void FindLeaf(DataRec CaseDesc, Tree T, Tree PT,
float Wt,
double *Prob,
403 void *
Prealloc(
void *Present,
size_t Bytes);
404 void *
Pcalloc(
size_t Number,
unsigned Size);
421 void FreeVector(
void **V,
int First,
int Last);
431 #define TX_Line(l,f) "\n*** line %d of `%s': ", l, f
432 #define E_NOFILE(f,e) "cannot open file %s%s\n", f, e
433 #define E_BADATTNAME "`:' or `:=' expected after attribute name"\
435 #define E_EOFINATT "unexpected eof while reading attribute `%s'\n"
436 #define E_SINGLEATTVAL(a,v) "attribute `%s' has only one value `%s'\n",\
438 #define E_DUPATTNAME "multiple attributes with name `%s'\n"
439 #define E_CWTATTERR "case weight attribute must be continuous\n"
440 #define E_BADATTVAL(v,a) "bad value of `%s' for attribute `%s'\n", v, a
441 #define E_BADNUMBER(a) "value of `%s' changed to `?'\n", a
442 #define E_BADCLASS "bad class value `%s'l\n"
443 #define E_BADCLASSTHRESH "bad class threshold `%s'\n"
444 #define E_LEQCLASSTHRESH "class threshold `%s' <= previous threshold\n"
445 #define E_BADCOSTCLASS "bad class `%s'\n"
446 #define E_BADCOST "bad cost value `%s'\n"
447 #define E_NOMEM "unable to allocate sufficient memory\n"
448 #define E_TOOMANYVALS(a,n) "too many values for attribute `%s'"\
450 #define E_BADDISCRETE "bad number of discrete values for attribute"\
452 #define E_NOTARGET "target attribute `%s' not found\n"
453 #define E_BADCTARGET "target attribute `%s' must be"\
454 " type `continuous'\n"
455 #define E_BADDTARGET "target attribute `%s' must be specified by"\
456 " a list of discrete values\n"
457 #define E_LONGNAME "overlength name: check data file formats\n"
458 #define E_HITEOF "unexpected end of file\n"
459 #define E_MISSNAME "missing name or value before `%s'\n"
460 #define E_BADTSTMP(d,a) "bad timestamp `%s' for attribute `%s'\n", d, a
461 #define E_BADDATE(d,a) "bad date `%s' for attribute `%s'\n", d, a
462 #define E_BADTIME(d,a) "bad time `%s' for attribute `%s'\n", d, a
463 #define E_UNKNOWNATT "unknown attribute name `%s'\n"
464 #define E_BADDEF1(a,s,x) "in definition of attribute `%s':\n"\
465 "\tat `%.12s': expect %s\n", a, s, x
466 #define E_BADDEF2(a,s,x) "in definition of attribute `%s':\n"\
467 "\t`%s': %s\n", a, s, x
468 #define E_BADDEF3 "cannot define target attribute `%s'\n"
469 #define E_BADDEF4 "[warning] target attribute appears in"\
470 " definition of attribute `%s'\n"
471 #define E_SAMEATT(a,b) "[warning] attribute `%s' is identical to"\
472 " attribute `%s'\n", a, b
473 #define EX_MODELFILE(f) "file %s incompatible with .names file\n", f
474 #define E_MFATT "undefined or excluded attribute"
475 #define E_MFATTVAL "undefined attribute value"
476 #define E_MFCLASS "undefined class"
477 #define E_MFEOF "unexpected eof"
478 #define T_ErrorLimit "Error limit exceeded\n"