コード例 #1
0
//B*ddq + C*dq = fext
void DynamicChain2D::GetAcceleration(Vector& ddq, const Vector& fext)
{
	Matrix B;
	GetKineticEnergyMatrix(B);
	CholeskyDecomposition<Real> cholesky;
	if(!cholesky.set(B)) {
		LOG4CXX_ERROR(KrisLibrary::logger(),"Kinetic energy matrix is not positive definite!");
		LOG4CXX_ERROR(KrisLibrary::logger(),B);
		Abort();
	}

	Vector Cdq;
	GetCoriolisForces(Cdq);
	Vector f_Cdq;
	if(fext.n==0) f_Cdq.setNegative(Cdq);
	else f_Cdq.sub(fext,Cdq);
	cholesky.backSub(f_Cdq,ddq);
}
コード例 #2
0
ファイル: dlgClasses.cpp プロジェクト: GHnubsST/pgadmin3
void ExecutionDialog::OnCancel(wxCommandEvent &ev)
{
	if (thread)
	{
		btnCancel->Disable();
		Abort();
		btnCancel->Enable();
		btnOK->Enable();
	}
	else
	{
		delete conn;
		if (IsModal())
			EndModal(-1);
		else
			Destroy();
	}
}
コード例 #3
0
ファイル: DVDDemuxClient.cpp プロジェクト: FLyrfors/xbmc
bool CDVDDemuxClient::Open(CDVDInputStream* pInput)
{
  Abort();

  m_pInput = pInput;
  m_IDemux = dynamic_cast<CDVDInputStream::IDemux*>(m_pInput);
  if (!m_IDemux)
    return false;

  if (!m_IDemux->OpenDemux())
    return false;

  RequestStreams();

  m_displayTime = 0;
  m_dtsAtDisplayTime = DVD_NOPTS_VALUE;
  return true;
}
コード例 #4
0
private func DoDirControl(int iDir)
  {
  // Abbruch, wenn das Zielobjekt weg ist
  if (!pTargetObject) return(Abort());
  // Richtungsänderung?
  if (iDir != GetDir(pTargetObject))
    {
    iAngle=-iAngle;
    pTargetObject->SetDir(iDir);
    pArrow->UpdateAngle(iAngle);
    pTargetObject->~AimingAngle(iAngle);
    }
  else
    // Tastendruck in Zielrichtung: Zaubern! - nicht bei tumble!
    if(!(GetAction(pTargetObject) S= "Tumble"))
     DoEnter();
  return(1);
  }
コード例 #5
0
ファイル: Sem.cpp プロジェクト: SergeyStrukov/CCore
ulen Sem::begin_give_many(ulen dcount)
 {
  FastMutex::Lock lock(mutex);
   
  if( take_count<dcount )
    {
     dcount-=take_count;
      
     if( UIntAdd(count,dcount) ) Abort("Fatal error : CCore::Sem counter add overflow");
     
     return Replace_null(take_count);
    }
  else
    {
     take_count-=dcount;
     
     return dcount;
    }  
 }
コード例 #6
0
ファイル: bitmapimage.cpp プロジェクト: lewing/moon
void
BitmapImage::CreateLoader (unsigned char *buffer)
{
	if (!(moonlight_flags & RUNTIME_INIT_ALL_IMAGE_FORMATS)) {
		// 89 50 4E 47 == png magic
		if (buffer[0] == 0x89)
			loader = runtime_get_windowing_system()->CreatePixbufLoader ("png");
		// ff d8 ff e0 == jfif magic
		else if (buffer[0] == 0xff)
			loader = runtime_get_windowing_system()->CreatePixbufLoader ("jpeg");

		else {
			Abort ();
			moon_error = new MoonError (MoonError::EXCEPTION, 4001, "unsupported image type");
		}
	} else {
		loader = runtime_get_windowing_system()->CreatePixbufLoader (NULL);
	}
}
コード例 #7
0
void ValidateMaskEditT(UnicodeString Mask, TEditControl *Edit, int ForceDirectoryMasks)
{
  DebugAssert(Edit != nullptr);
  TFileMasks Masks(ForceDirectoryMasks);
  try
  {
    Masks = Mask;
  }
  catch (EFileMasksException &E)
  {
    ShowExtendedException(&E);
    Edit->SetFocus();
    // This does not work for TEdit and TMemo (descendants of TCustomEdit) anymore,
    // as it re-selects whole text on exception in TCustomEdit.CMExit
//    Edit->SelStart = E.ErrorStart - 1;
//    Edit->SelLength = E.ErrorLen;
    Abort();
  }
}
コード例 #8
0
ファイル: permute.c プロジェクト: alaarman/ltsmin
static void
permute_one (void *arg, transition_info_t *ti, state_data_t dst, int *cpy)
{

    (void) cpy;

    permute_t          *perm = (permute_t*) arg;
    int                 seen;
    seen = state_info_new_state (perm->next, dst, ti, perm->state);
    if (EXPECT_FALSE(seen < 0)) {
        global->exit_status = LTSMIN_EXIT_FAILURE;
        if (run_stop(perm->run_ctx)) {
            Warning (info, "Error: %s full! Change -s/--ratio.",
                           state_store_full_msg(seen));
        }
        return;
    }
    switch (perm->permutation) {
    case Perm_Shift:
        if (ti->group < perm->start_group) {
            perm_todo (perm, ti, seen);
            break;
        } else // fall through
    case Perm_None:
        perm->real_cb (perm->call_ctx, perm->next, ti, seen);
        ti->por_proviso &= perm->por_proviso;
        break;
    case Perm_Shift_All:
        if (0 == perm->start_group_index && ti->group >= perm->start_group)
            perm->start_group_index = perm->nstored;
        // fall through
    case Perm_Dynamic:
    case Perm_Random:
    case Perm_SR:
    case Perm_RR:
    case Perm_Otf:
    case Perm_Sort:
        perm_todo (perm, ti, seen);
        break;
    default:
        Abort ("Unknown permutation!");
    }
}
コード例 #9
0
void
SpeechRecognition::ProcessTestEventRequest(nsISupports* aSubject,
                                           const nsAString& aEventName)
{
  if (aEventName.EqualsLiteral("EVENT_ABORT")) {
    Abort();
  } else if (aEventName.EqualsLiteral("EVENT_AUDIO_ERROR")) {
    DispatchError(
      SpeechRecognition::EVENT_AUDIO_ERROR,
      SpeechRecognitionErrorCode::Audio_capture, // TODO different codes?
      NS_LITERAL_STRING("AUDIO_ERROR test event"));
  } else {
    NS_ASSERTION(StaticPrefs::MediaWebspeechTextFakeRecognitionService(),
                 "Got request for fake recognition service event, but "
                 "media.webspeech.test.fake_recognition_service is unset");

    // let the fake recognition service handle the request
  }
}
コード例 #10
0
/* parse and translate global declarations */
void TopDecls(void)
{
    printf(".section .data\n");
    char tmp_buf[MAX_BUF];
    while(Look != 'B') {
        switch(Look) {
            case 'b':
            case 'w':
            case 'l':
                Decl();
                break;
            default:
                sprintf(tmp_buf, "Unrecognized keyword %c", Look);
                Abort(tmp_buf);
                break;
        }
        Fin();
    }
}
コード例 #11
0
ファイル: hre_table.c プロジェクト: graydon/ltsmin
static void put_at_chunk(value_table_t vt,chunk item,value_index_t index){
    SIputCAt(vt->index,item.data,item.len,index);

    if (HREme(vt->ctx)!=0) {
        Debug("validating at owner chunk %s at %u",item.data, index);
        if (vt->msg_pending) {
            Debug("waiting for msg (%x/%d) %s",vt->msg_pending,vt->msg_pending,vt->msg->buffer+4);
            HREyieldWhile(vt->ctx,&vt->msg_pending);
        }
        Debug("preparing message");
        int32_t tmp = -2 - index;
        if (item.len>MAX_CHUNK_SIZE) Abort("chunk length %d exceeds maximum (%d).",item.len,MAX_CHUNK_SIZE);
        memcpy(vt->msg->buffer,&tmp,4);
        memcpy(vt->msg->buffer+4,item.data,item.len);
        vt->msg->tail=item.len+4;
        vt->msg_pending=1;
        HREpostSend(vt->msg);
    }
}
コード例 #12
0
ファイル: WinInterface.cpp プロジェクト: mpmartin8080/winscp
//---------------------------------------------------------------------------
void __fastcall TWinInteractiveCustomCommand::Prompt(
  const UnicodeString & Prompt, UnicodeString & Value)
{
  UnicodeString APrompt = Prompt;
  if (APrompt.IsEmpty())
  {
    APrompt = FMTLOAD(CUSTOM_COMMANDS_PARAM_PROMPT, (FCustomCommandName));
  }
  TStrings * History = CustomWinConfiguration->History[L"CustomCommandParam"];
  if (InputDialog(FMTLOAD(CUSTOM_COMMANDS_PARAM_TITLE, (FCustomCommandName)),
        APrompt, Value, HELP_CUSTOM_COMMAND_PARAM, History))
  {
    CustomWinConfiguration->History[L"CustomCommandParam"] = History;
  }
  else
  {
    Abort();
  }
}
コード例 #13
0
ファイル: cndfs.c プロジェクト: Meijuh/ltsmin
void
rec_ndfs_call (wctx_t *ctx, ref_t state)
{
    cndfs_alg_local_t  *cloc = (cndfs_alg_local_t *) ctx->local;
    alg_global_t       *sm = ctx->global;
    strategy_t          rec_strat = get_strategy (ctx->run->shared->rec->alg);
    dfs_stack_push (sm->rec->local->stack, (int*)&state);
    cloc->counters.rec++;
    switch (rec_strat) {
    case Strat_ENDFS:
       endfs_blue (sm->rec->run, sm->rec); break;
    case Strat_LNDFS:
       lndfs_blue (sm->rec->run, sm->rec); break;
    case Strat_NDFS:
       ndfs_blue (sm->rec->run, sm->rec); break;
    default:
       Abort ("Invalid recursive strategy.");
    }
}
コード例 #14
0
ファイル: gcf-tool.c プロジェクト: Meijuh/ltsmin
static void gcf_extract(){
    char *gcf_name=HREnextArg();
    if (gcf_name==NULL) {
        Abort("missing <gcf archive> argument");
    }
    archive_t arch=arch_gcf_read(raf_unistd(gcf_name));
    archive_t dir;
    if (outputdir) {
        dir=arch_dir_create(outputdir,blocksize,force?DELETE_ALL:DELETE_NONE);
    } else {
        dir=arch_dir_open(".",blocksize);
    }
    char*pattern=HREnextArg();
    do {
        archive_copy(arch,dir,NULL,blocksize,pattern);
    } while((pattern=HREnextArg()));
    arch_close(&dir);
    arch_close(&arch);
}
コード例 #15
0
ファイル: balloc.c プロジェクト: PlanetAPL/a-plus
/* external function definitions */
void *
balloc(int size)
{
  static char fnc[] = "balloc";
  void *p;

  if (size <= 0) {
    return (void *) (0);
  }
  if ((p = (void *) malloc((unsigned) size)) == (void *) (0)) {
    if (errno == ENOMEM) {
      /* GASP!!!! */
      gasp(size);
      _exit(1);
    }
    Abort("%t %s(): abort: malloc(%u): %m\n", fnc, (unsigned) size);
  }
  return p;
}
コード例 #16
0
void
SpeechRecognition::ProcessTestEventRequest(nsISupports* aSubject, const nsAString& aEventName)
{
  if (aEventName.EqualsLiteral("EVENT_ABORT")) {
    Abort();
  } else if (aEventName.EqualsLiteral("EVENT_AUDIO_ERROR")) {
    DispatchError(SpeechRecognition::EVENT_AUDIO_ERROR,
                  SpeechRecognitionErrorCode::Audio_capture, // TODO different codes?
                  NS_LITERAL_STRING("AUDIO_ERROR test event"));
  } else {
    NS_ASSERTION(mTestConfig.mFakeRecognitionService,
                 "Got request for fake recognition service event, but "
                 TEST_PREFERENCE_FAKE_RECOGNITION_SERVICE " is unset");

    // let the fake recognition service handle the request
  }

  return;
}
コード例 #17
0
ファイル: spaces.c プロジェクト: BackupTheBerlios/dri-ex-svn
int 
FindContext(double M[2][2])  /* array to search for                          */
{
       register int i;       /* loop variable for search                     */
       for (i=0; i < nextcontext; i++)
               if (M[0][0] == contexts[i].normal[0][0] && M[1][0] == contexts[i].normal[1][0]
                   && M[0][1] == contexts[i].normal[0][1] && M[1][1] == contexts[i].normal[1][1])
                       break;
 
       if (i >= nextcontext) {
               if (i >= MAXCONTEXTS)
                       Abort("Context:  out of them");
               LONGCOPY(contexts[i].normal, M, sizeof(contexts[i].normal));
               MatrixInvert(M, contexts[i].inverse);
               nextcontext++;
       }
 
       return(i);
}
コード例 #18
0
void ApiChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config, EGLBoolean ret)
{
    stEglDisplay    *display    = _GetDisplay(dpy);
    const EGLint    *value      = attrib_list;
    stEglConfig     *p          = NULL;
    EGLBoolean      bFinish     = EGL_FALSE;
    EGLint          num         = num_config ? *num_config : 0;

    if (configs == NULL)
    {
        return;
    }

    for (GLint i=0; i<num; i++)
    {
        p = new stEglConfig();

        if (p)
        {
            p->config = configs[i];
            _ParseAttrbutes(dpy, value, p);
        }
        else
        {
            Abort("%s(%d)\n", __FUNCTION__, __LINE__);
            return;
        }

        if (display->eglConfStack)
        {
            stEglConfig *pTmp = display->eglConfStack;
            display->eglConfStack = p;
            p->next = pTmp;
        }
        else
        {
            display->eglConfStack = p;
        }
    }

    CTX_ANALYZER_FUNC6(ChooseConfig, EGLOutput, EGL_OUT_BUF_SIZE, dpy, attrib_list, configs, config_size, num_config, ret);
}
コード例 #19
0
ファイル: rationals.c プロジェクト: Meijuh/ltsmin
void
rationalize32 (float f,uint32_t *numerator,uint32_t *denominator)
{
    uint32_t i,j;
    // try x for 32 bit x
    j=1;
    i=nearbyintf(((float)j)*f);
    if (i==0){
        i=nearbyintf(1000000000*f);
        if (i==0){
            *numerator=0;
            *denominator=1;
            return;           
        }
    } else if (fequal(f,(float)i)){
        *numerator=i;
        *denominator=1;
        return;
    }
    // try x/y for 8 bit x,y
    for(j=2;j<256;j++){
        i=nearbyintf(((float)j)*f);
        if (i<=0 || i>=256) continue;
        if (fequal(f,((float)i)/((float)j))){
            *numerator=i;
            *denominator=j;
            return;
        }
    }
    // try 3(4??) digit decimal.
    for(j=1000;j<1000000000;j=j*10){
        i=nearbyintf(((float)j)*f);
        if (i<=100 || i>10000) continue;
        if (fequal(f,((float)i)/((float)j))){
            uint32_t c=gcd32(i,j);
            *numerator=i/c;
            *denominator=j/c;
            return;
        }
    }
    Abort("Attempt to reverse engineer %f failed",f);
}
コード例 #20
0
ファイル: hre_gzstream.c プロジェクト: Meijuh/ltsmin
static size_t gzip_read_max(stream_t stream,void*buf,size_t count){
    stream->rd.next_out=buf;
    stream->rd.avail_out=count;
    int res;
    do {
        if (stream->rd.avail_in==0){
            stream->rd.next_in=stream->rd_buf;
            stream->rd.avail_in=stream_read_max(stream->s,stream->rd_buf,stream->bufsize);
        }
        if (stream->compress){
            res=inflate(&stream->rd, Z_NO_FLUSH);
        } else {
            res=deflate(&stream->rd, Z_NO_FLUSH);
        }
        if(res!=Z_OK && res!=Z_STREAM_END){
            Abort("compression error %d %s",res,zError(res));
        }
    } while(stream->rd.avail_out && res!=Z_STREAM_END);
    return (count-stream->rd.avail_out);
}
コード例 #21
0
ファイル: hre_table.c プロジェクト: graydon/ltsmin
static chunk get_chunk(value_table_t vt,value_index_t idx){
    int len;
    char* data=SIgetC(vt->index,idx,&len);
    if (data==NULL) {
        if (HREme(vt->ctx)==0) Abort("chunk %d does not exist",idx);
        Debug("looking up index %d",idx);
        if (vt->msg_pending) HREyieldWhile(vt->ctx,&vt->msg_pending);
        vt->task=idx;
        memcpy(vt->msg->buffer,&idx,4);
        vt->msg->tail=4;
        vt->task_pending=1;
        vt->msg_pending=1;
        HREpostSend(vt->msg);
        HREyieldWhile(vt->ctx,&vt->task_pending);
        data=SIgetC(vt->index,idx,&len);
        data[len]=0;
        Debug("got %s (%d)",data,vt->msg_pending);
    }
    return chunk_ld(len,data);
}
コード例 #22
0
GLvoid CGLES3Context::CreateProgramObject(GLuint progId)
{
    CProgramObj *pProgram = FindProgram(progId);

    if (pProgram)
    {
        ClearProgram(pProgram);
        return;
    }

    pProgram = new CProgramObj(progId);
    if (pProgram)
    {
        programMap.insert(std::make_pair(progId, pProgram));
    }
    else
    {
        Abort("Cannot allocate program object.\n");
    }
}
コード例 #23
0
ファイル: util.cpp プロジェクト: builden/node.cpp
  void Assert(const char* const (*args)[4]) {
    auto filename = (*args)[0];
    auto linenum = (*args)[1];
    auto message = (*args)[2];
    auto function = (*args)[3];

    char exepath[256];
    size_t exepath_size = sizeof(exepath);
    if (uv_exepath(exepath, &exepath_size))
      snprintf(exepath, sizeof(exepath), "node");

    char pid[12] = { 0 };

    fprintf(stderr, "%s%s: %s:%s:%s%s Assertion `%s' failed.\n",
      exepath, pid, filename, linenum,
      function, *function ? ":" : "", message);
    fflush(stderr);

    Abort();
  }
コード例 #24
0
BackgroundLoader::~BackgroundLoader()
{
	if( !g_bEnableBackgroundLoading )
		return;

	Abort();

	m_bShutdownThread = true;
	m_StartSem.Post();
	m_LoadThread.Wait();

	/* Delete all leftover cached files. */
	map<CString,int>::iterator it;
	for( it = m_FinishedRequests.begin(); it != m_FinishedRequests.end(); ++it )
		FILEMAN->Remove( GetCachePath( it->first ) );

	/* m_sCachePathPrefix should be filled with several empty directories.  Delete
	 * them and m_sCachePathPrefix, so we don't leak them. */
	DeleteEmptyDirectories( m_sCachePathPrefix );
}
コード例 #25
0
void Alloc(char* Name) {
  if(InTable(Name)) {
    sprintf(tmp, "Duplicate Variable Name %s", Name);
    Abort(tmp);
  }
  AddEntry(Name, 'v');
  printf( "%s:	DQ ", Name);
  if(Look == '=') {
    Match('=');
    if(Look == '-') {
      printf("-");
      Match('-');
    }
    printf("%d\n", GetNum());
  }
  else {
    printf("0\n");
  }

}
コード例 #26
0
ファイル: assfail.c プロジェクト: jasonbking/illumos-gate
/*
 * Report a thread usage error.
 * Not called if _THREAD_ERROR_DETECTION=0.
 * Writes message and continues execution if _THREAD_ERROR_DETECTION=1.
 * Writes message and dumps core if _THREAD_ERROR_DETECTION=2.
 */
void
thread_error(const char *msg)
{
	char buf[800];
	uberdata_t *udp;
	ulwp_t *self;
	lwpid_t lwpid;

	/* avoid recursion deadlock */
	if ((self = __curthread()) != NULL) {
		if (assert_thread == self)
			_exit(127);
		enter_critical(self);
		(void) _lwp_mutex_lock(&assert_lock);
		assert_thread = self;
		lwpid = self->ul_lwpid;
		udp = self->ul_uberdata;
	} else {
		self = NULL;
		(void) _lwp_mutex_lock(&assert_lock);
		lwpid = _lwp_self();
		udp = &__uberdata;
	}

	(void) strcpy(buf, "\n*** _THREAD_ERROR_DETECTION: "
	    "thread usage error detected ***\n*** ");
	(void) strcat(buf, msg);

	(void) strcat(buf, "\n*** calling thread is ");
	ultos((uint64_t)(uintptr_t)self, 16, buf + strlen(buf));
	(void) strcat(buf, " thread-id ");
	ultos((uint64_t)lwpid, 10, buf + strlen(buf));
	(void) strcat(buf, "\n\n");
	(void) __write(2, buf, strlen(buf));
	if (udp->uberflags.uf_thread_error_detection >= 2)
		Abort(buf);
	assert_thread = NULL;
	(void) _lwp_mutex_unlock(&assert_lock);
	if (self != NULL)
		exit_critical(self);
}
コード例 #27
0
ファイル: bam_test.cpp プロジェクト: svn2github/ncbi_tk
char Complement(char c)
{
    switch ( c ) {
    case 'N': return 'N';
    case 'A': return 'T';
    case 'T': return 'A';
    case 'C': return 'G';
    case 'G': return 'C';
    case 'B': return 'V';
    case 'V': return 'B';
    case 'D': return 'H';
    case 'H': return 'D';
    case 'K': return 'M';
    case 'M': return 'K';
    case 'R': return 'Y';
    case 'Y': return 'R';
    case 'S': return 'S';
    case 'W': return 'W';
    default: Abort();
    }
}
コード例 #28
0
ファイル: spaces.c プロジェクト: BackupTheBerlios/dri-ex-svn
/*
:h3.MatrixInvert() - Invert a Matrix
 
My reference for matrix inversion was :hp1/Elementary Linear Algebra/
by Paul C. Shields, Worth Publishers, Inc., 1968.
*/
void 
MatrixInvert(double M[2][2],      /* input matrix                            */
	     double Mprime[2][2]) /* output inverted matrix                  */
{
       register double D;    /* determinant of matrix M                      */
       register double txx,txy,tyx,tyy;
 
       txx = M[0][0];
       txy = M[1][0];
       tyx = M[0][1];
       tyy = M[1][1];
 
       D = M[1][1] * M[0][0] - M[1][0] * M[0][1];
       if (D == 0.0)
               Abort("MatrixInvert:  can't");
 
       Mprime[0][0] = tyy / D;
       Mprime[1][0] = -txy / D;
       Mprime[0][1] = -tyx / D;
       Mprime[1][1] = txx / D;
}
コード例 #29
0
ファイル: hre_fifo.c プロジェクト: Meijuh/ltsmin
stream_t FIFOcreate(size_t blocksize){
    if(blocksize<=sizeof(void*)){
        Abort("block size must exceed pointer size");
    }
    stream_t fifo=RT_NEW(struct stream_s);
    stream_init(fifo);
    fifo->blocksize=blocksize;
    fifo->blocks=1;
    fifo->read_block=RTmalloc(blocksize);
    *((void**)fifo->read_block)=NULL;
    fifo->read_idx=sizeof(void*);
    fifo->write_block=fifo->read_block;
    fifo->write_idx=sizeof(void*);
    fifo->procs.read_max=fifo_read_max;
    fifo->procs.read=stream_default_read;
    fifo->procs.empty=fifo_empty;
    fifo->procs.close=FIFOdestroy;
    fifo->procs.write=fifo_write;
    fifo->procs.flush=fifo_flush;
    return fifo;
}
コード例 #30
0
ファイル: Unit1.cpp プロジェクト: ivan1986/vetklinika
void __fastcall TForm1::vactBeforeDelete(TDataSet *DataSet)
{
    notSelectQ(
"UPDATE vac SET npp=npp-1 WHERE npp>"+DataSet->FieldByName("npp")->AsString
               );
    notSelectQ(
"DELETE FROM vac WHERE nomer="+DataSet->FieldByName("nomer")->AsString
               );

    vact->DisableControls();
    int x=vact->RecNo;
    vact->Requery();
    try{
    try           {vact->RecNo=x;}
        catch(...){vact->RecNo=x-1;};
    }
        catch(...){vact->RecNo=-1;}
    vact->EnableControls();

    Abort();
}