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
14
#include <
mps/private/system/abstract-input-stream.h
>
15
21
MPS_BEGIN_DECLS
22
27
#define MPS_INPUT_BUFFER_HISTORY_DEFAULT_SIZE 2
28
33
struct
mps_input_buffer
{
38
mps_abstract_input_stream
*
stream
;
39
45
char
*
line
;
46
51
long
int
line_number
;
52
61
char
**
history
;
62
69
size_t
history_size
;
70
77
int
last
;
78
89
char
*
last_token
;
90
};
91
92
/* Function prototypes */
93
mps_input_buffer
*
mps_input_buffer_new
(
mps_abstract_input_stream
* stream);
94
int
mps_input_buffer_readline
(
mps_input_buffer
* buf);
95
void
mps_input_buffer_free
(
mps_input_buffer
* buf);
96
void
mps_input_buffer_set_history_size (
mps_input_buffer
* buf,
size_t
size);
97
mps_boolean
mps_input_buffer_eof
(
mps_input_buffer
* buf);
98
char
*
mps_input_buffer_next_token
(
mps_input_buffer
* buf);
99
100
MPS_END_DECLS
101
102
#endif
/* ifndef MPS_INPUT_BUFFER_H */
abstract-input-stream.h
Abstract input stream used to parse files.
mps_abstract_input_stream
struct mps_abstract_input_stream mps_abstract_input_stream
C wrapper around AbstractInputStream.
Definition:
abstract-input-stream.h:32
mps_input_buffer_next_token
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
mps_input_buffer_readline
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
mps_input_buffer_free
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_new
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_input_buffer_eof
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
mps_input_buffer
Buffer used to parse input files in MPSolve. It can read a stream line by line.
Definition:
input-buffer.h:33
mps_input_buffer::history_size
size_t history_size
Size of the history that is been kept in memory.
Definition:
input-buffer.h:69
mps_input_buffer::line
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_input_buffer::stream
mps_abstract_input_stream * stream
Stream associated with the mps_input_buffer.
Definition:
input-buffer.h:38
mps_input_buffer::last
int last
Index of the last line inserted in history.
Definition:
input-buffer.h:77
mps_input_buffer::line_number
long int line_number
Number of the last read line, the one that is stored in line field.
Definition:
input-buffer.h:51
mps_input_buffer::history
char ** history
Lines that have been read before this.
Definition:
input-buffer.h:61
mps_input_buffer::last_token
char * last_token
This is a pointer to the last parsed char in the buffer->line string.
Definition:
input-buffer.h:89
include
mps
private
input-buffer.h
Generated on Mon Nov 28 2022 00:00:00 for MPSolve by
1.9.5