int main() { int nU, nX, nY; // Довжина універсалу, множин X, Y printf("Введіть універсальну множину"); int* universal = inputSet(nU); printf("\nВведіть множину Х"); int* x = inputSet(nX, universal, nU); printf("\nВведіть множину У"); int *y = inputSet(nY, universal, nU); printf("\nОтримані множини:"); printSet(universal, nU); printSet(x, nX); printSet(y, nY); printUnion(x, nX, y, nY); printIntersect(x, nX, y, nY); printDiff(x, nX, y, nY); printDiff(y, nY, x, nX); printInverse(x, nX, universal, nU); printInverse(y, nY, universal, nU); printLinearMultiply(x, nX, y, nY); free(universal); free(x); free(y); }
void JBAddObj::engine(int n, JLinkObj& link) { JString oldv = value; inputSet(n).forEachChild(DoBAddEngin, (void**)&(value=JBlock())); if (value != oldv) broadcast(0); }
void JCAddObj::engine(int n, JLinkObj& link) { jcomplex oldv = value; inputSet(n).forEachChild(DoCAddEngin, (void**)&(value = 0.0)); if (value != oldv) broadcast(0); }
void JMaxObj::engine(int n, JLinkObj& link) { int oldv = value; inputSet(n).forEachChild(DoMaxEngin, (void**)&(value = JInteger::MIN_VALUE)); if (value != oldv) broadcast(n); }
void JORObj::engine(int n, JLinkObj& link) { int oldv = value; inputSet(n).forEachChild(DoOREngin, (void**)&(value = 0)); value &= mask; if (value != oldv) broadcast(0); }
void JSampleObj::access(int n, JLinkObj& link, const JDataType& data) { if (control) { JLinkObj* prev = (JLinkObj*)inputSet(n+IN_LAST).first(); if (prev) { if (!valueCounter++) prev->access(data); valueCounter--; } } }
void JBSubObj::putResult() { JBlock ov = value; int dest = end; int sz = block.size(); if (sz > 0) { begin = max(0, min(sz-1, begin)); if (inputSet(IN_END).last()) { if (dest < 0) dest = sz; else dest = max(begin, min(sz, dest)); } else dest = begin+1; value = block(begin, dest); } else value = block; if (value != ov) broadcast(0); }
int JSampleObj::outputType(int n) { int type = JDataType::last; JLinkObj* link = (JLinkObj*)inputSet(n+IN_LAST).first(); if (link) { if (!typeCounter++) type = link->from->outputType(link->fn); typeCounter--; } if (type == JDataType::last) { link = (JLinkObj*)outputSet(n).first(); if (link) { if (!typeCounter++) type = link->to->inputType(link->tn); typeCounter--; } } return type; }
boolean JTNG4Obj::inputAllowed(int n) { switch (n) { case IN_C: case IN_CCONFIG: return !inputSet(IN_A1).last() && !inputSet(IN_A2).last() && !inputSet(IN_A3).last() && !inputSet(IN_A4).last(); case IN_A1: case IN_A2: case IN_A3: case IN_A4: return !inputSet(IN_C).last() && !inputSet(IN_CCONFIG).last() ; } return true; }
boolean JDivideObj::inputAllowed(int n) { return !inputSet(n).last();}
void JTNG4Obj::engine(int n, JLinkObj& link) { switch (n) { case IN_COM: { JBlock data; link.access(JBlockData(data)); int size = data.size(); data.Dereference(); for (int i=0; i<size; i++) processByte((uchar)data[i]); break; } case IN_A1: { int v; link.access(JIntegerData(v)); vi[IN_A1] = (char)(v & 0xFF); if (!exclusive || !inputSet(IN_CLOCK).last()) procCOM(16); break; } case IN_A2: { int v; link.access(JIntegerData(v)); vi[IN_A2] = (char)(v & 0xFF); if (!exclusive || !inputSet(IN_CLOCK).last()) procCOM(32); break; } case IN_A3: { int v; link.access(JIntegerData(v)); vi[IN_A3] = (char)(v & 0xFF); if (!exclusive || !inputSet(IN_CLOCK).last()) procCOM(64); break; } case IN_A4: { int v; link.access(JIntegerData(v)); vi[IN_A4] = (char)(v & 0xFF); if (!exclusive || !inputSet(IN_CLOCK).last()) procCOM(128); break; } case IN_B: { int v; link.access(JIntegerData(v)); vi[IN_B] = (char)(v & 0xFF); if (!exclusive || !inputSet(IN_CLOCK).last()) procCOM(1); break; } case IN_C: { int v; link.access(JIntegerData(v)); vi[IN_C] = (char)(v & 0xFF); if (!exclusive || !inputSet(IN_CLOCK).last()) procCOM(2); break; } case IN_D: { int v; link.access(JIntegerData(v)); vi[IN_D] = (char)(v & 0xFF); if (!exclusive || !inputSet(IN_CLOCK).last()) procCOM(4); break; } case IN_BCONFIG: { int v; link.access(JIntegerData(v)); vi[IN_BCONFIG] = (char)(v & 0xFF); if (!exclusive || !inputSet(IN_CLOCK).last() && inputSet(IN_B).last()) procCOM(1); break; } case IN_CCONFIG: { int v; link.access(JIntegerData(v)); vi[IN_CCONFIG] = (char)(v & 0xFF); if (!exclusive || !inputSet(IN_CLOCK).last() && inputSet(IN_C).last()) procCOM(2); break; } case IN_DCONFIG: { int v; link.access(JIntegerData(v)); vi[IN_DCONFIG] = (char)(v & 0xFF); if (!exclusive || !inputSet(IN_CLOCK).last() && inputSet(IN_D).last()) procCOM(4); break; } case IN_CLOCK: { int v; link.access(JIntegerData(v)); v = (v != 0); if (v != vi[IN_CLOCK]) { vi[IN_CLOCK] = (char)v; if (v) { char code = 0; if (inputSet(IN_B).last() || inputSet(IN_BCONFIG).last()) code |= 1; if (inputSet(IN_C).last() || inputSet(IN_CCONFIG).last()) code |= 2; if (inputSet(IN_D).last() || inputSet(IN_DCONFIG).last()) code |= 4; if (inputSet(IN_A1).last()) code |= 16; if (inputSet(IN_A2).last()) code |= 32; if (inputSet(IN_A3).last()) code |= 64; if (inputSet(IN_A4).last()) code |= 128; if (code) procCOM(code); } } break; } default: { int v; link.access(JIntegerData(v)); vi[n] = (char)(v & 0xFF); if (!exclusive || !inputSet(IN_CLOCK).last()) procCOM(0); break; } } }
boolean JDelaySustainObj::inputAllowed(int n) { return !inputSet(n).last();}
boolean JSampleObj::inputAllowed(int n) { return (boolean)((n == IN_CONTROL) ? true : !inputSet(n).last());}
boolean JMIDIInObj::inputAllowed(int n) { return (boolean)(!inputSet(n).last());}
int J1DSliderObj::getMin() { return (inputSet(MIN).last()) ? min : 0;}
int J1DSliderObj::getMax() { return (inputSet(MAX).last()) ? max : mask;}
boolean J1DSliderObj::isNBits() { return !inputSet(MAX).last() && !inputSet(MIN).last();}
boolean JLEDObj::inputAllowed(int n) { return (boolean)((!n) ? true : !inputSet(n).last());}
boolean JTimerObj::inputAllowed(int n) { return !inputSet(n).last();}
boolean J1DMObj::inputAllowed(int n) { return (boolean)((n < 2) ? true : !inputSet(n).last());}