Lines Matching refs:source

45  *	get_next_block_fn(source)
48 * by popping one source bVSIZEOFlock of the stack of Sources
52 * The new source block to read from
55 * source The old source block
62 get_next_block_fn(register Source source)
70 if (source == NULL) {
73 if ((source->fd < 0) ||
74 ((source->bytes_left_in_file <= 0) &&
75 (source->inp_buf_ptr >= source->inp_buf_end))) {
76 /* We can't read from the makefile, so pop the source block */
77 if (source->fd > 2) {
78 (void) close(source->fd);
86 if (source->string.free_after_use &&
87 (source->string.buffer.start != NULL)) {
88 retmem(source->string.buffer.start);
89 source->string.buffer.start = NULL;
91 if (source->inp_buf != NULL) {
92 retmem_mb(source->inp_buf);
93 source->inp_buf = NULL;
95 source = source->previous;
96 if (source != NULL) {
97 source->error_converting = false;
99 return source;
101 if (source->bytes_left_in_file > 0) {
106 to_read = source->bytes_left_in_file;
107 source->inp_buf_ptr = source->inp_buf = getmem(to_read + 1);
108 source->inp_buf_end = source->inp_buf + to_read;
109 length = read(source->fd, source->inp_buf, (unsigned int) to_read);
121 *source->inp_buf_end = nul_char;
122 source->bytes_left_in_file = 0;
127 ptr = source->inp_buf_ptr + STRING_LEN_TO_CONVERT;
128 if (ptr > source->inp_buf_end) {
129 ptr = source->inp_buf_end;
131 for (num_wc_chars = 0; ptr > source->inp_buf_ptr; ptr--) {
134 num_wc_chars = mbstowcs(source->string.text.end,
135 source->inp_buf_ptr,
144 source->error_converting = true;
145 return source;
148 source->error_converting = false;
149 source->inp_buf_ptr = ptr;
150 source->string.text.end += num_wc_chars;
151 *source->string.text.end = 0;
153 if (source->inp_buf_ptr >= source->inp_buf_end) {
154 if (*(source->string.text.end - 1) != (int) newline_char) {
158 *source->string.text.end++ = (int) newline_char;
159 *source->string.text.end = (int) nul_char;
160 *source->string.buffer.end++;
162 if (source->inp_buf != NULL) {
163 retmem_mb(source->inp_buf);
164 source->inp_buf = NULL;
167 return source;