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

C++ LL函数代码示例

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

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



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

示例1: if

void World::RenderGroup(SceneGroup *i, mat4 t) 
{
	int ii, time = 0;
	// sphere vars
	double r;
	MaterialInfo m;
	
	// light vars
	LightInfo l;
	
	// camera vars
	CameraInfo f;
	   
	// if this is a terminal node
	if (i->getChildCount() == 0) {
		
		// if this node is a sphere
		if (i->computeSphere(r,m,time)) {
			_spheres.push_back(Sphere(vec4(0,0,0,1), r, m, t));
		} else if (i->computeLight(l)) {
			
			if (l.type == LIGHT_POINT) {
				_lights[l.type].push_back(Light(vec3(t*vec4(0,0,0,1),VW),0, l));
			}else if (l.type == LIGHT_DIRECTIONAL){
				_lights[l.type].push_back(Light(0,vec3(t*vec4(0,0,-1,0),VW), l));
			}else if (l.type == LIGHT_AMBIENT)
				_ambientLight = l.color;
				
		} else if (i->computeCamera(f)) {
			vec4 eye(0.0, 0.0, 0.0, 1.0);
		    vec4 LL(f.sides[FRUS_LEFT], f.sides[FRUS_BOTTOM], -1*f.sides[FRUS_NEAR], 1.0);
		    vec4 UL(f.sides[FRUS_LEFT], f.sides[FRUS_TOP], -1*f.sides[FRUS_NEAR], 1.0);
		    vec4 LR(f.sides[FRUS_RIGHT], f.sides[FRUS_BOTTOM], -1*f.sides[FRUS_NEAR], 1.0);
		    vec4 UR(f.sides[FRUS_RIGHT], f.sides[FRUS_TOP], -1*f.sides[FRUS_NEAR], 1.0);

		    _view = Viewport(eye, LL, UL, LR, UR, IMAGE_WIDTH, IMAGE_HEIGHT);
		}
		
	} else {
		
		// expand and traverse this node
		for(ii=0; ii<i->getChildCount();ii++) 
			RenderInstance(i->getChild(ii), t);
		
	}
	
}
开发者ID:therichardnguyen,项目名称:-CS184-AS5,代码行数:47,代码来源:World.cpp


示例2: qindex_push_index

/* push index */
int qindex_push_index(QINDEX *qindex, int64_t key, IBDATA *block)
{
    DOCHEADER *docheader = NULL;
    XPACKET *xpackets = NULL;
    int mid = 0, old = 0;

    if(qindex && block->ndata > 0 && (docheader = (DOCHEADER *)block->data)) 
    {
        MUTEX_LOCK(qindex->mutex);
        if(docheader->size == block->ndata && (xpackets = (XPACKET *)(qindex->xpacketio.map))
            && (mid = mmtree64_try_insert(qindex->idmap, qindex->state->rootid, 
                            key, (qindex->state->id_max+1), &old)) > 0)
        {
            if(old > 0) mid = old;
            else mid = ++(qindex->state->id_max);
            db_set_data(PDB(qindex->db), mid, block->data, block->ndata);
            if(mid <= qindex->state->xpackettotal)
            {
                if(xpackets[mid].crc != docheader->crc)
                    qindex_update(qindex, mid, 1);
                else
                    qindex_update(qindex, mid, 0);
                xpackets[mid].status = docheader->status;
                xpackets[mid].crc = docheader->crc;
                ACCESS_LOGGER(qindex->logger, "update-index{gloablid:%lld mid:%d total:%d}", LL(docheader->globalid), mid, qindex->state->xpackettotal);
            }
            else
            {
                qindex->state->xpackettotal = mid;
                CHECK_XPACKETIO(qindex);
                if((xpackets = (XPACKET *)(qindex->xpacketio.map)))
                {
                    xpackets[mid].status = docheader->status;
                    xpackets[mid].crc = docheader->crc;
                    ACCESS_LOGGER(qindex->logger, "new-index{gloablid:%lld mid:%d}", LL(docheader->globalid), mid);
                }
            }
        }
        else
        {
            FATAL_LOGGER(qindex->logger, "Invalid document size:%d ndata:%d id:%lld crc:%d", docheader->size, block->ndata, LL(docheader->globalid), docheader->crc);
            _exit(-1);
        }
        MUTEX_UNLOCK(qindex->mutex);
    }
    return mid;
}
开发者ID:cnangel,项目名称:ithunder,代码行数:48,代码来源:qindex.c


示例3: f12h_mc0_mce

static bool f12h_mc0_mce(u16 ec, u8 xec)
{
	bool ret = false;

	if (MEM_ERROR(ec)) {
		u8 ll = LL(ec);
		ret = true;

		if (ll == LL_L2)
			pr_cont("during L1 linefill from L2.\n");
		else if (ll == LL_L1)
			pr_cont("Data/Tag %s error.\n", R4_MSG(ec));
		else
			ret = false;
	}
	return ret;
}
开发者ID:AdrianHuang,项目名称:linux-3.8.13,代码行数:17,代码来源:mce_amd.c


示例4: session_malloc

session *
session_malloc (void)
{
  session *s = (session *) malloc (sizeof (session));

  if (!s)
    {
      LL ();
      fprintf (stderr, "%s: session malloc() failed: %s (%i)\n", progname,
	       strerror (errno), errno);
      exit (EXIT_FAILURE);
    }
  else
    memset (s, '\0', sizeof (session));

  return s;
}
开发者ID:FlorianHeigl,项目名称:sudosh2,代码行数:17,代码来源:replay.c


示例5: Run

bool Run(string &buf)
{
    bool bResult;
    float outRT;

    LeptLog LL("c:/recogText.log");
    LeptTextRecognition LTR(LL);
    //LTR.TrainingFromPath("C:/recog/GOSTdigits", 0);

    LTR.TrainingFromPath("../../../TestImage/TEXT/GOSTfont");

    bResult = LTR.FileRecognition("../../../TestImage/TEXT/Picture11.tif", buf, outRT);
    //bResult = LTR.FileRecognition("C:/test2/Image 3.tif", buf, outRT);
    //pixDisplay(pixdb, 800, 800);
    //pixDisplay(pixat->pix[2], 800, 800);
    return bResult;
}
开发者ID:VLunev,项目名称:LeptonicaRecog,代码行数:17,代码来源:File1.cpp


示例6: result

Direction DumbDirectionSolver::tryToMove(Point pt) {
	int count = 0;
	int newX = pt.getX();
	int newY = pt.getY();
	Direction result(LL("NULL"));
	bool again = false;
	do {
			result = whereICanGoFrom(pt);
			if (result.isNull()) {
				return result;
			}

			newX = result.changeX(pt.getX());
			newY = result.changeY(pt.getY());

			bool bombAtWay = (!bomb.isNull()) && (bomb == Point(newX, newY));
			bool barrierAtWay = board.isBarrierAt(newX, newY);
			auto futBla = board.getFutureBlasts();
			bool blastAtWay = (std::find(futBla.begin(), futBla.end(), Point(newX, newY)) != futBla.end());
			bool meatChopperNearWay = board.isNear(newX, newY, Element(LL("MEAT_CHOPPER")));

			if (blastAtWay &&
				board.countNear(pt.getX(), pt.getY(), Element(LL("SPACE"))) == 1 &&
				!board.isAt(pt.getX(), pt.getY(), Element(LL("BOMB_BOMBERMAN")))) {
					result = Direction(LL("STOP"));
					return result;
			}

			again = bombAtWay || barrierAtWay || meatChopperNearWay;

			bool deadEndAtWay = (board.countNear(newX, newY, Element(LL("SPACE"))) == 0 && !bomb.isNull());
			if (deadEndAtWay) {
				bomb.setNull(true);
			}
			if (result == Direction(LL("NULL"))) {
				again == true;
			}
	} while (count++ < 20 && again);
	if (count >= 20) {
		result = Direction(LL("ACT"));
    }
	return result;
}
开发者ID:Mperv,项目名称:snake,代码行数:43,代码来源:DumbDirectionSolver.cpp


示例7: f14h_mc1_mce

static bool f14h_mc1_mce(u16 ec, u8 xec)
{
	u8 r4    = R4(ec);
	bool ret = true;

	if (MEM_ERROR(ec)) {
		if (TT(ec) != 0 || LL(ec) != 1)
			ret = false;

		if (r4 == R4_IRD)
			pr_cont("Data/tag array parity error for a tag hit.\n");
		else if (r4 == R4_SNOOP)
			pr_cont("Tag error during snoop/victimization.\n");
		else
			ret = false;
	}
	return ret;
}
开发者ID:AdrianHuang,项目名称:linux-3.8.13,代码行数:18,代码来源:mce_amd.c


示例8: caldate_frommjd

void caldate_frommjd(struct caldate *cd, int64_t day, int *pwday, int *pyday)
{
  long year;
  long month;
  int yday;

  year = (long)(day / LL(146097));
  day %= LL(146097);
  day += LL(678881);
  while (day >= LL(146097)) { day -= LL(146097); ++year; }

  /* year * 146097 + day - 678881 is MJD; 0 <= day < 146097 */
  /* 2000-03-01, MJD 51604, is year 5, day 0 */

  if (pwday) *pwday = (int)((day + 3) % 7);

  year *= 4;
  if (day == LL(146096)) { year += 3; day = 36524L; }
  else { year += (long)(day / LL(36524)); day %= LL(36524); }
  year *= 25;
  year += (long)(day / 1461);
  day %= 1461;
  year *= 4;

  yday = (day < 306);
  if (day == 1460) { year += 3; day = 365; }
  else { year += (long)(day / 365); day %= 365; }
  yday += (int)day;

  day *= 10;
  month = (long)((day + 5) / 306);
  day = (day + 5) % 306;
  day /= 10;
  if (month >= 10) { yday -= 306; ++year; month -= 10; }
  else { yday += 59; month += 2; }

  cd->year = year;
  cd->month = (int)month + 1;
  cd->day = (int)(day + 1);

  if (pyday) *pyday = yday;
}
开发者ID:DouglasRMiles,项目名称:swipl-devel,代码行数:42,代码来源:caldate_fmjd.c


示例9: NodeInsert

Node NodeInsert(Node rootnode , int data){
    if (rootnode == NULL){
        rootnode = CreatNode(NULL , NULL , data);
        return rootnode;
    }
    if (data == rootnode -> data){
        printf("Insert Node %d Failed !\n" , data);
    }
    if (data < rootnode -> data){
        rootnode -> left = NodeInsert(rootnode -> left , data);
        rootnode -> height = MAX(Height(rootnode -> left) , Height(rootnode -> right)) + 1;
        //lose balance
        int rightheight = 0;
        if (rootnode -> right != NULL){
            rightheight = rootnode -> right ->height;
        }
        if (Height(rootnode -> left) >= rightheight + 2){
            if (data < rootnode -> left -> data){
                rootnode = LL(rootnode);
            }else{
                rootnode = LR(rootnode);
            }
        }
    }else{
        if (data > rootnode -> data){
            rootnode -> right = NodeInsert(rootnode -> right , data);
            rootnode -> height = MAX(Height(rootnode -> left) , Height(rootnode -> right)) + 1;
            //lose balance
            int leftheight = 0;
            if (rootnode -> left != NULL){
                leftheight = rootnode -> left -> height;
            }
            if (Height(rootnode -> right) >= leftheight + 2){
                if (data > rootnode -> right -> data){
                    rootnode = RR(rootnode);
                }else{
                    rootnode = RL(rootnode);
                }
            }
        }
    }
    rootnode -> height = MAX(Height(rootnode -> left) , Height(rootnode -> right)) + 1;
    return rootnode;
}
开发者ID:helloqiu,项目名称:dataClass,代码行数:44,代码来源:AVL_TREE.c


示例10: diff2PDF_u_tCopula_new

void diff2PDF_u_tCopula_new(double* u, double* v, int* n, double* param, int* copula, double* out)
{
	double x1, x2;
	int j=0, k=1;

	double t1, t2, t4, t5, t6, t7, t8, t9, t11, t12, t13, M, c=0, diffPDF=0, diff_dt2=0;
	double t14, t15, t16;

	double rho = param[0];
	double nu = param[1];
	
	t1=nu+2.0;
	t14=rho*rho;
	t4=1.0-t14;

	for(j=0;j<*n;j++)
	{
		LL(copula, &k, &u[j], &v[j], &rho, &nu, &c);
		c=exp(c);
		x1=qt(u[j],nu,1,0);
		x2=qt(v[j],nu,1,0);
		t15=x1*x1;
		t16=x2*x2;
		M = ( nu*t4 + t15 + t16 - 2.0*rho*x1*x2 );
		t2=dt(x1,nu,0);
		diffPDF_u_tCopula_new(&u[j], &v[j], &k, param, copula, &diffPDF);
		diff_dt_u(&x1, &nu, &diff_dt2);
		
		t7=x1-rho*x2;
		
		t5=-diffPDF/t2 + diff_dt2/t2/t2*c;
		t6=t1*t7/M + diff_dt2;
		
		t11=c/t2;
		t8=1.0/t2;
		t9=t1/M - 2.0*t1*t7*t7/M/M;
		t13=1.0+t15/nu;
		
		t12=t8*( -(nu+1.0)/(nu+t15) + 2.0*t15* (nu+1.0)/nu/nu / t13/t13);
		
		out[j]=t5*t6 - t11*(t8*t9 + t12);
	}
}
开发者ID:Pold87,项目名称:VineCopula,代码行数:43,代码来源:tcopuladeriv_new.c


示例11: diffPDF_nu_tCopula_new

void diffPDF_nu_tCopula_new(double* u, double* v, int* n, double* param, int* copula, double* out)
{
	double out1=0, out2=0, x1, x2;
	int j=0, k=1;

	double t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, M, c;

	double rho = param[0];
	double nu = param[1];

	

	t1=digamma((nu+1.0)/2.0);
	t2=digamma(nu/2.0);
	t14=rho*rho;
	t3=0.5*log(1.0-t14);
	t4=(nu-2.0)/(2.0*nu);
	t5=0.5*log(nu);
	t6=-t1+t2+t3-t4-t5;
	t10=(nu+2.0)/2.0;

	for(j=0;j<*n;j++)
	{
		LL(copula, &k, &u[j], &v[j], &rho, &nu, &c);
		c=exp(c);
		x1=qt(u[j],nu,1,0);
		x2=qt(v[j],nu,1,0);
		diffX_nu_tCopula(&x1, param, &out1);
		diffX_nu_tCopula(&x2, param, &out2);
		t7=1.0+2.0*x1*out1;
		t8=1.0+2.0*x2*out2;
		t15=x2*x2;
		t16=x1*x1;
		t9=(nu+1.0)/2.0*( t7/(nu+x1*x1) + t8/(nu+t15) );
		M=nu*(1.0-t14) + t16 + t15 - 2.0*rho*x1*x2;
		t11=1.0 - t14 + 2.0*x1*out1 + 2.0*x2*out2 - 2.0*rho*(x1*out2+x2*out1);
		t12=0.5*log((nu+t16)*(nu+t15));
		t13=0.5*log(M);

		out[j]=c*(t6 + t9 + t12 - t10*t11/M - t13);	
	}

}
开发者ID:Pold87,项目名称:VineCopula,代码行数:43,代码来源:tcopuladeriv_new.c


示例12: Node

Node* AvlTree::nodeInsert(Node* &rootNode , int data){
	if (rootNode == NULL){
		rootNode = new Node(NULL, NULL, data);
		
		return rootNode;
	}
	if (data == rootNode->data){
		return NULL;
	}
	if (data < rootNode -> data){
		rootNode -> left = nodeInsert(rootNode->left, data);
		rootNode -> height = MAX(Height(rootNode->left) , Height(rootNode -> right)) + 1;
		int rightHeight = 0;
		if (rootNode -> right != NULL){
			rightHeight = rootNode -> right -> height;
		}
		if (Height(rootNode -> left) >= rightHeight + 2){
			if (data < rootNode -> left -> data){
				rootNode = LL(rootNode);
			}else{
				rootNode = LR(rootNode);
			}
		}
	}else{
		if (data > rootNode -> data){
			rootNode -> right = nodeInsert(rootNode -> right, data);
			rootNode -> height = 1 + MAX(Height(rootNode -> left) , Height(rootNode -> right));
			int leftHeight = 0;
			if (rootNode -> left != NULL){
				leftHeight = rootNode -> left -> height;
			}
			if (Height(rootNode -> right) >= leftHeight + 2){
				if (data > rootNode -> right -> data){
					rootNode = RR(rootNode);
				}else{
					rootNode = RL(rootNode);
				}
			}
		}
	}
	rootNode -> height = MAX(Height(rootNode -> left) , Height(rootNode -> right)) + 1;
	return rootNode;
}
开发者ID:helloqiu,项目名称:dataClass,代码行数:43,代码来源:avl-tree.cpp


示例13: getNVector

float Plane::angle(const Line &L)
{// the return value should be between 0 and 90, if -1, means error.
  Vector v1 = getNVector();
  Vector v2;
  fPoint p;
  Line LL(L);

  LL.getPara(p,v2);
  float t1 = v1.length(), t2 = v2.length();

  if ((fabs(t1-0)<ZERO) ||(fabs(t2-0)<ZERO)){
	printf("\n Error: Plane::angle(Line)");
	return -1.0f;
  }

  float alpha = v1.dotProduct(v2)/t1/t2;
  //alpha = facos (fabs(alpha));
  alpha = acos (fabs(alpha));
  return alpha;
}
开发者ID:hsundar,项目名称:thesis.code,代码行数:20,代码来源:GPrimitive.C


示例14: if

static TLDNode *balance(TLDNode *node) {
	int nodeDiff;
	nodeDiff=checkDiff(node);
	if (nodeDiff>1){
		int checkLeft=checkDiff(node->left);
		if (checkLeft>0){
			node=LL(node);
		}else{
			node=LR(node);
		}
	}else if(nodeDiff<-1){
		int checkRight=checkDiff(node->right);
		if (checkRight>0){
			node=RL(node);
		}else{
			node=RR(node);
		}
	};
	return node;
}
开发者ID:fuhchang,项目名称:ap3_as1,代码行数:20,代码来源:tldlist4.c


示例15: transid_store_packed

uint transid_store_packed(MARIA_HA *info, uchar *to, ulonglong trid)
{
  uchar *start;
  uint length;
  uchar buff[8];
  DBUG_ASSERT(trid < (LL(1) << (MARIA_MAX_PACK_TRANSID_SIZE*8)));
  DBUG_ASSERT(trid >= info->s->state.create_trid);

  trid= (trid - info->s->state.create_trid) << 1;

  /* Mark that key contains transid */
  to[-1]|= 1;

  if (trid < MARIA_MIN_TRANSID_PACK_OFFSET)
  {
    to[0]= (uchar) trid;
    return 1;
  }
  start= to;

  /* store things in low-byte-first-order in buff */
  to= buff;
  do
  {
    *to++= (uchar) trid;
    trid= trid>>8;
  } while (trid);

  length= (uint) (to - buff);
  /* Store length prefix */
  start[0]= (uchar) (length + MARIA_TRANSID_PACK_OFFSET);
  start++;
  /* Copy things in high-byte-first order to output buffer */
  do
  {
    *start++= *--to;
  } while (to != buff);
  return length+1;
}
开发者ID:AllenWeb,项目名称:mariadb,代码行数:39,代码来源:ma_key.c


示例16: diff2PDF_u_v_tCopula_new

void diff2PDF_u_v_tCopula_new(double* u, double* v, int* n, double* param, int* copula, double* out)
{
	double x1, x2;
	int j=0, k=1;

	double t1, t2, t4, t5, t6, t7, t8, t9, t10, t11, t12, M, c=0, diff_dt1=0, diff_dt2=0;

	double rho = param[0];
	double nu = param[1];
	
	t1=nu+2.0;
	t4=1.0-rho*rho;

	for(j=0;j<*n;j++)
	{
		LL(copula, &k, &u[j], &v[j], &rho, &nu, &c);
		c=exp(c);
		x1=qt(u[j],nu,1,0);
		x2=qt(v[j],nu,1,0);
		M = ( nu*t4 + x1*x1 + x2*x2 - 2.0*rho*x1*x2 );
		t2=dt(x1,nu,0);
		t5=dt(x2,nu,0);
		
		t6=x1-rho*x2;
		t7=x2-rho*x1;
		
		diff_dt_u(&x1, &nu, &diff_dt1);
		diff_dt_u(&x2, &nu, &diff_dt2);
		
		t8=c/t2/t5;
		t9=t1*t6/M + diff_dt1;
		t10=t1*t7/M + diff_dt2;
		t11=t1*rho/M;
		t12=2.0*t1*t6*t7/M/M;
		
		out[j]=t8*(t9*t10 + t11 + t12);
	}
}
开发者ID:Pold87,项目名称:VineCopula,代码行数:38,代码来源:tcopuladeriv_new.c


示例17: diff2PDF_rho_nu_tCopula_new

void diff2PDF_rho_nu_tCopula_new(double* u, double* v, int* n, double* param, int* copula, double* out)
{
	double out1=0, out2=0, x1, x2;
	int j=0, k=1;

	double t3, t4, t5, t6, t7, t8, t9, t10, t11, M_rho, M_nu, M, c;

	double rho = param[0];
	double nu = param[1];

	
	t4=1.0-rho*rho;
	t3=rho/t4;
	t5=nu+2.0;

	

	for(j=0;j<*n;j++)
	{
		LL(copula, &k, &u[j], &v[j], &rho, &nu, &c);
		c=exp(c);
		x1=qt(u[j],nu,1,0);
		x2=qt(v[j],nu,1,0);
		diffX_nu_tCopula(&x1, param, &out1);
		diffX_nu_tCopula(&x2, param, &out2);
		t10=x1*x1;
		t11=x2*x2;
		M = ( nu*t4 + t10 + t11 - 2.0*rho*x1*x2 );
		diffPDF_rho_tCopula(&u[j], &v[j], &k, param, copula, &t6);
		diffPDF_nu_tCopula_new(&u[j], &v[j], &k, param, copula, &t7);
		M_rho=-2.0*(nu*rho+x1*x2);
		t8=(x1*out2+out1*x2);
		M_nu=t4+2.0*x1*out1+2.0*x2*out2-2.0*rho*t8;
		t9=-t3+t5/M*(rho+t8+0.5*M_nu*M_rho/M)-0.5*M_rho/M;

		out[j]=c*t9+t6*t7/c;	
	}
}
开发者ID:Pold87,项目名称:VineCopula,代码行数:38,代码来源:tcopuladeriv_new.c


示例18: tradeOneNightStand

function tradeOneNightStand() {

        vars Price = series(price());
        vars SMA10 = series(SMA(Price, 10));
        vars SMA40 = series(SMA(Price, 40));

        //Stop = 3 * 90 * PIP;

        var BuyStop,SellStop;

        BuyStop = HH(10) + 1*PIP;
        SellStop = LL(10) - 1*PIP;

        if (dow() == 5 && NumOpenLong == 0 && NumPendingLong == 0 && SMA10[0] > SMA40[0])
                enterLong(0,BuyStop);
        else if (dow() == 5 && NumOpenShort == 0 && NumPendingShort == 0 && SMA10[0] < SMA40[0])
                enterShort(0,SellStop);

        if (dow() != 5 && dow() != 6 && dow() != 7) {
                exitLong();
                exitShort();
        }

}
开发者ID:czarcrab,项目名称:Zorro,代码行数:24,代码来源:onc2.c


示例19: main

void main()
{
	int m;
	printf("1:复利计算\n");

	printf("2:单利计算\n");

	printf("3:求本金\n");
	printf("4:求时间\n");
	printf("5:求利率\n");
	printf("请输入序号");

	scanf("%d",&m);
	if(m==1)
		FL();
	 else if(m==2)
	    DL();
	 else if(m==3)
		BJ();
	 else if(m==4)
		Time();
	 else if(m==5)
		 LL();
}
开发者ID:Rick00,项目名称:rong_test,代码行数:24,代码来源:dbb.cpp


示例20: ktapc_chunkid

void ktapc_chunkid(char *out, const char *source, size_t bufflen)
{
	size_t l = strlen(source);

	if (*source == '=') {  /* 'literal' source */
		if (l <= bufflen)  /* small enough? */
			memcpy(out, source + 1, l * sizeof(char));
		else {  /* truncate it */
			addstr(out, source + 1, bufflen - 1);
			*out = '\0';
		}
	} else if (*source == '@') {  /* file name */
		if (l <= bufflen)  /* small enough? */
			memcpy(out, source + 1, l * sizeof(char));
		else {  /* add '...' before rest of name */
			addstr(out, RETS, LL(RETS));
			bufflen -= LL(RETS);
			memcpy(out, source + 1 + l - bufflen, bufflen * sizeof(char));
		}
	} else {  /* string; format as [string "source"] */
		const char *nl = strchr(source, '\n');  /* find first new line (if any) */
		addstr(out, PRE, LL(PRE));  /* add prefix */
		bufflen -= LL(PRE RETS POS) + 1;  /* save space for prefix+suffix+'\0' */
		if (l < bufflen && nl == NULL) {  /* small one-line source? */
			addstr(out, source, l);  /* keep it */
		} else {
			if (nl != NULL)
				l = nl - source;  /* stop at first newline */
			if (l > bufflen)
				l = bufflen;
			addstr(out, source, l);
			addstr(out, RETS, LL(RETS));
		}
		memcpy(out, POS, (LL(POS) + 1) * sizeof(char));
	}
}
开发者ID:idkwim,项目名称:ktap,代码行数:36,代码来源:util.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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