pkgsrc/devel/ruby-byaccr/patches/patch-af

128 lines
2.8 KiB
Text
Raw Normal View History

$NetBSD: patch-af,v 1.2 2005/06/19 20:44:06 minskim Exp $
--- output.c.orig 2000-11-14 02:42:19.000000000 -0600
+++ output.c
@@ -1,6 +1,5 @@
#include <stdio.h>
#include <string.h>
-#include <malloc.h>
#include "defs.h"
@@ -834,9 +833,7 @@ void output_defines(void)
s = symbol_name[i];
if (is_C_identifier(s))
{
- if (jflag) /*rwj*/
- fprintf(code_file, "");
- else
+ if (!jflag) /*rwj*/
fprintf(code_file, "#define ");
if (dflag) fprintf(defines_file, "#define ");
c = *s;
@@ -876,8 +873,17 @@ void output_defines(void)
if (dflag && unionized)
{
+#ifdef WITHOUT_MKSTEMP
fclose(union_file);
union_file = fopen(union_file_name, "r");
+#else
+ if (fflush(union_file) == 0)
+ rewind(union_file);
+ else {
+ fclose(union_file);
+ union_file = NULL;
+ }
+#endif
if (union_file == NULL) open_error(union_file_name);
while ((c = getc(union_file)) != EOF)
putc(c, defines_file);
@@ -891,8 +897,17 @@ void output_stored_text(void)
int c;
FILE *in, *out;
+#ifdef WITHOUT_MKSTEMP
fclose(text_file);
text_file = fopen(text_file_name, "r");
+#else
+ if (fflush(text_file) == 0)
+ rewind(text_file);
+ else {
+ fclose(text_file);
+ text_file = NULL;
+ }
+#endif
if (text_file == NULL)
open_error(text_file_name);
in = text_file;
@@ -908,11 +923,12 @@ FILE *in, *out;
++outline;
putc(c, out);
}
- if (!lflag)
+ if (!lflag) {
if (jflag)/*rwj*/
fprintf(out, jline_format, ++outline + 1, code_file_name);
else
fprintf(out, line_format, ++outline + 1, code_file_name);
+ }
}
@@ -1191,8 +1207,6 @@ char **symnam, *s;
void output_stype(void)
{
int prim; /*is the Ruby semantic type a primitive?*/
-char filenam[128];
-FILE *f;
if (jflag){ /*rwj*/
prim=0;
fprintf(code_file,"\n\n");
@@ -1313,11 +1327,12 @@ FILE *in, *out;
++outline;
putc('\n', out);
}
- if (!lflag)
+ if (!lflag) {
if (jflag)
fprintf(out, jline_format, ++outline + 1, code_file_name);
else
fprintf(out, line_format, ++outline + 1, code_file_name);
+ }
}
@@ -1326,8 +1341,17 @@ void output_semantic_actions(void)
int c, last;
FILE *out;
+#ifdef WITHOUT_MKSTEMP
fclose(action_file);
action_file = fopen(action_file_name, "r");
+#else
+ if (fflush(action_file) == 0)
+ rewind(action_file);
+ else {
+ fclose(action_file);
+ action_file = NULL;
+ }
+#endif
if (action_file == NULL)
open_error(action_file_name);
@@ -1353,11 +1377,12 @@ FILE *out;
putc('\n', out);
}
- if (!lflag)
+ if (!lflag) {
if (jflag)/*rwj*/
fprintf(out, jline_format, ++outline + 1, code_file_name);
else
fprintf(out, line_format, ++outline + 1, code_file_name);
+ }
}
void free_itemsets(void)