parent
775d86c0fa
commit
60cf41adab
6 changed files with 70 additions and 8 deletions
@ -0,0 +1 @@ |
||||
#include<stdio.h> |
@ -0,0 +1,13 @@ |
||||
project('pipeline test', 'c') |
||||
|
||||
e1 = executable('srcgen', 'srcgen.c') |
||||
|
||||
gen = generator(e1, \ |
||||
output_name : '@BASENAME@.h', \ |
||||
arguments : ['@INPUT@', '@OUTPUT@']) |
||||
|
||||
generated = gen.process('input_src.dat') |
||||
|
||||
e2 = executable('prog', 'prog.c', generated) |
||||
|
||||
add_test('pipelined', e2) |
@ -0,0 +1,9 @@ |
||||
#include"input_src.dat.h" |
||||
|
||||
int main(int argc, char **argv) { |
||||
void *foo = printf; |
||||
if(foo) { |
||||
return 0; |
||||
} |
||||
return 1; |
||||
} |
@ -0,0 +1,33 @@ |
||||
#include<stdio.h> |
||||
#include<assert.h> |
||||
|
||||
int main(int argc, char **argv) { |
||||
const int ARRSIZE = 80; |
||||
char arr[ARRSIZE]; |
||||
if(argc != 3) { |
||||
fprintf(stderr, "%s <input file> <output file>\n", argv[0]); |
||||
return 1; |
||||
} |
||||
char *ifilename = argv[1]; |
||||
char *ofilename = argv[2]; |
||||
printf("%s\n", ifilename); |
||||
FILE *ifile = fopen(ifilename, "r"); |
||||
if(!ifile) { |
||||
fprintf(stderr, "Could not open source file %s.\n", ifilename); |
||||
return 1; |
||||
} |
||||
FILE *ofile = fopen(ofilename, "w"); |
||||
if(!ofile) { |
||||
fprintf(stderr, "Could not open target file %s\n", ofilename); |
||||
return 1; |
||||
} |
||||
size_t bytes; |
||||
bytes = fread(arr, 1, ARRSIZE, ifile); |
||||
assert(bytes < 80); |
||||
assert(bytes > 0); |
||||
fwrite(arr, 1, bytes, ofile); |
||||
|
||||
fclose(ifile); |
||||
fclose(ofile); |
||||
return 0; |
||||
} |
Loading…
Reference in new issue