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

C++ read_type函数代码示例

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

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



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

示例1: read_struct

/*
 * read a struct and add it to tree
 */
static void
read_struct(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree,
            int add_type_field)
{
  proto_item *ti;
  proto_tree *new_tree;
  int         length;
  int         i;

  ti = proto_tree_add_item(etch_tree, hf_etch_struct, tvb, *offset,
                           tvb_captured_length(tvb) - *offset, ENC_NA);
  new_tree = proto_item_add_subtree(ti, ett_etch_struct);

  if (add_type_field) {
    read_type(offset, tvb, new_tree);
  }
  /* struct type as hash */
  read_value(offset, tvb, new_tree, hf_etch_value);

  /* struct length */
  length = read_value(offset, tvb, new_tree, hf_etch_length);

  for (i = 0; i < length; i++) {
    read_key_value(offset, tvb, new_tree);
  }

  /* termination */
  read_type(offset, tvb, new_tree);
}
开发者ID:appneta,项目名称:wireshark,代码行数:32,代码来源:packet-etch.c


示例2: read_array_type

/*
 * read a array type flag and add it to tree
 */
static void
read_array_type(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
{
  guint32 type_code;

  type_code = tvb_get_guint8(tvb, *offset);

  read_type(offset, tvb, etch_tree);
  if (type_code == ETCH_TC_CUSTOM) {
    read_type(offset, tvb, etch_tree);
    proto_tree_add_item(etch_tree, hf_etch_value, tvb, *offset, 4,
                        ENC_BIG_ENDIAN);
    (*offset) += 4;
  }
}
开发者ID:appneta,项目名称:wireshark,代码行数:18,代码来源:packet-etch.c


示例3: read_params

/*
 * Read a list of parameters.  Each parameter is a name and a type.
 * The list ends with a ')'.  We have already read the '('.
 */
static struct params *
read_params()
{
	char *token;
	struct params *ret, **pp, *p;

	ret = NULL;
	pp = &ret;
	token = read_token_no_eof();
	if (strcmp(token, ")") != 0) {
		while (1) {
			p = xmalloc(sizeof(struct params));
			p->name = token;
			p->type = read_type();
			p->next = NULL;
			*pp = p;
			pp = &p->next;

			token = read_token_no_eof();
			if (strcmp(token, ",") != 0)
				break;
			token = read_token_no_eof();
		}
	}
	if (strcmp(token, ")") != 0) {
		sysfatal("%s:%ud: expected '('\n",
			file, lineno);
	}
	return ret;
}
开发者ID:0day-ci,项目名称:gcc,代码行数:34,代码来源:goc2c.c


示例4: read_number

/*
 * read a number and add it to tree
 */
static void
read_number(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree,
            int asWhat, guint8 type_code)
{
  int byteLength;

  read_type(offset, tvb, etch_tree);
  byteLength = get_byte_length(type_code);
  if (byteLength > 0) {
    proto_item  *ti;
    const gchar *symbol = NULL;
    guint32      hash   = 0;

    gbl_symbol_buffer = wmem_strbuf_new_label(wmem_packet_scope());  /* no symbol found yet */
    if (byteLength == 4) {
      hash = tvb_get_ntohl(tvb, *offset);
      symbol = try_val_to_str_ext(hash, gbl_symbols_vs_ext);
      if(symbol != NULL) {
        asWhat = hf_etch_symbol;
        gbl_have_symbol = TRUE;
        wmem_strbuf_append_printf(gbl_symbol_buffer,"%s",symbol);
      }
    }
    ti = proto_tree_add_item(etch_tree, asWhat, tvb, *offset,
                             byteLength, ENC_BIG_ENDIAN);
    *offset += byteLength;
    if (symbol != NULL) {
      proto_item_append_text(ti, " (0x%08x) %s", hash, symbol);
    }
  }
}
开发者ID:appneta,项目名称:wireshark,代码行数:34,代码来源:packet-etch.c


示例5: strcpy

static t_myproof_variable *read_data( tree t, t_myproof_function *function )
{
    char identifier[MYPROOF_NAME_SIZE];

    if ( DECL_NAME(t) )
	{
	    strcpy( identifier, IDENTIFIER_POINTER(DECL_NAME(t)) );
	}
    else
	{
	    sprintf(identifier, "%c_%u", ( TREE_CODE(t) == CONST_DECL ) ? 'C' : 'D', DECL_UID(t) );
	}

    t_myproof_variable *variable = mylist_find( function->variables, variable_exists, (void*)identifier );

    if ( variable == NULL )
	{
	    variable = create_variable_struct( identifier, t );
	    mylist_insert( &(function->variables), variable );
	}

    read_type( TREE_TYPE(t), function );

    return variable;
}
开发者ID:canercandan,项目名称:myproof,代码行数:25,代码来源:pass_variable.c


示例6: read_type

std::unique_ptr<tag> io::read(std::istream& is, std::string& key)
{
    tag::tag_type tt = read_type(is);
    key = read_str(is);
    if(!is)
        throw tag::input_error((boost::format("Error reading name of tag_%1%") % tt).str());
    return read_payload(tt, is);
}
开发者ID:eFrane,项目名称:libnbtplusplus,代码行数:8,代码来源:read.cpp


示例7: write_message

void bronco::serverconnection::handle_announce(const boost::system::error_code &error, const protocol::Announce &announce)
{
    if (!error) {
        /* send join request */
        write_message(announce);

        /* wait for reply */
        read_type();
    } else {
        handle_error(error);
    }
}
开发者ID:hundeboll,项目名称:bronco,代码行数:12,代码来源:serverconnection.cpp


示例8: read_data

static void read_data( tree t )
{
    if ( DECL_NAME(t) )
	{
	    /* printf ( "       data \'%s\'\n", IDENTIFIER_POINTER(DECL_NAME(t)) ); */
	}
    else
	{
	    /* printf ( "       data \'%c_%u\'\n", (TREE_CODE(t)==CONST_DECL)?'C':'D', DECL_UID(t) ); */
	}

    read_type ( TREE_TYPE(t) );
}
开发者ID:canercandan,项目名称:myproof,代码行数:13,代码来源:pass_generic.c


示例9: read_array

/*
 * read an array from tvb and add it to tree
 */
static void
read_array(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
{
  int length;

  /*  array type */
  read_type(offset, tvb, etch_tree);

  /*  Array of type: */
  read_array_type(offset, tvb, etch_tree);

  /*  Array dim */
  proto_tree_add_item(etch_tree, hf_etch_dim, tvb, *offset, 1, ENC_BIG_ENDIAN);
  (*offset)++;

  /*  Array length */
  length = read_length(offset, tvb, etch_tree);

  for (; length > 0; length--) {
    read_value(offset, tvb, etch_tree, hf_etch_value);
  }
  /*  terminaton */
  read_type(offset, tvb, etch_tree);
}
开发者ID:appneta,项目名称:wireshark,代码行数:27,代码来源:packet-etch.c


示例10: cw_ktv_parse_string

int cw_ktv_parse_string(struct cw_KTV_Reader *r, char *key, char *type, char *val)
{

	int n;

	

	n = read_key (r,key,CW_KTV_MAX_KEY_LEN);
	n = read_type(r,type,200);
	if (n==1)
		return -1;
	n = read_val(r,val,200);
	return n;
	
}
开发者ID:7u83,项目名称:actube,代码行数:15,代码来源:cw_ktv_parser.c


示例11: perror

/**
 * A wrapper function around read_type() and read_packet() for reading data from the pipe
 * and returning it.
 *
 * @param[in]   fd      The file descriptor to read from.
 * @param[in]   type    A pointer to the packet type.
 *
 * @return      <ul>
 *                  <li>Returns the packet if successful.</li>
 *                  <li>Returns NULL if it fails to read either of the type or the packet from the pipe.</li>
 *              </ul>
 *
 * @designer    Ramzi Chennafi
 * @author      Ramzi Chennafi
 */
void *read_data(int fd, uint32_t *type) {

    void *packet;
    *type = read_type(fd);
    if(*type <= 0 || *type > NUM_PACKETS) {
        perror("read_data: Failed to read packet type from pipe");
        return NULL;
    }

    if((packet = read_packet(fd, packet_sizes[*type - 1])) == NULL) {
        printf("read_data: Failed to read packet\n");
        return NULL;
    }

    return packet;
}
开发者ID:kptnkrnch,项目名称:CutThePower_Backup,代码行数:31,代码来源:GameplayCommunication.cpp


示例12: read_length

/*
 * read the length of an array and add it to tree
 */
static guint32
read_length(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
{
  guint32 length;
  int     length_of_array_length_type;
  guint8  tiny;

  tiny = tvb_get_guint8(tvb, *offset);

  /*  Is this the value already? */
  if (  tiny <= ETCH_TC_MAX_TINY_INT
        || tiny >= ETCH_TC_MIN_TINY_INT) {
    length = tiny;
    length_of_array_length_type = 1;
  } else {
    guint8 type_code;
    type_code = read_type(offset, tvb, etch_tree);
    length_of_array_length_type = get_byte_length(type_code);

    switch (length_of_array_length_type) {
    case 1:
      length = tvb_get_guint8(tvb, *offset);
      break;
    case 2:
      length = tvb_get_ntohs(tvb, *offset);
      break;
    case 4:
      length = tvb_get_ntohl(tvb, *offset);
      break;
    default:
      return 0;             /* error! */
    }
  }
  proto_tree_add_item(etch_tree, hf_etch_length, tvb, *offset,
                      length_of_array_length_type, ENC_BIG_ENDIAN);
  (*offset) += length_of_array_length_type;

  if (*offset + length < *offset) {
    /* overflow case
     * https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8464 */
    length = tvb_reported_length_remaining(tvb, *offset);
  }
  return length;
}
开发者ID:appneta,项目名称:wireshark,代码行数:47,代码来源:packet-etch.c


示例13: read_params

/* Read a list of parameters.  Each parameter is a name and a type.
   The list ends with a ')'.  We have already read the '('.  */
static struct params *
read_params(int *poffset)
{
	char *token;
	struct params *ret, **pp, *p;
	int offset, size, rnd;

	ret = NULL;
	pp = &ret;
	token = read_token_no_eof();
	offset = 0;
	if (strcmp(token, ")") != 0) {
		while (1) {
			p = xmalloc(sizeof(struct params));
			p->name = token;
			p->type = read_type();
			p->next = NULL;
			*pp = p;
			pp = &p->next;

			size = type_size(p->type);
			rnd = size;
			if(rnd > structround)
				rnd = structround;
			if(offset%rnd)
				offset += rnd - offset%rnd;
			offset += size;

			token = read_token_no_eof();
			if (strcmp(token, ",") != 0)
				break;
			token = read_token_no_eof();
		}
	}
	if (strcmp(token, ")") != 0) {
		fprintf(stderr, "%s:%u: expected '('\n",
			file, lineno);
		exit(1);
	}
	if (poffset != NULL)
		*poffset = offset;
	return ret;
}
开发者ID:Ahmah2009,项目名称:golang,代码行数:45,代码来源:goc2c.c


示例14: read_length

/*
 * read the length of an array and add it to tree
 */
static guint32
read_length(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
{
  guint32 length;
  int     length_of_array_length_type;
  guint8  tiny;

  tiny = tvb_get_guint8(tvb, *offset);

  /*  Is this the value already? */
  if (  tiny <= ETCH_TC_MAX_TINY_INT
        || tiny >= ETCH_TC_MIN_TINY_INT) {
    length = tiny;
    length_of_array_length_type = 1;
  } else {
    guint8 type_code;
    type_code = read_type(offset, tvb, etch_tree);
    length_of_array_length_type = get_byte_length(type_code);

    switch (length_of_array_length_type) {
    case 1:
      length = tvb_get_guint8(tvb, *offset);
      break;
    case 2:
      length = tvb_get_ntohs(tvb, *offset);
      break;
    case 4:
      length = tvb_get_ntohl(tvb, *offset);
      break;
    default:
      return 0;             /* error! */
    }
  }
  proto_tree_add_item(etch_tree, hf_etch_length, tvb, *offset,
                      length_of_array_length_type, ENC_BIG_ENDIAN);
  (*offset) += length_of_array_length_type;
  return length;
}
开发者ID:AnkitKejriwal,项目名称:wireshark,代码行数:41,代码来源:packet-etch.c


示例15: read_text

static void 
read_text(FILE *fob, mxArray **data, double dbu_to_uu)
{
   mxArray *pstruct;
   mxArray *pprop = NULL;
   uint16_t rtype, rlen;
   int nprop = 0;
   char tstr[TXTLEN+4];
   element_t text;
   const char *fields[] = {"internal", "xy", "prop", "text"};


   /* initialize element */
   init_element(&text, GDS_TEXT);

   /* output data structure */
   pstruct = mxCreateStructMatrix(1,1, 4, fields);

   /* read element properties */
   while (1) {
      
      if ( read_record_hdr(fob, &rtype, &rlen) )
	 mexErrMsgTxt("gds_read_element (text) :  could not read record header.");

      if (rtype == ENDEL)
	 break;

      switch (rtype) {

         case STRING:
	    if ( read_string(fob, tstr, rlen) )
	       mexErrMsgTxt("gds_read_element (text) :  could not read string.");
	    struct_set_string(pstruct, 3, tstr);
	    break;

         case TEXTTYPE:
	    text.dtype = read_type(fob);
	    break;

         case XY:
	    mxSetFieldByNumber(pstruct, 0, 1, read_xy(fob, rlen, dbu_to_uu));
	    break;

         case LAYER:
	    text.layer = read_layer(fob);
	    break;

         case PATHTYPE:
	    text.ptype = read_type(fob);
	    text.has |= HAS_PTYPE;
	    break;

         case WIDTH:
	    text.width = dbu_to_uu * read_width(fob);
	    text.has |= HAS_WIDTH;
	    break;

         case PRESENTATION:
	    if ( read_word(fob, &text.present) )
	       mexErrMsgTxt("gds_read_element (text) :  could not read presentation data.");
	    text.has |= HAS_PRESTN;
	    break;

         case STRANS:
	    if ( read_word(fob, &text.strans.flags) )
	       mexErrMsgTxt("gds_read_element (text) :  could not read strans data.");
	    text.has |= HAS_STRANS;
	    break;

         case MAG:
	    if ( read_real8(fob, &text.strans.mag) )
	       mexErrMsgTxt("gds_read_element (text) :  could not read magnification.");
	    text.has |= HAS_MAG;
	    break;

         case ANGLE:
	    if ( read_real8(fob, &text.strans.angle) )
	       mexErrMsgTxt("gds_read_element (text) :  could not read angle.");
	    text.has |= HAS_ANGLE;
	    break;

         case ELFLAGS:
	    text.elflags = read_elflags(fob);
	    text.has |= HAS_ELFLAGS;
	    break;

         case PLEX:
	    text.plex = read_plex(fob);
	    text.has |= HAS_PLEX;
	    break;

         case PROPATTR:
	    pprop = resize_property_structure(pprop, nprop+1);
	    mxSetFieldByNumber(pprop, nprop, 0, read_propattr(fob));
	    break;

         case PROPVALUE:
 	    mxSetFieldByNumber(pprop, nprop, 1, read_propvalue(fob,rlen));
	    nprop += 1;
	    break;
//.........这里部分代码省略.........
开发者ID:QiTai,项目名称:gdsii-toolbox,代码行数:101,代码来源:gds_read_element.c


示例16: set_type_name


//.........这里部分代码省略.........
	{ "always_active", "bool" },
	{ "activation_border", "int/int|decimal" },
	{ "fall_through_platforms", "any" },
	{ "has_feet", "bool" },
	
	{ "x_schedule", "any" },
	{ "y_schedule", "any" },
	{ "rotation_schedule", "any" },
	{ "schedule_speed", "any" },
	
	{ "schedule_expires", "any" },
	
	{ "platform_area", "null|[int]" },
	{ "platform_offsets", "[int]" },
	{ "custom_draw", "list" },
	
	{ "uv_array", "[decimal]" },
	{ "xy_array", "[decimal]" },
	{ "uv_segments", "[int]" },
	
	{ "draw_primitives", "[object]/[object|map]|map" },
	{ "event_handlers", "object" },
	
	{ "use_absolute_screen_coordinates", "bool" },
	
	{ "widgets", "object/[object|map]|object|map" },
	{ "widget_list", "[widget]" },
	{ "textv", "any" },
	{ "body", "any" },
	{ "paused", "bool" },
	{ "mouseover_delay", "int" },
	{ "mouseover_area", "[int]" },
	{ "particle_systems", "{string -> object}" },

	{ "truez", "bool" },
	{ "tx", "decimal" },
	{ "ty", "decimal" },
	{ "tz", "decimal" },

	{ "animated_movements", "[string]" },

	{ "ctrl_user_output", "any" },
	
	{ "ctrl_up", "bool" },
	{ "ctrl_down", "bool" },
	{ "ctrl_left", "bool" },
	{ "ctrl_right", "bool" },
	
	{ "ctrl_attack", "bool" },
	{ "ctrl_jump", "bool" },
	{ "ctrl_tongue", "bool" },
	{ "ctrl_user", "any" },

	//player-specific
	{ "difficulty", "int" },
	{ "can_interact", "bool" },
	{ "underwater_controls", "bool" },
	{ "ctrl_mod_key", "int" },
	{ "ctrl_keys", "[string]" },
	{ "ctrl_mice", "[[int|string]]" },
	{ "ctrl_tilt", "int" },
	{ "ctrl_x", "int" },
	{ "ctrl_y", "int" },
	{ "ctrl_reverse_ab", "bool" },
	{ "control_scheme", "string" },
	{ "vertical_look", "int" },
	{ "control_lock", "null|[string]" },
};
	ASSERT_EQ(NUM_CUSTOM_OBJECT_PROPERTIES, sizeof(CustomObjectProperties)/sizeof(*CustomObjectProperties));

	if(global_entries().empty()) {
		for(int n = 0; n != sizeof(CustomObjectProperties)/sizeof(*CustomObjectProperties); ++n) {
			global_entries().push_back(entry(CustomObjectProperties[n].id));

			const std::string& type = CustomObjectProperties[n].type;
			std::string::const_iterator itor = std::find(type.begin(), type.end(), '/');
			std::string read_type(type.begin(), itor);
			global_entries().back().set_variant_type(parse_variant_type(variant(read_type)));

			if(itor != type.end()) {
				global_entries().back().write_type = parse_variant_type(variant(std::string(itor+1, type.end())));
			}
		}

		for(int n = 0; n != global_entries().size(); ++n) {
			keys_to_slots()[global_entries()[n].id] = n;
		}

		global_entries()[CUSTOM_OBJECT_ME].set_variant_type(variant_type::get_custom_object());
		global_entries()[CUSTOM_OBJECT_SELF].set_variant_type(variant_type::get_custom_object());

		const variant_type_ptr builtin = variant_type::get_builtin("level");
		global_entries()[CUSTOM_OBJECT_LEVEL].set_variant_type(builtin);
	}

	global_entries()[CUSTOM_OBJECT_PARENT].type_definition = is_singleton ? this : &instance();
	global_entries()[CUSTOM_OBJECT_LIB].type_definition = game_logic::get_library_definition().get();

	entries_ = global_entries();
}
开发者ID:LungTakumi,项目名称:anura,代码行数:101,代码来源:custom_object_callable.cpp


示例17: read_box

static void 
read_box(FILE *fob, mxArray **data, double dbu_to_uu)
{
   mxArray *pstruct;
   mxArray *pprop = NULL;
   uint16_t rtype, rlen;
   int nprop = 0;
   element_t box;
   const char *fields[] = {"internal", "xy", "prop"};


   /* initialize element */
   init_element(&box, GDS_BOX);

   /* output data structure */
   pstruct = mxCreateStructMatrix(1,1, 3, fields);

   /* read element properties */
   while (1) {
      
      if ( read_record_hdr(fob, &rtype, &rlen) )
	 mexErrMsgTxt("gds_read_element (box) :  could not read record header.");

      if (rtype == ENDEL)
	 break;

      switch (rtype) {

         case XY:
	    mxSetFieldByNumber(pstruct, 0, 1, read_xy(fob, rlen, dbu_to_uu));
	    break;

         case LAYER:
	    box.layer = read_layer(fob);
	    break;

         case BOXTYPE:
	    box.dtype = read_type(fob);
	    break;

         case ELFLAGS:
	    box.elflags = read_elflags(fob);
	    box.has |= HAS_ELFLAGS;
	    break;

         case PLEX:
	    box.plex = read_plex(fob);
	    box.has |= HAS_PLEX;
	    break;

         case PROPATTR:
	    pprop = resize_property_structure(pprop, nprop+1);
	    mxSetFieldByNumber(pprop, nprop, 0, read_propattr(fob));
	    break;

         case PROPVALUE:
 	    mxSetFieldByNumber(pprop, nprop, 1, read_propvalue(fob,rlen));
	    nprop += 1;
	    break;

         default:
	    mexPrintf("Unknown record id: 0x%x\n", rtype);
	    mexErrMsgTxt("BOX :  found unknown element property.");
      }
   }

   /* set prop field */
   if ( nprop ) {
      mxSetFieldByNumber(pstruct, 0, 2, pprop);
   }
   else {
      mxSetFieldByNumber(pstruct, 0, 2, empty_matrix());
   }

   /* store structure with element data */
   mxSetFieldByNumber(pstruct, 0, 0, copy_element_to_array(&box));

   /* return data */
   *data = pstruct;
}
开发者ID:QiTai,项目名称:gdsii-toolbox,代码行数:80,代码来源:gds_read_element.c


示例18: parse

int parse(FILE *file)
{
  int head = read_header(file);

  if(head == false){
    printf("Invalid Clean C compiled file");
    return 1;
  }

  hash_t *var_map = malloc(sizeof(hash_t));
  hash_init(var_map, 1024);

  int ch = fgetc(file);
  while(ch != EOF){
    CODE code = ch - '0';
    switch(code){
      case PUSHS : {
        char type = read_type(file);
        if(type == 'S'){
          int length;
          fscanf(file, "%d", &length);
          char word[length+1];
          fgets(word, length+1, file);
          word[length+1]='\0';
          push(word);
        }
        break;
      }
      case PUSHV : {
        int length;
        fscanf(file, "%d", &length);
        char var[length+1];
        fgets(var, length+1, file);
        char *value = hash_lookup(var_map, var);
        push(value);
        break;
      }
      case ASSIGN : {
        int length;
        fscanf(file, "%d", &length);
        char var[length+1];
        fgets(var, length+1, file);

        char *value = pop();
        hash_insert(var_map, var, value);

        break;
      }
      case PRINT : {
        char *output = pop();
        printf("%s\n", output);
        break;
      }
      case END :
        return 0;
    }
    ch = fgetc(file);
  }

  free(var_map);
  return 0;
}
开发者ID:Foredoomed,项目名称:CC,代码行数:62,代码来源:interpreter.c


示例19: read_path

static void 
read_path(FILE *fob, mxArray **data, double dbu_to_uu) 
{
   mxArray *pstruct;
   mxArray *pprop = NULL;
   mxArray *pc;
   tList xylist;
   uint16_t rtype, rlen;
   int nprop = 0;
   int nle, k;
   element_t path;
   const char *fields[] = {"internal", "xy", "prop"};


   /* initialize element */
   init_element(&path, GDS_PATH);

   /* output data structure */
   pstruct = mxCreateStructMatrix(1,1, 3, fields);

   /* create a list for the XY data record(s) */
   if ( create_list(&xylist) == -1 )
      mexErrMsgTxt("gds_read_element (path) :  could not create list for XY records.");

   /* read element properties */
   while (1) {
      
      if ( read_record_hdr(fob, &rtype, &rlen) )
	 mexErrMsgTxt("gds_read_element (path) :  could not read record header.");

      if (rtype == ENDEL)
	 break;

      switch (rtype) {

         case XY:
	    if ( list_insert(xylist, read_xy(fob, rlen, dbu_to_uu), AFTER) == -1)
	       mexErrMsgTxt("gds_read_element (path) :  list insertion failed.");
	    break;

         case LAYER:
	    path.layer = read_layer(fob);
	    break;

         case PATHTYPE:
	    path.ptype = read_type(fob);
	    path.has |= HAS_PTYPE;
	    break;

         case WIDTH:
	    path.width = dbu_to_uu * (double)read_width(fob);
	    path.has |= HAS_WIDTH;
	    break;

         case BGNEXTN:
	    path.bgnextn = dbu_to_uu * read_extn(fob);
	    path.has |= HAS_BGNEXTN;
	    break;

         case ENDEXTN:
	    path.endextn = dbu_to_uu * read_extn(fob);
	    path.has |= HAS_ENDEXTN;
	    break;

         case DATATYPE:
	    path.dtype = read_type(fob);
	    break;

         case ELFLAGS:
	    path.elflags = read_elflags(fob);
	    path.has |= HAS_ELFLAGS;
	    break;

         case PLEX:
	    path.plex = read_plex(fob);
	    path.has |= HAS_PLEX;
	    break;

         case PROPATTR:
	    pprop = resize_property_structure(pprop, nprop+1);
	    mxSetFieldByNumber(pprop, nprop, 0, read_propattr(fob));
	    break;

         case PROPVALUE:
 	    mxSetFieldByNumber(pprop, nprop, 1, read_propvalue(fob,rlen));
	    nprop += 1;
	    break;

         default:
	    mexPrintf("Unknown record id: 0x%x\n", rtype);
	    mexErrMsgTxt("PATH :  found unknown element property.");
      }
   }

   /* cell array with XY records */
   nle = list_entries(xylist);
   if ( !nle )
      mexErrMsgTxt("gds_read_element (path) :  element has no XY record.");
   pc = mxCreateCellMatrix(1, nle);
   list_head(xylist);
//.........这里部分代码省略.........
开发者ID:QiTai,项目名称:gdsii-toolbox,代码行数:101,代码来源:gds_read_element.c


示例20: quicktime_atom_read_header

int quicktime_atom_read_header(quicktime_t *file, quicktime_atom_t *atom)
{
	int result = 0;
	char header[10];

	if(file->use_avi)
	{
		reset(atom);
		atom->start = quicktime_position(file);
		if(!quicktime_read_data(file, header, HEADER_LENGTH)) return 1;
		atom->type[0] = header[0];
		atom->type[1] = header[1];
		atom->type[2] = header[2];
		atom->type[3] = header[3];
		atom->type[4] = 0;
		atom->size = 
			(((unsigned char)header[4])      ) |
			(((unsigned char)header[5]) << 8 ) |
			(((unsigned char)header[6]) << 16) |
			(((unsigned char)header[7]) << 24);
		atom->end = quicktime_add3(atom->start, atom->size, 8);
	}
	else
	{
		int64_t size2;

		reset(atom);

		atom->start = quicktime_position(file);

		if(!quicktime_read_data(file, header, HEADER_LENGTH)) return 1;
		result = read_type(header, atom->type);
		atom->size = read_size(header);
		atom->end = atom->start + atom->size;
/*
 * printf("quicktime_atom_read_header 1 %c%c%c%c start %llx size %llx end %llx ftell %llx %llx\n", 
 * 	atom->type[0], atom->type[1], atom->type[2], atom->type[3],
 * 	atom->start, atom->size, atom->end,
 * 	file->file_position,
 * 	(int64_t)FTELL(file->stream));
 */

/* Skip placeholder atom */
		if(quicktime_match_32(atom->type, "wide"))
		{
			atom->start = quicktime_position(file);
			reset(atom);
			if(!quicktime_read_data(file, header, HEADER_LENGTH)) return 1;
			result = read_type(header, atom->type);
			atom->size -= 8;
			if(atom->size <= 0)
			{
/* Wrapper ended.  Get new atom size */
				atom->size = read_size(header);
			}
			atom->end = atom->start + atom->size;
		}
		else
/* Get extended size */
		if(atom->size == 1)
		{
			if(!quicktime_read_data(file, header, HEADER_LENGTH)) return 1;
			atom->size = read_size64(header);
			atom->end = atom->start + atom->size;
/*
 * printf("quicktime_atom_read_header 2 %c%c%c%c start %llx size %llx end %llx ftell %llx\n", 
 * 	atom->type[0], atom->type[1], atom->type[2], atom->type[3],
 * 	atom->start, atom->size, atom->end,
 * 	file->file_position);
 */
		}
	}


	return result;
}
开发者ID:beequ7et,项目名称:cinelerra-cv,代码行数:76,代码来源:atom.c



注:本文中的read_type函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ read_uint函数代码示例发布时间:2022-05-30
下一篇:
C++ read_title函数代码示例发布时间: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