int main(int argc, char *argv[]) { /* double m[9] = {-1, 0, 1, -2, 0, 2, -1, 0, 1}; double r[4] = {1, 0, 0, -1}; double avg_m[9] = {0.1, 0.1, 0.1, 0.1, 0.2, 0.1, 0.1, 0.1, 0.1}; double avg_m5[25] = {0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04}; double gaussian_m[9] ={0.0113, 0.0838, 0.0113, 0.0838, 0.6193, 0.0838, 0.0113, 0.0838, 0.0113}; double highpass_m[9] = {-0.111, -0.111, -0.111, -0.111, 0.888, -0.111, -0.111, -0.111, -0.111}; double unsharp_m[9] = {-0.1667, -0.1667, -0.1667, -0.1667, 4.333, -0.1667, -0.1667, -0.1667, -0.1667}; */ char* s; listap B_lista = loadchars(); usr_interrupt=1; //0 lenne igazabol FILE *fp; fp = fopen("/home/hz/rendszam/rendszam.pid", "w"); fprintf(fp, "%u", getpid()); fclose(fp); sigset_t mask, oldmask; signal(SIGUSR1, kezelo); sigemptyset (&mask); sigaddset (&mask, SIGUSR1); while(1) { sigprocmask (SIG_BLOCK, &mask, &oldmask); while (!usr_interrupt) sigsuspend (&oldmask); sigprocmask (SIG_UNBLOCK, &mask, NULL); ido(); s = rendszamfelismero("/home/hz/rendszam/kep.jpg", B_lista); printf("\nFelismert rendszamtabla: \n"); printf("%s\n", s); usr_interrupt = 0; //break; } destroy(B_lista); return EXIT_SUCCESS; }
bool WalkTestLights::HandleDynLight (iLight* dyn) { LightStruct* ls = (LightStruct*)(WalkDataObject::GetData(dyn->QueryObject ())); switch (ls->type) { case DYN_TYPE_MISSILE: { MissileStruct* ms = (MissileStruct*)(WalkDataObject::GetData( dyn->QueryObject ())); csVector3 v (0, 0, 2.5); csVector3 old = dyn->GetMovable()->GetPosition (); v = old + ms->dir.GetT2O () * v; iSector* s = dyn->GetMovable()->GetSectors()->Get(0); bool mirror = false; csVector3 old_v = v; s = s->FollowSegment (ms->dir, v, mirror); if (ABS (v.x-old_v.x) > SMALL_EPSILON || ABS (v.y-old_v.y) > SMALL_EPSILON || ABS (v.z-old_v.z) > SMALL_EPSILON) { v = old; if (ms->sprite) { ms->sprite->GetMovable ()->ClearSectors (); Sys->Engine->GetMeshes ()->Remove (ms->sprite); } csRef<WalkDataObject> ido ( CS::GetChildObject<WalkDataObject>(dyn->QueryObject())); dyn->QueryObject ()->ObjRemove (ido); if (ms->snd) { ms->snd_stream->Pause(); } delete ms; if (Sys->mySound) { if (Sys->wMissile_boom) { csRef<iSndSysStream> st = Sys->mySound->CreateStream ( Sys->wMissile_boom->GetData (), CS_SND3D_ABSOLUTE); csRef<iSndSysSource> sndsource = Sys->mySound-> CreateSource (st); if (sndsource) { csRef<iSndSysSource3D> sndsource3d = scfQueryInterface<iSndSysSource3D> (sndsource); sndsource3d->SetPosition (v); sndsource->SetVolume (1.0f); st->SetLoopState (CS_SNDSYS_STREAM_DONTLOOP); st->Unpause (); } } } ExplosionStruct* es = new ExplosionStruct; es->type = DYN_TYPE_EXPLOSION; es->radius = 2; es->dir = 1; WalkDataObject* esdata = new WalkDataObject (es); dyn->QueryObject ()->ObjAdd (esdata); esdata->DecRef (); WalkTestParticleDemos::Explosion (Sys, dyn->GetMovable ()->GetSectors ()->Get (0), dyn->GetMovable ()->GetPosition (), "explo"); return false; } else ms->dir.SetOrigin (v); iSector* sector = dyn->GetMovable ()->GetSectors ()->Get (0); if (sector != s) { dyn->IncRef (); sector->GetLights ()->Remove (dyn); s->GetLights ()->Add (dyn); dyn->DecRef (); } dyn->GetMovable ()->SetPosition (v); if (ms->sprite) move_mesh (ms->sprite, s, v); if (Sys->mySound && ms->snd) { csRef<iSndSysSource3D> sndsource3d = scfQueryInterface<iSndSysSource3D> (ms->snd); sndsource3d->SetPosition (v); ms->snd->SetVolume (1.0f); } break; } case DYN_TYPE_EXPLOSION: { ExplosionStruct* es = (ExplosionStruct*)(WalkDataObject::GetData( dyn->QueryObject ())); if (es->dir == 1) { es->radius += 3; if (es->radius > 6) es->dir = -1; } else { es->radius -= 2; if (es->radius < 1) { csRef<WalkDataObject> ido ( CS::GetChildObject<WalkDataObject>(dyn->QueryObject())); dyn->QueryObject ()->ObjRemove (ido); delete es; iSector* sector = dyn->GetMovable ()->GetSectors ()->Get (0); sector->GetLights ()->Remove (dyn); return true; } } dyn->SetCutoffDistance (es->radius); break; } case DYN_TYPE_RANDOM: { RandomLight* rl = (RandomLight*)(WalkDataObject::GetData( dyn->QueryObject ())); rl->dyn_move += rl->dyn_move_dir; if (rl->dyn_move < 0 || rl->dyn_move > 2) rl->dyn_move_dir = -rl->dyn_move_dir; if (ABS (rl->dyn_r1-dyn->GetColor ().red) < .01 && ABS (rl->dyn_g1-dyn->GetColor ().green) < .01 && ABS (rl->dyn_b1-dyn->GetColor ().blue) < .01) RandomColor (rl->dyn_r1, rl->dyn_g1, rl->dyn_b1); else dyn->SetColor (csColor ((rl->dyn_r1+7.*dyn->GetColor ().red)/8., (rl->dyn_g1+7.*dyn->GetColor ().green)/8., (rl->dyn_b1+7.*dyn->GetColor ().blue)/8.)); dyn->GetMovable()->SetPosition (dyn->GetMovable()->GetPosition () + csVector3 (0, rl->dyn_move_dir, 0)); dyn->GetMovable()->UpdateMove(); break; } } return false; }
TBool CWebForm::SaveFormDataL() { bool value[2]={ false, false }; TBuf<MAX_ADDRESS_LEN> points[2]; TInt text_ids[]={ CL_WEB_FROM_TEXT_ID, CL_WEB_TO_TEXT_ID }; TInt list_ids[]={ CL_WEB_FROM_LIST_ID, CL_WEB_TO_LIST_ID }; for (int i=0; i<2; i++) { CSavedPoints::TEndPoint p=(CSavedPoints::TEndPoint)i; GetEdwinText(points[i], text_ids[i]); points[i].TrimAll(); if (points[i].Length()>3) { iPoints->AddPoint(p, points[i]); value[i]=true; } else { if (iSaved[i]) { TInt idx=GetCurrentItem(list_ids[i]); iPoints->IncUsage(p, idx); points[i]=iPoints->Points(p)[idx]; value[i]=true; } } } TTime time; time.HomeTime(); TDateTime dt=time.DateTime(); _LIT(KUrlFormat, "http://aikataulut.ytv.fi/reittiopas-pda/en/?test=1&keya=%S&keyb=%S&hour=%d&min=%d&vm=1&day=%d&month=%d&year=%d"); if (value[0] && value[1]) { TBuf<MAX_ADDRESS_LEN*3> enc_points[2]; for (int p=0; p<2; p++) { CHttp::AppendUrlEncoded(enc_points[p], points[p]); } auto_ptr<HBufC> addr(HBufC::NewL(KUrlFormat().Length()+enc_points[0].Length()+enc_points[1].Length()+10)); addr->Des().Format(KUrlFormat, &enc_points[0], &enc_points[1], (TInt)dt.Hour(), (TInt)dt.Minute(), (TInt)(dt.Day()+1), (TInt)(dt.Month()+1), (TInt)(dt.Year())); auto_ptr<CBBString> msg(CBBString::NewL(KWeb, points[0].Length()+points[1].Length()+20)); msg->iBuf->Des().Format(_L("HKL search from %S to %S"), &(points[0]), &(points[1])); iLog.post_new_value(msg.get()); #ifndef __WINS__ # ifndef __S60V2__ auto_ptr<CDorisBrowserInterface> ido(CDorisBrowserInterface::NewL()); ido->AppendL(CDorisBrowserInterface::EOpenURL_STRING, *addr); ido->ExecuteL(); # else auto_ptr<HBufC8> addr8(HBufC8::NewL(addr->Length())); TPtr8 addrp=addr8->Des(); CC()->ConvertFromUnicode(addrp, *addr); TUid KUidOperaBrowserUid = {0x101F4DED}; TUid KUidOperaRenderViewUid = {0}; TVwsViewId viewId(KUidOperaBrowserUid, KUidOperaRenderViewUid); auto_ptr<CVwsSessionWrapper> vws(CVwsSessionWrapper::NewL()); vws->ActivateView(viewId, TUid::Uid(0), *addr8); # endif #endif } else { #ifndef __WINS__ //iLog.post_new_value(_L("form closed")); iOpener.CloseConnection(); #endif } return true; }
void CContextContactsDetailView::HandleCommandL(TInt aCommand) { CALLSTACKITEM_N(_CL("CContextContactsDetailView"), _CL("HandleCommandL")); switch ( aCommand ) { case EAknSoftkeyBack: { ActivateParentViewL(); break; } case EContextContactsCmdCreateSms: { if ( iContainer->IsCurrentPhoneNumber() ) { TPtrC no( iItem->PbkFieldAt(iContainer->get_current_item_idx()).PbkFieldText() ); CDesCArrayFlat* recip=new CDesCArrayFlat(1); CleanupStack::PushL(recip); CDesCArrayFlat* alias=new CDesCArrayFlat(1); CleanupStack::PushL(alias); recip->AppendL(no); alias->AppendL( *(iItem->GetContactTitleL()) ); aPhoneHelper.send_sms(recip, alias); CleanupStack::PopAndDestroy(2); // recip, alias } else { CPbkSmsAddressSelect* sel=new (ELeave) CPbkSmsAddressSelect(); #ifndef __S60V3__ TPtrC no(sel->ExecuteLD(*iItem, NULL, EFalse)); #else TPtrC no(0, 0); CPbkSmsAddressSelect::TParams p(*iItem); TBool selected=sel->ExecuteLD(p); if (selected) { const TPbkContactItemField* f=p.SelectedField(); if (f && f->StorageType()==KStorageTypeText) { no.Set(f->Text()); } } #endif if (no.Length()>0) { CDesCArrayFlat* recip=new CDesCArrayFlat(1); CleanupStack::PushL(recip); CDesCArrayFlat* alias=new CDesCArrayFlat(1); CleanupStack::PushL(alias); recip->AppendL(no); alias->AppendL( *(iItem->GetContactTitleL()) ); aPhoneHelper.send_sms(recip, alias); CleanupStack::PopAndDestroy(2); // recip, alias } } break; } case EContextContactsCmdCreateMms: { if ( (iContainer->IsCurrentMMS()) || (iContainer->IsCurrentPhoneNumber()) ) { TPtrC no( iItem->PbkFieldAt(iContainer->get_current_item_idx()).PbkFieldText() ); CDesCArrayFlat* recip=new CDesCArrayFlat(1); CleanupStack::PushL(recip); CDesCArrayFlat* alias=new CDesCArrayFlat(1); CleanupStack::PushL(alias); recip->AppendL(no); alias->AppendL(*(iItem->GetContactTitleL())); aPhoneHelper.send_mms(recip,alias); CleanupStack::PopAndDestroy(2); // recip, alias } else { CPbkMmsAddressSelect* sel=new (ELeave) CPbkMmsAddressSelect(); #ifndef __S60V3__ TPtrC no(sel->ExecuteLD(*iItem, NULL, EFalse)); #else TPtrC no(0, 0); CPbkMmsAddressSelect::TParams p(*iItem); TBool selected=sel->ExecuteLD(p); if (selected) { const TPbkContactItemField* f=p.SelectedField(); if (f && f->StorageType()==KStorageTypeText) { no.Set(f->Text()); } } #endif if ((no!=KNullDesC)) { CDesCArrayFlat* recip=new CDesCArrayFlat(1); CleanupStack::PushL(recip); CDesCArrayFlat* alias=new CDesCArrayFlat(1); CleanupStack::PushL(alias); recip->AppendL(no); alias->AppendL(*(iItem->GetContactTitleL())); aPhoneHelper.send_mms(recip,alias); CleanupStack::PopAndDestroy(2); // recip,alias } } break; } case EContextContactsCmdCreateEmail: { if ( iContainer->IsCurrentMMS()) { TPtrC no( iItem->PbkFieldAt(iContainer->get_current_item_idx()).PbkFieldText() ); CDesCArrayFlat* recip=new CDesCArrayFlat(1); CleanupStack::PushL(recip); CDesCArrayFlat* alias=new CDesCArrayFlat(1); CleanupStack::PushL(alias); recip->AppendL(no); alias->AppendL(*(iItem->GetContactTitleL())); aPhoneHelper.send_email(recip,alias); CleanupStack::PopAndDestroy(2); // recip,alias } else { CPbkEmailAddressSelect* sel=new (ELeave) CPbkEmailAddressSelect(); #ifndef __S60V3__ TPtrC no(sel->ExecuteLD(*iItem, NULL, EFalse)); #else TPtrC no(0, 0); CPbkEmailAddressSelect::TParams p(*iItem); TBool selected=sel->ExecuteLD(p); if (selected) { const TPbkContactItemField* f=p.SelectedField(); if (f && f->StorageType()==KStorageTypeText) { no.Set(f->Text()); } } #endif if (no!=KNullDesC) { CDesCArrayFlat* recip=new CDesCArrayFlat(1); CleanupStack::PushL(recip); CDesCArrayFlat* alias=new CDesCArrayFlat(1); CleanupStack::PushL(alias); recip->AppendL(no); alias->AppendL(*(iItem->GetContactTitleL())); aPhoneHelper.send_email(recip, alias); CleanupStack::PopAndDestroy(2); // recip } } break; } case EContextContactsCmdCall: { if ( iContainer->IsCurrentPhoneNumber() ) { TPtrC no( iItem->PbkFieldAt(iContainer->get_current_item_idx()).PbkFieldText() ); aPhoneHelper.make_callL(no); } else { CPbkPhoneNumberSelect* sel=new (ELeave) CPbkPhoneNumberSelect(); #ifndef __S60V3__ TPtrC no(sel->ExecuteLD(*iItem, NULL, EFalse)); #else TPtrC no(0, 0); CPbkPhoneNumberSelect::TParams p(*iItem); TBool selected=sel->ExecuteLD(p); if (selected) { const TPbkContactItemField* f=p.SelectedField(); if (f && f->StorageType()==KStorageTypeText) { no.Set(f->Text()); } } #endif aPhoneHelper.make_callL(no); } break; } case EContextContactsCmdEdit: { aPhoneHelper.show_editor(iViewState->FocusedContactId(), false, iContainer->get_current_item_idx()); Refresh(); break; } case EContextContactsCmdDefaults: { CPbkContactItem * temp_item = pbkengine->OpenContactLCX(iViewState->FocusedContactId()); CDefaultNumbersPopupList * popup = CDefaultNumbersPopupList::NewL(temp_item); CleanupStack::PushL(popup); popup->ExecuteLD(); CleanupStack::Pop();//popup pbkengine->CommitContactL(*temp_item); CleanupStack::PopAndDestroy(2); // lock, temp_item Refresh(); break; } case EContextContactsCmdGoToWeb: { TBuf<255> url; url.Copy(iContainer->GetWebAddress()); if (url.Length() == 0) return; #ifndef __S60V3__ // FIXME3RD #ifndef __WINS__ # ifndef __S60V2__ auto_ptr<CDorisBrowserInterface> ido(CDorisBrowserInterface::NewL()); ido->AppendL(CDorisBrowserInterface::EOpenURL_STRING, url); ido->ExecuteL(); # else HBufC8* addr8=HBufC8::NewLC(url.Length()); TPtr8 addrp=addr8->Des(); CC()->ConvertFromUnicode(addrp, url); TUid KUidOperaBrowserUid = {0x101F4DED}; TUid KUidOperaRenderViewUid = {0}; TVwsViewId viewId(KUidOperaBrowserUid, KUidOperaRenderViewUid); CVwsSessionWrapper* vws; vws=CVwsSessionWrapper::NewLC(); vws->ActivateView(viewId, KUidOperaRenderViewUid, *addr8); CleanupStack::PopAndDestroy(2); # endif #endif #endif break; } case EContextContactsCmdDelete: { //note: this isn't the behaviour of original contact app TInt idx = iContainer->get_current_item_idx(); TInt id = iItem->PbkFieldAt(idx).PbkFieldId(); TPbkContactItemField * field = iItem->FindField(id, idx); TInt length = field->Label().Length() + field->Text().Length() + 10; HBufC * header = CEikonEnv::Static()->AllocReadResourceL(R_DELETE); CleanupStack::PushL(header); HBufC * message= HBufC::NewL(length); CleanupStack::PushL(message); message->Des().Append(field->Label()); message->Des().Append(_L(" (")); message->Des().Append(field->Text()); message->Des().Append(_L(") ?")); CAknMessageQueryDialog * dlg = CAknMessageQueryDialog::NewL(*message); CleanupStack::PushL(dlg); dlg->PrepareLC(R_CONFIRMATION_QUERY); dlg->QueryHeading()->SetTextL(*header); CleanupStack::Pop(dlg); if ( dlg->RunLD() ) { CPbkContactItem * temp_item = pbkengine->OpenContactLCX(iViewState->FocusedContactId()); temp_item->RemoveField(iContainer->get_current_item_idx()); pbkengine->CommitContactL(*temp_item); CleanupStack::PopAndDestroy(2); } CleanupStack::PopAndDestroy(2); //header, message Refresh(); break; } #ifdef __S60V3__ case EContextContactsMenuMsgCurrent: case EContextContactsMenuMsg: { HandleCreateMessageL(); } break; #endif default: { #ifndef __S60V3__ //FIXME3RD if (!iSendAppUi->CommandIsValidL(aCommand, TSendingCapabilities(0, 0, TSendingCapabilities::EAllMTMs))) #endif { AppUi()->HandleCommandL( aCommand ); } #ifndef __S60V3__ else { TUid mtm = iSendAppUi->MtmForCommand(aCommand); CArrayFixFlat<TInt> * c = new CArrayFixFlat<TInt>(1); CleanupStack::PushL(c); c->AppendL(iViewState->FocusedContactId()); aPhoneHelper.send_as( mtm, c); CleanupStack::PopAndDestroy(1); // c } #endif break; } } }