MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / ply_read_word

Function ply_read_word

src/IO/rply.c:933–973  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

931}
932
933static int ply_read_word(p_ply ply) {
934 size_t t = 0;
935 assert(ply && ply->fp && ply->io_mode == PLY_READ);
936 /* skip leading blanks */
937 while (1) {
938 t = strspn(BFIRST(ply), " \n\r\t");
939 /* check if all buffer was made of blanks */
940 if (t >= BSIZE(ply)) {
941 if (!BREFILL(ply)) {
942 ply_ferror(ply, "Unexpected end of file");
943 return 0;
944 }
945 } else break;
946 }
947 BSKIP(ply, t);
948 /* look for a space after the current word */
949 t = strcspn(BFIRST(ply), " \n\r\t");
950 /* if we didn't reach the end of the buffer, we are done */
951 if (t < BSIZE(ply)) {
952 ply_finish_word(ply, t);
953 return ply_check_word(ply);
954 }
955 /* otherwise, try to refill buffer */
956 if (!BREFILL(ply)) {
957 /* if we reached the end of file, try to do with what we have */
958 ply_finish_word(ply, t);
959 return ply_check_word(ply);
960 /* ply_ferror(ply, "Unexpected end of file"); */
961 /* return 0; */
962 }
963 /* keep looking from where we left */
964 t += strcspn(BFIRST(ply) + t, " \n\r\t");
965 /* check if the token is too large for our buffer */
966 if (t >= BSIZE(ply)) {
967 ply_ferror(ply, "Token too large");
968 return 0;
969 }
970 /* we are done */
971 ply_finish_word(ply, t);
972 return ply_check_word(ply);
973}
974
975static void ply_finish_word(p_ply ply, size_t size) {
976 ply->buffer_token = ply->buffer_first;

Callers 14

ply_read_headerFunction · 0.85
ply_read_header_formatFunction · 0.85
ply_read_header_commentFunction · 0.85
ply_read_header_obj_infoFunction · 0.85
ply_read_header_propertyFunction · 0.85
ply_read_header_elementFunction · 0.85
iascii_int8Function · 0.85
iascii_uint8Function · 0.85
iascii_int16Function · 0.85
iascii_uint16Function · 0.85
iascii_int32Function · 0.85
iascii_uint32Function · 0.85

Calls 4

BREFILLFunction · 0.85
ply_ferrorFunction · 0.85
ply_finish_wordFunction · 0.85
ply_check_wordFunction · 0.85

Tested by

no test coverage detected