Exemplo n.º 1
0
tlibc_error_code_t tlibc_csv_read_vector_begin(tlibc_abstract_reader_t *super, const char* vec_name)
{
	char *ch;
	tlibc_csv_reader_t *self = TLIBC_CONTAINER_OF(super, tlibc_csv_reader_t, super);
	int32_t index;
	index = get_field_index(self, self->col);
	if((index < 0) || (index >= TLIBC_CSV_FIELD_NUM))
	{
		return E_TLIBC_NOT_FOUND;
	}
	self->pre_read_uint32 = true;
	self->field = self->cur_line_fields[index];
	if((self->field == NULL) || (*self->field == 0))
	{
		self->pre_u32 = 0;
	}
	else
	{
		self->pre_u32 = 1;
		for(ch = self->field; *ch; ++ch)
		{
			if(*ch == ';')
			{
				++self->pre_u32;
			}
		}
	}

	return E_TLIBC_NOERROR;
}
Exemplo n.º 2
0
int Class::get_cp_field_index(u2 cp_index) {
	int index;
	char *name = get_cp_field_name(cp_index);
	
	index = get_field_index(name);
	if(index == -1) {
		printf("Error field %s not found: class.get_field_index\n", name);
		exit(0);
	}
	return index;
}
Exemplo n.º 3
0
tlibc_error_code_t tlibc_csv_read_field_begin(tlibc_abstract_reader_t *super, const char *var_name)
{
	tlibc_csv_reader_t *self = TLIBC_CONTAINER_OF(super, tlibc_csv_reader_t, super);
	int32_t index;

	if(self->pre_read_uint32)
	{   
		return E_TLIBC_NOERROR;
	}   
	TLIBC_UNUSED(var_name);
	index = get_field_index(self, self->col);
	if((index < 0) || (index >= TLIBC_CSV_FIELD_NUM))
	{
		return E_TLIBC_NOT_FOUND;
	}
	self->field = self->cur_line_fields[index];

	return E_TLIBC_NOERROR;
}
Exemplo n.º 4
0
// ------------------------------------------------------------------
// ciBytecodeStream::get_field
//
// If this bytecode is one of get_field, get_static, put_field,
// or put_static, get the referenced field.
ciField* ciBytecodeStream::get_field(bool& will_link) {
  ciField* f = CURRENT_ENV->get_field_by_index(_holder, get_field_index());
  will_link = f->will_link(_holder, _bc);
  return f;
}
Exemplo n.º 5
0
 /**
  * Gets the field index for the given name. Returns -1 if
  * the struct doesn't have a field of the given name.
  *
  * \param field_name  The name of the field.
  *
  * \returns  The field index, or -1 if there is not field
  *           of the given name.
  */
 inline intptr_t get_field_index(const std::string &field_name) const
 {
   return get_field_index(field_name.data(),
                          field_name.data() + field_name.size());
 }
ciField* ciBytecodeStream::get_field() const {
  return CURRENT_ENV->get_field_by_index(method()->holder(), get_field_index());
}