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


C++ ctype函数代码示例

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


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

示例1: lefdata

int
lefdata(int i, int c)
{
	int	ck;

	if (i >= nlin)
		i = nlin - 1;
	if (ctype(i, c) == 's') {
		for (ck = c; ctype(i, ck) == 's'; ck--)
			;
		if (thish(i, ck) == 0)
			return(0);
	}
	i = stynum[i];
	i = lefline[c][i];
	if (i > 0)
		return(i);
	if (dboxflg && c == 0)
		return(2);
	if (allflg)
		return(1);
	if (boxflg && c == 0)
		return(1);
	return(0);
}
开发者ID:dancrossnyc,项目名称:harvey,代码行数:25,代码来源:tu.c

示例2: acnt

/*
 * Check and cast arguments for builtins.
 */
static int
acnt(NODE *a, int narg, TWORD *tp)
{
    NODE *q;
    TWORD t;

    if (a == NIL)
        return narg;
    for (; a->n_op == CM; a = a->n_left, narg--) {
        if (tp == NULL)
            continue;
        q = a->n_right;
        t = ctype(tp[narg-1]);
        if (q->n_type == t)
            continue;
        a->n_right = ccast(q, t, 0, NULL, 0);
    }

    /* Last arg is ugly to deal with */
    if (narg == 1 && tp != NULL && a->n_type != tp[0]) {
        q = talloc();
        *q = *a;
        q = ccast(q, ctype(tp[0]), 0, NULL, 0);
        *a = *q;
        nfree(q);
    }
    return narg != 1;
}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:31,代码来源:builtins.c

示例3: skip_wdvarname

/* Return a pointer to the first character past any legal variable name */
const char *
skip_wdvarname(const char *s,
    /* skip array de-reference? */
    bool aok)
{
	if (s[0] == CHAR && ctype(s[1], C_ALPHX)) {
		do {
			s += 2;
		} while (s[0] == CHAR && ctype(s[1], C_ALNUX));
		if (aok && s[0] == CHAR && ord(s[1]) == ord('[')) {
			/* skip possible array de-reference */
			const char *p = s;
			char c;
			int depth = 0;

			while (/* CONSTCOND */ 1) {
				if (p[0] != CHAR)
					break;
				c = p[1];
				p += 2;
				if (ord(c) == ord('['))
					depth++;
				else if (ord(c) == ord(']') && --depth == 0) {
					s = p;
					break;
				}
			}
		}
	}
	return (s);
}
开发者ID:tomgrean,项目名称:mksh,代码行数:32,代码来源:var.c

示例4: lspan

lspan(i,c)
{
int k;
if (ctype(i,c) != 's') return(0);
c++;
if (c < ncol && ctype(i,c)== 's') 
	return(0);
for(k=0; ctype(i,--c) == 's'; k++);
return(k);
}
开发者ID:dank101,项目名称:4.4BSD-Alpha,代码行数:10,代码来源:tt.c

示例5: oneh

int oneh(int lin)
{
int k, icol;
k = ctype(lin,0);
for(icol=1; icol<ncol; icol++)
	{
	if (k != ctype(lin,icol))
		return(0);
	}
return(k);
}
开发者ID:5432935,项目名称:crossbridge,代码行数:11,代码来源:t5.c

示例6: domore

int
domore(char *dataln)
{
	int	icol, ch;

	if (prefix(".TE", dataln))
		return(0);
	if (dataln[0] == '.' && !isdigit((uchar)dataln[1])) {
		Bprint(&tabout, "%s\n", dataln);
		return(1);
	}
	fullbot[0] = 0;
	instead[0] = (char *)0;
	if (dataln[1] == 0)
		switch (dataln[0]) {
		case '_': 
			fullbot[0] = '-'; 
			putline(useln, 0);  
			return(1);
		case '=': 
			fullbot[0] = '='; 
			putline(useln, 0); 
			return(1);
		}
	for (icol = 0; icol < ncol; icol++) {
		table[0][icol].col = dataln;
		table[0][icol].rcol = 0;
		for (; (ch = *dataln) != '\0' && ch != tab; dataln++)
			;
		*dataln++ = '\0';
		switch (ctype(useln, icol)) {
		case 'n':
			table[0][icol].rcol = maknew(table[0][icol].col);
			break;
		case 'a':
			table[0][icol].rcol = table[0][icol].col;
			table[0][icol].col = "";
			break;
		}
		while (ctype(useln, icol + 1) == 's') /* spanning */
			table[0][++icol].col = "";
		if (ch == '\0') 
			break;
	}
	while (++icol < ncol)
		table[0][icol].col = "";
	putline(useln, 0);
	exstore = exspace;		 /* reuse space for numerical items */
	return(1);
}
开发者ID:00001,项目名称:plan9port,代码行数:50,代码来源:t9.c

示例7: skip_varname

/*
 * Return a pointer to the first char past a legal variable name
 * (returns the argument if there is no legal name, returns a pointer to
 * the terminating NUL if whole string is legal).
 */
const char *
skip_varname(const char *s, bool aok)
{
	size_t alen;

	if (s && ctype(*s, C_ALPHX)) {
		do {
			++s;
		} while (ctype(*s, C_ALNUX));
		if (aok && ord(*s) == ord('[') && (alen = array_ref_len(s)))
			s += alen;
	}
	return (s);
}
开发者ID:tomgrean,项目名称:mksh,代码行数:19,代码来源:var.c

示例8: makeline

makeline(i,c,lintype)
{
int cr, type, shortl;
type = thish(i,c);
if (type==0) return;
cr=c;
shortl = (table[i][c].col[0]=='\\');
if (c>0 && !shortl && thish(i,c-1) == type)return;
if (shortl==0)
	for(cr=c; cr < ncol && (ctype(i,cr)=='s'||type==thish(i,cr)); cr++);
else
	for(cr=c+1; cr<ncol && ctype(i,cr)=='s'; cr++);
drawline(i, c, cr-1, lintype, 0, shortl);
}
开发者ID:YoshikazuNakahara,项目名称:Unixv7x86,代码行数:14,代码来源:tu.c

示例9: runtabs

void
runtabs(int lform, int ldata)
{
int c, ct, vforml, lf;
fprintf(tabout, ".ta ");
for(c=0; c<ncol; c++)
	{
	vforml=lform;
	for(lf=prev(lform); lf>=0 && vspen(table[lf][c].col); lf=prev(lf))
		vforml=lf;
	if (fspan(vforml,c))
		continue;
	switch(ct=ctype(vforml,c))
		{
		case 'n':
		case 'a':
			if (table[ldata][c].rcol)
			  if (lused[c]) /*Zero field width*/
				fprintf(tabout, "\\n(%du ",c+CMID);
		case 'c':
		case 'l':
		case 'r':
		    if (realsplit? rused[c]: (used[c]+lused[c]))
			fprintf(tabout, "\\n(%du ",c+CRIGHT);
			continue;
		case 's':
			if (lspan(lform, c))
				fprintf(tabout, "\\n(%du ", c+CRIGHT);
			continue;
		}
	}
fprintf(tabout, "\n");
}
开发者ID:andreiw,项目名称:polaris,代码行数:33,代码来源:t7.c

示例10: ctype

static bool ctype(CVarRef v, int (*iswhat)(int)) {
  if (v.isInteger()) {
    int64_t n = v.toInt64();
    if (n <= 255 && n >= 0) {
      return iswhat(n);
    }

    if (n >= -128 && n < 0) {
      return iswhat(n + 256);
    }

    return ctype(v.toString(), iswhat);
  }

  if (v.isString()) {
    String s = v.toString();
    if (!s.empty()) {
      const char *p = s.data();
      const char *e = s.data() + s.size();
      while (p < e) {
        if (!iswhat((int)*(unsigned char *)(p++))) {
          return false;
        }
      }
      return true;
    }
  }
  return false;
}
开发者ID:Bluarggag,项目名称:hhvm,代码行数:29,代码来源:ext_ctype.cpp

示例11: addstr

static struct symtab *
addstr(char *n)
{
	NODE *p = block(NAME, NIL, NIL, FLOAT, 0, 0);
	struct symtab *sp;
	NODE *q;
	struct attr *ap;
	struct rstack *rp;
	extern struct rstack *rpole;

	p->n_type = ctype(ULONGLONG);
	rpole = rp = bstruct(NULL, STNAME, NULL);
	soumemb(p, loti, 0);
	soumemb(p, hiti, 0);
	q = dclstruct(rp);
	sp = q->n_sp = lookup(addname(n), 0);
	defid(q, TYPEDEF);
	ap = attr_new(GCC_ATYP_MODE, 3);
	ap->sarg(0) = addname("TI");
	ap->iarg(1) = 0;
	sp->sap = attr_add(sp->sap, ap);
	nfree(q);
	nfree(p);

	return sp;
}
开发者ID:Scarletts,项目名称:LiteBSD,代码行数:26,代码来源:gcc_compat.c

示例12: print_value_quoted

/* print variable/alias value using necessary quotes
 * (POSIX says they should be suitable for re-entry...)
 * No trailing newline is printed.
 */
void
print_value_quoted(const char *s)
{
        const char *p;
        int inquote = 0;

        /* Test if any quotes are needed */
        for (p = s; *p; p++)
                if (ctype(*p, C_QUOTE))
                        break;
        if (!*p) {
                shprintf("%s", s);
                return;
        }
        for (p = s; *p; p++) {
                if (*p == '\'') {
                        shprintf("'\\'" + 1 - inquote);
                        inquote = 0;
                } else {
                        if (!inquote) {
                                shprintf("'");
                                inquote = 1;
                        }
                        shf_putc(*p, shl_stdout);
                }
        }
        if (inquote)
                shprintf("'");
}
开发者ID:adtools,项目名称:abcsh,代码行数:33,代码来源:misc.c

示例13: assert

thrust_rewriter::result_type thrust_rewriter::make_tuple_rewrite(const bind& n) {
    //The rhs must be an apply
    assert(detail::isinstance<apply>(n.rhs()));
    
    const apply& rhs = boost::get<const apply&>(n.rhs());
    //The rhs must apply "thrust::make_tuple"
    assert(rhs.fn().id() == detail::snippet_make_tuple());
    
    //Derive the types of all the inputs
    vector<shared_ptr<const ctype::type_t> > typified;
    for(auto i = rhs.args().begin(); i != rhs.args().end(); i++) {
        //Argument to make_tuple must be a name or a literal
        if (detail::isinstance<name>(*i)) {
            const name& name_i = boost::get<const name&>(*i);
            typified.push_back(
                make_shared<const ctype::monotype_t>(
                    detail::typify(
                        name_i.id())));
        } else {
            typified.push_back(i->ctype().ptr());
        }
                    
    }

    const name& lhs = boost::get<const name&>(n.lhs());
    shared_ptr<const name> n_lhs =
        make_shared<const name>(lhs.id(),
                                lhs.type().ptr(),
                                make_shared<const ctype::tuple_t>(
                                    std::move(typified)));
    return make_shared<const bind>(
        n_lhs, rhs.ptr());
}
开发者ID:configithub,项目名称:numpy-gpu,代码行数:33,代码来源:rewrites.cpp

示例14: thish

int
thish(int i, int c)
{
	int t;
	char *s;
	struct colstr *pc;
	if (c<0)return(0);
	if (i<0) return(0);
	t = ctype(i,c);
	if (t=='_' || t == '-')
		return('-');
	if (t=='=')return('=');
	if (t=='^') return(1);
	if (fullbot[i] )
		return(fullbot[i]);
	if (t=='s') return(thish(i,c-1));
	if (t==0) return(1);
	pc = &table[i][c];
	s = (t=='a' ? pc->rcol : pc->col);
	if (s==0 || (point(s) && *s==0))
		return(1);
	if (vspen(s)) return(1);
	if (t=barent( s))
		return(t);
	return(0);
}
开发者ID:andreiw,项目名称:polaris,代码行数:26,代码来源:tt.c

示例15: tmpVec1

  template <class F> F CpuIterativeSolver<F>::initGeneral (const std::vector<ctype>& einc, std::ostream& log, const std::vector<ctype>& start, UNUSED Core::ProfilingDataPtr prof) {
    std::vector<ctype>& pvec = tmpVec1 ();
    for (int j = 0; j < 3; j++)
      for (uint32_t i = g ().nvCount (); i < g ().vecStride (); i++)
        pvec[i + j * g ().vecStride ()] =  0;
    g ().multMat (matVec ().cc ().cc_sqrt (), einc, pvec);

    ftype temp = LinAlg::norm (pvec);
    this->residScale = 1 / temp;

    ftype inprodR = 0.0 / 0.0;

    if (start.size () != 0) {
      std::vector<ctype>& xvec = this->xvec ();
      g ().multMatInv (matVec ().cc ().cc_sqrt (), start, xvec); // xvec = start / cc_sqrt
      std::vector<ctype>& Avecbuffer = this->Avecbuffer ();
      matVec ().apply (xvec, Avecbuffer, false);
      std::vector<ctype>& rvec = this->rvec ();
      LinAlg::linComb (Avecbuffer, ctype (-1), pvec, rvec);
      inprodR = LinAlg::norm (rvec);
      log << "Use loaded start value" << std::endl;
    } else {

      std::vector<ctype>& Avecbuffer = this->Avecbuffer ();
      matVec ().apply (pvec, Avecbuffer, false);

      std::vector<ctype>& rvec = this->rvec ();
      LinAlg::linComb (Avecbuffer, ctype (-1), pvec, rvec);
      inprodR = LinAlg::norm (rvec);

      log << "temp = " << temp << ", inprodR = " << inprodR << std::endl;

      std::vector<ctype>& xvec = this->xvec ();
      if (temp < inprodR) {
        log << "Use 0" << std::endl;
        LinAlg::fill<ctype> (xvec, 0);
        swap (rvec, pvec);
        inprodR = temp;
      } else {
        log << "Use pvec" << std::endl;
        swap (xvec, pvec);
      }
    }

    log << "|r_0|^2: " << temp << std::endl;
    return inprodR;
  }
开发者ID:steffen-kiess,项目名称:dda,代码行数:47,代码来源:CpuIterativeSolver.cpp


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