-
-
Notifications
You must be signed in to change notification settings - Fork 84
expand.c: Add "maximum" and "minimum" to math. #1176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I would like to know more about the use case, since expansion variables aren't really conditionals. To me this sounds more like conditionals should be extended to be able to test this, but unsure if expansion variables are the best place to add some conditional like this. |
Also as a |
It's currently possible to find out which of two values is greater indirectly by using Putting < and > in
Maybe a separate expansion variable for numerical comparisons? Maximum and minimum could go in as well. |
I think we need to be a bit careful here... The DSL in fvwm isn't formal; we're in danger here of creating a reverse-polish engine with The original use-case of introducing these placeholders was to allow for a more direct route to performing simple arithmetic logic, without requiring things like But there will also come a point where one needs to consider Whether we allow this PR nor not, is unclear to me. I do agree with @somiaj though that any |
In terms of an operation on integers, |
OK, I can see that. Would you be able to come up with a suitable list?
This example is employing a "hack"; look at its implementation -- if anything I'd rather see it be converted to be a subset of the math(s) code we're referring to here. Either way... my point here still stands that we do still need to be careful about how we expect users to use this. Maybe that's out of scope to this PR, I grant you -- but I also don't want to just merge this PR bindly. Sorry, @pghvlaans -- but if I decide I wish to increase the scope of this at the expense of this PR, I shall... |
Oh, sure, no worries. |
09a24c8
to
d0e1071
Compare
Forgot to do the discussed change to maximum and minimum. |
doc/fvwm3_manpage_source.adoc
Outdated
The comma in "<x>,<y>" is to allow for a future possibility of using floats. | ||
Maximum (>) returns the greater of two values, and minimum (<) the lesser. | ||
All operations use C integer mathematics. The result of integer division is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this up to the list of all the other operations in the previous paragraph. The statement is out of place here in talking about floats and integer math.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to previous paragraph, merged in intervening commits, squashed and force pushed.
Your merge/force push broke your patch, it now contains all the recent stuff added to main too. The diff should only contain your changes (though unsure where the issue is I'm just going off of what github shows me the commit diff is) |
Sorry, brain fart. I'll fix it and push again in a few minutes. EDIT: Done. |
# changes ### Enhancements * FvwmRearrange: Use -on_screen to tile/cascade all windows on the monitor. by @pghvlaans in fvwmorg/fvwm3#1170 * FvwmRearrange: Add -win_cmd COMMAND option. by @somiaj in fvwmorg/fvwm3#1179 * expand.c: Add "maximum" and "minimum" to math. by @pghvlaans in fvwmorg/fvwm3#1176 ### Other Changes * build: macos: fix path to fribidi by @ThomasAdam in fvwmorg/fvwm3#1174 * fvwm-convert-2.6: fix syntax error by @ThomasAdam in fvwmorg/fvwm3#1177 * style: remove superfluous debug by @ThomasAdam in fvwmorg/fvwm3#1181 * Remove autotools & modernise build CI/CD by @ThomasAdam in fvwmorg/fvwm3#1191 * build: remove go-1.14.0 check by @ThomasAdam in fvwmorg/fvwm3#1195 * Fix crash in FvwmPager and clarify Balloons option. by @somiaj in fvwmorg/fvwm3#1197 * build: modify release version script by @ThomasAdam in fvwmorg/fvwm3#1201 * meson: do a link test for `locale_charset()` by @Kangie in fvwmorg/fvwm3#1203 * Small RandR fixes by @ThomasAdam in fvwmorg/fvwm3#1207 * setup_visible_names: don't ignore when both set by @ThomasAdam in fvwmorg/fvwm3#1208
This commit would add
<
(minimum) and>
(maximum) to the list of available operations in$[math]
. I think this could potentially be used to do some interesting things, such as determining the orientation of a rotating monitor in a portable way.