本文整理汇总了C++中concat3函数的典型用法代码示例。如果您正苦于以下问题:C++ concat3函数的具体用法?C++ concat3怎么用?C++ concat3使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了concat3函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: recorder_start
/* Start the recorder */
static void
recorder_start(void)
{
/* Alas, while we'd like to use mkstemp it is not portable,
and doing the autoconfiscation (and providing fallbacks) is more
than we want to cope with. So we have to be content with using a
default name. Throw in the pid so at least parallel builds might
work (Debian bug 575731). */
string cwd;
char pid_str[MAX_INT_LENGTH];
/* Windows (MSVC) seems to have no pid_t, so instead of storing the
value returned by getpid() we immediately consume it. */
sprintf (pid_str, "%ld", (long) getpid());
recorder_name = concat3(kpse_program_name, pid_str, ".fls");
/* If an output directory was specified, use it instead of cwd. */
if (output_directory) {
string temp = concat3(output_directory, DIR_SEP_STRING, recorder_name);
free(recorder_name);
recorder_name = temp;
}
recorder_file = xfopen(recorder_name, FOPEN_W_MODE);
cwd = xgetcwd();
fprintf(recorder_file, "PWD %s\n", cwd);
free(cwd);
}
示例2: P1C
static string
kpse_expand_kpse_dot P1C(string, path)
{
string ret, elt;
string kpse_dot = getenv("KPSE_DOT");
#ifdef MSDOS
boolean malloced_kpse_dot = false;
#endif
if (kpse_dot == NULL)
return path;
ret = (string)xmalloc(1);
*ret = 0;
#ifdef MSDOS
/* Some setups of ported Bash force $KPSE_DOT to have the //d/foo/bar
form (when `pwd' is used), which is not understood by libc and the OS.
Convert them back to the usual d:/foo/bar form. */
if (kpse_dot[0] == '/' && kpse_dot[1] == '/'
&& kpse_dot[2] >= 'A' && kpse_dot[2] <= 'z' && kpse_dot[3] == '/') {
kpse_dot++;
kpse_dot = xstrdup (kpse_dot);
kpse_dot[0] = kpse_dot[1]; /* drive letter */
kpse_dot[1] = ':';
malloced_kpse_dot = true;
}
#endif
for (elt = kpse_path_element (path); elt; elt = kpse_path_element (NULL)) {
string save_ret = ret;
boolean ret_copied = true;
/* We assume that the !! magic is only used on absolute components.
Single "." gets special treatment, as does "./" or its equivalent. */
if (kpse_absolute_p (elt, false) || (elt[0] == '!' && elt[1] == '!')) {
ret = concat3(ret, elt, ENV_SEP_STRING);
} else if (elt[0] == '.' && elt[1] == 0) {
ret = concat3 (ret, kpse_dot, ENV_SEP_STRING);
#ifndef VMS
} else if (elt[0] == '.' && IS_DIR_SEP(elt[1])) {
ret = concatn (ret, kpse_dot, elt + 1, ENV_SEP_STRING, NULL);
} else if (*elt) {
ret = concatn (ret, kpse_dot, DIR_SEP_STRING, elt, ENV_SEP_STRING, NULL);
#endif
} else {
/* omit empty path elements from TEXMFCNF.
See http://bugs.debian.org/358330. */
ret_copied = false;
}
if (ret_copied)
free (save_ret);
}
#ifdef MSDOS
if (malloced_kpse_dot) free (kpse_dot);
#endif
ret[strlen (ret) - 1] = 0;
return ret;
}
示例3: is_if
static const char* is_if (const char* line)
{
uintL n = strlen(line);
uintL i = 0;
/* Skip whitespace. */
for (; i < n && is_whitespace(line[i]); i++) {}
/* Parse a '#'. */
if (i < n && line[i] == '#')
i++;
else
return NULL;
/* Skip whitespace. */
for (; i < n && is_whitespace(line[i]); i++) {}
/* Check for "if". */
if (i+2 < n
&& line[i+0] == 'i'
&& line[i+1] == 'f'
&& is_whitespace(line[i+2])) {
i += 3;
for (; i < n && is_whitespace(line[i]); i++) {}
for (; n > i && is_whitespace(line[n-1]); n--) {}
return substring(line,i,n);
}
/* Check for "ifdef". */
if (i+5 < n
&& line[i+0] == 'i'
&& line[i+1] == 'f'
&& line[i+2] == 'd'
&& line[i+3] == 'e'
&& line[i+4] == 'f'
&& is_whitespace(line[i+5])) {
i += 6;
for (; i < n && is_whitespace(line[i]); i++) {}
for (; n > i && is_whitespace(line[n-1]); n--) {}
{ char* term = substring(line,i,n);
const char* result = concat3("defined(",term,")");
xfree(term);
return result;
} }
/* Check for "ifndef". */
if (i+6 < n
&& line[i+0] == 'i'
&& line[i+1] == 'f'
&& line[i+2] == 'n'
&& line[i+3] == 'd'
&& line[i+4] == 'e'
&& line[i+5] == 'f'
&& is_whitespace(line[i+6])) {
i += 7;
for (; i < n && is_whitespace(line[i]); i++) {}
for (; n > i && is_whitespace(line[n-1]); n--) {}
{ char* term = substring(line,i,n);
const char* result = concat3("!defined(",term,")");
xfree(term);
return result;
} }
return NULL;
}
示例4: do_texio_ini_print
static void do_texio_ini_print(lua_State * L, const char *extra)
{
const char *s;
int i = 1;
int l = term_and_log;
int n = lua_gettop(L);
if (n > 1) {
if (get_selector_value(L, i, &l))
i++;
}
for (; i <= n; i++) {
if (lua_isstring(L, i)) {
s = lua_tostring(L, i);
if (l == term_and_log || l == term_only)
fprintf(stdout, "%s%s", extra, s);
if (l == log_only || l == term_and_log) {
if (loggable_info == NULL) {
loggable_info = strdup(s);
} else {
char *v = concat3(loggable_info, extra, s);
free(loggable_info);
loggable_info = v;
}
}
}
}
}
示例5: main
int main(){
//Testar exo 1
char s1[10] ="marianas";
char s2[4] ="ana";
char* o = strstr(s1, s2);
printf("%s %s %s\n ", s1, s2, o);
//
//Testar exo2
int v[4] ={ 90, 4, 80, 2};
int in = maxInd(v, 4);
printf("O indice do maior valor no vetor v é %d cujo elemento é %d\n", in, v[in]);
//Testar exo 3
printf("Antes do concat\n");
LInt a = (LInt)malloc(sizeof(struct slist));
a->valor = 10;
a->prox = (LInt)malloc(sizeof(struct slist));
a->prox->valor = 20;
a->prox->prox = NULL;
printL(a);
LInt b = (LInt)malloc(sizeof(struct slist));
b->valor = 30;
b->prox = (LInt)malloc(sizeof(struct slist));
b->prox->valor = 40;
b->prox->prox= NULL;
printL(b);
concat3(&a, b);
printf("Depois do concat\n");
//a = concat(a,b);
printL(a);
//Testar exo4
printf("Exo 4\n");
ABin ar = (ABin)malloc(sizeof(struct nodo));
ar->valor = 50;
ar->esq = (ABin)malloc(sizeof(struct nodo));
ar->esq->valor = 30;
ar->esq->esq = NULL;
ar->esq->dir=NULL;
ar->dir = (ABin)malloc(sizeof(struct nodo));
ar->dir->valor = 80;
ar->dir->esq = NULL;
ar->dir->dir = NULL;
LInt lis = nivel(ar, 2);
printL(lis);
return 0;
}
示例6: switch
String c_AsyncFunctionWaitHandle::getName() {
switch (getState()) {
case STATE_BLOCKED:
case STATE_SCHEDULED:
case STATE_RUNNING: {
String funcName;
if (actRec()->func()->isClosureBody()) {
// Can we do better than this?
funcName = s__closure_;
} else {
funcName = actRec()->func()->name()->data();
}
String clsName;
if (actRec()->hasThis()) {
clsName = actRec()->getThis()->getVMClass()->name()->data();
} else if (actRec()->hasClass()) {
clsName = actRec()->getClass()->name()->data();
} else {
return funcName;
}
return concat3(clsName, "::", funcName);
}
default:
throw FatalErrorException(
"Invariant violation: encountered unexpected state");
}
}
示例7: pallet_id
// move
void pallet_id(const PalletMovement *movement)
{
printf("pallet_id: Adding id [%s] to pallet with rfid [%s] and [%s]\n", movement->id, movement->pallet, movement->pallet2);
char *time = get_time_string();
const char *keys[5] = {
"reader", "palletId", "tag1", "tag2", "time"
};
const char *values[5] = {
movement->reader,
movement->id,
movement->pallet,
movement->pallet2,
time
};
char *parameters = to_parameters(5, keys, values);
char *URL = concat3(BASE_URL, SERVER_MOVE_START, parameters);
movements_add(URL);
free(time);
free(parameters);
free(URL);
}
示例8: place_id
void place_id(const PalletMovement *movement)
{
printf("place_id: Adding tag to place [%s], with rfid tag [%s]\n", movement->id, movement->placement);
char *time = get_time_string();
const char *keys[4] = {
"reader", "place", "p", "time"
};
printf("Values place_id: reader: [%s] id: [%s] tag: [%s] time: [%s]\n", movement->reader, movement->id, movement->placement, time);
const char *values[4] = {
movement->reader,
movement->id,
movement->placement,
time
};
printf("URL snart");
char *parameters = to_parameters(4, keys, values);
char *URL = concat3(BASE_URL, SERVER_MOVE_START, parameters);
printf("URL: %s", URL);
movements_add(URL);
free(time);
free(parameters);
free(URL);
}
示例9: appdef
static void
appdef(char ***lstp, const char *def)
{
appstrg(lstp, concat2("-D__", def));
appstrg(lstp, concat3("-D__", def, "__"));
}
示例10: do_texio_ini_print
static void
do_texio_ini_print (lua_State *L, char *extra) {
char *s;
int i,n,l;
n = lua_gettop(L);
i = 1;
l = 3;
if (n>1) {
s=(char *)lua_tostring(L, 1);
if (strcmp(s,"log") == 0) { i++; l = 1; }
else if (strcmp(s,"term") == 0) { i++; l = 2; }
else if (strcmp(s,"term and log") == 0) { i++; l = 3; }
}
for (;i<=n;i++) {
if(lua_isstring(L, i)) {
s = (char *)lua_tostring(L, i);
if (l==2||l==3)
fprintf(stdout,"%s%s", extra, s);
if (l==1||l==3) {
if (loggable_info==NULL) {
loggable_info = strdup(s);
} else {
char *v = concat3 (loggable_info,extra,s);
free(loggable_info);
loggable_info = v;
}
}
}
}
}
示例11: INSTANCE_METHOD_INJECTION_BUILTIN
String c_Continuation::t_getorigfuncname() {
INSTANCE_METHOD_INJECTION_BUILTIN(Continuation, Continuation::getorigfuncname);
String called_class;
if (hhvm) {
if (actRec()->hasThis()) {
called_class = actRec()->getThis()->getVMClass()->name()->data();
} else if (actRec()->hasClass()) {
called_class = actRec()->getClass()->name()->data();
}
} else {
called_class = getCalledClass();
}
if (called_class.size() == 0) {
return m_origFuncName;
}
/*
Replace the class name in m_origFuncName with the LSB class. This
produces more useful traces.
*/
size_t method_pos = m_origFuncName.find("::");
if (method_pos != std::string::npos) {
return concat3(called_class, "::", m_origFuncName.substr(method_pos+2));
} else {
return m_origFuncName;
}
}
示例12: do_else
static void do_else ()
{
VectorString* v = StackVectorString_peek(ifdef_stack);
uintL i = VectorString_length(v) - 1;
const char* lastcondition = VectorString_element(v,i);
lastcondition = concat3("!(",lastcondition,")");
VectorString_set_element(v,i,lastcondition);
}
示例13: kpathsea_var_value
string
kpathsea_var_value (kpathsea kpse, const_string var)
{
string vtry, ret;
const_string value;
assert (kpse->program_name);
/* First look for VAR.progname. */
vtry = concat3 (var, ".", kpse->program_name);
value = getenv (vtry);
free (vtry);
if (!value || !*value) {
/* Now look for VAR_progname. */
vtry = concat3 (var, "_", kpse->program_name);
value = getenv (vtry);
free (vtry);
}
/* Just plain VAR. */
if (!value || !*value)
value = getenv (var);
/* Not in the environment; check a config file. */
if (!value || !*value)
value = kpathsea_cnf_get (kpse, var);
/* We have a value; do variable and tilde expansion. We want to use ~
in the cnf files, to adapt nicely to Windows and to avoid extra /'s
(see tilde.c), but we also want kpsewhich -var-value=foo to not
have any literal ~ characters, so our shell scripts don't have to
worry about doing the ~ expansion. */
ret = value ? kpathsea_expand (kpse, value) : NULL;
#ifdef KPSE_DEBUG
if (KPATHSEA_DEBUG_P (KPSE_DEBUG_VARS))
DEBUGF2("variable: %s = %s\n", var, ret ? ret : "(nil)");
#endif
return ret;
}
示例14: INSTANCE_METHOD_INJECTION_BUILTIN
/* SRC: classes/directoryiterator.php line 14 */
void c_DirectoryIterator::t___construct(Variant v_path) {
INSTANCE_METHOD_INJECTION_BUILTIN(DirectoryIterator, DirectoryIterator::__construct);
if (!(x_hphp_directoryiterator___construct(GET_THIS_TYPED(DirectoryIterator), toString(v_path)))) {
{
{
p_UnexpectedValueException tmp0 = coo_UnexpectedValueException();
throw_exception(((c_UnexpectedValueException*)tmp0.get()->create(concat3(NAMSTR(s_sys_ss19fa93f0, "DirectoryIterator::__construct("), toString(v_path), NAMSTR(s_sys_ss4e2ff123, "): failed to open dir"))), tmp0));
}
}
}
}
示例15: HHVM_FUNCTION
static Variant HHVM_FUNCTION(assert, const Variant& assertion,
const Variant& message /* = null */) {
if (!s_option_data->assertActive) return true;
CallerFrame cf;
Offset callerOffset;
auto const fp = cf(&callerOffset);
auto const passed = [&]() -> bool {
if (assertion.isString()) {
if (RuntimeOption::EvalAuthoritativeMode) {
// We could support this with compile-time string literals,
// but it's not yet implemented.
throw_not_supported("assert()",
"assert with strings argument in RepoAuthoritative mode");
}
return eval_for_assert(fp, assertion.toString()).toBoolean();
}
return assertion.toBoolean();
}();
if (passed) return true;
if (!s_option_data->assertCallback.isNull()) {
auto const unit = fp->m_func->unit();
PackedArrayInit ai(3);
ai.append(String(const_cast<StringData*>(unit->filepath())));
ai.append(Variant(unit->getLineNumber(callerOffset)));
ai.append(assertion.isString() ? assertion : empty_string_variant_ref);
HHVM_FN(call_user_func)(s_option_data->assertCallback, ai.toArray());
}
if (s_option_data->assertException) {
if (message.isObject()) {
Object exn = message.toObject();
if (exn.instanceof(SystemLib::s_AssertionErrorClass)) {
throw_object(exn);
}
}
SystemLib::throwExceptionObject(message.toString());
}
if (s_option_data->assertWarning) {
String name(message.isNull() ? "Assertion" : message.toString());
auto const str = !assertion.isString()
? " failed"
: concat3(" \"", assertion.toString(), "\" failed");
raise_warning("assert(): %s%s", name.data(), str.data());
}
if (s_option_data->assertBail) {
throw ExitException(1);
}
return init_null();
}