summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimo Savinen <tjsa@iki.fi>2005-10-16 10:48:56 +0000
committerHadrien Dorio <hadrien.dorio@gmail.com>2017-12-16 00:24:06 +0100
commitd33af5172f7d8c403c097f0eadfcc35ed766e1fd (patch)
tree654c3daa39ab20c8e82358a9def359bddcfcd88b /src
parentb8e1dc4200c8e57024b9a37edc67f9a24c02f0e5 (diff)
downloadbinary-block-editor-d33af5172f7d8c403c097f0eadfcc35ed766e1fd.tar.gz
binary-block-editor-d33af5172f7d8c403c097f0eadfcc35ed766e1fd.zip
0.1.4
Diffstat (limited to 'src')
-rw-r--r--src/bbe.c47
-rw-r--r--src/bbe.h19
-rw-r--r--src/buffer.c10
-rw-r--r--src/execute.c471
4 files changed, 292 insertions, 255 deletions
diff --git a/src/bbe.c b/src/bbe.c
index ae456cc..0de3695 100644
--- a/src/bbe.c
+++ b/src/bbe.c
@@ -20,7 +20,7 @@
*
*/
-/* $Id: bbe.c,v 1.35 2005/10/06 16:48:06 timo Exp $ */
+/* $Id: bbe.c,v 1.37 2005/10/14 14:04:45 timo Exp $ */
#include "bbe.h"
#ifdef HAVE_GETOPT_H
@@ -57,7 +57,7 @@ static char *email_address = "tjsa@iki.fi";
struct block block;
/* commands to be executed */
-struct command *commands = NULL;
+struct commands cmds;
/* extra info for panic */
char *panic_info = NULL;
@@ -71,6 +71,14 @@ char *convert_strings[] = {
"ASCBCD",
"",
};
+/* commands to be executed at start of buffer */
+#define BLOCK_START_COMMANDS "DIJLFBN"
+
+/* commands to be executed for each byte */
+#define BYTE_COMMANDS "acdirsywjpl&|^~"
+
+/* commands to be executed at end of buffer */
+#define BLOCK_END_COMMANDS "A"
/* format types for p command */
char *p_formats="DOHAB";
@@ -385,7 +393,7 @@ parse_block(char *bs)
void
parse_command(char *command_string)
{
- struct command *curr,*new;
+ struct command_list *curr,*new,**start;
char *c,*p,*buf;
char *f;
char *token[10];
@@ -407,16 +415,32 @@ parse_command(char *command_string)
while(token[i - 1] != NULL && i < 10) token[i++] = strtok(NULL," \t\n");
i--;
- curr = commands;
+ if(strchr(BLOCK_START_COMMANDS,token[0][0]) != NULL)
+ {
+ curr = cmds.block_start;
+ start = &cmds.block_start;
+ } else if(strchr(BYTE_COMMANDS,token[0][0]) != NULL)
+ {
+ curr = cmds.byte;
+ start = &cmds.byte;
+ } else if(strchr(BLOCK_END_COMMANDS,token[0][0]) != NULL)
+ {
+ curr = cmds.block_end;
+ start = &cmds.block_end;
+ } else
+ {
+ panic("Error in command",command_string,NULL);
+ }
+
if (curr != NULL)
{
while(curr->next != NULL) curr = curr->next;
}
- new = xmalloc(sizeof(struct command));
+ new = xmalloc(sizeof(struct command_list));
new->next = NULL;
- if(commands == NULL)
+ if(curr == NULL)
{
- commands = new;
+ *start = new;
} else
{
curr->next = new;
@@ -707,6 +731,9 @@ main (int argc, char **argv)
int opt;
block.type = 0;
+ cmds.block_start = NULL;
+ cmds.byte = NULL;
+ cmds.block_end = NULL;
#ifdef HAVE_GETOPT_LONG
while ((opt = getopt_long(argc,argv,short_opts,long_opts,NULL)) != -1)
#else
@@ -757,8 +784,8 @@ main (int argc, char **argv)
}
init_buffer();
- init_commands(commands);
- execute_program(commands);
- close_commands(commands);
+ init_commands(&cmds);
+ execute_program(&cmds);
+ close_commands(&cmds);
exit(EXIT_SUCCESS);
}
diff --git a/src/bbe.h b/src/bbe.h
index 02a166f..7546d81 100644
--- a/src/bbe.h
+++ b/src/bbe.h
@@ -20,7 +20,7 @@
*
*/
-/* $Id: bbe.h,v 1.24 2005/09/29 11:27:01 timo Exp $ */
+/* $Id: bbe.h,v 1.25 2005/10/13 13:48:46 timo Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -100,7 +100,7 @@ struct block {
/* Commands */
-struct command {
+struct command_list {
char letter; // command letter (D,A,s,..)
off_t offset; // n for D,r,i and d commands
off_t count; // count for d command
@@ -110,7 +110,13 @@ struct command {
off_t s2_len;
int rpos; // replace position for s,r and y
FILE *fd; // stream for w command
- struct command *next;
+ struct command_list *next;
+};
+
+struct commands {
+ struct command_list *block_start;
+ struct command_list *byte;
+ struct command_list *block_end;
};
/* in/out files */
@@ -136,6 +142,7 @@ struct input_buffer {
/* output buffer */
struct output_buffer {
unsigned char *buffer;
+ unsigned char *end;
unsigned char *write_pos; // current write psotion;
unsigned char *low_pos; // low water mark
unsigned char *cycle_start; // at this position started the last command cycle
@@ -189,10 +196,10 @@ extern void
flush_buffer();
extern void
-init_commands(struct command *c);
+init_commands(struct commands *c);
extern void
-close_commands(struct command *c);
+close_commands(struct commands *c);
extern inline void
set_cycle_start();
@@ -204,7 +211,7 @@ extern void
write_w_command(unsigned char *buf,size_t length);
extern void
-execute_program(struct command *c);
+execute_program(struct commands *c);
extern void
reverse_bytes(size_t count);
diff --git a/src/buffer.c b/src/buffer.c
index d7a5b4e..f05ffca 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -20,7 +20,7 @@
*
*/
-/* $Id: buffer.c,v 1.30 2005/09/30 10:58:15 timo Exp $ */
+/* $Id: buffer.c,v 1.32 2005/10/14 13:25:54 timo Exp $ */
#include "bbe.h"
#include <stdlib.h>
@@ -140,6 +140,7 @@ init_buffer()
in_buffer.block_num = 0;
out_buffer.buffer = xmalloc(OUTPUT_BUFFER_SIZE);
+ out_buffer.end = out_buffer.buffer + OUTPUT_BUFFER_SIZE;
out_buffer.write_pos = out_buffer.buffer;
out_buffer.low_pos = out_buffer.buffer + OUTPUT_BUFFER_SAFE;
}
@@ -311,7 +312,7 @@ mark_block_end()
}
if(i)
{
- scan -= i;
+ scan -= i - 1;
} else
{
scan++;
@@ -320,7 +321,7 @@ mark_block_end()
if (i == block.start.S.length)
{
- in_buffer.block_end = scan - 1;
+ in_buffer.block_end = scan - 2;
}
} else
{
@@ -405,6 +406,7 @@ find_block()
if(block.start.S.length > 0)
{
i = 0;
+ if(in_buffer.stream_end == NULL) safe_search += block.start.S.length - 1;
while(in_buffer.read_pos <= safe_search - block.start.S.length + 1 && i < block.start.S.length)
{
i = 0;
@@ -501,7 +503,7 @@ write_next_byte()
out_buffer.write_pos++;
out_buffer.block_offset++;
- if(out_buffer.write_pos > out_buffer.buffer + OUTPUT_BUFFER_SIZE)
+ if(out_buffer.write_pos > out_buffer.end)
{
save_pos = out_buffer.cycle_start < out_buffer.low_pos ? out_buffer.cycle_start : out_buffer.low_pos;
if(save_pos == out_buffer.buffer)
diff --git a/src/execute.c b/src/execute.c
index ffadc3c..b0a29cd 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -20,7 +20,7 @@
*
*/
-/* $Id: execute.c,v 1.25 2005/10/05 16:06:11 timo Exp $ */
+/* $Id: execute.c,v 1.27 2005/10/14 13:23:20 timo Exp $ */
#include "bbe.h"
#include <stdlib.h>
@@ -35,21 +35,14 @@ static int delete_this_byte;
/* tells if current block should be deleted */
static int delete_this_block;
+/* tells if current block should be skipped */
+static int skip_this_block;
+
/* tells if i or s commands are inserting bytes, meaningfull at end of the block */
static int inserting;
/* command list for write_w_command */
-static struct command *current_commands;
-
-/* commands to be executed at start of buffer */
-/* note J and L must be in every string becaus ethey affect the whole block */
-#define BLOCK_START_COMMANDS "DIJLFBN"
-
-/* commands to be executed for each byte */
-#define BYTE_COMMANDS "acdirsywjplJL&|^~"
-
-/* commands to be executed at end of buffer */
-#define BLOCK_END_COMMANDS "AJL"
+static struct command_list *current_byte_commands;
/* most significant bit of byte */
#define BYTE_MASK (1 << (sizeof(unsigned char) * 8 - 1))
@@ -63,7 +56,6 @@ byte_to_string(unsigned char byte,char format)
{
static char string[128];
int i;
- int j;
switch(format)
{
@@ -124,76 +116,75 @@ off_t_to_string(off_t number,char format)
/* execute given commands */
void
-execute_commands(struct command *c,char *command_letters)
+execute_commands(struct command_list *c)
{
register int i;
unsigned char a,b;
unsigned char *p;
char *str;
+ if(skip_this_block) return;
while(c != NULL)
{
- if(strchr(command_letters,c->letter) != NULL)
+ switch(c->letter)
{
- switch(c->letter)
- {
- case 'A':
- case 'I':
- write_buffer(c->s1,c->s1_len);
- break;
- case 'd':
- if(c->rpos || c->offset == in_buffer.block_offset)
- {
- if(c->rpos < c->count)
- {
- delete_this_byte = 1;
- c->rpos++;
- } else
- {
- c->rpos = 0;
- }
- }
- break;
- case 'D':
- if(c->offset == in_buffer.block_num || c->offset == 0) delete_this_block = 1;
- break;
- case 'i':
- if(c->offset == in_buffer.block_offset && !c->rpos)
- {
- c->rpos = 1;
- inserting = 1;
- break;
- }
- if(c->rpos > 0 && c->rpos <= c->s1_len)
+ case 'A':
+ case 'I':
+ write_buffer(c->s1,c->s1_len);
+ break;
+ case 'd':
+ if(c->rpos || c->offset == in_buffer.block_offset)
+ {
+ if(c->rpos < c->count)
{
- if(c->rpos <= c->s1_len)
- {
- put_byte(c->s1[c->rpos - 1]);
- if(c->rpos < c->s1_len) inserting = 1;
- }
+ delete_this_byte = 1;
c->rpos++;
+ } else
+ {
+ c->rpos = 0;
}
+ }
+ break;
+ case 'D':
+ if(c->offset == in_buffer.block_num || c->offset == 0) delete_this_block = 1;
+ break;
+ case 'i':
+ if(c->offset == in_buffer.block_offset && !c->rpos)
+ {
+ c->rpos = 1;
+ inserting = 1;
break;
- case 'r':
- if(in_buffer.block_offset >= c->offset &&
- in_buffer.block_offset < c->offset + c->s1_len)
+ }
+ if(c->rpos > 0 && c->rpos <= c->s1_len)
+ {
+ if(c->rpos <= c->s1_len)
{
- put_byte(c->s1[in_buffer.block_offset - c->offset]);
+ put_byte(c->s1[c->rpos - 1]);
+ if(c->rpos < c->s1_len) inserting = 1;
}
- break;
- case 's':
- if(c->rpos)
+ c->rpos++;
+ }
+ break;
+ case 'r':
+ if(in_buffer.block_offset >= c->offset &&
+ in_buffer.block_offset < c->offset + c->s1_len)
+ {
+ put_byte(c->s1[in_buffer.block_offset - c->offset]);
+ }
+ break;
+ case 's':
+ if(c->rpos)
+ {
+ if(c->rpos < c->s1_len && c->rpos < c->s2_len)
{
- if(c->rpos < c->s1_len && c->rpos < c->s2_len)
- {
- put_byte(c->s2[c->rpos]);
- } else if (c->rpos < c->s1_len && c->rpos >= c->s2_len)
- {
- delete_this_byte = 1;
- } else if(c->rpos >= c->s1_len && c->rpos < c->s2_len)
- {
- put_byte(c->s2[c->rpos]);
- }
+ put_byte(c->s2[c->rpos]);
+ } else if (c->rpos < c->s1_len && c->rpos >= c->s2_len)
+ {
+ delete_this_byte = 1;
+ } else if(c->rpos >= c->s1_len && c->rpos < c->s2_len)
+ {
+ put_byte(c->s2[c->rpos]);
+ }
if(c->rpos >= c->s1_len - 1 && c->rpos < c->s2_len - 1)
{
@@ -206,178 +197,179 @@ execute_commands(struct command *c,char *command_letters)
c->rpos = 0;
}
break;
- }
- if(delete_this_byte) break;
- p = out_buffer.write_pos;
- i = 0;
- while(*p == c->s1[i] && i < c->s1_len)
+ }
+ if(delete_this_byte) break;
+ p = out_buffer.write_pos;
+ i = 0;
+ while(*p == c->s1[i] && i < c->s1_len)
+ {
+ if(p == out_buffer.write_pos) p = read_pos();
+ if(p == block_end_pos() && c->s1_len - 1 > i) break;
+ i++;
+ p++;
+ }
+ if(i == c->s1_len)
+ {
+ if(c->s1_len > 1 || c->s2_len > 1) c->rpos = 1;
+ if(c->s2_len)
{
- if(p == out_buffer.write_pos) p = read_pos();
- if(p == block_end_pos() && c->s1_len - 1 > i) break;
- i++;
- p++;
- }
- if(i == c->s1_len)
+ put_byte(c->s2[0]);
+ if(c->s1_len == 1 && c->s2_len > 1) inserting = 1;
+ } else
{
- if(c->s1_len > 1 || c->s2_len > 1) c->rpos = 1;
- if(c->s2_len)
- {
- put_byte(c->s2[0]);
- if(c->s1_len == 1 && c->s2_len > 1) inserting = 1;
- } else
- {
- delete_this_byte = 1;
- }
+ delete_this_byte = 1;
}
- break;
- case 'y':
- i = 0;
- while(c->s1[i] != *out_buffer.write_pos && i < c->s1_len) i++;
- if(c->s1[i] == *out_buffer.write_pos && i < c->s1_len) put_byte(c->s2[i]);
- break;
- case 'c':
- switch(c->s1[0])
- {
- case 'A': // from ascii
- switch(c->s1[3])
- {
- case 'B': // to bcd
- if(c->rpos || (last_byte() && out_buffer.block_offset == 0)) // skip first nibble
- {
- c->rpos = 0;
- if(last_byte()) // unless last byte of block
- {
- if(*out_buffer.write_pos >= '0' && *out_buffer.write_pos <= '9')
- {
- a = *out_buffer.write_pos - '0';
- a = (a << 4) & 0xf0;
- b = 0x0f;
- *out_buffer.write_pos = a | b;
- }
- }
- break;
- }
- if(out_buffer.block_offset == 0 || delete_this_byte) break;
- if((out_buffer.write_pos[-1] >= '0' && out_buffer.write_pos[-1] <= '9'))
+ }
+ break;
+ case 'y':
+ i = 0;
+ while(c->s1[i] != *out_buffer.write_pos && i < c->s1_len) i++;
+ if(c->s1[i] == *out_buffer.write_pos && i < c->s1_len) put_byte(c->s2[i]);
+ break;
+ case 'c':
+ switch(c->s1[0])
+ {
+ case 'A': // from ascii
+ switch(c->s1[3])
+ {
+ case 'B': // to bcd
+ if(c->rpos || (last_byte() && out_buffer.block_offset == 0)) // skip first nibble
+ {
+ c->rpos = 0;
+ if(last_byte()) // unless last byte of block
{
- a = out_buffer.write_pos[-1] - '0';
- a = (a << 4) & 0xf0;
- if(*out_buffer.write_pos >= '0' && *out_buffer.write_pos <= '9')
- {
- b = *out_buffer.write_pos - '0';
- b &= 0x0f;
- delete_this_byte = 1;
- c->rpos = 1;
- } else
+ if(*out_buffer.write_pos >= '0' && *out_buffer.write_pos <= '9')
{
+ a = *out_buffer.write_pos - '0';
+ a = (a << 4) & 0xf0;
b = 0x0f;
- if(*out_buffer.write_pos == 'F' || *out_buffer.write_pos == 'f') delete_this_byte=1;
+ *out_buffer.write_pos = a | b;
}
- out_buffer.write_pos[-1] = a | b;
}
break;
- }
- break;
- case 'B': // from bcd
- switch(c->s1[3])
- {
- case 'A': // to ascii
- if(((*out_buffer.write_pos >> 4) & 0x0f) <= 9 &&
- ((*out_buffer.write_pos & 0x0f) <= 9 || (*out_buffer.write_pos & 0x0f) == 0x0f))
+ }
+ if(out_buffer.block_offset == 0 || delete_this_byte) break;
+ if((out_buffer.write_pos[-1] >= '0' && out_buffer.write_pos[-1] <= '9'))
+ {
+ a = out_buffer.write_pos[-1] - '0';
+ a = (a << 4) & 0xf0;
+ if(*out_buffer.write_pos >= '0' && *out_buffer.write_pos <= '9')
+ {
+ b = *out_buffer.write_pos - '0';
+ b &= 0x0f;
+ delete_this_byte = 1;
+ c->rpos = 1;
+ } else
{
- a = (*out_buffer.write_pos >> 4) & 0x0f;
- b = *out_buffer.write_pos & 0x0f;
- *out_buffer.write_pos = '0' + a;
- if(!delete_this_byte)
+ b = 0x0f;
+ if(*out_buffer.write_pos == 'F' || *out_buffer.write_pos == 'f') delete_this_byte=1;
+ }
+ out_buffer.write_pos[-1] = a | b;
+ }
+ break;
+ }
+ break;
+ case 'B': // from bcd
+ switch(c->s1[3])
+ {
+ case 'A': // to ascii
+ if(((*out_buffer.write_pos >> 4) & 0x0f) <= 9 &&
+ ((*out_buffer.write_pos & 0x0f) <= 9 || (*out_buffer.write_pos & 0x0f) == 0x0f))
+ {
+ a = (*out_buffer.write_pos >> 4) & 0x0f;
+ b = *out_buffer.write_pos & 0x0f;
+ *out_buffer.write_pos = '0' + a;
+ if(!delete_this_byte)
+ {
+ write_next_byte();
+ if(b == 0x0f)
+ {
+ *out_buffer.write_pos = 'F';
+ } else
{
- write_next_byte();
- if(b == 0x0f)
- {
- *out_buffer.write_pos = 'F';
- } else
- {
- *out_buffer.write_pos = '0' + b;
- }
+ *out_buffer.write_pos = '0' + b;
}
}
- break;
- }
- break;
- }
- break;
- case 'j':
- if(in_buffer.block_offset < c->count)
- {
- while(c->next != NULL) c = c->next; // skip rest of commands
- }
- break;
- case 'J':
- if(in_buffer.block_num <= c->count)
- {
- while(c->next != NULL) c = c->next; // skip rest of commands
- }
- break;
- case 'l':
- if(in_buffer.block_offset >= c->count)
- {
- while(c->next != NULL) c = c->next; // skip rest of commands
- }
- break;
- case 'L':
- if(in_buffer.block_num > c->count)
- {
- while(c->next != NULL) c = c->next; // skip rest of commands
- }
- break;
- case 'p':
- if (delete_this_byte) break;
- i = 0;
- a = *out_buffer.write_pos;
- while(i < c->s1_len)
- {
- str = byte_to_string(a,c->s1[i]);
- write_string(str);
- i++;
- if (i < c->s1_len)
- {
- put_byte('-');
- write_next_byte();
+ }
+ break;
}
- }
- put_byte(' ');
- break;
- case 'F':
- str = off_t_to_string(in_buffer.stream_offset + (off_t) (in_buffer.read_pos-in_buffer.buffer),c->s1[0]);
- write_string(str);
- put_byte(':');
- write_next_byte();
- break;
- case 'B':
- str = off_t_to_string(in_buffer.block_num,c->s1[0]);
+ break;
+ }
+ break;
+ case 'j':
+ if(in_buffer.block_offset < c->count)
+ {
+ while(c->next != NULL) c = c->next; // skip rest of commands
+ }
+ break;
+ case 'J':
+ if(in_buffer.block_num <= c->count)
+ {
+ skip_this_block = 1;
+ return;
+ }
+ break;
+ case 'l':
+ if(in_buffer.block_offset >= c->count)
+ {
+ while(c->next != NULL) c = c->next; // skip rest of commands
+ }
+ break;
+ case 'L':
+ if(in_buffer.block_num > c->count)
+ {
+ skip_this_block = 1;
+ return;
+ }
+ break;
+ case 'p':
+ if (delete_this_byte) break;
+ i = 0;
+ a = *out_buffer.write_pos;
+ while(i < c->s1_len)
+ {
+ str = byte_to_string(a,c->s1[i]);
write_string(str);
- put_byte(':');
- write_next_byte();
- break;
- case 'N':
- write_string(get_current_file());
- put_byte(':');
- write_next_byte();
- break;
- case '&':
- put_byte(*out_buffer.write_pos & c->s1[0]);
- break;
- case '|':
- put_byte(*out_buffer.write_pos | c->s1[0]);
- break;
- case '^':
- put_byte(*out_buffer.write_pos ^ c->s1[0]);
- break;
- case '~':
- put_byte(~*out_buffer.write_pos);
- break;
- case 'w':
- break;
- }
+ i++;
+ if (i < c->s1_len)
+ {
+ put_byte('-');
+ write_next_byte();
+ }
+ }
+ put_byte(' ');
+ break;
+ case 'F':
+ str = off_t_to_string(in_buffer.stream_offset + (off_t) (in_buffer.read_pos-in_buffer.buffer),c->s1[0]);
+ write_string(str);
+ put_byte(':');
+ write_next_byte();
+ break;
+ case 'B':
+ str = off_t_to_string(in_buffer.block_num,c->s1[0]);
+ write_string(str);
+ put_byte(':');
+ write_next_byte();
+ break;
+ case 'N':
+ write_string(get_current_file());
+ put_byte(':');
+ write_next_byte();
+ break;
+ case '&':
+ put_byte(*out_buffer.write_pos & c->s1[0]);
+ break;
+ case '|':
+ put_byte(*out_buffer.write_pos | c->s1[0]);
+ break;
+ case '^':
+ put_byte(*out_buffer.write_pos ^ c->s1[0]);
+ break;
+ case '~':
+ put_byte(~*out_buffer.write_pos);
+ break;
+ case 'w':
+ break;
}
c = c->next;
}
@@ -387,9 +379,9 @@ execute_commands(struct command *c,char *command_letters)
void
write_w_command(unsigned char *buf,size_t length)
{
- struct command *c;
+ struct command_list *c;
- c = current_commands;
+ c = current_byte_commands;
while(c != NULL)
{
@@ -405,8 +397,12 @@ write_w_command(unsigned char *buf,size_t length)
/* init_commands, initialize those wich need it, currently w - open file and rpos=0 for all */
void
-init_commands(struct command *c)
+init_commands(struct commands *commands)
{
+ struct command_list *c;
+
+ c = commands->byte;
+
while(c != NULL)
{
switch(c->letter)
@@ -423,8 +419,12 @@ init_commands(struct command *c)
/* close_commands, close those wich need it, currently w - close file */
void
-close_commands(struct command *c)
+close_commands(struct commands *commands)
{
+ struct command_list *c;
+
+ c = commands->byte;
+
while(c != NULL)
{
switch(c->letter)
@@ -439,7 +439,7 @@ close_commands(struct command *c)
/* reset the rpos counter for next block, in case block was shorter eg. delete count */
inline void
-reset_rpos(struct command *c)
+reset_rpos(struct command_list *c)
{
while(c != NULL)
{
@@ -452,18 +452,19 @@ reset_rpos(struct command *c)
/* main execution loop */
void
-execute_program(struct command *c)
+execute_program(struct commands *commands)
{
int block_end;
- current_commands = c;
+ current_byte_commands = commands->byte;
while(find_block())
{
- reset_rpos(c);
+ reset_rpos(commands->byte);
delete_this_block = 0;
out_buffer.block_offset = 0;
- execute_commands(c,BLOCK_START_COMMANDS);
+ skip_this_block = 0;
+ execute_commands(commands->block_start);
do
{
set_cycle_start();
@@ -471,14 +472,14 @@ execute_program(struct command *c)
inserting = 0;
block_end = last_byte();
put_byte(read_byte()); // as default write current byte from input
- execute_commands(c,BYTE_COMMANDS);
+ execute_commands(commands->byte);
if(!delete_this_byte && !delete_this_block)
{
write_next_byte(); // advance the write pointer if byte is not marked for del
}
if(!block_end && !inserting) get_next_byte();
} while (!block_end || inserting);
- execute_commands(c,BLOCK_END_COMMANDS);
+ execute_commands(commands->block_end);
flush_buffer();
}
close_output_stream();
OpenPOWER on IntegriCloud