mirror of
https://github.com/open-simh/simtools.git
synced 2026-01-11 23:53:02 +00:00
Rename stream2 method "gets" to "getline"
because FORTIFY re#defines gets, and this gets is something different.
This commit is contained in:
parent
a0add7154f
commit
8d7414d7c3
@ -45,7 +45,7 @@ static int assemble(
|
||||
int local; /* Whether a label is a local label or
|
||||
not */
|
||||
|
||||
line = stack_gets(stack);
|
||||
line = stack_getline(stack);
|
||||
if (line == NULL)
|
||||
return -1; /* Return code for EOF. */
|
||||
|
||||
@ -522,7 +522,7 @@ static int assemble(
|
||||
cp += strcspn(cp, quote);
|
||||
if (*cp == quote[0])
|
||||
break; /* Found closing quote */
|
||||
cp = stack_gets(stack); /* Read next input line */
|
||||
cp = stack_getline(stack); /* Read next input line */
|
||||
if (cp == NULL)
|
||||
break; /* EOF */
|
||||
}
|
||||
@ -641,7 +641,7 @@ static int assemble(
|
||||
for (;;) {
|
||||
char *mlabel;
|
||||
|
||||
maccp = macstr->vtbl->gets(macstr);
|
||||
maccp = macstr->vtbl->getline(macstr);
|
||||
if (maccp == NULL)
|
||||
break;
|
||||
mlabel = get_symbol(maccp, &maccp, NULL);
|
||||
|
||||
4
macros.c
4
macros.c
@ -40,7 +40,7 @@ void macro_stream_delete(
|
||||
}
|
||||
|
||||
STREAM_VTBL macro_stream_vtbl = {
|
||||
macro_stream_delete, buffer_stream_gets, buffer_stream_rewind
|
||||
macro_stream_delete, buffer_stream_getline, buffer_stream_rewind
|
||||
};
|
||||
|
||||
STREAM *new_macro_stream(
|
||||
@ -85,7 +85,7 @@ void read_body(
|
||||
char *nextline;
|
||||
char *cp;
|
||||
|
||||
nextline = stack_gets(stack); /* Now read the line */
|
||||
nextline = stack_getline(stack); /* Now read the line */
|
||||
if (nextline == NULL) { /* End of file. */
|
||||
report(stack->top, "Macro body of '%s' not closed\n", name);
|
||||
break;
|
||||
|
||||
24
rept_irpc.c
24
rept_irpc.c
@ -27,11 +27,11 @@ typedef struct rept_stream {
|
||||
expansion */
|
||||
} REPT_STREAM;
|
||||
|
||||
/* rept_stream_gets gets a line from a repeat stream. At the end of
|
||||
/* rept_stream_getline gets a line from a repeat stream. At the end of
|
||||
each count, the coutdown is decreated and the stream is reset to
|
||||
its beginning. */
|
||||
|
||||
char *rept_stream_gets(
|
||||
char *rept_stream_getline(
|
||||
STREAM *str)
|
||||
{
|
||||
REPT_STREAM *rstr = (REPT_STREAM *) str;
|
||||
@ -41,7 +41,7 @@ char *rept_stream_gets(
|
||||
if (rstr->count <= 0)
|
||||
return NULL;
|
||||
|
||||
if ((cp = buffer_stream_gets(str)) != NULL)
|
||||
if ((cp = buffer_stream_getline(str)) != NULL)
|
||||
return cp;
|
||||
|
||||
buffer_stream_rewind(str);
|
||||
@ -64,7 +64,7 @@ void rept_stream_delete(
|
||||
/* The VTBL */
|
||||
|
||||
STREAM_VTBL rept_stream_vtbl = {
|
||||
rept_stream_delete, rept_stream_gets, buffer_stream_rewind
|
||||
rept_stream_delete, rept_stream_getline, buffer_stream_rewind
|
||||
};
|
||||
|
||||
/* expand_rept is called when a .REPT is encountered in the input. */
|
||||
@ -135,11 +135,11 @@ typedef struct irp_stream {
|
||||
int savecond; /* Saved conditional level */
|
||||
} IRP_STREAM;
|
||||
|
||||
/* irp_stream_gets expands the IRP as the stream is read. */
|
||||
/* irp_stream_getline expands the IRP as the stream is read. */
|
||||
/* Each time an iteration is exhausted, the next iteration is
|
||||
generated. */
|
||||
|
||||
char *irp_stream_gets(
|
||||
char *irp_stream_getline(
|
||||
STREAM *str)
|
||||
{
|
||||
IRP_STREAM *istr = (IRP_STREAM *) str;
|
||||
@ -148,7 +148,7 @@ char *irp_stream_gets(
|
||||
ARG *arg;
|
||||
|
||||
for (;;) {
|
||||
if ((cp = buffer_stream_gets(str)) != NULL)
|
||||
if ((cp = buffer_stream_getline(str)) != NULL)
|
||||
return cp;
|
||||
|
||||
cp = istr->items + istr->offset;
|
||||
@ -190,7 +190,7 @@ void irp_stream_delete(
|
||||
}
|
||||
|
||||
STREAM_VTBL irp_stream_vtbl = {
|
||||
irp_stream_delete, irp_stream_gets, buffer_stream_rewind
|
||||
irp_stream_delete, irp_stream_getline, buffer_stream_rewind
|
||||
};
|
||||
|
||||
/* expand_irp is called when a .IRP is encountered in the input. */
|
||||
@ -266,10 +266,10 @@ typedef struct irpc_stream {
|
||||
int savecond; /* conditional stack at invocation */
|
||||
} IRPC_STREAM;
|
||||
|
||||
/* irpc_stream_gets - same comments apply as with irp_stream_gets, but
|
||||
/* irpc_stream_getline - same comments apply as with irp_stream_getline, but
|
||||
the substitution is character-by-character */
|
||||
|
||||
char *irpc_stream_gets(
|
||||
char *irpc_stream_getline(
|
||||
STREAM *str)
|
||||
{
|
||||
IRPC_STREAM *istr = (IRPC_STREAM *) str;
|
||||
@ -278,7 +278,7 @@ char *irpc_stream_gets(
|
||||
ARG *arg;
|
||||
|
||||
for (;;) {
|
||||
if ((cp = buffer_stream_gets(str)) != NULL)
|
||||
if ((cp = buffer_stream_getline(str)) != NULL)
|
||||
return cp;
|
||||
|
||||
cp = istr->items + istr->offset;
|
||||
@ -320,7 +320,7 @@ void irpc_stream_delete(
|
||||
}
|
||||
|
||||
STREAM_VTBL irpc_stream_vtbl = {
|
||||
irpc_stream_delete, irpc_stream_gets, buffer_stream_rewind
|
||||
irpc_stream_delete, irpc_stream_getline, buffer_stream_rewind
|
||||
};
|
||||
|
||||
/* expand_irpc - called when .IRPC is encountered in the input */
|
||||
|
||||
18
stream2.c
18
stream2.c
@ -172,9 +172,9 @@ void stream_delete(
|
||||
|
||||
/* *** class BUFFER_STREAM implementation */
|
||||
|
||||
/* STREAM::gets for a buffer stream */
|
||||
/* STREAM::getline for a buffer stream */
|
||||
|
||||
char *buffer_stream_gets(
|
||||
char *buffer_stream_getline(
|
||||
STREAM *str)
|
||||
{
|
||||
char *nl;
|
||||
@ -228,7 +228,7 @@ void buffer_stream_rewind(
|
||||
/* BUFFER_STREAM vtbl */
|
||||
|
||||
STREAM_VTBL buffer_stream_vtbl = {
|
||||
buffer_stream_delete, buffer_stream_gets, buffer_stream_rewind
|
||||
buffer_stream_delete, buffer_stream_getline, buffer_stream_rewind
|
||||
};
|
||||
|
||||
void buffer_stream_construct(
|
||||
@ -271,9 +271,9 @@ STREAM *new_buffer_stream(
|
||||
|
||||
/* *** FILE_STREAM implementation */
|
||||
|
||||
/* Implement STREAM::gets for a file stream */
|
||||
/* Implement STREAM::getline for a file stream */
|
||||
|
||||
static char *file_gets(
|
||||
static char *file_getline(
|
||||
STREAM *str)
|
||||
{
|
||||
int i,
|
||||
@ -332,7 +332,7 @@ void file_rewind(
|
||||
}
|
||||
|
||||
static STREAM_VTBL file_stream_vtbl = {
|
||||
file_destroy, file_gets, file_rewind
|
||||
file_destroy, file_getline, file_rewind
|
||||
};
|
||||
|
||||
/* Prepare and open a stream from a file. */
|
||||
@ -391,11 +391,11 @@ void stack_push(
|
||||
stack->top = str;
|
||||
}
|
||||
|
||||
/* stack_gets calls vtbl->gets for the topmost stack entry. When
|
||||
/* stack_getline calls vtbl->getline for the topmost stack entry. When
|
||||
topmost streams indicate they're exhausted, they are popped and
|
||||
deleted, until the stack is exhausted. */
|
||||
|
||||
char *stack_gets(
|
||||
char *stack_getline(
|
||||
STACK *stack)
|
||||
{
|
||||
char *line;
|
||||
@ -403,7 +403,7 @@ char *stack_gets(
|
||||
if (stack->top == NULL)
|
||||
return NULL;
|
||||
|
||||
while ((line = stack->top->vtbl->gets(stack->top)) == NULL) {
|
||||
while ((line = stack->top->vtbl->getline(stack->top)) == NULL) {
|
||||
stack_pop(stack);
|
||||
if (stack->top == NULL)
|
||||
return NULL;
|
||||
|
||||
19
stream2.h
19
stream2.h
@ -40,15 +40,12 @@ DAMAGE.
|
||||
struct stream;
|
||||
|
||||
typedef struct stream_vtbl {
|
||||
void (
|
||||
*delete) (
|
||||
struct stream * stream); /* Destructor */
|
||||
char *(
|
||||
*gets) (
|
||||
struct stream * stream); /* "gets" function */
|
||||
void (
|
||||
*rewind) (
|
||||
struct stream * stream); /* "rewind" function */
|
||||
void (*delete)(
|
||||
struct stream *stream); /* Destructor */
|
||||
char *(*getline)(
|
||||
struct stream *stream); /* "getline" function */
|
||||
void (*rewind)(
|
||||
struct stream *stream); /* "rewind" function */
|
||||
} STREAM_VTBL;
|
||||
|
||||
typedef struct stream {
|
||||
@ -114,7 +111,7 @@ void buffer_stream_construct(
|
||||
BUFFER_STREAM * bstr,
|
||||
BUFFER *buf,
|
||||
char *name);
|
||||
char *buffer_stream_gets(
|
||||
char *buffer_stream_getline(
|
||||
STREAM *str);
|
||||
void buffer_stream_delete(
|
||||
STREAM *str);
|
||||
@ -131,7 +128,7 @@ void stack_push(
|
||||
STREAM *str);
|
||||
void stack_pop(
|
||||
STACK *stack);
|
||||
char *stack_gets(
|
||||
char *stack_getline(
|
||||
STACK *stack);
|
||||
|
||||
#endif /* STREAM2_H */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user