summaryrefslogtreecommitdiffstats
path: root/src/tape.c
diff options
context:
space:
mode:
authorAnton Luka Šijanec <sijanecantonluka@gmail.com>2020-06-09 17:31:19 +0200
committerAnton Luka Šijanec <sijanecantonluka@gmail.com>2020-06-09 17:31:19 +0200
commit1006e7fb17e31ea501eca6834253d288c2f6da59 (patch)
tree64f28ec44b0563201ab18a881e8b58036208c2b1 /src/tape.c
parenti dont know (diff)
downloadbverbose-1006e7fb17e31ea501eca6834253d288c2f6da59.tar
bverbose-1006e7fb17e31ea501eca6834253d288c2f6da59.tar.gz
bverbose-1006e7fb17e31ea501eca6834253d288c2f6da59.tar.bz2
bverbose-1006e7fb17e31ea501eca6834253d288c2f6da59.tar.lz
bverbose-1006e7fb17e31ea501eca6834253d288c2f6da59.tar.xz
bverbose-1006e7fb17e31ea501eca6834253d288c2f6da59.tar.zst
bverbose-1006e7fb17e31ea501eca6834253d288c2f6da59.zip
Diffstat (limited to 'src/tape.c')
-rw-r--r--src/tape.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/tape.c b/src/tape.c
index 442ba53..0492313 100644
--- a/src/tape.c
+++ b/src/tape.c
@@ -93,13 +93,16 @@ int bvr_inline_command_processor(FILE * page_source_file, FILE * output_file, ch
return what_to_return;
}
-int bvr_compose_stream(FILE * page_source_file, FILE * temp_output_file) {
- char copy_buffer[COPY_BUFFER_SIZE];
- int cycles = 0;
- for(int i = 0; i < sizeof(copy_buffer); i++) { // da garbage vrednosti ne bodo slučajno ukazi!
- copy_buffer[i] = '\n'; // čeprav OS verjetno nastavi ram na \0\0\0\0\0\0 preden ga da procesu
+int init_tape_copy_buffer(char copy_buffer[], int buffer_size) {
+ for(int i = 0; i <buffer_size; i++) { // da garbage vrednosti ne bodo slučajno ukazi!
+ (copy_buffer)[i] = '\n'; // čeprav OS verjetno nastavi ram na \0\0\0\0\0\0 preden ga da procesu
} // ampak kaj pa, ko funkcijo zaženemo drugič, pointer bo kazal na isto mesto! // nočemo \0
+}
+int bvr_compose_stream(FILE * page_source_file, FILE * temp_output_file) {
+ int cycles = 0;
+ char copy_buffer[COPY_BUFFER_SIZE];
+ init_tape_copy_buffer(copy_buffer, COPY_BUFFER_SIZE);
// copy_buffer[ftell(page_source_file)% COPY_BUFFER_SIZE] = fgetc(page_source_file);
// if(copy_buffer[ftell(page_source_file)% COPY_BUFFER_SIZE] == EOF) {
// goto done_reading_write_file;