Esempio n. 1
0
// empilha (pilha de operandos, número encontrado)
void jj_expressao_2() {
	char * constante;
	sprintf(buffer, "K_%d", find_by_key(&table_numbers, token.value));
	constante = strcpy(buffer);
	push_stack(&pilha_operandos, constante);
	definir_nome_da_variavel_retornada_por_expressao(constante);
}
    int ObSSTableBlockIndexMgr::search_one_block_by_key(
        const ObRowkey& key, const SearchMode mode,
        ObBlockPositionInfo& pos_info) const
    {
      int ret = OB_SUCCESS;
      Bound bound;
      const_iterator find_it = NULL;

      if (is_regular_mode(mode) && NULL == key.ptr())
      {
        TBSYS_LOG(ERROR, "INVALID ARGUMENT");
        ret = OB_INVALID_ARGUMENT;
      }
      else if (OB_SUCCESS != (ret = get_bound(bound)))
      {
        TBSYS_LOG(ERROR, "get bound error");
      }
      else if (OB_SUCCESS != (ret = find_by_key(key, mode, bound, find_it)))
      {
        TBSYS_LOG(ERROR, "find by key error");
      }
      else
      {
        if (NULL != find_it && find_it < bound.end_ && find_it >= bound.begin_)
        {
          pos_info.offset_ = find_it->block_data_offset_;
          pos_info.size_ = (find_it + 1)->block_data_offset_
            - find_it->block_data_offset_;
        }
      }
      
      return ret;
    }
    int ObSSTableBlockIndexMgr::search_batch_blocks_by_key(
        const ObRowkey& key, const SearchMode mode,
        ObBlockPositionInfos& pos_info) const
    {
      int ret = OB_SUCCESS;
      Bound bound;
      const_iterator find_it = NULL;
      ObRowkey end_key;

      if (is_regular_mode(mode) && NULL == key.ptr())
      {
        TBSYS_LOG(ERROR, "is regular mode, but key==NULL");
        ret = OB_INVALID_ARGUMENT;
      }
      else if (OB_SUCCESS != (ret = get_bound(bound)))
      {
        TBSYS_LOG(ERROR, "get bound error");
      }
      else if (OB_SUCCESS != (ret = find_by_key(key, mode, bound, find_it)))
      {
        TBSYS_LOG(ERROR, "find by key error");
      }
      else if (OB_SUCCESS != (ret = store_block_position_info(
              find_it, bound, mode, end_key, pos_info)))
      {
        TBSYS_LOG(ERROR, "store block position info error");
      }
      else
      {
      }

      return ret;
    }
Esempio n. 4
0
int sc_pkcs15_find_so_pin(struct sc_pkcs15_card *p15card,
			struct sc_pkcs15_object **out)
{
	struct sc_pkcs15_search_key sk;

	memset(&sk, 0, sizeof(sk));
	sk.flags_mask = sk.flags_value = SC_PKCS15_PIN_FLAG_SO_PIN;
	
	return find_by_key(p15card, SC_PKCS15_TYPE_AUTH_PIN, &sk, out);
}
Esempio n. 5
0
int sc_pkcs15_find_prkey_by_id_usage(struct sc_pkcs15_card *p15card,
			       const struct sc_pkcs15_id *id,
			       unsigned int usage,
			       struct sc_pkcs15_object **out)
{
	struct sc_pkcs15_search_key sk;

	memset(&sk, 0, sizeof(sk));
	sk.usage_mask = sk.usage_value = usage;
	sk.id = id;

	return find_by_key(p15card, SC_PKCS15_TYPE_PRKEY, &sk, out);
}
Esempio n. 6
0
int sc_pkcs15_find_pin_by_reference(struct sc_pkcs15_card *p15card,
				const sc_path_t *path, int reference,
				struct sc_pkcs15_object **out)
{
	struct sc_pkcs15_search_key sk;

	memset(&sk, 0, sizeof(sk));
	sk.match_reference = 1;
	sk.reference = reference;
	sk.path = path;

	return find_by_key(p15card, SC_PKCS15_TYPE_AUTH_PIN, &sk, out);
}
    int ObSSTableBlockIndexMgr::search_batch_blocks_by_range(
        const ObNewRange& range, const bool is_reverse_scan,
        ObBlockPositionInfos& pos_info) const
    {
      int ret = OB_SUCCESS;
      Bound bound;
      const_iterator find_it = NULL;
      common::ObRowkey search_key;
      common::ObRowkey end_key;
      SearchMode mode = OB_SEARCH_MODE_MIN_VALUE;

      if (OB_SUCCESS != (ret = get_bound(bound)))
      {
        TBSYS_LOG(ERROR, "get bound error");
      }
      else if (OB_SUCCESS != (ret = trans_range_to_search_key(
              range, is_reverse_scan, search_key, mode)))
      {//基准key
        TBSYS_LOG(ERROR, "trans range to search key error");
      }
      else if (OB_SUCCESS != (ret = find_by_key(search_key, mode,
              bound, find_it)))
      {
        //TBSYS_LOG(ERROR, "find by key error");
      }
      else
      {
        if (is_reverse_scan && (!range.border_flag_.is_min_value()))
        {
          end_key = range.start_key_;
        }
        else if (!is_reverse_scan && (!range.border_flag_.is_max_value()))
        {
          end_key = range.end_key_;
        }

        if (OB_SUCCESS != (ret = store_block_position_info(
                find_it, bound, mode, end_key, pos_info)))
        {
          TBSYS_LOG(WARN, "stroe block position info error:ret=%d",
              ret);
        }
      }

      return ret;
    }
Esempio n. 8
0
PROTECTED
int handle_menu_key(WPARAM wParam)
{
    object win, obj;
    win = find_by_handle(GetFocus());
    if (win) {
	if (win->kind != WindowObject)
	    win = win->parent;
	obj = find_by_key(win, wParam);
	if (obj) {
	    adjust_menus_top_down(obj);
	    if (isenabled(obj)) /* Don't do menu actions which are greyed out. CJ */
		activatecontrol(obj);
	    return 1;
	}
    }
    return 0;
}
Esempio n. 9
0
void get_next_token(int is_declaration) {
	
	char temp_string[500];
	int counter;
	
	token.type = TOKEN_TYPE_IGNORED;
	token.value = NULL;
	
	if (reading_head.current == EOF) {
		/* return a END_OF_FILE token if the file was completely read */
		
		token.type = TOKEN_TYPE_END_OF_FILE;
		
	} else {
		/* extract a token from file */
		
		while (reading_head.current != EOF && token.type == TOKEN_TYPE_IGNORED) {
			/* chars being discarted */
			
			/* the transducer automata will execute a transition to consume the current char */
			token.type = transducer_consume_input(reading_head.current, reading_head.next);
			
			read_next_char();
		}
		
		
		/* 
		 * the previous char will not be dicarted because it created a transition to a
		 * valid state with transducer automata
		 */
		temp_string[0] = reading_head.previous;
		counter = 1;
		
		token.line = reading_head.line;
		token.column = reading_head.column-1;
		
		while (reading_head.current != EOF && token.type == TOKEN_TYPE_INCOMPLETE) {
			/* building token */
			
			/* the transducer automata will execute a transition to consume the current char */
			token.type = transducer_consume_input(reading_head.current, reading_head.next);
			
			temp_string[counter] = reading_head.current;
			counter += 1;
			
			read_next_char();
		}

		
		/* allocate memory to token value */
		token.value = (char*) malloc(counter*sizeof(char));
		while (counter > 0) {
			/* fill each char of the token value */
			token.value[counter-1] = temp_string[counter-1];
			counter -= 1;
		}
		
		
		if (token.type == TOKEN_TYPE_IGNORED) {
			free(token.value);
			token.value = NULL;
		} else if (token.type == TOKEN_TYPE_INCOMPLETE) {
			token.type = TOKEN_TYPE_INVALID;
		} else if (token.type == TOKEN_TYPE_IDENTIFIER && (find_by_key(&table_reserved_words, token.value) >= 0)) {
			token.type = TOKEN_TYPE_RESERVED_WORD;
		}
		
		//Only identifiers being declared will be added to the symbol table.
		if (token.type == TOKEN_TYPE_IDENTIFIER) {
			if (is_declaration == 1 ) {
				token.index = update_semantic_tables();
			}
		}
		else {
			token.index = update_semantic_tables();
		}

		
		
	}
	
}
Esempio n. 10
0
uint8_t rtyp_get_icom_address(int key) {
	int idx = find_by_key(key);
	if(idx < 0)
		return 0x00;
	return rig_types[idx].icom_addr;
}
Esempio n. 11
0
const char *rtyp_get_name(int key) {
	int idx = find_by_key(key);
	if(idx >= 0)
		return rig_types[idx].name;
	return "* Unknown key *";
}