| 1231 | } |
| 1232 | |
| 1233 | static int ply_read_header_element(p_ply ply) { |
| 1234 | p_ply_element element = NULL; |
| 1235 | long dummy; |
| 1236 | assert(ply && ply->fp && ply->io_mode == PLY_READ); |
| 1237 | if (strcmp(BWORD(ply), "element")) return 0; |
| 1238 | /* allocate room for new element */ |
| 1239 | element = ply_grow_element(ply); |
| 1240 | if (!element) return 0; |
| 1241 | /* get element name */ |
| 1242 | if (!ply_read_word(ply)) return 0; |
| 1243 | strcpy(element->name, BWORD(ply)); |
| 1244 | /* get number of elements of this type */ |
| 1245 | if (!ply_read_word(ply)) return 0; |
| 1246 | if (sscanf(BWORD(ply), "%ld", &dummy) != 1) { |
| 1247 | ply_ferror(ply, "Expected number got '%s'", BWORD(ply)); |
| 1248 | return 0; |
| 1249 | } |
| 1250 | element->ninstances = dummy; |
| 1251 | /* get all properties for this element */ |
| 1252 | if (!ply_read_word(ply)) return 0; |
| 1253 | while (ply_read_header_property(ply) || |
| 1254 | ply_read_header_comment(ply) || ply_read_header_obj_info(ply)) |
| 1255 | /* do nothing */; |
| 1256 | return 1; |
| 1257 | } |
| 1258 | |
| 1259 | static void ply_error_cb(p_ply ply, const char *message) { |
| 1260 | (void) ply; |
no test coverage detected