MPSolve 3.2.1
Loading...
Searching...
No Matches
input-buffer.h
Go to the documentation of this file.
1/*
2 * This file is part of MPSolve 3.2.1
3 *
4 * Copyright (C) 2001-2020, Dipartimento di Matematica "L. Tonelli", Pisa.
5 * License: http://www.gnu.org/licenses/gpl.html GPL version 3 or higher
6 *
7 * Authors:
8 * Leonardo Robol <leonardo.robol@unipi.it>
9 */
10
11#ifndef MPS_INPUT_BUFFER_H_
12#define MPS_INPUT_BUFFER_H_
13
15
21MPS_BEGIN_DECLS
22
27#define MPS_INPUT_BUFFER_HISTORY_DEFAULT_SIZE 2
28
39
45 char *line;
46
51 long int line_number;
52
61 char **history;
62
70
77 int last;
78
89 char * last_token;
90};
91
92/* Function prototypes */
96void mps_input_buffer_set_history_size (mps_input_buffer * buf, size_t size);
97mps_boolean mps_input_buffer_eof (mps_input_buffer * buf);
99
100MPS_END_DECLS
101
102#endif /* ifndef MPS_INPUT_BUFFER_H */
Abstract input stream used to parse files.
struct mps_abstract_input_stream mps_abstract_input_stream
C wrapper around AbstractInputStream.
Definition: abstract-input-stream.h:32
char * mps_input_buffer_next_token(mps_input_buffer *buf)
This function returns the next token that is in the buffer but hasn't been read yet.
Definition: input-buffer.c:153
int mps_input_buffer_readline(mps_input_buffer *buf)
Read a new line in the buffer, replacing the one present now.
Definition: input-buffer.c:95
void mps_input_buffer_free(mps_input_buffer *buf)
Free the buffer and internal data contained in it. Unread lines may be lost.
Definition: input-buffer.c:56
mps_input_buffer * mps_input_buffer_new(mps_abstract_input_stream *stream)
Create a new input buffer associated with the given input stream.
Definition: input-buffer.c:25
mps_boolean mps_input_buffer_eof(mps_input_buffer *buf)
Check if the whole stream has been read. This does not mean that there is nothing more to read,...
Definition: input-buffer.c:85
Buffer used to parse input files in MPSolve. It can read a stream line by line.
Definition: input-buffer.h:33
size_t history_size
Size of the history that is been kept in memory.
Definition: input-buffer.h:69
char * line
Pointer the last line read in the buffer. Another line can be read with mps_input_buffer_readline()
Definition: input-buffer.h:45
mps_abstract_input_stream * stream
Stream associated with the mps_input_buffer.
Definition: input-buffer.h:38
int last
Index of the last line inserted in history.
Definition: input-buffer.h:77
long int line_number
Number of the last read line, the one that is stored in line field.
Definition: input-buffer.h:51
char ** history
Lines that have been read before this.
Definition: input-buffer.h:61
char * last_token
This is a pointer to the last parsed char in the buffer->line string.
Definition: input-buffer.h:89