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


C++ preprocess函数代码示例

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


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

示例1: printNumberOfMirrorStrings

void printNumberOfMirrorStrings (char * s)
{
	int max = 0, i, C = 0, R = 0, n = 0;
	
	i = 0;
	while (s[i++])
		n++;
	char * T = preprocess (s, n);
	n = 0;
	i = 0;
	while (T[i++])
		n++;
	int * P = (int *) malloc (n * sizeof (int));
	
	int max_arr[3001] = {0};
	
	for (i = 0; i < n; i++)
		P[i] = 0;
	
	for (i = 1; i < n-1; i++)
	{
		int i_mirror = C - (i - C);
		
		P[i] = (R > i) ? min (R - i, P[i_mirror]) : 0;
		
		while (T[i + 1 + P[i]] == T[i - 1 - P[i]])
			P[i]++;
		
		if (i + P[i] > R)
		{
			C = i;
			R = i + P[i];
		}
	}
	
	for (i = 1; i < n-1; i++)
	{
		if (P[i] > max)
		{
			max = P[i];
		}
		max_arr[P[i]]++;
	}
	
	printf ("%d %d\n", max, max_arr[max]);
	
	free (P);
	free (T);
}
开发者ID:asm123,项目名称:Codechef,代码行数:49,代码来源:msubstr_manacher.c

示例2: testConstructDFA2

void testConstructDFA2(){
	regexps = malloc(sizeof(struct REentry));
	char *s = "(a|b)*abb(a|b)*";
	regexps->regexp = malloc(strlen(s));
	strcpy(regexps->regexp, s);
	regexps->action = "printf;";
	regexps->next = NULL;
	preprocess();
	constructNFA();
	constructDFA();
	printDFATransTable();
	destroyDFA();
	destroyNFA();
	destroyGraph();
}
开发者ID:ZeyuMi,项目名称:MiLex,代码行数:15,代码来源:dfaConstructortest.c

示例3: printLCAs

// Prints LCAs for given queries q[0..m-1] in a tree
// with given root
void printLCAs(Node *root, Query q[], int m)
{
    // Allocate memory for V subsets and nodes
    struct subset * subsets = new subset[V+1];
 
    // Creates subsets and colors them WHITE
    initialise(subsets);
 
    // Preprocess the tree
    preprocess(root, subsets);
 
    // Perform a tree walk to process the LCA queries
    // offline
    lcaWalk(root->data , q, m, subsets);
}
开发者ID:gbelwariar,项目名称:Self-Made-Projects,代码行数:17,代码来源:Tarjan_Offline_Least_Common_Ancestor_Algorithm.cpp

示例4: test_compute_inf_timeslot

static void test_compute_inf_timeslot(void) {
    init_test_exam();
    exam *test_exams[] = {exam1, exam2, exam3, exam4,
                            exam5, exam6, exam7, exam8};
    init_test_array_exams(8, test_exams);
    preprocess(exams);
    CU_ASSERT_EQUAL(compute_inf_timeslot(exam1, exams), 0);
    CU_ASSERT_EQUAL(compute_inf_timeslot(exam7, exams), 0);
    /* Schedule Exam 1 at timeslot 2 (index 1)*/
    exams->data[0]->timeslot = 1;
    CU_ASSERT_EQUAL(compute_inf_timeslot(exams->data[0], exams), 0);
    /* First timeslot expected for Exam 7 (depends on Exam 1) : 3 (index 2) */
    CU_ASSERT_EQUAL(compute_inf_timeslot(exams->data[6], exams), 2);
    clean_array_exams();
}
开发者ID:Kent1,项目名称:Horaires,代码行数:15,代码来源:graph_heuristics_test.c

示例5: visit

void DeclarationValidator::visit(Declaration* declaration)
{
  bool testDataOk;
  QJson::Parser parser;
  QVariantMap testData = parser.parse(preprocess(declaration->comment()), &testDataOk).toMap();
  if (!testDataOk)
  {
    d->testsPassed = false;
    qDebug() << "Error parsing test data for declaration on line" << declaration->range().start.line + 1;
    qDebug() << "Parser error on comment line" << parser.errorLine() << "was" << parser.errorString();
    return;
  }
  if (!KDevelop::runTests(testData, declaration))
    d->testsPassed = false;
}
开发者ID:caidongyun,项目名称:kdevplatform,代码行数:15,代码来源:declarationvalidator.cpp

示例6: preprocess

  void Oscillator::process() {
    preprocess();

    int i = 0;
    if (input(kReset)->source->triggered &&
        input(kReset)->source->trigger_value == kVoiceReset) {
      int trigger_offset = input(kReset)->source->trigger_offset;
      for (; i < trigger_offset; ++i)
        tick(i);

      offset_ = 0.0;
    }
    for (; i < buffer_size_; ++i)
      tick(i);
  }
开发者ID:yoyz,项目名称:audio,代码行数:15,代码来源:twytch_oscillator.cpp

示例7: testConstructNFA3

void testConstructNFA3(){
	regexps = malloc(sizeof(struct REentry));
	char *s = "(a|b)*abb(a|b)*";
	regexps->regexp = malloc(strlen(s));
	strcpy(regexps->regexp, s);
	regexps->action = "printf;";
	regexps->next = malloc(sizeof(struct REentry));
	s = "(a|b)+abc(a|b|c)?";
	regexps->next->regexp = malloc(strlen(s));
	strcpy(regexps->next->regexp, s);
	regexps->next->action = "donothing";
	preprocess();
	constructNFA();
	printGraph();
	destroyNFA();
}
开发者ID:ZeyuMi,项目名称:MiLex,代码行数:16,代码来源:nfaConstructortest.c

示例8: main

int main(void)
{
    preprocess();
    scanf("%d", &tests);
    for(int t = 0; t < tests; ++ t)
    {
        scanf("%d", &bits);
        word[bits] = 0;
        for(int b = 0; b < bits; ++ b)
            scanf(" %c", &word[b]);

        solve();
    }

    return 0;
}
开发者ID:Neverous,项目名称:ii-mia,代码行数:16,代码来源:homeworks1.cpp

示例9: preprocess

void UvdState::processK1(K1 k1)
{
    preprocess(k1.ri.time);

    if (k1.ri.confidence == 3)
    {
        m_recvStats.k1Conf3Lines++;
    }
    else
    {
        m_recvStats.k1Conf4Lines++;
    }

    OccurrenceRecord record;
    if (m_pendingOccurrences.count(k1.tailNumber) == 0)
    {
        record.tailNumber = k1.tailNumber;
        record.firstTime = k1.ri.time;
        record.lastTime = k1.ri.time;
        m_pendingOccurrences[k1.tailNumber] = record;
    }
    else
    {
        record = m_pendingOccurrences[k1.tailNumber];
        if (record.lastTime + 100.0 < k1.ri.time)
        {
            // finalize old occurrence
            lock();
            m_occurrences.push_back(record);
            unlock();

            // and replace with new
            record.tailNumber = k1.tailNumber;
            record.firstTime = k1.ri.time;
            record.lastTime = k1.ri.time;
        }
        else
        {
            record.lastTime = k1.ri.time;
        }

        m_pendingOccurrences[k1.tailNumber] = record;
    }

    postprocess(k1.ri.time);
}
开发者ID:rcg17,项目名称:uvdg-cocoa,代码行数:46,代码来源:UvdState.cpp

示例10: Point

//---------------------------------------------------------------------------------------
Mat PAN::getcontours(vector<vector<Point>> &finalcontours,int parameter,String database){
	Mat img;
	finalcontours._Pop_back_n(finalcontours.size());
	Image image=PAN::Image(&img, 0, 0, 0, 0, Point(0, 0));
	Mat mod;
	if (parameter == 1){ mod = preprocess(panimage.img, &image, REMOVE_EMBLEM,database); }//used for cropping the image
	else if (parameter == 2){ mod = panimage.img->clone(); }
	int erosion_size = 4/parameter;
	Mat element = getStructuringElement(MORPH_RECT, Size(2 * erosion_size + 1, 2 * erosion_size + 1), Point(erosion_size, erosion_size));
	*image.img = mod.clone();
	int kernel_size = 3;
	int threshold = 81;
	int ratio = 2/parameter;
	int lowThreshold = 100;
	if (image.img->channels() >= 2){ cvtColor(*image.img, *image.img, CV_BGR2GRAY); }
	adaptiveThreshold(*image.img, *image.img, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY, threshold, threshold);
	erode(*image.img, *image.img, element);
	blur(*image.img, *image.img, Size(kernel_size, kernel_size));
	Canny(*image.img, *image.img, lowThreshold, lowThreshold*(2*ratio+1), 3, true);
	vector<vector<Point>> contours;
	findContours(*image.img, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE, Point(0, 0));

	for (unsigned int i = 0; i< contours.size(); i++){
		if (contours[i].size()>80 && contours[i].size() < 1000){
			vector<Point>temp = contours[i];
			if (parameter == 1){
				if (checktext(temp) == 1){ finalcontours.push_back(temp); }
			}
			else if (parameter == 2){
				if (checksign(temp) == 1){ 
					finalcontours.push_back(temp);
				}
			}
		}
	}

	RNG rng(1235);
	for (unsigned int i = 0; i<finalcontours.size(); i++){
		Scalar color = Scalar(rng.uniform(150, 255), rng.uniform(150, 255), rng.uniform(150, 255));
		drawContours(*image.img, finalcontours, i, color, 2, 8);
	}
	
	//imshow("output", *image.img);
	//waitKey();
	return mod;
}
开发者ID:Pranavgulati,项目名称:VeriSmart,代码行数:47,代码来源:PAN.cpp

示例11: test_get_first_exam

static void test_get_first_exam(void) {
    init_test_exam();
    exam *test_exams[] = {exam1, exam2, exam3, exam4,
                            exam5, exam6, exam7, exam8};
    init_test_array_exams(8, test_exams);
    preprocess(exams);
    exam *first = get_first_exam(exams, MAX_TIMESLOT);
    /* Initially, lower sat degree is Exam 4 */
    CU_ASSERT_PTR_EQUAL(first, exams->data[3]);
    /* Assign Exam 4 */
    exams->data[3]->timeslot = 2;
    first = get_first_exam(exams, MAX_TIMESLOT);
    /* Tie break between Exam 2, 5 and 6.
     * Exam 5 has the most students enrolled */
    CU_ASSERT_PTR_EQUAL(first, exams->data[4]);
    clean_array_exams();
}
开发者ID:Kent1,项目名称:Horaires,代码行数:17,代码来源:graph_heuristics_test.c

示例12: main

int main(int argc, char** argv) {
	char* sourceFileName = argv[1];
	FILE* source = fopen(sourceFileName, "r");
	preprocess(source);
	SymbolList* symlist = getSymbols();
	Symbol* symbols = symlist->symbols;
	// printf("Number of symbols: %d\n", symlist->size);
	// for (int i = 0; i < symlist->size; i++) {
	// 	printf("\n\n");
	// 	printSymbol(symbols);
	// 	symbols++;
	// }

	FILE* datasection = fopen("binarydata.txt", "w+");
	printDataSection(datasection, symlist);
	fclose(source);
}
开发者ID:tophep,项目名称:mips-assembler,代码行数:17,代码来源:testcase.c

示例13: cl_process

/* OpenCL processing function */
static cl_int
cl_process (GeglOperation       *op,
            cl_mem               in_tex,
            cl_mem               out_tex,
            size_t               global_worksize,
            const GeglRectangle *roi,
            int                  level)
{
  /* Retrieve a pointer to GeglChantO structure which contains all the
   * chanted properties
   */

  GeglChantO   *o         = GEGL_CHANT_PROPERTIES (op);
  const gfloat *coeffs    = o->chant_data;

  cl_int cl_err = 0;

  if (! coeffs)
    {
      coeffs = o->chant_data = preprocess (o);
    }

  if (!cl_data)
    {
      const char *kernel_name[] = {"kernel_temp", NULL};
      cl_data = gegl_cl_compile_and_build (kernel_source, kernel_name);
    }

  if (!cl_data) return 1;

  cl_err |= gegl_clSetKernelArg(cl_data->kernel[0], 0, sizeof(cl_mem),    (void*)&in_tex);
  cl_err |= gegl_clSetKernelArg(cl_data->kernel[0], 1, sizeof(cl_mem),    (void*)&out_tex);
  cl_err |= gegl_clSetKernelArg(cl_data->kernel[0], 2, sizeof(cl_float),  (void*)&coeffs[0]);
  cl_err |= gegl_clSetKernelArg(cl_data->kernel[0], 3, sizeof(cl_float),  (void*)&coeffs[1]);
  cl_err |= gegl_clSetKernelArg(cl_data->kernel[0], 4, sizeof(cl_float),  (void*)&coeffs[2]);
  if (cl_err != CL_SUCCESS) return cl_err;

  cl_err = gegl_clEnqueueNDRangeKernel(gegl_cl_get_command_queue (),
                                        cl_data->kernel[0], 1,
                                        NULL, &global_worksize, NULL,
                                        0, NULL, NULL);
  if (cl_err != CL_SUCCESS) return cl_err;

  return cl_err;
}
开发者ID:AjayRamanathan,项目名称:gegl,代码行数:46,代码来源:color-temperature.c

示例14: MOPO_ASSERT

  void Oscillator::process() {
    MOPO_ASSERT(inputMatchesBufferSize(kFrequency));
    MOPO_ASSERT(inputMatchesBufferSize(kPhase));

    preprocess();

    int i = 0;
    if (input(kReset)->source->triggered &&
        input(kReset)->source->trigger_value == kVoiceReset) {
      int trigger_offset = input(kReset)->source->trigger_offset;
      for (; i < trigger_offset; ++i)
        tick(i);

      offset_ = 0.0;
    }
    for (; i < buffer_size_; ++i)
      tick(i);
  }
开发者ID:mtytel,项目名称:mopo,代码行数:18,代码来源:oscillator.cpp

示例15: main

int main(void)
{
    preprocess();
    scanf("%lld", &tests);
    for(long long int t = 0; t < tests; ++ t)
    {
        scanf("%lld %lld", &numbers, &subset);
        for(long long int n = 0; n < numbers; ++ n)
        {
            scanf("%lld", &number[n]);
            number[n] %= MOD;
        }

        printf("Case #%lld: %lld\n", t + 1, solve(numbers, subset));
    }

    return 0;
}
开发者ID:Neverous,项目名称:individual,代码行数:18,代码来源:card.cpp


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