[LinuxCNC/linuxcnc PR#98] Improve the ‘halcmd loadusr’ message when component is failing to load

未分类 bolang 4个月前 (10-15) 37次浏览

Issue #98 | 状态: 已关闭 | 作者: jepler | 创建时间: 2016-06-29

标签: enhancement


This series of commits converts halcmd_commands.c to C++, adds a new type-safe C++ wrapper around HAL shared memory, but all to improve the message shown while ‘loadusr’ is waiting for a component that may never load. Now a message like this is displayed when a component loads during this process, but its name is not what was expected:

While waiting for 'wrongname', component 'example' loaded.
Did you specify the correct name via 'loadusr -Wn'?


评论 (12)

#1 – andypugh 于 2020-04-08

Is this still a live pull-request? I am unclear what the force-push by cradek did.


#2 – jepler 于 2020-04-09

The force-push is attributed to cradek because this dates back to when we were operating our own git server. As far as I know, this PR still does something that master doesn’t.


#3 – andypugh 于 2021-03-31

I tried to solve the merge conflicts with this, but it is really quite messy in conjunction with https://github.com/LinuxCNC/linuxcnc/commit/05a37cfc0fc090052f8b757e6575b0f3c783ba8f

The results of an evening of trying are here:
https://github.com/LinuxCNC/linuxcnc/tree/andypugh/jepler_98


#4 – petterreinholdtsen 于 2022-07-14

Just for fun, I had a look at this patch. Instead of trying to merge in the latest changes to master, I rebased it on top of master and ended up with a fairly small patch that can be found in https://github.com/petterreinholdtsen/linuxcnc/tree/halcmd-cplusplus . Is this change still interesting? Seem like a usable goal to have a better error message and some type safety in the code.


#5 – jepler 于 2022-07-15

I think I was worried there was resistance to using C++ in mandatory parts of HAL, but if that ever was a real concern I don’t feel like it is anymore. Thanks for modernizing this!


#6 – c-morley 于 2022-07-15

Changing to C++ seems a bit much for only a small improvement.
I liked that HAL was C only.
My 2 cents.


#7 – petterreinholdtsen 于 2022-07-15

[c-morley]
> Changing to C++ seems a bit much for only a small improvement.
> I liked that HAL was C only.
> My 2 cents.

Is it type safety or the new error message you talk about when you
consider it a small improvement?

It look like C++ is already used quite a lot. Can you phrase a
description for the code style guide (docs/src/code/style-guide.adoc) to
explain where you believe C and C++ should be used? I believe it would
be useful for future contributors and it would be good to have a
discussion about where C and C++ should be used with basis on a concrete
proposal.


Happy hacking
Petter Reinholdtsen


#8 – c-morley 于 2022-07-15

New error message -small improvement.

Trying to avoid a ‘best language’ war but IMHO:

If we have a choice between having good feature code in a certain language or not having the good feature – mostly likely accept the code.

but if deciding which code to use, we should use the common linuxcnc codes (C,C++ and python)
and after that should try to keep the lowest programming bar that still get the desired feature.

We could write all of linuxcnc in C or C++ etc but then the project would likely die.
Occasionally I hear people complain that the GUIs are written in python which is slow, which is true.
But if you wrote them in C++ there would only be a couple of people (in this project) that could/would develop them. The correct answer is to use C/C++ for what needs it and use python/compiled python for the rest so the programming bar is held low.

another one is TCL programming, a couple of guys like it and we have a fair amount of that code in linuxcnc.
But they are the only ones that work on that code. I would prefer it if we didn’t add more, because it makes the maintenance problem worse.

S0 HAL was purposely written in C by John K, I would imagine because he liked C.
C is a great language for this use. there are lots of example/tutorials on the web. Interfacing Python modules are relatively easy to write with it. HAL is a very important part of the linuxcnc infrastructure, we should keep the programming bar low on it, so the maximum amount of people can understand and possibly expand it.

If some day we decide C is very much holding back HAL development well then that’s a different story.
Though in this project we hardly ever plan anything – it grows organically.

But then I’m just a small wheel in linuxcnc, mostly GUI code, I only dabble in the motion/HAL code, so this is just a personal perspective I felt important to get out.

Thanks


#9 – SebKuzminsky 于 2022-07-16

When John K wrote HAL, C++ was still somewhat immature, and I’m glad he didn’t use it then. But C++ has come a long way since then. I’m a fan of modern C++, and I’d be happy to see it used more in LinuxCNC, where appropriate.


#10 – petterreinholdtsen 于 2022-07-17

Perhaps this pull request can be updated using my rebased set of patches or a similar set of rebased patches to fix the merge conflict, to make it easier for the current guardians of the master branch to test it out?


#11 – jepler 于 2022-07-20

I’ve force-updated this branch with the version kindly provided by @petterreinholdtsen. Thank you.


#12 – jepler 于 2022-07-21

I added a commit that fixes running on 64-bit platforms.


原始Issue: https://github.com/LinuxCNC/linuxcnc/pull/98

喜欢 (0)