Esempio n. 1
0
_RES_TYPE_ _PICO_ACCEPT_(const _SES_TYPE_ ses,
                         const _STR_TYPE_ str)
 { if (STATUS != ENABLED)
     return _CTL_ERROR_;
   for (SES_IDX = 0 ; SES_IDX < _MAX_SES_ ; SES_IDX++)
     if (SES_TAB[SES_IDX].ses == ses)
       { if (SES_TAB[SES_IDX].res != _DO_ACCEPT_)
           return _CTL_ERROR_;
         CTX_RESTORE(SES_IDX);
         _stk_claim_();
         _mem_claim_STR_(str);
         _stk_push_EXP_(_ag_make_TXT_(str)); 
         _ESC_ = SES_TAB[SES_IDX].esc;        
         if (setjmp(SES_TAB[SES_IDX].exi) == 0) 
           _stk_loop_();
         CTX_CAPTURE(SES_IDX);
         return SES_TAB[SES_IDX].res; }
   return _SNA_ERROR_; }
Esempio n. 2
0
/*-------------------------------------------------------------------------*/
static _NIL_TYPE_ LRPL(_NIL_TYPE_)
 { _EXP_TYPE_ dct, arg, xdc, exp, nbr, tab, ltab, newtab, i;
   _UNS_TYPE_ ctr, siz, pos;
   _STR_TYPE_ iname;
   _TAG_TYPE_ tag;
   _stk_pop_EXP_(arg);
   _stk_pop_EXP_(exp);
   _stk_peek_EXP_(ltab);
   tag = _ag_get_TAG_(arg);
   if (tag == _VOI_TAG_)                                    // Assign the new lazy expression
     { _ag_set_LTAB_LZEXP_(ltab, exp);
       _ag_set_LTAB_DCT_(ltab, _DCT_);
       _stk_zap_CNT_(); }
   else if (TAB_tab[tag] && (_ag_get_TAB_SIZ_(arg) == 1))   // Assign new member of concrete part
     { tab = _ag_get_LTAB_CONCR_(ltab);
       siz = _ag_get_TAB_SIZ_(tab);
       nbr = _ag_get_TAB_EXP_(arg, 1);
       tag = _ag_get_TAG_(nbr);
       if (tag == _NBR_TAG_)
         { xdc = _ag_get_LTAB_DCT_(ltab);
           pos = _ag_get_NBU_(nbr);
  
           iname = "i";
           _mem_claim_STR_(iname);
           i = _env_make_NAM_(iname);
           dct = _ag_make_DCT_();
           _ag_set_DCT_NAM_(dct, i);
           _ag_set_DCT_VAL_(dct, nbr);
           _ag_set_DCT_DCT_(dct, xdc);
           _stk_poke_EXP_(_DCT_);
           _DCT_ = dct;
           _stk_push_EXP_(exp);
           _stk_push_EXP_(tab);
           if ((pos > 0) && (pos <= 1073741824))            // greatest positive number represented with 31 bits, greater are negative
             { if (pos > siz) 
                 { ctr = _ag_get_NBU_(nbr);                 // make the counter equal to pos
                   _mem_claim_SIZ_(ctr);                    // create a new concrete table
                   newtab = _ag_make_TAB_(ctr);
                   _ag_set_LTAB_CONCR_(ltab, newtab);
                   exp = _ag_make_LAZY_();                  // fill the new concrete table
                   while (ctr > siz) {                      // first fill with <lazy> members
                      _ag_set_TAB_EXP_(newtab, ctr, exp);
                      ctr--; }
                   while (ctr > 0) {                        // now copy the concrete part
                      exp = _ag_get_TAB_EXP_(tab, ctr);
                      _ag_set_TAB_EXP_(newtab, ctr, exp);
                      ctr--; }
                   _stk_poke_EXP_(newtab);
                 }
               _stk_pop_EXP_(tab);
               _stk_peek_EXP_(exp);
               _stk_poke_EXP_(tab);
               _stk_push_EXP_(nbr);
               _stk_push_EXP_(exp);
               _stk_poke_CNT_(ATL);
               _stk_push_CNT_(EXP);
             }
           else
            _error_(_RNG_ERROR_); }
       else
        _error_(_IIX_ERROR_); }
   else
     _error_(_IAG_ERROR_); }