gbranden pushed a commit to branch master
in repository groff.
commit 6a71c06393a2fd54f0da5c775cc256da85800d26
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Nov 16 10:15:41 2026 -0600
[pic]: Trivially refactor.
Rename `lookup_variable()` function to `look_up_variable()`. "Lookup"
is a (somewhat informal) noun, while "look up" is a verb.
* src/preproc/pic/object.h: Update declaration.
* src/preproc/pic/pic.ypp: Update definition.
* src/preproc/pic/lex.cpp (for_input::get, for_input::peek):
* src/preproc/pic/object.cpp (output::compute_scale)
(object_spec::make_box)
(object_spec::make_text)
(object_spec::make_ellipse)
(object_spec::make_circle)
(object_spec::make_line)
(object_spec::make_arc)
(object_spec::make_linear)
(object_spec::make_object)
(print_picture): Update call sites.
---
ChangeLog | 20 ++++++++++++++++++++
src/preproc/pic/lex.cpp | 4 ++--
src/preproc/pic/object.cpp | 36 ++++++++++++++++++------------------
src/preproc/pic/object.h | 2 +-
src/preproc/pic/pic.ypp | 30 +++++++++++++++---------------
5 files changed, 56 insertions(+), 36 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d6a786d9a..85bfd4a41 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2026-11-16 G. Branden Robinson <[email protected]>
+
+ [pic]: Trivially refactor. Rename `lookup_variable()` function
+ to `look_up_variable()`. "Lookup" is a (somewhat informal)
+ noun, while "look up" is a verb.
+
+ * src/preproc/pic/object.h: Update declaration.
+ * src/preproc/pic/pic.ypp: Update definition.
+ * src/preproc/pic/lex.cpp (for_input::get, for_input::peek):
+ * src/preproc/pic/object.cpp (output::compute_scale)
+ (object_spec::make_box)
+ (object_spec::make_text)
+ (object_spec::make_ellipse)
+ (object_spec::make_circle)
+ (object_spec::make_line)
+ (object_spec::make_arc)
+ (object_spec::make_linear)
+ (object_spec::make_object)
+ (print_picture): Update call sites.
+
2026-11-16 G. Branden Robinson <[email protected]>
[tbl]: Boolify AT&T compatibility flag.
diff --git a/src/preproc/pic/lex.cpp b/src/preproc/pic/lex.cpp
index 8ad58bbd9..3b9d45779 100644
--- a/src/preproc/pic/lex.cpp
+++ b/src/preproc/pic/lex.cpp
@@ -1480,7 +1480,7 @@ int for_input::get()
return '\n';
}
double val;
- if (!lookup_variable(var, &val)) {
+ if (!look_up_variable(var, &val)) {
lex_error("body of 'for' terminated enclosing block");
return EOF;
}
@@ -1508,7 +1508,7 @@ int for_input::peek()
if (!done_newline)
return '\n';
double val;
- if (!lookup_variable(var, &val))
+ if (!look_up_variable(var, &val))
return EOF;
if (by_is_multiplicative) {
if (val * by > to)
diff --git a/src/preproc/pic/object.cpp b/src/preproc/pic/object.cpp
index a57329235..e128d4df5 100644
--- a/src/preproc/pic/object.cpp
+++ b/src/preproc/pic/object.cpp
@@ -102,9 +102,9 @@ double output::compute_scale(double sc, const position &ll,
const position &ur)
sc = 1.0;
distance sdim = dim/sc;
double max_width = 0.0;
- lookup_variable("maxpswid", &max_width);
+ look_up_variable("maxpswid", &max_width);
double max_height = 0.0;
- lookup_variable("maxpsht", &max_height);
+ look_up_variable("maxpsht", &max_height);
if ((max_width > 0.0 && sdim.x > max_width)
|| (max_height > 0.0 && sdim.y > max_height)) {
double xscale = dim.x/max_width;
@@ -859,19 +859,19 @@ graphic_object *object_spec::make_box(position *curpos,
direction *dirp)
if ((flags & IS_SAME) && have_last_box)
height = last_box_height;
else
- lookup_variable("boxht", &height);
+ look_up_variable("boxht", &height);
}
if (!(flags & HAS_WIDTH)) {
if ((flags & IS_SAME) && have_last_box)
width = last_box_width;
else
- lookup_variable("boxwid", &width);
+ look_up_variable("boxwid", &width);
}
if (!(flags & HAS_RADIUS)) {
if ((flags & IS_SAME) && have_last_box)
radius = last_box_radius;
else
- lookup_variable("boxrad", &radius);
+ look_up_variable("boxrad", &radius);
}
last_box_width = width;
last_box_height = height;
@@ -1046,14 +1046,14 @@ text_object::text_object(const position &d)
graphic_object *object_spec::make_text(position *curpos, direction *dirp)
{
if (!(flags & HAS_HEIGHT)) {
- lookup_variable("textht", &height);
+ look_up_variable("textht", &height);
int nitems = 0;
for (text_item *t = text; t; t = t->next)
nitems++;
height *= nitems;
}
if (!(flags & HAS_WIDTH))
- lookup_variable("textwid", &width);
+ look_up_variable("textwid", &width);
text_object *p = new text_object(position(width, height));
if (!position_rectangle(p, curpos, dirp)) {
delete p;
@@ -1102,13 +1102,13 @@ graphic_object *object_spec::make_ellipse(position
*curpos, direction *dirp)
if ((flags & IS_SAME) && have_last_ellipse)
height = last_ellipse_height;
else
- lookup_variable("ellipseht", &height);
+ look_up_variable("ellipseht", &height);
}
if (!(flags & HAS_WIDTH)) {
if ((flags & IS_SAME) && have_last_ellipse)
width = last_ellipse_width;
else
- lookup_variable("ellipsewid", &width);
+ look_up_variable("ellipsewid", &width);
}
last_ellipse_width = width;
last_ellipse_height = height;
@@ -1150,7 +1150,7 @@ graphic_object *object_spec::make_circle(position
*curpos, direction *dirp)
if ((flags & IS_SAME) && have_last_circle)
radius = last_circle_radius;
else
- lookup_variable("circlerad", &radius);
+ look_up_variable("circlerad", &radius);
}
last_circle_radius = radius;
have_last_circle = 1;
@@ -1668,7 +1668,7 @@ linear_object *object_spec::make_line(position *curpos,
direction *dirp)
v[i] = s->pos;
}
if (flags & IS_DEFAULT_CHOPPED) {
- lookup_variable("circlerad", &start_chop);
+ look_up_variable("circlerad", &start_chop);
end_chop = start_chop;
flags |= IS_CHOPPED;
}
@@ -1942,7 +1942,7 @@ linear_object *object_spec::make_arc(position *curpos,
direction *dirp)
else
startpos = *curpos;
if (!(flags & HAS_RADIUS))
- lookup_variable("arcrad", &radius);
+ look_up_variable("arcrad", &radius);
// compute the end
position endpos;
if (flags & HAS_TO)
@@ -2010,13 +2010,13 @@ graphic_object *object_spec::make_linear(position
*curpos, direction *dirp)
if (flags & HAS_HEIGHT)
a.height = height;
else
- lookup_variable("arrowht", &a.height);
+ look_up_variable("arrowht", &a.height);
if (flags & HAS_WIDTH)
a.width = width;
else
- lookup_variable("arrowwid", &a.width);
+ look_up_variable("arrowwid", &a.width);
double solid;
- lookup_variable("arrowhead", &solid);
+ look_up_variable("arrowhead", &solid);
a.solid = solid != 0.0;
obj->add_arrows(at_start, at_end, a);
}
@@ -2071,7 +2071,7 @@ object *object_spec::make_object(position *curpos,
direction *dirp)
if (flags & HAS_THICKNESS)
th = thickness;
else
- lookup_variable("linethick", &th);
+ look_up_variable("linethick", &th);
obj->set_thickness(th);
if (flags & IS_OUTLINED)
obj->set_outline_color(outlined);
@@ -2084,7 +2084,7 @@ object *object_spec::make_object(position *curpos,
direction *dirp)
obj->set_fill_color(shaded);
else {
if (flags & IS_DEFAULT_FILLED)
- lookup_variable("fillval", &fill);
+ look_up_variable("fillval", &fill);
if (fill < 0.0)
error("bad fill value %1", fill);
else
@@ -2216,7 +2216,7 @@ void print_picture(object *obj)
for (object *p = obj; p; p = p->next)
p->update_bounding_box(&bb);
double scale;
- lookup_variable("scale", &scale);
+ look_up_variable("scale", &scale);
out->start_picture(scale, bb.ll, bb.ur);
print_object_list(obj);
out->finish_picture();
diff --git a/src/preproc/pic/object.h b/src/preproc/pic/object.h
index f65307d50..0422c6922 100644
--- a/src/preproc/pic/object.h
+++ b/src/preproc/pic/object.h
@@ -232,7 +232,7 @@ object *make_object(object_spec *, position *, direction *);
object *make_mark_object();
object *make_command_object(char *, const char *, int);
-int lookup_variable(const char *name, double *val);
+int look_up_variable(const char *name, double *val);
void define_variable(const char *name, double val);
void print_picture(object *);
diff --git a/src/preproc/pic/pic.ypp b/src/preproc/pic/pic.ypp
index 7a65b1c07..e8b217297 100644
--- a/src/preproc/pic/pic.ypp
+++ b/src/preproc/pic/pic.ypp
@@ -687,36 +687,36 @@ object_spec:
| LINE
{
$$ = new object_spec(LINE_OBJECT);
- lookup_variable("lineht", & $$->segment_height);
- lookup_variable("linewid", & $$->segment_width);
+ look_up_variable("lineht", & $$->segment_height);
+ look_up_variable("linewid", & $$->segment_width);
$$->dir = current_direction;
}
| POLYGON
{
$$ = new object_spec(POLYGON_OBJECT);
- lookup_variable("lineht", & $$->segment_height);
- lookup_variable("linewid", & $$->segment_width);
+ look_up_variable("lineht", & $$->segment_height);
+ look_up_variable("linewid", & $$->segment_width);
$$->dir = current_direction;
}
| ARROW
{
$$ = new object_spec(ARROW_OBJECT);
- lookup_variable("lineht", & $$->segment_height);
- lookup_variable("linewid", & $$->segment_width);
+ look_up_variable("lineht", & $$->segment_height);
+ look_up_variable("linewid", & $$->segment_width);
$$->dir = current_direction;
}
| MOVE
{
$$ = new object_spec(MOVE_OBJECT);
- lookup_variable("moveht", & $$->segment_height);
- lookup_variable("movewid", & $$->segment_width);
+ look_up_variable("moveht", & $$->segment_height);
+ look_up_variable("movewid", & $$->segment_width);
$$->dir = current_direction;
}
| SPLINE
{
$$ = new object_spec(SPLINE_OBJECT);
- lookup_variable("lineht", & $$->segment_height);
- lookup_variable("linewid", & $$->segment_width);
+ look_up_variable("lineht", & $$->segment_height);
+ look_up_variable("linewid", & $$->segment_width);
$$->dir = current_direction;
}
| text %prec TEXT
@@ -961,7 +961,7 @@ object_spec:
{
$$ = $1;
$$->flags |= IS_DOTTED;
- lookup_variable("dashwid", & $$->dash_width);
+ look_up_variable("dashwid", & $$->dash_width);
}
| object_spec DOTTED expr
{
@@ -973,7 +973,7 @@ object_spec:
{
$$ = $1;
$$->flags |= IS_DASHED;
- lookup_variable("dashwid", & $$->dash_width);
+ look_up_variable("dashwid", & $$->dash_width);
}
| object_spec DASHED expr
{
@@ -1584,7 +1584,7 @@ expr_lower_than:
expr_not_lower_than:
VARIABLE
{
- if (!lookup_variable($1, & $$)) {
+ if (!look_up_variable($1, & $$)) {
lex_error("there is no variable '%1'", $1);
YYABORT;
}
@@ -1830,7 +1830,7 @@ void define_label(const char *label, const place *pl)
current_table->define(label, p);
}
-int lookup_variable(const char *name, double *val)
+int look_up_variable(const char *name, double *val)
{
place *pl = lookup_label(name);
if (pl) {
@@ -1876,7 +1876,7 @@ static void reset(const char *nm)
double val = defaults_table[i].val;
if (defaults_table[i].scaled) {
double scale;
- lookup_variable("scale", &scale);
+ look_up_variable("scale", &scale);
val *= scale;
}
define_variable(defaults_table[i].name, val);
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit