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

C++ concat函数代码示例

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

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



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

示例1: exprswitch

/*
 * normal (expression) switch.
 * rebulid case statements into if .. goto
 */
static void
exprswitch(Node *sw)
{
	Node *def;
	NodeList *cas;
	Node *a;
	Case *c0, *c, *c1;
	Type *t;
	int arg, ncase;

	casebody(sw, N);

	arg = Snorm;
	if(isconst(sw->ntest, CTBOOL)) {
		arg = Strue;
		if(sw->ntest->val.u.bval == 0)
			arg = Sfalse;
	}
	walkexpr(&sw->ntest, &sw->ninit);
	t = sw->type;
	if(t == T)
		return;

	/*
	 * convert the switch into OIF statements
	 */
	exprname = N;
	cas = nil;
	if(arg != Strue && arg != Sfalse) {
		exprname = temp(sw->ntest->type);
		cas = list1(nod(OAS, exprname, sw->ntest));
		typechecklist(cas, Etop);
	} else {
		exprname = nodbool(arg == Strue);
	}

	c0 = mkcaselist(sw, arg);
	if(c0 != C && c0->type == Tdefault) {
		def = c0->node->right;
		c0 = c0->link;
	} else {
		def = nod(OBREAK, N, N);
	}

loop:
	if(c0 == C) {
		cas = list(cas, def);
		sw->nbody = concat(cas, sw->nbody);
		sw->list = nil;
		walkstmtlist(sw->nbody);
		return;
	}

	// deal with the variables one-at-a-time
	if(!okforcmp[t->etype] || c0->type != Texprconst) {
		a = exprbsw(c0, 1, arg);
		cas = list(cas, a);
		c0 = c0->link;
		goto loop;
	}

	// do binary search on run of constants
	ncase = 1;
	for(c=c0; c->link!=C; c=c->link) {
		if(c->link->type != Texprconst)
			break;
		ncase++;
	}

	// break the chain at the count
	c1 = c->link;
	c->link = C;

	// sort and compile constants
	c0 = csort(c0, exprcmp);
	a = exprbsw(c0, ncase, arg);
	cas = list(cas, a);

	c0 = c1;
	goto loop;

}
开发者ID:Rasender,项目名称:Hello-ACS-560,代码行数:86,代码来源:swt.c


示例2: test_posix_extended

void
test_posix_extended ()
{
  /* Intervals can only match up to RE_DUP_MAX occurences of anything.  */
  char dup_max_plus_one[6];
  sprintf (dup_max_plus_one, "%d", RE_DUP_MAX + 1);


  printf ("\nStarting POSIX extended tests.\n");
  t = posix_extended_test;
  
  re_set_syntax (RE_SYNTAX_POSIX_MINIMAL_EXTENDED);  

  test_posix_generic ();

  printf ("\nContinuing POSIX extended tests.\n");

  /* Grouping tests that differ from basic's.  */
  
  test_should_match = true;
  MATCH_SELF ("a)");

                                /* Valid use of special characters.  */
  test_match ("\\(a", "(a");
  test_match ("a\\+", "a+");
  test_match ("a\\?", "a?");
  test_match ("\\{a", "{a");
  test_match ("\\|a", "|a");
  test_match ("a\\|b", "a|b");
  test_match ("a\\|?", "a");
  test_match ("a\\|?", "a|");
  test_match ("a\\|*", "a");
  test_match ("a\\|*", "a||");
  test_match ("\\(*\\)", ")");
  test_match ("\\(*\\)", "(()");
  test_match ("a\\|+", "a|");
  test_match ("a\\|+", "a||");
  test_match ("\\(+\\)", "()");
  test_match ("\\(+\\)", "(()");
  test_match ("a\\||b", "a|");
  test_match ("\\(?\\)", ")");
  test_match ("\\(?\\)", "()");

  test_match ("a+", "a");
  test_match ("a+", "aa");
  test_match ("a?", "");
  test_match ("a?", "a");

                                                /* Bracket expressions.  */
  test_match ("[(]", "(");
  test_match ("[+]", "+");
  test_match ("[?]", "?");
  test_match ("[{]", "{");
  test_match ("[|]", "|");
                                                /* Subexpressions.  */
  test_match ("(a+)*", "");
  test_match ("(a+)*", "aa");
  test_match ("(a?)*", "");
  test_match ("(a?)*", "aa");
                                                /* (No) back references.  */
  test_match ("(a)\\1", "a1");
                                                /* Invalid as intervals,
                                                   but are valid patterns.  */
  MATCH_SELF ("{");
  test_match ("^{", "{");
  test_match ("a|{", "{");
  test_match ("({)", "{");
  MATCH_SELF ("a{");
  MATCH_SELF ("a{}");
  MATCH_SELF ("a{-1");
  MATCH_SELF ("a{-1}");
  MATCH_SELF ("a{0");            
  MATCH_SELF ("a{0,"); 
  MATCH_SELF (concat ("a{", dup_max_plus_one));
  MATCH_SELF (concat (concat ("a{", dup_max_plus_one), ","));
  MATCH_SELF ("a{1,0");
  MATCH_SELF ("a{1,0}");
  MATCH_SELF ("a{0,1");
  test_match ("[a{0,1}]", "}");
  test_match ("a{1,3}{-1}", "aaa{-1}");
  test_match (concat ("a{1,3}{", dup_max_plus_one), 
        concat ("aaa{", dup_max_plus_one));
  test_match ("a{1,3}{2,1}", "aaa{2,1}");
  test_match ("a{1,3}{1,2", "aaa{1,2");
          /* Valid consecutive repetitions.  */
  test_match ("a*+", "a");
  test_match ("a*?", "a");
  test_match ("a++", "a");
  test_match ("a+*", "a");
  test_match ("a+?", "a");
  test_match ("a??", "a");
  test_match ("a?*", "a");
  test_match ("a?+", "a");
  
  test_match ("a{2}?", "");
  test_match ("a{2}?", "aa");
  test_match ("a{2}+", "aa");
  test_match ("a{2}{2}", "aaaa");

  test_match ("a{1}?*", "");
//.........这里部分代码省略.........
开发者ID:OpenModelica,项目名称:OMCompiler-3rdParty,代码行数:101,代码来源:psx-extend.c


示例3: get_cegis_meta_name

std::string get_cegis_meta_name(const std::string &base_name)
{
  return concat(id2string(goto_functionst::entry_point()), base_name);
}
开发者ID:diffblue,项目名称:cbmc,代码行数:4,代码来源:meta_variables.cpp


示例4: hibc

int hibc(struct zint_symbol *symbol, unsigned char source[], int length)
{
	int counter, error_number, i;
	char to_process[40], temp[2], check_digit;
	
	if(length > 36) {
		strcpy(symbol->errtxt, "Data too long for HIBC LIC");
		return ERROR_TOO_LONG;
	}
	to_upper(source);
	error_number = is_sane(TECHNETIUM , source, length);
    if(error_number == ERROR_INVALID_DATA1) {
		strcpy(symbol->errtxt, "Invalid characters in data");
		return error_number;
	}
	
	strcpy(to_process, "+");
	counter = 41;
	for(i = 0; i < length; i++) {
		counter += posn(TECHNETIUM, source[i]);
	}
	counter = counter % 43;
	
	if(counter < 10) {
		check_digit = itoc(counter);
	} else {
		if(counter < 36) {
			check_digit = (counter - 10) + 'A';
		} else {
			switch(counter) {
				case 36: check_digit = '-'; break;
				case 37: check_digit = '.'; break;
				case 38: check_digit = ' '; break;
				case 39: check_digit = '$'; break;
				case 40: check_digit = '/'; break;
				case 41: check_digit = '+'; break;
				case 42: check_digit = '%'; break;
				default: check_digit = ' '; break; /* Keep compiler happy */
			}
		}
	}
	
	temp[0] = check_digit;
	temp[1] = '\0';
	
	concat(to_process, (char *)source);
	concat(to_process, temp);
	length = strlen(to_process);
	
	switch(symbol->symbology) {
		case BARCODE_HIBC_128:
			error_number = code_128(symbol, (unsigned char *)to_process, length);
			ustrcpy(symbol->text, (unsigned char*)"*");
			uconcat(symbol->text, (unsigned char*)to_process);
			uconcat(symbol->text, (unsigned char*)"*");
			break;
		case BARCODE_HIBC_39:
			symbol->option_2 = 0;
			error_number = c39(symbol, (unsigned char *)to_process, length);
			ustrcpy(symbol->text, (unsigned char*)"*");
			uconcat(symbol->text, (unsigned char*)to_process);
			uconcat(symbol->text, (unsigned char*)"*");
			break;
		case BARCODE_HIBC_DM:
			error_number = dmatrix(symbol, (unsigned char *)to_process, length);
			break;
		case BARCODE_HIBC_QR:
			error_number = qr_code(symbol, (unsigned char *)to_process, length);
			break;
		case BARCODE_HIBC_PDF:
			error_number = pdf417enc(symbol, (unsigned char *)to_process, length);
			break;
		case BARCODE_HIBC_MICPDF:
			error_number = micro_pdf417(symbol, (unsigned char *)to_process, length);
			break;
		case BARCODE_HIBC_AZTEC:
			error_number = aztec(symbol, (unsigned char *)to_process, length);
			break;
	}
	
	return error_number;
}
开发者ID:gamalielmendez,项目名称:BibliotecaImpresionSql,代码行数:82,代码来源:library.c


示例5: addWord

void addWord(Production p, char * word){
	p->word=concat(p->word,word);
}
开发者ID:kpjjpk,项目名称:tla-tp2,代码行数:3,代码来源:Grammar.c


示例6: time

Animation AnimationBuilder::spawnJobs(std::string &err, int maxTime){
	FractalLogger::getSingleton()->write(id, "Fractal Is Animated: Note Detailed progress not reported.\n");
	FractalLogger::getSingleton()->write(id, "Building Animation Data...\n");
	unsigned long genStart = time(NULL);

	Animation anim;
	anim.baseID = id;
	anim.timeStarted = genStart;
	if(maxTime > 0){
		anim.timeMustStop = time(NULL) + maxTime;
	}else{
		anim.timeMustStop = 0;
	}

	if(!p->getJson().isMember("anim") || !p->getJson()["anim"].isObject()){
		err += "No JSON Object Anim\n";
		return anim;
	}
	Json::Value animData = p->getJson()["anim"];
	p->getJson()["anim"] = Json::ValueType::nullValue;
	p->getJson()["basic"]["anim"]["selected"] = "no";
	if(!animData.isMember("frames") || !animData["frames"].isInt()){
		err += "anim.frames does not exist or non-int\n";
		return anim;
	}
	if(animData["frames"].asInt() < 1){
		err += "anim.frames out of bounds\n";
		return anim;
	}
	anim.frames = animData["frames"].asInt();

	if(!animData.isMember("fps") || !animData["fps"].isInt()){
		err += "anim.fps does not exist or non-int\n";
		return anim;
	}
	if(animData["fps"].asInt() < 1){
		err += "anim.fps out of bounds\n";
		return anim;
	}
	anim.fps = animData["fps"].asInt();

	if(!animData.isMember("keyframes") || !animData["keyframes"].isArray()){
		err += "anim.keyframes does not exist or non-array\n";
		return anim;
	}
	if(!SchemaManager::getSingleton()->validateAnimationParam(animData["keyframes"], anim.frames, err)){
		err += "Keyframe Validation Reported Error(s)!\n";
		return anim;
	}

	// first job will render frame one -- we need to render all others
	ParamsFile pnew(p->getJson().toStyledString(), false); // copy json data to interpolate
	buildAnimatedParams(animData, &pnew);

	for(int i=2; i<=anim.frames; i++){
		pnew.getJson()["internal"]["thisframe"] = i;
		std::string savepath = DirectoryManager::getSingleton()->getRootDirectory()+"renders/";
		savepath = concat(savepath, anim.baseID) + concat(".frame.", i) + ".job";

		interpolateFrame(pnew, i);

		pnew.saveToFile(savepath);
		anim.frameQueue.push_back(savepath);
	}

	p->getJson()["internal"]["thisframe"] = 1;
	p->getJson()["anim"] = animData;
	p->getJson()["basic"]["anim"]["selected"] = "yes"; // restore it :D

	// finally revalidate the parameters in case we messed up
	err += SchemaManager::getSingleton()->validateParamaters(p->getJson());

	if(err == ""){
		genStart = time(NULL) - genStart;
		FractalLogger::getSingleton()->write(id,
				concat("Animation Data Built: Took ", (float)genStart/1000)+" seconds!\n");
	}
	return anim;
}
开发者ID:jeffreysanti,项目名称:JSFractalEngine,代码行数:79,代码来源:AnimationBuilder.cpp


示例7: hashFunction

unsigned int hashFunction(int index0, int index1) {
	return concat(extractBits(index0, 0, 3), extractBits(index1, 0, 7));
	//return extractBits(index0, 0, 3) | extractBits(index1, 0, 4);
}
开发者ID:Junyi-Liu,项目名称:benchmarks-HLS,代码行数:4,代码来源:pivot_rt.c


示例8: telepen_num

int telepen_num(struct zint_symbol *symbol, unsigned char source[], int src_len)
{
	unsigned int i, count, check_digit, glyph;
	int error_number, temp_length = src_len;
	char dest[1024]; /* 14 + 60 * 14 + 14 + 14 + 1 ~ 1024 */
	unsigned char temp[64];
	
	error_number = 0;
	count = 0;

	if(temp_length > 60) {
		strcpy(symbol->errtxt, "Input too long");
		return ERROR_TOO_LONG;
	}
	ustrcpy(temp, source);		
	to_upper(temp);
	error_number = is_sane(NEON, temp, temp_length);
	if(error_number == ERROR_INVALID_DATA) {
		strcpy(symbol->errtxt, "Invalid characters in data");
		return error_number;
	}
	
	/* Add a leading zero if required */
	if (temp_length & 1)
	{
		memmove(temp + 1, temp, temp_length);
		temp[0] = '0';

		temp[++temp_length] = '\0';
	}

	/* Start character */
	strcpy(dest, TeleTable['_']);

	for (i = 0; i < temp_length; i += 2)
	{
		if(temp[i] == 'X') {
			strcpy(symbol->errtxt, "Invalid position of X in Telepen data");
			return ERROR_INVALID_DATA;
		}
		
		if(temp[i + 1] == 'X') {
			glyph = ctoi(temp[i]) + 17;
			count += glyph;
		} else {
			glyph = (10 * ctoi(temp[i])) + ctoi(temp[i + 1]);
			glyph += 27;
			count += glyph;
		}
		concat(dest, TeleTable[glyph]);
	}

	check_digit = 127 - (count % 127);
	if(check_digit == 127) { check_digit = 0; }
	concat(dest, TeleTable[check_digit]);

	/* Stop character */
	concat(dest, TeleTable['z']);
	
	expand(symbol, dest);
	ustrcpy(symbol->text, temp);
	return error_number;
}
开发者ID:Ulle84,项目名称:UllesSourceCode,代码行数:63,代码来源:telepen.c


示例9: concat

struct gen_seq : gen_seq<N-1, N-1, Is...>{};
template<unsigned... Is>
struct gen_seq<0, Is...> : seq<Is...>{};

template<unsigned N1, unsigned... I1, unsigned N2, unsigned... I2>
constexpr std::array<char const, N1+N2-1> concat(char const (&a1)[N1], char const (&a2)[N2], seq<I1...>, seq<I2...>){
  return {{ a1[I1]..., a2[I2]... }};
}

template<unsigned N1, unsigned N2>
constexpr std::array<char const, N1+N2-1> concat(char const (&a1)[N1], char const (&a2)[N2]){
  return concat(a1, a2, gen_seq<N1-1>{}, gen_seq<N2>{});
}

// The string is used to retrieve the version embedded into .so file on Linux
constexpr auto rs2_api_version = concat("VERSION: ",RS2_API_VERSION_STR);

template<>
bool contains(const std::shared_ptr<librealsense::device_info>& first,
              const std::shared_ptr<librealsense::device_info>& second)
{
    auto first_data = first->get_device_data();
    auto second_data = second->get_device_data();

    for (auto&& uvc : first_data.uvc_devices)
    {
        if (std::find(second_data.uvc_devices.begin(),
            second_data.uvc_devices.end(), uvc) ==
            second_data.uvc_devices.end())
            return false;
    }
开发者ID:EladZucker,项目名称:librealsense,代码行数:31,代码来源:context.cpp


示例10: test_preg_rep

// Used by test_ext_preg
static String test_preg_rep(CStrRef a, CStrRef b, CStrRef c) {
  return concat(f_strtoupper(c), a);
}
开发者ID:kreshano,项目名称:hiphop-php,代码行数:4,代码来源:test_externals.cpp


示例11: batch_process

int batch_process(struct zint_symbol *symbol, char *filename)
{
	FILE *file;
	unsigned char buffer[7100];
	unsigned char character;
	int posn = 0, error_number = 0, line_count = 1;
	char output_file[127];
	char number[12], reverse_number[12];
	int inpos, local_line_count;
	char format_string[127], reversed_string[127], format_char;
	int format_len, i;
	char adjusted[2];
	
	memset(buffer, 0, sizeof(unsigned char) * 7100);
	if(symbol->outfile[0] == '\0') {
		strcpy(format_string, "~~~~~.png");
	} else {
		if(strlen(format_string) < 127) {
			strcpy(format_string, symbol->outfile);
		} else {
			strcpy(symbol->errtxt, "Format string too long");
			return ZERROR_INVALID_DATA;
		}
	}
	memset(adjusted, 0, sizeof(char) * 2);
	
	if(!strcmp(filename, "-")) {
		file = stdin;
	} else {
		file = fopen(filename, "rb");
		if (!file) {
			strcpy(symbol->errtxt, "Unable to read input file");
			return ZERROR_INVALID_DATA;
		}
	}
	
	do {
		character = fgetc(file);
		if(character == '\n') {
			if(buffer[posn - 1] == '\r') {
				/* CR+LF - assume Windows formatting and remove CR */
				posn--;
				buffer[posn] = '\0';
			}
			inpos = 0;
			local_line_count = line_count;
			memset(number, 0, sizeof(char) * 12);
			memset(reverse_number, 0, sizeof(char) * 12);
			memset(reversed_string, 0, sizeof(char) * 127);
			memset(output_file, 0, sizeof(char) * 127);
			do {
				number[inpos] = itoc(local_line_count % 10);
				local_line_count /= 10;
				inpos++;
			} while (local_line_count > 0);
			number[inpos] = '\0';
			
			for(i = 0; i < inpos; i++) {
				reverse_number[i] = number[inpos - i - 1];
			}
			
			format_len = strlen(format_string);
			for(i = format_len; i > 0; i--) {
				format_char = format_string[i - 1];
				
				switch(format_char) {
					case '#':
						if (inpos > 0) {
							adjusted[0] = reverse_number[inpos - 1];
							inpos--;
						} else {
							adjusted[0] = ' ';
						}
						break;
					case '~':
						if (inpos > 0) {
							adjusted[0] = reverse_number[inpos - 1];
							inpos--;
						} else {
							adjusted[0] = '0';
						}
						break;
					case '@':
						if (inpos > 0) {
							adjusted[0] = reverse_number[inpos - 1];
							inpos--;
						} else {
							adjusted[0] = '*';
						}
						break;
					default:
						adjusted[0] = format_string[i - 1];
						break;
				}
				concat(reversed_string, adjusted);
			}
			
			for(i = 0; i < format_len; i++) {
				output_file[i] = reversed_string[format_len - i - 1];
			}
//.........这里部分代码省略.........
开发者ID:nitin-nizhawan,项目名称:zint,代码行数:101,代码来源:main.c


示例12: typeswitch


//.........这里部分代码省略.........
	typecheck(&boolname, Erv);

	hashname = temp(types[TUINT32]);
	typecheck(&hashname, Erv);

	t = sw->ntest->right->type;
	if(isnilinter(t))
		a = syslook("efacethash", 1);
	else
		a = syslook("ifacethash", 1);
	argtype(a, t);
	a = nod(OCALL, a, N);
	a->list = list1(facename);
	a = nod(OAS, hashname, a);
	typecheck(&a, Etop);
	cas = list(cas, a);

	c0 = mkcaselist(sw, Stype);
	if(c0 != C && c0->type == Tdefault) {
		def = c0->node->right;
		c0 = c0->link;
	} else {
		def = nod(OBREAK, N, N);
	}
	
	/*
	 * insert if statement into each case block
	 */
	for(c=c0; c!=C; c=c->link) {
		n = c->node;
		switch(c->type) {

		case Ttypenil:
			v.ctype = CTNIL;
			a = nod(OIF, N, N);
			a->ntest = nod(OEQ, facename, nodlit(v));
			typecheck(&a->ntest, Erv);
			a->nbody = list1(n->right);		// if i==nil { goto l }
			n->right = a;
			break;
		
		case Ttypevar:
		case Ttypeconst:
			n->right = typeone(n);
			break;
		}
	}

	/*
	 * generate list of if statements, binary search for constant sequences
	 */
	while(c0 != C) {
		if(c0->type != Ttypeconst) {
			n = c0->node;
			cas = list(cas, n->right);
			c0=c0->link;
			continue;
		}
		
		// identify run of constants
		c1 = c = c0;
		while(c->link!=C && c->link->type==Ttypeconst)
			c = c->link;
		c0 = c->link;
		c->link = nil;

		// sort by hash
		c1 = csort(c1, typecmp);
		
		// for debugging: linear search
		if(0) {
			for(c=c1; c!=C; c=c->link) {
				n = c->node;
				cas = list(cas, n->right);
			}
			continue;
		}

		// combine adjacent cases with the same hash
		ncase = 0;
		for(c=c1; c!=C; c=c->link) {
			ncase++;
			hash = list1(c->node->right);
			while(c->link != C && c->link->hash == c->hash) {
				hash = list(hash, c->link->node->right);
				c->link = c->link->link;
			}
			c->node->right = liststmt(hash);
		}
		
		// binary search among cases to narrow by hash
		cas = list(cas, typebsw(c1, ncase));
	}
	if(nerrors == 0) {
		cas = list(cas, def);
		sw->nbody = concat(cas, sw->nbody);
		sw->list = nil;
		walkstmtlist(sw->nbody);
	}
}
开发者ID:Rasender,项目名称:Hello-ACS-560,代码行数:101,代码来源:swt.c


示例13: concat

 //加等
 MyString& MyString::operator+=(const MyString &rhs)
 {
     concat(rhs.size(), rhs.data);
     return *this;
 }
开发者ID:LeonaLiu,项目名称:MyString,代码行数:6,代码来源:MyString.cpp


示例14: concat

void Panel::RefreshTitle()
{
	m_Title = concat(L'{', GetTitle(), L'}');
}
开发者ID:johnd0e,项目名称:farmanager,代码行数:4,代码来源:panel.cpp


示例15: P2C

static string
maketex P2C(kpse_file_format_type, format, string*, args)
{
  /* New implementation, use fork/exec pair instead of popen, since
   * the latter is virtually impossible to make safe.
   */
  unsigned len;
  string *s;
  string ret;
  string fn;
  
  if (!kpse_make_tex_discard_errors) {
    fprintf (stderr, "kpathsea: Running");
    for (s = &args[0]; *s != NULL; s++)
      fprintf (stderr, " %s", *s);
    fputc('\n', stderr);
  }

#if defined (AMIGA)
  /* Amiga has a different interface. */
  {
    string cmd;
    string newcmd;
    cmd = xstrdup(args[0]);
    for (s = &args[1];  *s != NULL; s++) {
      newcmd = concat(cmd, *s);
      free (cmd);
      cmd = newcmd;
    }
    ret = system(cmd) == 0 ? getenv ("LAST_FONT_CREATED"): NULL;
    free (cmd);
  }
#elif defined (MSDOS)
#error Implement new MSDOS mktex call interface here
#elif defined (WIN32)
  /* We would vastly prefer to link directly with mktex.c here.
     Unfortunately, it is not quite possible because kpathsea
     is not reentrant. The progname is expected to be set in mktex.c
     and various initialisations occur. So to be safe, we implement
     a call sequence equivalent to the Unix one. */
  {
    STARTUPINFO si;
    PROCESS_INFORMATION pi;

    HANDLE child_in, child_out, child_err;
    HANDLE father_in, father_out_dup;
    HANDLE current_pid;
    SECURITY_ATTRIBUTES sa = { sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
    string new_cmd = NULL, app_name = NULL;

    char buf[1024+1];
    int num;
    extern char *quote_args(char **argv);

    if (look_for_cmd(args[0], &app_name) == FALSE) {
      ret = NULL;
      goto error_exit;
    }

    /* Compute the command line */
    new_cmd = quote_args(args);

    /* We need this handle to duplicate other handles */
    current_pid = GetCurrentProcess();

    ZeroMemory( &si, sizeof(STARTUPINFO) );
    si.cb = sizeof(STARTUPINFO);
    si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW ;
    si.wShowWindow = /* 0 */ SW_HIDE ;

    /* Child stdin */
    child_in = CreateFile("nul",
                          GENERIC_READ,
                          FILE_SHARE_READ | FILE_SHARE_WRITE,
                          &sa,  /* non inheritable */
                          OPEN_EXISTING,
                          FILE_ATTRIBUTE_NORMAL,
                          NULL);
    si.hStdInput = child_in;

    if (CreatePipe(&father_in, &child_out, NULL, 0) == FALSE) {
      fprintf(stderr, "popen: error CreatePipe\n");
      goto error_exit;
    }
    if (DuplicateHandle(current_pid, child_out,
                        current_pid, &father_out_dup,
                        0, TRUE, DUPLICATE_SAME_ACCESS) == FALSE) {
      fprintf(stderr, "popen: error DuplicateHandle father_in\n");
      CloseHandle(father_in);
      CloseHandle(child_out);
      goto error_exit;
    }
    CloseHandle(child_out);
    si.hStdOutput = father_out_dup;

    /* Child stderr */
    if (kpse_make_tex_discard_errors) {
      child_err = CreateFile("nul",
                             GENERIC_WRITE,
                             FILE_SHARE_READ | FILE_SHARE_WRITE,
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:101,代码来源:tex-make.c


示例16: option

int option(char *arg) {
  	if (strncmp(arg, "-lccdir=", 8) == 0) {
		if (strcmp(cpp[0], LCCDIR "gcc/cpp") == 0)
			cpp[0] = concat(&arg[8], "/gcc/cpp");
		include[0] = concat("-I", concat(&arg[8], "/include"));
		include[1] = concat("-I", concat(&arg[8], "/gcc/include"));
		ld[9]  = concat(&arg[8], "/gcc/crtbegin.o");
		ld[12] = concat("-L", &arg[8]);
		ld[14] = concat("-L", concat(&arg[8], "/gcc"));
		ld[19] = concat(&arg[8], "/gcc/crtend.o");
		com[0] = concat(&arg[8], "/rcc");
	} else if (strcmp(arg, "-p") == 0 || strcmp(arg, "-pg") == 0) {
		ld[7] = "/usr/lib/gcrt1.o";
		ld[18] = "-lgmon";
	} else if (strcmp(arg, "-b") == 0) 
		;
	else if (strcmp(arg, "-g") == 0)
		;
	else if (strncmp(arg, "-ld=", 4) == 0)
		ld[0] = &arg[4];
	else if (strcmp(arg, "-static") == 0) {
		ld[3] = "-static";
		ld[4] = "";
	} else
		return 0;
	return 1;
}
开发者ID:DCPUTools,项目名称:dcpu16-lcc,代码行数:27,代码来源:linux.c


示例17: xgetcwd

string
xgetcwd (void)
{
    /* If the system provides getcwd, use it.  If not, use getwd if
       available.  But provide a way not to use getcwd: on some systems
       getcwd forks, which is expensive and may in fact be impossible for
       large programs like tex.  If your system needs this define and it
       is not detected by configure, let me know.
                                       -- Olaf Weber <[email protected] */
#if defined (HAVE_GETCWD) && !defined (GETCWD_FORKS)
    char path[PATH_MAX + 1];
#if defined(WIN32)
    string pp;
#endif

    if (getcwd (path, PATH_MAX + 1) == NULL) {
        FATAL_PERROR ("getcwd");
    }

#if defined(WIN32)
    for (pp = path; *pp; pp++) {
        if (*pp == '\\')
            *pp = '/';
#if defined (KPSE_COMPAT_API)
        else if (IS_KANJI(pp))
            pp++;
#endif
    }
#endif

    return xstrdup (path);
#elif defined (HAVE_GETWD)
    char path[PATH_MAX + 1];

    if (getwd (path) == NULL) {
        FATAL_PERROR ("getwd");
    }

    return xstrdup (path);
#else /* (not HAVE_GETCWD || GETCWD_FORKS) && not HAVE_GETWD */
    struct stat root_stat, cwd_stat;
    string cwd_path = (string)xmalloc(2); /* In case we assign "/" below.  */

    *cwd_path = 0;

    /* Find the inodes of the root and current directories.  */
    root_stat = xstat("/");
    cwd_stat  = xstat(".");

    /* Go up the directory hierarchy until we get to root, prepending each
       directory we pass through to `cwd_path'.  */
    while (!SAME_FILE_P(root_stat, cwd_stat)) {
        struct dirent *e;
        DIR *parent_dir;
        boolean found = false;

        xchdir("..");
        parent_dir = xopendir(".");

        /* Look through the parent directory for the entry with the same
           inode, so we can get its name.  */
        while ((e = readdir (parent_dir)) != NULL && !found) {
            struct stat test_stat;
            test_stat = xlstat(e->d_name);

            if (SAME_FILE_P(test_stat, cwd_stat)) {
                /* We've found it.  Prepend the pathname.  */
                string temp = cwd_path;
                cwd_path = concat3("/", e->d_name, cwd_path);
                free(temp);

                /* Set up to test the next parent.  */
                cwd_stat = xstat(".");

                /* Stop reading this directory.  */
                found = true;
            }
        }
        if (!found)
            LIB_FATAL2("No inode %d/device %d in parent directory",
                   cwd_stat.st_ino, cwd_stat.st_dev);

        xclosedir(parent_dir);
    }

    /* If the current directory is the root, cwd_path will be the empty
       string, and we will have not gone through the loop.  */
    if (*cwd_path == 0)
        strcpy(cwd_path, "/");
    else
        /* Go back to where we were.  */
        xchdir(cwd_path);

#ifdef DOSISH
    /* Prepend the drive letter to CWD_PATH, since this technique
       never tells us what the drive is.

       Note that on MS-DOS/MS-Windows, the branch that works around
       missing `getwd' will probably only work for DJGPP (which does
       have `getwd'), because only DJGPP reports meaningful
//.........这里部分代码省略.........
开发者ID:clerkma,项目名称:texlive-mobile,代码行数:101,代码来源:xgetcwd.c


示例18: process_include

static void
process_include (rtx desc, int lineno)
{
  const char *filename = XSTR (desc, 0);
  const char *old_filename;
  int old_lineno;
  char *pathname;
  FILE *input_file;

  /* If specified file name is absolute, skip the include stack.  */
  if (! IS_ABSOLUTE_PATH (filename))
    {
      struct file_name_list *stackp;

      /* Search directory path, trying to open the file.  */
      for (stackp = first_dir_md_include; stackp; stackp = stackp->next)
	{
	  static const char sep[2] = { DIR_SEPARATOR, '\0' };

	  pathname = concat (stackp->fname, sep, filename, NULL);
	  input_file = fopen (pathname, "r");
	  if (input_file != NULL)
	    goto success;
	  free (pathname);
	}
    }

  if (base_dir)
    pathname = concat (base_dir, filename, NULL);
  else
    pathname = xstrdup (filename);
  input_file = fopen (pathname, "r");
  if (input_file == NULL)
    {
      free (pathname);
      message_with_line (lineno, "include file `%s' not found", filename);
      errors = 1;
      return;
    }
 success:

  /* Save old cursor; setup new for the new file.  Note that "lineno" the
     argument to this function is the beginning of the include statement,
     while read_rtx_lineno has already been advanced.  */
  old_filename = read_rtx_filename;
  old_lineno = read_rtx_lineno;
  read_rtx_filename = pathname;
  read_rtx_lineno = 1;

  /* Read the entire file.  */
  while (1)
    {
      rtx desc;
      int c;

      c = read_skip_spaces (input_file);
      if (c == EOF)
	break;

      ungetc (c, input_file);
      lineno = read_rtx_lineno;
      desc = read_rtx (input_file);
      process_rtx (desc, lineno);
    }

  /* Do not free pathname.  It is attached to the various rtx queue
     elements.  */

  read_rtx_filename = old_filename;
  read_rtx_lineno = old_lineno;

  fclose (input_file);
}
开发者ID:Fokycnuk,项目名称:gcc,代码行数:73,代码来源:gensupport.c


示例19: get_local_meta_name

std::string get_local_meta_name(const std::string &func, const std::string &var)
{
  return concat(func, var);
}
开发者ID:diffblue,项目名称:cbmc,代码行数:4,代码来源:meta_variables.cpp


示例20: process_rtx

static void
process_rtx (rtx desc, int lineno)
{
  switch (GET_CODE (desc))
    {
    case DEFINE_INSN:
      queue_pattern (desc, &define_insn_tail, read_rtx_filename, lineno);
      break;

    case DEFINE_COND_EXEC:
      queue_pattern (desc, &define_cond_exec_tail, read_rtx_filename, lineno);
      break;

    case DEFINE_ATTR:
      queue_pattern (desc, &define_attr_tail, read_rtx_filename, lineno);
      break;

    case INCLUDE:
      process_include (desc, lineno);
      break;

    case DEFINE_INSN_AND_SPLIT:
      {
	const char *split_cond;
	rtx split;
	rtvec attr;
	int i;

	/* Create a split with values from the insn_and_split.  */
	split = rtx_alloc (DEFINE_SPLIT);

	i = XVECLEN (desc, 1);
	XVEC (split, 0) = rtvec_alloc (i);
	while (--i >= 0)
	  {
	    XVECEXP (split, 0, i) = copy_rtx (XVECEXP (desc, 1, i));
	    remove_constraints (XVECEXP (split, 0, i));
	  }

	/* If the split condition starts with "&&", append it to the
	   insn condition to create the new split condition.  */
	split_cond = XSTR (desc, 4);
	if (split_cond[0] == '&' && split_cond[1] == '&')
	  split_cond = concat (XSTR (desc, 2), split_cond, NULL);
	XSTR (split, 1) = split_cond;
	XVEC (split, 2) = XVEC (desc, 5);
	XSTR (split, 3) = XSTR (desc, 6);

	/* Fix up the DEFINE_INSN.  */
	attr = XVEC (desc, 7);
	PUT_CODE (desc, DEFINE_INSN);
	XVEC (desc, 4) = attr;

	/* Queue them.  */
	queue_pattern (desc, &define_insn_tail, read_rtx_filename, lineno);
	queue_pattern (split, &other_tail, read_rtx_filename, lineno);
	break;
      }

    default:
      queue_pattern (desc, &other_tail, read_rtx_filename, lineno);
      break;
    }
}
开发者ID:Fokycnuk,项目名称:gcc,代码行数:64,代码来源:gensupport.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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