void CWASDDbusPathInit(){ InitPath(vrrid,ASD_DBUS_BUSNAME); InitPath(vrrid,ASD_DBUS_OBJPATH); InitPath(vrrid,ASD_DBUS_INTERFACE); InitPath(vrrid,ASD_DBUS_STA_OBJPATH); InitPath(vrrid,ASD_DBUS_STA_INTERFACE); InitPath(vrrid,ASD_DBUS_SECURITY_OBJPATH); InitPath(vrrid,ASD_DBUS_SECURITY_INTERFACE); InitPath(vrrid,ASD_DBUS_AC_GROUP_OBJPATH); InitPath(vrrid,ASD_DBUS_AC_GROUP_INTERFACE); }
void FabAtHomePrinter::downloadSegmentList(Bay* bay, const bool startFlow, bool startSuckback, double pushoutDistance, double pushoutVelocity, double standardDistance, double standardVelocity, double suckbackDistance, double suckbackVelocity, const Point& suckbackPoint) { InitPath(); if(startFlow) { bay->motor->moveAbsolute(bay->motor->getCommandedPosition()-pushoutDistance,pushoutVelocity,PRINT_ACCELERATION); //Start pushout. } while(AddPathPoints() == -2) //Start movement. { } if(startFlow) { bay->motor->waitMove(); //Wait for bay movement to finish. bay->motor->moveAbsolute(bay->motor->getCommandedPosition()-standardDistance,standardVelocity,PRINT_ACCELERATION); //Start standard flow. } double xDiff, yDiff; //Move points to the path pointer buffer while handling suckback. while(AddPathPoints() != -1 || startSuckback) { if(startSuckback) { xDiff = suckbackPoint.x - axes["X"].motor->getPosition(); yDiff = suckbackPoint.y - axes["Y"].motor->getPosition(); if(xDiff*xDiff+yDiff*yDiff < 0.25) { bay->motor->moveAbsolute(bay->motor->getCommandedPosition()+suckbackDistance,suckbackVelocity,PRINT_ACCELERATION); //Start suckback. startSuckback = false; } } } }
int GMoveTransformHandler::OnLButtonDown(UINT nFlags, Point &point) { TRACE("%s:OnLButtonDown (%f %f %f) %x \n",this->ClassName(),point.x,point.y,point.z,nFlags); firstPoint = point; firstFlags = nFlags; RayRange ray; view->ComputeWorldRay(point,ray); if (ComputeRayHit(ray)) { if (InitPath()) { SetState(1); // get starting point in view and local object coordinate view->viewInfo.World2View(lastHit.pw,lastS); World2Local(lastHit.pw,lastO); // compute center for trackball { Point p = lastHit.bbox.Center(); p= lastHit.m * p; view->World2Screen(p,centerS); } UpdateDialogValue(); return(EV_OK); } else { Reporter.Error("Can´t edit selected object, because not contained in Transform group. "); return(EV_CANCEL); } } else return(EV_CANCEL); }
int asd_init_socket_server(char *path) { char ASD_STA_PATH[PATH_LEN] ; struct sockaddr_un local; int len; int fd = -1; memset(&ASD_STA_PATH,0,PATH_LEN); memcpy(ASD_STA_PATH,path,strlen(path)); InitPath(vrrid,ASD_STA_PATH); fd = socket(PF_UNIX,SOCK_DGRAM,0); if(fd < 0) { asd_printf(ASD_DEFAULT,MSG_ERROR,"func :%s socket init error %s",__func__,strerror(errno)); exit(1); } local.sun_family = PF_UNIX; strcpy(local.sun_path,ASD_STA_PATH); unlink(local.sun_path); len = sizeof(local.sun_family) + strlen(local.sun_path); if(bind(fd,(struct sockaddr *) &local,len) < 0) { asd_printf(ASD_DEFAULT,MSG_ERROR,"func :%s socket bind error %s",__func__,strerror(errno)); exit(1); } socket_rcv = fd; return fd; }
status_t PackageDirectory::WriteToPath(const char *path, ItemState *state) { BPath &destination = state->destination; status_t ret; parser_debug("Directory: %s WriteToPath() called!\n", fPath.String()); ret = InitPath(path, &destination); parser_debug("Ret: %d %s\n", ret, strerror(ret)); if (ret != B_OK) return ret; // Since Antares is single-user right now, we give the newly // created directory default permissions ret = create_directory(destination.Path(), kDefaultMode); parser_debug("Create dir ret: %d %s\n", ret, strerror(ret)); if (ret != B_OK) return ret; BDirectory dir(destination.Path()); parser_debug("Directory created!\n"); if (fCreationTime) dir.SetCreationTime(static_cast<time_t>(fCreationTime)); if (fModificationTime) dir.SetModificationTime(static_cast<time_t>(fModificationTime)); // Since directories can only have attributes in the offset section, // we can check here whether it is necessary to continue if (fOffset) ret = HandleAttributes(&destination, &dir, "FoDa"); parser_debug("Ret: %d %s\n", ret, strerror(ret)); return ret; }
float CAICallback::GetPathLength(float3 start, float3 end, int pathType) { const int pathID = InitPath(start, end, pathType); float pathLen = -1.0f; if (pathID == 0) { return pathLen; } std::vector<float3> points; std::vector<int> lengths; pathManager->GetEstimatedPath(pathID, points, lengths); // distance to first intermediate node pathLen = (points[0] - start).Length(); // we don't care which path segment has // what resolution, just lump all points // together for (size_t i = 1; i < points.size(); i++) { pathLen += (points[i] - points[i - 1]).Length(); } /* // this method does not work without a path-owner // todo: add an alternate GPL() callback for this? bool haveNextWP = true; float3 currWP = start; float3 nextWP = start; while (haveNextWP) { nextWP = GetNextWaypoint(pathID); if (nextWP.y == -2) { // next path node not yet known continue; } if (nextWP.y == -1) { if (nextWP.x >= 0.0f && nextWP.z >= 0.0f) { // end of path (nextWP == end) pathLen += (nextWP - currWP).Length2D(); } else { // invalid path pathLen = -1.0f; } haveNextWP = false; } else { pathLen += (nextWP - currWP).Length2D(); currWP = nextWP; } } */ FreePath(pathID); return pathLen; }
ECode CPathInterpolator::InitQuad( /* [in] */ Float controlX, /* [in] */ Float controlY) { AutoPtr<IPath> path; CPath::New((IPath**)&path); path->MoveTo(0, 0); path->QuadTo(controlX, controlY, 1f, 1f); return InitPath(path); }
ECode CPathInterpolator::ParseInterpolatorFromTypeArray( /* [in] */ ITypedArray* a) { // If there is pathData defined in the xml file, then the controls points // will be all coming from pathData. Boolean has = FALSE; if (a->HasValue(R::styleable::PathInterpolator_pathData, &has), has) { String pathData; a->GetString(R::styleable::PathInterpolator_pathData, &pathData); AutoPtr<IPath> path = PathParser::CreatePathFromPathData(pathData); if (path == NULL) { // throw new InflateException("The path is null, which is created" // + " from " + pathData); return E_INFLATE_EXCEPTION; } FAIL_RETURN(InitPath(path)); } else { if (!(a->HasValue(R::styleable::PathInterpolator_controlX1, &has), has)) { // throw new InflateException("pathInterpolator requires the controlX1 attribute"); return E_INFLATE_EXCEPTION; } else if (!a.hasValue(R.styleable.PathInterpolator_controlY1)) { // throw new InflateException("pathInterpolator requires the controlY1 attribute"); return E_INFLATE_EXCEPTION; } Float x1 = 0f; a->GetFloat(R::styleable::PathInterpolator_controlX1, 0, &x1); Float y1 = 0f; a->GetFloat(R::styleable::PathInterpolator_controlY1, 0, &y1); Boolean hasX2 = FALSE; a->HasValue(R::styleable::PathInterpolator_controlX2, &hasX2); Boolean hasY2 = FALSE; a->HasValue(R::styleable::PathInterpolator_controlY2, &hasY2); if (hasX2 != hasY2) { // throw new InflateException( // "pathInterpolator requires both controlX2 and controlY2 for cubic Beziers."); return E_INFLATE_EXCEPTION; } if (!hasX2) { FAIL_RETURN(InitQuad(x1, y1)); } else { Float x2 = 0f; a->GetFloat(R::styleable::PathInterpolator_controlX2, 0, &x2); Float y2 = 0f; a->GetFloat(R::styleable::PathInterpolator_controlY2, 0, &y2); FAIL_RETURN(InitCubic(x1, y1, x2, y2)); } } return NOERROR; }
ECode CPathInterpolator::InitCubic( /* [in] */ Float x1, /* [in] */ Float y1, /* [in] */ Float x2, /* [in] */ Float y2) { AutoPtr<IPath> path; CPath::New((IPath**)&path); path->MoveTo(0, 0); path->CubicTo(x1, y1, x2, y2, 1f, 1f); return InitPath(path); }
GestureOverlayView::GestureOverlayView() : mGesturePaint(InitGesturePaint()), mFadeDuration(150), mFadeOffset(420), mFadingStart(420), mFadingHasStarted(FALSE), mFadeEnabled(TRUE), mCurrentColor(0), mCertainGestureColor(0xFFFFFF00), mUncertainGestureColor(0x48FFFF00), mGestureStrokeWidth(12.0f), mInvalidateExtraBorder(10), mGestureStrokeType(GESTURE_STROKE_TYPE_SINGLE), mGestureStrokeLengthThreshold(50.0f), mGestureStrokeSquarenessTreshold(0.275f), mGestureStrokeAngleThreshold(40.0f), mOrientation(ORIENTATION_VERTICAL), mInvalidRect(InitInvalidRect()), mPath(InitPath()), mGestureVisible(TRUE), mX(0.0f), mY(0.0f), mCurveEndX(0.0f), mCurveEndY(0.0f), mTotalLength(0.0f), mIsGesturing(FALSE), mPreviousWasGesturing(FALSE), mInterceptEvents(TRUE), mIsListeningForGestures(FALSE), mResetGesture(FALSE), mHandleGestureActions(FALSE), mIsFadingOut(FALSE), mFadingAlpha(1.0f), mInterpolator(InitInterpolator()), mFadingOut(InitFadingOut()) {}
//---------------------------------------------------------------------------- // // ROUTINE: CAIHumanStateObstruct::Init() // // PURPOSE: Handles initialization of the CAIHumanStateObstruct class, // Retreive initialization information from the AI, and change // the AI state to reflect entry to this state // //---------------------------------------------------------------------------- LTBOOL CAIHumanStateObstruct::Init(CAIHuman* pAIHuman) { if ( !super::Init(pAIHuman) ) { return LTFALSE; } InitPath( pAIHuman ); // Ensure that node tracking is disabled. m_pAIHuman->DisableNodeTracking(); m_pAIHuman->SetAwareness( kAware_Alert ); return LTTRUE; }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int nCmdShow) { DuiLib::CPaintManagerUI::SetInstance(hInstance); InitPath(); HRESULT Hr = ::CoInitialize(NULL); if (FAILED(Hr)) return 0; camera::MessageLoopManager* manager = camera::MessageLoopManager::GetInstance(); MainMessageDispatcher main_dispatcher; manager->Init(&main_dispatcher); MainRunner(); manager->QuitCameraThread(); ::CoUninitialize(); return 0; }
void FabAtHomePrinter::downloadSegmentList(Bay* bay, const bool startFlow, bool startSuckback, double pushoutDistance, double pushoutVelocity, double standardDistance, double standardVelocity, double suckbackDistance, double suckbackVelocity, const Point& suckbackPoint) { InitPath(); if(startFlow) { bay->motor->moveAbsolute(bay->motor->getCommandedPosition()-pushoutDistance,pushoutVelocity,PRINT_ACCELERATION); //Start pushout. } AddPathPoints(); //Start movement. if(startFlow) { bay->motor->waitMove(); //Wait for bay movement to finish. bay->motor->moveAbsolute(bay->motor->getCommandedPosition()-standardDistance,standardVelocity,PRINT_ACCELERATION); //Start standard flow. } //Move points to the path pointer buffer while handling suckback. double currX, currY, xDiff, yDiff; bool doneAddingPoints = false; while(!doneAddingPoints || startSuckback) { if(!doneAddingPoints && AddPathPoints() == -1) { doneAddingPoints = true; } if(startSuckback) { currX = axes["X"].motor->getPosition(); currY = axes["Y"].motor->getPosition(); xDiff = suckbackPoint.x - currX; yDiff = suckbackPoint.y - currY; if(xDiff*xDiff+yDiff*yDiff < 0.25) { bay->motor->moveAbsolute(bay->motor->getCommandedPosition()+suckbackDistance,suckbackVelocity,PRINT_ACCELERATION); //Start suckback. startSuckback = false; } } if(startSuckback && !axes["X"].motor->moving() && !axes["Y"].motor->moving() && !axes["Z"].motor->moving()) { //We have not started suckback and have reached end of path so we may have tunneled through the suckback circle. Just do the suckback now. bay->motor->moveAbsolute(bay->motor->getCommandedPosition()+suckbackDistance,suckbackVelocity,PRINT_ACCELERATION); //Start suckback. startSuckback = false; } } }
int asd_init_send_socket() { char AWSM_PATH[PATH_LEN] = "/var/run/wcpss/asd_table"; int fd = -1; fd = socket(PF_UNIX,SOCK_DGRAM,0); if(fd < 0) { asd_printf(ASD_DEFAULT,MSG_ERROR,"func :%s socket init error %s",__func__,strerror(errno)); exit(1); } InitPath(vrrid,AWSM_PATH); toMain.addr.sun_family = PF_UNIX; strcpy(toMain.addr.sun_path,AWSM_PATH); toMain.addrlen = strlen(toMain.addr.sun_path)+sizeof(toMain.addr.sun_family); socket_snd = fd; return fd; }
BOOL CBetaPatchClientApp::InitInstance() { AfxEnableControlContainer(); #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif BOOL bSkipPatch = FALSE; CHECK_TYPE type = CheckSingleInstance(); switch( type ) { case CHECK_FALSE: return FALSE; case CHECK_SKIP: RunClient(); return FALSE; } ::DeleteFile( PATCH_LOGFILE ); ::DeleteFile( "NewFlyff.exe" ); if( InitPath() == FALSE ) // 레지스트리에서 실행 Path를 얻어 지정한다. return FALSE; if( CheckDirectXVersion() == FALSE ) { AfxMessageBox( IDS_DIRECTX_INSTALL ); // DirectX 9가 설치되어 있지 않습니다. return FALSE; } CBetaPatchClientDlg dlg; m_pMainWnd = &dlg; g_pDlg = &dlg; dlg.DoModal(); return FALSE; }
status_t PackageLink::WriteToPath(const char *path, ItemState *state) { if (state == NULL) return B_ERROR; status_t ret = B_OK; BSymLink symlink; parser_debug("Symlink: %s WriteToPath() called!\n", fPath.String()); BPath &destination = state->destination; BDirectory *dir = &state->parent; if (state->status == B_NO_INIT || destination.InitCheck() != B_OK || dir->InitCheck() != B_OK) { // Not yet initialized ret = InitPath(path, &destination); if (ret != B_OK) return ret; BString linkName(destination.Leaf()); parser_debug("%s:%s:%s\n", fPath.String(), destination.Path(), linkName.String()); BPath dirPath; ret = destination.GetParent(&dirPath); ret = dir->SetTo(dirPath.Path()); if (ret == B_ENTRY_NOT_FOUND) { ret = create_directory(dirPath.Path(), kDefaultMode); if (ret != B_OK) { parser_debug("create_directory()) failed\n"); return B_ERROR; } } if (ret != B_OK) { parser_debug("destination InitCheck failed %s for %s\n", strerror(ret), dirPath.Path()); return ret; } ret = dir->CreateSymLink(destination.Path(), fLink.String(), &symlink); if (ret == B_FILE_EXISTS) { // We need to check if the existing symlink is pointing at the same path // as our new one - if not, let's prompt the user symlink.SetTo(destination.Path()); BPath oldLink; ret = symlink.MakeLinkedPath(dir, &oldLink); chdir(dirPath.Path()); if (ret == B_BAD_VALUE || oldLink != fLink.String()) state->status = ret = B_FILE_EXISTS; else ret = B_OK; } } if (state->status == B_FILE_EXISTS) { switch (state->policy) { case P_EXISTS_OVERWRITE: { BEntry entry; ret = entry.SetTo(destination.Path()); if (ret != B_OK) return ret; entry.Remove(); ret = dir->CreateSymLink(destination.Path(), fLink.String(), &symlink); break; } case P_EXISTS_NONE: case P_EXISTS_ASK: ret = B_FILE_EXISTS; break; case P_EXISTS_SKIP: return B_OK; } } if (ret != B_OK) { parser_debug("CreateSymLink failed\n"); return ret; } parser_debug(" Symlink created!\n"); ret = symlink.SetPermissions(static_cast<mode_t>(fMode)); if (fCreationTime && ret == B_OK) ret = symlink.SetCreationTime(static_cast<time_t>(fCreationTime)); if (fModificationTime && ret == B_OK) { ret = symlink.SetModificationTime(static_cast<time_t>( fModificationTime)); } if (ret != B_OK) { parser_debug("Failed to set symlink attributes\n"); return ret; } if (fOffset) { // Symlinks also seem to have attributes - so parse them ret = HandleAttributes(&destination, &symlink, "LnDa"); } return ret; }
status_t PackageFile::WriteToPath(const char *path, ItemState *state) { if (state == NULL) return B_ERROR; BPath &destination = state->destination; status_t ret = B_OK; parser_debug("File: %s WriteToPath() called!\n", fPath.String()); BFile file; if (state->status == B_NO_INIT || destination.InitCheck() != B_OK) { ret = InitPath(path, &destination); if (ret != B_OK) return ret; ret = file.SetTo(destination.Path(), B_WRITE_ONLY | B_CREATE_FILE | B_FAIL_IF_EXISTS); if (ret == B_ENTRY_NOT_FOUND) { BPath directory; destination.GetParent(&directory); if (create_directory(directory.Path(), kDefaultMode) != B_OK) return B_ERROR; ret = file.SetTo(destination.Path(), B_WRITE_ONLY | B_CREATE_FILE); } else if (ret == B_FILE_EXISTS) state->status = B_FILE_EXISTS; if (ret != B_OK) return ret; } if (state->status == B_FILE_EXISTS) { switch (state->policy) { case P_EXISTS_OVERWRITE: ret = file.SetTo(destination.Path(), B_WRITE_ONLY | B_ERASE_FILE); break; case P_EXISTS_NONE: case P_EXISTS_ASK: ret = B_FILE_EXISTS; break; case P_EXISTS_SKIP: return B_OK; } } if (ret != B_OK) return ret; parser_debug(" File created!\n"); // Set the file permissions, creation and modification times ret = file.SetPermissions(static_cast<mode_t>(fMode)); if (fCreationTime && ret == B_OK) ret = file.SetCreationTime(static_cast<time_t>(fCreationTime)); if (fModificationTime && ret == B_OK) ret = file.SetModificationTime(static_cast<time_t>(fModificationTime)); if (ret != B_OK) return ret; // Set the mimetype and application signature if present BNodeInfo info(&file); if (fMimeType.Length() > 0) { ret = info.SetType(fMimeType.String()); if (ret != B_OK) return ret; } if (fSignature.Length() > 0) { ret = info.SetPreferredApp(fSignature.String()); if (ret != B_OK) return ret; } if (fOffset) { parser_debug("We have an offset\n"); if (!fPackage) return B_ERROR; ret = fPackage->InitCheck(); if (ret != B_OK) return ret; // We need to parse the data section now fPackage->Seek(fOffset, SEEK_SET); uint8 buffer[7]; char *attrName = 0; uint32 nameSize = 0; uint8 *attrData = new uint8[P_CHUNK_SIZE]; uint64 dataSize = P_CHUNK_SIZE; uint8 *temp = new uint8[P_CHUNK_SIZE]; uint64 tempSize = P_CHUNK_SIZE; uint64 attrCSize = 0, attrOSize = 0; uint32 attrType = 0; // type_code type bool attrStarted = false, done = false; uint8 section = P_ATTRIBUTE; while (fPackage->Read(buffer, 7) == 7) { if (!memcmp(buffer, "FBeA", 5)) { parser_debug("-> Attribute\n"); section = P_ATTRIBUTE; continue; } else if (!memcmp(buffer, "FiDa", 5)) { parser_debug("-> File data\n"); section = P_DATA; continue; } switch (section) { case P_ATTRIBUTE: ret = ParseAttribute(buffer, &file, &attrName, &nameSize, &attrType, &attrData, &dataSize, &temp, &tempSize, &attrCSize, &attrOSize, &attrStarted, &done); break; case P_DATA: ret = ParseData(buffer, &file, fOriginalSize, &done); break; default: return B_ERROR; } if (ret != B_OK || done) break; } delete[] attrData; delete[] temp; } return ret; }
void CWWIDDbusPathInit() { InitPath(vrrid,WID_DBUS_BUSNAME); InitPath(vrrid,WID_DBUS_OBJPATH); InitPath(vrrid,WID_DBUS_INTERFACE); InitPath(vrrid,WID_DBUS_WLAN_OBJPATH); InitPath(vrrid,WID_DBUS_WLAN_INTERFACE); InitPath(vrrid,WID_DBUS_WTP_OBJPATH); InitPath(vrrid,WID_DBUS_WTP_INTERFACE); InitPath(vrrid,WID_DBUS_RADIO_OBJPATH); InitPath(vrrid,WID_DBUS_RADIO_INTERFACE); InitPath(vrrid,WID_DBUS_QOS_OBJPATH); InitPath(vrrid,WID_DBUS_QOS_INTERFACE); InitPath(vrrid,WID_DBUS_EBR_OBJPATH); InitPath(vrrid,WID_DBUS_EBR_INTERFACE); InitPath(vrrid,WID_BAK_OBJPATH); InitPath(vrrid,WID_BAK_INTERFACE); InitPath(vrrid,WID_DBUS_ACIPLIST_OBJPATH); InitPath(vrrid,WID_DBUS_ACIPLIST_INTERFACE); InitPath(vrrid,WID_DBUS_AP_GROUP_OBJPATH); InitPath(vrrid,WID_DBUS_AP_GROUP_INTERFACE); }
ECode CPathInterpolator::constructor( /* [in] */ IPath* path) { return InitPath(path); }