Example #1
0
P1(PUBLIC pascal trap, BOOLEAN, PrValidate, THPrint, hPrint) /* IMII-158 */
{
    /* TODO: figure out what are problem areas for us and adjust
	     accordingly */

  set_wDev (hPrint);

  if (!HxX (hPrint, prInfo.iVRes) || !HxX (hPrint, prInfo.iHRes))
    PrintDefault (hPrint);

  {
    int first, last;

    first = Hx (hPrint, prJob.iFstPage);
    last  = Hx (hPrint, prJob.iLstPage);

    if (first < 1 || first > last)
      {
	HxX(hPrint, prJob.iFstPage)  =  CWC(1);
	HxX(hPrint, prJob.iLstPage)  =  CWC(9999);
      }
  }
  {
    int copies;

    copies = Hx (hPrint, prJob.iCopies);
    
    if (copies < 1 || copies > 99)
      HxX(hPrint, prJob.iCopies)   =  CWC(1);
  }

  HxX(hPrint, prJob.bJDocLoop) =  2;
  return FALSE;
}
Example #2
0
void KneeJointR::checkInitPos( SP::SiconosVector x1 ,  SP::SiconosVector x2 )
{

  //x1->display();
  double X1 = x1->getValue(0);
  double Y1 = x1->getValue(1);
  double Z1 = x1->getValue(2);
  double q10 = x1->getValue(3);
  double q11 = x1->getValue(4);
  double q12 = x1->getValue(5);
  double q13 = x1->getValue(6);
  double X2 = 0;
  double Y2 = 0;
  double Z2 = 0;
  double q20 = 1;
  double q21 = 0;
  double q22 = 0;
  double q23 = 0;
  if(x2)
  {
    //printf("checkInitPos x2:\n");
    //x2->display();
    X2 = x2->getValue(0);
    Y2 = x2->getValue(1);
    Z2 = x2->getValue(2);
    q20 = x2->getValue(3);
    q21 = x2->getValue(4);
    q22 = x2->getValue(5);
    q23 = x2->getValue(6);
  }

  if (Hx(X1, Y1, Z1, q10, q11, q12, q13, X2, Y2, Z2, q20, q21, q22, q23) > DBL_EPSILON )
  {
    std::cout << "KneeJointR::checkInitPos( SP::SiconosVector x1 ,  SP::SiconosVector x2 )" << std::endl;
    std::cout << " Hx is large :" << Hx(X1, Y1, Z1, q10, q11, q12, q13, X2, Y2, Z2, q20, q21, q22, q23) << std::endl;
  }
  if (Hy(X1, Y1, Z1, q10, q11, q12, q13, X2, Y2, Z2, q20, q21, q22, q23) > DBL_EPSILON )
  {
    std::cout << "KneeJointR::checkInitPos( SP::SiconosVector x1 ,  SP::SiconosVector x2 )" << std::endl;
    std::cout << " Hy is large :" << Hy(X1, Y1, Z1, q10, q11, q12, q13, X2, Y2, Z2, q20, q21, q22, q23) << std::endl;
  }
  if (Hz(X1, Y1, Z1, q10, q11, q12, q13, X2, Y2, Z2, q20, q21, q22, q23) > DBL_EPSILON )
  {
    std::cout << "KneeJointR::checkInitPos( SP::SiconosVector x1 ,  SP::SiconosVector x2 )" << std::endl;
    std::cout << " Hz is large :" << Hz(X1, Y1, Z1, q10, q11, q12, q13, X2, Y2, Z2, q20, q21, q22, q23) << std::endl;
  }
     
  
  // printf("checkInitPos Hx : %e\n", Hx(X1, Y1, Z1, q10, q11, q12, q13, X2, Y2, Z2, q20, q21, q22, q23));
  // printf("checkInitPos Hy : %e\n", Hy(X1, Y1, Z1, q10, q11, q12, q13, X2, Y2, Z2, q20, q21, q22, q23));
  // printf("checkInitPos Hz : %e\n", Hz(X1, Y1, Z1, q10, q11, q12, q13, X2, Y2, Z2, q20, q21, q22, q23));


}
Example #3
0
P0(PUBLIC pascal trap, void, SystemTask)
{
    DCtlHandle dctlh;
    INTEGER i;

    for (i = 0; i < CW(UnitNtryCnt); ++i) {
	dctlh = MR(MR(UTableBase)[i].p);
	if ((HxX(dctlh, dCtlFlags) & CWC(NEEDTIMEBIT)) &&
				      TickCount() >= Hx(dctlh, dCtlCurTicks)) {
	    Control(itorn(i), accRun, (Ptr) 0);
	    HxX(dctlh, dCtlCurTicks) = CL(Hx(dctlh, dCtlCurTicks) +
							 Hx(dctlh, dCtlDelay));
	}
    }
}
Example #4
0
P1(PUBLIC pascal trap, BOOLEAN, SystemEvent, EventRecord *, evp)
{
    BOOLEAN retval;
    WindowPeek wp;
    INTEGER rn;
    DCtlHandle dctlh;
    LONGINT templ;

    if (SEvtEnb) {
	wp = 0;
	switch (evp->what) {
	default:
	case CWC(nullEvent):
	case CWC(mouseDown):
	case CWC(networkEvt):
	case CWC(driverEvt):
	case CWC(app1Evt):
	case CWC(app2Evt):
	case CWC(app3Evt):
	case CWC(app4Evt):
	    break;
	case CWC(mouseUp):
	case CWC(keyDown):
	case CWC(keyUp):
	case CWC(autoKey):
	    wp = (WindowPeek) FrontWindow();
	    break;
	case CWC(updateEvt):
	case CWC(activateEvt):
	    wp = (WindowPeek) MR(evp->message);
	    break;
	case CWC(diskEvt):
	    /* NOTE:  I think the code around toolevent.c:277 should
		      really be here.  I'm not going to get all excited
		      about it right now though. */
	    break;
	}
	if (wp) {
	    rn = WINDOW_KIND (wp);
	    if ((retval = rn < 0)) {
		dctlh = rntodctlh(rn);
		if (Hx(dctlh, dCtlEMask) & (1 << CW(evp->what))) {
		    templ = (LONGINT) (long) RM(evp);
		    Control(rn, accEvent, (Ptr) &templ);
		}
	    }
	} else
	    retval = FALSE;

    } else
	retval = FALSE;
    return retval;
}
Example #5
0
P1(PUBLIC pascal trap, INTEGER, GetResFileAttrs, INTEGER, rn)
{
    resmaphand map;

    ROMlib_setreserr(noErr);
    map = ROMlib_rntohandl(rn, (Handle *)0);
    if (!map) {
        ROMlib_setreserr(resFNotFound);
        return(0);
    } else
        return(Hx(map, resfatr));
}
Example #6
0
void Update2D(double *ez, double *hx, double *hy){

	for(int mm = 0; mm < SIZE; mm++){
		for(int nn = 0; nn < SIZE-1; nn++){
			Hx(mm,nn) = Chxh*Hx(mm,nn) -
					Chxe * ( Ez(mm, nn+1) - Ez(mm, nn));
		}
	}

	for(int mm = 0; mm < SIZE-1; mm++){
		for(int nn = 0; nn < SIZE; nn++){
					Hy(mm,nn) = Chyh*Hy(mm,nn)+Chye*( Ez( mm + 1 , nn) - Ez(mm, nn) );
				}
	}
	for(int mm = 0; mm < SIZE-1; mm++){
			for(int nn = 0; nn < SIZE-1; nn++){
				Ez(mm,nn) = Ceze*Ez(mm,nn)+
						Cezh * ( (Hy(mm,nn) - Hy(mm-1,nn))-
								(Hx(mm,nn)-Hx(mm,nn-1)));
			}
		}
}
Example #7
0
void KneeJointR::computeh(double time, BlockVector& q0, SiconosVector& y)
{
  DEBUG_BEGIN("KneeJointR::computeh(double time, BlockVector& q0, SiconosVector& y)\n");
  DEBUG_EXPR(q0.display());

  double X1 = q0.getValue(0);
  double Y1 = q0.getValue(1);
  double Z1 = q0.getValue(2);
  double q10 = q0.getValue(3);
  double q11 = q0.getValue(4);
  double q12 = q0.getValue(5);
  double q13 = q0.getValue(6);
  DEBUG_PRINTF("X1 = %12.8e,\t Y1 = %12.8e,\t Z1 = %12.8e,\n",X1,Y1,Z1);
  DEBUG_PRINTF("q10 = %12.8e,\t q11 = %12.8e,\t q12 = %12.8e,\t q13 = %12.8e,\n",q10,q11,q12,q13);
  double X2 = 0;
  double Y2 = 0;
  double Z2 = 0;
  double q20 = 1;
  double q21 = 0;
  double q22 = 0;
  double q23 = 0;
  if(q0.getNumberOfBlocks()>1)
  {
    // SP::SiconosVector x2 = _d2->q();
    // DEBUG_EXPR( _d2->q()->display(););
    X2 = q0.getValue(7);
    Y2 = q0.getValue(8);
    Z2 = q0.getValue(9);
    q20 = q0.getValue(10);
    q21 = q0.getValue(11);
    q22 = q0.getValue(12);
    q23 = q0.getValue(13);
  }
  y.setValue(0, Hx(X1, Y1, Z1, q10, q11, q12, q13, X2, Y2, Z2, q20, q21, q22, q23));
  y.setValue(1, Hy(X1, Y1, Z1, q10, q11, q12, q13, X2, Y2, Z2, q20, q21, q22, q23));
  y.setValue(2, Hz(X1, Y1, Z1, q10, q11, q12, q13, X2, Y2, Z2, q20, q21, q22, q23));
  DEBUG_EXPR(y.display());
  DEBUG_END("KneeJointR::computeh(double time, BlockVector& q0, SiconosVector& y)\n");
    
}
Example #8
0
P1(PUBLIC pascal trap, void, PrintDefault, THPrint, hPrint)
{
    /* TODO:  fill this information in from the currently open
       printer resource file.  I don't know where it's kept so
       I've filled in the values by hand to be what I suspect the
       LaserWriter we're using wants */

    memset((char *) STARH(hPrint), 0, sizeof(TPrint));
    HxX(hPrint, iPrVersion) = CW (ROMlib_PrDrvrVers);

    ROMlib_set_default_resolution (hPrint, 72, 72);
    
    HxX(hPrint, prInfo.iDev) = 0;

    set_wDev (hPrint);
    HxX(hPrint, prStl.iPageV) = CWC(1320); /* These were switched a while back */
    HxX(hPrint, prStl.iPageH) = CWC(1020); /* but I think it was a mistake */
    HxX(hPrint, prStl.bPort)  = 0;
    HxX(hPrint, prStl.feed)   = 2;

    HxX(hPrint, prInfoPT.iDev)         = 0;
    HxX(hPrint, prInfoPT.iVRes)        = CWC(72);
    HxX(hPrint, prInfoPT.iHRes)        = CWC(72);
    HxX(hPrint, prInfoPT.rPage)	     = HxX(hPrint, prInfo.rPage);

    HxX(hPrint, prXInfo.iRowBytes) = CW((Hx(hPrint, prXInfo.iBandH) + 7) / 8);
    /* TODO: what about the rest of prXInfo? (is zero for now) */

    HxX(hPrint, prJob.iFstPage)  =  CWC(1);
    HxX(hPrint, prJob.iLstPage)  =  CWC(9999);
    HxX(hPrint, prJob.iCopies)   =  CWC(1);
    HxX(hPrint, prJob.bJDocLoop) =  2; /* used to be 1, but then File Maker
					  Pro 2.1 would call PrOpenDoc
					  and PrCloseDoc once for each page */
    HxX(hPrint, prJob.fFromUsr)  =  1;
}