Skip to content

Commit

Permalink
Rename some variables to use English abbreviations
Browse files Browse the repository at this point in the history
  • Loading branch information
tsjensen committed Jan 1, 2024
1 parent daa8b6d commit 05019d6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/boxes.in.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ typedef struct {

reprule_t *current_rule;
reprule_t *reprules; /* applied when drawing a box */
size_t anz_reprules;
size_t num_reprules;
reprule_t *revrules; /* applied upon removal of a box */
size_t anz_revrules;
size_t num_revrules;
} design_t;

extern design_t *designs;
Expand Down
12 changes: 6 additions & 6 deletions src/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static int get_indent(const line_t *lines, const size_t lines_size)

int apply_substitutions(input_t *result, const int mode)
{
size_t anz_rules;
size_t num_rules;
reprule_t *rules;
size_t j, k;

Expand All @@ -104,11 +104,11 @@ int apply_substitutions(input_t *result, const int mode)
}

if (mode == 0) {
anz_rules = opt.design->anz_reprules;
num_rules = opt.design->num_reprules;
rules = opt.design->reprules;
}
else if (mode == 1) {
anz_rules = opt.design->anz_revrules;
num_rules = opt.design->num_revrules;
rules = opt.design->revrules;
}
else {
Expand All @@ -120,11 +120,11 @@ int apply_substitutions(input_t *result, const int mode)
* Compile regular expressions
*/
#ifdef REGEXP_DEBUG
fprintf(stderr, "Compiling %d %s rule patterns\n", (int) anz_rules, mode ? "reversion" : "replacement");
fprintf(stderr, "Compiling %d %s rule patterns\n", (int) num_rules, mode ? "reversion" : "replacement");
#endif
errno = 0;
opt.design->current_rule = rules;
for (j = 0; j < anz_rules; ++j, ++(opt.design->current_rule)) {
for (j = 0; j < num_rules; ++j, ++(opt.design->current_rule)) {
rules[j].prog = u32_compile_pattern(rules[j].search->memory);
if (rules[j].prog == NULL) {
return 5;
Expand All @@ -140,7 +140,7 @@ int apply_substitutions(input_t *result, const int mode)
*/
for (k = 0; k < result->num_lines; ++k) {
opt.design->current_rule = rules;
for (j = 0; j < anz_rules; ++j, ++(opt.design->current_rule)) {
for (j = 0; j < num_rules; ++j, ++(opt.design->current_rule)) {
#ifdef REGEXP_DEBUG
char *outtext = bxs_to_output(result->lines[k].text);
char *outrepstr = bxs_to_output(rules[j].repstr);
Expand Down
12 changes: 6 additions & 6 deletions src/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,12 @@ static void print_design_details(design_t *d)
}

fprintf(opt.outfile, "Replacement Rules: ");
if (d->anz_reprules > 0) {
for (int i = 0; i < (int) d->anz_reprules; ++i) {
if (d->num_reprules > 0) {
for (int i = 0; i < (int) d->num_reprules; ++i) {
fprintf(opt.outfile, "%d. (%s) \"%s\" WITH \"%s\"%s", i + 1,
d->reprules[i].mode == 'g' ? "glob" : "once",
bxs_to_output(d->reprules[i].search), bxs_to_output(d->reprules[i].repstr), opt.eol);
if (i < (int) d->anz_reprules - 1) {
if (i < (int) d->num_reprules - 1) {
fprintf(opt.outfile, " ");
}
}
Expand All @@ -253,12 +253,12 @@ static void print_design_details(design_t *d)
fprintf(opt.outfile, "none%s", opt.eol);
}
fprintf(opt.outfile, "Reversion Rules: ");
if (d->anz_revrules > 0) {
for (int i = 0; i < (int) d->anz_revrules; ++i) {
if (d->num_revrules > 0) {
for (int i = 0; i < (int) d->num_revrules; ++i) {
fprintf(opt.outfile, "%d. (%s) \"%s\" TO \"%s\"%s", i + 1,
d->revrules[i].mode == 'g' ? "glob" : "once",
bxs_to_output(d->revrules[i].search), bxs_to_output(d->revrules[i].repstr), opt.eol);
if (i < (int) d->anz_revrules - 1) {
if (i < (int) d->num_revrules - 1) {
fprintf(opt.outfile, " ");
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,12 @@ block: YSAMPLE STRING YENDSAMPLE

| YREPLACE rflag STRING YWITH STRING
{
invoke_action(action_add_regex_rule(bison_args, "rep", &curdes.reprules, &curdes.anz_reprules, $3, $5, $2));
invoke_action(action_add_regex_rule(bison_args, "rep", &curdes.reprules, &curdes.num_reprules, $3, $5, $2));
}

| YREVERSE rflag STRING YTO STRING
{
invoke_action(action_add_regex_rule(bison_args, "rev", &curdes.revrules, &curdes.anz_revrules, $3, $5, $2));
invoke_action(action_add_regex_rule(bison_args, "rev", &curdes.revrules, &curdes.num_revrules, $3, $5, $2));
}

| YPADDING '{' wlist '}'
Expand Down

0 comments on commit 05019d6

Please sign in to comment.