当前位置: 首页>>代码示例>>C++>>正文


C++ c_start函数代码示例

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


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

示例1: ecard_readchunk

int ecard_readchunk(struct in_chunk_dir *cd, ecard_t *ec, int id, int num)
{
	struct ex_chunk_dir excd;
	int index = 16;
	int useld = 0;

	if (!ec->cid.cd)
		return 0;

	while(1) {
		ecard_readbytes(&excd, ec, index, 8, useld);
		index += 8;
		if (c_id(&excd) == 0) {
			if (!useld && ec->loader) {
				useld = 1;
				index = 0;
				continue;
			}
			return 0;
		}
		if (c_id(&excd) == 0xf0) { /* link */
			index = c_start(&excd);
			continue;
		}
		if (c_id(&excd) == 0x80) { /* loader */
			if (!ec->loader) {
				ec->loader = (loader_t)kmalloc(c_len(&excd),
							       GFP_KERNEL);
				if (ec->loader)
					ecard_readbytes(ec->loader, ec,
							(int)c_start(&excd),
							c_len(&excd), useld);
				else
					return 0;
			}
			continue;
		}
		if (c_id(&excd) == id && num-- == 0)
			break;
	}

	if (c_id(&excd) & 0x80) {
		switch (c_id(&excd) & 0x70) {
		case 0x70:
			ecard_readbytes((unsigned char *)excd.d.string, ec,
					(int)c_start(&excd), c_len(&excd),
					useld);
			break;
		case 0x00:
			break;
		}
	}
	cd->start_offset = c_start(&excd);
	memcpy(cd->d.string, excd.d.string, 256);
	return 1;
}
开发者ID:Antonio-Zhou,项目名称:Linux-2.6.11,代码行数:56,代码来源:ecard.c

示例2: Normal_World

void Normal_World(void)
{
	/*while(1)
	{
		semi_write0("[Fast Model] This is normal world\n");
		asm volatile(
				".arch_extension sec\n\t"
				"smc #0\n\t") ;
	}*/

	semi_write0("[bootwrapper] Dongli Boot Kernel!\n");
	c_start();
}
开发者ID:finallyjustice,项目名称:fastmodels-code,代码行数:13,代码来源:c_start.c

示例3: c_start

static void *c_next(struct seq_file *m, void *v, loff_t *pos)
{
	(*pos)++;
	return c_start(m, pos);
}
开发者ID:mozgwar,项目名称:GC-Wii-Linux-Kernel-3.12.y,代码行数:5,代码来源:proc.c

示例4: main

int main(int argc, char** argv)
{
    if (argc != 2)
    {
        std::cerr << "Usage: " << argv[0] << " <file name>\n";
        return 1;
    }

    // Open a new file and write the EBML Header. This specifies that the file
    // is an EBML file, and is a Tawara document.
    std::fstream stream(argv[1], std::ios::in|std::ios::out|std::ios::trunc);
    tawara::EBMLElement ebml_el;
    ebml_el.write(stream);

    // Open a new segment in the file. This will write some initial meta-data
    // and place some padding at the start of the file for final meta-data to
    // be written after tracks, clusters, etc. have been written.
    tawara::Segment segment;
    segment.write(stream);
    // Set up the segment information so it can be used while writing tracks
    // and clusters.
    // A UID is not required, but is highly recommended.
    boost::uuids::random_generator gen;
    boost::uuids::uuid uuid = gen();
    std::vector<char> uuid_data(uuid.size());
    std::copy(uuid.begin(), uuid.end(), uuid_data.begin());
    segment.info.uid(uuid_data);
    // The filename can be nice to know.
    segment.info.filename(argv[1]);
    // The segment's timecode scale is possibly the most important value in the
    // segment meta-data data. Without it, timely playback of frames is not
    // possible. It has a sensible default (defined in the Tawara specification),
    // but here we set it to ten milliseconds for demonstrative purposes.
    segment.info.timecode_scale(10000000);
    // The segment's date should be set. It is the somewhat-awkward value of
    // the number of seconds since the start of the millenium. Boost::Date_Time
    // to the rescue!
    bpt::ptime basis(boost::gregorian::date(2001, 1, 1));
    bpt::ptime start(bpt::second_clock::local_time());
    bpt::time_duration td = start - basis;
    segment.info.date(td.total_seconds());
    // Let's give the segment an inspirational title.
    segment.info.title("Example segment");
    // It sometimes helps to know what created a Tawara file.
    segment.info.muxing_app("libtawara-0.1");
    segment.info.writing_app("tawara_eg_write");

    // Set up the tracks meta-data and write it to the file.
    tawara::Tracks tracks;
    // Each track is represented in the Tracks information by a TrackEntry.
    // This specifies such things as the track number, the track's UID and the
    // codec used.
    tawara::TrackEntry::Ptr track(new tawara::TrackEntry(1, 1, "string"));
    track->name("Example frames");
    track->codec_name("ASCII string");
    // Adding each level 1 element (only the first occurance, in the case of
    // clusters) to the index makes opening the file later much faster.
    segment.index.insert(std::make_pair(tracks.id(),
                segment.to_segment_offset(stream.tellp())));
    // Now we can write the Tracks element.
    tracks.insert(track);
    tracks.write(stream);

    // The data itself is stored in clusters. Each cluster contains a number of
    // blocks, with each block containing a single frame of data.  Different
    // cluster implementations are available using different optimisations.
    // Here, we use the implementation that stores all its blocks in memory
    // before writing them all to the file at once. As with the segment,
    // clusters must be opened for writing before blocks are added. Once the
    // cluster is complete, it is finalised. How many blocks each cluster
    // contains is relatively flexible: the only limitation is on the range of
    // block timecodes that can be stored. Each timecode is a signed 16-bit
    // integer, and usually blocks have timecodes that are positive, limiting
    // the range to 32767. The unit of this value is the segment's timecode
    // scale. The default timecode scale therefore gives approximately 65
    // seconds of total range, with 32 seconds being used.
    tawara::MemoryCluster cluster;
    // Again, we add the cluster to the index for faster file opening.
    segment.index.insert(std::make_pair(cluster.id(),
                segment.to_segment_offset(stream.tellp())));
    // The cluster's timecode determines the basis for the timecodes of all
    // blocks in that cluster.
    bpt::ptime c_start(bpt::second_clock::local_time());
    bpt::time_duration c_td = c_start - start;
    cluster.timecode(c_td.total_microseconds() / 10000);
    // Open the cluster for writing so we can begin adding blocks.
    cluster.write(stream);
    // Here, a few blocks are added.
    for (int ii(1); ii <= 5; ++ii)
    {
        std::string frame("frame 1");
        frame[6] = ii + '0';
        // When creating a block, the track number must be specified. In our
        // case, all blocks belong to track 1. A timecode must also be given.
        // It is an offset from the cluster's timecode measured in the
        // segment's timecode scale.
        bpt::ptime b_start(bpt::second_clock::local_time());
        bpt::time_duration b_td = b_start - c_start;
        tawara::BlockElement::Ptr block(new tawara::SimpleBlock(1,
                    b_td.total_microseconds() / 10000));
//.........这里部分代码省略.........
开发者ID:gbiggs,项目名称:tawara,代码行数:101,代码来源:write.cpp


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