本文整理汇总了C++中bu_exit函数的典型用法代码示例。如果您正苦于以下问题:C++ bu_exit函数的具体用法?C++ bu_exit怎么用?C++ bu_exit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bu_exit函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int
main (int argc, char **argv)
{
int Ch; /* The current input character */
int *thresh_val; /* The threshold value */
int nm_threshs; /* How many thresholds? */
int i;
unsigned char *bin_color = (unsigned char *)0;/* resultant pixel values */
if ((nm_threshs = argc - 1) < 1) {
bu_exit(1, "%s", USAGE);
}
if (nm_threshs > 255) {
bu_exit(1, "bwthresh: Too many thresholds!\n");
}
thresh_val = (int *)bu_malloc((unsigned) (nm_threshs * sizeof(int)), "thresh_val");
bin_color = (unsigned char *)bu_malloc((unsigned) ((nm_threshs + 1) * sizeof(int)), "bin_color");
for (i = 0; i < nm_threshs; ++i) {
if (sscanf(*++argv, "%d", thresh_val + i) != 1) {
bu_log("bwthresh: Illegal threshold value: '%s'\n", *argv);
bu_exit(1, "%s", USAGE);
}
if ((unsigned char) thresh_val[i] != thresh_val[i]) {
bu_exit(1, "bwthresh: Threshold[%d] value %d out of range. Need 0 <= value <= 255\n",
i, thresh_val[i]);
}
if (i > 0) {
if (thresh_val[i] <= thresh_val[i - 1]) {
bu_exit(1, "bwthresh: Threshold values not strictly increasing\n");
}
}
bin_color[i] = 256 * i / nm_threshs;
}
bin_color[i] = 255;
while ((Ch = getchar()) != EOF) {
for (i = 0; i < nm_threshs; ++i)
if (Ch < thresh_val[i])
break;
(void) putchar(bin_color[i]);
}
bu_free(thresh_val, "thresh_val");
bu_free(bin_color, "bin_color");
return 0;
}
开发者ID:cogitokat,项目名称:brlcad,代码行数:47,代码来源:bwthresh.c
示例2: checkgamma
void
checkgamma(double g)
{
if (fabs(g) < 1.0e-10) {
fprintf(stderr, "fbgamma: gamma too close to zero\n");
bu_exit(3, "%s", usage);
}
}
开发者ID:kanzure,项目名称:brlcad,代码行数:8,代码来源:fbgamma.c
示例3: wait
/*
If args[0] is NULL, spawn a shell, otherwise execute the specified
command line.
Return the exit status of the program, or -1 if wait() or fork()
return an error.
*/
int
exec_Shell(char **args)
{
int child_pid;
if (args[0] == NULL) {
char *arg_sh = getenv("SHELL");
/* $SHELL, if set, DFL_SHELL otherwise. */
if (arg_sh == NULL)
arg_sh = DFL_SHELL;
args[0] = arg_sh;
args[1] = NULL;
}
switch (child_pid = fork()) {
case -1 :
fb_log("\"%s\" (%d) could not fork.\n",
__FILE__, __LINE__
);
return -1;
case 0 : /* Child process - execute. */
sleep(2);
(void)execvp(args[0], args);
fb_log("%s : could not execute.\n", args[0]);
bu_exit(1, NULL);
default :
{
int pid;
int stat_loc;
void (*istat)(), (*qstat)(), (*cstat)();
istat = signal(SIGINT, SIG_IGN);
qstat = signal(SIGQUIT, SIG_IGN);
cstat = signal(SIGCLD, SIG_DFL);
while ( (pid = wait(&stat_loc)) != -1
&& pid != child_pid
)
;
(void)signal(SIGINT, istat);
(void)signal(SIGQUIT, qstat);
(void)signal(SIGCLD, cstat);
if (pid == -1) {
fb_log("\"%s\" (%d) wait failed : no children.\n",
__FILE__, __LINE__
);
return -1;
}
switch (stat_loc & 0377) {
case 0177 : /* Child stopped. */
fb_log("Child stopped.\n");
return (stat_loc >> 8) & 0377;
case 0 : /* Child exited. */
return (stat_loc >> 8) & 0377;
default : /* Child terminated. */
fb_log("Child terminated.\n");
return 1;
}
}
}
}
开发者ID:kanzure,项目名称:brlcad,代码行数:64,代码来源:execshell.c
示例4: main
int
main(int argc, char **argv)
{
register int i;
struct timeval tv;
if ( !get_args( argc, argv ) ) {
(void)fputs(usage, stderr);
bu_exit( 1, NULL );
}
if ( fps > 0.0 ) {
tv.tv_sec = (long) (1.0 / fps);
tv.tv_usec = (long) (((1.0 / fps) - tv.tv_sec) * 1000000);
}
if ( (fbp = fb_open( NULL, size, size)) == FBIO_NULL ) {
fprintf(stderr, "fbcmrot: fb_open failed\n");
return 1;
}
local_inp = &cm1;
local_outp = &cm2;
fb_rmap( fbp, local_inp );
while (1) {
register int from;
ColorMap *tp;
/* Build color map for current value */
for ( i=0, from = increment; i < 256; i++, from++ ) {
if ( from < 0 )
from += 256;
else if ( from > 255 )
from -= 256;
local_outp->cm_red[i] = local_inp->cm_red[from];
local_outp->cm_green[i] = local_inp->cm_green[from];
local_outp->cm_blue[i] = local_inp->cm_blue[from];
}
fb_wmap( fbp, local_outp );
tp = local_outp;
local_outp = local_inp;
local_inp = tp;
if ( fps > 0.0 ) {
fd_set readfds;
FD_ZERO(&readfds);
FD_SET(fileno(stdin), &readfds);
select(fileno(stdin)+1, &readfds, (fd_set *)0, (fd_set *)0, &tv);
}
if ( onestep )
break;
}
fb_close( fbp );
return 0;
}
开发者ID:cciechad,项目名称:brlcad,代码行数:58,代码来源:fbcmrot.c
示例5: do_rt_gettrees
void
do_rt_gettrees(struct rt_i *my_rtip, char **object_name, int nm_objects, int *prep)
{
static char **prev_names = 0;
static int prev_nm = 0;
int i;
if (object_name == NULL) {
if ((object_name = prev_names) == 0)
bu_exit (1, "%s:%d: This shouldn't happen\n", __FILE__, __LINE__);
nm_objects = prev_nm;
}
if (prev_names == 0) {
prev_names = object_name;
prev_nm = nm_objects;
}
if (silent_flag != SILENT_YES) {
printf("\nGet trees...");
fflush(stdout);
}
i = rt_gettrees_and_attrs(my_rtip, (const char **)a_tab.attrib, nm_objects, (const char **) object_name, 1);
if (i) {
fflush(stdout);
bu_exit (1, "rt_gettrees() failed\n");
}
if (*prep) {
if (silent_flag != SILENT_YES) {
printf("\nPrepping the geometry...");
fflush(stdout);
}
rt_prep(my_rtip);
*prep = 0;
}
if (silent_flag != SILENT_YES) {
printf("\n%s", (nm_objects == 1) ? "Object" : "Objects");
for (i = 0; i < nm_objects; ++i)
printf(" '%s'", object_name[i]);
printf(" processed\n");
}
}
开发者ID:behollis,项目名称:brlcad-svn-rev65072-gsoc2015,代码行数:45,代码来源:nirt.c
示例6: main
int main(int argc, char **argv)
{
int i, n;
double *bp;
double arg;
int j;
size_t ret;
if ( !get_args( argc, argv ) || isatty(fileno(infp))
|| isatty(fileno(stdout)) ) {
bu_exit(1, "Usage: dmod {-a add -s sub -m mult -d div -A(abs) -e exp -r root} [doubles]\n");
}
while ( (n = fread(buf, sizeof(*buf), BUFLEN, infp)) > 0 ) {
for ( i = 0; i < numop; i++ ) {
arg = val[ i ];
switch ( op[i] ) {
double d;
case ADD:
bp = &buf[0];
for ( j = n; j > 0; j-- ) {
*bp++ += arg;
}
break;
case MULT:
bp = &buf[0];
for ( j = n; j > 0; j-- ) {
*bp++ *= arg;
}
break;
case POW:
bp = &buf[0];
for ( j = n; j > 0; j-- ) {
d = pow( *bp, arg );
*bp++ = d;
}
break;
case ABS:
bp = &buf[0];
for ( j = n; j > 0; j-- ) {
if ( *bp < 0.0 )
*bp = - *bp;
bp++;
}
break;
default:
break;
}
}
ret = fwrite( buf, sizeof(*buf), n, stdout );
if (ret != (size_t)n)
perror("fwrite");
}
return 0;
}
开发者ID:cogitokat,项目名称:brlcad,代码行数:57,代码来源:dmod.c
示例7: do_bool_tree_rewrite
/*
* Perform one rewrite step on the root of a Boolean tree
*
* This function has two parameters: a Boolean-tree node and a rule
* number. Do_bool_tree_rewrite() applies the specified rewrite rule
* to the subtree rooted at the specified node.
*/
static void do_bool_tree_rewrite (struct bool_tree_node *rp, int rule_nm)
{
struct bool_tree_node *left; /* Left child of the root */
struct bool_tree_node *right; /* Right " " " " */
struct bool_tree_node *a, *b, *c; /* Subtrees unchanged */
BU_CKMAG(rp, BOOL_TREE_NODE_MAGIC, "Boolean tree node");
left = bt_opd(rp, BT_LEFT);
right = bt_opd(rp, BT_RIGHT);
BU_CKMAG(left, BOOL_TREE_NODE_MAGIC, "Boolean tree node");
BU_CKMAG(right, BOOL_TREE_NODE_MAGIC, "Boolean tree node");
switch (rule_nm) {
case 0:
return;
case 1: /* a U (b U c) : (a U b) U c */
case 5: /* a - (b U c) : (a - b) - c */
case 6: /* a * (b * c) : (a * b) * c */
case 8: /* a * (b - c) : (a * b) - c */
a = left;
b = bt_opd(right, BT_LEFT);
c = bt_opd(right, BT_RIGHT);
bt_opd(rp, BT_LEFT) = right;
bt_opd(bt_opd(rp, BT_LEFT), BT_LEFT) = a;
bt_opd(bt_opd(rp, BT_LEFT), BT_RIGHT) = b;
bt_opd(rp, BT_RIGHT) = c;
bt_opn(bt_opd(rp, BT_LEFT)) = bt_opn(rp);
if ((rule_nm == 5) || (rule_nm == 8))
bt_opn(rp) = OPN_DIFFERENCE;
break;
case 2: /* (a U b) * c : (a * c) U (b * c) */
case 4: /* (a U b) - c : (a - c) U (b - c) */
a = bt_opd(left, BT_LEFT);
b = bt_opd(left, BT_RIGHT);
c = right;
bt_opn(left) = bt_opn(rp);
bt_opd(left, BT_RIGHT) = dup_bool_tree(c);
bt_opn(rp) = OPN_UNION;
bt_opd(rp, BT_RIGHT) = bt_create_internal(bt_opn(left), b, c);
break;
case 3: /* a * (b U c) : (a * b) U (a * c) */
case 7: /* a - (b * c) : (a - b) U (a - c) */
case 9: /* a - (b - c) : (a - b) U (a * c) */
a = left;
b = bt_opd(right, BT_LEFT);
c = bt_opd(right, BT_RIGHT);
bt_opd(rp, BT_LEFT) = bt_create_internal(bt_opn(rp), a, b);
bt_opn(rp) = OPN_UNION;
bt_opn(right) = (rule_nm == 7) ? OPN_DIFFERENCE
: OPN_INTERSECTION;
bt_opd(right, BT_LEFT) = dup_bool_tree(a);
break;
default:
bu_exit (1, "Reached %s:%d. This shouldn't happen\n", __FILE__, __LINE__);
}
}
开发者ID:behollis,项目名称:brlcad-svn-rev65072-gsoc2015,代码行数:64,代码来源:bool_rewrite.c
示例8: main
/**
* M A I N
*
* Call parse_args to handle command line arguments first, then
* process input.
*/
int main(int ac, char *av[])
{
/** @struct rt_i
* This structure contains some global state information for librt
*/
struct rt_i *rtip;
struct db_tree_state init_state; /* state table for the hierarchy walker */
char idbuf[1024] = {0}; /* Database title */
int arg_count;
char *tmp_basename;
/** @struct user_data
* This is an example structure.
* It contains anything you want to have available in the region/leaf processing routines
*/
struct user_data {
int stuff;
} user_data;
arg_count = parse_args(ac, av);
if ((ac - arg_count) < 1) {
tmp_basename = bu_basename(av[0]);
usage(tmp_basename, "bad argument count");
bu_free(tmp_basename, "tmp_basename free");
}
/*
* Build an index of what's in the database.
* rt_dirbuild() returns an "instance" pointer which describes
* the database. It also gives you back the
* title string in the header (ID) record.
*/
rtip = rt_dirbuild(av[arg_count], idbuf, sizeof(idbuf));
if (rtip == RTI_NULL) {
bu_exit(2, "%s: rt_dirbuild failure\n", av[0]);
}
arg_count++;
init_state = rt_initial_tree_state;
db_walk_tree(rtip->rti_dbip, /* database instance */
ac-arg_count, /* number of trees to get from the database */
(const char **)&av[arg_count],
1, /* number of cpus to use */
&init_state,
region_start,
region_end,
leaf_func,
(genptr_t)&user_data);
/* at this point you can do things with the geometry you have obtained */
return 0;
}
开发者ID:cogitokat,项目名称:brlcad,代码行数:63,代码来源:walk_example.c
示例9: main
int
main(int argc, char *argv[])
{
int function_num = 0;
if (argc < 3) {
bu_exit(1, "Argument format: <function_number> <args> [%s]\n", argv[0]);
}
sscanf(argv[1], "%d", &function_num);
switch (function_num) {
case 1:
return test_bn_table_make_uniform(argc, argv);
case 2:
return test_bn_tabdata_add(argc, argv);
case 3:
return test_bn_tabdata_mul(argc, argv);
case 4:
return test_bn_tabdata_mul3(argc, argv);
case 5:
return test_bn_tabdata_incr_mul3_scale(argc, argv);
case 6:
return test_bn_tabdata_incr_mul2_scale(argc, argv);
case 7:
return test_bn_tabdata_scale(argc, argv);
case 8:
return test_bn_table_scale(argc, argv);
case 9:
return test_bn_tabdata_join1(argc, argv);
case 10:
return test_bn_tabdata_join2(argc, argv);
case 11:
return test_bn_tabdata_blend2(argc, argv);
case 12:
return test_bn_tabdata_blend3(argc, argv);
case 13:
return test_bn_tabdata_area1(argc, argv);
case 14:
return test_bn_tabdata_area2(argc, argv);
case 15:
return test_bn_tabdata_mul_area1(argc, argv);
case 16:
return test_bn_tabdata_mul_area2(argc, argv);
case 17:
return test_bn_table_lin_interp(argc, argv);
case 18:
return test_bn_tabdata_copy(argc, argv);
case 19:
return test_bn_tabdata_dup(argc, argv);
case 20:
return test_bn_tabdata_get_constval(argc, argv);
}
bu_log("ERROR: function_num %d is not valid [%s]\n", function_num, argv[0]);
return 1;
}
开发者ID:kanzure,项目名称:brlcad,代码行数:57,代码来源:bn_tabdata.c
示例10: main
int
main(int argc, char **argv)
{
FBIO *fbp;
FILE *fp;
int fbsize = 512;
int i;
while (argc > 1) {
if (BU_STR_EQUAL(argv[1], "-h")) {
fbsize = 1024;
} else if (argv[1][0] == '-') {
/* unknown flag */
bu_exit(1, "%s", usage);
} else
break; /* must be a filename */
argc--;
argv++;
}
if (argc > 1) {
if ((fp = fopen(argv[1], "wb")) == NULL) {
fprintf(stderr, "fb-cmap: can't open \"%s\"\n", argv[1]);
bu_exit(2, "%s", usage);
}
} else
fp = stdout;
if ((fbp = fb_open(NULL, fbsize, fbsize)) == FBIO_NULL)
bu_exit(2, "Unable to open framebuffer\n");
i = fb_rmap(fbp, &cm);
fb_close(fbp);
if (i < 0) {
bu_exit(3, "fb-cmap: can't read colormap\n");
}
for (i = 0; i <= 255; i++) {
fprintf(fp, "%d\t%04x %04x %04x\n", i,
cm.cm_red[i], cm.cm_green[i], cm.cm_blue[i]);
}
return 0;
}
开发者ID:cogitokat,项目名称:brlcad,代码行数:44,代码来源:fb-cmap.c
示例11: get_large_field_input
HIDDEN void
get_large_field_input(FILE *fp, int write_flag)
{
char **tmp_rec;
size_t field_no;
size_t card_len;
size_t last_field;
size_t i;
tmp_rec = prev_rec;
prev_rec = curr_rec;
curr_rec = tmp_rec;
for (field_no=0; field_no < NO_OF_FIELDS; field_no ++)
curr_rec[field_no][0] = '\0';
card_len = strlen(line);
last_field = (card_len - 8)/16 + 1;
if (((last_field - 1) * 16 + 8) < card_len)
last_field++;
if (last_field > 5)
last_field = 5;
bu_strlcpy(curr_rec[0], line, 8);
curr_rec[0][8] = '\0';
for (field_no=1; field_no < last_field; field_no++) {
bu_strlcpy(curr_rec[field_no], &line[field_no*16 - 8], 16);
curr_rec[field_no][16] = '\0';
}
/* remove the newline from the end of the last field */
i = strlen(curr_rec[last_field-1]) - 1;
while (isspace((int)curr_rec[last_field-1][i]) || curr_rec[last_field-1][i] == '\012' || curr_rec[last_field-1][i] == '\015')
i--;
curr_rec[last_field-1][++i] = '\0';
if (next_line[0] == '*') {
if (!get_next_record(fp, 0, 0)) {
bu_exit(1, "unexpected end of INPUT at line #%ld\n", line_count);
}
card_len = strlen(line);
last_field = (card_len - 8)/16 + 1;
if (((last_field - 1) * 16 + 8) < card_len)
last_field++;
if (last_field > 5)
last_field = 5;
last_field += 4;
for (field_no=5; field_no < last_field; field_no++) {
bu_strlcpy(curr_rec[field_no], &line[(field_no-4)*16 - 8], 16);
curr_rec[field_no][16] = '\0';
}
}
if (write_flag)
write_fields();
}
开发者ID:kanzure,项目名称:brlcad,代码行数:56,代码来源:nastran-g.c
示例12: main
int
main(int argc, char **argv)
{
int x, y;
int xin, yin; /* number of sceen output lines */
height = width = 512; /* Defaults */
if ( !get_args( argc, argv ) ) {
(void)fputs(usage, stderr);
bu_exit( 1, NULL );
}
/* Open Display Device */
if ((fbp = fb_open(framebuffer, width, height )) == NULL ) {
fprintf( stderr, "fb_open failed\n");
bu_exit( 1, NULL );
}
/* determine "reasonable" behavior */
xin = fb_getwidth(fbp) - scr_xoff;
if ( xin < 0 ) xin = 0;
if ( xin > width ) xin = width;
yin = fb_getheight(fbp) - scr_yoff;
if ( yin < 0 ) yin = 0;
if ( yin > height ) yin = height;
for ( y = scr_yoff; y < scr_yoff + yin; y++ ) {
if ( inverse ) {
(void)fb_read( fbp, scr_xoff, fb_getheight(fbp)-1-y, inbuf, xin );
} else {
(void)fb_read( fbp, scr_xoff, y, inbuf, xin );
}
for ( x = 0; x < xin; x++ ) {
obuf[x] = (((int)inbuf[3*x+RED]) + ((int)inbuf[3*x+GRN])
+ ((int)inbuf[3*x+BLU])) / 3;
}
fwrite( &obuf[0], sizeof( char ), xin, outfp );
}
fb_close( fbp );
bu_exit( 0, NULL );
}
开发者ID:cciechad,项目名称:brlcad,代码行数:43,代码来源:fb-bw.c
示例13: do_file
/*
* D O _ F I L E
*/
void
do_file(void)
{
char *output_file;
FILE *ifp, *ofp;
int i;
if ( (ifp = fopen( input_file, "rb" )) == NULL ) {
perror(input_file);
bu_exit(1, NULL);
}
output_file = (char *)bu_malloc( strlen(input_file)+10, "output_file" );
snprintf(output_file, strlen(input_file)+9, "MOD_%s", input_file);
if ( (ofp = fopen( output_file, "wb" )) == NULL ) {
perror(output_file);
fclose(ifp);
bu_free(output_file, "output_file");
bu_exit(2, NULL);
}
bu_free(output_file, "output_file");
/* Shift cmap to be more useful */
for ( i=0; i<256; i++ ) {
map.cm_red[i] >>= 8;
map.cm_green[i] >>= 8;
map.cm_blue[i] >>= 8;
}
while ( !feof(ifp) ) {
i = map.cm_red[getc(ifp)];
putc( i, ofp );
i = map.cm_green[getc(ifp)];
putc( i, ofp );
i = map.cm_blue[getc(ifp)];
putc( i, ofp );
}
fclose(ifp);
fclose(ofp);
}
开发者ID:cogitokat,项目名称:brlcad,代码行数:45,代码来源:fbgammamod.c
示例14: Put_vertex
int
Put_vertex(struct vertex *v, struct iges_edge_use *edge)
{
struct iges_edge_list *e_list;
struct iges_edge_list *el;
struct iges_vertex_list *v_list;
int vert_index;
int vert_de;
if ((e_list = Get_edge_list(edge)) == NULL)
return 0;
el = e_list;
while (el && el->edge_de != edge->edge_de)
el = el->next;
if (!el) {
bu_exit(1, "Cannot find an edge list with edge_de = %d\n", edge->edge_de);
}
if (edge->orient) {
vert_de = el->i_edge[edge->index-1].start_vert_de;
vert_index = el->i_edge[edge->index-1].start_vert_index-1;
} else {
vert_de = el->i_edge[edge->index-1].end_vert_de;
vert_index = el->i_edge[edge->index-1].end_vert_index-1;
}
if ((v_list = Get_vertex_list(vert_de)) == NULL)
return 0;
if (v_list->i_verts[vert_index].v) {
bu_log("vertex already assigned %p, trying to assign %p\n",
(void *)v_list->i_verts[vert_index].v, (void *)v);
bu_exit(1, "Multiple vertex assignments\n");
}
v_list->i_verts[vert_index].v = v;
return 1;
}
开发者ID:behollis,项目名称:brlcad-svn-rev65072-gsoc2015,代码行数:42,代码来源:get_vertex.c
示例15: main
int
main(int argc, char **argv)
{
FILE *ofp = stdout;
size_t num = 0;
size_t scans_per_patch, bytes_per_patch;
size_t y;
outwidth = outheight = DEFAULT_SIZE;
if (!get_args(argc, argv)) {
(void)fputs(usage, stderr);
bu_exit (1, NULL);
}
if (encapsulated) {
xpoints = width;
ypoints = height;
} else {
xpoints = outwidth * 72 + 0.5;
ypoints = outheight * 72 + 0.5;
}
prolog(ofp, file_name, xpoints, ypoints);
scans_per_patch = MAX_BYTES / width;
if (scans_per_patch > height)
scans_per_patch = height;
bytes_per_patch = scans_per_patch * width;
for (y = 0; y < height; y += scans_per_patch) {
/* start a patch */
fprintf(ofp, "save\n");
fprintf(ofp, "%lu %lu 8 [%lu 0 0 %lu 0 %lu] {<\n ",
(unsigned long)width, (unsigned long)scans_per_patch, /* patch size */
(unsigned long)width, (unsigned long)height, /* total size = 1.0 */
(unsigned long)-y); /* patch y origin */
/* data */
num = 0;
while (num < bytes_per_patch) {
fprintf(ofp, "%02x", getc(infp));
if ((++num % 32) == 0)
fprintf(ofp, "\n ");
}
/* close this patch */
fprintf(ofp, ">} image\n");
fprintf(ofp, "restore\n");
}
postlog(ofp);
return 0;
}
开发者ID:cogitokat,项目名称:brlcad,代码行数:53,代码来源:bw-ps.c
示例16: get_small_field_input
HIDDEN void
get_small_field_input(FILE *fp, int write_flag)
{
char **tmp_rec;
int field_no;
int card_len;
int last_field;
tmp_rec = prev_rec;
prev_rec = curr_rec;
curr_rec = tmp_rec;
for ( field_no=0; field_no < NO_OF_FIELDS; field_no ++ )
curr_rec[field_no][0] = '\0';
card_len = strlen( line );
last_field = card_len/8 + 1;
if ( (last_field * 8) < card_len )
last_field++;
if ( last_field > 9 )
last_field = 9;
bu_strlcpy( curr_rec[0], line, 8 );
curr_rec[0][8] = '\0';
for ( field_no=2; field_no < last_field+1; field_no++ )
{
bu_strlcpy( curr_rec[field_no-1], &line[(field_no-1)*8], 8 );
curr_rec[field_no-1][8] = '\0';
}
if ( next_line[0] == '+' )
{
if ( !get_next_record( fp, 0, 0 ) )
{
bu_exit(1, "unexpected end of INPUT at line #%d\n", line_count );
}
card_len = strlen( line );
last_field = card_len/8 + 1;
if ( (last_field * 8) < card_len )
last_field++;
if ( last_field > 9 )
last_field = 9;
last_field += 9;
for ( field_no=10; field_no < last_field+1; field_no++ )
{
bu_strlcpy( curr_rec[field_no-1], &line[(field_no-9)*8], 8 );
curr_rec[field_no-1][8] = '\0';
}
}
if ( write_flag )
write_fields();
}
开发者ID:cciechad,项目名称:brlcad,代码行数:53,代码来源:nastran-g.c
示例17: main
int main()
{
char in_filename[120];
int width, height;
icv_image_t *bif;
printf("Input file Name\n");
if (scanf("%s", in_filename ) != 1) {
bu_exit(1,"Wrong Arguments");
}
printf("input the width height of the Image file : ");
if(scanf("%d %d", &width, &height)!=2)
bu_exit(1,"Wrong Arguments");
bif = pix_load(in_filename, width, height);
printf("...\nImage Loaded Successfully\n...\n");
icv_image_save(bif, OUT_IMAGE, ICV_IMAGE_PIX);
printf("...\nImage Saved Successfully\n...\n");
return 0;
}
开发者ID:zerolevel,项目名称:libicv,代码行数:21,代码来源:icv_image_pix_load.c
示例18: do_fb
/*
* D O _ F B
*/
void
do_fb(void)
{
FBIO *fbp;
if ( (fbp = fb_open( framebuffer, 0, 0 )) == FBIO_NULL ) {
bu_exit( 2, "Unable to open framebuffer\n" );
}
if ( fb_wmap( fbp, &map ) < 0 )
fprintf( stderr, "fbgammamod: unable to write color map\n");
fb_close(fbp);
}
开发者ID:cogitokat,项目名称:brlcad,代码行数:15,代码来源:fbgammamod.c
注:本文中的bu_exit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论