Text archives Help
- From: thiago@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r323 - trunk/Model/Readers/rply
- Date: Sun, 15 May 2005 01:11:07 -0600 (MDT)
Author: thiago
Date: Sun May 15 01:11:07 2005
New Revision: 323
Modified:
trunk/Model/Readers/rply/rply.c
trunk/Model/Readers/rply/rply.h
Log:
Took out all the writing code (made code smaller/simpler) and made it work on
fisher (type assumptions weren't needed).
Modified: trunk/Model/Readers/rply/rply.c
==============================================================================
--- trunk/Model/Readers/rply/rply.c (original)
+++ trunk/Model/Readers/rply/rply.c Sun May 15 01:11:07 2005
@@ -1,5 +1,7 @@
+//this has been modified to only read files.
+
/* ----------------------------------------------------------------------
- * RPly library, read/write PLY files
+ * RPly library, read PLY files
* Diego Nehab, Princeton University
*
http://www.cs.princeton.edu/~diego/professional/rply
*
@@ -25,11 +27,6 @@
#define LINESIZE 1024
#define BUFFERSIZE (8*1024)
-typedef enum e_ply_io_mode_ {
- PLY_READ,
- PLY_WRITE
-} e_ply_io_mode;
-
static const char *const ply_storage_mode_list[] = {
"binary_big_endian", "binary_little_endian", "ascii", NULL
}; /* order matches e_ply_storage_mode enum */
@@ -108,10 +105,10 @@
}
/* ----------------------------------------------------------------------
- * Input/output driver
+ * Input
*
- * Depending on file mode, different functions are used to read/write
- * property fields. The drivers make it transparent to read/write in ascii,
+ * Depending on file mode, different functions are used to read
+ * property fields. The drivers make it transparent to read in ascii,
* big endian or little endian cases.
* ---------------------------------------------------------------------- */
typedef int (*p_ply_ihandler)(p_ply ply, double *value);
@@ -123,19 +120,9 @@
} t_ply_idriver;
typedef t_ply_idriver *p_ply_idriver;
-typedef int (*p_ply_ohandler)(p_ply ply, double value);
-typedef int (*p_ply_ochunk)(p_ply ply, void *anydata, size_t size);
-typedef struct t_ply_odriver_ {
- p_ply_ohandler ohandler[16];
- p_ply_ochunk ochunk;
- const char *name;
-} t_ply_odriver;
-typedef t_ply_odriver *p_ply_odriver;
-
/* ----------------------------------------------------------------------
* Ply file handle.
*
- * io_mode: read or write (from e_ply_io_mode)
* storage_mode: mode of file associated with handle (from
e_ply_storage_mode)
* element: elements description for this file
* nelement: number of different elements in file
@@ -148,16 +135,11 @@
* buffer: last word/chunck of data read from ply file
* buffer_first, buffer_last: interval of untouched good data in buffer
* buffer_token: start of parsed token (line or word) in buffer
- * idriver, odriver: input driver used to get property fields from file
+ * idriver: input driver used to get property fields from file
* argument: storage space for callback arguments
- * welement, wproperty: element/property type being written
- * winstance_index: index of instance of current element being written
- * wvalue_index: index of list property value being written
- * wlength: number of values in list property being written
* error_cb: callback for error messages
* ---------------------------------------------------------------------- */
typedef struct t_ply_ {
- e_ply_io_mode io_mode;
e_ply_storage_mode storage_mode;
p_ply_element element;
long nelements;
@@ -170,10 +152,7 @@
char buffer[BUFFERSIZE];
size_t buffer_first, buffer_token, buffer_last;
p_ply_idriver idriver;
- p_ply_odriver odriver;
t_ply_argument argument;
- long welement, wproperty;
- long winstance_index, wvalue_index, wlength;
p_ply_error_cb error_cb;
} t_ply;
@@ -183,9 +162,6 @@
static t_ply_idriver ply_idriver_ascii;
static t_ply_idriver ply_idriver_binary;
static t_ply_idriver ply_idriver_binary_reverse;
-static t_ply_odriver ply_odriver_ascii;
-static t_ply_odriver ply_odriver_binary;
-static t_ply_odriver ply_odriver_binary_reverse;
static int ply_read_word(p_ply ply);
static int ply_check_word(p_ply ply);
@@ -193,8 +169,6 @@
static int ply_check_line(p_ply ply);
static int ply_read_chunk(p_ply ply, void *anybuffer, size_t size);
static int ply_read_chunk_reverse(p_ply ply, void *anybuffer, size_t size);
-static int ply_write_chunk(p_ply ply, void *anybuffer, size_t size);
-static int ply_write_chunk_reverse(p_ply ply, void *anybuffer, size_t size);
static void ply_reverse(void *anydata, size_t size);
/* ----------------------------------------------------------------------
@@ -202,7 +176,7 @@
* ---------------------------------------------------------------------- */
static int ply_find_string(const char *item, const char* const list[]);
p_ply_element ply_find_element(p_ply ply, const char *name);
-static p_ply_property ply_find_property(p_ply_element element,
+ p_ply_property ply_find_property(p_ply_element element,
const char *name);
/* ----------------------------------------------------------------------
@@ -322,13 +296,12 @@
return NULL;
}
ply->fp = fp;
- ply->io_mode = PLY_READ;
ply->error_cb = error_cb;
return ply;
}
int ply_read_header(p_ply ply) {
- assert(ply && ply->fp && ply->io_mode == PLY_READ);
+ assert(ply && ply->fp);
if (!ply_read_word(ply)) return 0;
/* parse file format */
if (!ply_read_header_format(ply)) {
@@ -366,7 +339,7 @@
int ply_read(p_ply ply) {
long i;
p_ply_argument argument;
- assert(ply && ply->fp && ply->io_mode == PLY_READ);
+ assert(ply && ply->fp);
argument = &ply->argument;
/* for each element type */
for (i = 0; i < ply->nelements; i++) {
@@ -378,109 +351,6 @@
return 1;
}
-/* ----------------------------------------------------------------------
- * Write support functions
- * ---------------------------------------------------------------------- */
-p_ply ply_create(const char *name, e_ply_storage_mode storage_mode,
- p_ply_error_cb error_cb) {
- FILE *fp = NULL;
- p_ply ply = NULL;
- if (error_cb == NULL) error_cb = ply_error_cb;
- if (!ply_type_check()) {
- error_cb("Incompatible type system");
- return NULL;
- }
- assert(name && storage_mode <= PLY_DEFAULT);
- fp = fopen(name, "wb");
- if (!fp) {
- error_cb("Unable to create file");
- return NULL;
- }
- ply = ply_alloc();
- if (!ply) {
- fclose(fp);
- error_cb("Out of memory");
- return NULL;
- }
- ply->io_mode = PLY_WRITE;
- if (storage_mode == PLY_DEFAULT) storage_mode = ply_arch_endian();
- if (storage_mode == PLY_ASCII) ply->odriver = &ply_odriver_ascii;
- else if (storage_mode == ply_arch_endian())
- ply->odriver = &ply_odriver_binary;
- else ply->odriver = &ply_odriver_binary_reverse;
- ply->storage_mode = storage_mode;
- ply->fp = fp;
- ply->error_cb = error_cb;
- return ply;
-}
-
-int ply_add_element(p_ply ply, const char *name, long ninstances) {
- p_ply_element element = NULL;
- assert(ply && ply->fp && ply->io_mode == PLY_WRITE);
- assert(name && strlen(name) < WORDSIZE && ninstances >= 0);
- if (strlen(name) >= WORDSIZE || ninstances < 0) {
- ply_error(ply, "Invalid arguments");
- return 0;
- }
- element = ply_grow_element(ply);
- if (!element) return 0;
- strcpy(element->name, name);
- element->ninstances = ninstances;
- return 1;
-}
-
-int ply_add_scalar_property(p_ply ply, const char *name, e_ply_type type) {
- p_ply_element element = NULL;
- p_ply_property property = NULL;
- assert(ply && ply->fp && ply->io_mode == PLY_WRITE);
- assert(name && strlen(name) < WORDSIZE);
- assert(type < PLY_LIST);
- if (strlen(name) >= WORDSIZE || type >= PLY_LIST) {
- ply_error(ply, "Invalid arguments");
- return 0;
- }
- element = &ply->element[ply->nelements-1];
- property = ply_grow_property(ply, element);
- if (!property) return 0;
- strcpy(property->name, name);
- property->type = type;
- return 1;
-}
-
-int ply_add_list_property(p_ply ply, const char *name,
- e_ply_type length_type, e_ply_type value_type) {
- p_ply_element element = NULL;
- p_ply_property property = NULL;
- assert(ply && ply->fp && ply->io_mode == PLY_WRITE);
- assert(name && strlen(name) < WORDSIZE);
- if (strlen(name) >= WORDSIZE) {
- ply_error(ply, "Invalid arguments");
- return 0;
- }
- assert(length_type < PLY_LIST);
- assert(value_type < PLY_LIST);
- if (length_type >= PLY_LIST || value_type >= PLY_LIST) {
- ply_error(ply, "Invalid arguments");
- return 0;
- }
- element = &ply->element[ply->nelements-1];
- property = ply_grow_property(ply, element);
- if (!property) return 0;
- strcpy(property->name, name);
- property->type = PLY_LIST;
- property->length_type = length_type;
- property->value_type = value_type;
- return 1;
-}
-
-int ply_add_property(p_ply ply, const char *name, e_ply_type type,
- e_ply_type length_type, e_ply_type value_type) {
- if (type == PLY_LIST)
- return ply_add_list_property(ply, name, length_type, value_type);
- else
- return ply_add_scalar_property(ply, name, type);
-}
-
int ply_add_comment(p_ply ply, const char *comment) {
char *new_comment = NULL;
assert(ply && comment && strlen(comment) < LINESIZE);
@@ -509,98 +379,11 @@
return 1;
}
-int ply_write_header(p_ply ply) {
- long i, j;
- assert(ply && ply->fp && ply->io_mode == PLY_WRITE);
- assert(ply->element || ply->nelements == 0);
- assert(!ply->element || ply->nelements > 0);
- if (fprintf(ply->fp, "ply\nformat %s 1.0\n",
- ply_storage_mode_list[ply->storage_mode]) <= 0) goto error;
- for (i = 0; i < ply->ncomments; i++)
- if (fprintf(ply->fp, "comment %s\n", ply->comment + LINESIZE*i) <= 0)
- goto error;
- for (i = 0; i < ply->nobj_infos; i++)
- if (fprintf(ply->fp, "obj_info %s\n", ply->obj_info + LINESIZE*i) <=
0)
- goto error;
- for (i = 0; i < ply->nelements; i++) {
- p_ply_element element = &ply->element[i];
- assert(element->property || element->nproperties == 0);
- assert(!element->property || element->nproperties > 0);
- if (fprintf(ply->fp, "element %s %ld\n", element->name,
- element->ninstances) <= 0) goto error;
- for (j = 0; j < element->nproperties; j++) {
- p_ply_property property = &element->property[j];
- if (property->type == PLY_LIST) {
- if (fprintf(ply->fp, "property list %s %s %s\n",
- ply_type_list[property->length_type],
- ply_type_list[property->value_type],
- property->name) <= 0) goto error;
- } else {
- if (fprintf(ply->fp, "property %s %s\n",
- ply_type_list[property->type],
- property->name) <= 0) goto error;
- }
- }
- }
- return fprintf(ply->fp, "end_header\n") > 0;
-error:
- ply_error(ply, "Error writing to file");
- return 0;
-}
-
-int ply_write(p_ply ply, double value) {
- p_ply_element element = NULL;
- p_ply_property property = NULL;
- int type = -1;
- int breakafter = 0;
- if (ply->welement > ply->nelements) return 0;
- element = &ply->element[ply->welement];
- if (ply->wproperty > element->nproperties) return 0;
- property = &element->property[ply->wproperty];
- if (property->type == PLY_LIST) {
- if (ply->wvalue_index == 0) {
- type = property->length_type;
- ply->wlength = (long) value;
- } else type = property->value_type;
- } else {
- type = property->type;
- ply->wlength = 0;
- }
- if (!ply->odriver->ohandler[type](ply, value)) {
- ply_error(ply, "Failed writing %s of %s %d (%s: %s)",
- property->name, element->name,
- ply->winstance_index,
- ply->odriver->name, ply_type_list[type]);
- return 0;
- }
- ply->wvalue_index++;
- if (ply->wvalue_index > ply->wlength) {
- ply->wvalue_index = 0;
- ply->wproperty++;
- }
- if (ply->wproperty >= element->nproperties) {
- ply->wproperty = 0;
- ply->winstance_index++;
- if (ply->storage_mode == PLY_ASCII) breakafter = 1;
- }
- if (ply->winstance_index >= element->ninstances) {
- ply->winstance_index = 0;
- ply->welement++;
- }
- return !breakafter || putc('\n', ply->fp) > 0;
-}
-
int ply_close(p_ply ply) {
long i;
assert(ply && ply->fp);
assert(ply->element || ply->nelements == 0);
assert(!ply->element || ply->nelements > 0);
- /* write last chunk to file */
- if (ply->io_mode == PLY_WRITE &&
- fwrite(ply->buffer, 1, ply->buffer_last, ply->fp) < ply->buffer_last) {
- ply_error(ply, "Error closing up");
- return 0;
- }
fclose(ply->fp);
/* free all memory used by handle */
if (ply->element) {
@@ -821,7 +604,7 @@
return NULL;
}
-static p_ply_property ply_find_property(p_ply_element element,
+p_ply_property ply_find_property(p_ply_element element,
const char *name) {
p_ply_property property;
int i, nproperties;
@@ -845,7 +628,7 @@
static int ply_read_word(p_ply ply) {
size_t t = 0;
- assert(ply && ply->fp && ply->io_mode == PLY_READ);
+ assert(ply && ply->fp);
/* skip leading blanks */
while (1) {
t = strspn(BFIRST(ply), " \n\r\t");
@@ -898,7 +681,7 @@
static int ply_read_line(p_ply ply) {
const char *end = NULL;
- assert(ply && ply->fp && ply->io_mode == PLY_READ);
+ assert(ply && ply->fp);
/* look for a end of line */
end = strchr(BFIRST(ply), '\n');
/* if we didn't reach the end of the buffer, we are done */
@@ -934,7 +717,7 @@
static int ply_read_chunk(p_ply ply, void *anybuffer, size_t size) {
char *buffer = (char *) anybuffer;
size_t i = 0;
- assert(ply && ply->fp && ply->io_mode == PLY_READ);
+ assert(ply && ply->fp);
assert(ply->buffer_first <= ply->buffer_last);
while (i < size) {
if (ply->buffer_first < ply->buffer_last) {
@@ -950,33 +733,6 @@
return 1;
}
-static int ply_write_chunk(p_ply ply, void *anybuffer, size_t size) {
- char *buffer = (char *) anybuffer;
- size_t i = 0;
- assert(ply && ply->fp && ply->io_mode == PLY_WRITE);
- assert(ply->buffer_last <= BUFFERSIZE);
- while (i < size) {
- if (ply->buffer_last < BUFFERSIZE) {
- ply->buffer[ply->buffer_last] = buffer[i];
- ply->buffer_last++;
- i++;
- } else {
- ply->buffer_last = 0;
- if (fwrite(ply->buffer, 1, BUFFERSIZE, ply->fp) < BUFFERSIZE)
- return 0;
- }
- }
- return 1;
-}
-
-static int ply_write_chunk_reverse(p_ply ply, void *anybuffer, size_t size) {
- int ret = 0;
- ply_reverse(anybuffer, size);
- ret = ply_write_chunk(ply, anybuffer, size);
- ply_reverse(anybuffer, size);
- return ret;
-}
-
static int ply_read_chunk_reverse(p_ply ply, void *anybuffer, size_t size) {
if (!ply_read_chunk(ply, anybuffer, size)) return 0;
ply_reverse(anybuffer, size);
@@ -1003,14 +759,8 @@
ply->obj_info = NULL;
ply->nobj_infos = 0;
ply->idriver = NULL;
- ply->odriver = NULL;
ply->buffer[0] = '\0';
ply->buffer_first = ply->buffer_last = ply->buffer_token = 0;
- ply->welement = 0;
- ply->wproperty = 0;
- ply->winstance_index = 0;
- ply->wlength = 0;
- ply->wvalue_index = 0;
}
static void ply_element_init(p_ply_element element) {
@@ -1079,7 +829,7 @@
}
static int ply_read_header_format(p_ply ply) {
- assert(ply && ply->fp && ply->io_mode == PLY_READ);
+ assert(ply && ply->fp);
if (strcmp(BWORD(ply), "format")) return 0;
if (!ply_read_word(ply)) return 0;
ply->storage_mode = ply_find_string(BWORD(ply), ply_storage_mode_list);
@@ -1095,7 +845,7 @@
}
static int ply_read_header_comment(p_ply ply) {
- assert(ply && ply->fp && ply->io_mode == PLY_READ);
+ assert(ply && ply->fp);
if (strcmp(BWORD(ply), "comment")) return 0;
if (!ply_read_line(ply)) return 0;
if (!ply_add_comment(ply, BLINE(ply))) return 0;
@@ -1104,7 +854,7 @@
}
static int ply_read_header_obj_info(p_ply ply) {
- assert(ply && ply->fp && ply->io_mode == PLY_READ);
+ assert(ply && ply->fp);
if (strcmp(BWORD(ply), "obj_info")) return 0;
if (!ply_read_line(ply)) return 0;
if (!ply_add_obj_info(ply, BLINE(ply))) return 0;
@@ -1143,7 +893,7 @@
static int ply_read_header_element(p_ply ply) {
p_ply_element element = NULL;
long dummy;
- assert(ply && ply->fp && ply->io_mode == PLY_READ);
+ assert(ply && ply->fp);
if (strcmp(BWORD(ply), "element")) return 0;
/* allocate room for new element */
element = ply_grow_element(ply);
@@ -1186,8 +936,11 @@
else return PLY_BIG_ENDIAN;
}
+/* As far as I can tell, these checks aren't needed and they also
+ * cause the program to fail on true 64 bit machines.
+ */
static int ply_type_check(void) {
- assert(sizeof(char) == 1);
+ /* assert(sizeof(char) == 1);
assert(sizeof(unsigned char) == 1);
assert(sizeof(short) == 2);
assert(sizeof(unsigned short) == 2);
@@ -1202,100 +955,11 @@
if (sizeof(long) != 4) return 0;
if (sizeof(unsigned long) != 4) return 0;
if (sizeof(float) != 4) return 0;
- if (sizeof(double) != 8) return 0;
+ if (sizeof(double) != 8) return 0;*/
return 1;
}
/* ----------------------------------------------------------------------
- * Output handlers
- * ---------------------------------------------------------------------- */
-static int oascii_int8(p_ply ply, double value) {
- if (value > CHAR_MAX || value < CHAR_MIN) return 0;
- return fprintf(ply->fp, "%d ", (char) value) > 0;
-}
-
-static int oascii_uint8(p_ply ply, double value) {
- if (value > UCHAR_MAX || value < 0) return 0;
- return fprintf(ply->fp, "%d ", (unsigned char) value) > 0;
-}
-
-static int oascii_int16(p_ply ply, double value) {
- if (value > SHRT_MAX || value < SHRT_MIN) return 0;
- return fprintf(ply->fp, "%d ", (short) value) > 0;
-}
-
-static int oascii_uint16(p_ply ply, double value) {
- if (value > USHRT_MAX || value < 0) return 0;
- return fprintf(ply->fp, "%d ", (unsigned short) value) > 0;
-}
-
-static int oascii_int32(p_ply ply, double value) {
- if (value > LONG_MAX || value < LONG_MIN) return 0;
- return fprintf(ply->fp, "%d ", (int) value) > 0;
-}
-
-static int oascii_uint32(p_ply ply, double value) {
- if (value > ULONG_MAX || value < 0) return 0;
- return fprintf(ply->fp, "%d ", (unsigned int) value) > 0;
-}
-
-static int oascii_float32(p_ply ply, double value) {
- if (value < -FLT_MAX || value > FLT_MAX) return 0;
- return fprintf(ply->fp, "%g ", (float) value) > 0;
-}
-
-static int oascii_float64(p_ply ply, double value) {
- if (value < -DBL_MAX || value > DBL_MAX) return 0;
- return fprintf(ply->fp, "%g ", value) > 0;
-}
-
-static int obinary_int8(p_ply ply, double value) {
- char int8 = (char) value;
- if (value > CHAR_MAX || value < CHAR_MIN) return 0;
- return ply->odriver->ochunk(ply, &int8, sizeof(int8));
-}
-
-static int obinary_uint8(p_ply ply, double value) {
- unsigned char uint8 = (unsigned char) value;
- if (value > UCHAR_MAX || value < 0) return 0;
- return ply->odriver->ochunk(ply, &uint8, sizeof(uint8));
-}
-
-static int obinary_int16(p_ply ply, double value) {
- short int16 = (short) value;
- if (value > SHRT_MAX || value < SHRT_MIN) return 0;
- return ply->odriver->ochunk(ply, &int16, sizeof(int16));
-}
-
-static int obinary_uint16(p_ply ply, double value) {
- unsigned short uint16 = (unsigned short) value;
- if (value > USHRT_MAX || value < 0) return 0;
- return ply->odriver->ochunk(ply, &uint16, sizeof(uint16));
-}
-
-static int obinary_int32(p_ply ply, double value) {
- long int32 = (long) value;
- if (value > LONG_MAX || value < LONG_MIN) return 0;
- return ply->odriver->ochunk(ply, &int32, sizeof(int32));
-}
-
-static int obinary_uint32(p_ply ply, double value) {
- unsigned long uint32 = (unsigned long) value;
- if (value > ULONG_MAX || value < 0) return 0;
- return ply->odriver->ochunk(ply, &uint32, sizeof(uint32));
-}
-
-static int obinary_float32(p_ply ply, double value) {
- float float32 = (float) value;
- if (value > FLT_MAX || value < -FLT_MAX) return 0;
- return ply->odriver->ochunk(ply, &float32, sizeof(float32));
-}
-
-static int obinary_float64(p_ply ply, double value) {
- return ply->odriver->ochunk(ply, &value, sizeof(value));
-}
-
-/* ----------------------------------------------------------------------
* Input handlers
* ---------------------------------------------------------------------- */
static int iascii_int8(p_ply ply, double *value) {
@@ -1447,36 +1111,6 @@
}, /* order matches e_ply_type enum */
ply_read_chunk_reverse,
"reverse binary input"
-};
-
-static t_ply_odriver ply_odriver_ascii = {
- { oascii_int8, oascii_uint8, oascii_int16, oascii_uint16,
- oascii_int32, oascii_uint32, oascii_float32, oascii_float64,
- oascii_int8, oascii_uint8, oascii_int16, oascii_uint16,
- oascii_int32, oascii_uint32, oascii_float32, oascii_float64
- }, /* order matches e_ply_type enum */
- NULL,
- "ascii output"
-};
-
-static t_ply_odriver ply_odriver_binary = {
- { obinary_int8, obinary_uint8, obinary_int16, obinary_uint16,
- obinary_int32, obinary_uint32, obinary_float32, obinary_float64,
- obinary_int8, obinary_uint8, obinary_int16, obinary_uint16,
- obinary_int32, obinary_uint32, obinary_float32, obinary_float64
- }, /* order matches e_ply_type enum */
- ply_write_chunk,
- "binary output"
-};
-
-static t_ply_odriver ply_odriver_binary_reverse = {
- { obinary_int8, obinary_uint8, obinary_int16, obinary_uint16,
- obinary_int32, obinary_uint32, obinary_float32, obinary_float64,
- obinary_int8, obinary_uint8, obinary_int16, obinary_uint16,
- obinary_int32, obinary_uint32, obinary_float32, obinary_float64
- }, /* order matches e_ply_type enum */
- ply_write_chunk_reverse,
- "reverse binary output"
};
/* ----------------------------------------------------------------------
Modified: trunk/Model/Readers/rply/rply.h
==============================================================================
--- trunk/Model/Readers/rply/rply.h (original)
+++ trunk/Model/Readers/rply/rply.h Sun May 15 01:11:07 2005
@@ -9,6 +9,10 @@
* at the end of this file.
* ---------------------------------------------------------------------- */
+/*
+ * This has been modified to not handle ply writing
+ */
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -223,68 +227,68 @@
int ply_get_property_info(p_ply_property property, const char** name,
e_ply_type *type, e_ply_type *length_type, e_ply_type *value_type);
-/* ----------------------------------------------------------------------
- * Creates new ply file
- *
- * name: file name
- * storage_mode: file format mode
- *
- * Returns handle to ply file if successfull, NULL otherwise
- * ---------------------------------------------------------------------- */
-p_ply ply_create(const char *name, e_ply_storage_mode storage_mode,
- p_ply_error_cb error_cb);
-
-/* ----------------------------------------------------------------------
- * Adds a new element to the ply file created by ply_create
- *
- * ply: handle returned by ply_create
- * name: name of new element
- * ninstances: number of element of this time in file
- *
- * Returns 1 if successfull, 0 otherwise
- * ---------------------------------------------------------------------- */
-int ply_add_element(p_ply ply, const char *name, long ninstances);
+/* /\*
---------------------------------------------------------------------- */
+/* * Creates new ply file */
+/* * */
+/* * name: file name */
+/* * storage_mode: file format mode */
+/* * */
+/* * Returns handle to ply file if successfull, NULL otherwise */
+/* * ----------------------------------------------------------------------
*\/ */
+/* p_ply ply_create(const char *name, e_ply_storage_mode storage_mode, */
+/* p_ply_error_cb error_cb); */
+
+/* /\*
---------------------------------------------------------------------- */
+/* * Adds a new element to the ply file created by ply_create */
+/* * */
+/* * ply: handle returned by ply_create */
+/* * name: name of new element */
+/* * ninstances: number of element of this time in file */
+/* * */
+/* * Returns 1 if successfull, 0 otherwise */
+/* * ----------------------------------------------------------------------
*\/ */
+/* int ply_add_element(p_ply ply, const char *name, long ninstances); */
+
+/* /\*
---------------------------------------------------------------------- */
+/* * Adds a new property to the last element added by ply_add_element */
+/* * */
+/* * ply: handle returned by ply_create */
+/* * name: name of new property */
+/* * type: property type */
+/* * length_type: scalar type of length field of a list property */
+/* * value_type: scalar type of value fields of a list property */
+/* * */
+/* * Returns 1 if successfull, 0 otherwise */
+/* * ----------------------------------------------------------------------
*\/ */
+/* int ply_add_property(p_ply ply, const char *name, e_ply_type type, */
+/* e_ply_type length_type, e_ply_type value_type); */
+
+/* /\*
---------------------------------------------------------------------- */
+/* * Adds a new list property to the last element added by ply_add_element
*/
+/* * */
+/* * ply: handle returned by ply_create */
+/* * name: name of new property */
+/* * length_type: scalar type of length field of a list property */
+/* * value_type: scalar type of value fields of a list property */
+/* * */
+/* * Returns 1 if successfull, 0 otherwise */
+/* * ----------------------------------------------------------------------
*\/ */
+/* int ply_add_list_property(p_ply ply, const char *name, */
+/* e_ply_type length_type, e_ply_type value_type); */
+
+/* /\*
---------------------------------------------------------------------- */
+/* * Adds a new property to the last element added by ply_add_element */
+/* * */
+/* * ply: handle returned by ply_create */
+/* * name: name of new property */
+/* * type: property type */
+/* * */
+/* * Returns 1 if successfull, 0 otherwise */
+/* * ----------------------------------------------------------------------
*\/ */
+/* int ply_add_scalar_property(p_ply ply, const char *name, e_ply_type
type); */
/* ----------------------------------------------------------------------
- * Adds a new property to the last element added by ply_add_element
- *
- * ply: handle returned by ply_create
- * name: name of new property
- * type: property type
- * length_type: scalar type of length field of a list property
- * value_type: scalar type of value fields of a list property
- *
- * Returns 1 if successfull, 0 otherwise
- * ---------------------------------------------------------------------- */
-int ply_add_property(p_ply ply, const char *name, e_ply_type type,
- e_ply_type length_type, e_ply_type value_type);
-
-/* ----------------------------------------------------------------------
- * Adds a new list property to the last element added by ply_add_element
- *
- * ply: handle returned by ply_create
- * name: name of new property
- * length_type: scalar type of length field of a list property
- * value_type: scalar type of value fields of a list property
- *
- * Returns 1 if successfull, 0 otherwise
- * ---------------------------------------------------------------------- */
-int ply_add_list_property(p_ply ply, const char *name,
- e_ply_type length_type, e_ply_type value_type);
-
-/* ----------------------------------------------------------------------
- * Adds a new property to the last element added by ply_add_element
- *
- * ply: handle returned by ply_create
- * name: name of new property
- * type: property type
- *
- * Returns 1 if successfull, 0 otherwise
- * ---------------------------------------------------------------------- */
-int ply_add_scalar_property(p_ply ply, const char *name, e_ply_type type);
-
-/* ----------------------------------------------------------------------
- * Adds a new comment item
+ * Adds a new comment item
*
* ply: handle returned by ply_create
* comment: pointer to string with comment text
@@ -294,7 +298,7 @@
int ply_add_comment(p_ply ply, const char *comment);
/* ----------------------------------------------------------------------
- * Adds a new obj_info item
+ * Adds a new obj_info item
*
* ply: handle returned by ply_create
* comment: pointer to string with obj_info data
@@ -304,29 +308,6 @@
int ply_add_obj_info(p_ply ply, const char *obj_info);
/* ----------------------------------------------------------------------
- * Writes the ply file header after all element and properties have been
- * defined by calls to ply_add_element and ply_add_property
- *
- * ply: handle returned by ply_create
- *
- * Returns 1 if successfull, 0 otherwise
- * ---------------------------------------------------------------------- */
-int ply_write_header(p_ply ply);
-
-/* ----------------------------------------------------------------------
- * Writes one property value, in the order they should be written to the
- * file. For each element type, write all elements of that type in order.
- * For each element, write all its properties in order. For scalar
- * properties, just write the value. For list properties, write the length
- * and then each of the values.
- *
- * ply: handle returned by ply_create
- *
- * Returns 1 if successfull, 0 otherwise
- * ---------------------------------------------------------------------- */
-int ply_write(p_ply ply, double value);
-
-/* ----------------------------------------------------------------------
* Closes a ply file handle. Releases all memory used by handle
*
* ply: handle to be closed.
@@ -336,7 +317,7 @@
int ply_close(p_ply ply);
p_ply_element ply_find_element(p_ply ply, const char *name);
-
+p_ply_property ply_find_property(p_ply_element element, const char *name);
long get_nproperties(p_ply_element e);
#ifdef __cplusplus
- [MANTA] r323 - trunk/Model/Readers/rply, thiago, 05/15/2005
Archive powered by MHonArc 2.6.16.