• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ NOT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中NOT函数的典型用法代码示例。如果您正苦于以下问题:C++ NOT函数的具体用法?C++ NOT怎么用?C++ NOT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NOT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Farray_in_bounds_p

void Farray_in_bounds_p(CL_FORM *base, int nargs)
{
	CL_FORM *rest_0;
	CL_FORM *local;
	rest_0 = ARG(1);
	local = ARG(nargs);
	COPY(ARG(0), LOCAL(0));
	Farray_rank(LOCAL(0));
	REST_LENGTH(rest_0, LOCAL(1));
	Fnumeql(LOCAL(0), 2);
	if(CL_TRUEP(LOCAL(0)))
	{
	}
	else
	{
		LOAD_SMSTR((CL_FORM *)&KClisp[188], LOCAL(0));	/* Wrong number of subscripts for array ~a */
		COPY(ARG(0), LOCAL(1));
		Ferror(LOCAL(0), 2);
	}
	{
		LOAD_FIXNUM(LOCAL(0), 0, LOCAL(0));
		{
			CL_FORM *rest_1;
			LOAD_NIL(LOCAL(1));
			rest_1 = rest_0;
			M1_1:;
			if(NOT(REST_NOT_EMPTY(rest_1)))
			{
				LOAD_NIL(LOCAL(1));
				LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(0));	/* T */
				goto RETURN1;
			}
			{
				CL_FORM *rest_2;
				rest_2 = rest_1;
				REST_CAR(rest_2, LOCAL(1));
			}
			if(CL_FIXNUMP(LOCAL(1)))
			{
				LOAD_FIXNUM(LOCAL(2), 0, LOCAL(2));
				COPY(LOCAL(1), LOCAL(3));
				COPY(ARG(0), LOCAL(4));
				COPY(LOCAL(0), LOCAL(5));
				Farray_dimension(LOCAL(4));
				F1minus(LOCAL(4));
				Fle(LOCAL(2), 3);
			}
			else
			{
				goto ELSE1;
			}
			if(CL_TRUEP(LOCAL(2)))
			{
			}
			else
			{
				ELSE1:;
				LOAD_NIL(ARG(0));
				goto RETURN1;
			}
			F1plus(LOCAL(0));
			{
				CL_FORM *rest_3;
				rest_3 = rest_1;
				rest_1 = REST_CDR(rest_3);
			}
			goto M1_1;
		}
		RETURN1:;
	}
}
开发者ID:hoelzl,项目名称:Clicc,代码行数:71,代码来源:lisp235.c


示例2: Reify_Va_To_Array_In_Frame

//
//  Make_Where_For_Frame: C
//
// Each call frame maintains the array it is executing in, the current index
// in that array, and the index of where the current expression started.
// This can be deduced into a segment of code to display in the debug views
// to indicate roughly "what's running" at that stack level.
//
// Unfortunately, Rebol doesn't formalize this very well.  There is no lock
// on segments of blocks during their evaluation, and it's possible for
// self-modifying code to scramble the blocks being executed.  The DO
// evaluator is robust in terms of not *crashing*, but the semantics may well
// suprise users.
//
// !!! Should blocks on the stack be locked from modification, at least by
// default unless a special setting for self-modifying code unlocks it?
//
// So long as WHERE information is unreliable, this has to check that
// `expr_index` (where the evaluation started) and `index` (where the
// evaluation thinks it currently is) aren't out of bounds here.  We could
// be giving back positions now unrelated to the call...but it won't crash!
//
REBARR *Make_Where_For_Frame(struct Reb_Frame *frame)
{
    REBCNT start;
    REBCNT end;

    REBARR *where;
    REBOOL pending;

    if (FRM_IS_VALIST(frame)) {
        const REBOOL truncated = TRUE;
        Reify_Va_To_Array_In_Frame(frame, truncated);
    }

    // WARNING: MIN is a C macro and repeats its arguments.
    //
    start = MIN(ARR_LEN(FRM_ARRAY(frame)), cast(REBCNT, frame->expr_index));
    end = MIN(ARR_LEN(FRM_ARRAY(frame)), FRM_INDEX(frame));

    assert(end >= start);
    assert(frame->mode != CALL_MODE_GUARD_ARRAY_ONLY);
    pending = NOT(frame->mode == CALL_MODE_FUNCTION);

    // Do a shallow copy so that the WHERE information only includes
    // the range of the array being executed up to the point of
    // currently relevant evaluation, not all the way to the tail
    // of the block (where future potential evaluation would be)
    {
        REBCNT n = 0;

        REBCNT len =
            1 // fake function word (compensates for prefetch)
            + (end - start) // data from expr_index to the current index
            + (pending ? 1 : 0); // if it's pending we put "..." to show that

        where = Make_Array(len);

        // !!! Due to "prefetch" the expr_index will be *past* the invocation
        // of the function.  So this is a lie, as a placeholder for what a
        // real debug mode would need to actually save the data to show.
        // If the execution were a path or anything other than a word, this
        // will lose it.
        //
        Val_Init_Word(ARR_AT(where, n), REB_WORD, FRM_LABEL(frame));
        ++n;

        for (n = 1; n < len; ++n)
            *ARR_AT(where, n) = *ARR_AT(FRM_ARRAY(frame), start + n - 1);

        SET_ARRAY_LEN(where, len);
        TERM_ARRAY(where);
    }

    // Making a shallow copy offers another advantage, that it's
    // possible to get rid of the newline marker on the first element,
    // that would visually disrupt the backtrace for no reason.
    //
    if (end - start > 0)
        CLEAR_VAL_FLAG(ARR_HEAD(where), VALUE_FLAG_LINE);

    // We add an ellipsis to a pending frame to make it a little bit
    // clearer what is going on.  If someone sees a where that looks
    // like just `* [print]` the asterisk alone doesn't quite send
    // home the message that print is not running and it is
    // argument fulfillment that is why it's not "on the stack"
    // yet, so `* [print ...]` is an attempt to say that better.
    //
    // !!! This is in-band, which can be mixed up with literal usage
    // of ellipsis.  Could there be a better "out-of-band" conveyance?
    // Might the system use colorization in a value option bit.
    //
    if (pending)
        Val_Init_Word(Alloc_Tail_Array(where), REB_WORD, SYM_ELLIPSIS);

    return where;
}
开发者ID:kjanz1899,项目名称:ren-c,代码行数:97,代码来源:n-system.c


示例3: Fmake_pathname

void Fmake_pathname(CL_FORM *base, int nargs)
{
	BOOL supl_flags[8];
	static CL_FORM * keylist[] =
	{
		SYMBOL(Slisp, 251),	/* HOST */
		SYMBOL(Slisp, 252),	/* DEVICE */
		SYMBOL(Slisp, 253),	/* DIRECTORY */
		SYMBOL(Slisp, 254),	/* NAME */
		SYMBOL(Slisp, 80),	/* TYPE */
		SYMBOL(Slisp, 255),	/* VERSION */
		SYMBOL(Slisp, 275),	/* DEFAULTS */
		SYMBOL(Slisp, 277),	/* CASE */
	};
	keysort(ARG(0), nargs - 0, 8, keylist, supl_flags, FALSE);
	if(NOT(supl_flags[0]))
	{
		LOAD_NIL(ARG(0));
		LOAD_NIL(ARG(8));
	}
	else
	{
		LOAD_T(ARG(8));
	}
	if(NOT(supl_flags[1]))
	{
		LOAD_NIL(ARG(1));
		LOAD_NIL(ARG(9));
	}
	else
	{
		LOAD_T(ARG(9));
	}
	if(NOT(supl_flags[2]))
	{
		LOAD_NIL(ARG(2));
		LOAD_NIL(ARG(10));
	}
	else
	{
		LOAD_T(ARG(10));
	}
	if(NOT(supl_flags[3]))
	{
		LOAD_NIL(ARG(3));
		LOAD_NIL(ARG(11));
	}
	else
	{
		LOAD_T(ARG(11));
	}
	if(NOT(supl_flags[4]))
	{
		LOAD_NIL(ARG(4));
		LOAD_NIL(ARG(12));
	}
	else
	{
		LOAD_T(ARG(12));
	}
	if(NOT(supl_flags[5]))
	{
		LOAD_NIL(ARG(5));
		LOAD_NIL(ARG(13));
	}
	else
	{
		LOAD_T(ARG(13));
	}
	if(NOT(supl_flags[6]))
	{
		LOAD_NIL(ARG(6));
	}
	if(NOT(supl_flags[7]))
	{
		LOAD_SYMBOL(SYMBOL(Slisp, 276), ARG(7));	/* LOCAL */
	}
	make_pathname1(ARG(0));
}
开发者ID:hoelzl,项目名称:Clicc,代码行数:79,代码来源:lisp344.c


示例4: new

short AQRInfo::setAQREntriesFromInputStr(char * inStr, Lng32 inStrLen)
{
  if ((! inStr) || (inStrLen <= 0))
    return -1;

  char * newStr = new(heap_) char[inStrLen + 1 + 1];
  str_cpy_all(newStr, inStr, inStrLen);
  newStr[inStrLen] = 0;
  Lng32 n = 0;

  Int32 i = 0;
  while (i < inStrLen)
    {
      if ((inStr[i] != '+') &&
	  (inStr[i] != '-') &&
	  (inStr[i] != '.') &&
	  (inStr[i] != ' ') &&
	  (inStr[i] != ',') &&
	  (inStr[i] != '|') &&
	  (NOT ((inStr[i] >= '0') &&
		(inStr[i] <= '9'))))
	return -1;

      if (inStr[i] != ' ')
	{
	  newStr[n] = inStr[i];
	  n++;
	}

      i++;
    }

  if (newStr[n-1] != '|')
    {
      newStr[n] = '|';
      n++;
    }
  newStr[n] = 0;

  i = 0;
  Int32 j = 0;
  Int32 k = 1;
  Lng32 sqlcode = -1;
  Lng32 nskcode = 0;
  Lng32 retries = 1;
  Lng32 delay = 60;
  Lng32 type = 0;
  Lng32 numCQDs = 0;
  char * cqdStr = NULL;
  Lng32 cmpInfo = 0;
  Lng32 intAQR = 0;
  Lng32 task = ComTdbExeUtilAQR::NONE_;
  NABoolean numberSeen = FALSE;
  while (i < n)
    {
      if ((newStr[i] >= '0') &&
	  (newStr[i] <= '9'))
	numberSeen = TRUE;

      if (newStr[i] == '+')
	{
	  if ((numberSeen) ||
	      (task != ComTdbExeUtilAQR::NONE_))
	    return -1;

	  task = ComTdbExeUtilAQR::ADD_;
	  j++;
	}
      else if (newStr[i] == '-')
	{
	  if ((numberSeen) ||
	      (task != ComTdbExeUtilAQR::NONE_))
	    return -1;

	  task = ComTdbExeUtilAQR::DELETE_;
	  j++;
	}
      else if (newStr[i] == '.')
	{
	  if ((numberSeen) ||
	      (task != ComTdbExeUtilAQR::NONE_))
	    return -1;

	  task = ComTdbExeUtilAQR::UPDATE_;
	  j++;
	}

      if ((newStr[i] == ',') ||
	  (newStr[i] == '|'))
	{
	  if (i > j)
	    {
	      Lng32 v = 0;
	      if ((k < 7) || (k == 8) || (k == 9))
		{
		  Int64 bigV = str_atoi(&newStr[j], i-j);
		  if (bigV == -1)
		    return -1;
		  
		  if (bigV > INT_MAX)
//.........这里部分代码省略.........
开发者ID:apache,项目名称:incubator-trafodion,代码行数:101,代码来源:SessionDefaults.cpp


示例5: FcharG

void FcharG(CL_FORM *base, int nargs)
{
	CL_FORM *rest_0;
	CL_FORM *local;
	rest_0 = ARG(1);
	local = ARG(nargs);
	{
		CL_FORM *rest_1;
		LOAD_NIL(LOCAL(0));
		rest_1 = rest_0;
		M1_1:;
		if(NOT(REST_NOT_EMPTY(rest_1)))
		{
			LOAD_NIL(LOCAL(0));
			LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(0));	/* T */
			goto RETURN1;
		}
		{
			CL_FORM *rest_2;
			rest_2 = rest_1;
			REST_CAR(rest_2, LOCAL(0));
		}
		if(CL_CHARP(ARG(0)))
		{
		}
		else
		{
			COPY(SYMVAL(Slisp, 58), LOCAL(1));	/* WRONG_TYPE */
			COPY(ARG(0), LOCAL(2));
			LOAD_SYMBOL(SYMBOL(Slisp, 18), LOCAL(3));	/* CHARACTER */
			Ferror(LOCAL(1), 3);
		}
		COPY(ARG(0), LOCAL(1));
		rt_char_code(LOCAL(1));
		if(CL_CHARP(LOCAL(0)))
		{
		}
		else
		{
			COPY(SYMVAL(Slisp, 58), LOCAL(2));	/* WRONG_TYPE */
			COPY(LOCAL(0), LOCAL(3));
			LOAD_SYMBOL(SYMBOL(Slisp, 18), LOCAL(4));	/* CHARACTER */
			Ferror(LOCAL(2), 3);
		}
		COPY(LOCAL(0), LOCAL(2));
		rt_char_code(LOCAL(2));
		Fle(LOCAL(1), 2);
		if(CL_TRUEP(LOCAL(1)))
		{
			LOAD_NIL(ARG(0));
			goto RETURN1;
		}
		COPY(LOCAL(0), ARG(0));
		{
			CL_FORM *rest_3;
			rest_3 = rest_1;
			rest_1 = REST_CDR(rest_3);
		}
		goto M1_1;
	}
	RETURN1:;
}
开发者ID:hoelzl,项目名称:Clicc,代码行数:62,代码来源:FcharG.c


示例6: do_vread_s


//.........这里部分代码省略.........
  dep->de_client = mp->m_source;

  if (dep->de_mode == DEM_ENABLED) {    

    descr = &dep->descr[DESCR_RECV][dep->cur_descr[DESCR_RECV]];  

    /* check if packet is in the current descr and only there */
    if(  !( !(descr->descr->des[DES0] & DES0_OWN) &&  
	    (descr->descr->des[DES0] & DES0_FS)   &&
	    (descr->descr->des[DES0] & DES0_LS)     ))
      goto suspend;


    /*TODO: multi-descr msgs...*/
    /* We only support packets contained in a single descriptor.
       Setting the descriptor buffer size to less then
       ETH_MAX_PACK_SIZE will result in multi-descriptor
       packets that we won't be able to handle 
    */
    assert(!(descr->descr->des[DES0]&DES0_OWN));
    assert(descr->descr->des[DES0]&DES0_FS);
    assert(descr->descr->des[DES0]&DES0_LS);

    /* Check for abnormal messages. We assert here
       because this driver is for a virtualized 
       envrionment where we will not get bad packets
    */
    assert(!(descr->descr->des[DES0]&DES0_ES));
    assert(!(descr->descr->des[DES0]&DES0_RE));


    /* Setup the iovec entry to allow copying into
       client layer
    */
    dep->de_read_iovec.iod_proc_nr = mp->m_source;
    de_get_userdata_s(mp->m_source, (cp_grant_id_t) mp->DL_GRANT, 0,
		      mp->DL_COUNT, dep->de_read_iovec.iod_iovec);
    dep->de_read_iovec.iod_iovec_s = mp->DL_COUNT;
    dep->de_read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT;
    dep->de_read_iovec.iod_iovec_offset = 0;
    size = de_calc_iov_size(&dep->de_read_iovec);
    if (size < ETH_MAX_PACK_SIZE) 
      panic("%s %d", str_SizeErrMsg, size);

    /* Copy buffer to user area  and clear ownage */
    size = (descr->descr->des[DES0]&DES0_FL)>>DES0_FL_SHIFT;

    /*TODO: Complain to MS */
    /*HACK: VPC2007 returns packet of invalid size. Ethernet standard
      specify 46 bytes as the minimum for valid payload. However, this is 
      artificial in so far as for certain packet types, notably ARP, less
      then 46 bytes are needed to contain the full information. In a non 
      virtualized environment the 46 bytes rule is enforced in order to give
      guarantee in the collison detection scheme. Of course, this being a 
      driver for a VPC2007, we won't have collisions and I can only suppose
      MS decided to cut packet size to true minimum, regardless of the 
      46 bytes payload standard. Note that this seems to not happen in 
      bridged mode. Note also, that the card does not return runt or 
      incomplete frames to us, so this hack is safe
    */    
    if(size<60){
      bzero(&descr->buf1[size], 60-size);
      size=60;
    }
    /* End ugly hack */

    iovp = &dep->de_read_iovec;
    buffer = descr->buf1;
    dep->bytes_rx += size;
    dep->de_stat.ets_packetR++;
    dep->de_read_s = size;

    do {   
      bytes = iovp->iod_iovec[ix].iov_size;	/* Size of buffer */
      if (bytes >= size) 
	bytes = size;

      r= sys_safecopyto(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, 0,
			(vir_bytes)buffer, bytes);
      if (r != OK)
	panic("%s %d", str_CopyErrMsg, r);
      buffer += bytes;
      
      if (++ix >= IOVEC_NR) {	/* Next buffer of IO vector */
	de_next_iov(iovp);
	ix = 0;
      }
    } while ((size -= bytes) > 0);

    descr->descr->des[DES0]=DES0_OWN;
    dep->cur_descr[DESCR_RECV]++;
    if(dep->cur_descr[DESCR_RECV] >= DE_NB_RECV_DESCR)
      dep->cur_descr[DESCR_RECV] = 0;	  

    DEBUG(printf("Read returned size = %d\n", size));

    /* Reply information */
    dep->de_flags |= DEF_ACK_RECV;
    dep->de_flags &= NOT(DEF_READING);
  }
开发者ID:anuragpeshne,项目名称:minix,代码行数:101,代码来源:dec21140A.c


示例7: null_test2

void null_test2 (void)
{
    cholmod_dense *X, *Xbad = NULL ;
    cholmod_sparse *Sbad = NULL, *A ;
    int ok ;

    /* ---------------------------------------------------------------------- */
    /* Test Core Common */
    /* ---------------------------------------------------------------------- */

    ok = CHOLMOD(allocate_work)(Size_max, 1, 1, cm) ;		NOT (ok) ;
    ok = CHOLMOD(allocate_work)(1, Size_max, 1, cm) ;		NOT (ok) ;
    ok = CHOLMOD(allocate_work)(1, 1, Size_max, cm) ;		NOT (ok) ;

    /* free a NULL pointer */
    CHOLMOD(free)(42, sizeof (char), NULL, cm) ;
    cm->print = 5 ; CHOLMOD(print_common)("cm", cm) ; cm->print = 3 ;

    cm->maxrank = 3 ;
    cm->maxrank = CHOLMOD(maxrank)(5, cm) ; OK (cm->maxrank == 4) ;
    cm->maxrank = 1 ;
    cm->maxrank = CHOLMOD(maxrank)(5, cm) ; OK (cm->maxrank == 2) ;
    cm->maxrank = 8 ;

    /* test the error handler */
    cm->error_handler = my_handler2 ;
    CHOLMOD(drop)(0., NULL, cm) ;
    cm->error_handler = NULL ;

    /* ---------------------------------------------------------------------- */
    /* dense */
    /* ---------------------------------------------------------------------- */

    X = CHOLMOD(allocate_dense)(5, 4, 1, CHOLMOD_REAL, cm) ;	    NOP (X) ;
    X = CHOLMOD(allocate_dense)(1, Int_max, 1, CHOLMOD_REAL, cm) ;  NOP (X) ;
    X = CHOLMOD(allocate_dense)(1, 1, 1, -1, cm) ;		    NOP (X) ;
    CHOLMOD(free_dense)(&X, cm) ;

    /* free a NULL dense matrix */
    ok = CHOLMOD(free_dense)(&X, cm) ;				    OK (ok) ;
    ok = CHOLMOD(free_dense)(NULL, cm) ;			    OK (ok) ;

    /* make an invalid sparse matrix */
    Sbad = CHOLMOD(speye)(2, 3, CHOLMOD_REAL, cm) ;		    OKP (Sbad) ;
    Sbad->stype = 1 ;
    ok = CHOLMOD(check_sparse)(Sbad, cm) ;			    NOT (ok) ;
    X = CHOLMOD(sparse_to_dense)(Sbad, cm) ;			    NOP (X) ;
    ok = CHOLMOD(free_sparse)(&Sbad, cm) ;			    OK (ok) ;

    /* make an invalid dense matrix */
    Xbad = CHOLMOD(eye)(4, 4, CHOLMOD_REAL, cm) ;		    OKP (Xbad) ;
    Xbad->d = 1 ;
    ok = CHOLMOD(check_dense)(Xbad, cm) ;			    NOT (ok) ;
    A = CHOLMOD(dense_to_sparse)(Xbad, TRUE, cm) ;
    ok = CHOLMOD(free_dense)(&Xbad, cm) ;			    OK (ok) ;
    CHOLMOD(print_common)("cm", cm) ;
    cm->print = 5 ; CHOLMOD(print_sparse)(A, "Bad A", cm) ; cm->print = 3 ;
    NOP (A) ;

    /* ---------------------------------------------------------------------- */
    /* sparse */
    /* ---------------------------------------------------------------------- */

    /* free a NULL sparse matrix */
    ok = CHOLMOD(free_sparse)(&A, cm) ;				    OK (ok) ;
    ok = CHOLMOD(free_sparse)(NULL, cm) ;			    OK (ok) ;
    A = CHOLMOD(copy_sparse)(NULL, cm) ;			    NOP (A) ;

    /* ---------------------------------------------------------------------- */
    /* error tests done */
    /* ---------------------------------------------------------------------- */

    printf ("------------------ null tests done\n") ;
}
开发者ID:Ascronia,项目名称:fieldtrip,代码行数:74,代码来源:null.c


示例8: rtpp_command_ul_handle


//.........这里部分代码省略.........
                spa->timeout_data.notify_tag = strdup(ulop->notify_tag);
            }
        } else if (ulop->socket_name_u == NULL && spa->timeout_data.handler != NULL) {
            spa->timeout_data.handler = NULL;
            rtpp_log_write(RTPP_LOG_INFO, spa->log, "disabling timeout handler");
        }
    }

    if (ulop->ia[0] != NULL && ulop->ia[1] != NULL) {
        if (spa->addr[pidx] != NULL)
            spa->last_update[pidx] = cmd->dtime;
        if (spa->rtcp->addr[pidx] != NULL)
            spa->rtcp->last_update[pidx] = cmd->dtime;
        /*
         * Unless the address provided by client historically
         * cannot be trusted and address is different from one
         * that we recorded update it.
         */
        if (spa->untrusted_addr[pidx] == 0 && !(spa->addr[pidx] != NULL &&
          SA_LEN(ulop->ia[0]) == SA_LEN(spa->addr[pidx]) &&
          memcmp(ulop->ia[0], spa->addr[pidx], SA_LEN(ulop->ia[0])) == 0)) {
            rtpp_log_write(RTPP_LOG_INFO, spa->log, "pre-filling %s's address "
              "with %s:%s", (pidx == 0) ? "callee" : "caller", ulop->addr, ulop->port);
            if (spa->addr[pidx] != NULL) {
                if (spa->canupdate[pidx] == 0) {
                    if (spa->prev_addr[pidx] != NULL)
                         free(spa->prev_addr[pidx]);
                    spa->prev_addr[pidx] = spa->addr[pidx];
                } else {
                    free(spa->addr[pidx]);
                }
            }
            spa->addr[pidx] = ulop->ia[0];
            ulop->ia[0] = NULL;
        }
        if (spa->rtcp->untrusted_addr[pidx] == 0 && !(spa->rtcp->addr[pidx] != NULL &&
          SA_LEN(ulop->ia[1]) == SA_LEN(spa->rtcp->addr[pidx]) &&
          memcmp(ulop->ia[1], spa->rtcp->addr[pidx], SA_LEN(ulop->ia[1])) == 0)) {
            if (spa->rtcp->addr[pidx] != NULL) {
                if (spa->rtcp->canupdate[pidx] == 0) {
                    if (spa->rtcp->prev_addr[pidx] != NULL)
                        free(spa->rtcp->prev_addr[pidx]);
                    spa->rtcp->prev_addr[pidx] = spa->rtcp->addr[pidx];
                } else {
                    free(spa->rtcp->addr[pidx]);
                }
            }
            spa->rtcp->addr[pidx] = ulop->ia[1];
            ulop->ia[1] = NULL;
        }
    }
    spa->asymmetric[pidx] = spa->rtcp->asymmetric[pidx] = ulop->asymmetric;
    spa->canupdate[pidx] = spa->rtcp->canupdate[pidx] = NOT(ulop->asymmetric);
    if (spa->codecs[pidx] != NULL) {
        free(spa->codecs[pidx]);
        spa->codecs[pidx] = NULL;
    }
    if (ulop->codecs != NULL) {
        spa->codecs[pidx] = ulop->codecs;
        ulop->codecs = NULL;
    }
    if (ulop->requested_nsamples > 0) {
        rtpp_log_write(RTPP_LOG_INFO, spa->log, "RTP packets from %s "
          "will be resized to %d milliseconds",
          (pidx == 0) ? "callee" : "caller", ulop->requested_nsamples / 8);
    } else if (spa->resizers[pidx] != NULL) {
          rtpp_log_write(RTPP_LOG_INFO, spa->log, "Resizing of RTP "
          "packets from %s has been disabled",
          (pidx == 0) ? "callee" : "caller");
    }
    if (ulop->requested_nsamples > 0) {
        if (spa->resizers[pidx] != NULL) {
            rtp_resizer_set_onsamples(spa->resizers[pidx], ulop->requested_nsamples);
        } else {
            spa->resizers[pidx] = rtp_resizer_new(ulop->requested_nsamples);
        }
    } else if (spa->resizers[pidx] != NULL) {
        rtp_resizer_free(spa->resizers[pidx]);
        spa->resizers[pidx] = NULL;
    }

    assert(lport != 0);
    ulop->reply.port = lport;
    ulop->reply.ia = ulop->lia[0];
    if (cf->stable->advaddr[0] != NULL) {
        if (cf->stable->bmode != 0 && cf->stable->advaddr[1] != NULL &&
          ulop->lia[0] == cf->stable->bindaddr[1]) {
            ulop->reply.ia_ov = cf->stable->advaddr[1];
        } else {
            ulop->reply.ia_ov = cf->stable->advaddr[0];
        }
    }
    ul_reply_port(cf, cmd, &ulop->reply);
    rtpp_command_ul_opts_free(ulop);
    return (0);

err_undo_0:
    rtpp_command_ul_opts_free(ulop);
    return (-1);
}
开发者ID:coolroad,项目名称:rtpproxy,代码行数:101,代码来源:rtpp_command_ul.c


示例9: el1_send

/*
**  Name:	void el1_send(dpeth_t *dep, int from_int, int pktsize)
**  Function:	Send function.  Called from main to transit a packet or
**  		from interrupt handler when a new packet was queued.
*/
static void el1_send(dpeth_t * dep, int from_int, int pktsize)
{
  buff_t *txbuff;
  clock_t now;

  if (from_int == FALSE) {

	if ((txbuff = alloc_buff(dep, pktsize + sizeof(buff_t))) != NULL) {

		/*  Fill transmit buffer from user area */
		txbuff->next = NULL;
		txbuff->size = pktsize;
		txbuff->client = dep->de_client;
		user2mem(dep, txbuff);
	} else
		panic(dep->de_name, "out of memory for Tx", NO_NUM);

  } else if ((txbuff = dep->de_xmitq_head) != NULL) {

	/* Get first packet in queue */
	lock();
	if (dep->de_xmitq_tail == dep->de_xmitq_head)
		dep->de_xmitq_head = dep->de_xmitq_tail = NULL;
	else
		dep->de_xmitq_head = txbuff->next;
	unlock();
	pktsize = txbuff->size;

  } else
	panic(dep->de_name, "should not be sending ", NO_NUM);

  if ((dep->de_flags & DEF_XMIT_BUSY)) {
	if (from_int) panic(dep->de_name, "should not be sending ", NO_NUM);
	getuptime(&now);
	if ((now - dep->de_xmit_start) > 4) {
		/* Transmitter timed out */
		DEBUG(printf("3c501: transmitter timed out ... \n"));
		dep->de_stat.ets_sendErr += 1;
		dep->de_flags &= NOT(DEF_XMIT_BUSY);
		el1_reset(dep);
	}

	/* Queue packet */
	lock();			/* Queue packet to receive queue */
	if (dep->de_xmitq_head == NULL)
		dep->de_xmitq_head = txbuff;
	else
		dep->de_xmitq_tail->next = txbuff;
	dep->de_xmitq_tail = txbuff;
	unlock();
  } else {
	/* Save for retransmission */
	TxBuff = txbuff;
	dep->de_flags |= (DEF_XMIT_BUSY | DEF_ACK_SEND);

	/* Setup board for packet loading */
	lock();			/* Buffer to processor */
	outb_el1(dep, EL1_CSR, ECSR_RIDE | ECSR_SYS);
	inb_el1(dep, EL1_RECV);	/* Clears any spurious interrupt */
	inb_el1(dep, EL1_XMIT);
	outw_el1(dep, EL1_RECVPTR, 0);	/* Clears RX packet area */

	/* Loads packet */
	outw_el1(dep, EL1_XMITPTR, (EL1_BFRSIZ - pktsize));
	outsb(dep->de_data_port, SELF, txbuff->buffer, pktsize);
	/* Starts transmitter */
	outw_el1(dep, EL1_XMITPTR, (EL1_BFRSIZ - pktsize));
	outb_el1(dep, EL1_CSR, ECSR_RIDE | ECSR_XMIT);	/* There it goes... */
	unlock();

	getuptime(&dep->de_xmit_start);
	dep->de_flags &= NOT(DEF_SENDING);
  }
  return;
}
开发者ID:michalwojciech,项目名称:cs170s10proj2,代码行数:80,代码来源:3c501.c


示例10: resolveFunctionCalls

//==================================================================
static void resolveFunctionCalls(
						TokNode *pNode,
						const DVec<Function> &funcs )
{
	for (size_t i=0; i < pNode->mpChilds.size(); ++i)
	{
		resolveFunctionCalls( pNode->mpChilds[i], funcs );
	}

	if ( pNode->mNodeType == TokNode::TYPE_FUNCCALL )
	{
		// do we have any params ?
		if ( pNode->mpChilds.size() )
		{
			const TokNode	*pParamsList = pNode->mpChilds[0];

			// bogus params ?
			for (size_t i=0; i < pParamsList->mpChilds.size(); ++i)
			{
				VarType vtype = pParamsList->mpChilds[i]->GetVarType();
				if ( vtype == VT_UNKNOWN )
				{
					throw Exception( pNode, "Unknown type for parameter %i", i+1 );
					//break;
				}
			}
		}

		const Function	*pFunc = NULL;

		// is asm func ? If so, then no need to process anything else here
		if ( IsAsmFunc( pNode->GetTokStr() ) )
			return;

		// find the function by its name and it's parameters types
		pFunc = MatchFunctionByParams( pNode, funcs );

		if NOT( pFunc )
		{
			// if not, then throw an exception
			throw Exception(
				DUT::SSPrintFS( "Could not find the function: %s", pNode->GetTokStr() ),
				pNode );
		}

		TokNode	*pClonedParamsHooks = cloneBranch( pFunc->mpParamsNode );

		TokNode	*pFollowingStatement = NULL;
		if ( pFunc->mpRetTypeTok->id == T_KW___funcop )
		{
			pFollowingStatement = pNode->GetRight();
		}

		// place the params block where the function call (name) currently is
		pClonedParamsHooks->ReplaceNode( pNode );

		// don't add the return value for "void" functions !
		if ( pFunc->mRetVarType != VT_VOID )
		{
			// add a return node/variable
			AddVariable(
				pClonedParamsHooks->mpParent,
				DNEW TokNode( DNEW Token( *pFunc->mpRetTypeTok ) ),
				DNEW TokNode( "varying", T_DE_varying, T_TYPE_DETAIL, pClonedParamsHooks ),	// %%% forced varying for now !
				NULL,
				pClonedParamsHooks,
				false,
				true );
		}

		const TokNode	*pPassParams = pNode->GetChildTry( 0 );

		assignPassingParams( pClonedParamsHooks, pPassParams );

		// a funcop ?
		if ( pFunc->mpRetTypeTok->id == T_KW___funcop )
		{
			// NOTE: do re really need to do this reparenting ??!

			if NOT( pFollowingStatement )
				throw Exception( "Missing statement !", pNode );

			pClonedParamsHooks->mIsFuncOp = true;

			handleFuncopEndForIfElse( pClonedParamsHooks );
		}
	}
}
开发者ID:UIKit0,项目名称:RibTools,代码行数:89,代码来源:RSLC_Functions_ResolveFunctionCalls.cpp


示例11: SYNTAX

WireSyntax::WireSyntax()
{
    SYNTAX("Wire");

    DEFINE_VOID("Comment",
                CHOICE(
                    GLUE(
                        STRING("//"),
                        CHOICE(
                            FIND(AHEAD(CHAR('\n'))),
                            FIND(EOI())
                        )
                    ),
                    GLUE(
                        STRING("/*"),
                        REPEAT(
                            CHOICE(
                                INLINE("Comment"),
                                GLUE(
                                    NOT(STRING("*/")),
                                    ANY()
                                )
                            )
                        ),
                        STRING("*/")
                    )
                )
               );

    DEFINE_VOID("Whitespace",
                REPEAT(
                    CHOICE(
                        RANGE(" \t\n"),
                        INLINE("Comment")
                    )
                )
               );

    DEFINE("Name",
           REPEAT(1, EXCEPT(" \t\n:;"))
          );

    DEFINE("Value",
           CHOICE(
               REF("Atom"),
               REF("Properties"),
               REF("Items")
           )
          );

    DEFINE("Object",
           GLUE(
               REPEAT(0, 1,
                      GLUE(
                          REF("Name"),
                          INLINE("Whitespace"),
                          CHAR(':'),
                          INLINE("Whitespace")
                      )
                     ),
               INLINE("Value")
           )
          );

    DEFINE("Atom",
           REPEAT(
               GLUE(
                   NOT(
                       CHOICE(
                           GLUE(
                               REPEAT(RANGE(" \t")),
                               INLINE("Name"),
                               REPEAT(RANGE(" \t")),
                               CHAR(':')
                           ),
                           GLUE(
                               REPEAT(RANGE(" \t")),
                               RANGE("};,")
                           ),
                           STRING("\n\n")
                       )
                   ),
                   ANY()
               )
           )
          );

    DEFINE("Properties",
           GLUE(
               CHAR('{'),
               INLINE("Whitespace"),
               REPEAT(
                   GLUE(
                       REF("Object"),
                       INLINE("Whitespace"),
                       RANGE(";,"),
                       INLINE("Whitespace")
                   )
               ),
               CHAR('}')
//.........这里部分代码省略.........
开发者ID:frankencode,项目名称:paco,代码行数:101,代码来源:WireSyntax.cpp


示例12: Fpathname_host

void Fpathname_host(CL_FORM *base, int nargs)
{
	BOOL supl_flags[1];
	static CL_FORM * keylist[] =
	{
		SYMBOL(Slisp, 208),	/* CASE */
	};
	keysort(STACK(base, 1), nargs - 1, 1, keylist, supl_flags, FALSE);
	if(NOT(supl_flags[0]))
	{
		LOAD_SYMBOL(SYMBOL(Slisp, 207), STACK(base, 1));	/* LOCAL */
	}
	COPY(STACK(base, 0), STACK(base, 2));
	COPY(STACK(base, 0), STACK(base, 3));
	LOAD_SYMBOL(SYMBOL(Slisp, 164), STACK(base, 4));	/* PATHNAME */
	struct_typep(STACK(base, 3));
	if(CL_TRUEP(STACK(base, 3)))
	{
		COPY(STACK(base, 0), STACK(base, 2));
	}
	else
	{
		if(CL_ARRAY_P(STACK(base, 0)))
		{
			COPY(STACK(base, 0), STACK(base, 3));
			LOAD_SYMBOL(SYMBOL(Slisp, 43), STACK(base, 4));	/* STANDARD-CHAR */
			LOAD_SYMBOL(SYMBOL(Slisp, 48), STACK(base, 5));	/* * */
			check_array_internal(STACK(base, 3));
			bool_result = CL_TRUEP(STACK(base, 3));
		}
		else
		{
			bool_result = FALSE;
		}
		if(bool_result)
		{
			COPY(STACK(base, 0), STACK(base, 2));
			Fparse_namestring(STACK(base, 2), 1);
			mv_count = 1;
		}
		else
		{
			COPY(STACK(base, 0), STACK(base, 3));
			LOAD_SYMBOL(SYMBOL(Slisp, 63), STACK(base, 4));	/* STREAM */
			struct_typep(STACK(base, 3));
			if(CL_TRUEP(STACK(base, 3)))
			{
				COPY(STACK(base, 0), STACK(base, 2));
				file_name(STACK(base, 2), 1);
				Fparse_namestring(STACK(base, 2), 1);
				mv_count = 1;
			}
			else
			{
				LOAD_SMSTR((CL_FORM *)&KFpathname_host[0], STACK(base, 2));	/* etypecase: the value ~a is not a legal value */
				COPY(STACK(base, 0), STACK(base, 3));
				Ferror(STACK(base, 2), 2);
			}
		}
	}
	COPY(STACK(base, 2), STACK(base, 0));
	LOAD_FIXNUM(0, STACK(base, 1));
	LOAD_SYMBOL(SYMBOL(Slisp, 164), STACK(base, 2));	/* PATHNAME */
	struct_ref(STACK(base, 0));
}
开发者ID:plops,项目名称:clicc,代码行数:65,代码来源:lisp100.c


示例13: CMPASSERT

CmpStatement::ReturnStatus
CmpStatement::process (const CmpMessageCompileStmt& compilestmt)
{
  CmpMain cmpmain;

  CMPASSERT(compilestmt.getCmpCompileInfo());

  char * sqlStr = NULL;
  Int32 sqlStrLen = 0;
  Lng32 inputCS = 0;
  NAString currCatName;
  NAString currSchName;
  char * recompControlInfo = NULL;
  NABoolean isSchNameRecvd;
  NABoolean nametypeNsk;
  NABoolean odbcProcess;
  NABoolean noTextCache;
  NABoolean aqrPrepare;
  NABoolean standaloneQuery;
  if (processRecvdCmpCompileInfo(this,
				 compilestmt,
  				 compilestmt.getCmpCompileInfo(),
				 context_,
				 sqlStr,
				 sqlStrLen, // out - long &
				 inputCS,
				 isSchNameRecvd, 
				 currCatName, currSchName,
				 recompControlInfo,
				 nametypeNsk,
				 odbcProcess,
				 noTextCache,
				 aqrPrepare,
				 standaloneQuery))
    return CmpStatement_ERROR;

  reply_ =
    new(outHeap_) CmpMessageReplyCode( outHeap_, compilestmt.id(), 
				       0, 0, outHeap_);
   
  // A pointer to user SQL query is stored in CmpStatement; if an exception is
  // thrown the user query is copied from here. It is reset upon return from
  // sqlcompStatic() method.

  sqlTextStr_ = sqlStr;
  sqlTextLen_ = sqlStrLen;

  // process recompControlInfo, if received
  if (recompControlInfo)
    setupRecompControlInfo(recompControlInfo, &cmpmain, inputCS);


  // set ODBC_PROCESS default.
  NABoolean odbcProcessChanged = FALSE;
  if (odbcProcess)
    {
      if (CmpCommon::getDefault(ODBC_PROCESS) != DF_ON)
	{
	  odbcProcessChanged = TRUE;
	  NAString op("ON");
	  context_->schemaDB_->getDefaults().validateAndInsert("ODBC_PROCESS", op, FALSE);
	}
      if (CmpCommon::getDefault(JDBC_PROCESS) != DF_ON)
	{
	  odbcProcessChanged = TRUE;
	  NAString op("ON");
	  context_->schemaDB_->getDefaults().validateAndInsert("JDBC_PROCESS", op, FALSE);
	}
      
    }
  
  QueryText qText(sqlStr, inputCS);
  cmpmain.setSqlParserFlags(compilestmt.getFlags());

  if (compilestmt.getCmpCompileInfo()->isSystemModuleStmt())
  {
  CMPASSERT(FALSE);
 }

  ULng32 flags = 0;

  NABoolean qtcChanged = FALSE;
  if ((CmpCommon::getDefault(QUERY_TEXT_CACHE) == DF_SYSTEM) &&
      (aqrPrepare || noTextCache))
    {
      CMPASSERT(NOT (aqrPrepare && noTextCache));

      qtcChanged = TRUE;
      NAString op(((aqrPrepare && standaloneQuery) ? "SKIP" : "OFF"));
      context_->schemaDB_->getDefaults().validateAndInsert("QUERY_TEXT_CACHE", op, FALSE);
    }

  CmpMain::ReturnStatus rs = 
    cmpmain.sqlcompStatic(qText, 0, 
			  &(reply_->data()), &(reply_->size()),
			  reply_->outHeap(), CmpMain::END, 
			  compilestmt.getType());
  sqlTextStr_ = NULL;

  
//.........这里部分代码省略.........
开发者ID:XueminZhu,项目名称:incubator-trafodion,代码行数:101,代码来源:CmpStatement.cpp


示例14: dump

int    GLUI_EditText::key_handler( unsigned char key,int modifiers )
{
  int i, regular_key;
  /* int has_selection;              */

  if ( NOT glui )
    return false;

  if ( debug )
    dump( stdout, "-> KEY HANDLER" );

  regular_key = false;
  /*  has_selection = (sel_start != sel_end);              */

  if ( key == 21 AND (modifiers & GLUT_ACTIVE_CTRL )!=0) { /* DEL all text */
    /** This one (key==21) may not port!! */
    
    insertion_pt = -1;  
    text[0] = '\0';
    sel_start = sel_end = -1;
  }
  else if ( key == 13 ) {           /* RETURN */
    /*    glui->disactivate_current_control();              */
    disactivate();  /** Force callbacks, etc **/
    activate(GLUI_ACTIVATE_TAB);     /** Reselect all text **/
    translate_and_draw_front();
    return true;
  }
  else if ( key  == 27 ) {         /* ESCAPE */
    glui->disactivate_current_control();
    return true;
  }
  else if ( key == 8 ) {       /* BACKSPACE */
    if ( sel_start == sel_end ) {   /* no selection */
      if ( insertion_pt > 0 ) {
	/*** See if we're deleting a period in a float data-type box ***/
	if ( data_type == GLUI_EDITTEXT_FLOAT AND text[insertion_pt-1]=='.' )
	  num_periods--;
	
	/*** Shift over string first ***/
	insertion_pt--;
	for( i=insertion_pt; i< (int)strlen( text ); i++ )
	  text[i] = text[i+1];    
      }
    }
    else {                         /* There is a selection */
      clear_substring( MIN(sel_start,sel_end), MAX(sel_start,sel_end ));
      insertion_pt = MIN(sel_start,sel_end);
      sel_start = sel_end = insertion_pt;
    }
  }
  else {                      /* Regular key */    
    regular_key = true;
    
    /** Check if we only accept numbers **/
    if (data_type == GLUI_EDITTEXT_FLOAT ) {
      if ( (key < '0' OR key > '9') AND key != '.' AND key != '-' )
	return true;

      if ( key == '-' ) { /* User typed a '-' */

	/* If user has first character selected, then '-' is allowed */
	if ( NOT ( MIN(sel_start,sel_end) == 0 AND
		   MAX(sel_start,sel_end) > 0 ) ) {

	  /* User does not have 1st char selected */
	  if (insertion_pt != 0 OR text[0] == '-' ) {
	    return true; /* Can only place negative at beginning of text,
			    and only one of them */
	  }
	}
      }

      if ( key == '.' ) {
	/*printf( "PERIOD: %d\n", num_periods );              */

	if ( num_periods > 0 ) {
	  /** We're trying to type a period, but the text already contains
	    a period.  Check whether the period is contained within
	    is current selection (thus it will be safely replaced) **/

	  int period_found = false; 
	  if ( sel_start != sel_end ) {
	    for( i=MIN(sel_end,sel_start); i<MAX(sel_start,sel_end); i++ ) {
	      /*  printf( "%c ", text[i] );              */
	      if ( text[i] == '.' ) {
		period_found = true;
		break;
	      }
	    }
	  }

	  /* printf( "found: %d    num: %d\n", period_found, num_periods );              */
	  
	  if ( NOT period_found )
	    return true;
	}
      }
    } 
    else if (data_type == GLUI_EDITTEXT_INT)	
//.........这里部分代码省略.........
开发者ID:elvisciotti,项目名称:opengl-vs-dot-net-graphics,代码行数:101,代码来源:glui_edittext.cpp


示例15: el1_interrupt

/*
**  Name:	void el1_interrupt(dpeth_t *dep)
**  Function:	Interrupt handler.  Acknwledges transmit interrupts
**  		or unloads receive buffer to memory queue.
*/
static void el1_interrupt(dpeth_t * dep)
{
  u16_t csr, isr;
  int pktsize;
  buff_t *rxptr;

  csr = inb_el1(dep, EL1_CSR);
  if ((csr & ECSR_XMIT) && (dep->de_flags & DEF_XMIT_BUSY)) {

	/* Got a transmit interrupt */
	isr = inb_el1(dep, EL1_XMIT);
	if ((isr & (EXSR_16JAM | EXSR_UNDER | EXSR_JAM)) || !(isr & EXSR_IDLE)) {
	DEBUG(printf("3c501: got xmit interrupt (ASR=0x%02X XSR=0x%02X)\n", csr, isr));
		if (isr & EXSR_JAM) {
			/* Sending, packet got a collision */
			dep->de_stat.ets_collision += 1;
			/* Put pointer back to beginning of packet */
			outb_el1(dep, EL1_CSR, ECSR_RIDE | ECSR_SYS);
			outw_el1(dep, EL1_XMITPTR, (EL1_BFRSIZ - TxBuff->size));
			/* And retrigger transmission */
			outb_el1(dep, EL1_CSR, ECSR_RIDE | ECSR_XMIT);
			return;

		} else if ((isr & EXSR_16JAM) || !(isr & EXSR_IDLE)) {
			dep->de_stat.ets_sendErr += 1;

		} else if (isr & EXSR_UNDER) {
			dep->de_stat.ets_fifoUnder += 1;
		}
		DEBUG(printf("3c501: got xmit interrupt (0x%02X)\n", isr));
		el1_reset(dep);

	} else {
		/** if (inw_el1(dep, EL1_XMITPTR) == EL1_BFRSIZ) **/
		/* Packet transmitted successfully */
		dep->de_stat.ets_packetT += 1;
		dep->bytes_Tx += (long) (TxBuff->size);
		free_buff(dep, TxBuff);
		dep->de_flags &= NOT(DEF_XMIT_BUSY);
		if ((dep->de_flags & DEF_SENDING) && dep->de_xmitq_head) {
			/* Pending transmit request available in queue */
			el1_send(dep, TRUE, 0);
			if (dep->de_flags & (DEF_XMIT_BUSY | DEF_ACK_SEND))
				return;
		}
	}

  } else if ((csr & (ECSR_RECV | ECSR_XMTBSY)) == (ECSR_RECV | ECSR_XMTBSY)) {

	/* Got a receive interrupt */
	isr = inb_el1(dep, EL1_RECV);
	pktsize = inw_el1(dep, EL1_RECVPTR);
	if ((isr & ERSR_RERROR) || (isr & ERSR_STALE)) {
	DEBUG(printf("Rx0 (ASR=0x%02X RSR=0x%02X size=%d)\n", csr, isr, pktsize));
		dep->de_stat.ets_recvErr += 1;

	} else if (pktsize < ETH_MIN_PACK_SIZE || pktsize > ETH_MAX_PACK_SIZE) {
	DEBUG(printf("Rx1 (ASR=0x%02X RSR=0x%02X size=%d)\n", csr, isr, pktsize));
		dep->de_stat.ets_recvErr += 1;

	} else if ((rxptr = alloc_buff(dep, pktsize + sizeof(buff_t))) == NULL) {
		/* Memory not available. Drop packet */
		dep->de_stat.ets_fifoOver += 1;

	} else if (isr & (ERSR_GOOD | ERSR_ANY)) {
		/* Got a good packet. Read it from buffer */
		outb_el1(dep, EL1_CSR, ECSR_RIDE | ECSR_SYS);
		outw_el1(dep, EL1_XMITPTR, 0);
		insb(dep->de_data_port, SELF, rxptr->buffer, pktsize);
		rxptr->next = NULL;
		rxptr->size = pktsize;
		dep->de_stat.ets_packetR += 1;
		dep->bytes_Rx += (long) pktsize;
		lock();		/* Queue packet to receive queue */
		if (dep->de_recvq_head == NULL)
			dep->de_recvq_head = rxptr;
		else
			dep->de_recvq_tail->next = rxptr;
		dep->de_recvq_tail = rxptr;
		unlock();

		/* Reply to pending Receive requests, if any */
		el1_recv(dep, TRUE, 0);
	}
  } else {			/* Nasty condition, should never happen */
	DEBUG(
	      printf("3c501: got interrupt with status 0x%02X\n"
		     "       de_flags=0x%04X  XSR=0x%02X RSR=0x%02X \n"
		     "       xmit buffer = 0x%4X recv buffer = 0x%4X\n",
			csr, dep->de_flags,
			inb_el1(dep, EL1_RECV),
			inb_el1(dep, EL1_XMIT),
			inw_el1(dep, EL1_XMITPTR),
			inw_el1(dep, EL1_RECVPTR))
		);
//.........这里部分代码省略.........
开发者ID:michalwojciech,项目名称:cs170s10proj2,代码行数:101,代码来源:3c501.c


示例16: do_conf

static void do_conf(const message * mp)
{
  int r;
  dpeth_t *dep;
  message reply_mess;

  dep = &de_state;

  strncpy(dep->de_name, str_DevName, strlen(str_DevName));
  dep->de_name[strlen(dep->de_name)-1] = '0' + de_instance;

  if (dep->de_mode == DEM_DISABLED) {
    de_update_conf(dep); 
    pci_init();
    if (dep->de_mode == DEM_ENABLED && !de_probe(dep, de_instance)) {
	printf("%s: warning no ethernet card found at 0x%04X\n",
	       dep->de_name, dep->de_base_port);
	dep->de_mode = DEM_DISABLED;
    }
  }

  r = OK;

  /* 'de_mode' may change if probe routines fail, test again */
  switch (dep->de_mode) {

  case DEM_DISABLED:
    r = ENXIO;       /* Device is OFF or hardware probe failed */
    break;

  case DEM_ENABLED:
    if (dep->de_flags == DEF_EMPTY) {
	de_first_init(dep);
	dep->de_flags |= DEF_ENABLED;
	de_reset(dep);
	de_hw_conf(dep);
	de_setup_frame(dep);
	de_start(dep);
    }

    /* TODO CHECK PROMISC AND MULTI */
    dep->de_flags &= NOT(DEF_PROMISC | DEF_MULTI | DEF_BROAD);
    if (mp->DL_MODE & DL_PROMISC_REQ)
	dep->de_flags |= DEF_PROMISC | DEF_MULTI | DEF_BROAD;
    if (mp->DL_MODE & DL_MULTI_REQ) dep->de_flags |= DEF_MULTI;
    if (mp->DL_MODE & DL_BROAD_REQ) dep->de_flags |= DEF_BROAD;
    break;

  case DEM_SINK:
    DEBUG(printf("%s running in sink mode\n", str_DevName));
    memset(dep->de_address.ea_addr, 0, sizeof(ether_addr_t));
    de_conf_addr(dep);
    break;

  default:	break;
  }

  reply_mess.m_type = DL_CONF_REPLY;
  reply_mess.DL_STAT = r;
  if(r == OK){
    *(ether_addr_t *) reply_mess.DL_HWADDR = dep->de_address;
  }
  
  if (send(mp->m_sourc 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NOTE函数代码示例发布时间:2022-05-30
下一篇:
C++ NOR_WRITE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap