#include "misc/auxiliary.h"
#include <unistd.h>
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <gmp.h>
#include "omalloc/omalloc.h"
#include "reporter/s_buff.h"
#include "reporter/si_signals.h"
Go to the source code of this file.
◆ S_BUFF_LEN
◆ s_close()
Definition at line 45 of file s_buff.cc.
46{
48 {
53 return r;
54 }
55 return 0;
56}
#define omFreeSize(addr, size)
◆ s_getc()
Definition at line 58 of file s_buff.cc.
59{
61 {
63 return 0;
64 }
65 if (F->bp>=F->end)
66 {
69 if (r<=0)
70 {
71 F->is_eof=1;
72 return -1;
73 }
74 else
75 {
76 F->end=r-1;
77 F->bp=0;
78 return F->buff[0];
79 }
80 }
81
82 F->bp++;
83 return F->buff[F->bp];
84}
◆ s_iseof()
Definition at line 254 of file s_buff.cc.
255{
256 if (F!=
NULL)
return F->is_eof;
257 else return 1;
258}
◆ s_isready()
Definition at line 85 of file s_buff.cc.
86{
88 {
90 return 0;
91 }
92 if (F->bp>=F->end) return 0;
94 while((
p<F->end)&&(F->buff[
p]<=
' '))
p++;
95 if (
p>=F->end)
return 0;
96 return 1;
97}
◆ s_open()
◆ s_open_by_name()
◆ s_readbytes()
Definition at line 168 of file s_buff.cc.
169{
171 {
173 return 0;
174 }
176 while((!F->is_eof)&&(
i<len))
177 {
180 }
182}
◆ s_readint()
Definition at line 112 of file s_buff.cc.
113{
115 {
117 return 0;
118 }
119 char c;
120 int neg=1;
121 int r=0;
122
123 do
124 {
126 } while((!F->is_eof) && (c<=' '));
127 if (c==
'-') { neg=-1; c=
s_getc(F); }
129 {
130
131 r=r*10+(c-'0');
133 }
135
136
137 return r*neg;
138}
void s_ungetc(int c, s_buff F)
◆ s_readlong()
Definition at line 140 of file s_buff.cc.
141{
143 {
145 return 0;
146 }
147 char c;
148 long neg=1;
149 long r=0;
150
151 do
152 {
154 } while((!F->is_eof) && (c<=' '));
155 if (c==
'-') { neg=-1; c=
s_getc(F); }
157 {
158
159 r=r*10+(c-'0');
161 }
163
164
165 return r*neg;
166}
◆ s_readmpz()
Definition at line 184 of file s_buff.cc.
185{
187 {
189 return;
190 }
192 char c;
193 int neg=1;
194 do
195 {
197 } while((!F->is_eof) && (c<=' '));
198 if (c==
'-') { neg=-1; c=
s_getc(F); }
200 {
204 }
207}
◆ s_readmpz_base()
Definition at line 209 of file s_buff.cc.
210{
212 {
214 return;
215 }
217 char c;
218 int neg=1;
219 do
220 {
222 } while((!F->is_eof) && (c<=' '));
223 if (c==
'-') { neg=-1; c=
s_getc(F); }
227 while(c>' ')
228 {
230 || ((c>='a') && (c<='z'))
231 || ((c>='A') && (c<='Z')))
232 {
235 }
236 else
237 {
239 break;
240 }
242 {
247 }
249 }
253}
#define omRealloc(addr, size)
◆ s_ungetc()
Definition at line 99 of file s_buff.cc.
100{
102 {
104 }
105 else if (F->bp>=0)
106 {
107 F->buff[F->bp]=c;
108 F->bp--;
109 }
110}