1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-08-14 02:26:10 +00:00

Merge pull request #69 from ZornsLemma/plasm-stdout

Add new -S option to "plasm" to output to stdout
This commit is contained in:
David Schmenk
2023-02-02 11:35:00 -06:00
committed by GitHub
2 changed files with 17 additions and 5 deletions

View File

@@ -34,6 +34,10 @@ int main(int argc, char **argv)
break; break;
case 'W': case 'W':
outflags |= WARNINGS; outflags |= WARNINGS;
break;
case 'S':
outflags |= STREAM;
break;
} }
} }
} }
@@ -56,12 +60,19 @@ int main(int argc, char **argv)
j--; j--;
} }
asmfile[j+1] = 'a'; asmfile[j+1] = 'a';
if (outflags & STREAM)
{
outputfile = stdout;
}
else
{
outputfile = fopen(asmfile, "w"); outputfile = fopen(asmfile, "w");
if (!outputfile) if (!outputfile)
{ {
printf("Error opening output file %s\n", asmfile); printf("Error opening output file %s\n", asmfile);
exit(1); exit(1);
} }
}
while (j && asmfile[j-1] != '/') while (j && asmfile[j-1] != '/')
j--; j--;
k = 1; k = 1;
@@ -79,7 +90,7 @@ int main(int argc, char **argv)
} }
if (inputfile == NULL) if (inputfile == NULL)
{ {
printf("Usage: %s [-AMONW] <inputfile>", argv[0]); printf("Usage: %s [-AMONWS] <inputfile>\n", argv[0]);
return (0); return (0);
} }
emit_flags(outflags); emit_flags(outflags);

View File

@@ -9,6 +9,7 @@
#define SYSFLAGS (1<<5) #define SYSFLAGS (1<<5)
#define WARNINGS (1<<6) #define WARNINGS (1<<6)
#define NO_COMBINE (1<<7) #define NO_COMBINE (1<<7)
#define STREAM (1<<8)
#define FALSE 0 #define FALSE 0
#define TRUE (!FALSE) #define TRUE (!FALSE)
extern int outflags; extern int outflags;