MCPcopy Create free account
hub / github.com/davisking/dlib / underflow

Method underflow

dlib/matlab/subprocess_stream.cpp:320–353  ·  view source on GitHub ↗

input functions

Source from the content-addressed store, hash-verified

318
319 // input functions
320 int_type underflow(
321 )
322 {
323 if (gptr() < egptr())
324 {
325 return static_cast<unsigned char>(*gptr());
326 }
327
328 int num_put_back = static_cast<int>(gptr() - eback());
329 if (num_put_back > max_putback)
330 {
331 num_put_back = max_putback;
332 }
333
334 // copy the putback characters into the putback end of the in_buffer
335 std::memmove(in_buffer+(max_putback-num_put_back), gptr()-num_put_back, num_put_back);
336
337
338 if (read_echoing_select(fd, fd_printf))
339 return EOF;
340 int num = read(fd,in_buffer+max_putback, in_buffer_size-max_putback);
341 if (num <= 0)
342 {
343 // an error occurred or the connection is over which is EOF
344 return EOF;
345 }
346
347 // reset in_buffer pointers
348 setg (in_buffer+(max_putback-num_put_back),
349 in_buffer+max_putback,
350 in_buffer+max_putback+num);
351
352 return static_cast<unsigned char>(*gptr());
353 }
354
355 std::streamsize xsgetn (
356 char_type* s,

Callers

nothing calls this directly

Calls 1

read_echoing_selectFunction · 0.85

Tested by

no test coverage detected