(tiny announcement) GVPR has native string concatenation (+)

OK, not real exciting, but I’ve always assumed that GVPR only supports string concatenation via sprintf. But GVPR also allows string concatenation via the “+” operator, like this:
newstr="one " + "two";
This makes code just a little easier to read.

By the way, it also supports these other string operators | & ^ % * but I haven’t figured them out. (see lib/expr/exeval.c)

You can see the implementations of each of these in:

  • |: str_ior
  • &: str_and
  • ^: str_xor
  • %: str_mod
  • *: str_mpy

They do something analogous to the relevant bitwise operation but on the string operands as if they were sets of bytes. Why you would want to do such a thing, I have no idea.

To simplify the implementation of gvpr, I relied on Glenn Fowler’s C-like expression library libexpr, part of the larger AST platform. This platform provides a good deal of solid, portable and flexible software for writing applications, and is the basis for lots of other tools. (Note that the AST libcdt is the fundamental library in Graphviz.) As I tried to keep the AST software used in gvpr in sync with the official version, there are lots of features in the library that are not relevant to gvpr, so inaccessible or undocumented.

I do note that I used ‘+’ as a string operator in some of the gvpr scripts supplied with the release, so it would be reasonable to document its use.