diff options
author | Anton Luka Šijanec <sijanecantonluka@gmail.com> | 2020-06-09 17:31:19 +0200 |
---|---|---|
committer | Anton Luka Šijanec <sijanecantonluka@gmail.com> | 2020-06-09 17:31:19 +0200 |
commit | 1006e7fb17e31ea501eca6834253d288c2f6da59 (patch) | |
tree | 64f28ec44b0563201ab18a881e8b58036208c2b1 /src/tape.c | |
parent | i dont know (diff) | |
download | bverbose-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.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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; |