本文整理汇总了C++中ErrorInit函数的典型用法代码示例。如果您正苦于以下问题:C++ ErrorInit函数的具体用法?C++ ErrorInit怎么用?C++ ErrorInit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ErrorInit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
/*---------------------------------------------------------------*/
int main(int argc, char *argv[]) {
int nargs;
nargs = handle_version_option (argc, argv, vcid, "$Name: stable5 $");
if (nargs && argc - nargs == 1) exit (0);
argc -= nargs;
cmdline = argv2cmdline(argc,argv);
uname(&uts);
getcwd(cwd,2000);
Progname = argv[0] ;
argc --;
argv++;
ErrorInit(NULL, NULL, NULL) ;
DiagInit(NULL, NULL, NULL) ;
if (argc == 0) usage_exit();
parse_commandline(argc, argv);
check_options();
if (checkoptsonly) return(0);
dump_options(stdout);
SUBJECTS_DIR = getenv("SUBJECTS_DIR");
if (SUBJECTS_DIR == NULL) {
printf("ERROR: SUBJECTS_DIR not defined in environment\n");
exit(1);
}
return 0;
}
示例2: main
int
main(int argc, char *argv[]) {
char **av, *in_fname, *out_fname ;
int ac, nargs ;
MRI_SURFACE *mris ;
float alpha, beta, gamma ;
/* rkt: check for and handle version tag */
nargs = handle_version_option (argc, argv, "$Id: mris_rotate.c,v 1.6 2011/03/02 00:04:33 nicks Exp $", "$Name: stable5 $");
if (nargs && argc - nargs == 1)
exit (0);
argc -= nargs;
Progname = argv[0] ;
ErrorInit(NULL, NULL, NULL) ;
DiagInit(NULL, NULL, NULL) ;
ac = argc ;
av = argv ;
for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) {
nargs = get_option(argc, argv) ;
argc -= nargs ;
argv += nargs ;
}
if (argc < 6)
usage_exit() ;
in_fname = argv[1] ;
if (sscanf(argv[2], "%f", &alpha) != 1)
ErrorExit(ERROR_BADPARM, "%s: could not scan alpha from %s",
Progname, argv[2]) ;
if (sscanf(argv[3], "%f", &beta) != 1)
ErrorExit(ERROR_BADPARM, "%s: could not scan beta from %s",
Progname, argv[3]) ;
if (sscanf(argv[4], "%f", &gamma) != 1)
ErrorExit(ERROR_BADPARM, "%s: could not scan gamma from %s",
Progname, argv[4]) ;
out_fname = argv[5] ;
mris = MRISfastRead(in_fname) ;
if (!mris)
ErrorExit(ERROR_NOFILE, "%s: could not read surface file %s",
Progname, in_fname) ;
alpha = RADIANS(alpha) ;
beta = RADIANS(beta) ;
gamma = RADIANS(gamma) ;
MRIScenter(mris, mris) ;
MRISrotate(mris, mris, alpha, beta, gamma) ;
if (!mris)
ErrorExit(ERROR_NOFILE, "%s: could not rotate surface", Progname) ;
if (Gdiag & DIAG_SHOW)
fprintf(stderr, "writing rotated surface to %s\n", out_fname) ;
MRISwrite(mris, out_fname) ;
exit(0) ;
return(0) ; /* for ansi */
}
示例3: player_sd_init
player_sd_t*
player_sd_init(void)
{
player_sd_t* sd;
player_sd_mdns_t* mdns;
sd = (player_sd_t*)malloc(sizeof(player_sd_t));
assert(sd);
sd->devs = NULL;
sd->devs_len = 0;
mdns = (player_sd_mdns_t*)malloc(sizeof(player_sd_mdns_t));
assert(mdns);
mdns->browseRef_valid = 0;
mdns->mdnsDevs = NULL;
mdns->mdnsDevs_len = 0;
mdns->callb = NULL;
mdns->flags = 0;
sd->sdRef = mdns;
pthread_mutex_init(&(mdns->mutex),NULL);
// Initialize the interface table, so that we can decode the interface
// strings names that are used in TXT records.
itable_init();
// Pick a default debug level
ErrorInit(1,NULL);
return(sd);
}
示例4: main
int
main(int argc, char *argv[]) {
char **av, *out_vol ;
int ac, nargs ;
MRI *mri_time1, *mri_time2, *mri_tmp, *mri_atrophy ;
TRANSFORM *transform1, *transform2 ;
/* rkt: check for and handle version tag */
nargs = handle_version_option (argc, argv, "$Id: mri_map_atrophy.c,v 1.4 2011/03/02 00:04:22 nicks Exp $", "$Name: stable5 $");
if (nargs && argc - nargs == 1)
exit (0);
argc -= nargs;
Progname = argv[0] ;
ErrorInit(NULL, NULL, NULL) ;
DiagInit(NULL, NULL, NULL) ;
ac = argc ;
av = argv ;
for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) {
nargs = get_option(argc, argv) ;
argc -= nargs ;
argv += nargs ;
}
if (argc < 6)
usage_exit() ;
out_vol = argv[argc-1] ;
printf("reading volume from %s...\n", argv[1]) ;
mri_time1 = MRIread(argv[1]) ;
if (!mri_time1)
ErrorExit(ERROR_NOFILE, "%s: could not read MRI volume %s", Progname, argv[2]) ;
mri_time2 = MRIread(argv[2]) ;
if (!mri_time2)
ErrorExit(ERROR_NOFILE, "%s: could not read MRI volume %s", Progname, argv[2]) ;
transform1 = TransformRead(argv[3]) ;
if (!transform1)
ErrorExit(ERROR_NOFILE, "%s: could not read transform from %s", Progname, argv[3]) ;
transform2 = TransformRead(argv[4]) ;
if (!transform2)
ErrorExit(ERROR_NOFILE, "%s: could not read transform from %s", Progname, argv[4]) ;
mri_tmp = TransformApplyType(transform1, mri_time1, NULL, SAMPLE_NEAREST);
MRIfree(&mri_time1) ;
mri_time1 = mri_tmp ;
mri_tmp = TransformApplyType(transform2, mri_time2, NULL, SAMPLE_NEAREST);
MRIfree(&mri_time2) ;
mri_time2 = mri_tmp ;
mri_atrophy = make_atrophy_map(mri_time1, mri_time2, NULL, transform1, transform2, gray_labels, ngray, csf_labels, ncsf) ;
MRIwrite(mri_atrophy, out_vol) ;
exit(0) ;
return(0) ; /* for ansi */
}
示例5: main
int
main(int argc, char *argv[]) {
char **av ;
int ac, nargs ;
MRI *mri_src, *mri_dst = NULL ;
char *in_fname, *out_fname ;
/* rkt: check for and handle version tag */
nargs = handle_version_option (argc, argv, "$Id: mri_polv.c,v 1.6 2011/03/02 00:04:24 nicks Exp $", "$Name: stable5 $");
if (nargs && argc - nargs == 1)
exit (0);
argc -= nargs;
Progname = argv[0] ;
ErrorInit(NULL, NULL, NULL) ;
DiagInit(NULL, NULL, NULL) ;
ac = argc ;
av = argv ;
for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) {
nargs = get_option(argc, argv) ;
argc -= nargs ;
argv += nargs ;
}
if (argc < 1)
argc = 1 ;
if (argc < 1)
ErrorExit(ERROR_BADPARM, "%s: no input name specified", Progname) ;
in_fname = argv[1] ;
if (argc < 2)
ErrorExit(ERROR_BADPARM, "%s: no output name specified", Progname) ;
out_fname = argv[2] ;
if (verbose)
fprintf(stderr, "reading from %s...", in_fname) ;
mri_src = MRIread(in_fname) ;
if (!mri_src)
ErrorExit(ERROR_NO_FILE, "%s: could not open source file %s",
Progname, in_fname) ;
if (verbose)
fprintf(stderr, "done.\ncalculating plane of least variance...") ;
mri_dst = MRIcentralPlaneOfLeastVarianceNormal(mri_src, NULL, window_size) ;
if (!mri_dst)
ErrorExit(ERROR_BADPARM, "%s: plane of least variance calculation failed",
Progname) ;
if (verbose)
fprintf(stderr, "\ndone. writing output to %s", out_fname) ;
MRIwrite(mri_dst, out_fname) ;
if (verbose)
fprintf(stderr, "\n") ;
exit(0) ;
return(0) ;
}
示例6: main
int
main(int argc, char *argv[]) {
char **av ;
int ac, nargs ;
MRI *mri_src, *mri_dst ;
char *in_fname, *out_fname ;
int label, nvox ;
/* rkt: check for and handle version tag */
nargs = handle_version_option (argc, argv, "$Id: mri_copy_values.c,v 1.5 2011/03/02 00:04:14 nicks Exp $", "$Name: $");
if (nargs && argc - nargs == 1)
exit (0);
argc -= nargs;
Progname = argv[0] ;
ErrorInit(NULL, NULL, NULL) ;
DiagInit(NULL, NULL, NULL) ;
ac = argc ;
av = argv ;
for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) {
nargs = get_option(argc, argv) ;
argc -= nargs ;
argv += nargs ;
}
if (argc < 2)
ErrorExit(ERROR_BADPARM, "%s: no input name specified", Progname) ;
in_fname = argv[1] ;
if (argc < 3)
ErrorExit(ERROR_BADPARM, "%s: no value specified", Progname) ;
label = atoi(argv[2]) ;
if (argc < 4)
ErrorExit(ERROR_BADPARM, "%s: no output name specified", Progname) ;
out_fname = argv[3] ;
fprintf(stderr, "reading from %s...\n", in_fname) ;
mri_src = MRIread(in_fname) ;
if (!mri_src)
ErrorExit(ERROR_NOFILE, "%s: could not read input volume %s",
Progname, in_fname) ;
mri_dst = MRIread(out_fname) ;
if (!mri_dst)
ErrorExit(ERROR_NOFILE, "%s: could not read destination volume %s",
Progname, out_fname) ;
nvox = MRIcopyLabel(mri_src, mri_dst, label) ;
fprintf(stderr, "%d voxels copied from input to output volume...\n", nvox);
fprintf(stderr, "writing to %s...\n", out_fname) ;
MRIwrite(mri_dst, out_fname) ;
MRIfree(&mri_dst) ;
MRIfree(&mri_src) ;
exit(0) ;
return(0) ;
}
示例7: main
int
main(int argc, char *argv[]) {
char **av ;
int ac, nargs, i ;
MRI *mri_src, *mri_dst = NULL ;
char *in_fname, *out_fname ;
/* rkt: check for and handle version tag */
nargs = handle_version_option (argc, argv, "$Id: mri_reduce.c,v 1.7 2011/03/02 00:04:24 nicks Exp $", "$Name: stable5 $");
if (nargs && argc - nargs == 1)
exit (0);
argc -= nargs;
Progname = argv[0] ;
ErrorInit(NULL, NULL, NULL) ;
DiagInit(NULL, NULL, NULL) ;
ac = argc ;
av = argv ;
for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) {
nargs = get_option(argc, argv) ;
argc -= nargs ;
argv += nargs ;
}
if (argc < 1)
argc = 1 ;
if (argc < 1)
ErrorExit(ERROR_BADPARM, "%s: no input name specified", Progname) ;
in_fname = argv[1] ;
if (argc < 2)
ErrorExit(ERROR_BADPARM, "%s: no output name specified", Progname) ;
out_fname = argv[2] ;
fprintf(stderr, "reading from %s...", in_fname) ;
mri_src = MRIread(in_fname) ;
i = 0 ;
do {
if (i)
mri_src = MRIcopy(mri_dst, NULL) ;
fprintf(stderr, "\nreducing by 2");
mri_dst = MRIallocSequence(mri_src->width/2, mri_src->height/2, mri_src->depth/2, MRI_FLOAT, mri_src->nframes);
MRIreduce(mri_src, mri_dst) ;
MRIfree(&mri_src) ;
} while (++i < reductions) ;
fprintf(stderr, "\nwriting to %s", out_fname) ;
MRIwrite(mri_dst, out_fname) ;
fprintf(stderr, "\n") ;
exit(0) ;
return(0) ;
}
示例8: main
int
main(int argc, char *argv[]) {
char **av ;
int ac, nargs ;
MRI *mri_src, *mri_ref, *mri_tmp ;
double accuracy ;
MRI_REGION box ;
/* rkt: check for and handle version tag */
nargs = handle_version_option (argc, argv, "$Id: mri_label_accuracy.c,v 1.2 2011/03/02 00:04:22 nicks Exp $", "$Name: stable5 $");
if (nargs && argc - nargs == 1)
exit (0);
argc -= nargs;
Progname = argv[0] ;
ErrorInit(NULL, NULL, NULL) ;
DiagInit(NULL, NULL, NULL) ;
ac = argc ;
av = argv ;
for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) {
nargs = get_option(argc, argv) ;
argc -= nargs ;
argv += nargs ;
}
if (argc < 3)
usage_exit(1) ;
mri_src = MRIread(argv[1]) ;
if (mri_src == NULL)
ErrorExit(ERROR_BADPARM, "%s: could not read input volume %s\n", Progname,argv[1]);
MRIboundingBox(mri_src, 0, &box) ;
mri_tmp = MRIextractRegionAndPad(mri_src, NULL, &box, PAD) ;
MRIfree(&mri_src) ; mri_src = mri_tmp ;
if (mri_src->type == MRI_SHORT)
{
mri_tmp = MRIchangeType(mri_src, MRI_FLOAT, 0, 0, 0) ;
MRIfree(&mri_src) ; mri_src = mri_tmp ;
}
mri_ref = MRIread(argv[2]) ;
if (mri_ref == NULL)
ErrorExit(ERROR_BADPARM, "%s: could not read reference volume %s\n", Progname,argv[1]);
MRIboundingBox(mri_ref, 0, &box) ;
mri_tmp = MRIextractRegionAndPad(mri_ref, NULL, &box, PAD) ;
MRIfree(&mri_ref) ; mri_ref = mri_tmp ;
accuracy = MRIcomputeLabelAccuracy(mri_src, mri_ref, MRI_MEAN_MIN_DISTANCE, stdout) ;
if (Gdiag_fp)
fclose(Gdiag_fp) ;
exit(0) ;
return(0) ;
}
示例9: main
int
main(int argc, char *argv[]) {
char **av ;
int ac, nargs, nsize ;
MRI_SURFACE *mris ;
MRI *mri ;
nargs = handle_version_option (argc, argv, "$Id: mris_nudge.c,v 1.2 2011/03/02 00:04:31 nicks Exp $", "$Name: stable5 $");
if (nargs && argc - nargs == 1)
exit (0);
argc -= nargs;
Gx = Gy = Gz = -1 ;
Progname = argv[0] ;
ErrorInit(NULL, NULL, NULL) ;
DiagInit(NULL, NULL, NULL) ;
ac = argc ;
av = argv ;
for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) {
nargs = get_option(argc, argv) ;
argc -= nargs ;
argv += nargs ;
}
if (argc < 7)
usage_exit(1) ;
mris = MRISread(argv[1]) ;
if (mris == NULL)
ErrorExit(ERROR_NOFILE, "%s: could not read surface from %s", Progname, argv[1]) ;
MRIScomputeMetricProperties(mris) ;
MRISstoreMetricProperties(mris) ;
mri = MRIread(argv[2]) ;
if (mri == NULL)
ErrorExit(ERROR_NOFILE, "%s: could not read volume from %s", Progname, argv[2]) ;
target_vnos[nvertices] = atoi(argv[3]) ;
target_vals[nvertices] = atof(argv[4]) ;
nsize = atoi(argv[5]) ;
printf("nudging %d vertex region around vertex %d to target val %2.1f\n",
nsize, target_vnos[nvertices], target_vals[nvertices]) ;
nvertices++ ;
MRISerodeRipped(mris, nsize) ;
MRISrepositionSurface(mris, mri, target_vnos, target_vals, nvertices, nsize, sigma) ;
MRISunrip(mris) ;
printf("writing repositioned surface to %s\n", argv[6]) ;
MRISwrite(mris, argv[6]) ;
return(0) ;
}
示例10: main
//------------------------------------------------------------------------------
int main( int argc, char* argv[] )
{
if (argc < 3) {
printf("Too few arguments!\nUsage: orbittarget <robot_name> <neighbour_name> [config_file]\n");
return 1;
}
// init general stuff
ErrorInit ( 1, false );
initRandomNumberGenerator();
printf("-----------------------------------\n");
printf("Chatterbox Orbit Target\n");
printf(" build %s %s \n", __DATE__, __TIME__);
printf(" compiled against RAPI version %s (%s) build %s\n", RAPI_VERSION(),
RAPI_GIT_VERSION(), RAPI_BUILD() );
printf("\n");
printf("Lifting the robot up disables motors\n");
if (signal(SIGINT, quitSig) == SIG_ERR) {
PRT_ERR1("Error resetting signal handler %s", strerror(errno));
}
// Create robot and its controller
robot = new Rapi::CCBRobot ();
if ( robot->init() == 0) {
Rapi::rapiError->print();
delete robot;
exit(-1);
}
robot->setName(argv[1]);
if (argc > 3)
robotCtrl = new COrbitTarget ( robot, std::string(argv[3]) );
else
robotCtrl = new COrbitTarget ( robot );
robotCtrl->setNNName(std::string(argv[2]));
// Blocking call
robot->run();
// Clean up robot controller
if (robotCtrl) {
delete robotCtrl;
robotCtrl = NULL;
}
// Clean up robot
if (robot)
delete (robot);
return 1;
}
示例11: WSAHtonl
void SocketUdp::Bind(const EndPoint& ep)
{
SOCKADDR_IN sin;
if (!ep.getIp())
WSAHtonl(this->socket_, INADDR_ANY, &sin.sin_addr.s_addr);
else
sin.sin_addr.s_addr = inet_addr(ep.getIpStr().c_str());
sin.sin_family = AF_INET;
WSAHtons(this->socket_, ep.getPort(), &sin.sin_port);
if ((bind(this->socket_, reinterpret_cast<SOCKADDR*>(&sin), sizeof sin)) == SOCKET_ERROR)
throw ErrorInit("Cannot bind the socket");
}
示例12: ErrorHashCreate
PARSEDLLSPEC int ErrorHashCreate(struct _Error *m, int many)
{
struct _Error **fpnew;
int it, ip;
int key;
if(_ErrorFirst)
{
ErrorInit();
}
for(it=0; it<many; it++)
{
//
// compute hash key
//
key=ErrorHashKey(m[it].code);
//
// see if we need to create more room
//
if(EH[key].many>=EH[key].max)
{
fpnew=(struct _Error **)malloc((EH[key].max+EENTRY)*sizeof(struct _Error *));
if(fpnew!=0)
{
if(EH[key].many>0 && EH[key].fptr!=0)
{
for(ip=0; ip<EH[key].many; ip++)
{
fpnew[ip]=EH[key].fptr[ip];
}
free(EH[key].fptr);
}
EH[key].fptr=fpnew;
EH[key].max+=EENTRY;
}
else
{
ErrorHashDestroy();
return -1;
}
}
//
// now we should be able to stick the new one in the structure
//
EH[key].fptr[EH[key].many]= &m[it];
EH[key].many++;
}
return 0;
}
示例13: ErrorForward
PARSEDLLSPEC void ErrorForward(int art, int code, char *ttype, char *message)
{
struct _Error *mptr;
int response;
int type;
if(_ErrorFirst)
{
ErrorInit();
}
type=ErrorTypeParse(ttype);
mptr=ErrorFind(code);
if(mptr==0)
{
if(type>=0 && type<sizeof(_ErrorResponse)/sizeof(_ErrorResponse[0]))
{
response=_ErrorResponse[type];
}
else
{
response=0;
}
}
else
{
type=mptr->type&0xff;
response=(mptr->type>>8)&0xff;
if(response==0)
{
if(type>=0 && type<sizeof(_ErrorResponse)/sizeof(_ErrorResponse[0]))
{
response=_ErrorResponse[type];
}
else
{
response=0;
}
}
}
response&=(~(1<<ErrorResponseSpecial));
//
// here is where we format the message
//
if(response!=0)
{
ErrorPrintIt(art,code,type,response,message);
}
}
示例14: main
/***-------------------------------------------------------****/
int main(int argc, char *argv[])
{
int nargs, index, ac, nvolumes;
char **av ;
MRI *mri_and = NULL, *mri ;
/* rkt: check for and handle version tag */
nargs = handle_version_option (argc, argv, vcid, "$Name: $");
if (nargs && argc - nargs == 1)
exit (0);
Progname = argv[0] ;
argc -= nargs;
ac = argc ;
av = argv ;
for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++)
{
nargs = get_option(argc, argv) ;
argc -= nargs ;
argv += nargs ;
}
nvolumes = argc-2 ;
if (nvolumes <= 0)
usage_exit() ;
printf("processing %d input files\n", nvolumes) ;
ErrorInit(NULL, NULL, NULL) ;
DiagInit(NULL, NULL, NULL) ;
for (index = 0 ; index < nvolumes ; index++)
{
char *fname = argv[index+1] ;
printf("processing input volume %d of %d: %s\n",
index+1, nvolumes, fname) ;
mri = MRIread(fname) ;
if (index == 0)
mri_and = MRIcopy(mri, NULL) ;
else
MRIand(mri, mri_and, mri_and, 0) ;
MRIfree(&mri) ;
}
printf("writing output to %s\n", argv[argc-1]) ;
MRIwrite(mri_and, argv[argc-1]) ;
exit(0);
} /* end main() */
示例15: main
int
main(int argc, char *argv[])
{
MRI_SURFACE *mris ;
char **av, *in_fname, *out_fname ;
int ac, nargs ;
MRI *mri_distance ;
/* rkt: check for and handle version tag */
nargs = handle_version_option
(argc, argv,
"$Id: mris_distance_map.c,v 1.2 2011/03/02 00:04:31 nicks Exp $",
"$Name: stable5 $");
if (nargs && argc - nargs == 1)
exit (0);
argc -= nargs;
Progname = argv[0] ;
ErrorInit(NULL, NULL, NULL) ;
DiagInit(NULL, NULL, NULL) ;
ac = argc ;
av = argv ;
for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) {
nargs = get_option(argc, argv) ;
argc -= nargs ;
argv += nargs ;
}
if (argc < 3) usage_exit() ;
in_fname = argv[1] ;
out_fname = argv[2] ;
mris = MRISread(in_fname) ;
if (mris == NULL)
ErrorExit(ERROR_NOFILE, "%s: could not load surface %s", Progname, out_fname) ;
mri_distance = MRIScomputeDistanceMap(mris, NULL, ref_vertex_no) ;
MRIwrite(mri_distance, out_fname) ;
MRISfree(&mris) ;
exit(0) ;
return(0) ; /* for ansi */
}