Subversion Repositories gelsvn

Rev

Rev 371 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 371 Rev 595
Line 56... Line 56...
56
 *
56
 *
57
 * Returns handle to ply file if succesful, NULL otherwise.
57
 * Returns handle to ply file if succesful, NULL otherwise.
58
 * ---------------------------------------------------------------------- */
58
 * ---------------------------------------------------------------------- */
59
typedef struct t_ply_argument_ {
59
typedef struct t_ply_argument_ {
60
    p_ply_element element;
60
    p_ply_element element;
61
    long instance_index;
61
    int instance_index;
62
    p_ply_property property;
62
    p_ply_property property;
63
    long length, value_index;
63
    int length, value_index;
64
    double value;
64
    double value;
65
    void *pdata;
65
    void *pdata;
66
    long idata;
66
    int idata;
67
} t_ply_argument;
67
} t_ply_argument;
68
 
68
 
69
/* ----------------------------------------------------------------------
69
/* ----------------------------------------------------------------------
70
 * Property information
70
 * Property information
71
 *
71
 *
Line 79... Line 79...
79
typedef struct t_ply_property_ {
79
typedef struct t_ply_property_ {
80
    char name[WORDSIZE];
80
    char name[WORDSIZE];
81
    e_ply_type type, value_type, length_type;
81
    e_ply_type type, value_type, length_type;
82
    p_ply_read_cb read_cb;
82
    p_ply_read_cb read_cb;
83
    void *pdata;
83
    void *pdata;
84
    long idata;
84
    int idata;
85
} t_ply_property; 
85
} t_ply_property; 
86
 
86
 
87
/* ----------------------------------------------------------------------
87
/* ----------------------------------------------------------------------
88
 * Element information
88
 * Element information
89
 *
89
 *
Line 94... Line 94...
94
 *
94
 *
95
 * Returns 1 if should continue processing file, 0 if should abort.
95
 * Returns 1 if should continue processing file, 0 if should abort.
96
 * ---------------------------------------------------------------------- */
96
 * ---------------------------------------------------------------------- */
97
typedef struct t_ply_element_ {
97
typedef struct t_ply_element_ {
98
    char name[WORDSIZE];
98
    char name[WORDSIZE];
99
    long ninstances;
99
    int ninstances;
100
    p_ply_property property;
100
    p_ply_property property;
101
    long nproperties;
101
    int nproperties;
102
} t_ply_element;
102
} t_ply_element;
103
 
103
 
104
/* ----------------------------------------------------------------------
104
/* ----------------------------------------------------------------------
105
 * Input/output driver
105
 * Input/output driver
106
 *
106
 *
Line 152... Line 152...
152
 * ---------------------------------------------------------------------- */
152
 * ---------------------------------------------------------------------- */
153
typedef struct t_ply_ {
153
typedef struct t_ply_ {
154
    e_ply_io_mode io_mode;
154
    e_ply_io_mode io_mode;
155
    e_ply_storage_mode storage_mode;
155
    e_ply_storage_mode storage_mode;
156
    p_ply_element element;
156
    p_ply_element element;
157
    long nelements;
157
    int nelements;
158
    char *comment;
158
    char *comment;
159
    long ncomments;
159
    int ncomments;
160
    char *obj_info;
160
    char *obj_info;
161
    long nobj_infos;
161
    int nobj_infos;
162
    FILE *fp;
162
    FILE *fp;
163
    int c;
163
    int c;
164
    char buffer[BUFFERSIZE];
164
    char buffer[BUFFERSIZE];
165
    size_t buffer_first, buffer_token, buffer_last;
165
    size_t buffer_first, buffer_token, buffer_last;
166
    p_ply_idriver idriver;
166
    p_ply_idriver idriver;
167
    p_ply_odriver odriver;
167
    p_ply_odriver odriver;
168
    t_ply_argument argument;
168
    t_ply_argument argument;
169
    long welement, wproperty;
169
    int welement, wproperty;
170
    long winstance_index, wvalue_index, wlength;
170
    int winstance_index, wvalue_index, wlength;
171
    p_ply_error_cb error_cb;
171
    p_ply_error_cb error_cb;
172
} t_ply;
172
} t_ply;
173
 
173
 
174
/* ----------------------------------------------------------------------
174
/* ----------------------------------------------------------------------
175
 * I/O functions and drivers
175
 * I/O functions and drivers
Line 221... Line 221...
221
static void ply_element_init(p_ply_element element);
221
static void ply_element_init(p_ply_element element);
222
static void ply_property_init(p_ply_property property);
222
static void ply_property_init(p_ply_property property);
223
static p_ply ply_alloc(void);
223
static p_ply ply_alloc(void);
224
static p_ply_element ply_grow_element(p_ply ply);
224
static p_ply_element ply_grow_element(p_ply ply);
225
static p_ply_property ply_grow_property(p_ply ply, p_ply_element element);
225
static p_ply_property ply_grow_property(p_ply ply, p_ply_element element);
226
static void *ply_grow_array(p_ply ply, void **pointer, long *nmemb, long size);
226
static void *ply_grow_array(p_ply ply, void **pointer, int *nmemb, int size);
227
 
227
 
228
/* ----------------------------------------------------------------------
228
/* ----------------------------------------------------------------------
229
 * Special functions
229
 * Special functions
230
 * ---------------------------------------------------------------------- */
230
 * ---------------------------------------------------------------------- */
231
static e_ply_storage_mode ply_arch_endian(void);
231
static e_ply_storage_mode ply_arch_endian(void);
Line 339... Line 339...
339
        }
339
        }
340
    }
340
    }
341
    return 1;
341
    return 1;
342
}
342
}
343
 
343
 
344
long ply_set_read_cb(p_ply ply, const char *element_name, 
344
int ply_set_read_cb(p_ply ply, const char *element_name, 
345
        const char* property_name, p_ply_read_cb read_cb, 
345
        const char* property_name, p_ply_read_cb read_cb, 
346
        void *pdata, long idata) {
346
        void *pdata, int idata) {
347
    p_ply_element element = NULL; 
347
    p_ply_element element = NULL; 
348
    p_ply_property property = NULL;
348
    p_ply_property property = NULL;
349
    assert(ply && element_name && property_name);
349
    assert(ply && element_name && property_name);
350
    element = ply_find_element(ply, element_name);
350
    element = ply_find_element(ply, element_name);
351
    if (!element) return 0;
351
    if (!element) return 0;
Line 356... Line 356...
356
    property->idata = idata;
356
    property->idata = idata;
357
    return (int) element->ninstances;
357
    return (int) element->ninstances;
358
}
358
}
359
 
359
 
360
int ply_read(p_ply ply) {
360
int ply_read(p_ply ply) {
361
    long i;
361
    int i;
362
    p_ply_argument argument;
362
    p_ply_argument argument;
363
    assert(ply && ply->fp && ply->io_mode == PLY_READ);
363
    assert(ply && ply->fp && ply->io_mode == PLY_READ);
364
    argument = &ply->argument;
364
    argument = &ply->argument;
365
    /* for each element type */
365
    /* for each element type */
366
    for (i = 0; i < ply->nelements; i++) {
366
    for (i = 0; i < ply->nelements; i++) {
Line 406... Line 406...
406
    ply->fp = fp;
406
    ply->fp = fp;
407
    ply->error_cb = error_cb;
407
    ply->error_cb = error_cb;
408
    return ply;
408
    return ply;
409
}
409
}
410
 
410
 
411
int ply_add_element(p_ply ply, const char *name, long ninstances) {
411
int ply_add_element(p_ply ply, const char *name, int ninstances) {
412
    p_ply_element element = NULL;
412
    p_ply_element element = NULL;
413
    assert(ply && ply->fp && ply->io_mode == PLY_WRITE);
413
    assert(ply && ply->fp && ply->io_mode == PLY_WRITE);
414
    assert(name && strlen(name) < WORDSIZE && ninstances >= 0);
414
    assert(name && strlen(name) < WORDSIZE && ninstances >= 0);
415
    if (strlen(name) >= WORDSIZE || ninstances < 0) {
415
    if (strlen(name) >= WORDSIZE || ninstances < 0) {
416
        ply_error(ply, "Invalid arguments");
416
        ply_error(ply, "Invalid arguments");
Line 502... Line 502...
502
    strcpy(new_obj_info, obj_info);
502
    strcpy(new_obj_info, obj_info);
503
    return 1;
503
    return 1;
504
}
504
}
505
 
505
 
506
int ply_write_header(p_ply ply) {
506
int ply_write_header(p_ply ply) {
507
    long i, j;
507
    int i, j;
508
    assert(ply && ply->fp && ply->io_mode == PLY_WRITE);
508
    assert(ply && ply->fp && ply->io_mode == PLY_WRITE);
509
    assert(ply->element || ply->nelements == 0); 
509
    assert(ply->element || ply->nelements == 0); 
510
    assert(!ply->element || ply->nelements > 0); 
510
    assert(!ply->element || ply->nelements > 0); 
511
    if (fprintf(ply->fp, "ply\nformat %s 1.0\n", 
511
    if (fprintf(ply->fp, "ply\nformat %s 1.0\n", 
512
                ply_storage_mode_list[ply->storage_mode]) <= 0) goto error;
512
                ply_storage_mode_list[ply->storage_mode]) <= 0) goto error;
Line 552... Line 552...
552
    if (ply->wproperty > element->nproperties) return 0;
552
    if (ply->wproperty > element->nproperties) return 0;
553
    property = &element->property[ply->wproperty];
553
    property = &element->property[ply->wproperty];
554
    if (property->type == PLY_LIST) {
554
    if (property->type == PLY_LIST) {
555
        if (ply->wvalue_index == 0) {
555
        if (ply->wvalue_index == 0) {
556
            type = property->length_type;
556
            type = property->length_type;
557
            ply->wlength = (long) value;
557
            ply->wlength = (int) value;
558
        } else type = property->value_type;
558
        } else type = property->value_type;
559
    } else {
559
    } else {
560
        type = property->type;
560
        type = property->type;
561
        ply->wlength = 0;
561
        ply->wlength = 0;
562
    }
562
    }
Line 583... Line 583...
583
    }
583
    }
584
    return !breakafter || putc('\n', ply->fp) > 0;
584
    return !breakafter || putc('\n', ply->fp) > 0;
585
}
585
}
586
 
586
 
587
int ply_close(p_ply ply) {
587
int ply_close(p_ply ply) {
588
    long i;
588
    int i;
589
    assert(ply && ply->fp);
589
    assert(ply && ply->fp);
590
    assert(ply->element || ply->nelements == 0);
590
    assert(ply->element || ply->nelements == 0);
591
    assert(!ply->element || ply->nelements > 0);
591
    assert(!ply->element || ply->nelements > 0);
592
    /* write last chunk to file */
592
    /* write last chunk to file */
593
    if (ply->io_mode == PLY_WRITE && 
593
    if (ply->io_mode == PLY_WRITE && 
Line 621... Line 621...
621
    if (last < ply->element + ply->nelements) return last;
621
    if (last < ply->element + ply->nelements) return last;
622
    else return NULL;
622
    else return NULL;
623
}
623
}
624
 
624
 
625
int ply_get_element_info(p_ply_element element, const char** name,
625
int ply_get_element_info(p_ply_element element, const char** name,
626
        long *ninstances) {
626
        int *ninstances) {
627
    assert(element);
627
    assert(element);
628
    if (name) *name = element->name;
628
    if (name) *name = element->name;
629
    if (ninstances) *ninstances = (long) element->ninstances;
629
    if (ninstances) *ninstances = (int) element->ninstances;
630
    return 1;
630
    return 1;
631
}
631
}
632
 
632
 
633
p_ply_property ply_get_next_property(p_ply_element element, 
633
p_ply_property ply_get_next_property(p_ply_element element, 
634
        p_ply_property last) {
634
        p_ply_property last) {
Line 668... Line 668...
668
 
668
 
669
/* ----------------------------------------------------------------------
669
/* ----------------------------------------------------------------------
670
 * Callback argument support functions 
670
 * Callback argument support functions 
671
 * ---------------------------------------------------------------------- */
671
 * ---------------------------------------------------------------------- */
672
int ply_get_argument_element(p_ply_argument argument, 
672
int ply_get_argument_element(p_ply_argument argument, 
673
        p_ply_element *element, long *instance_index) {
673
        p_ply_element *element, int *instance_index) {
674
    assert(argument);
674
    assert(argument);
675
    if (!argument) return 0;
675
    if (!argument) return 0;
676
    if (element) *element = argument->element;
676
    if (element) *element = argument->element;
677
    if (instance_index) *instance_index = argument->instance_index;
677
    if (instance_index) *instance_index = argument->instance_index;
678
    return 1;
678
    return 1;
679
}
679
}
680
 
680
 
681
int ply_get_argument_property(p_ply_argument argument, 
681
int ply_get_argument_property(p_ply_argument argument, 
682
        p_ply_property *property, long *length, long *value_index) {
682
        p_ply_property *property, int *length, int *value_index) {
683
    assert(argument);
683
    assert(argument);
684
    if (!argument) return 0;
684
    if (!argument) return 0;
685
    if (property) *property = argument->property;
685
    if (property) *property = argument->property;
686
    if (length) *length = argument->length;
686
    if (length) *length = argument->length;
687
    if (value_index) *value_index = argument->value_index;
687
    if (value_index) *value_index = argument->value_index;
688
    return 1;
688
    return 1;
689
}
689
}
690
 
690
 
691
int ply_get_argument_user_data(p_ply_argument argument, void **pdata, 
691
int ply_get_argument_user_data(p_ply_argument argument, void **pdata, 
692
        long *idata) {
692
        int *idata) {
693
    assert(argument);
693
    assert(argument);
694
    if (!argument) return 0;
694
    if (!argument) return 0;
695
    if (pdata) *pdata = argument->pdata;
695
    if (pdata) *pdata = argument->pdata;
696
    if (idata) *idata = argument->idata;
696
    if (idata) *idata = argument->idata;
697
    return 1;
697
    return 1;
Line 718... Line 718...
718
        ply_error(ply, "Error reading '%s' of '%s' number %d",
718
        ply_error(ply, "Error reading '%s' of '%s' number %d",
719
                property->name, element->name, argument->instance_index);
719
                property->name, element->name, argument->instance_index);
720
        return 0;
720
        return 0;
721
    }
721
    }
722
    /* invoke callback to pass length in value field */
722
    /* invoke callback to pass length in value field */
723
    argument->length = (long) length;
723
    argument->length = (int) length;
724
    argument->value_index = -1;
724
    argument->value_index = -1;
725
    argument->value = length;
725
    argument->value = length;
726
    if (read_cb && !read_cb(argument)) {
726
    if (read_cb && !read_cb(argument)) {
727
        ply_error(ply, "Aborted by user");
727
        ply_error(ply, "Aborted by user");
728
        return 0;
728
        return 0;
729
    }
729
    }
730
    /* read list values */
730
    /* read list values */
731
    handler = driver[property->value_type];
731
    handler = driver[property->value_type];
732
    /* for each value in list */
732
    /* for each value in list */
733
    for (l = 0; l < (long) length; l++) {
733
    for (l = 0; l < (int) length; l++) {
734
        /* read value from file */
734
        /* read value from file */
735
        argument->value_index = l;
735
        argument->value_index = l;
736
        if (!handler(ply, &argument->value)) {
736
        if (!handler(ply, &argument->value)) {
737
            ply_error(ply, "Error reading value number %d of '%s' of "
737
            ply_error(ply, "Error reading value number %d of '%s' of "
738
                    "'%s' number %d", l+1, property->name, 
738
                    "'%s' number %d", l+1, property->name, 
Line 775... Line 775...
775
        return ply_read_scalar_property(ply, element, property, argument);
775
        return ply_read_scalar_property(ply, element, property, argument);
776
}
776
}
777
 
777
 
778
static int ply_read_element(p_ply ply, p_ply_element element, 
778
static int ply_read_element(p_ply ply, p_ply_element element, 
779
        p_ply_argument argument) {
779
        p_ply_argument argument) {
780
    long j, k;
780
    int j, k;
781
    /* for each element of this type */
781
    /* for each element of this type */
782
    for (j = 0; j < element->ninstances; j++) {
782
    for (j = 0; j < element->ninstances; j++) {
783
        argument->instance_index = j;
783
        argument->instance_index = j;
784
        /* for each property */
784
        /* for each property */
785
        for (k = 0; k < element->nproperties; k++) {
785
        for (k = 0; k < element->nproperties; k++) {
Line 829... Line 829...
829
    return NULL;
829
    return NULL;
830
}
830
}
831
 
831
 
832
static int ply_check_word(p_ply ply) {
832
static int ply_check_word(p_ply ply) {
833
    if (strlen(BLINE(ply)) >= WORDSIZE) {
833
    if (strlen(BLINE(ply)) >= WORDSIZE) {
834
        ply_error(ply, "Word too long");
834
        ply_error(ply, "Word too int");
835
        return 0;
835
        return 0;
836
    }
836
    }
837
    return 1;
837
    return 1;
838
}
838
}
839
 
839
 
Line 882... Line 882...
882
    return ply_check_word(ply);
882
    return ply_check_word(ply);
883
}
883
}
884
 
884
 
885
static int ply_check_line(p_ply ply) {
885
static int ply_check_line(p_ply ply) {
886
    if (strlen(BLINE(ply)) >= LINESIZE) {
886
    if (strlen(BLINE(ply)) >= LINESIZE) {
887
        ply_error(ply, "Line too long");
887
        ply_error(ply, "Line too int");
888
        return 0;
888
        return 0;
889
    }
889
    }
890
    return 1;
890
    return 1;
891
}
891
}
892
 
892
 
Line 1030... Line 1030...
1030
    ply_init(ply);
1030
    ply_init(ply);
1031
    return ply;
1031
    return ply;
1032
}
1032
}
1033
 
1033
 
1034
static void *ply_grow_array(p_ply ply, void **pointer, 
1034
static void *ply_grow_array(p_ply ply, void **pointer, 
1035
        long *nmemb, long size) {
1035
        int *nmemb, int size) {
1036
    void *temp = *pointer;
1036
    void *temp = *pointer;
1037
    long count = *nmemb + 1;
1037
    int count = *nmemb + 1;
1038
    if (!temp) temp = malloc(count*size);
1038
    if (!temp) temp = malloc(count*size);
1039
    else temp = realloc(temp, count*size);
1039
    else temp = realloc(temp, count*size);
1040
    if (!temp) {
1040
    if (!temp) {
1041
        ply_error(ply, "Out of memory");
1041
        ply_error(ply, "Out of memory");
1042
        return NULL;
1042
        return NULL;
Line 1134... Line 1134...
1134
    return 1;
1134
    return 1;
1135
}
1135
}
1136
 
1136
 
1137
static int ply_read_header_element(p_ply ply) {
1137
static int ply_read_header_element(p_ply ply) {
1138
    p_ply_element element = NULL;
1138
    p_ply_element element = NULL;
1139
    long dummy;
1139
    int dummy;
1140
    assert(ply && ply->fp && ply->io_mode == PLY_READ);
1140
    assert(ply && ply->fp && ply->io_mode == PLY_READ);
1141
    if (strcmp(BWORD(ply), "element")) return 0;
1141
    if (strcmp(BWORD(ply), "element")) return 0;
1142
    /* allocate room for new element */
1142
    /* allocate room for new element */
1143
    element = ply_grow_element(ply);
1143
    element = ply_grow_element(ply);
1144
    if (!element) return 0;
1144
    if (!element) return 0;
1145
    /* get element name */
1145
    /* get element name */
1146
    if (!ply_read_word(ply)) return 0;
1146
    if (!ply_read_word(ply)) return 0;
1147
    strcpy(element->name, BWORD(ply));
1147
    strcpy(element->name, BWORD(ply));
1148
    /* get number of elements of this type */
1148
    /* get number of elements of this type */
1149
    if (!ply_read_word(ply)) return 0;
1149
    if (!ply_read_word(ply)) return 0;
1150
    if (sscanf(BWORD(ply), "%ld", &dummy) != 1) {
1150
    if (sscanf(BWORD(ply), "%d", &dummy) != 1) {
1151
        ply_error(ply, "Expected number got '%s'", BWORD(ply));
1151
        ply_error(ply, "Expected number got '%s'", BWORD(ply));
1152
        return 0;
1152
        return 0;
1153
    }
1153
    }
1154
    element->ninstances = dummy;
1154
    element->ninstances = dummy;
1155
    /* get all properties for this element */
1155
    /* get all properties for this element */
Line 1172... Line 1172...
1172
    va_end(ap);
1172
    va_end(ap);
1173
    ply->error_cb(buffer);
1173
    ply->error_cb(buffer);
1174
}
1174
}
1175
 
1175
 
1176
static e_ply_storage_mode ply_arch_endian(void) {
1176
static e_ply_storage_mode ply_arch_endian(void) {
1177
    unsigned long i = 1;
1177
    unsigned int i = 1;
1178
    unsigned char *s = (unsigned char *) &i;
1178
    unsigned char *s = (unsigned char *) &i;
1179
    if (*s == 1) return PLY_LITTLE_ENDIAN;
1179
    if (*s == 1) return PLY_LITTLE_ENDIAN;
1180
    else return PLY_BIG_ENDIAN;
1180
    else return PLY_BIG_ENDIAN;
1181
}
1181
}
1182
 
1182
 
1183
static int ply_type_check(void) {
1183
static int ply_type_check(void) {
1184
    assert(sizeof(char) == 1);
1184
    assert(sizeof(char) == 1);
1185
    assert(sizeof(unsigned char) == 1);
1185
    assert(sizeof(unsigned char) == 1);
1186
    assert(sizeof(short) == 2);
1186
    assert(sizeof(short) == 2);
1187
    assert(sizeof(unsigned short) == 2);
1187
    assert(sizeof(unsigned short) == 2);
1188
    assert(sizeof(long) == 4);
1188
    assert(sizeof(int) == 4);
1189
    assert(sizeof(unsigned long) == 4);
1189
    assert(sizeof(unsigned int) == 4);
1190
    assert(sizeof(float) == 4);
1190
    assert(sizeof(float) == 4);
1191
    assert(sizeof(double) == 8);
1191
    assert(sizeof(double) == 8);
1192
    if (sizeof(char) != 1) return 0;
1192
    if (sizeof(char) != 1) return 0;
1193
    if (sizeof(unsigned char) != 1) return 0;
1193
    if (sizeof(unsigned char) != 1) return 0;
1194
    if (sizeof(short) != 2) return 0;
1194
    if (sizeof(short) != 2) return 0;
1195
    if (sizeof(unsigned short) != 2) return 0;
1195
    if (sizeof(unsigned short) != 2) return 0;
1196
    if (sizeof(long) != 4) return 0;
1196
    if (sizeof(int) != 4) return 0;
1197
    if (sizeof(unsigned long) != 4) return 0;
1197
    if (sizeof(unsigned int) != 4) return 0;
1198
    if (sizeof(float) != 4) return 0;
1198
    if (sizeof(float) != 4) return 0;
1199
    if (sizeof(double) != 8) return 0;
1199
    if (sizeof(double) != 8) return 0;
1200
    return 1;
1200
    return 1;
1201
}
1201
}
1202
 
1202
 
Line 1266... Line 1266...
1266
    if (value > USHRT_MAX || value < 0) return 0;
1266
    if (value > USHRT_MAX || value < 0) return 0;
1267
    return ply->odriver->ochunk(ply, &uint16, sizeof(uint16)); 
1267
    return ply->odriver->ochunk(ply, &uint16, sizeof(uint16)); 
1268
}
1268
}
1269
 
1269
 
1270
static int obinary_int32(p_ply ply, double value) {
1270
static int obinary_int32(p_ply ply, double value) {
1271
    long int32 = (long) value;
1271
    int int32 = (int) value;
1272
    if (value > LONG_MAX || value < LONG_MIN) return 0;
1272
    if (value > LONG_MAX || value < LONG_MIN) return 0;
1273
    return ply->odriver->ochunk(ply, &int32, sizeof(int32));
1273
    return ply->odriver->ochunk(ply, &int32, sizeof(int32));
1274
}
1274
}
1275
 
1275
 
1276
static int obinary_uint32(p_ply ply, double value) {
1276
static int obinary_uint32(p_ply ply, double value) {
1277
    unsigned long uint32 = (unsigned long) value;
1277
    unsigned int uint32 = (unsigned int) value;
1278
    if (value > ULONG_MAX || value < 0) return 0;
1278
    if (value > ULONG_MAX || value < 0) return 0;
1279
    return ply->odriver->ochunk(ply, &uint32, sizeof(uint32));
1279
    return ply->odriver->ochunk(ply, &uint32, sizeof(uint32));
1280
}
1280
}
1281
 
1281
 
1282
static int obinary_float32(p_ply ply, double value) {
1282
static int obinary_float32(p_ply ply, double value) {
Line 1383... Line 1383...
1383
    *value = uint16;
1383
    *value = uint16;
1384
    return 1;
1384
    return 1;
1385
}
1385
}
1386
 
1386
 
1387
static int ibinary_int32(p_ply ply, double *value) {
1387
static int ibinary_int32(p_ply ply, double *value) {
1388
    long int32;
1388
    int int32;
1389
    if (!ply->idriver->ichunk(ply, &int32, sizeof(int32))) return 0;
1389
    if (!ply->idriver->ichunk(ply, &int32, sizeof(int32))) return 0;
1390
    *value = int32;
1390
    *value = int32;
1391
    return 1;
1391
    return 1;
1392
}
1392
}
1393
 
1393
 
1394
static int ibinary_uint32(p_ply ply, double *value) {
1394
static int ibinary_uint32(p_ply ply, double *value) {
1395
    unsigned long uint32;
1395
    unsigned int uint32;
1396
    if (!ply->idriver->ichunk(ply, &uint32, sizeof(uint32))) return 0;
1396
    if (!ply->idriver->ichunk(ply, &uint32, sizeof(uint32))) return 0;
1397
    *value = uint32;
1397
    *value = uint32;
1398
    return 1;
1398
    return 1;
1399
}
1399
}
1400
 
1400