Lines Matching refs:source

187 	inputsource *source;
189 source = isc_mem_get(lex->mctx, sizeof(*source));
190 source->result = ISC_R_SUCCESS;
191 source->is_file = is_file;
192 source->need_close = need_close;
193 source->at_eof = false;
194 source->last_was_eol = lex->last_was_eol;
195 source->input = input;
196 source->name = isc_mem_strdup(lex->mctx, name);
197 source->pushback = NULL;
198 isc_buffer_allocate(lex->mctx, &source->pushback,
200 source->ignored = 0;
201 source->line = 1;
202 ISC_LIST_INITANDPREPEND(lex->sources, source, link);
213 * Open 'filename' and make it the current input source for 'lex'.
235 * Make 'stream' the current input source for 'lex'.
250 * Make 'buffer' the current input source for 'lex'.
262 inputsource *source;
270 source = HEAD(lex->sources);
271 if (source == NULL) {
275 ISC_LIST_UNLINK(lex->sources, source, link);
276 lex->last_was_eol = source->last_was_eol;
277 if (source->is_file) {
278 if (source->need_close) {
279 (void)fclose((FILE *)(source->input));
282 isc_mem_free(lex->mctx, source->name);
283 isc_buffer_free(&source->pushback);
284 isc_mem_put(lex->mctx, source, sizeof(*source));
308 pushback(inputsource *source, int c) {
309 REQUIRE(source->pushback->current > 0);
311 source->at_eof = false;
314 source->pushback->current--;
316 source->line--;
321 pushandgrow(isc_lex_t *lex, inputsource *source, int c) {
322 if (isc_buffer_availablelength(source->pushback) == 0) {
328 oldlen = isc_buffer_length(source->pushback);
330 isc_buffer_usedregion(source->pushback, &used);
333 tbuf->current = source->pushback->current;
334 isc_buffer_free(&source->pushback);
335 source->pushback = tbuf;
337 isc_buffer_putuint8(source->pushback, (uint8_t)c);
343 inputsource *source;
363 source = HEAD(lex->sources);
366 if (source == NULL) {
374 if (source->result != ISC_R_SUCCESS) {
375 return source->result;
379 source->saved_line = source->line;
381 if (isc_buffer_remaininglength(source->pushback) == 0 && source->at_eof)
401 isc_buffer_compact(source->pushback);
415 if (source->is_file) {
416 flockfile(source->input);
421 if (isc_buffer_remaininglength(source->pushback) == 0) {
422 if (source->is_file) {
423 stream = source->input;
432 source->result =
435 result = source->result;
438 source->at_eof = true;
441 buffer = source->input;
445 source->at_eof = true;
453 source->result = pushandgrow(lex, source, c);
454 if (source->result != ISC_R_SUCCESS) {
455 result = source->result;
461 if (!source->at_eof) {
464 source->ignored = isc_buffer_consumedlength(
465 source->pushback);
467 c = isc_buffer_getuint8(source->pushback);
473 source->line++;
613 pushback(source, c);
634 pushback(source, c);
725 pushback(source, c);
726 if (source->result != ISC_R_SUCCESS) {
727 result = source->result;
771 pushback(source, c);
844 pushback(source, c);
926 if (source->is_file) {
927 funlockfile(source->input);
1022 inputsource *source;
1028 source = HEAD(lex->sources);
1029 REQUIRE(source != NULL);
1031 REQUIRE(isc_buffer_consumedlength(source->pushback) != 0 ||
1036 isc_buffer_first(source->pushback);
1038 source->line = source->saved_line;
1039 source->at_eof = false;
1044 inputsource *source;
1047 source = HEAD(lex->sources);
1048 REQUIRE(source != NULL);
1050 REQUIRE(isc_buffer_consumedlength(source->pushback) != 0 ||
1055 INSIST(source->ignored <= isc_buffer_consumedlength(source->pushback));
1056 r->base = (unsigned char *)isc_buffer_base(source->pushback) +
1057 source->ignored;
1058 r->length = isc_buffer_consumedlength(source->pushback) -
1059 source->ignored;
1064 inputsource *source;
1067 source = HEAD(lex->sources);
1069 if (source == NULL) {
1073 return source->name;
1078 inputsource *source;
1081 source = HEAD(lex->sources);
1083 if (source == NULL) {
1087 return source->line;
1092 inputsource *source;
1096 source = HEAD(lex->sources);
1098 if (source == NULL) {
1102 isc_mem_free(lex->mctx, source->name);
1103 source->name = newname;
1109 inputsource *source;
1112 source = HEAD(lex->sources);
1114 if (source == NULL) {
1118 source->line = line;
1124 inputsource *source;
1128 source = HEAD(lex->sources);
1130 if (source == NULL) {
1134 return source->is_file;