示例#1
0
/*
 * Release a single client from a barrier at a time.
 */
static void
release_client(int sock, struct in_addr ipaddr, int istcp, int result)
{
	int	err;
	
	if (istcp) {
		if ((err = writeall(sock, &result, sizeof(result))) <= 0) {
			if (err < 0) {
				errorc("writing to TCP client");
			}
			error("write to TCP client aborted");
		}
		tcpsockets[sock].barrier = NULL;
		close(sock);
	}
	else {
		struct sockaddr_in	client;
		
		client.sin_addr    = ipaddr;
		client.sin_family  = AF_INET;
		client.sin_port    = htons(portnum);

		while( ((err = sendto(sock, &result, sizeof(result), 0,
				      (struct sockaddr *)&client,
				      sizeof(client))) < 0) &&
		       (errno == EINTR) )
		{
			// Nothing to do...
		}
		if (err < 0)
			errorc("writing to UDP client");
	}
}
示例#2
0
Alias<ISource> CountSource::inputCommand(symbolGB &) {
  errorc(__LINE__);
  if(d_count<=0) errorc(__LINE__);
  --d_count;
  if(d_count==0) d_eoi = true;
  return *(Alias<ISource> *)0;
};
示例#3
0
void GrbSource::get(Term& x) {
  char c;
  d_so.peekCharacter(c,"\n *");
  if(c=='+') { 
    d_so.passCharacter();
    d_so.peekCharacter(c,"\n *");
  };
  if(c=='-' || ('0'<=c && c <= '9')) {
    // have a number first
    get(x.Coefficient());
    get(x.MonomialPart());
  } else if('a'<=c && c <= 'z') {
    x.Coefficient().setToOne();
    get(x.MonomialPart());
  } else if('A'<=c && c <= 'Z') {
    x.Coefficient().setToOne();
    get(x.MonomialPart());
  } else if(c=='(') {
    d_so.getCharacter(c,"\n *");
    if(c!='1') errorc(__LINE__);
    d_so.getCharacter(c,"\n *");
    if(c!=')') errorc(__LINE__);
    x.Coefficient().setToOne();
    x.MonomialPart().setToOne();
  } else errorc(__LINE__);
  d_eoi = d_so.eof();
};
示例#4
0
文件: asmeval.c 项目: mingpen/OpenNT
UCHAR PASCAL CODESIZE
popoperator (
	register struct ar	*p
){
	register char op;

	if (!p->lastitem) {
		errorc( E_OPR );  /* expected operator */
		return( (char)OPPLUS );  /* use '+' as default */
	}
	else {
		if (p->lastitem->itype != OPERATOR) {
			errorc( E_OPR );  /* expected operator */
			return( (char)OPPLUS );  /* use '+' as default */
		}
		else {
			/* Return OPERATOR number */
			op = p->lastitem->dsckind.opr.oidx;
			/* Pop OPERATOR off stack */
			itemptr = p->lastitem;
			p->lastitem = p->lastitem->previtem;
			return (op);
		}
	}
}
示例#5
0
文件: asmeval.c 项目: mingpen/OpenNT
VOID PASCAL CODESIZE
signadjust (
	UCHAR	minus,
	register struct exprec *p
){
	register struct psop *psol;	/* parse stack operand structure */
	register struct psop *psor;	/* parse stack operand structure */
	DSCREC	       *t;
	OFFSET maxInt;
	char   fOverflow = FALSE;

	maxInt = (fArth32)? OFFSETMAX: 0xffff;

	psor = &(p->valright->dsckind.opnd);
	psol = &(p->valleft->dsckind.opnd);

	if (psol->s)		  /* arthmethic on data size item - NEAR/FAR */
	    errorc(E_TIL);

	if (minus)
		psor->dsign = !psor->dsign;

	if (psol->dsegment || psol->dflag == XTERNAL ||
	    (M_FLTSTACK & psol->dtype)) {
		/* Want to preserve Left operand */
		t = p->valleft;
		p->valleft = p->valright;
		p->valright = t;
		p->right = p->left;
		p->left = p->valleft->dsckind.opnd.doffset;
		psor = &(p->valright->dsckind.opnd);
		psol = &(p->valleft->dsckind.opnd);
	}
	if (psol->dflag == UNDEFINED)
		psor->dtype = M_CODE | M_FORTYPE;

	if (psor->dflag == UNDEFINED && !(psol->dtype & M_PTRSIZE))
		psol->dsize = 0;

	if (psol->dsign == psor->dsign) {
		/* Signs are same */
		fOverflow = (((maxInt - p->right) + 1) == p->left);
		p->right = p->right + p->left;
	} else if (p->right > p->left)
		/* Different signs */
		p->right = p->right - p->left;
	else {
		p->right = p->left - p->right;
		psor->dsign = !psor->dsign;
	}

	if (p->right == 0 && !fOverflow)
		psor->dsign = FALSE;
	if (psor->dsign && (psor->dtype & M_SEGRESULT))
		errorc (E_OSA);
	psor->doffset = p->right;
}
示例#6
0
void Polynomial::addNewLastTerm(const Term & t) {
  PolynomialIterator w(begin());
  const int sz = numberOfTerms();
  if(sz>0) {
    for(int i=1;i<sz;++i,++w) {};
    const Monomial & m = (*w).MonomialPart();
    if(AdmissibleOrder::s_getCurrent().monomialGreater(t.MonomialPart(),m)) {
      errorc(__LINE__);
    };
    if(t.MonomialPart()==m) {
      errorc(__LINE__);
    };
  };
  addTermToEnd(t);
};
示例#7
0
void Polynomial::doubleProduct(const Field & f,const Monomial & x,
        const Polynomial &  poly,const Monomial & y) {
  if(&poly==this) errorc(__LINE__);
#ifdef CHECK_FOR_ZERO_COEFFICIENTS
GBStream << "MXS:doubleProduct:poly:" << poly << '\n';
GBStream << "MXS:doubleProduct:aTerm:" << aTerm << '\n';
GBStream << "MXS:doubleProduct:bTerm:" << bTerm << '\n';
#endif
  setToZero();
  if(!f.zero())  {
    const int sz = poly.numberOfTerms();
    PolynomialIterator w = poly.begin();
    Term t;
    for(int i=1;i<=sz;++i,++w) {
      t = *w;
      t.Coefficient() *= f;
      Monomial & m = t.MonomialPart();
      Monomial result(x);
      result *= m;
      result *= y;
      m = result;
      addTermToEnd(t);
    }
  }
};  
示例#8
0
void MmaSink::put(const Holder& h) {
  s_table.executeconst(*this,h);
#else
void MmaSink::put(const Holder&) {
  errorc(__LINE__);
#endif
};
示例#9
0
bool AdmWithLevels::variableLess(const Variable & x,const Variable & y) const {
  bool result = false;
  bool done = false;
  int n1 = level(x), n2 = level(y);
  if(x==y) {
    done = true;
  } else if(n1!=n2) {
    result = n1<n2;
    done = true;
  } else {
    const vector<Variable> & V = monomialsAtLevel(n1);
    vector<Variable>::const_iterator w = V.begin(), e = V.end();
    while(w!=e) {
      const Variable & v = *w;
      if(v==x) {
        done = true;
        result = true; 
        break;
      } else if(v==y) {
        done = true;
        result = false; 
        break;
      };
      ++w;
    };
  };
  if(!done) errorc(__LINE__);
  return result;
};
示例#10
0
void AdmissibleOrder::s_setCurrentAdopt(AdmissibleOrder * p) {
    if(p==s_Current_p) errorc(__LINE__);
    if(s_Current_p) {
        RECORDHERE(delete s_Current_p;)
    }
    s_Current_p = p;
};
示例#11
0
void subMonomial::error2(int newstart) const {
  GBStream << "The start of an subMonomial was set to "
       << newstart << " and there are only "
       << _mono.numberOfFactors() << " factors .\n";
  GBStream << "The length was set to " << _length << '\n';
  errorc(__LINE__);
};
示例#12
0
void subMonomial::error5() const {
  GBStream << "The start of an subMonomial was set to "
        << _start+1 << " and there are only "
        << _mono.numberOfFactors() << "factors.\n";
  GBStream << "The length was set to " << _length << "\n";
  errorc(__LINE__);
};
示例#13
0
Alias<ISource> CountSource::inputNamedFunction(const char * x) {
  if(d_count<=0) errorc(__LINE__);
  --d_count;
  Alias<ISource> result(d_source.inputNamedFunction(x));
  if(d_count==0) d_eoi = true;
  return result;
};
示例#14
0
Alias<ISource> CountSource::inputFunction(symbolGB & x) {
  if(d_count<=0) errorc(__LINE__);
  --d_count;
  Alias<ISource> result(d_source.inputFunction(x));
  if(d_count==0) d_eoi = true;
  return result;
};
示例#15
0
void Polynomial::setToOne() {
   setToZero();
   operator =(Term::s_TERM_ONE);
   if(AdmissibleOrder::s_getCurrentP()==0) {
     GBStream << "Invalid order pointer.\n";
     errorc(__LINE__);
   }
};
示例#16
0
文件: asmeval.c 项目: mingpen/OpenNT
VOID PASCAL CODESIZE
valconst (
	register DSCREC	*arg
){
	if (!(M_RCONST & arg->dsckind.opnd.dtype) ||
	      arg->dsckind.opnd.dsegment ||
	      arg->dsckind.opnd.dflag == XTERNAL)
		/* Not constant */
		errorc (E_CXP);
}
示例#17
0
void MmaSink::noOutput() {
#ifdef DEBUG_MMASINK
  GBStream << "sink:null" << this << '\n';
#endif
  if(!MLPutSymbol(d_mlink,"Null")) errorc(__LINE__);
#ifdef DEBUG_MMASINK
  checkforerror();
#endif
  ++d_count;
};
示例#18
0
Alias<ISink> MmaSink::outputFunction(const char* x,long L) {
  if(!MLPutFunction(d_mlink,x,L)) errorc(__LINE__);
  ++d_count;
// DO NOT INCLUDE d_count -= L; since this will be done by the new MmaSink 
  Alias<ISink> al(new MmaSink(*this),Adopt::s_dummy);
#ifdef DEBUG_MMASINK
  checkforerror();
#endif
return al;
};
示例#19
0
int Polynomial::compareTwoMonomials(const Monomial & m1,
                                const Monomial & m2) const {
  int cmp;
  if(m1==m2) {
    cmp = 0;
  } else {
    bool flag = false; // false to prevent warnings from the compiler
    if(false) {
    } else if(isPD()) {
      if(AdmissibleOrder::s_getCurrentP()==0) {
        GBStream << "Invalid order pointer." << '\n';
        errorc(__LINE__);
      }
      flag = AdmissibleOrder::s_getCurrent().monomialGreater(m1,m2);
    } else errorc(__LINE__);
    cmp = flag ? 1 : -1;
  }
  return cmp;
};
示例#20
0
文件: asmeval.c 项目: mingpen/OpenNT
VOID PASCAL CODESIZE
valerror (
	register struct ar	*p
){
	DSCREC *oldlast;

	/* Operand was expected */
	errorc (E_OPN);
	/* save expr stack */
	oldlast = p->lastitem;
	p->lastitem = defaultdsc ();
	/*  Point to rest */
	p->lastitem->previtem = oldlast;
}
示例#21
0
文件: asmeval.c 项目: mingpen/OpenNT
USHORT PASCAL CODESIZE
valuesize (
	register DSCREC *arg
){
	if (!fArth32)
	   arg->dsckind.opnd.doffset = (long) (SHORT) arg->dsckind.opnd.doffset;

	if (arg->dsckind.opnd.doffset == 0) {
		/* 0 means no size */
		errorc (E_OHS);
		return (0);
	}
	else if (arg->dsckind.opnd.doffset >= CSFAR_LONG)
		return (xltsymtoresult[PROC]);
	else
		return (xltsymtoresult[DVAR]);
}
示例#22
0
void Polynomial::doubleProduct(const Monomial & x,
        const Polynomial &  poly,const Monomial & y) {
  if(&poly==this) errorc(__LINE__);
#ifdef CHECK_FOR_ZERO_COEFFICIENTS
GBStream << "MXS:doubleProduct:poly:" << poly << '\n';
GBStream << "MXS:doubleProduct:aTerm:" << aTerm << '\n';
GBStream << "MXS:doubleProduct:bTerm:" << bTerm << '\n';
#endif
  setToZero();
  const int sz = poly.numberOfTerms();
  PolynomialIterator w = poly.begin();
  Term result;
  for(int i=1;i<=sz;++i,++w) {
    result.assign(x);
    result *= (*w);
    result *= y;
    addTermToEnd(result);
  }
};  
示例#23
0
文件: asmeval.c 项目: mingpen/OpenNT
OFFSET PASCAL CODESIZE
shiftoper (
	register struct exprec	*p
){
	register OFFSET  argl;
	register USHORT  argr;

	argl = p->valleft->dsckind.opnd.doffset;
	if (p->valleft->dsckind.opnd.dsign)
		argl = -argl;
	argr = p->valright->dsckind.opnd.doffset;
	if (p->valright->dsckind.opnd.dsign) {
		errorc (E_SCN);
		return (argl);
	}
	else if (sizeof(OFFSET)*8 < argr)
		return (0);
	else if (p->stkoper == OPSHL)
		return (argl << argr);
	else
		return (argl >> argr);
}
示例#24
0
void GrbSource::get(Holder&) {
  errorc(__LINE__);
};
示例#25
0
Alias<ISource> GrbSource::inputNamedFunction(const char *) {
  errorc(__LINE__);
  d_eoi = d_so.eof();
  return *(Alias<ISource> *) 0;
};
示例#26
0
Alias<ISource> GrbSource::inputFunction(symbolGB &) {
  errorc(__LINE__);
  d_eoi = d_so.eof();
  return *(Alias<ISource> *) 0;
};
示例#27
0
void GrbSource::passString() {
  errorc(__LINE__);
  d_eoi = d_so.eof();
};
示例#28
0
void GrbSource::get(symbolGB &) {
  errorc(__LINE__);
  d_eoi = d_so.eof();
};
示例#29
0
void GrbSource::get(asStringGB &) {
  errorc(__LINE__);
  d_eoi = d_so.eof();
};
示例#30
0
int GrbSource::getType() const {
  errorc(__LINE__);
  return -1;
};