Exemplo n.º 1
0
static void regexp_setup(pTHX_ regexp* r, SV* pat, U32 nparens, SV* callback)
{
    I32 len;
    int i;

    /* fprintf(stderr,"regexp_setup "); */
    Safefree(r->precomp);
    r->prelen = SvLEN(pat);
    r->precomp = savesvpv(pat);
    
    r->nparens = nparens;
    
    Renew(r->startp, nparens+1, I32);
    Renew(r->endp, nparens+1, I32);
    
    len = 1;
    if(r->offsets[0] < len) {
      Renew(r->offsets, 2*len+1, U32);
      r->offsets[0] = len;
    }

    r->offsets[1] = RECOGNITION_FLAG;

    Safefree(r->substrs->data[0].substr);
    r->substrs->data[0].substr = SvREFCNT_inc(callback);

    r->minlen = 0;
    r->reganch = 0;
    
    /* XXX Does regcomp.c zero any of the match fields? */
}
Exemplo n.º 2
0
        inline bool Read(T* value) 
        {
            auto size = sizeof(T);

            if (m_codedInputPtr->CurrentPosition() > INT_MAX - size)
                Renew();
            
            if (size == sizeof(uint32)) {
                uint32 tmp;
                if (!m_codedInputPtr->ReadLittleEndian32(&tmp))
                    return false;
                *value = Encode<uint32, T>(tmp);
                return true;
            }

            if (size == sizeof(uint64)) {
                uint64 tmp;
                if (!m_codedInputPtr->ReadLittleEndian64(&tmp))
                    return false;
                *value = Encode<uint64, T>(tmp);
                return true;
            }

            return false;
        }
bool CVirtQueue::Create(UINT Index,
    VirtIODevice *IODevice,
    NDIS_HANDLE DrvHandle)
{
    m_DrvHandle = DrvHandle;
    m_Index = Index;
    m_IODevice = IODevice;

    if (!m_SharedMemory.Create(DrvHandle))
    {
        DPrintf(0, "[%s] - shared memory creation failed\n", __FUNCTION__);
        return false;
    }

    NETKVM_ASSERT(m_VirtQueue == nullptr);

    if (AllocateQueueMemory())
    {
        Renew();
    }
    else
    {
        DPrintf(0, "[%s] - queue memory allocation failed, index = %d\n", __FUNCTION__, Index);
    }

    return m_VirtQueue != nullptr;
}
Exemplo n.º 4
0
	void Dfs(int uu) {
		dtop = 0;
		DfsStack[++dtop].Set(uu, 0, 0, 0, 1);
		while (dtop) {
			int u = DfsStack[dtop].u, F = DfsStack[dtop].F;
			if (vis[u] != 2) {
				if (vis[u] == 0) {
					Renew(u, Get(v[u]));
					int p1 = top, w = Push(u), p2 = top;
					DfsStack[dtop].Set(u, p1, w, p2);
					vis[u] = 1;
				}
				if (a[u]) {
					if (a[u]->y != F)
						DfsStack[++dtop].Set(a[u]->y, 0, 0, 0, u);
					a[u] = a[u]->next;
				}
				if (!a[u]) vis[u] = 2;
			}else {
				top = DfsStack[dtop].p1; 
				stack[DfsStack[dtop].p2] = DfsStack[dtop].w;
				dtop--;
			}
		}
	}
Exemplo n.º 5
0
void sar_nodeAddCharNode_c(sarNode_p node, sarNode_p newNode, char newChar) {
    int currSize = node->charNumber;

    int newSize = currSize+1;
    Renew(node->sarPathChars, newSize, char);
    Renew(node->sarNodes, newSize, sarNode_p);
    node->charNumber = newSize;

    int charOffset = 0;
    while(charOffset < currSize) {
        if (newChar < node->sarPathChars[charOffset]) {
            break;
        }
        ++charOffset;
    }

    int cpOffset = currSize;
    while(cpOffset > charOffset) {
        node->sarPathChars[cpOffset] = node->sarPathChars[cpOffset - 1];
        node->sarNodes[cpOffset] = node->sarNodes[cpOffset - 1];
        --cpOffset;
    }

    node->sarPathChars[cpOffset] = newChar;
    node->sarNodes[cpOffset] = newNode;
}
void CDlgAdminMapObject::OnAdminMsg(int nType, DWORD dwPara)
{
	switch (nType) {
	case ADMINMSG_RENEWMAPOBJECT:	/* マップオブジェクト情報更新 */
		Renew ();
		break;
	}
}
void CDlgAdminEfcEffectList::OnMainFrame(DWORD dwCommand, DWORD dwParam)
{
    switch (dwCommand) {
    case MAINFRAMEMSG_RENEWEFFECT:		/* エフェクト情報更新 */
        Renew ();
        break;
    }
}
void CDlgAdminCharSkillList::OnMainFrame(DWORD dwCommand, DWORD dwParam)
{
	switch (dwCommand) {
	case MAINFRAMEMSG_RENEWSKILLINFO:		/* スキル情報更新 */
		Renew ();
		break;
	}
}
void CDlgAdminCharModifyGrp::OnAdminMsg(int nType, DWORD dwPara)
{
	PCLibInfoCharCli pLibInfoChar;

	pLibInfoChar	= m_pMgrData->GetLibInfoChar ();
	m_pInfoChar		= (PCInfoCharCli)pLibInfoChar->GetPtr (dwPara);

	Renew ();
}
Exemplo n.º 10
0
		inline void Insert(Node* p, Node*& now, int v) {
			if (now == null) {
				now = Renew(v);
				now->p = p;
				Splay(now, null);
				return;
			}
			now->size++;
			bool d = (v > now->v);
			Insert(now, now->ch[d], v);
		}
Exemplo n.º 11
0
BOOL CDlgAdminMapObject::OnInitDialog()
{
	CDlgAdminBase::OnInitDialog();

	m_List.SetExtendedStyle (LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
	m_List.InsertColumn (1, "ID",				LVCFMT_LEFT, 50);
	m_List.InsertColumn (2, "オブジェクト名",	LVCFMT_LEFT, 200);

	RegisterControl (IDC_RENEW,	LH_CTRL_X);
	RegisterControl (IDC_LIST,	LH_CTRL_WIDTH | LH_CTRL_HEIGHT);

	Renew ();
	return TRUE;
}
BOOL CDlgAdminCharSkillList::OnInitDialog()
{
	CmyString strTmp;

	CDlgAdminBase::OnInitDialog ();

	m_List.SetExtendedStyle (LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
	m_List.InsertColumn (0, "ID",		LVCFMT_LEFT, 40);
	m_List.InsertColumn (1, "スキル名",	LVCFMT_LEFT, 300);

	Renew ();

	return TRUE;
}
Exemplo n.º 13
0
	/** checks if time for renew is reached, if so, renew */
	void RenewIfTime(){
		clock_t now = clock();
		// clock can wrap around, in this case renew bw immediately
		clock_t interval_msec = now < last_renew ? RENEW_INTERVAL_MSEC : CLOCKS_TO_MSEC(now - last_renew);
		if (interval_msec >= RENEW_INTERVAL_MSEC){
#if INSTRUMENT_BW
			// percentage used
			unsigned int total = ComputeTotalBW();
			unsigned int used = ComputeTotalUsedBW(); 
			REPORT_VALUE("BW total (per renew)", total);
			REPORT_VALUE("BW percentage", (used * 100) / total);
#endif
			Renew();
		}
	}
Exemplo n.º 14
0
Uint8* AudioQueue_next (AudioQueue* self, int size, bool wait)
{
	if (wait) SDL_SemWait(self->empty_node);
	else if (SDL_SemTryWait(self->empty_node)) return NULL;

	AudioNode* node = self->tail;

	SDL_AudioCVT* cvt = &self->cvt;

	Renew(node->buf, node->alloc_size, size * cvt->len_mult, Uint8);
	cvt->buf = node->buf;
	cvt->len = size;

	node->size = size * cvt->len_mult;
	return node->buf;
}
Exemplo n.º 15
0
void *
buffer_append_space(Buffer *buffer, uint32_t len)
{
  uint32_t newlen;
  void *p;

  if (len > BUFFER_MAX_CHUNK)
    croak("buffer_append_space: len %u too large (max %u)", len, BUFFER_MAX_CHUNK);

  /* If the buffer is empty, start using it from the beginning. */
  if (buffer->offset == buffer->end) {
    buffer->offset = 0;
    buffer->end = 0;
  }

restart:
  /* If there is enough space to store all data, store it now. */
  if (buffer->end + len <= buffer->alloc) {
    p = buffer->buf + buffer->end;
    buffer->end += len;
    return p;
  }

  /* Compact data back to the start of the buffer if necessary */
  if (buffer_compact(buffer))
    goto restart;

  /* Increase the size of the buffer and retry. */
  if (buffer->alloc + len < 4096)
    newlen = (buffer->alloc + len) * 2;
  else
    newlen = buffer->alloc + len + 4096;
  
  if (newlen > BUFFER_MAX_LEN)
    croak("buffer_append_space: alloc %u too large (max %u)",
        newlen, BUFFER_MAX_LEN);
#ifdef XS_DEBUG
  PerlIO_printf(PerlIO_stderr(), "Buffer extended to %d\n", newlen);
#endif
  Renew(buffer->buf, (int)newlen, u_char);
  buffer->alloc = newlen;
  goto restart;
  /* NOTREACHED */
}
Exemplo n.º 16
0
void CLibInfoMapEvent::Merge(CLibInfoMapEvent *pSrc)
{
	int i, nCount;
	PCInfoMapEventBase pInfoTmp, pInfoSrc, pInfoDst;

	nCount = pSrc->GetCount ();
	for (i = 0; i < nCount; i ++) {
		pInfoSrc = (PCInfoMapEventBase)pSrc->GetPtr (i);
		pInfoTmp = (PCInfoMapEventBase)GetPtr (pInfoSrc->m_dwMapEventID);
		if (pInfoTmp == NULL) {
			pInfoTmp = (PCInfoMapEventBase)GetNew (pInfoSrc->m_nType);
			pInfoTmp->Copy (pInfoSrc);
			Add (pInfoTmp);
		} else {
			pInfoDst = (PCInfoMapEventBase)GetNew (pInfoSrc->m_nType);
			pInfoDst->Copy (pInfoSrc);
			Renew (pInfoSrc->m_dwMapEventID, pInfoDst);
		}
	}
}
void CLibInfoMapObjectData::Merge(CLibInfoMapObjectData *pSrc)
{
    int i, nCount;
    PCInfoMapObjectData pInfoTmp, pInfoSrc, pInfoDst;

    nCount = pSrc->GetCount ();
    for (i = 0; i < nCount; i ++) {
        pInfoSrc = (PCInfoMapObjectData)pSrc->GetPtr (i);
        pInfoTmp = (PCInfoMapObjectData)GetPtr (pInfoSrc->m_dwDataID);
        if (pInfoTmp == NULL) {
            pInfoTmp = (PCInfoMapObjectData)GetNew ();
            pInfoTmp->Copy (pInfoSrc);
            Add (pInfoTmp);
        } else {
            pInfoDst = (PCInfoMapObjectData)GetNew ();
            pInfoDst->Copy (pInfoSrc);
            Renew (pInfoSrc->m_dwDataID, pInfoDst);
        }
    }
}
Exemplo n.º 18
0
int main(){
   traj = fopen("myTraj_0721_18p_modified6p.xyz","w");
   stateFile = fopen("state_0721.txt","w");
   InitialSet();
   t=0;
   while(t<time){
      t = t + 1;
      newcal();
      note();      
      for(a=0;a<N-1;a++){
          for(b=a+1;b<N;b++){
              CalDist();
              CalEdepth();
              CalForce();
          }
      }
      SumForces();
      State();
      Renew();
      }
   return 0;
}
Exemplo n.º 19
0
bool TApp::OnInit()
{
    errorCode = Success;
    parser = new wxCmdLineParser(argc, argv);
    parser->SetDesc(commandLineDescription);

    wxString description = "start with the specified multisampling mode:";
    description += "\n\t0\talways off";
    description += "\n\t1\talways on";
    description += "\n\t2\ton when stopped";
    parser->AddOption("f", "fsaa", description, wxCMD_LINE_VAL_NUMBER);


    parser->Parse();
    simple = parser->Found("s");
    logo = parser->Found("l");
    waitVsync = true;
    parser->Found("p", &program);

    long fsaa;
    if (parser->Found("f", &fsaa)) {
        switch (fsaa) {
            case 0: this->fsaa = Id::MultisampleAlwaysOff; break;
            case 1: this->fsaa = Id::MultisampleAlwaysOn; break;
            case 2: this->fsaa = Id::MultisampleOnWhenStopped; break;
        }
    } else {
        this->fsaa = Id::MultisampleOnWhenStopped;
    }

    if (single = parser->Found("b"))
        TCanvas::Attributes[TCanvas::DoubleBufferAttributeIndex] = 0;

    frame = 0;
    Renew();


    return true;
} 
Exemplo n.º 20
0
void CStaticMapShadow::OnSize(UINT nType, int cx, int cy)
{
	CStatic::OnSize(nType, cx, cy);

	Renew ();
}
Exemplo n.º 21
0
void CStaticMapShadow::SetScrollPos(int nPos)
{
	m_nPos = nPos;
	Renew ();
}
Exemplo n.º 22
0
// This function gets executed in each thread
void *startFunction(void *socketnumber)
{
	int s = *(int *)socketnumber;	
	char message[1000];
	
	//Send ACCEPTED to client acknowledge the client about the connection.
	strcpy(message, "ACCEPTED");
    send(s , message , strlen(message),0);

    int r;
    char query[1000];
    //Wait for client query.....
    while( (r = recv(s , query , 1000 , 0)) > 0 )
    {

    	//SEARCH for search, INSERT for insert, ISSUE for issue, RENEW for renew, RESERVE for reserve, EXIT for exit. 
    	if (query[0] == '1')
    	{
            //If writer is greater than 0 then donot allow any readers to enter.
            while(writers>0);
            readers++;
    		send(s, "1", strlen("1"),0);
    		//Receive Book Name in 
    		r = recv(s,query,1000,0);
            query[r] = '\0';
    		if (r==0 || r==-1)
    		{
    			break;
    		}
    		Search(query, message, myLibrary,nbooks);
            send(s,message,strlen(message),0);
            readers--;
    	}
    	else if (query[0] == '2')
    	{
            writers++;
            int thisWriter = turns++;
            //Wait for all the earliar readers to finish
            while(readers>0 || turn != thisWriter);//Do Nothing
    		send(s, "1", strlen("1"),0);
    		r = recv(s,query,1000,0);
            query[r] = '\0';
    		if (r==0 || r==-1)
    		{
    			break;
    		}
    		myLibrary = Insert(query,myLibrary,nbooks);
            send(s,"1",strlen("1"),0);
            writers--;
            turn++;
    	}
    	else if (query[0] == '3')
    	{
    		send(s, "1", strlen("1"),0);
    		r = recv(s,query,1000,0);
    		if (r==0 || r==-1)
    		{
    			break;
    		}
    		int result = Issue(atoi(query),message,myLibrary,nbooks);            
            send(s,message,strlen(message),0);
    	}
    	else if (query[0] == '4')
    	{
    		send(s, "1", strlen("1"),0);
    		r = recv(s,query,1000,0);
    		if (r==0 || r==-1)
    		{
    			break;
    		}
    		int result = Renew(atoi(query),message,myLibrary,nbooks);
            send(s,message,strlen(message),0);
    	}
    	else if (query[0] == '5')
    	{
    		send(s, "1", strlen("1"),0);
    		r = recv(s,query,1000,0);
    		if (r==0 || r==-1)
    		{
    			break;
    		}
    		int result = Reserve(atoi(query),message,myLibrary,nbooks);
            send(s,message,strlen(message),0);
    	}
    	else if (query[0] == '6')
    	{
            writers++;
            int thisWriter = turns++;
            send(s, "1", strlen("1"),0);
            int result = Exit(myLibrary,nbooks);
        }
        else if (query[0] == '7')
        {
            break;
        }
    }
     
    if(r == 0)
    {
        printf("Client %d disconnected\n",s );
    }
    else if(r == -1)
    {
        printf("Receive Failed from clien %d",s);
    }
    printf("Client %d disconnected\n",s );
    return(0);
}
Exemplo n.º 23
0
Arquivo: perly.c Projeto: behnaaz/jerl
Perl_yyparse (pTHX_ int gramtype)
#endif
{
    dVAR;
    int yystate;
    int yyn;
    int yyresult;

    /* Lookahead token as an internal (translated) token number.  */
    int yytoken = 0;

    yy_parser *parser;	    /* the parser object */
    yy_stack_frame  *ps;   /* current parser stack frame */

#define YYPOPSTACK   parser->ps = --ps
#define YYPUSHSTACK  parser->ps = ++ps

    /* The variable used to return semantic value and location from the
      action routines: ie $$.  */
    YYSTYPE yyval;

#ifndef PERL_IN_MADLY_C
#  ifdef PERL_MAD
    if (PL_madskills)
        return madparse(gramtype);
#  endif
#endif

    YYDPRINTF ((Perl_debug_log, "Starting parse\n"));

    parser = PL_parser;

    ENTER;  /* force parser state cleanup/restoration before we return */
    SAVEPPTR(parser->yylval.pval);
    SAVEINT(parser->yychar);
    SAVEINT(parser->yyerrstatus);
    SAVEINT(parser->stack_size);
    SAVEINT(parser->yylen);
    SAVEVPTR(parser->stack);
    SAVEVPTR(parser->ps);

    /* initialise state for this parse */
    parser->yychar = gramtype;
    parser->yyerrstatus = 0;
    parser->stack_size = YYINITDEPTH;
    parser->yylen = 0;
    Newx(parser->stack, YYINITDEPTH, yy_stack_frame);
    ps = parser->ps = parser->stack;
    ps->state = 0;
    SAVEDESTRUCTOR_X(S_clear_yystack, parser);

    /*------------------------------------------------------------.
    | yynewstate -- Push a new state, which is found in yystate.  |
    `------------------------------------------------------------*/
yynewstate:

    yystate = ps->state;

    YYDPRINTF ((Perl_debug_log, "Entering state %d\n", yystate));

    parser->yylen = 0;

    {
        size_t size = ps - parser->stack + 1;

        /* grow the stack? We always leave 1 spare slot,
         * in case of a '' -> 'foo' reduction */

        if (size >= (size_t)parser->stack_size - 1) {
            /* this will croak on insufficient memory */
            parser->stack_size *= 2;
            Renew(parser->stack, parser->stack_size, yy_stack_frame);
            ps = parser->ps = parser->stack + size -1;

            YYDPRINTF((Perl_debug_log,
                       "parser stack size increased to %lu frames\n",
                       (unsigned long int)parser->stack_size));
        }
    }

    /* Do appropriate processing given the current state.  */
    /* Read a lookahead token if we need one and don't already have one.  */

    /* First try to decide what to do without reference to lookahead token.  */

    yyn = yypact[yystate];
    if (yyn == YYPACT_NINF)
        goto yydefault;

    /* Not known => get a lookahead token if don't already have one.  */

    /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
    if (parser->yychar == YYEMPTY) {
        YYDPRINTF ((Perl_debug_log, "Reading a token: "));
#ifdef PERL_IN_MADLY_C
        parser->yychar = PL_madskills ? madlex() : yylex();
#else
        parser->yychar = yylex();
#endif

#  ifdef EBCDIC
        if (parser->yychar >= 0 && parser->yychar < 255) {
            parser->yychar = NATIVE_TO_ASCII(parser->yychar);
        }
#  endif
    }

    if (parser->yychar <= YYEOF) {
        parser->yychar = yytoken = YYEOF;
        YYDPRINTF ((Perl_debug_log, "Now at end of input.\n"));
    }
    else {
        yytoken = YYTRANSLATE (parser->yychar);
        YYDSYMPRINTF ("Next token is", yytoken, &parser->yylval);
    }

    /* If the proper action on seeing token YYTOKEN is to reduce or to
      detect an error, take that action.  */
    yyn += yytoken;
    if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
        goto yydefault;
    yyn = yytable[yyn];
    if (yyn <= 0) {
        if (yyn == 0 || yyn == YYTABLE_NINF)
            goto yyerrlab;
        yyn = -yyn;
        goto yyreduce;
    }

    if (yyn == YYFINAL)
        YYACCEPT;

    /* Shift the lookahead token.  */
    YYDPRINTF ((Perl_debug_log, "Shifting token %s, ", yytname[yytoken]));

    /* Discard the token being shifted unless it is eof.  */
    if (parser->yychar != YYEOF)
        parser->yychar = YYEMPTY;

    YYPUSHSTACK;
    ps->state   = yyn;
    ps->val     = parser->yylval;
    ps->compcv  = (CV*)SvREFCNT_inc(PL_compcv);
    ps->savestack_ix = PL_savestack_ix;
#ifdef DEBUGGING
    ps->name    = (const char *)(yytname[yytoken]);
#endif

    /* Count tokens shifted since error; after three, turn off error
      status.  */
    if (parser->yyerrstatus)
        parser->yyerrstatus--;

    goto yynewstate;


    /*-----------------------------------------------------------.
    | yydefault -- do the default action for the current state.  |
    `-----------------------------------------------------------*/
yydefault:
    yyn = yydefact[yystate];
    if (yyn == 0)
        goto yyerrlab;
    goto yyreduce;


    /*-----------------------------.
    | yyreduce -- Do a reduction.  |
    `-----------------------------*/
yyreduce:
    /* yyn is the number of a rule to reduce with.  */
    parser->yylen = yyr2[yyn];

    /* If YYLEN is nonzero, implement the default value of the action:
      "$$ = $1".

      Otherwise, the following line sets YYVAL to garbage.
      This behavior is undocumented and Bison
      users should not rely upon it.  Assigning to YYVAL
      unconditionally makes the parser a bit smaller, and it avoids a
      GCC warning that YYVAL may be used uninitialized.  */
    yyval = ps[1-parser->yylen].val;

    YY_STACK_PRINT(parser);
    YY_REDUCE_PRINT (yyn);

    switch (yyn) {


#define dep() deprecate("\"do\" to call subroutines")

#ifdef PERL_IN_MADLY_C
#  define IVAL(i) (i)->tk_lval.ival
#  define PVAL(p) (p)->tk_lval.pval
#  define TOKEN_GETMAD(a,b,c) token_getmad((a),(b),(c))
#  define TOKEN_FREE(a) token_free(a)
#  define OP_GETMAD(a,b,c) op_getmad((a),(b),(c))
#  define IF_MAD(a,b) (a)
#  define DO_MAD(a) a
#  define MAD
#else
#  define IVAL(i) (i)
#  define PVAL(p) (p)
#  define TOKEN_GETMAD(a,b,c)
#  define TOKEN_FREE(a)
#  define OP_GETMAD(a,b,c)
#  define IF_MAD(a,b) (b)
#  define DO_MAD(a)
#  undef MAD
#endif

        /* contains all the rule actions; auto-generated from perly.y */
#include "perly.act"

    }

    {
        int i;
        for (i=0; i< parser->yylen; i++) {
            SvREFCNT_dec(ps[-i].compcv);
        }
    }

    parser->ps = ps -= (parser->yylen-1);

    /* Now shift the result of the reduction.  Determine what state
      that goes to, based on the state we popped back to and the rule
      number reduced by.  */

    ps->val     = yyval;
    ps->compcv  = (CV*)SvREFCNT_inc(PL_compcv);
    ps->savestack_ix = PL_savestack_ix;
#ifdef DEBUGGING
    ps->name    = (const char *)(yytname [yyr1[yyn]]);
#endif

    yyn = yyr1[yyn];

    yystate = yypgoto[yyn - YYNTOKENS] + ps[-1].state;
    if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == ps[-1].state)
        yystate = yytable[yystate];
    else
        yystate = yydefgoto[yyn - YYNTOKENS];
    ps->state = yystate;

    goto yynewstate;


    /*------------------------------------.
    | yyerrlab -- here on detecting error |
    `------------------------------------*/
yyerrlab:
    /* If not already recovering from an error, report this error.  */
    if (!parser->yyerrstatus) {
        yyerror ("syntax error");
    }


    if (parser->yyerrstatus == 3) {
        /* If just tried and failed to reuse lookahead token after an
              error, discard it.  */

        /* Return failure if at end of input.  */
        if (parser->yychar == YYEOF) {
            /* Pop the error token.  */
            SvREFCNT_dec(ps->compcv);
            YYPOPSTACK;
            /* Pop the rest of the stack.  */
            while (ps > parser->stack) {
                YYDSYMPRINTF ("Error: popping", yystos[ps->state], &ps->val);
                LEAVE_SCOPE(ps->savestack_ix);
                if (yy_type_tab[yystos[ps->state]] == toketype_opval
                        && ps->val.opval)
                {
                    YYDPRINTF ((Perl_debug_log, "(freeing op)\n"));
                    if (ps->compcv != PL_compcv) {
                        PL_compcv = ps->compcv;
                        PAD_SET_CUR_NOSAVE(CvPADLIST(PL_compcv), 1);
                    }
                    op_free(ps->val.opval);
                }
                SvREFCNT_dec(ps->compcv);
                YYPOPSTACK;
            }
            YYABORT;
        }

        YYDSYMPRINTF ("Error: discarding", yytoken, &parser->yylval);
        parser->yychar = YYEMPTY;

    }

    /* Else will try to reuse lookahead token after shifting the error
      token.  */
    goto yyerrlab1;


    /*----------------------------------------------------.
    | yyerrlab1 -- error raised explicitly by an action.  |
    `----------------------------------------------------*/
yyerrlab1:
    parser->yyerrstatus = 3;	/* Each real token shifted decrements this.  */

    for (;;) {
        yyn = yypact[yystate];
        if (yyn != YYPACT_NINF) {
            yyn += YYTERROR;
            if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) {
                yyn = yytable[yyn];
                if (0 < yyn)
                    break;
            }
        }

        /* Pop the current state because it cannot handle the error token.  */
        if (ps == parser->stack)
            YYABORT;

        YYDSYMPRINTF ("Error: popping", yystos[ps->state], &ps->val);
        LEAVE_SCOPE(ps->savestack_ix);
        if (yy_type_tab[yystos[ps->state]] == toketype_opval && ps->val.opval) {
            YYDPRINTF ((Perl_debug_log, "(freeing op)\n"));
            if (ps->compcv != PL_compcv) {
                PL_compcv = ps->compcv;
                PAD_SET_CUR_NOSAVE(CvPADLIST(PL_compcv), 1);
            }
            op_free(ps->val.opval);
        }
        SvREFCNT_dec(ps->compcv);
        YYPOPSTACK;
        yystate = ps->state;

        YY_STACK_PRINT(parser);
    }

    if (yyn == YYFINAL)
        YYACCEPT;

    YYDPRINTF ((Perl_debug_log, "Shifting error token, "));

    YYPUSHSTACK;
    ps->state   = yyn;
    ps->val     = parser->yylval;
    ps->compcv  = (CV*)SvREFCNT_inc(PL_compcv);
    ps->savestack_ix = PL_savestack_ix;
#ifdef DEBUGGING
    ps->name    ="<err>";
#endif

    goto yynewstate;


    /*-------------------------------------.
    | yyacceptlab -- YYACCEPT comes here.  |
    `-------------------------------------*/
yyacceptlab:
    yyresult = 0;
    for (ps=parser->ps; ps > parser->stack; ps--) {
        SvREFCNT_dec(ps->compcv);
    }
    parser->ps = parser->stack; /* disable cleanup */
    goto yyreturn;

    /*-----------------------------------.
    | yyabortlab -- YYABORT comes here.  |
    `-----------------------------------*/
yyabortlab:
    yyresult = 1;
    goto yyreturn;

yyreturn:
    LEAVE;	/* force parser stack cleanup before we return */
    return yyresult;
}
Exemplo n.º 24
0
 RenewableCodedStream(io::ZeroCopyInputStream& input) 
     : m_input(input)
 {
     Renew();
 }