---------------------------------------------------------------------- * Internal functions * ---------------------------------------------------------------------- */
| 796 | * Internal functions |
| 797 | * ---------------------------------------------------------------------- */ |
| 798 | static int ply_read_list_property(p_ply ply, p_ply_element element, |
| 799 | p_ply_property property, p_ply_argument argument) { |
| 800 | int l; |
| 801 | p_ply_read_cb read_cb = property->read_cb; |
| 802 | p_ply_ihandler *driver = ply->idriver->ihandler; |
| 803 | /* get list length */ |
| 804 | p_ply_ihandler handler = driver[property->length_type]; |
| 805 | double length; |
| 806 | if (!handler(ply, &length)) { |
| 807 | ply_ferror(ply, "Error reading '%s' of '%s' number %d", |
| 808 | property->name, element->name, argument->instance_index); |
| 809 | return 0; |
| 810 | } |
| 811 | /* invoke callback to pass length in value field */ |
| 812 | argument->length = (long) length; |
| 813 | argument->value_index = -1; |
| 814 | argument->value = length; |
| 815 | if (read_cb && !read_cb(argument)) { |
| 816 | ply_ferror(ply, "Aborted by user"); |
| 817 | return 0; |
| 818 | } |
| 819 | /* read list values */ |
| 820 | handler = driver[property->value_type]; |
| 821 | /* for each value in list */ |
| 822 | for (l = 0; l < (long) length; l++) { |
| 823 | /* read value from file */ |
| 824 | argument->value_index = l; |
| 825 | if (!handler(ply, &argument->value)) { |
| 826 | ply_ferror(ply, "Error reading value number %d of '%s' of " |
| 827 | "'%s' number %d", l+1, property->name, |
| 828 | element->name, argument->instance_index); |
| 829 | return 0; |
| 830 | } |
| 831 | /* invoke callback to pass value */ |
| 832 | if (read_cb && !read_cb(argument)) { |
| 833 | ply_ferror(ply, "Aborted by user"); |
| 834 | return 0; |
| 835 | } |
| 836 | } |
| 837 | return 1; |
| 838 | } |
| 839 | |
| 840 | static int ply_read_scalar_property(p_ply ply, p_ply_element element, |
| 841 | p_ply_property property, p_ply_argument argument) { |
no test coverage detected