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

C++ p_error函数代码示例

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

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



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

示例1: set_edit_chars

/*
 * Trade edit characters with the other talk. By agreement
 * the first three characters each talk transmits after
 * connection are the three edit characters.
 */
void
set_edit_chars(void)
{
	char buf[3];
	int cc;
	struct termios tty;
	
	tcgetattr(0, &tty);
	my_win.cerase = tty.c_cc[VERASE];
	my_win.kill = tty.c_cc[VKILL];
	if (tty.c_cc[VWERASE] == (unsigned char) -1)
		my_win.werase = '\027';	 /* control W */
	else
		my_win.werase = tty.c_cc[VWERASE];
	buf[0] = my_win.cerase;
	buf[1] = my_win.kill;
	buf[2] = my_win.werase;
	cc = write(sockt, buf, sizeof(buf));
	if (cc != sizeof(buf) )
		p_error("Lost the connection");
	cc = read(sockt, buf, sizeof(buf));
	if (cc != sizeof(buf) )
		p_error("Lost the connection");
	his_win.cerase = buf[0];
	his_win.kill = buf[1];
	his_win.werase = buf[2];
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:32,代码来源:init_disp.c


示例2: sininv

/* Sinusoidal inverse equations--mapping x,y to lat,long 
  -----------------------------------------------------*/
int sininv(
double x,		/* (I) X projection coordinate */
double y,		/* (I) Y projection coordinate */
double *lon,		/* (O) Longitude */
double *lat)		/* (O) Latitude */
{
  double temp;		/* Re-used temporary variable */
  double mu, ml;
  double sin_phi, cos_phi;
/* Inverse equations
  -----------------*/
  x -= false_easting;
  y -= false_northing;
  
  if (ind != 0) /* Spherical */
    {
      *lat = y / R;
      if (fabs(*lat) > HALF_PI) 
	{
	  p_error("Input data error","sinusoidal-inverse");
	  return(164);
	}
      temp = fabs(*lat) - HALF_PI;
      if (fabs(temp) > EPSLN)
	{
	  temp = lon_center + x / (R * cos(*lat));
	  *lon = adjust_lon(temp);
	}
      else *lon = lon_center;
      return(OK);
    }
  else /* Ellipsoidal */
    {
      ml = y;
      mu = ml / (r_major * imu);
      *lat = mu + 
	(e2 * sin(2.0 * mu)) + 
	(e3 * sin(4.0 * mu)) + 
	(e4 * sin(6.0 * mu)) + 
	(e5 * sin(8.0 * mu));

      if (fabs(*lat) > HALF_PI) 
	{
	  p_error("Input data error","sinusoidal-inverse");
	  return(164);
	}
      temp = fabs(*lat) - HALF_PI;
      if (fabs(temp) > EPSLN)
	{
	  sin_phi = sin(*lat);
	  cos_phi = cos(*lat);
	  temp = lon_center + 
	    x * sqrt(1.0 - es * SQUARE(sin_phi)) / (r_major * cos_phi);
	  *lon = adjust_lon(temp);
	}
     else *lon = lon_center;
     return(OK);
   }
}
开发者ID:OPENDAP,项目名称:hdf5_handler,代码行数:61,代码来源:sininv.c


示例3: invite_remote

int
invite_remote (void)
{
  int new_sockt;
  struct itimerval itimer;
  CTL_RESPONSE response;

  itimer.it_value.tv_sec = RING_WAIT;
  itimer.it_value.tv_usec = 0;
  itimer.it_interval = itimer.it_value;
  if (listen (sockt, 5) != 0)
    p_error ("Error on attempt to listen for caller");

  msg.addr.sa_family = htons (my_addr.sin_family);
  memcpy (msg.addr.sa_data,
	  ((struct sockaddr *) &my_addr)->sa_data,
	  sizeof ((struct sockaddr *) & my_addr)->sa_data);

  msg.id_num = htonl (-1);	/* an impossible id_num */
  invitation_waiting = 1;
  announce_invite ();
  /*
   * Shut off the automatic messages for a while,
   * so we can use the interupt timer to resend the invitation
   */
  end_msgs ();
  setitimer (ITIMER_REAL, &itimer, (struct itimerval *) 0);
  message ("Waiting for your party to respond");
  signal (SIGALRM, re_invite);
  setjmp (invitebuf);
  while ((new_sockt = accept (sockt, 0, 0)) < 0)
    {
      if (errno == EINTR)
	continue;
      p_error ("Unable to connect with your party");
    }
  close (sockt);
  sockt = new_sockt;

  /*
   * Have the daemons delete the invitations now that we
   * have connected.
   */
  current_state = "Waiting for your party to respond";
  start_msgs ();

  msg.id_num = htonl (local_id);
  ctl_transact (my_machine_addr, msg, DELETE, &response);
  msg.id_num = htonl (remote_id);
  ctl_transact (his_machine_addr, msg, DELETE, &response);
  invitation_waiting = 0;

  return 0;
}
开发者ID:antoine1fr,项目名称:inetutils,代码行数:54,代码来源:invite.c


示例4: p_close

int p_close(p_team_t team)
{
    struct team *pteam = p_to_team(team);

    if (p_error(pteam))
            p_error(pteam);

    if (pteam->dev->dev_ops->close)
	    return pteam->dev->dev_ops->close(pteam->dev, pteam);

    return 0;
}
开发者ID:parallella,项目名称:pal,代码行数:12,代码来源:p_close.c


示例5: getpayload

/*
 * Get simple payload from file
 */
int getpayload(char *path) {
    FILE *file;

    // open file
    if((file=fopen(path, "r"))==NULL)
        p_error("\nError opening payload file.\n");

    if(!fread(progopt.payload, 1, MAX_ARG*4-1, file))
        p_error("\nError reading  payload from file.\n");

    fclose(file);

    return 1;
}
开发者ID:olemoudi,项目名称:toolbox,代码行数:17,代码来源:argparser.cpp


示例6: check_local

/*
 * See if the local daemon has an invitation for us.
 */
int
check_local(void)
{
	CTL_RESPONSE response;
	CTL_RESPONSE *rp = &response;
	struct sockaddr addr;

	/* the rest of msg was set up in get_names */
#ifdef MSG_EOR
	/* copy new style sockaddr to old, swap family (short in old) */
	msg.ctl_addr = *(struct osockaddr *)&ctl_addr;
	msg.ctl_addr.sa_family = htons(ctl_addr.sin_family);
#else
	msg.ctl_addr = *(struct sockaddr *)&ctl_addr;
#endif
	/* must be initiating a talk */
	if (!look_for_invite(rp))
		return (0);
	/*
	 * There was an invitation waiting for us,
	 * so connect with the other (hopefully waiting) party
	 */
	current_state = "Waiting to connect with caller";
	do {
		if (rp->addr.sa_family != AF_INET)
			p_error("Response uses invalid network address");
		(void)memcpy(&addr, &rp->addr.sa_family, sizeof(addr));
		addr.sa_family = rp->addr.sa_family;
		addr.sa_len = sizeof(addr);
		errno = 0;
		if (connect(sockt, &addr, sizeof(addr)) != -1)
			return (1);
	} while (errno == EINTR);
	if (errno == ECONNREFUSED) {
		/*
		 * The caller gave up, but his invitation somehow
		 * was not cleared. Clear it and initiate an
		 * invitation. (We know there are no newer invitations,
		 * the talkd works LIFO.)
		 */
		ctl_transact(his_machine_addr, msg, DELETE, rp);
		close(sockt);
		open_sockt();
		return (0);
	}
	p_error("Unable to connect with initiator");
	/*NOTREACHED*/
	return (0);
}
开发者ID:JabirTech,项目名称:Source,代码行数:52,代码来源:look_up.c


示例7: open_ctl

/* open the ctl socket */
open_ctl() 
{
    int length;

    ctl_addr.sin_port = 0;
    ctl_addr.sin_addr = my_machine_addr;
    ctl_sockt = socket(AF_INET, SOCK_DGRAM, 0);
    if (ctl_sockt <= 0)
	p_error("Bad socket");
    if (bind(ctl_sockt, (struct sockaddr *)&ctl_addr, sizeof(ctl_addr)) != 0)
	p_error("Couldn't bind to control socket");
    length = sizeof(ctl_addr);
    if (getsockname(ctl_sockt, (struct sockaddr *)&ctl_addr, &length) == -1)
	p_error("Bad address for ctl socket");
}
开发者ID:catufunwa,项目名称:4.4BSD-Lite,代码行数:16,代码来源:ctl.c


示例8: open_sockt

open_sockt()
{
    int length;

    my_addr.sin_addr = my_machine_addr;
    my_addr.sin_port = 0;
    sockt = socket(AF_INET, SOCK_STREAM, 0);
    if (sockt <= 0)
	p_error("Bad socket");
    if (bind(sockt, (struct sockaddr *)&my_addr, sizeof(my_addr)) != 0)
	p_error("Binding local socket");
    length = sizeof(my_addr);
    if (getsockname(sockt, (struct sockaddr *)&my_addr, &length) == -1)
	p_error("Bad address for socket");
}
开发者ID:catufunwa,项目名称:4.4BSD-Lite,代码行数:15,代码来源:ctl.c


示例9: write

/** Trade edit characters with the other talk. By agreement
 * the first three characters each talk transmits after
 * connection are the three edit characters.
 * A normal talk client uses tcgetattr() to get the chars,
 * but the daemon isn't connected to a terminal, so we can't call it.
 * We just send dummy chars, to disable control chars. */
void TalkConnection::set_edit_chars()
{
	char buf[3];
        int cc;
        buf[0] = buf[1] = buf[2] = (char)0xff;
        /* Write our config to the caller */
	cc = write(sockt, buf, sizeof(buf));
	if (cc != sizeof(buf) )
		p_error("Lost the connection");
        /* Read the caller configuration */
	cc = read(sockt, buf, sizeof(buf));
	if (cc != sizeof(buf) )
		p_error("Lost the connection");
	char_erase = buf[0]; // store it in TalkConnection
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:21,代码来源:talkconn.cpp


示例10: longitude

/* Lambert Azimuthal Equal Area forward equations--mapping lat,long to x,y
  -----------------------------------------------------------------------*/
long lamazfor
(
    double lon,			/* (I) Longitude */
    double lat,			/* (I) Latitude */
    double *x,			/* (O) X projection coordinate */
    double *y			/* (O) Y projection coordinate */
)
{
double delta_lon;	/* Delta longitude (Given longitude - center 	*/
double sin_delta_lon;	/* Sine of the delta longitude 			*/
double cos_delta_lon;	/* Cosine of the delta longitude 		*/
double sin_lat;		/* Sine of the given latitude 			*/
double cos_lat;		/* Cosine of the given latitude 		*/
double g;		/* temporary varialbe				*/
double ksp;		/* heigth above elipsiod			*/
char mess[60];

/* Forward equations
  -----------------*/
delta_lon = adjust_lon(lon - lon_center);
gctp_sincos(lat, &sin_lat, &cos_lat);
gctp_sincos(delta_lon, &sin_delta_lon, &cos_delta_lon);
g = sin_lat_o * sin_lat + cos_lat_o * cos_lat * cos_delta_lon;
if (g == -1.0) 
   {
   sprintf(mess, "Point projects to a circle of radius = %f\n", 2.0 * R);
   p_error(mess, "lamaz-forward");
   return(113);
   }
ksp = R * sqrt(2.0 / (1.0 + g));
*x = ksp * cos_lat * sin_delta_lon + false_easting;
*y = ksp * (cos_lat_o * sin_lat - sin_lat_o * cos_lat * cos_delta_lon) + 
	false_northing;
return(GCTP_OK);
}
开发者ID:Kylia669,项目名称:DiplomWork,代码行数:37,代码来源:lamazfor.c


示例11: atan

/* Function to compute the latitude angle, phi2, for the inverse of the
   Lambert Conformal Conic and Polar Stereographic projections.
----------------------------------------------------------------*/
double phi2z
(
    double eccent,		/* Spheroid eccentricity		*/
    double ts,		/* Constant value t			*/
    long *flag		/* Error flag number			*/
)
{
    double eccnth;
    double phi;
    double con;
    double dphi;
    double sinpi;
    long i;

    *flag = 0;
    eccnth = .5 * eccent;
    phi = HALF_PI - 2 * atan(ts);
    for (i = 0; i <= 15; i++)
    {
        sinpi = sin(phi);
        con = eccent * sinpi;
        dphi = HALF_PI - 2 * atan(ts *(pow(((1.0 - con)/(1.0 + con)),eccnth))) 
             - phi;
        phi += dphi; 
        if (fabs(dphi) <= .0000000001)
            return(phi);
    }
    p_error ("Convergence error","phi2z-conv");
    *flag = 002;
    return(002);
}
开发者ID:davidh-ssec,项目名称:polar2grid,代码行数:34,代码来源:cproj.c


示例12: ctl_transact

/** Look for an invitation on remote machine */
int TalkConnection::look_for_invite(int mandatory)
{
    /* Check for invitation on caller's machine */
    ctl_transact(LOOK_UP, 0);

    uint8_t answer;
    uint32_t id_num;
    getResponseItems(&answer, &id_num, &lookup_addr);

    if (!mandatory) return 0;

    /* the switch is for later options, such as multiple invitations */
    switch (answer) {

	case SUCCESS:
            new_msg.id_num = htonl(id_num);
            old_msg.id_num = htonl(id_num);
            ktalk_debug("TalkConnection::look_for_invite : got SUCCESS");
            if (lookup_addr.ta_family != AF_INET)
                p_error("Response uses invalid network address");
            return (1);

	default:
            /* there wasn't an invitation waiting for us */
            ktalk_debug("TalkConnection::look_for_invite : didn't get SUCCESS");
            return (0);
    }
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:29,代码来源:talkconn.cpp


示例13: utmConversionInit

/* **************************************************************** */
long utmConversionInit(PointLla point)
{
	long zone = 0;
	double r_maj = 6378137;			// Magic Number: These are the values
	double r_min = 6356752.3142;	// needed for the UTM ellipsoid
	double scale_fact = .9996;
//	long val;
	
	if(point->longitudeRadians > PI || point->longitudeRadians < -PI)
	{
		p_error("Invalid Seed Point for UTM Init. Check Radians??","");
		return(-1);
	}

	zone = calc_utm_zone(point->longitudeRadians*R2D);

	// Check if the zone is different than what was done before
	if(zone != utmLibZone)
	{		
		if(utmforint(r_maj, r_min, scale_fact, zone) != OK) return -1;
		if(utminvint(r_maj, r_min, scale_fact, zone) != OK) return -1;
		
		utmLibInitFlag = 1;
		utmLibZone = zone;
		return OK;
	}
	else
	{
		// Zone is the same, no need to re-init
		return OK;
	}
}
开发者ID:OpenJAUS,项目名称:openjaus,代码行数:33,代码来源:utmLib.c


示例14: p_error

// Sinusoidal inverse equations--mapping x,y to lat,long 
long Projectoid::sininv(
double x,               // (I) X projection coordinate
double y,               // (I) Y projection coordinate
double *lon,            // (O) Longitude
double *lat)            // (O) Latitude
{
double temp;            // Re-used temporary variable

// Inverse equations
x -= false_easting;
y -= false_northing;
*lat = y / R;
if (fabs(*lat) > HALF_PI) 
	{
	p_error("Input data error", "sinusoidal-inverse");
	return(164);
	}
temp = fabs(*lat) - HALF_PI;
if (fabs(temp) > EPSLN)
	{
	temp = lon_center + x / (R * cos(*lat));
	*lon = adjust_lon(temp);
	}
else
	*lon = lon_center;

return(OK);

}
开发者ID:AlphaPixel,项目名称:3DNature,代码行数:30,代码来源:sininv.cpp


示例15: is_dir

int is_dir(char *url)
{
	struct stat st;
	if(stat(url,&st)<0)
		p_error("error in is_dir logic error",5);
	return S_ISDIR(st.st_mode)?1:0;
}
开发者ID:ztmhsj,项目名称:webserver,代码行数:7,代码来源:server_function.c


示例16: sin

/* Function to compute latitude, phi3, for the inverse of the Equidistant
   Conic projection.
-----------------------------------------------------------------*/
double phi3z
(
    double ml,		/* Constant 			*/
    double e0,		/* Constant			*/
    double e1,		/* Constant			*/
    double e2,		/* Constant			*/
    double e3,		/* Constant			*/
    long *flag		/* Error flag number		*/
)
{
    double phi;
    double dphi;
    long i;

    phi = ml;
    for (i = 0; i < 15; i++)
    {
        dphi = (ml + e1 * sin(2.0 * phi) - e2 * sin(4.0 * phi) + e3 * 
                sin(6.0 * phi)) / e0 - phi;
        phi += dphi;
        if (fabs(dphi) <= .0000000001)
        {
            *flag = 0;
            return(phi);
        }
    }
    p_error("Latitude failed to converge after 15 iterations","PHI3Z-CONV");
    *flag = 3;
    return(3);
}
开发者ID:davidh-ssec,项目名称:polar2grid,代码行数:33,代码来源:cproj.c


示例17: adjust_lon

/* General Vertical Near-Side Perspective forward equations--mapping 
   lat,long to x,y
  ----------------------------------------------------------------*/
long gvnspfor
(
    double lon,			/* (I) Longitude */
    double lat,			/* (I) Latitude */
    double *x,			/* (O) X projection coordinate */
    double *y			/* (O) Y projection coordinate */
)

{
double dlon;
double sinphi,cosphi;
double coslon;
double g;
double ksp;

/* Forward equations
  -----------------*/
dlon = adjust_lon(lon - lon_center);
gctp_sincos(lat,&sinphi,&cosphi);
coslon = cos(dlon);
g = sin_p15 * sinphi + cos_p15 * cosphi * coslon;
if (g < (1.0/ p))
   {
   p_error("Point cannot be projected","gvnsp-for");
   return(153);
   }
ksp = (p - 1.0)/(p - g);
*x = false_easting + R * ksp * cosphi * sin(dlon);
*y = false_northing + R * ksp * (cos_p15 * sinphi - sin_p15 * cosphi * coslon);

return(GCTP_OK);
}
开发者ID:Kylia669,项目名称:DiplomWork,代码行数:35,代码来源:gvnspfor.c


示例18: longitude

/* Wagner IV forward equations--mapping lat,long to x,y
  ----------------------------------------------------*/
long wivfor
(
    double lon,			/* (I) Longitude */
    double lat,			/* (I) Latitude */
    double *x,			/* (O) X projection coordinate */
    double *y			/* (O) Y projection coordinate */
)
{
double delta_lon;	/* Delta longitude (Given longitude - center */
double theta;
double delta_theta;
double con;
long i;

/* Forward equations
  -----------------*/
delta_lon = adjust_lon(lon - lon_center);
theta = lat;
con = 2.9604205062 * sin(lat);

/* Iterate using the Newton-Raphson method to find theta
  -----------------------------------------------------*/
for (i=0;;i++)
   {
   delta_theta = -(theta + sin(theta) - con) / (1.0 + cos(theta));
   theta += delta_theta;
   if (fabs(delta_theta) < EPSLN) break;
   if (i >= 30) p_error("Iteration failed to converge","wagneriv-forward");
   }
theta /= 2.0;
*x = 0.86310 * R * delta_lon * cos(theta) + false_easting;
*y = 1.56548 * R * sin(theta) + false_northing;
return(GCTP_OK);
}
开发者ID:Kylia669,项目名称:DiplomWork,代码行数:36,代码来源:wivfor.c


示例19: longitude

/* Universal Transverse Mercator forward equations--mapping lat,long to x,y
   Note:  The algorithm for UTM is exactly the same as TM and therefore
	  if a change is implemented, also make the change to TMFOR.c
  -----------------------------------------------------------------------*/
long utmfor
(
    double lon,			/* (I) Longitude 		*/
    double lat,			/* (I) Latitude 		*/
    double *x,			/* (O) X projection coordinate 	*/
    double *y			/* (O) Y projection coordinate 	*/
)
{
    double delta_lon;	/* Delta longitude (Given longitude - center 	*/
    double sin_phi, cos_phi;/* sin and cos value				*/
    double al, als;		/* temporary values				*/
    double b;		/* temporary values				*/
    double c, t, tq;	/* temporary values				*/
    double con, n, ml;	/* cone constant, small m			*/

    /* Forward equations
      -----------------*/
    delta_lon = adjust_lon(lon - lon_center);
    gctp_sincos(lat, &sin_phi, &cos_phi);

    /* This part was in the fortran code and is for the spherical form
    ----------------------------------------------------------------*/
    if (ind != 0)
    {
        b = cos_phi * sin(delta_lon);
        if ((fabs(fabs(b) - 1.0)) < .0000000001)
        {
            p_error("Point projects into infinity","utm-for");
            return(93);
        }
        else
        {
            *x = .5 * r_major * scale_factor * log((1.0 + b)/(1.0 - b));
            con = acos(cos_phi * cos(delta_lon)/sqrt(1.0 - b*b));
            if (lat < 0)
                con = - con;
            *y = r_major * scale_factor * (con - lat_origin);
            return(GCTP_OK);
        }
    }

    al  = cos_phi * delta_lon;
    als = SQUARE(al);
    c   = esp * SQUARE(cos_phi);
    tq  = tan(lat);
    t   = SQUARE(tq);
    con = 1.0 - es * SQUARE(sin_phi);
    n   = r_major / sqrt(con);
    ml  = r_major * mlfn(e0, e1, e2, e3, lat);

    *x  = scale_factor * n * al * (1.0 + als / 6.0 * (1.0 - t + c + als / 20.0 *
                                   (5.0 - 18.0 * t + SQUARE(t) + 72.0 * c - 58.0 * esp))) + false_easting;

    *y  = scale_factor * (ml - ml0 + n * tq * (als * (0.5 + als / 24.0 *
                          (5.0 - t + 9.0 * c + 4.0 * SQUARE(c) + als / 30.0 * (61.0 - 58.0 * t
                                  + SQUARE(t) + 600.0 * c - 330.0 * esp))))) + false_northing;

    return(GCTP_OK);
}
开发者ID:Kylia669,项目名称:DiplomWork,代码行数:63,代码来源:utmfor.c


示例20: printf

Value* Scope::newVar(const char* n) {
  if ( numvar >= MAX_SCOPE_VARS-1 ) {
    printf("Scope layer has too much variables: %d [max: %d]\n", numvar, MAX_SCOPE_VARS );
    printf("DUMPING SCOPE:\n");
    dump();
    p_error("DONE");
  }

  if ( getVar(n) != NULL )
    p_error("Variable %s has already been declared in this scope.", n );

  Value* res = new Value((long int)0);
  val[numvar] = res;
  name[numvar] = n;
  numvar++;
  return res;
}
开发者ID:SinaC,项目名称:OldRaytrace,代码行数:17,代码来源:context.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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