~ubuntu-branches/debian/stretch/adios/stretch

« back to all changes in this revision

Viewing changes to utils/bpsplit/bpappend.c

  • Committer: Package Import Robot
  • Author(s): Alastair McKinstry
  • Date: 2014-06-16 23:06:38 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20140616230638-5a0z7ylxx8i0edrg
Tags: 1.7.0-1
* New upstream release.
* Add adios.pc pkgconfig file. adios_config now uses this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
/** Main */
95
95
int main( int argc, char *argv[] ) {
96
96
    int excode;
97
 
    int from      = -1;           // split from  'from'. -1=last
98
 
    int to        = -1;           // split until 'to'. -1=last
99
97
    char *filein  = NULL;
100
98
    char *fileout = NULL;       
101
99
 
102
100
    prgname = strdup(argv[0]);
103
101
 
104
102
    /* other variables */
105
 
    int c, last_c='_';
 
103
    int c;
 
104
    //int last_c='_';
106
105
    int idx = 1;
107
106
    /* Process the arguments */
108
107
    while ((c = getopt_long(argc, argv, optstring, options, NULL)) != -1) {
129
128
            exit (1);
130
129
            break;
131
130
        } /* end switch */
132
 
        last_c = c;
 
131
        //last_c = c;
133
132
        idx++;
134
133
    } /* end while */
135
134
 
339
338
    struct adios_index_process_group_struct_v1 * pg = in_pg_root;
340
339
    struct adios_index_var_struct_v1       * vg = in_vars_root;
341
340
    struct adios_index_attribute_struct_v1 * ag = in_attrs_root;
342
 
    int i, start, count;
 
341
    int i;
343
342
 
344
343
    // process group offsets
345
344
    if (verbose) printf("Recalc offsets for new process groups\n");
351
350
    // variable characteristics offsets
352
351
    if (verbose) printf("Recalc offsets for new variable characteristics\n");
353
352
    while (vg) {
354
 
        start = 0;
355
 
        count = 0;
356
353
        for (i=0; i < vg->characteristics_count; i++) {
357
354
            vg->characteristics[i].offset += out_bp->pg_index_offset;
358
355
        }
362
359
    // attribute characteristics offsets
363
360
    if (verbose) printf("Recalc offsets for new attribute characteristics\n");
364
361
    while (ag) {
365
 
        start = 0;
366
 
        count = 0;
367
362
        for (i=0; i < ag->characteristics_count; i++) {
368
363
            ag->characteristics[i].offset += out_bp->pg_index_offset;
369
364
        }
414
409
        return 2;
415
410
    }
416
411
    if (bytes_written != buffer_offset) {
417
 
        fprintf(stderr, "  Error: could not write complete original index into output file: %llu bytes from %llu\n"
 
412
        fprintf(stderr, "  Error: could not write complete original index into output file: %zu bytes from %llu\n"
418
413
                "Index in output file will be damaged.\n",
419
414
                bytes_written, buffer_offset);
420
415
        return 2;
523
518
    if (verbose>1) printf("  write %llu 0x%llx bytes of indexes into %s\n", buffer_offset, buffer_offset, fileout);
524
519
    bytes_written = write (f, buffer, buffer_offset);
525
520
 
526
 
    if (verbose>1) printf("  written %llu 0x%llx bytes of indexes into %s\n", bytes_written, bytes_written, fileout);
 
521
    if (verbose>1) printf("  written %zu 0x%zx bytes of indexes into %s\n", bytes_written, bytes_written, fileout);
527
522
 
528
523
    // clean up
529
524
    free(buffer);
536
531
 
537
532
int bpappend(char *filein, char *fileout) {
538
533
    int excode = 0;
539
 
    uint32_t from, to;
540
 
    uint32_t maxtime = 1;   // at least there is time=1 (single group) in a bp file
541
 
    struct adios_bp_buffer_struct_v1 * b = 0;
542
 
 
543
534
    // open output file if exists, read and parse indexes 
544
535
    excode = read_indexes( fileout, false );
545
536
    if (excode == 128) {